From 3200faa2a2a16940e4f24e61af4c7cf3c4c67d7c Mon Sep 17 00:00:00 2001 From: Elyes Cherfa Date: Fri, 28 Mar 2025 17:35:34 +0100 Subject: [PATCH 1/6] Issue #35: Rebrand Codebase from Sentry Software to MetricsHub * Updated `pom.xml` & `site.xml` to change sentrysoftware occurrences by metricshub. * Upgraded some dependencies versions. * Updated `site.xml` to update the logo and upgrade the `sentry-maven-skin` version. * Updated chestyle.xml. * Tested that everything is working fine. --- .github/workflows/build.yml | 2 +- .github/workflows/deploy.yml | 2 +- .github/workflows/release.yml | 2 +- README.md | 10 +- checkstyle.origin.xml | 222 + checkstyle.xml | 60 +- pom.xml | 50 +- .../wbem/client/Utils.java | 210 +- .../wbem/client/WbemCimDataHandler.java | 368 +- .../wbem/client/WbemClient.java | 456 +- .../wbem/client/WbemExecutor.java | 386 +- .../wbem/client/WbemQueryResult.java | 104 +- .../wbem/client/WqlQuery.java | 274 +- .../exceptions/WqlQuerySyntaxException.java | 38 + .../wbem/javax/cim/CIMArgument.java | 202 +- .../wbem/javax/cim/CIMClass.java | 1148 ++- .../wbem/javax/cim/CIMClassProperty.java | 524 +- .../wbem/javax/cim/CIMDataType.java | 1472 ++-- .../wbem/javax/cim/CIMDateTime.java | 272 +- .../wbem/javax/cim/CIMDateTimeAbsolute.java | 806 +- .../wbem/javax/cim/CIMDateTimeInterval.java | 1128 ++- .../wbem/javax/cim/CIMElement.java | 294 +- .../wbem/javax/cim/CIMFlavor.java | 176 +- .../wbem/javax/cim/CIMInstance.java | 734 +- .../wbem/javax/cim/CIMMethod.java | 608 +- .../javax/cim/CIMNamedElementInterface.java | 120 +- .../wbem/javax/cim/CIMObjectPath.java | 1346 ++- .../wbem/javax/cim/CIMParameter.java | 460 +- .../wbem/javax/cim/CIMProperty.java | 336 +- .../cim/CIMQualifiedElementInterface.java | 246 +- .../wbem/javax/cim/CIMQualifier.java | 360 +- .../wbem/javax/cim/CIMQualifierType.java | 346 +- .../wbem/javax/cim/CIMScope.java | 224 +- .../wbem/javax/cim/CIMTypedElement.java | 252 +- .../wbem/javax/cim/CIMValuedElement.java | 308 +- .../wbem/javax/cim/UnsignedInteger16.java | 492 +- .../wbem/javax/cim/UnsignedInteger32.java | 490 +- .../wbem/javax/cim/UnsignedInteger64.java | 554 +- .../wbem/javax/cim/UnsignedInteger8.java | 496 +- .../wbem/javax/cim/package.html | 0 .../wbem/javax/wbem/CloseableIterator.java | 162 +- .../wbem/javax/wbem/WBEMException.java | 774 +- .../javax/wbem/client/EnumerateResponse.java | 234 +- .../javax/wbem/client/PasswordCredential.java | 270 +- .../javax/wbem/client/RoleCredential.java | 248 +- .../wbem/javax/wbem/client/RolePrincipal.java | 294 +- .../wbem/javax/wbem/client/UserPrincipal.java | 330 +- .../wbem/javax/wbem/client/WBEMClient.java | 4506 +++++----- .../wbem/client/WBEMClientConstants.java | 318 +- .../javax/wbem/client/WBEMClientFactory.java | 229 +- .../wbem/javax/wbem/client/package.html | 0 .../wbem/listener/IndicationListener.java | 138 +- .../javax/wbem/listener/WBEMListener.java | 246 +- .../wbem/listener/WBEMListenerConstants.java | 160 +- .../wbem/listener/WBEMListenerFactory.java | 214 +- .../wbem/javax/wbem/listener/package.html | 0 .../wbem/javax/wbem/package.html | 0 .../sblim/cimclient/CIMXMLTraceListener.java | 134 +- .../wbem/sblim/cimclient/GenericExts.java | 208 +- .../cimclient/IndicationListenerSBLIM.java | 152 +- .../sblim/cimclient/LogAndTraceManager.java | 438 +- .../wbem/sblim/cimclient/LogListener.java | 134 +- .../wbem/sblim/cimclient/TraceListener.java | 164 +- .../wbem/sblim/cimclient/WBEMClientSBLIM.java | 555 +- .../WBEMConfigurationProperties.java | 2306 +++-- .../sblim/cimclient/WBEMListenerSBLIM.java | 927 +- .../discovery/AdvertisementCatalog.java | 1119 ++- .../sblim/cimclient/discovery/Discoverer.java | 144 +- .../discovery/DiscovererFactory.java | 184 +- .../cimclient/discovery/WBEMProtocol.java | 286 +- .../discovery/WBEMServiceAdvertisement.java | 687 +- .../sblim/cimclient/discovery/package.html | 0 .../cimclient/doc-files/bestpractise.html | 0 .../cimclient/doc-files/configuration.html | 0 .../cimclient/doc-files/development.html | 0 .../sblim/cimclient/doc-files/discovery.html | 0 .../sblim/cimclient/doc-files/embedded.html | 0 .../sblim/cimclient/doc-files/firststeps.html | 0 .../sblim/cimclient/doc-files/history.html | 0 .../doc-files/indication_threading.png | Bin .../cimclient/doc-files/indications.html | 0 .../sblim/cimclient/doc-files/logging.html | 0 .../sblim/cimclient/doc-files/secure.html | 0 .../doc-files/secure_indications.html | 0 .../cimclient/doc-files/terminology.html | 0 .../sblim/cimclient/doc-files/unittest.html | 0 .../internal/cim/CIMElementSorter.java | 244 +- .../cimclient/internal/cim/CIMHelper.java | 695 +- .../internal/cim/CIMInstanceBuilder.java | 310 +- .../internal/cim/CIMOctetString.java | 966 +- .../cim/CIMQualifiedElementInterfaceImpl.java | 656 +- .../cimclient/internal/cim/CIMVersion.java | 314 +- .../internal/cim/DTStringReader.java | 414 +- .../internal/cim/DTStringWriter.java | 266 +- .../sblim/cimclient/internal/cim/package.html | 0 .../cimxml/CIMClientXML_HelperImpl.java | 5269 ++++++----- .../cimclient/internal/cimxml/CIMMessage.java | 396 +- .../cimclient/internal/cimxml/CIMRequest.java | 334 +- .../internal/cimxml/CIMResponse.java | 456 +- .../internal/cimxml/CIMXMLBuilderImpl.java | 4599 +++++----- .../internal/cimxml/CIMXMLParseException.java | 146 +- .../internal/cimxml/CIMXMLParserImpl.java | 7765 ++++++++--------- .../internal/cimxml/CimXmlSerializer.java | 784 +- .../internal/cimxml/LocalPathBuilder.java | 426 +- .../cimclient/internal/cimxml/TypedValue.java | 168 +- .../cimclient/internal/cimxml/package.html | 0 .../internal/cimxml/sax/CIMObjectFactory.java | 1182 ++- .../internal/cimxml/sax/EmbObjHandler.java | 699 +- .../internal/cimxml/sax/NodeConstIf.java | 1856 ++-- .../internal/cimxml/sax/NodeFactory.java | 982 ++- .../internal/cimxml/sax/NodePool.java | 320 +- .../internal/cimxml/sax/SAXHelper.java | 208 +- .../internal/cimxml/sax/SAXSession.java | 171 +- .../cimxml/sax/XMLDefaultHandlerImpl.java | 589 +- .../sax/node/AbstractArrayValueNode.java | 118 +- .../cimxml/sax/node/AbstractMessageNode.java | 136 +- .../sax/node/AbstractMethodCallNode.java | 415 +- .../cimxml/sax/node/AbstractMultiRspNode.java | 146 +- .../cimxml/sax/node/AbstractObjectNode.java | 126 +- .../sax/node/AbstractObjectPathNode.java | 116 +- .../sax/node/AbstractParamValueNode.java | 138 +- .../sax/node/AbstractParameterNode.java | 249 +- .../cimxml/sax/node/AbstractPathNode.java | 132 +- .../cimxml/sax/node/AbstractPropertyNode.java | 325 +- .../cimxml/sax/node/AbstractResponseNode.java | 116 +- .../sax/node/AbstractScalarValueNode.java | 122 +- .../sax/node/AbstractSimpleRspNode.java | 145 +- .../cimxml/sax/node/AbstractValueNode.java | 118 +- .../internal/cimxml/sax/node/ArrayIf.java | 126 +- .../internal/cimxml/sax/node/CIMNode.java | 312 +- .../cimxml/sax/node/ClassNameNode.java | 241 +- .../internal/cimxml/sax/node/ClassNode.java | 365 +- .../cimxml/sax/node/ClassPathNode.java | 277 +- .../cimxml/sax/node/CorrelatorNode.java | 237 +- .../internal/cimxml/sax/node/ErrorIf.java | 114 +- .../internal/cimxml/sax/node/ErrorNode.java | 265 +- .../cimxml/sax/node/ExpMethodCallNode.java | 260 +- .../sax/node/ExpMethodResponseNode.java | 290 +- .../cimxml/sax/node/ExpParamValueNode.java | 246 +- .../internal/cimxml/sax/node/HostNode.java | 224 +- .../cimxml/sax/node/IMethodCallNode.java | 156 +- .../cimxml/sax/node/IMethodResponseNode.java | 409 +- .../cimxml/sax/node/IParamValueNode.java | 335 +- .../cimxml/sax/node/IReturnValueNode.java | 312 +- .../cimxml/sax/node/InstanceNameNode.java | 325 +- .../cimxml/sax/node/InstanceNode.java | 329 +- .../cimxml/sax/node/InstancePathNode.java | 295 +- .../cimxml/sax/node/KeyBindingNode.java | 257 +- .../cimxml/sax/node/KeyValueNode.java | 445 +- .../cimxml/sax/node/LocalClassPathNode.java | 269 +- .../sax/node/LocalInstancePathNode.java | 287 +- .../sax/node/LocalNameSpacePathNode.java | 279 +- .../internal/cimxml/sax/node/MessageNode.java | 270 +- .../cimxml/sax/node/MethodCallNode.java | 156 +- .../internal/cimxml/sax/node/MethodNode.java | 353 +- .../cimxml/sax/node/MethodResponseNode.java | 397 +- .../cimxml/sax/node/MultiExpReqNode.java | 208 +- .../cimxml/sax/node/MultiExpRspNode.java | 210 +- .../cimxml/sax/node/MultiReqNode.java | 226 +- .../cimxml/sax/node/MultiRspNode.java | 208 +- .../cimxml/sax/node/NameSpaceNode.java | 226 +- .../cimxml/sax/node/NameSpacePathNode.java | 286 +- .../internal/cimxml/sax/node/Node.java | 787 +- .../cimxml/sax/node/NonVolatileIf.java | 116 +- .../cimxml/sax/node/ObjectPathIf.java | 112 +- .../cimxml/sax/node/ObjectPathNode.java | 225 +- .../cimxml/sax/node/ParamValueNode.java | 361 +- .../cimxml/sax/node/ParameterArrayNode.java | 181 +- .../cimxml/sax/node/ParameterNode.java | 173 +- .../sax/node/ParameterRefArrayNode.java | 175 +- .../sax/node/ParameterReferenceNode.java | 163 +- .../cimxml/sax/node/PropertyArrayNode.java | 281 +- .../cimxml/sax/node/PropertyNode.java | 275 +- .../sax/node/PropertyReferenceNode.java | 239 +- .../cimxml/sax/node/QualiDeclNode.java | 443 +- .../cimxml/sax/node/QualifiedNodeHandler.java | 397 +- .../cimxml/sax/node/QualifierNode.java | 375 +- .../cimxml/sax/node/RetValPipeIf.java | 124 +- .../cimxml/sax/node/ReturnValueNode.java | 287 +- .../internal/cimxml/sax/node/ScopeNode.java | 258 +- .../cimxml/sax/node/SimpleExpReqNode.java | 214 +- .../cimxml/sax/node/SimpleExpRspNode.java | 261 +- .../cimxml/sax/node/SimpleReqNode.java | 242 +- .../cimxml/sax/node/SimpleRspNode.java | 285 +- .../internal/cimxml/sax/node/TypedIf.java | 112 +- .../cimxml/sax/node/ValueArrayNode.java | 311 +- .../internal/cimxml/sax/node/ValueIf.java | 114 +- .../sax/node/ValueInstanceWithPathNode.java | 295 +- .../sax/node/ValueNamedInstanceNode.java | 319 +- .../internal/cimxml/sax/node/ValueNode.java | 265 +- .../cimxml/sax/node/ValueNullNode.java | 229 +- .../cimxml/sax/node/ValueObjectNode.java | 251 +- .../node/ValueObjectWithLocalPathNode.java | 321 +- .../sax/node/ValueObjectWithPathNode.java | 313 +- .../cimxml/sax/node/ValueRefArrayNode.java | 283 +- .../cimxml/sax/node/ValueReferenceNode.java | 291 +- .../internal/cimxml/sax/node/package.html | 0 .../internal/cimxml/sax/package.html | 0 .../cimclient/internal/discovery/package.html | 0 .../internal/discovery/slp/DiscovererSLP.java | 510 +- .../slp/WBEMServiceAdvertisementSLP.java | 588 +- .../internal/discovery/slp/package.html | 0 .../internal/http/AuthorizationHandler.java | 240 +- .../internal/http/AuthorizationInfo.java | 1028 ++- .../internal/http/BASE64Encoder.java | 284 +- .../cimclient/internal/http/Challenge.java | 562 +- .../cimclient/internal/http/HttpClient.java | 2578 +++--- .../internal/http/HttpClientMethod.java | 400 +- .../internal/http/HttpClientPool.java | 662 +- .../internal/http/HttpConnectionHandler.java | 570 +- .../internal/http/HttpContentHandler.java | 158 +- .../internal/http/HttpException.java | 232 +- .../cimclient/internal/http/HttpHeader.java | 1073 ++- .../internal/http/HttpHeaderParser.java | 488 +- .../cimclient/internal/http/HttpMethod.java | 238 +- .../internal/http/HttpParseException.java | 142 +- .../internal/http/HttpServerConnection.java | 886 +- .../internal/http/HttpServerMethod.java | 356 +- .../internal/http/HttpServerWorker.java | 166 +- .../internal/http/HttpSocketFactory.java | 992 ++- .../internal/http/HttpUrlConnection.java | 540 +- .../internal/http/MessageReader.java | 402 +- .../internal/http/MessageWriter.java | 400 +- .../internal/http/PegasusLocalAuthInfo.java | 362 +- .../cimclient/internal/http/WwwAuthInfo.java | 720 +- .../internal/http/io/ASCIIPrintStream.java | 856 +- .../internal/http/io/BoundedInputStream.java | 310 +- .../internal/http/io/ChunkedInputStream.java | 432 +- .../internal/http/io/ChunkedOutputStream.java | 244 +- .../internal/http/io/DebugInputStream.java | 342 +- .../http/io/KeepAliveInputStream.java | 236 +- .../http/io/PersistentInputStream.java | 184 +- .../http/io/PersistentOutputStream.java | 182 +- .../internal/http/io/TrailerException.java | 159 +- .../cimclient/internal/http/io/package.html | 0 .../cimclient/internal/http/package.html | 0 .../internal/logging/LogAndTraceBroker.java | 1912 ++-- .../internal/logging/LogFormatter.java | 166 +- .../internal/logging/MessageLoader.java | 278 +- .../cimclient/internal/logging/Messages.java | 502 +- .../cimclient/internal/logging/TimeStamp.java | 238 +- .../internal/logging/TraceFormatter.java | 188 +- .../cimclient/internal/logging/package.html | 0 .../sblim/cimclient/internal/package.html | 0 .../internal/pullparser/XMLPullParser.java | 2542 +++--- .../pullparser/XMLPullParserException.java | 152 +- .../internal/pullparser/package.html | 0 .../cimclient/internal/uri/Authority.java | 426 +- .../cimclient/internal/uri/BooleanValue.java | 260 +- .../cimclient/internal/uri/CharValue.java | 356 +- .../cimclient/internal/uri/DateTimeValue.java | 266 +- .../cimclient/internal/uri/IntegerValue.java | 668 +- .../cimclient/internal/uri/KeyValuePair.java | 250 +- .../cimclient/internal/uri/KeyValuePairs.java | 208 +- .../internal/uri/NamespaceHandle.java | 318 +- .../cimclient/internal/uri/NamespacePath.java | 328 +- .../cimclient/internal/uri/QuotedValue.java | 112 +- .../cimclient/internal/uri/RealValue.java | 384 +- .../internal/uri/ReferenceValue.java | 188 +- .../cimclient/internal/uri/StringValue.java | 266 +- .../sblim/cimclient/internal/uri/Test.java | 366 +- .../sblim/cimclient/internal/uri/URI.java | 740 +- .../cimclient/internal/uri/URIString.java | 730 +- .../sblim/cimclient/internal/uri/Value.java | 400 +- .../sblim/cimclient/internal/uri/package.html | 0 .../sblim/cimclient/internal/util/MOF.java | 1900 ++-- .../cimclient/internal/util/StringSorter.java | 192 +- .../cimclient/internal/util/ThreadPool.java | 692 +- .../sblim/cimclient/internal/util/Util.java | 278 +- .../internal/util/WBEMConfiguration.java | 2478 +++--- .../util/WBEMConfigurationDefaults.java | 732 +- .../internal/util/WBEMConstants.java | 388 +- .../cimclient/internal/util/XMLHostStr.java | 370 +- .../cimclient/internal/util/package.html | 0 .../cimclient/internal/wbem/CIMError.java | 392 +- .../internal/wbem/CloseableIteratorDOM.java | 400 +- .../wbem/CloseableIteratorGeneric.java | 222 +- .../internal/wbem/CloseableIteratorPULL.java | 447 +- .../internal/wbem/CloseableIteratorSAX.java | 346 +- .../internal/wbem/EnumerateResponseDOM.java | 272 +- .../internal/wbem/EnumerateResponsePULL.java | 272 +- .../internal/wbem/EnumerateResponseSAX.java | 280 +- .../internal/wbem/WBEMClientCIMXML.java | 5753 ++++++------ .../internal/wbem/indications/CIMEvent.java | 264 +- .../wbem/indications/CIMEventDispatcher.java | 415 +- .../indications/CIMIndicationHandler.java | 1659 ++-- .../wbem/indications/RIHandlerTest.txt | 0 .../ReliableIndicationHandler.java | 1319 ++- .../internal/wbem/indications/package.html | 0 .../wbem/operations/CIMAssociatorNamesOp.java | 242 +- .../wbem/operations/CIMAssociatorsOp.java | 318 +- .../wbem/operations/CIMCreateClassOp.java | 158 +- .../wbem/operations/CIMCreateInstanceOp.java | 160 +- .../wbem/operations/CIMCreateNameSpaceOp.java | 126 +- .../operations/CIMCreateQualifierTypeOp.java | 162 +- .../wbem/operations/CIMDeleteClassOp.java | 130 +- .../wbem/operations/CIMDeleteInstanceOp.java | 130 +- .../wbem/operations/CIMDeleteNameSpaceOp.java | 130 +- .../operations/CIMDeleteQualifierTypeOp.java | 130 +- .../wbem/operations/CIMEnumClassNamesOp.java | 158 +- .../wbem/operations/CIMEnumClassesOp.java | 238 +- .../operations/CIMEnumInstanceNamesOp.java | 130 +- .../wbem/operations/CIMEnumInstancesOp.java | 264 +- .../wbem/operations/CIMEnumNameSpaceOp.java | 128 +- .../operations/CIMEnumQualifierTypesOp.java | 130 +- .../wbem/operations/CIMExecQueryOp.java | 184 +- .../wbem/operations/CIMGetClassOp.java | 240 +- .../wbem/operations/CIMGetInstanceOp.java | 238 +- .../wbem/operations/CIMGetPropertyOp.java | 158 +- .../operations/CIMGetQualifierTypeOp.java | 158 +- .../wbem/operations/CIMInvokeMethodOp.java | 216 +- .../wbem/operations/CIMOperation.java | 264 +- .../wbem/operations/CIMReferenceNamesOp.java | 184 +- .../wbem/operations/CIMReferencesOp.java | 262 +- .../wbem/operations/CIMSetClassOp.java | 160 +- .../wbem/operations/CIMSetInstanceOp.java | 214 +- .../wbem/operations/CIMSetPropertyOp.java | 184 +- .../operations/CIMSetQualifierTypeOp.java | 162 +- .../operations/CIMSingleResultOperation.java | 142 +- .../internal/wbem/operations/package.html | 0 .../cimclient/internal/wbem/package.html | 0 .../wbem/sblim/cimclient/package.html | 0 .../wbem/sblim/slp/Advertiser.java | 258 +- .../wbem/sblim/slp/Locator.java | 554 +- .../wbem/sblim/slp/SLPConfigProperties.java | 920 +- .../sblim/slp/ServiceLocationAttribute.java | 810 +- .../ServiceLocationAttributeDescriptor.java | 330 +- .../slp/ServiceLocationAttributeVerifier.java | 308 +- .../sblim/slp/ServiceLocationEnumeration.java | 182 +- .../sblim/slp/ServiceLocationException.java | 522 +- .../sblim/slp/ServiceLocationManager.java | 242 +- .../wbem/sblim/slp/ServiceType.java | 540 +- .../wbem/sblim/slp/ServiceURL.java | 680 +- .../wbem/sblim/slp/TemplateRegistry.java | 284 +- .../sblim/slp/internal/AdvertiserImpl.java | 371 +- .../sblim/slp/internal/AttributeHandler.java | 256 +- .../wbem/sblim/slp/internal/Convert.java | 344 +- .../internal/IPv6MulticastAddressFactory.java | 336 +- .../wbem/sblim/slp/internal/Net.java | 214 +- .../wbem/sblim/slp/internal/SLPConfig.java | 1230 ++- .../wbem/sblim/slp/internal/SLPDefaults.java | 436 +- .../wbem/sblim/slp/internal/SLPLimits.java | 244 +- .../wbem/sblim/slp/internal/SLPString.java | 240 +- .../wbem/sblim/slp/internal/TRC.java | 604 +- .../slp/internal/msg/AttributeReply.java | 304 +- .../slp/internal/msg/AttributeRequest.java | 354 +- .../wbem/sblim/slp/internal/msg/DAAdvert.java | 404 +- .../sblim/slp/internal/msg/DADescriptor.java | 338 +- .../sblim/slp/internal/msg/FunctionIDs.java | 228 +- .../sblim/slp/internal/msg/MsgFactory.java | 456 +- .../sblim/slp/internal/msg/MsgHeader.java | 680 +- .../sblim/slp/internal/msg/ReplyMessage.java | 226 +- .../slp/internal/msg/RequestMessage.java | 412 +- .../wbem/sblim/slp/internal/msg/SAAdvert.java | 346 +- .../slp/internal/msg/SLPInputStream.java | 1006 ++- .../sblim/slp/internal/msg/SLPMessage.java | 445 +- .../slp/internal/msg/SLPOutputStream.java | 882 +- .../slp/internal/msg/SerializeOption.java | 110 +- .../internal/msg/ServiceAcknowledgment.java | 242 +- .../internal/msg/ServiceDeregistration.java | 332 +- .../slp/internal/msg/ServiceRegistration.java | 392 +- .../sblim/slp/internal/msg/ServiceReply.java | 368 +- .../slp/internal/msg/ServiceRequest.java | 376 +- .../slp/internal/msg/ServiceTypeReply.java | 286 +- .../slp/internal/msg/ServiceTypeRequest.java | 304 +- .../wbem/sblim/slp/internal/msg/Util.java | 130 +- .../wbem/sblim/slp/internal/package.html | 0 .../sblim/slp/internal/sa/DatagramThread.java | 246 +- .../sblim/slp/internal/sa/MessageTable.java | 510 +- .../sblim/slp/internal/sa/RecieverThread.java | 352 +- .../sblim/slp/internal/sa/ServiceAgent.java | 724 +- .../sblim/slp/internal/sa/ServiceTable.java | 840 +- .../wbem/sblim/slp/internal/sa/TCPThread.java | 232 +- .../wbem/sblim/slp/internal/ua/DACache.java | 348 +- .../slp/internal/ua/DatagramRequester.java | 836 +- .../sblim/slp/internal/ua/LocatorImpl.java | 282 +- .../sblim/slp/internal/ua/ResponseCache.java | 250 +- .../sblim/slp/internal/ua/ResultTable.java | 468 +- .../slp/internal/ua/SLEnumerationImpl.java | 512 +- .../sblim/slp/internal/ua/TCPRequester.java | 304 +- .../wbem/sblim/slp/package.html | 0 .../exceptions/WqlQuerySyntaxException.java | 40 - src/site/markdown/index.md | 10 +- src/site/resources/images/metricshub-logo.png | Bin 0 -> 6041 bytes .../resources/images/sentry-logo-179x75px.png | Bin 4321 -> 0 bytes src/site/site.xml | 8 +- .../wbem/WbemCimDataHandlerTest.java | 315 +- .../wbem/WbemClientTest.java | 326 +- .../wbem/WbemExecutorTest.java | 164 +- .../wbem/WqlQueryTest.java | 152 +- 390 files changed, 80616 insertions(+), 81195 deletions(-) create mode 100644 checkstyle.origin.xml rename src/main/java/org/{sentrysoftware => metricshub}/wbem/client/Utils.java (76%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/client/WbemCimDataHandler.java (81%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/client/WbemClient.java (76%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/client/WbemExecutor.java (81%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/client/WbemQueryResult.java (51%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/client/WqlQuery.java (79%) create mode 100644 src/main/java/org/metricshub/wbem/client/exceptions/WqlQuerySyntaxException.java rename src/main/java/org/{sentrysoftware => metricshub}/wbem/javax/cim/CIMArgument.java (80%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/javax/cim/CIMClass.java (92%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/javax/cim/CIMClassProperty.java (89%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/javax/cim/CIMDataType.java (92%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/javax/cim/CIMDateTime.java (84%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/javax/cim/CIMDateTimeAbsolute.java (91%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/javax/cim/CIMDateTimeInterval.java (93%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/javax/cim/CIMElement.java (84%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/javax/cim/CIMFlavor.java (75%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/javax/cim/CIMInstance.java (89%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/javax/cim/CIMMethod.java (88%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/javax/cim/CIMNamedElementInterface.java (67%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/javax/cim/CIMObjectPath.java (90%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/javax/cim/CIMParameter.java (86%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/javax/cim/CIMProperty.java (86%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/javax/cim/CIMQualifiedElementInterface.java (80%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/javax/cim/CIMQualifier.java (85%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/javax/cim/CIMQualifierType.java (85%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/javax/cim/CIMScope.java (78%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/javax/cim/CIMTypedElement.java (79%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/javax/cim/CIMValuedElement.java (83%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/javax/cim/UnsignedInteger16.java (88%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/javax/cim/UnsignedInteger32.java (88%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/javax/cim/UnsignedInteger64.java (89%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/javax/cim/UnsignedInteger8.java (88%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/javax/cim/package.html (100%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/javax/wbem/CloseableIterator.java (76%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/javax/wbem/WBEMException.java (90%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/javax/wbem/client/EnumerateResponse.java (76%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/javax/wbem/client/PasswordCredential.java (81%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/javax/wbem/client/RoleCredential.java (81%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/javax/wbem/client/RolePrincipal.java (81%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/javax/wbem/client/UserPrincipal.java (84%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/javax/wbem/client/WBEMClient.java (97%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/javax/wbem/client/WBEMClientConstants.java (85%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/javax/wbem/client/WBEMClientFactory.java (77%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/javax/wbem/client/package.html (100%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/javax/wbem/listener/IndicationListener.java (70%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/javax/wbem/listener/WBEMListener.java (80%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/javax/wbem/listener/WBEMListenerConstants.java (76%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/javax/wbem/listener/WBEMListenerFactory.java (76%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/javax/wbem/listener/package.html (100%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/javax/wbem/package.html (100%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/CIMXMLTraceListener.java (68%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/GenericExts.java (75%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/IndicationListenerSBLIM.java (72%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/LogAndTraceManager.java (84%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/LogListener.java (67%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/TraceListener.java (73%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/WBEMClientSBLIM.java (88%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/WBEMConfigurationProperties.java (95%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/WBEMListenerSBLIM.java (88%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/discovery/AdvertisementCatalog.java (91%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/discovery/Discoverer.java (71%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/discovery/DiscovererFactory.java (69%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/discovery/WBEMProtocol.java (78%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/discovery/WBEMServiceAdvertisement.java (91%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/discovery/package.html (100%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/doc-files/bestpractise.html (100%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/doc-files/configuration.html (100%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/doc-files/development.html (100%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/doc-files/discovery.html (100%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/doc-files/embedded.html (100%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/doc-files/firststeps.html (100%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/doc-files/history.html (100%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/doc-files/indication_threading.png (100%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/doc-files/indications.html (100%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/doc-files/logging.html (100%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/doc-files/secure.html (100%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/doc-files/secure_indications.html (100%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/doc-files/terminology.html (100%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/doc-files/unittest.html (100%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cim/CIMElementSorter.java (78%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cim/CIMHelper.java (86%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cim/CIMInstanceBuilder.java (83%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cim/CIMOctetString.java (91%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cim/CIMQualifiedElementInterfaceImpl.java (82%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cim/CIMVersion.java (77%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cim/DTStringReader.java (84%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cim/DTStringWriter.java (76%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cim/package.html (100%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/CIMClientXML_HelperImpl.java (93%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/CIMMessage.java (78%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/CIMRequest.java (75%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/CIMResponse.java (80%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/CIMXMLBuilderImpl.java (93%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/CIMXMLParseException.java (65%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/CIMXMLParserImpl.java (95%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/CimXmlSerializer.java (89%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/LocalPathBuilder.java (82%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/TypedValue.java (63%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/package.html (100%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/CIMObjectFactory.java (86%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/EmbObjHandler.java (85%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/NodeConstIf.java (92%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/NodeFactory.java (89%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/NodePool.java (74%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/SAXHelper.java (65%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/SAXSession.java (64%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/XMLDefaultHandlerImpl.java (82%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractArrayValueNode.java (63%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractMessageNode.java (65%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractMethodCallNode.java (79%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractMultiRspNode.java (67%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractObjectNode.java (61%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractObjectPathNode.java (63%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractParamValueNode.java (64%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractParameterNode.java (76%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractPathNode.java (64%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractPropertyNode.java (78%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractResponseNode.java (62%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractScalarValueNode.java (65%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractSimpleRspNode.java (62%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractValueNode.java (63%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/ArrayIf.java (61%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/CIMNode.java (79%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/ClassNameNode.java (69%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/ClassNode.java (78%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/ClassPathNode.java (77%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/CorrelatorNode.java (70%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/ErrorIf.java (58%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/ErrorNode.java (75%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/ExpMethodCallNode.java (74%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/ExpMethodResponseNode.java (76%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/ExpParamValueNode.java (73%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/HostNode.java (71%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/IMethodCallNode.java (72%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/IMethodResponseNode.java (82%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/IParamValueNode.java (78%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/IReturnValueNode.java (81%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/InstanceNameNode.java (78%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/InstanceNode.java (74%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/InstancePathNode.java (77%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/KeyBindingNode.java (74%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/KeyValueNode.java (78%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/LocalClassPathNode.java (77%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/LocalInstancePathNode.java (76%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/LocalNameSpacePathNode.java (76%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/MessageNode.java (78%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/MethodCallNode.java (73%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/MethodNode.java (79%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/MethodResponseNode.java (82%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/MultiExpReqNode.java (74%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/MultiExpRspNode.java (74%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/MultiReqNode.java (74%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/MultiRspNode.java (73%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/NameSpaceNode.java (71%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/NameSpacePathNode.java (78%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/Node.java (87%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/NonVolatileIf.java (63%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/ObjectPathIf.java (58%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/ObjectPathNode.java (73%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/ParamValueNode.java (80%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/ParameterArrayNode.java (69%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/ParameterNode.java (69%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/ParameterRefArrayNode.java (71%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/ParameterReferenceNode.java (68%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/PropertyArrayNode.java (75%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/PropertyNode.java (74%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/PropertyReferenceNode.java (73%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/QualiDeclNode.java (80%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/QualifiedNodeHandler.java (80%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/QualifierNode.java (79%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/RetValPipeIf.java (62%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/ReturnValueNode.java (77%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/ScopeNode.java (75%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/SimpleExpReqNode.java (74%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/SimpleExpRspNode.java (75%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/SimpleReqNode.java (76%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/SimpleRspNode.java (77%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/TypedIf.java (59%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueArrayNode.java (77%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueIf.java (62%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueInstanceWithPathNode.java (73%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueNamedInstanceNode.java (76%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueNode.java (75%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueNullNode.java (68%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueObjectNode.java (74%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueObjectWithLocalPathNode.java (79%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueObjectWithPathNode.java (78%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueRefArrayNode.java (76%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueReferenceNode.java (79%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/node/package.html (100%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/cimxml/sax/package.html (100%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/discovery/package.html (100%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/discovery/slp/DiscovererSLP.java (81%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/discovery/slp/WBEMServiceAdvertisementSLP.java (83%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/discovery/slp/package.html (100%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/http/AuthorizationHandler.java (78%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/http/AuthorizationInfo.java (87%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/http/BASE64Encoder.java (81%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/http/Challenge.java (88%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/http/HttpClient.java (93%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/http/HttpClientMethod.java (82%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/http/HttpClientPool.java (88%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/http/HttpConnectionHandler.java (86%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/http/HttpContentHandler.java (71%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/http/HttpException.java (74%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/http/HttpHeader.java (89%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/http/HttpHeaderParser.java (86%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/http/HttpMethod.java (77%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/http/HttpParseException.java (66%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/http/HttpServerConnection.java (89%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/http/HttpServerMethod.java (79%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/http/HttpServerWorker.java (65%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/http/HttpSocketFactory.java (91%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/http/HttpUrlConnection.java (85%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/http/MessageReader.java (80%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/http/MessageWriter.java (79%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/http/PegasusLocalAuthInfo.java (79%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/http/WwwAuthInfo.java (90%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/http/io/ASCIIPrintStream.java (86%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/http/io/BoundedInputStream.java (79%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/http/io/ChunkedInputStream.java (83%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/http/io/ChunkedOutputStream.java (77%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/http/io/DebugInputStream.java (80%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/http/io/KeepAliveInputStream.java (73%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/http/io/PersistentInputStream.java (72%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/http/io/PersistentOutputStream.java (72%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/http/io/TrailerException.java (66%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/http/io/package.html (100%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/http/package.html (100%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/logging/LogAndTraceBroker.java (93%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/logging/LogFormatter.java (71%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/logging/MessageLoader.java (79%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/logging/Messages.java (82%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/logging/TimeStamp.java (77%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/logging/TraceFormatter.java (74%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/logging/package.html (100%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/package.html (100%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/pullparser/XMLPullParser.java (93%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/pullparser/XMLPullParserException.java (67%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/pullparser/package.html (100%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/uri/Authority.java (86%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/uri/BooleanValue.java (75%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/uri/CharValue.java (80%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/uri/DateTimeValue.java (72%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/uri/IntegerValue.java (88%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/uri/KeyValuePair.java (77%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/uri/KeyValuePairs.java (75%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/uri/NamespaceHandle.java (79%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/uri/NamespacePath.java (81%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/uri/QuotedValue.java (61%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/uri/RealValue.java (78%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/uri/ReferenceValue.java (64%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/uri/StringValue.java (74%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/uri/Test.java (86%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/uri/URI.java (89%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/uri/URIString.java (87%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/uri/Value.java (86%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/uri/package.html (100%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/util/MOF.java (90%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/util/StringSorter.java (74%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/util/ThreadPool.java (88%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/util/Util.java (82%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/util/WBEMConfiguration.java (94%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/util/WBEMConfigurationDefaults.java (88%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/util/WBEMConstants.java (82%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/util/XMLHostStr.java (81%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/util/package.html (100%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/wbem/CIMError.java (79%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/wbem/CloseableIteratorDOM.java (76%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/wbem/CloseableIteratorGeneric.java (71%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/wbem/CloseableIteratorPULL.java (75%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/wbem/CloseableIteratorSAX.java (73%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/wbem/EnumerateResponseDOM.java (75%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/wbem/EnumerateResponsePULL.java (76%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/wbem/EnumerateResponseSAX.java (77%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/wbem/WBEMClientCIMXML.java (94%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/wbem/indications/CIMEvent.java (75%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/wbem/indications/CIMEventDispatcher.java (83%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/wbem/indications/CIMIndicationHandler.java (89%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/wbem/indications/RIHandlerTest.txt (100%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/wbem/indications/ReliableIndicationHandler.java (92%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/wbem/indications/package.html (100%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/wbem/operations/CIMAssociatorNamesOp.java (72%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/wbem/operations/CIMAssociatorsOp.java (76%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/wbem/operations/CIMCreateClassOp.java (63%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/wbem/operations/CIMCreateInstanceOp.java (63%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/wbem/operations/CIMCreateNameSpaceOp.java (63%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/wbem/operations/CIMCreateQualifierTypeOp.java (65%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/wbem/operations/CIMDeleteClassOp.java (61%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/wbem/operations/CIMDeleteInstanceOp.java (61%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/wbem/operations/CIMDeleteNameSpaceOp.java (64%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/wbem/operations/CIMDeleteQualifierTypeOp.java (62%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumClassNamesOp.java (64%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumClassesOp.java (72%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumInstanceNamesOp.java (62%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumInstancesOp.java (74%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumNameSpaceOp.java (64%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumQualifierTypesOp.java (62%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/wbem/operations/CIMExecQueryOp.java (67%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/wbem/operations/CIMGetClassOp.java (73%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/wbem/operations/CIMGetInstanceOp.java (73%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/wbem/operations/CIMGetPropertyOp.java (65%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/wbem/operations/CIMGetQualifierTypeOp.java (65%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/wbem/operations/CIMInvokeMethodOp.java (69%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/wbem/operations/CIMOperation.java (71%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/wbem/operations/CIMReferenceNamesOp.java (67%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/wbem/operations/CIMReferencesOp.java (73%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/wbem/operations/CIMSetClassOp.java (63%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/wbem/operations/CIMSetInstanceOp.java (69%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/wbem/operations/CIMSetPropertyOp.java (67%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/wbem/operations/CIMSetQualifierTypeOp.java (65%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/wbem/operations/CIMSingleResultOperation.java (66%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/wbem/operations/package.html (100%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/internal/wbem/package.html (100%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/cimclient/package.html (100%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/slp/Advertiser.java (83%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/slp/Locator.java (91%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/slp/SLPConfigProperties.java (93%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/slp/ServiceLocationAttribute.java (90%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/slp/ServiceLocationAttributeDescriptor.java (82%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/slp/ServiceLocationAttributeVerifier.java (83%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/slp/ServiceLocationEnumeration.java (77%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/slp/ServiceLocationException.java (86%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/slp/ServiceLocationManager.java (78%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/slp/ServiceType.java (88%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/slp/ServiceURL.java (89%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/slp/TemplateRegistry.java (83%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/slp/internal/AdvertiserImpl.java (75%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/slp/internal/AttributeHandler.java (79%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/slp/internal/Convert.java (81%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/slp/internal/IPv6MulticastAddressFactory.java (77%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/slp/internal/Net.java (73%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/slp/internal/SLPConfig.java (91%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/slp/internal/SLPDefaults.java (81%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/slp/internal/SLPLimits.java (74%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/slp/internal/SLPString.java (78%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/slp/internal/TRC.java (85%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/slp/internal/msg/AttributeReply.java (78%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/slp/internal/msg/AttributeRequest.java (82%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/slp/internal/msg/DAAdvert.java (84%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/slp/internal/msg/DADescriptor.java (79%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/slp/internal/msg/FunctionIDs.java (69%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/slp/internal/msg/MsgFactory.java (84%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/slp/internal/msg/MsgHeader.java (86%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/slp/internal/msg/ReplyMessage.java (72%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/slp/internal/msg/RequestMessage.java (82%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/slp/internal/msg/SAAdvert.java (80%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/slp/internal/msg/SLPInputStream.java (88%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/slp/internal/msg/SLPMessage.java (79%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/slp/internal/msg/SLPOutputStream.java (86%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/slp/internal/msg/SerializeOption.java (61%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/slp/internal/msg/ServiceAcknowledgment.java (73%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/slp/internal/msg/ServiceDeregistration.java (80%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/slp/internal/msg/ServiceRegistration.java (82%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/slp/internal/msg/ServiceReply.java (81%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/slp/internal/msg/ServiceRequest.java (83%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/slp/internal/msg/ServiceTypeReply.java (78%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/slp/internal/msg/ServiceTypeRequest.java (80%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/slp/internal/msg/Util.java (64%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/slp/internal/package.html (100%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/slp/internal/sa/DatagramThread.java (72%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/slp/internal/sa/MessageTable.java (83%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/slp/internal/sa/RecieverThread.java (74%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/slp/internal/sa/ServiceAgent.java (78%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/slp/internal/sa/ServiceTable.java (85%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/slp/internal/sa/TCPThread.java (71%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/slp/internal/ua/DACache.java (80%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/slp/internal/ua/DatagramRequester.java (86%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/slp/internal/ua/LocatorImpl.java (72%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/slp/internal/ua/ResponseCache.java (76%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/slp/internal/ua/ResultTable.java (83%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/slp/internal/ua/SLEnumerationImpl.java (82%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/slp/internal/ua/TCPRequester.java (72%) rename src/main/java/org/{sentrysoftware => metricshub}/wbem/sblim/slp/package.html (100%) delete mode 100644 src/main/java/org/sentrysoftware/wbem/client/exceptions/WqlQuerySyntaxException.java create mode 100644 src/site/resources/images/metricshub-logo.png delete mode 100644 src/site/resources/images/sentry-logo-179x75px.png rename src/test/java/org/{sentrysoftware => metricshub}/wbem/WbemCimDataHandlerTest.java (90%) rename src/test/java/org/{sentrysoftware => metricshub}/wbem/WbemClientTest.java (89%) rename src/test/java/org/{sentrysoftware => metricshub}/wbem/WbemExecutorTest.java (92%) rename src/test/java/org/{sentrysoftware => metricshub}/wbem/WqlQueryTest.java (95%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 55aed6a..62baa53 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,7 +18,7 @@ on: jobs: build: - uses: sentrysoftware/workflows/.github/workflows/maven-build.yml@v3 + uses: metricshub/workflows/.github/workflows/maven-build.yml@v2 with: jdkVersion: "17" debug: ${{ github.event_name == 'workflow_dispatch' && inputs.debug }} diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 5a72abb..cf17156 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -10,7 +10,7 @@ on: jobs: deploy: - uses: sentrysoftware/workflows/.github/workflows/maven-central-deploy.yml@v3 + uses: metricshub/workflows/.github/workflows/maven-central-deploy.yml@v2 with: jdkVersion: "17" secrets: inherit diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 14d640c..ba8ec25 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,7 +18,7 @@ on: jobs: release: - uses: sentrysoftware/workflows/.github/workflows/maven-central-release.yml@v3 + uses: metricshub/workflows/.github/workflows/maven-central-release.yml@v2 with: releaseVersion: ${{ inputs.releaseVersion }} developmentVersion: ${{ inputs.developmentVersion }} diff --git a/README.md b/README.md index 62df03a..6845666 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@ # WBEM Java Client -![GitHub release (with filter)](https://img.shields.io/github/v/release/sentrysoftware/wbem) -![Build](https://img.shields.io/github/actions/workflow/status/sentrysoftware/wbem/deploy.yml) -![GitHub top language](https://img.shields.io/github/languages/top/sentrysoftware/wbem) -![License](https://img.shields.io/github/license/sentrysoftware/wbem) +![GitHub release (with filter)](https://img.shields.io/github/v/release/metricshub/wbem-java) +![Build](https://img.shields.io/github/actions/workflow/status/metricshub/wbem-java/deploy.yml) +![GitHub top language](https://img.shields.io/github/languages/top/metricshub/wbem-java) +![License](https://img.shields.io/github/license/metricshub/wbem-java) This project is a fork of the excellent [Standards Based Linux Instrumentation](https://sourceforge.net/projects/sblim/) ([see also](https://sblim.sourceforge.net/wiki/index.php/Main_Page)). -See **[Project Documentation](https://sentrysoftware.org/wbem)** and the [Javadoc](https://sentrysoftware.org/wbem/apidocs) for more information on how to use this library in your code. +See **[Project Documentation](https://metricshub.org/wbem-java)** and the [Javadoc](https://metricshub.org/wbem-java/apidocs) for more information on how to use this library in your code. The Web-Based Enterprise Management (WBEM) Java Client is a library that enables to: * Connect to a WBEM Server diff --git a/checkstyle.origin.xml b/checkstyle.origin.xml new file mode 100644 index 0000000..2098fe6 --- /dev/null +++ b/checkstyle.origin.xml @@ -0,0 +1,222 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/checkstyle.xml b/checkstyle.xml index 2098fe6..cf46deb 100644 --- a/checkstyle.xml +++ b/checkstyle.xml @@ -46,30 +46,18 @@ - + - - - - - - - - - - - - @@ -92,15 +80,8 @@ - - - - - - - @@ -123,19 +104,13 @@ - - - - - - @@ -143,33 +118,24 @@ - - - - - - - - - + - @@ -179,43 +145,21 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/pom.xml b/pom.xml index 438686f..1108870 100644 --- a/pom.xml +++ b/pom.xml @@ -2,24 +2,24 @@ 4.0.0 - org.sentrysoftware + org.metricshub oss-parent 2 - org.sentrysoftware - wbem + org.metricshub + wbem-java 1.1.00-SNAPSHOT WBEM Java Client WBEM Java Client - Sentry Software - https://sentrysoftware.com + MetricsHub + https://metricshub.com - https://sentrysoftware.org/wbem + https://metricshub.org/wbem 2023 @@ -32,40 +32,33 @@ GitHub - https://github.com/sentrysoftware/wbem/issues/ + https://github.com/MetricsHub/wbem-java/issues/ - scm:git:https://github.com/sentrysoftware/wbem.git - https://github.com/sentrysoftware/wbem + scm:git:https://github.com/MetricsHub/wbem-java.git + https://github.com/metricshub/wbem-java HEAD Bertrand Martin (@bertysentry) - bertrand@sentrysoftware.com + bertrand@metricshub.com maintainer Nassim BOUTEKEDJIRET (@NassimBtk) - nassim@sentrysoftware.com - - maintainer - - - - Kawtar Bakour (@KawtarBK9) - kawtar@sentrysoftware.com + nassim@metricshub.com maintainer Elyes Cherfa (@CherfaElyes) - elyes@sentrysoftware.com + elyes@metricshub.com maintainer @@ -126,30 +119,13 @@ ${maven.compiler.target} public true - org.sentrysoftware.wbem.javax.*:org.sentrysoftware.wbem.sblim.* + org.metricshub.wbem-java.javax.*:org.metricshub.wbem-java.sblim.* - - - - - - maven-site-plugin - - - org.sentrysoftware.maven - maven-skin-tools - 1.2.00 - - - - - - diff --git a/src/main/java/org/sentrysoftware/wbem/client/Utils.java b/src/main/java/org/metricshub/wbem/client/Utils.java similarity index 76% rename from src/main/java/org/sentrysoftware/wbem/client/Utils.java rename to src/main/java/org/metricshub/wbem/client/Utils.java index a1c27ff..835e14f 100644 --- a/src/main/java/org/sentrysoftware/wbem/client/Utils.java +++ b/src/main/java/org/metricshub/wbem/client/Utils.java @@ -1,106 +1,104 @@ -package org.sentrysoftware.wbem.client; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.time.LocalDateTime; -import java.time.OffsetDateTime; -import java.time.ZoneOffset; -import java.time.format.DateTimeFormatter; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -public class Utils { - - /** - * Check if the required argument is not null. - * - * @param argument - * @param name - * @throws IllegalArgumentException if the argument is null - */ - public static void checkNonNull(final T argument, final String name) { - if (argument == null) { - throw new IllegalArgumentException(name + " must not be null."); - } - } - - /** - * Default separator for array values - */ - public static final String DEFAULT_ARRAY_SEPARATOR = "|"; - - public static final String EMPTY = ""; - - /** - * Formatter/Parser of the first part of CIM_DATETIME - */ - public static final DateTimeFormatter WBEM_CIM_DATETIME_FORMATTER = DateTimeFormatter.ofPattern("yyyyMMddHHmmss"); - - /** - * Regex that matches with a CIM_DATETIME string format See - * https://docs.microsoft.com/en-us/windows/win32/wmisdk/cim-datetime - *
    - *
  • group(1): yyyymmddHHMMSS - *
  • group(2): optional fraction of seconds - *
  • group(3): timezone offset... in minutes (sigh) - */ - private static final Pattern CIM_DATETIME_PATTERN = Pattern - .compile("^([0-9]{14})(?:\\.([0-9]{3,6}))?([+-][0-9]{3})$"); - - /** - * Convert a String holding a CIM_DATETIME (i.e. a string in the form of - * yyyymmddHHMMSS.mmmmmmsUUU) to an OffsetDateTime object - * - * @param stringValue String value with a CIM_DATETIME - * @return OffsetDateTime instance - */ - public static OffsetDateTime convertCimDateTime(final String stringValue) { - - if (stringValue == null) { - return null; - } - - final Matcher dateTimeMatcher = CIM_DATETIME_PATTERN.matcher(stringValue); - if (!dateTimeMatcher.find()) { - throw new IllegalArgumentException("Not a valid CIM_DATETIME value: " + stringValue); - } - - // LocalDateTime - final LocalDateTime localDateTime = LocalDateTime.parse(dateTimeMatcher.group(1), WBEM_CIM_DATETIME_FORMATTER); - - // Note: we're not taking the milliseconds and microseconds into account from - // group(2) - - // Zone Offset - final String zoneOffset = dateTimeMatcher.group(3); - if (zoneOffset == null) { - throw new IllegalStateException( - "Unable to get the timezone offset from CIM_DATETIME value: " + stringValue); - } - final int secondsOffset = Integer.parseInt(zoneOffset) * 60; - final ZoneOffset offset = ZoneOffset.ofTotalSeconds(secondsOffset); - - return OffsetDateTime.of(localDateTime, offset); - } - -} +package org.metricshub.wbem.client; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.time.LocalDateTime; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.time.format.DateTimeFormatter; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class Utils { + + /** + * Check if the required argument is not null. + * + * @param argument + * @param name + * @throws IllegalArgumentException if the argument is null + */ + public static void checkNonNull(final T argument, final String name) { + if (argument == null) { + throw new IllegalArgumentException(name + " must not be null."); + } + } + + /** + * Default separator for array values + */ + public static final String DEFAULT_ARRAY_SEPARATOR = "|"; + + public static final String EMPTY = ""; + + /** + * Formatter/Parser of the first part of CIM_DATETIME + */ + public static final DateTimeFormatter WBEM_CIM_DATETIME_FORMATTER = DateTimeFormatter.ofPattern("yyyyMMddHHmmss"); + + /** + * Regex that matches with a CIM_DATETIME string format See + * https://docs.microsoft.com/en-us/windows/win32/wmisdk/cim-datetime + *
      + *
    • group(1): yyyymmddHHMMSS + *
    • group(2): optional fraction of seconds + *
    • group(3): timezone offset... in minutes (sigh) + */ + private static final Pattern CIM_DATETIME_PATTERN = Pattern + .compile("^([0-9]{14})(?:\\.([0-9]{3,6}))?([+-][0-9]{3})$"); + + /** + * Convert a String holding a CIM_DATETIME (i.e. a string in the form of + * yyyymmddHHMMSS.mmmmmmsUUU) to an OffsetDateTime object + * + * @param stringValue String value with a CIM_DATETIME + * @return OffsetDateTime instance + */ + public static OffsetDateTime convertCimDateTime(final String stringValue) { + + if (stringValue == null) { + return null; + } + + final Matcher dateTimeMatcher = CIM_DATETIME_PATTERN.matcher(stringValue); + if (!dateTimeMatcher.find()) { + throw new IllegalArgumentException("Not a valid CIM_DATETIME value: " + stringValue); + } + + // LocalDateTime + final LocalDateTime localDateTime = LocalDateTime.parse(dateTimeMatcher.group(1), WBEM_CIM_DATETIME_FORMATTER); + + // Note: we're not taking the milliseconds and microseconds into account from + // group(2) + + // Zone Offset + final String zoneOffset = dateTimeMatcher.group(3); + if (zoneOffset == null) { + throw new IllegalStateException( + "Unable to get the timezone offset from CIM_DATETIME value: " + stringValue); + } + final int secondsOffset = Integer.parseInt(zoneOffset) * 60; + final ZoneOffset offset = ZoneOffset.ofTotalSeconds(secondsOffset); + + return OffsetDateTime.of(localDateTime, offset); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/client/WbemCimDataHandler.java b/src/main/java/org/metricshub/wbem/client/WbemCimDataHandler.java similarity index 81% rename from src/main/java/org/sentrysoftware/wbem/client/WbemCimDataHandler.java rename to src/main/java/org/metricshub/wbem/client/WbemCimDataHandler.java index e97dfc3..538e136 100644 --- a/src/main/java/org/sentrysoftware/wbem/client/WbemCimDataHandler.java +++ b/src/main/java/org/metricshub/wbem/client/WbemCimDataHandler.java @@ -1,185 +1,183 @@ -package org.sentrysoftware.wbem.client; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.function.Function; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import org.sentrysoftware.wbem.javax.cim.CIMDataType; -import org.sentrysoftware.wbem.javax.cim.CIMDateTimeAbsolute; -import org.sentrysoftware.wbem.javax.cim.CIMDateTimeInterval; -import org.sentrysoftware.wbem.javax.cim.CIMInstance; -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; -import org.sentrysoftware.wbem.javax.cim.CIMProperty; - -/** - * Handler for CIMProperty conversion to string. - * - */ -public class WbemCimDataHandler { - - private WbemCimDataHandler() { } - - public static final String PATH_PROPERTY = "__Path"; - - private static final Map> CONVERT_MAP; - static { - final Map> map = new HashMap<>(); - map.put(CIMDataType.STRING, String::valueOf); - map.put(CIMDataType.BOOLEAN, String::valueOf); - map.put(CIMDataType.SINT8, String::valueOf); - map.put(CIMDataType.SINT16, String::valueOf); - map.put(CIMDataType.SINT32, String::valueOf); - map.put(CIMDataType.SINT64, String::valueOf); - map.put(CIMDataType.CHAR16, String::valueOf); - map.put(CIMDataType.REAL32, String::valueOf); - map.put(CIMDataType.REAL64, String::valueOf); - map.put(CIMDataType.OBJECT, String::valueOf); - map.put(CIMDataType.DATETIME, WbemCimDataHandler::convertDateTime); - map.put(CIMDataType.UINT8, String::valueOf); - map.put(CIMDataType.UINT16, String::valueOf); - map.put(CIMDataType.UINT32, String::valueOf); - map.put(CIMDataType.UINT64, String::valueOf); - map.put(CIMDataType.REFERENCE, WbemCimDataHandler::convertReference); - CONVERT_MAP = Collections.unmodifiableMap(map); - } - - /** - * Get the value of the CIM property. - * - * @param property The property name. - * @param cimInstance The CIM instance. - * @param arraySeparator The array separator value. default value '|' - * @return - */ - public static String getCimPropertyAsString( - final String property, - final CIMInstance cimInstance, - final String arraySeparator) { - Utils.checkNonNull(property, "property"); - Utils.checkNonNull(cimInstance, "cimInstance"); - - if (PATH_PROPERTY.equalsIgnoreCase(property)) { - final CIMObjectPath objectPath = cimInstance.getObjectPath(); - Utils.checkNonNull(objectPath, "objectPath"); - return convertReference(objectPath); - } - - // first check getProperty - CIMProperty cimProperty = cimInstance.getProperty(property); - - // then, if null, check getKeys - final String separator = arraySeparator == null? Utils.DEFAULT_ARRAY_SEPARATOR : arraySeparator; - if (cimProperty == null && cimInstance.getKeys() != null) { - return Stream.of(cimInstance.getKeys()) - .filter(key -> key.getName() != null && key.getName().equalsIgnoreCase(property)) - .findFirst() - .map(cp -> convertCimPropertyValue(cp, separator)) - .orElse(Utils.EMPTY); - } - - return cimProperty == null ? - Utils.EMPTY : convertCimPropertyValue(cimProperty, separator); - } - - /** - * Convert the CIM property value into a String. - * - * @param cimProperty The CIM property. - * @param arraySeparator The array separator value. - * @return - */ - private static String convertCimPropertyValue( - final CIMProperty cimProperty, - final String arraySeparator) { - final Object cimPropertyValue = cimProperty.getValue(); - if (cimPropertyValue == null) { - return Utils.EMPTY; - } - - final CIMDataType dataType = cimProperty.getDataType(); - if (dataType == null) { - return cimPropertyValue.toString(); - } - - return dataType.isArray() ? - convertArray(cimProperty, arraySeparator) : - CONVERT_MAP.getOrDefault(dataType.getType(), Object::toString).apply(cimPropertyValue); - } - - /** - * Convert a CIM property value array. - * - * @param cimProperty The CIM property. - * @param arraySeparator The array separator value. - * @return - */ - private static String convertArray( - final CIMProperty cimProperty, - final String arraySeparator) { - return Arrays.stream((Object[]) cimProperty.getValue()) - .map(obj -> (obj == null) ? Utils.EMPTY : CONVERT_MAP.getOrDefault(cimProperty.getDataType().getType(), Object::toString).apply(obj)) - .collect(Collectors.joining(arraySeparator, Utils.EMPTY, arraySeparator)); - } - - /** - * Convert a CIMObjectPath reference to string: - *
    • take the part after ':'
    • - *
    • escape back slash
    • - *
    • escape double quotes
    • - * - * @param cimPropertyValue - * @return - */ - private static String convertReference(final Object cimPropertyValue) { - final CIMObjectPath objectPath = (CIMObjectPath) cimPropertyValue; - final String str = objectPath.toString(); - return str - .substring(str.indexOf(':') + 1) // take the part after : (if exists) - .replace("\\\\", "\\") // Replace \\ by \ - .replace("\\\"", "\""); // Replace \" by " - } - - /** - * Convert a CIMDateTime into a string containing to Epoch time milliseconds. - * - * @param cimPropertyValue - * @return - */ - private static String convertDateTime(final Object cimPropertyValue) { - if (cimPropertyValue == null) { - return Utils.EMPTY; - } - - if (cimPropertyValue instanceof CIMDateTimeAbsolute) { - final String dateTimeString = ((CIMDateTimeAbsolute) cimPropertyValue).getDateTimeString(); - return String.valueOf(Utils.convertCimDateTime(dateTimeString).toInstant().toEpochMilli()); - } - return String.valueOf(((CIMDateTimeInterval) cimPropertyValue).getTotalMilliseconds()); - } -} +package org.metricshub.wbem.client; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import org.metricshub.wbem.javax.cim.CIMDataType; +import org.metricshub.wbem.javax.cim.CIMDateTimeAbsolute; +import org.metricshub.wbem.javax.cim.CIMDateTimeInterval; +import org.metricshub.wbem.javax.cim.CIMInstance; +import org.metricshub.wbem.javax.cim.CIMObjectPath; +import org.metricshub.wbem.javax.cim.CIMProperty; + +/** + * Handler for CIMProperty conversion to string. + * + */ +public class WbemCimDataHandler { + + private WbemCimDataHandler() { } + + public static final String PATH_PROPERTY = "__Path"; + + private static final Map> CONVERT_MAP; + static { + final Map> map = new HashMap<>(); + map.put(CIMDataType.STRING, String::valueOf); + map.put(CIMDataType.BOOLEAN, String::valueOf); + map.put(CIMDataType.SINT8, String::valueOf); + map.put(CIMDataType.SINT16, String::valueOf); + map.put(CIMDataType.SINT32, String::valueOf); + map.put(CIMDataType.SINT64, String::valueOf); + map.put(CIMDataType.CHAR16, String::valueOf); + map.put(CIMDataType.REAL32, String::valueOf); + map.put(CIMDataType.REAL64, String::valueOf); + map.put(CIMDataType.OBJECT, String::valueOf); + map.put(CIMDataType.DATETIME, WbemCimDataHandler::convertDateTime); + map.put(CIMDataType.UINT8, String::valueOf); + map.put(CIMDataType.UINT16, String::valueOf); + map.put(CIMDataType.UINT32, String::valueOf); + map.put(CIMDataType.UINT64, String::valueOf); + map.put(CIMDataType.REFERENCE, WbemCimDataHandler::convertReference); + CONVERT_MAP = Collections.unmodifiableMap(map); + } + + /** + * Get the value of the CIM property. + * + * @param property The property name. + * @param cimInstance The CIM instance. + * @param arraySeparator The array separator value. default value '|' + * @return + */ + public static String getCimPropertyAsString( + final String property, + final CIMInstance cimInstance, + final String arraySeparator) { + Utils.checkNonNull(property, "property"); + Utils.checkNonNull(cimInstance, "cimInstance"); + + if (PATH_PROPERTY.equalsIgnoreCase(property)) { + final CIMObjectPath objectPath = cimInstance.getObjectPath(); + Utils.checkNonNull(objectPath, "objectPath"); + return convertReference(objectPath); + } + + // first check getProperty + CIMProperty cimProperty = cimInstance.getProperty(property); + + // then, if null, check getKeys + final String separator = arraySeparator == null? Utils.DEFAULT_ARRAY_SEPARATOR : arraySeparator; + if (cimProperty == null && cimInstance.getKeys() != null) { + return Stream.of(cimInstance.getKeys()) + .filter(key -> key.getName() != null && key.getName().equalsIgnoreCase(property)) + .findFirst() + .map(cp -> convertCimPropertyValue(cp, separator)) + .orElse(Utils.EMPTY); + } + + return cimProperty == null ? + Utils.EMPTY : convertCimPropertyValue(cimProperty, separator); + } + + /** + * Convert the CIM property value into a String. + * + * @param cimProperty The CIM property. + * @param arraySeparator The array separator value. + * @return + */ + private static String convertCimPropertyValue( + final CIMProperty cimProperty, + final String arraySeparator) { + final Object cimPropertyValue = cimProperty.getValue(); + if (cimPropertyValue == null) { + return Utils.EMPTY; + } + + final CIMDataType dataType = cimProperty.getDataType(); + if (dataType == null) { + return cimPropertyValue.toString(); + } + + return dataType.isArray() ? + convertArray(cimProperty, arraySeparator) : + CONVERT_MAP.getOrDefault(dataType.getType(), Object::toString).apply(cimPropertyValue); + } + + /** + * Convert a CIM property value array. + * + * @param cimProperty The CIM property. + * @param arraySeparator The array separator value. + * @return + */ + private static String convertArray( + final CIMProperty cimProperty, + final String arraySeparator) { + return Arrays.stream((Object[]) cimProperty.getValue()) + .map(obj -> (obj == null) ? Utils.EMPTY : CONVERT_MAP.getOrDefault(cimProperty.getDataType().getType(), Object::toString).apply(obj)) + .collect(Collectors.joining(arraySeparator, Utils.EMPTY, arraySeparator)); + } + + /** + * Convert a CIMObjectPath reference to string: + *
    • take the part after ':'
    • + *
    • escape back slash
    • + *
    • escape double quotes
    • + * + * @param cimPropertyValue + * @return + */ + private static String convertReference(final Object cimPropertyValue) { + final CIMObjectPath objectPath = (CIMObjectPath) cimPropertyValue; + final String str = objectPath.toString(); + return str + .substring(str.indexOf(':') + 1) // take the part after : (if exists) + .replace("\\\\", "\\") // Replace \\ by \ + .replace("\\\"", "\""); // Replace \" by " + } + + /** + * Convert a CIMDateTime into a string containing to Epoch time milliseconds. + * + * @param cimPropertyValue + * @return + */ + private static String convertDateTime(final Object cimPropertyValue) { + if (cimPropertyValue == null) { + return Utils.EMPTY; + } + + if (cimPropertyValue instanceof CIMDateTimeAbsolute) { + final String dateTimeString = ((CIMDateTimeAbsolute) cimPropertyValue).getDateTimeString(); + return String.valueOf(Utils.convertCimDateTime(dateTimeString).toInstant().toEpochMilli()); + } + return String.valueOf(((CIMDateTimeInterval) cimPropertyValue).getTotalMilliseconds()); + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/client/WbemClient.java b/src/main/java/org/metricshub/wbem/client/WbemClient.java similarity index 76% rename from src/main/java/org/sentrysoftware/wbem/client/WbemClient.java rename to src/main/java/org/metricshub/wbem/client/WbemClient.java index 6dfbdd7..1ed9248 100644 --- a/src/main/java/org/sentrysoftware/wbem/client/WbemClient.java +++ b/src/main/java/org/metricshub/wbem/client/WbemClient.java @@ -1,229 +1,227 @@ -package org.sentrysoftware.wbem.client; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.net.URL; -import java.util.ArrayList; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import javax.security.auth.Subject; - -import org.sentrysoftware.wbem.javax.cim.CIMInstance; -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; -import org.sentrysoftware.wbem.javax.cim.CIMProperty; -import org.sentrysoftware.wbem.javax.wbem.CloseableIterator; -import org.sentrysoftware.wbem.javax.wbem.WBEMException; -import org.sentrysoftware.wbem.javax.wbem.client.EnumerateResponse; -import org.sentrysoftware.wbem.javax.wbem.client.PasswordCredential; -import org.sentrysoftware.wbem.javax.wbem.client.UserPrincipal; -import org.sentrysoftware.wbem.javax.wbem.client.WBEMClient; -import org.sentrysoftware.wbem.javax.wbem.client.WBEMClientConstants; -import org.sentrysoftware.wbem.javax.wbem.client.WBEMClientFactory; - -/** - * Matsya WBEM client for query execution. - * - */ -public class WbemClient implements AutoCloseable { - - private static final Locale[] FIXED_AVAILABLE_LOCALES_ARRAY = {Locale.ENGLISH}; - - private WBEMClient client; - - private CloseableIterator iterator; - - /** - * Connect to WBEM client. - * - * @param url - * @param username - * @param password - * @param timeout - * @throws WBEMException - */ - public void connect( - final URL url, - final String username, - final char[] password, - int timeout) throws WBEMException { - - Utils.checkNonNull(url, "url"); - Utils.checkNonNull(username, "username"); - Utils.checkNonNull(password, "password"); - - final CIMObjectPath cimObjectPath = new CIMObjectPath( - url.getProtocol(), - url.getHost(), - String.valueOf(url.getPort()), - null, - null, - null); - - final Subject subject = new Subject(); - subject.getPrincipals().add(new UserPrincipal(username)); - subject.getPrivateCredentials().add(new PasswordCredential(password)); - - // Create and initialize a WBEM client. - client = WBEMClientFactory.getClient("CIM-XML"); - client.setProperty(WBEMClientConstants.PROP_TIMEOUT, String.valueOf(timeout)); - client.initialize(cimObjectPath, subject, FIXED_AVAILABLE_LOCALES_ARRAY); - } - - @Override - public void close() { - if (iterator != null) { - iterator.close(); - } - - if (client != null) { - client.close(); - } - } - - /** - * Execute a WQL query on remote. - * @param wqlQuery The query handler. - * @param namespace The WBEM namespace. - * @param arraySeparator The array separator value. default value '|' - * @return - * @throws WBEMException - */ - public WbemQueryResult executeWql( - final WqlQuery wqlQuery, - final String namespace, - final String arraySeparator) throws WBEMException { - - Utils.checkNonNull(wqlQuery, "wqlQuery"); - Utils.checkNonNull(namespace, "namespace"); - - if (client == null) { - throw new IllegalStateException("client must be connected first."); - } - - iterator = client.enumerateInstances( - new CIMObjectPath(null, null, null, namespace, wqlQuery.getClassName(), null), - true, - false, - true, - wqlQuery.getPropertiesArray()); - - return enumerateInstances(wqlQuery, iterator, arraySeparator); - } - - /** - * Get associators. - * @param wqlQuery The query handler. - * @param objectPathAssociators The object path for ASSOCIATORS. - * @param arraySeparator The array separator value. default value '|' - * @return - * @throws WBEMException - */ - public WbemQueryResult getAssociators( - final WqlQuery wqlQuery, - final String objectPathAssociators, - final String arraySeparator) throws WBEMException { - - Utils.checkNonNull(wqlQuery, "wqlQuery"); - Utils.checkNonNull(objectPathAssociators, "objectPathAssociators"); - - if (client == null) { - throw new IllegalStateException("client must be connected first."); - } - - final EnumerateResponse response = client.associators( - new CIMObjectPath(objectPathAssociators), - wqlQuery.getClassName(), - null, - null, - null, - false, - wqlQuery.getPropertiesArray(), - null, - null, - null, - false, - null); - iterator = response.getResponses(); - - return enumerateInstances(wqlQuery, iterator, arraySeparator); - } - - public static WbemQueryResult enumerateInstances( - final WqlQuery wqlQuery, - final CloseableIterator iterator, - final String arraySeparator) { - if (iterator == null) { - return new WbemQueryResult(new ArrayList<>(), new ArrayList<>()); - } - - Set properties = null; - List originalProperties = null; - final List> values = new ArrayList<>(); - - while (iterator.hasNext()) { - final CIMInstance cimInstance = iterator.next(); - - if (properties == null) { - properties = - wqlQuery.getProperties().isEmpty() ? - Stream.of(cimInstance.getProperties()) - .map(CIMProperty::getName) - .collect(Collectors.toCollection(LinkedHashSet::new)) : - wqlQuery.getProperties(); - } - - if (originalProperties == null) { - originalProperties = wqlQuery.hasDuplicateProperties() ? - wqlQuery.getOriginalProperties() : - properties.stream().collect(Collectors.toList()); - } - - final List row; - if (wqlQuery.hasDuplicateProperties()) { - - final Map cimProperties = properties.stream().collect(Collectors.toMap( - String::toLowerCase, - property -> WbemCimDataHandler.getCimPropertyAsString(property, cimInstance, arraySeparator))); - - row = originalProperties.stream() - .map(property -> cimProperties.get(property.toLowerCase())) - .collect(Collectors.toList()); - - } else { - row = properties.stream() - .map(property -> WbemCimDataHandler.getCimPropertyAsString(property, cimInstance, arraySeparator)) - .collect(Collectors.toList()); - } - - values.add(row); - } - - return new WbemQueryResult(originalProperties, values); - } -} +package org.metricshub.wbem.client; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.net.URL; +import java.util.ArrayList; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import javax.security.auth.Subject; + +import org.metricshub.wbem.javax.cim.CIMInstance; +import org.metricshub.wbem.javax.cim.CIMObjectPath; +import org.metricshub.wbem.javax.wbem.CloseableIterator; +import org.metricshub.wbem.javax.wbem.WBEMException; +import org.metricshub.wbem.javax.wbem.client.EnumerateResponse; +import org.metricshub.wbem.javax.wbem.client.PasswordCredential; +import org.metricshub.wbem.javax.wbem.client.UserPrincipal; +import org.metricshub.wbem.javax.wbem.client.WBEMClient; +import org.metricshub.wbem.javax.wbem.client.WBEMClientConstants; +import org.metricshub.wbem.javax.wbem.client.WBEMClientFactory; +import org.metricshub.wbem.javax.cim.CIMProperty; + +/** + * Matsya WBEM client for query execution. + * + */ +public class WbemClient implements AutoCloseable { + + private static final Locale[] FIXED_AVAILABLE_LOCALES_ARRAY = {Locale.ENGLISH}; + + private WBEMClient client; + + private CloseableIterator iterator; + + /** + * Connect to WBEM client. + * + * @param url + * @param username + * @param password + * @param timeout + * @throws WBEMException + */ + public void connect( + final URL url, + final String username, + final char[] password, + int timeout) throws WBEMException { + + Utils.checkNonNull(url, "url"); + Utils.checkNonNull(username, "username"); + Utils.checkNonNull(password, "password"); + + final CIMObjectPath cimObjectPath = new CIMObjectPath( + url.getProtocol(), + url.getHost(), + String.valueOf(url.getPort()), + null, + null, + null); + + final Subject subject = new Subject(); + subject.getPrincipals().add(new UserPrincipal(username)); + subject.getPrivateCredentials().add(new PasswordCredential(password)); + + // Create and initialize a WBEM client. + client = WBEMClientFactory.getClient("CIM-XML"); + client.setProperty(WBEMClientConstants.PROP_TIMEOUT, String.valueOf(timeout)); + client.initialize(cimObjectPath, subject, FIXED_AVAILABLE_LOCALES_ARRAY); + } + + @Override + public void close() { + if (iterator != null) { + iterator.close(); + } + + if (client != null) { + client.close(); + } + } + + /** + * Execute a WQL query on remote. + * @param wqlQuery The query handler. + * @param namespace The WBEM namespace. + * @param arraySeparator The array separator value. default value '|' + * @return + * @throws WBEMException + */ + public WbemQueryResult executeWql( + final WqlQuery wqlQuery, + final String namespace, + final String arraySeparator) throws WBEMException { + + Utils.checkNonNull(wqlQuery, "wqlQuery"); + Utils.checkNonNull(namespace, "namespace"); + + if (client == null) { + throw new IllegalStateException("client must be connected first."); + } + + iterator = client.enumerateInstances( + new CIMObjectPath(null, null, null, namespace, wqlQuery.getClassName(), null), + true, + false, + true, + wqlQuery.getPropertiesArray()); + + return enumerateInstances(wqlQuery, iterator, arraySeparator); + } + + /** + * Get associators. + * @param wqlQuery The query handler. + * @param objectPathAssociators The object path for ASSOCIATORS. + * @param arraySeparator The array separator value. default value '|' + * @return + * @throws WBEMException + */ + public WbemQueryResult getAssociators( + final WqlQuery wqlQuery, + final String objectPathAssociators, + final String arraySeparator) throws WBEMException { + + Utils.checkNonNull(wqlQuery, "wqlQuery"); + Utils.checkNonNull(objectPathAssociators, "objectPathAssociators"); + + if (client == null) { + throw new IllegalStateException("client must be connected first."); + } + + final EnumerateResponse response = client.associators( + new CIMObjectPath(objectPathAssociators), + wqlQuery.getClassName(), + null, + null, + null, + false, + wqlQuery.getPropertiesArray(), + null, + null, + null, + false, + null); + iterator = response.getResponses(); + + return enumerateInstances(wqlQuery, iterator, arraySeparator); + } + + public static WbemQueryResult enumerateInstances( + final WqlQuery wqlQuery, + final CloseableIterator iterator, + final String arraySeparator) { + if (iterator == null) { + return new WbemQueryResult(new ArrayList<>(), new ArrayList<>()); + } + + Set properties = null; + List originalProperties = null; + final List> values = new ArrayList<>(); + + while (iterator.hasNext()) { + final CIMInstance cimInstance = iterator.next(); + + if (properties == null) { + properties = + wqlQuery.getProperties().isEmpty() ? + Stream.of(cimInstance.getProperties()) + .map(CIMProperty::getName) + .collect(Collectors.toCollection(LinkedHashSet::new)) : + wqlQuery.getProperties(); + } + + if (originalProperties == null) { + originalProperties = wqlQuery.hasDuplicateProperties() ? + wqlQuery.getOriginalProperties() : + properties.stream().collect(Collectors.toList()); + } + + final List row; + if (wqlQuery.hasDuplicateProperties()) { + + final Map cimProperties = properties.stream().collect(Collectors.toMap( + String::toLowerCase, + property -> WbemCimDataHandler.getCimPropertyAsString(property, cimInstance, arraySeparator))); + + row = originalProperties.stream() + .map(property -> cimProperties.get(property.toLowerCase())) + .collect(Collectors.toList()); + + } else { + row = properties.stream() + .map(property -> WbemCimDataHandler.getCimPropertyAsString(property, cimInstance, arraySeparator)) + .collect(Collectors.toList()); + } + + values.add(row); + } + + return new WbemQueryResult(originalProperties, values); + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/client/WbemExecutor.java b/src/main/java/org/metricshub/wbem/client/WbemExecutor.java similarity index 81% rename from src/main/java/org/sentrysoftware/wbem/client/WbemExecutor.java rename to src/main/java/org/metricshub/wbem/client/WbemExecutor.java index b9212d9..08014b8 100644 --- a/src/main/java/org/sentrysoftware/wbem/client/WbemExecutor.java +++ b/src/main/java/org/metricshub/wbem/client/WbemExecutor.java @@ -1,194 +1,192 @@ -package org.sentrysoftware.wbem.client; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.net.URL; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; - -import org.sentrysoftware.wbem.client.exceptions.WqlQuerySyntaxException; -import org.sentrysoftware.wbem.javax.wbem.WBEMException; - -/** - * Functions to execute WBEM query. - * - */ -public class WbemExecutor { - - private WbemExecutor() { } - - /** - * Execute a WBEM query on remote. - * - * @param url The remote URL. - * @param namespace The WBEM namespace. - * @param username The user name. - * @param password The Password. - * @param query The WQL Query to execute. - * @param timeout Timeout in milliseconds. - * @param arraySeparator The array separator value. default value '|' - * @return - * @throws WqlQuerySyntaxException On WQL syntax errors. - * @throws WBEMException On WBEM errors. - * @throws TimeoutException To notify userName of timeout. - * @throws InterruptedException - */ - public static WbemQueryResult executeWql( - final URL url, - final String namespace, - final String username, - final char[] password, - final String query, - int timeout, - final String arraySeparator) - throws WqlQuerySyntaxException, - WBEMException, - TimeoutException, - InterruptedException { - return executeMethod( - url, - namespace, - username, - password, - query, - null, - timeout, - arraySeparator); - } - - /** - * Execute WBEM get associators on remote. - * - * @param url The remote URL. - * @param username The user name. - * @param password The Password. - * @param query The WQL Query to execute. - * @param objectPathAssociators The object path for ASSOCIATORS. - * @param timeout Timeout in milliseconds. - * @param arraySeparator The array separator value. default value '|' - * @return - * @throws WqlQuerySyntaxException On WQL syntax errors. - * @throws WBEMException On WBEM errors. - * @throws TimeoutException To notify userName of timeout. - * @throws InterruptedException - */ - public static WbemQueryResult getAssociators( - final URL url, - final String username, - final char[] password, - final String query, - final String objectPathAssociators, - int timeout, - final String arraySeparator) - throws WqlQuerySyntaxException, - WBEMException, - TimeoutException, - InterruptedException { - return executeMethod( - url, - null, - username, - password, - query, - objectPathAssociators, - timeout, - arraySeparator); - } - - /** - * Execute the WBEM method with timeout. - * - * @param url - * @param namespace - * @param username - * @param password - * @param query - * @param objectPathAssociators - * @param timeout - * @param arraySeparator - * @return - * @throws InterruptedException - * @throws TimeoutException - * @throws WBEMException - * @throws WqlQuerySyntaxException - */ - private static WbemQueryResult executeMethod( - final URL url, - final String namespace, - final String username, - final char[] password, - final String query, - final String objectPathAssociators, - int timeout, - final String arraySeparator) - throws InterruptedException, - TimeoutException, - WBEMException, - WqlQuerySyntaxException { - - Utils.checkNonNull(url, "url"); - Utils.checkNonNull(username, "username"); - Utils.checkNonNull(password, "password"); - - final WqlQuery wqlQuery = WqlQuery.parseQuery(query); - - final ExecutorService executor = Executors.newSingleThreadExecutor(); - - final Future future = executor.submit(() -> { - try (final WbemClient matsyaWbemClient = new WbemClient()) { - matsyaWbemClient.connect(url, username, password, timeout); - - return objectPathAssociators == null ? - matsyaWbemClient.executeWql(wqlQuery, namespace, arraySeparator) : - matsyaWbemClient.getAssociators(wqlQuery, objectPathAssociators, arraySeparator); - } - }); - - try { - return future.get(timeout, TimeUnit.MILLISECONDS); - - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - throw (InterruptedException) e; - - } catch (TimeoutException e) { - future.cancel(true); - throw e; - - } catch (ExecutionException e) { - if (e.getCause() instanceof WBEMException) { - throw (WBEMException) e.getCause(); - } - // else should be RunTimeException as matsyaWbemClient only thrown - // WBEMException as checked exceptions. - throw (RuntimeException) e.getCause(); - } - finally { - executor.shutdownNow(); - } - } -} +package org.metricshub.wbem.client; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.net.URL; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; + +import org.metricshub.wbem.client.exceptions.WqlQuerySyntaxException; +import org.metricshub.wbem.javax.wbem.WBEMException; + +/** + * Functions to execute WBEM query. + * + */ +public class WbemExecutor { + + private WbemExecutor() { } + + /** + * Execute a WBEM query on remote. + * + * @param url The remote URL. + * @param namespace The WBEM namespace. + * @param username The user name. + * @param password The Password. + * @param query The WQL Query to execute. + * @param timeout Timeout in milliseconds. + * @param arraySeparator The array separator value. default value '|' + * @return + * @throws WqlQuerySyntaxException On WQL syntax errors. + * @throws WBEMException On WBEM errors. + * @throws TimeoutException To notify userName of timeout. + * @throws InterruptedException + */ + public static WbemQueryResult executeWql( + final URL url, + final String namespace, + final String username, + final char[] password, + final String query, + int timeout, + final String arraySeparator) + throws WqlQuerySyntaxException, + WBEMException, + TimeoutException, + InterruptedException { + return executeMethod( + url, + namespace, + username, + password, + query, + null, + timeout, + arraySeparator); + } + + /** + * Execute WBEM get associators on remote. + * + * @param url The remote URL. + * @param username The user name. + * @param password The Password. + * @param query The WQL Query to execute. + * @param objectPathAssociators The object path for ASSOCIATORS. + * @param timeout Timeout in milliseconds. + * @param arraySeparator The array separator value. default value '|' + * @return + * @throws WqlQuerySyntaxException On WQL syntax errors. + * @throws WBEMException On WBEM errors. + * @throws TimeoutException To notify userName of timeout. + * @throws InterruptedException + */ + public static WbemQueryResult getAssociators( + final URL url, + final String username, + final char[] password, + final String query, + final String objectPathAssociators, + int timeout, + final String arraySeparator) + throws WqlQuerySyntaxException, + WBEMException, + TimeoutException, + InterruptedException { + return executeMethod( + url, + null, + username, + password, + query, + objectPathAssociators, + timeout, + arraySeparator); + } + + /** + * Execute the WBEM method with timeout. + * + * @param url + * @param namespace + * @param username + * @param password + * @param query + * @param objectPathAssociators + * @param timeout + * @param arraySeparator + * @return + * @throws InterruptedException + * @throws TimeoutException + * @throws WBEMException + * @throws WqlQuerySyntaxException + */ + private static WbemQueryResult executeMethod( + final URL url, + final String namespace, + final String username, + final char[] password, + final String query, + final String objectPathAssociators, + int timeout, + final String arraySeparator) + throws InterruptedException, + TimeoutException, + WBEMException, + WqlQuerySyntaxException { + + Utils.checkNonNull(url, "url"); + Utils.checkNonNull(username, "username"); + Utils.checkNonNull(password, "password"); + + final WqlQuery wqlQuery = WqlQuery.parseQuery(query); + + final ExecutorService executor = Executors.newSingleThreadExecutor(); + + final Future future = executor.submit(() -> { + try (final WbemClient matsyaWbemClient = new WbemClient()) { + matsyaWbemClient.connect(url, username, password, timeout); + + return objectPathAssociators == null ? + matsyaWbemClient.executeWql(wqlQuery, namespace, arraySeparator) : + matsyaWbemClient.getAssociators(wqlQuery, objectPathAssociators, arraySeparator); + } + }); + + try { + return future.get(timeout, TimeUnit.MILLISECONDS); + + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw (InterruptedException) e; + + } catch (TimeoutException e) { + future.cancel(true); + throw e; + + } catch (ExecutionException e) { + if (e.getCause() instanceof WBEMException) { + throw (WBEMException) e.getCause(); + } + // else should be RunTimeException as matsyaWbemClient only thrown + // WBEMException as checked exceptions. + throw (RuntimeException) e.getCause(); + } + finally { + executor.shutdownNow(); + } + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/client/WbemQueryResult.java b/src/main/java/org/metricshub/wbem/client/WbemQueryResult.java similarity index 51% rename from src/main/java/org/sentrysoftware/wbem/client/WbemQueryResult.java rename to src/main/java/org/metricshub/wbem/client/WbemQueryResult.java index 91b01c8..c402f41 100644 --- a/src/main/java/org/sentrysoftware/wbem/client/WbemQueryResult.java +++ b/src/main/java/org/metricshub/wbem/client/WbemQueryResult.java @@ -1,53 +1,51 @@ -package org.sentrysoftware.wbem.client; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.List; - -/** - * Wrapper class for WBEM query result. - * - */ -public class WbemQueryResult { - - /** List of the properties of the query. */ - private final List properties; - - /** Query results. */ - private final List> values; - - public WbemQueryResult( - final List properties, - final List> values) { - this.properties = properties; - this.values = values; - } - - public List getProperties() { - return properties; - } - - public List> getValues() { - return values; - } -} +package org.metricshub.wbem.client; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.List; + +/** + * Wrapper class for WBEM query result. + * + */ +public class WbemQueryResult { + + /** List of the properties of the query. */ + private final List properties; + + /** Query results. */ + private final List> values; + + public WbemQueryResult( + final List properties, + final List> values) { + this.properties = properties; + this.values = values; + } + + public List getProperties() { + return properties; + } + + public List> getValues() { + return values; + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/client/WqlQuery.java b/src/main/java/org/metricshub/wbem/client/WqlQuery.java similarity index 79% rename from src/main/java/org/sentrysoftware/wbem/client/WqlQuery.java rename to src/main/java/org/metricshub/wbem/client/WqlQuery.java index ec2405a..489326a 100644 --- a/src/main/java/org/sentrysoftware/wbem/client/WqlQuery.java +++ b/src/main/java/org/metricshub/wbem/client/WqlQuery.java @@ -1,138 +1,136 @@ -package org.sentrysoftware.wbem.client; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.HashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.Set; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import org.sentrysoftware.wbem.client.exceptions.WqlQuerySyntaxException; - -/** - * Handler for WQL query. - * - */ -public class WqlQuery { - - private WqlQuery() { } - - private static final String ID = "[^\\s]+"; - private static final String LIST_SEPARATOR = "\\s*,\\s*"; - - private static final Pattern CHECK_SELECT_PATTERN = Pattern.compile( - "^\\s*SELECT\\s+(\\*|(?!SELECT|FROM|WHERE)\\w+|((?!SELECT|FROM|WHERE)\\w+\\s*,\\s*)+((?!SELECT|FROM|WHERE)\\w+))\\s+FROM\\s+((?!SELECT|WHERE|FROM)\\w+)\\s*?$", - Pattern.CASE_INSENSITIVE); - - private static final Pattern EXTRACT_SELECT_PATTERN= Pattern.compile( - "^\\s*SELECT\\s+(.+)\\s+FROM\\s+("+ID+")\\s*$", - Pattern.CASE_INSENSITIVE); - private static final int SELECT_GROUP_CLASSNAME = 2; - private static final int SELECT_GROUP_FIELDS = 1; - private static final int SELECT_GROUP_COUNT = 2; - - private String className; - private Set properties; - private List originalProperties; - - /** - * Constructor for WQL query. - * - * @param query the WQL query. - * @throws WqlQuerySyntaxException On WQL Syntax exception. - */ - public static WqlQuery parseQuery(final String query) throws WqlQuerySyntaxException { - - Utils.checkNonNull(query, "query"); - - if (CHECK_SELECT_PATTERN.matcher(query).find()) { - final WqlQuery wqlQuery = new WqlQuery(); - wqlQuery.parseSelect(query); - return wqlQuery; - } - throw new WqlQuerySyntaxException(query); - } - - public String getClassName() { - return className; - } - - public String[] getPropertiesArray() { - return properties.isEmpty() ? - null : - properties.stream() - .filter(property -> !WbemCimDataHandler.PATH_PROPERTY.equalsIgnoreCase(property)) - .toArray(String[]::new); - } - - public Set getProperties() { - return properties; - } - - public List getOriginalProperties() { - return originalProperties; - } - - public boolean hasDuplicateProperties() { - return properties != null && originalProperties != null && properties.size() != originalProperties.size(); - } - - private void parseSelect( - final String query) throws WqlQuerySyntaxException { - - final Matcher matcher = EXTRACT_SELECT_PATTERN.matcher(query); - if (!matcher.find()) { - throw new WqlQuerySyntaxException(query); - } - if (matcher.groupCount() < SELECT_GROUP_COUNT) { - throw new WqlQuerySyntaxException(query); - } - - className = matcher.group(SELECT_GROUP_CLASSNAME); - - final String fieldsList = matcher.group(SELECT_GROUP_FIELDS); - final String[] fieldArray = Optional.ofNullable(fieldsList) - .filter(s -> !"*".equals(s)) - .map(s -> s.split(LIST_SEPARATOR)) - .orElse(new String[0]); - - originalProperties = Stream.of(fieldArray) - .map(String::trim) - .collect(Collectors.toList()); - - // using a map, so the properties will keep the case and the order of the query. - final Map originalMap = new HashMap<>(); - originalProperties.stream().forEach( - property -> originalMap.computeIfAbsent(property.toLowerCase(), prop -> property)); - - properties = originalProperties.stream() - .map(property -> originalMap.get(property.toLowerCase())) - .collect(Collectors.toCollection(LinkedHashSet::new)); - } -} +package org.metricshub.wbem.client; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.HashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import org.metricshub.wbem.client.exceptions.WqlQuerySyntaxException; + +/** + * Handler for WQL query. + * + */ +public class WqlQuery { + + private WqlQuery() { } + + private static final String ID = "[^\\s]+"; + private static final String LIST_SEPARATOR = "\\s*,\\s*"; + + private static final Pattern CHECK_SELECT_PATTERN = Pattern.compile( + "^\\s*SELECT\\s+(\\*|(?!SELECT|FROM|WHERE)\\w+|((?!SELECT|FROM|WHERE)\\w+\\s*,\\s*)+((?!SELECT|FROM|WHERE)\\w+))\\s+FROM\\s+((?!SELECT|WHERE|FROM)\\w+)\\s*?$", + Pattern.CASE_INSENSITIVE); + + private static final Pattern EXTRACT_SELECT_PATTERN= Pattern.compile( + "^\\s*SELECT\\s+(.+)\\s+FROM\\s+("+ID+")\\s*$", + Pattern.CASE_INSENSITIVE); + private static final int SELECT_GROUP_CLASSNAME = 2; + private static final int SELECT_GROUP_FIELDS = 1; + private static final int SELECT_GROUP_COUNT = 2; + + private String className; + private Set properties; + private List originalProperties; + + /** + * Constructor for WQL query. + * + * @param query the WQL query. + * @throws WqlQuerySyntaxException On WQL Syntax exception. + */ + public static WqlQuery parseQuery(final String query) throws WqlQuerySyntaxException { + + Utils.checkNonNull(query, "query"); + + if (CHECK_SELECT_PATTERN.matcher(query).find()) { + final WqlQuery wqlQuery = new WqlQuery(); + wqlQuery.parseSelect(query); + return wqlQuery; + } + throw new WqlQuerySyntaxException(query); + } + + public String getClassName() { + return className; + } + + public String[] getPropertiesArray() { + return properties.isEmpty() ? + null : + properties.stream() + .filter(property -> !WbemCimDataHandler.PATH_PROPERTY.equalsIgnoreCase(property)) + .toArray(String[]::new); + } + + public Set getProperties() { + return properties; + } + + public List getOriginalProperties() { + return originalProperties; + } + + public boolean hasDuplicateProperties() { + return properties != null && originalProperties != null && properties.size() != originalProperties.size(); + } + + private void parseSelect( + final String query) throws WqlQuerySyntaxException { + + final Matcher matcher = EXTRACT_SELECT_PATTERN.matcher(query); + if (!matcher.find()) { + throw new WqlQuerySyntaxException(query); + } + if (matcher.groupCount() < SELECT_GROUP_COUNT) { + throw new WqlQuerySyntaxException(query); + } + + className = matcher.group(SELECT_GROUP_CLASSNAME); + + final String fieldsList = matcher.group(SELECT_GROUP_FIELDS); + final String[] fieldArray = Optional.ofNullable(fieldsList) + .filter(s -> !"*".equals(s)) + .map(s -> s.split(LIST_SEPARATOR)) + .orElse(new String[0]); + + originalProperties = Stream.of(fieldArray) + .map(String::trim) + .collect(Collectors.toList()); + + // using a map, so the properties will keep the case and the order of the query. + final Map originalMap = new HashMap<>(); + originalProperties.stream().forEach( + property -> originalMap.computeIfAbsent(property.toLowerCase(), prop -> property)); + + properties = originalProperties.stream() + .map(property -> originalMap.get(property.toLowerCase())) + .collect(Collectors.toCollection(LinkedHashSet::new)); + } +} diff --git a/src/main/java/org/metricshub/wbem/client/exceptions/WqlQuerySyntaxException.java b/src/main/java/org/metricshub/wbem/client/exceptions/WqlQuerySyntaxException.java new file mode 100644 index 0000000..08c7189 --- /dev/null +++ b/src/main/java/org/metricshub/wbem/client/exceptions/WqlQuerySyntaxException.java @@ -0,0 +1,38 @@ +package org.metricshub.wbem.client.exceptions; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +/** + * Exception for a syntax error in the WQL Query parameter. + * + */ +public class WqlQuerySyntaxException extends Exception { + + private static final long serialVersionUID = 1L; + + public WqlQuerySyntaxException(final String wqlQuery) { + super("Syntax error in WQL Query: " + wqlQuery); + } + + public WqlQuerySyntaxException(final Throwable cause) { + super(cause); + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/javax/cim/CIMArgument.java b/src/main/java/org/metricshub/wbem/javax/cim/CIMArgument.java similarity index 80% rename from src/main/java/org/sentrysoftware/wbem/javax/cim/CIMArgument.java rename to src/main/java/org/metricshub/wbem/javax/cim/CIMArgument.java index 6c11b0d..fc076cb 100644 --- a/src/main/java/org/sentrysoftware/wbem/javax/cim/CIMArgument.java +++ b/src/main/java/org/metricshub/wbem/javax/cim/CIMArgument.java @@ -1,102 +1,100 @@ -/* - (C) Copyright IBM Corp. 2006, 2012 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-10-06 ebak Make SBLIM client JSR48 compliant - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2750520 2009-04-10 blaschke-oss Code cleanup from empty statement et al - * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics - * 2935258 2010-01-22 blaschke-oss Sync up javax.cim.* javadoc with JSR48 1.0.0 - * 2944839 2010-02-08 blaschke-oss Remove redundant toString() methods - * 3400209 2011-08-31 blaschke-oss Highlighted Static Analysis (PMD) issues - * 3565581 2012-09-07 blaschke-oss TCK: remove unnecessary overriding methods - */ - -package org.sentrysoftware.wbem.javax.cim; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -//Sync'd against JSR48 1.0.0 javadoc (build 1.5.0_10) on Wed Jan 20 02:20:58 EST 2010 -/** - * This class represents an instance of a CIMParameter used for a - * method invocation. A CIMArgument has a name, data type and - * value. A CIMArgument corresponds to a CIMParameter - * defined for a CIMMethod. - * - * @param - * Type parameter. - * - * @see CIMParameter - */ -public class CIMArgument extends CIMValuedElement { - - private static final long serialVersionUID = 4727439564059428267L; - - /** - * Constructs a CIMArgument to be used for method invocations. - * A CIMArgument corresponds to a CIMParameter. - * For each CIMParameter being populated during a method - * invocation a CIMArgument object must be created. - * - * @param pName - * Name of the CIM argument. - * @param pType - * CIMDataType of the argument. - * @param pValue - * Value of the argument. - * @throws IllegalArgumentException - * If the value does not match the type. - * @see CIMParameter - */ - public CIMArgument(String pName, CIMDataType pType, E pValue) throws IllegalArgumentException { - super(pName, pType, pValue); - } - - /** - * Compares this object against the specified object. The result is - * true if and only if the argument is not null - * and is a CIMArgument that represents the same name, type and - * value as this CIMArgument. - * - * @param pObj - * The object to compare with. - * @return true if the objects are the same; false - * otherwise. - */ - @Override - public boolean equals(Object pObj) { - if (!(pObj instanceof CIMArgument)) return false; - return super.equals(pObj); - } -} +/* + (C) Copyright IBM Corp. 2006, 2012 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-10-06 ebak Make SBLIM client JSR48 compliant + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2750520 2009-04-10 blaschke-oss Code cleanup from empty statement et al + * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics + * 2935258 2010-01-22 blaschke-oss Sync up javax.cim.* javadoc with JSR48 1.0.0 + * 2944839 2010-02-08 blaschke-oss Remove redundant toString() methods + * 3400209 2011-08-31 blaschke-oss Highlighted Static Analysis (PMD) issues + * 3565581 2012-09-07 blaschke-oss TCK: remove unnecessary overriding methods + */ + +package org.metricshub.wbem.javax.cim; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +//Sync'd against JSR48 1.0.0 javadoc (build 1.5.0_10) on Wed Jan 20 02:20:58 EST 2010 +/** + * This class represents an instance of a CIMParameter used for a + * method invocation. A CIMArgument has a name, data type and + * value. A CIMArgument corresponds to a CIMParameter + * defined for a CIMMethod. + * + * @param + * Type parameter. + * + * @see CIMParameter + */ +public class CIMArgument extends CIMValuedElement { + + private static final long serialVersionUID = 4727439564059428267L; + + /** + * Constructs a CIMArgument to be used for method invocations. + * A CIMArgument corresponds to a CIMParameter. + * For each CIMParameter being populated during a method + * invocation a CIMArgument object must be created. + * + * @param pName + * Name of the CIM argument. + * @param pType + * CIMDataType of the argument. + * @param pValue + * Value of the argument. + * @throws IllegalArgumentException + * If the value does not match the type. + * @see CIMParameter + */ + public CIMArgument(String pName, CIMDataType pType, E pValue) throws IllegalArgumentException { + super(pName, pType, pValue); + } + + /** + * Compares this object against the specified object. The result is + * true if and only if the argument is not null + * and is a CIMArgument that represents the same name, type and + * value as this CIMArgument. + * + * @param pObj + * The object to compare with. + * @return true if the objects are the same; false + * otherwise. + */ + @Override + public boolean equals(Object pObj) { + if (!(pObj instanceof CIMArgument)) return false; + return super.equals(pObj); + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/javax/cim/CIMClass.java b/src/main/java/org/metricshub/wbem/javax/cim/CIMClass.java similarity index 92% rename from src/main/java/org/sentrysoftware/wbem/javax/cim/CIMClass.java rename to src/main/java/org/metricshub/wbem/javax/cim/CIMClass.java index 24f06e5..30ea988 100644 --- a/src/main/java/org/sentrysoftware/wbem/javax/cim/CIMClass.java +++ b/src/main/java/org/metricshub/wbem/javax/cim/CIMClass.java @@ -1,575 +1,573 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-10-06 ebak Make SBLIM client JSR48 compliant - * 1669961 2006-04-16 lupusalex CIMTypedElement.getType() =>getDataType() - * 1737123 2007-06-15 ebak Differences to JSR48 public review draft - * 1783288 2007-09-10 ebak CIMClass.isAssociation() not working for retrieved classes. - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2750520 2009-04-10 blaschke-oss Code cleanup from empty statement et al - * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors - * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics - * 2823494 2009-08-03 rgummada Change Boolean constructor to static - * 2935258 2010-01-22 blaschke-oss Sync up javax.cim.* javadoc with JSR48 1.0.0 - * 2944842 2010-02-08 blaschke-oss Missing thrown ArrayIndexOutOfBoundsException - * 2975917 2010-03-24 blaschke-oss TCK: CIMClass.getProperty() does not handle null property - * 3400209 2011-08-31 blaschke-oss Highlighted Static Analysis (PMD) issues - * 3496301 2012-03-02 blaschke-oss Sync up javax.* javadoc with JSR48 1.0.0 Final - * 3500619 2012-03-16 blaschke-oss JSR48 1.0.0: CIMClass association/key clean up - * 3521119 2012-04-24 blaschke-oss JSR48 1.0.0: remove CIMObjectPath 2/3/4-parm ctors - * 3565581 2012-09-07 blaschke-oss TCK: remove unnecessary overriding methods - * 2719 2013-12-10 blaschke-oss TCK: CIM APIs should not generate NullPointerException - * 2716 2013-12-11 blaschke-oss Sync up javax.* javadoc with JSR48 1.0.0 Final V - */ - -package org.sentrysoftware.wbem.javax.cim; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.TreeSet; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cim.CIMElementSorter; -import org.sentrysoftware.wbem.sblim.cimclient.internal.cim.CIMQualifiedElementInterfaceImpl; -import org.sentrysoftware.wbem.sblim.cimclient.internal.util.MOF; - -//Sync'd against JSR48 1.0.0 javadoc (version 1.7.0_03) on Tue Dec 10 07:02:50 EST 2013 -/** - * This class represents a CIM class as defined by the Distributed Management - * Task Force (DMTF) CIM Infrastructure - * Specification (DSP004). A CIMClass has the following attributes: - *
        - *
      • an object path describing the location and name of the class
      • - *
      • superclass name (can be null if no superclass)
      • - *
      • an array of qualifiers for the class
      • - *
      • an array of properties
      • - *
      • an array of methods
      • - *
      - */ -public class CIMClass extends CIMElement implements CIMQualifiedElementInterface, - CIMNamedElementInterface { - - private static final long serialVersionUID = -5634561913210025100L; - - private CIMQualifiedElementInterfaceImpl iQualiImpl; - - private CIMObjectPath iObjPath; - - private String iSuperClass; - - private CIMClassProperty[] iProps; - - private CIMMethod[] iMethods; - - private boolean iIsKeyed; - - private boolean iIsAssoc; - - /** - * Creates and instantiates a Java object representing a CIM Class. This - * method may or may not validate the pIsAssociation and - * pIsKeyed parameters. If an invalid value is supplied (i.e. - * the class is an association, but the pIsAssociation was set - * to false), it may or may not be corrected. - * - * @param pPath - * Object Name of the CIM class. - * @param pSuperClass - * Name of the superclass. - * @param pQualifiers - * List of qualifiers of the CIM class. - * @param pProperties - * List of properties of the CIM class. - * @param pMethods - * List of methods of the CIM class. - * @param pIsAssociation - * true if the CIM class is an Association, - * false otherwise. - * @param pIsKeyed - * true if the CIM class has Keys, - * false otherwise. - * @throws IllegalArgumentException - * If pPath is null. - * - */ - public CIMClass(CIMObjectPath pPath, String pSuperClass, CIMQualifier[] pQualifiers, - CIMClassProperty[] pProperties, CIMMethod[] pMethods, boolean pIsAssociation, - boolean pIsKeyed) { - this(pPath, pSuperClass, pQualifiers, pProperties, pMethods); - // if (this.isAssociation() != pIsAssociation) { - // throw new IllegalArgumentException( - // "pIsAssociation does not match pQualifiers! pIsAssociation is " + - // pIsAssociation - // + " while pQualifiers " - // + (this.isAssociation() ? "contains" : "does not contain") - // + " qualifier with association in class " + - // this.iObjPath.getObjectName()); - // } - // if (this.isKeyed() != pIsKeyed) { - // throw new IllegalArgumentException( - // "pIsKeyed does not match pProperties! pIsKeyed is " + pIsKeyed - // + " while pProperties " - // + (this.isKeyed() ? "contains" : "does not contain") - // + " property with key qualifier in class " + - // this.iObjPath.getObjectName()); - // } - } - - /** - * Creates and instantiates a Java object representing a CIM Class. This - * constructor will inspect the class to determine if it is an association - * or has keys. - * - * @param pName - * Name of the CIM class. - * @param pSuperClass - * Name of the superclass. - * @param pQualifiers - * List of qualifiers of the CIM class. - * @param pProperties - * List of properties of the CIM class. - * @param pMethods - * List of methods of the CIM class. - * @throws IllegalArgumentException - * If pName is null. - */ - public CIMClass(String pName, String pSuperClass, CIMQualifier[] pQualifiers, - CIMClassProperty[] pProperties, CIMMethod[] pMethods) { - this(new CIMObjectPath(null, null, null, null, pName, null), pSuperClass, pQualifiers, - pProperties, pMethods); - } - - /** - * This private constructor does the actual work for the two public - * constructors and sets the iIsAssoc and iIsKeyed instance variables based - * on whether there is qualifier with name="Association" and value=true and - * a property with a qualifier with name="Key" and value=true, respectively. - */ - private CIMClass(CIMObjectPath pPath, String pSuperClass, CIMQualifier[] pQualifiers, - CIMClassProperty[] pProperties, CIMMethod[] pMethods) { - super(pPath == null ? null : pPath.getObjectName()); - this.iObjPath = pPath; - this.iSuperClass = pSuperClass; - this.iQualiImpl = new CIMQualifiedElementInterfaceImpl(pQualifiers); - this.iProps = (CIMClassProperty[]) CIMElementSorter.sort(pProperties); - this.iMethods = (CIMMethod[]) CIMElementSorter.sort(pMethods); - this.iIsAssoc = this.iQualiImpl.hasQualifierValue("Association", Boolean.TRUE); - this.iIsKeyed = hasKey(pProperties); - } - - /** - * Indicates whether the specified CIMClass is equal to this - * CIMClass. - * - * @param pObj - * The CIMClass object with which to compare. - * @return true if this object is the same as the - * pObj argument; false otherwise. - */ - @Override - public boolean equals(Object pObj) { - if (!(pObj instanceof CIMClass)) return false; - CIMClass that = (CIMClass) pObj; - if (!super.equals(that)) return false; - if (this.iSuperClass == null ? that.iSuperClass != null : !this.iSuperClass - .equalsIgnoreCase(that.iSuperClass)) return false; - if (!this.iQualiImpl.equals(that.iQualiImpl) || !Arrays.equals(this.iProps, that.iProps) - || !Arrays.equals(this.iMethods, that.iMethods) || this.iIsAssoc != that.iIsAssoc - || isKeyed() != that.isKeyed()) return false; - return true; - } - - /** - * This method returns a new CIMClass with properties filtered - * according to the input parameters. Inclusion of class origin and - * qualifiers can also be controlled. Methods will not be included in the - * class returned. - * - * @param pLocalOnly - * If true only the elements defined in this class - * are included; otherwise all elements are included. - * @param pIncludeQualifiers - * If true qualifiers are included on all elements; - * otherwise no qualifiers are included. - * @param pIncludeClassOrigin - * If true, the ClassOrigin attribute is included. - * @param pPropertyList - * If the PropertyList input parameter is not - * null, the members of the array define one or more - * Property names. The CIMClass returned does not - * include elements for any Properties missing from this list. If - * the PropertyList input parameter is an empty - * array this signifies that no Properties are included in the - * class returned. If the PropertyList input - * parameter is null this specifies that all - * Properties are included in the class returned. If the - * PropertyList contains duplicate elements or - * invalid property names, they are ignored. - * @return CIMClass matching the requested criteria. - */ - public CIMClass filterProperties(boolean pLocalOnly, boolean pIncludeQualifiers, - boolean pIncludeClassOrigin, String[] pPropertyList) { - ArrayList> newPropAList = new ArrayList>(); - // place pPropertyList into a set, for easy and fast search - TreeSet set; - if (pPropertyList != null) { - set = new TreeSet(); - for (int i = 0; i < pPropertyList.length; i++) - set.add(pPropertyList[i].toUpperCase()); - } else set = null; - for (int i = 0; i < getPropertyCount(); i++) { - CIMClassProperty refProp = getProperty(i); - if (pLocalOnly && refProp.isPropagated()) continue; - if (set == null || set.contains(refProp.getName().toUpperCase())) newPropAList - .add(new CIMClassProperty(refProp.getName(), refProp.getDataType(), - refProp.getValue(), - pIncludeQualifiers ? refProp.getQualifiers() : null, - pIncludeQualifiers ? refProp.isKey() : false, // FIXME: - // Should it depend on pIncludeQualifiers? - refProp.isPropagated(), pIncludeClassOrigin ? refProp.getOriginClass() - : null)); - } - return new CIMClass(getObjectPath(), getSuperClassName(), getQualifiers(), newPropAList - .toArray(new CIMClassProperty[0]), null, isAssociation(), isKeyed()); - } - - /** - * Returns a list of key properties for this CIM class. - * - * @return The list of CIM properties that are keys for this CIM class. - */ - public CIMClassProperty[] getKeys() { - ArrayList> keyAList = new ArrayList>(); - for (int i = 0; i < getPropertyCount(); i++) { - CIMClassProperty prop = getProperty(i); - if (prop.isKey()) keyAList.add(prop); - } - return keyAList.toArray(new CIMClassProperty[0]); - } - - /** - * Get a method by index. - * - * @param pIndex - * The index of the method to retrieve. - * @return The CIMMethod at the specified index. - * @throws ArrayIndexOutOfBoundsException - */ - public CIMMethod getMethod(int pIndex) throws ArrayIndexOutOfBoundsException { - return this.iMethods[pIndex]; - } - - /** - * Returns the specified CIM method in this CIM class. - * - * @param pName - * The string name of the method to retrieve. The name may be - * specified in the form "originClass.methodName". - * @return The CIM method specified or null if the method does - * not exist. - */ - - public CIMMethod getMethod(String pName) { - return getMethod(pName, null); - } - - /** - * Returns the CIM method specified by its name and optionally, its origin - * class. The origin class is the class in which the method is defined. - * - * @param pName - * The string name of the method to get. - * @param pOriginClass - * (Optional) The class in which the method was defined. - * @return The CIM method specified or null if the method does - * not exist. - */ - public CIMMethod getMethod(String pName, String pOriginClass) { - CIMMethod method = (CIMMethod) CIMElementSorter.find(this.iMethods, pName); - if (method == null) return null; - if (pOriginClass == null || pOriginClass.equalsIgnoreCase(method.getOriginClass())) return method; - return null; - } - - /** - * Get the number of methods defined in this CIM class. - * - * @return The number of methods defined in the CIM class. - */ - public int getMethodCount() { - return this.iMethods == null ? 0 : this.iMethods.length; - } - - /** - * Get the CIM methods defined in this CIM class. - * - * @return The methods in this CIM class. - */ - public CIMMethod[] getMethods() { - return this.iMethods != null ? this.iMethods : new CIMMethod[0]; - } - - /** - * This method returns the CIMObjectPath that represents this - * CIM class. - * - * @return The CIMObjectPath that represents this CIM class. - */ - public CIMObjectPath getObjectPath() { - return this.iObjPath; - } - - /** - * Get the properties defined for this CIM class. - * - * @return The properties for this class. - */ - public CIMClassProperty[] getProperties() { - return this.iProps != null ? this.iProps : new CIMClassProperty[0]; - } - - /** - * Get a class property by index. - * - * @param pIndex - * The index of the class property to retrieve. - * @return The CIMClassProperty at the specified index. - * @throws ArrayIndexOutOfBoundsException - */ - public CIMClassProperty getProperty(int pIndex) throws ArrayIndexOutOfBoundsException { - return this.iProps[pIndex]; - } - - /** - * Gets the specified property. - * - * @param pName - * The text string for the name of the property. - * @return The property requested or null if the property does - * not exist. - */ - public CIMClassProperty getProperty(String pName) { - return (CIMClassProperty) CIMElementSorter.find(this.iProps, pName); - } - - /** - * Gets the specified property. - * - * @param pName - * The string name of the property to get. - * @param pOriginClass - * (Optional) The string name of the class in which the property - * was defined. - * @return The property requested or null if the property does - * not exist. - */ - public CIMClassProperty getProperty(String pName, String pOriginClass) { - CIMClassProperty prop = (CIMClassProperty) CIMElementSorter.find(this.iProps, pName); - if (prop == null || pOriginClass == null) return prop; - return pOriginClass.equalsIgnoreCase(prop.getOriginClass()) ? prop : null; - } - - /** - * Get the number of properties defined in this CIMClass. - * - * @return The number of properties defined in the CIMClass. - */ - public int getPropertyCount() { - return this.iProps != null ? this.iProps.length : 0; - } - - /** - * Get a qualifier by index. - * - * @param pIndex - * The index of the qualifier to retrieve. - * @return The qualifier at the specified index. - * @throws ArrayIndexOutOfBoundsException - */ - public CIMQualifier getQualifier(int pIndex) throws ArrayIndexOutOfBoundsException { - return this.iQualiImpl.getQualifier(pIndex); - } - - /** - * Gets a qualifier by name. - * - * @param pName - * The name of the qualifier to get. - * @return The qualifier requested or null if the qualifier - * does not exist. - */ - public CIMQualifier getQualifier(String pName) { - return this.iQualiImpl.getQualifier(pName); - } - - /** - * Get the number of qualifiers defined in this CIM class. - * - * @return The number of qualifiers defined in the CIM class. - */ - public int getQualifierCount() { - return this.iQualiImpl.getQualifierCount(); - } - - /** - * Returns the list of qualifiers for the CIM class. - * - * @return Qualifiers for this class. - */ - public CIMQualifier[] getQualifiers() { - return this.iQualiImpl.getQualifiers(); - } - - /** - * Gets a qualifier value by name. - * - * @param pName - * The name of the qualifier to get. - * @return null if the qualifier does not exist or value is - * null, otherwise returns the reference to the - * qualifier. - */ - public Object getQualifierValue(String pName) { - return this.iQualiImpl.getQualifierValue(pName); - } - - /** - * Gets the name of the parent of this CIM class. - * - * @return The name of the parent class. - */ - public String getSuperClassName() { - return this.iSuperClass; - } - - /** - * Checks whether the specified qualifier is one of the qualifiers in this - * CIM class. - * - * @param pName - * The name of the qualifier. - * @return true if the qualifier exists in this CIM class, - * otherwise false. - */ - public boolean hasQualifier(String pName) { - return this.iQualiImpl.hasQualifier(pName); - } - - /** - * Checks whether the specified qualifier is one of the qualifiers defined - * for this class with the specified value. This method will return - * false if the qualifier is not applied or if the value does - * not match. - * - * @param pName - * The name of the qualifier. - * @param pValue - * The value to be tested. - * @return true if the qualifier exists and has the value, - * otherwise false. - */ - public boolean hasQualifierValue(String pName, Object pValue) { - return this.iQualiImpl.hasQualifierValue(pName, pValue); - } - - /** - * Identifies whether or not this CIM class is an association. An - * association is a relationship between two or more classes or instances of - * two or more classes. The properties of an association class include - * references, or pointers, to the two or more instances. All CIM classes - * can be included in one or more associations. - * - * @return true if this CIM class is an association; otherwise, - * false. - */ - public boolean isAssociation() { - return this.iIsAssoc; - } - - /** - * Identifies whether or not this class is keyed. Only keyed classes can - * have instances. Returns true if this CIM class has one or - * more key properties. Otherwise, returns false. - * - * @return true if this CIM class has a key property, otherwise - * returns false. - */ - public boolean isKeyed() { - return this.iIsKeyed; - } - - /** - * Returns a new CIM instance initialized with the default CIM properties, - * values and name of this CIM class. - * - * @return A CIM instance of this CIM class. - */ - public CIMInstance newInstance() { - return new CIMInstance(this.iObjPath, this.iProps); - } - - /** - * Returns a String representation of the CIM class. This - * method is intended to be used only for debugging purposes, and the format - * of the returned string may vary between implementations. The returned - * string may be empty but may not be null. - * - * @return A String representation of this CIM class. - */ - @Override - public String toString() { - return MOF.classDeclaration(this, MOF.EMPTY); - } - - /** - * Checks whether an array of properties contains a key. - * - * @param pProps - * Array of properties. - * @return true if at least one of the class properties is a - * key, false otherwise. - */ - private static boolean hasKey(CIMClassProperty[] pProps) { - if (pProps == null) return false; - for (int i = 0; i < pProps.length; i++) - if (pProps[i].isKey()) return true; - return false; - } - -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-10-06 ebak Make SBLIM client JSR48 compliant + * 1669961 2006-04-16 lupusalex CIMTypedElement.getType() =>getDataType() + * 1737123 2007-06-15 ebak Differences to JSR48 public review draft + * 1783288 2007-09-10 ebak CIMClass.isAssociation() not working for retrieved classes. + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2750520 2009-04-10 blaschke-oss Code cleanup from empty statement et al + * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors + * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics + * 2823494 2009-08-03 rgummada Change Boolean constructor to static + * 2935258 2010-01-22 blaschke-oss Sync up javax.cim.* javadoc with JSR48 1.0.0 + * 2944842 2010-02-08 blaschke-oss Missing thrown ArrayIndexOutOfBoundsException + * 2975917 2010-03-24 blaschke-oss TCK: CIMClass.getProperty() does not handle null property + * 3400209 2011-08-31 blaschke-oss Highlighted Static Analysis (PMD) issues + * 3496301 2012-03-02 blaschke-oss Sync up javax.* javadoc with JSR48 1.0.0 Final + * 3500619 2012-03-16 blaschke-oss JSR48 1.0.0: CIMClass association/key clean up + * 3521119 2012-04-24 blaschke-oss JSR48 1.0.0: remove CIMObjectPath 2/3/4-parm ctors + * 3565581 2012-09-07 blaschke-oss TCK: remove unnecessary overriding methods + * 2719 2013-12-10 blaschke-oss TCK: CIM APIs should not generate NullPointerException + * 2716 2013-12-11 blaschke-oss Sync up javax.* javadoc with JSR48 1.0.0 Final V + */ + +package org.metricshub.wbem.javax.cim; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.TreeSet; + +import org.metricshub.wbem.sblim.cimclient.internal.cim.CIMElementSorter; +import org.metricshub.wbem.sblim.cimclient.internal.cim.CIMQualifiedElementInterfaceImpl; +import org.metricshub.wbem.sblim.cimclient.internal.util.MOF; + +//Sync'd against JSR48 1.0.0 javadoc (version 1.7.0_03) on Tue Dec 10 07:02:50 EST 2013 +/** + * This class represents a CIM class as defined by the Distributed Management + * Task Force (DMTF) CIM Infrastructure + * Specification (DSP004). A CIMClass has the following attributes: + *
        + *
      • an object path describing the location and name of the class
      • + *
      • superclass name (can be null if no superclass)
      • + *
      • an array of qualifiers for the class
      • + *
      • an array of properties
      • + *
      • an array of methods
      • + *
      + */ +public class CIMClass extends CIMElement implements CIMQualifiedElementInterface, + CIMNamedElementInterface { + + private static final long serialVersionUID = -5634561913210025100L; + + private CIMQualifiedElementInterfaceImpl iQualiImpl; + + private CIMObjectPath iObjPath; + + private String iSuperClass; + + private CIMClassProperty[] iProps; + + private CIMMethod[] iMethods; + + private boolean iIsKeyed; + + private boolean iIsAssoc; + + /** + * Creates and instantiates a Java object representing a CIM Class. This + * method may or may not validate the pIsAssociation and + * pIsKeyed parameters. If an invalid value is supplied (i.e. + * the class is an association, but the pIsAssociation was set + * to false), it may or may not be corrected. + * + * @param pPath + * Object Name of the CIM class. + * @param pSuperClass + * Name of the superclass. + * @param pQualifiers + * List of qualifiers of the CIM class. + * @param pProperties + * List of properties of the CIM class. + * @param pMethods + * List of methods of the CIM class. + * @param pIsAssociation + * true if the CIM class is an Association, + * false otherwise. + * @param pIsKeyed + * true if the CIM class has Keys, + * false otherwise. + * @throws IllegalArgumentException + * If pPath is null. + * + */ + public CIMClass(CIMObjectPath pPath, String pSuperClass, CIMQualifier[] pQualifiers, + CIMClassProperty[] pProperties, CIMMethod[] pMethods, boolean pIsAssociation, + boolean pIsKeyed) { + this(pPath, pSuperClass, pQualifiers, pProperties, pMethods); + // if (this.isAssociation() != pIsAssociation) { + // throw new IllegalArgumentException( + // "pIsAssociation does not match pQualifiers! pIsAssociation is " + + // pIsAssociation + // + " while pQualifiers " + // + (this.isAssociation() ? "contains" : "does not contain") + // + " qualifier with association in class " + + // this.iObjPath.getObjectName()); + // } + // if (this.isKeyed() != pIsKeyed) { + // throw new IllegalArgumentException( + // "pIsKeyed does not match pProperties! pIsKeyed is " + pIsKeyed + // + " while pProperties " + // + (this.isKeyed() ? "contains" : "does not contain") + // + " property with key qualifier in class " + + // this.iObjPath.getObjectName()); + // } + } + + /** + * Creates and instantiates a Java object representing a CIM Class. This + * constructor will inspect the class to determine if it is an association + * or has keys. + * + * @param pName + * Name of the CIM class. + * @param pSuperClass + * Name of the superclass. + * @param pQualifiers + * List of qualifiers of the CIM class. + * @param pProperties + * List of properties of the CIM class. + * @param pMethods + * List of methods of the CIM class. + * @throws IllegalArgumentException + * If pName is null. + */ + public CIMClass(String pName, String pSuperClass, CIMQualifier[] pQualifiers, + CIMClassProperty[] pProperties, CIMMethod[] pMethods) { + this(new CIMObjectPath(null, null, null, null, pName, null), pSuperClass, pQualifiers, + pProperties, pMethods); + } + + /** + * This private constructor does the actual work for the two public + * constructors and sets the iIsAssoc and iIsKeyed instance variables based + * on whether there is qualifier with name="Association" and value=true and + * a property with a qualifier with name="Key" and value=true, respectively. + */ + private CIMClass(CIMObjectPath pPath, String pSuperClass, CIMQualifier[] pQualifiers, + CIMClassProperty[] pProperties, CIMMethod[] pMethods) { + super(pPath == null ? null : pPath.getObjectName()); + this.iObjPath = pPath; + this.iSuperClass = pSuperClass; + this.iQualiImpl = new CIMQualifiedElementInterfaceImpl(pQualifiers); + this.iProps = (CIMClassProperty[]) CIMElementSorter.sort(pProperties); + this.iMethods = (CIMMethod[]) CIMElementSorter.sort(pMethods); + this.iIsAssoc = this.iQualiImpl.hasQualifierValue("Association", Boolean.TRUE); + this.iIsKeyed = hasKey(pProperties); + } + + /** + * Indicates whether the specified CIMClass is equal to this + * CIMClass. + * + * @param pObj + * The CIMClass object with which to compare. + * @return true if this object is the same as the + * pObj argument; false otherwise. + */ + @Override + public boolean equals(Object pObj) { + if (!(pObj instanceof CIMClass)) return false; + CIMClass that = (CIMClass) pObj; + if (!super.equals(that)) return false; + if (this.iSuperClass == null ? that.iSuperClass != null : !this.iSuperClass + .equalsIgnoreCase(that.iSuperClass)) return false; + if (!this.iQualiImpl.equals(that.iQualiImpl) || !Arrays.equals(this.iProps, that.iProps) + || !Arrays.equals(this.iMethods, that.iMethods) || this.iIsAssoc != that.iIsAssoc + || isKeyed() != that.isKeyed()) return false; + return true; + } + + /** + * This method returns a new CIMClass with properties filtered + * according to the input parameters. Inclusion of class origin and + * qualifiers can also be controlled. Methods will not be included in the + * class returned. + * + * @param pLocalOnly + * If true only the elements defined in this class + * are included; otherwise all elements are included. + * @param pIncludeQualifiers + * If true qualifiers are included on all elements; + * otherwise no qualifiers are included. + * @param pIncludeClassOrigin + * If true, the ClassOrigin attribute is included. + * @param pPropertyList + * If the PropertyList input parameter is not + * null, the members of the array define one or more + * Property names. The CIMClass returned does not + * include elements for any Properties missing from this list. If + * the PropertyList input parameter is an empty + * array this signifies that no Properties are included in the + * class returned. If the PropertyList input + * parameter is null this specifies that all + * Properties are included in the class returned. If the + * PropertyList contains duplicate elements or + * invalid property names, they are ignored. + * @return CIMClass matching the requested criteria. + */ + public CIMClass filterProperties(boolean pLocalOnly, boolean pIncludeQualifiers, + boolean pIncludeClassOrigin, String[] pPropertyList) { + ArrayList> newPropAList = new ArrayList>(); + // place pPropertyList into a set, for easy and fast search + TreeSet set; + if (pPropertyList != null) { + set = new TreeSet(); + for (int i = 0; i < pPropertyList.length; i++) + set.add(pPropertyList[i].toUpperCase()); + } else set = null; + for (int i = 0; i < getPropertyCount(); i++) { + CIMClassProperty refProp = getProperty(i); + if (pLocalOnly && refProp.isPropagated()) continue; + if (set == null || set.contains(refProp.getName().toUpperCase())) newPropAList + .add(new CIMClassProperty(refProp.getName(), refProp.getDataType(), + refProp.getValue(), + pIncludeQualifiers ? refProp.getQualifiers() : null, + pIncludeQualifiers ? refProp.isKey() : false, // FIXME: + // Should it depend on pIncludeQualifiers? + refProp.isPropagated(), pIncludeClassOrigin ? refProp.getOriginClass() + : null)); + } + return new CIMClass(getObjectPath(), getSuperClassName(), getQualifiers(), newPropAList + .toArray(new CIMClassProperty[0]), null, isAssociation(), isKeyed()); + } + + /** + * Returns a list of key properties for this CIM class. + * + * @return The list of CIM properties that are keys for this CIM class. + */ + public CIMClassProperty[] getKeys() { + ArrayList> keyAList = new ArrayList>(); + for (int i = 0; i < getPropertyCount(); i++) { + CIMClassProperty prop = getProperty(i); + if (prop.isKey()) keyAList.add(prop); + } + return keyAList.toArray(new CIMClassProperty[0]); + } + + /** + * Get a method by index. + * + * @param pIndex + * The index of the method to retrieve. + * @return The CIMMethod at the specified index. + * @throws ArrayIndexOutOfBoundsException + */ + public CIMMethod getMethod(int pIndex) throws ArrayIndexOutOfBoundsException { + return this.iMethods[pIndex]; + } + + /** + * Returns the specified CIM method in this CIM class. + * + * @param pName + * The string name of the method to retrieve. The name may be + * specified in the form "originClass.methodName". + * @return The CIM method specified or null if the method does + * not exist. + */ + + public CIMMethod getMethod(String pName) { + return getMethod(pName, null); + } + + /** + * Returns the CIM method specified by its name and optionally, its origin + * class. The origin class is the class in which the method is defined. + * + * @param pName + * The string name of the method to get. + * @param pOriginClass + * (Optional) The class in which the method was defined. + * @return The CIM method specified or null if the method does + * not exist. + */ + public CIMMethod getMethod(String pName, String pOriginClass) { + CIMMethod method = (CIMMethod) CIMElementSorter.find(this.iMethods, pName); + if (method == null) return null; + if (pOriginClass == null || pOriginClass.equalsIgnoreCase(method.getOriginClass())) return method; + return null; + } + + /** + * Get the number of methods defined in this CIM class. + * + * @return The number of methods defined in the CIM class. + */ + public int getMethodCount() { + return this.iMethods == null ? 0 : this.iMethods.length; + } + + /** + * Get the CIM methods defined in this CIM class. + * + * @return The methods in this CIM class. + */ + public CIMMethod[] getMethods() { + return this.iMethods != null ? this.iMethods : new CIMMethod[0]; + } + + /** + * This method returns the CIMObjectPath that represents this + * CIM class. + * + * @return The CIMObjectPath that represents this CIM class. + */ + public CIMObjectPath getObjectPath() { + return this.iObjPath; + } + + /** + * Get the properties defined for this CIM class. + * + * @return The properties for this class. + */ + public CIMClassProperty[] getProperties() { + return this.iProps != null ? this.iProps : new CIMClassProperty[0]; + } + + /** + * Get a class property by index. + * + * @param pIndex + * The index of the class property to retrieve. + * @return The CIMClassProperty at the specified index. + * @throws ArrayIndexOutOfBoundsException + */ + public CIMClassProperty getProperty(int pIndex) throws ArrayIndexOutOfBoundsException { + return this.iProps[pIndex]; + } + + /** + * Gets the specified property. + * + * @param pName + * The text string for the name of the property. + * @return The property requested or null if the property does + * not exist. + */ + public CIMClassProperty getProperty(String pName) { + return (CIMClassProperty) CIMElementSorter.find(this.iProps, pName); + } + + /** + * Gets the specified property. + * + * @param pName + * The string name of the property to get. + * @param pOriginClass + * (Optional) The string name of the class in which the property + * was defined. + * @return The property requested or null if the property does + * not exist. + */ + public CIMClassProperty getProperty(String pName, String pOriginClass) { + CIMClassProperty prop = (CIMClassProperty) CIMElementSorter.find(this.iProps, pName); + if (prop == null || pOriginClass == null) return prop; + return pOriginClass.equalsIgnoreCase(prop.getOriginClass()) ? prop : null; + } + + /** + * Get the number of properties defined in this CIMClass. + * + * @return The number of properties defined in the CIMClass. + */ + public int getPropertyCount() { + return this.iProps != null ? this.iProps.length : 0; + } + + /** + * Get a qualifier by index. + * + * @param pIndex + * The index of the qualifier to retrieve. + * @return The qualifier at the specified index. + * @throws ArrayIndexOutOfBoundsException + */ + public CIMQualifier getQualifier(int pIndex) throws ArrayIndexOutOfBoundsException { + return this.iQualiImpl.getQualifier(pIndex); + } + + /** + * Gets a qualifier by name. + * + * @param pName + * The name of the qualifier to get. + * @return The qualifier requested or null if the qualifier + * does not exist. + */ + public CIMQualifier getQualifier(String pName) { + return this.iQualiImpl.getQualifier(pName); + } + + /** + * Get the number of qualifiers defined in this CIM class. + * + * @return The number of qualifiers defined in the CIM class. + */ + public int getQualifierCount() { + return this.iQualiImpl.getQualifierCount(); + } + + /** + * Returns the list of qualifiers for the CIM class. + * + * @return Qualifiers for this class. + */ + public CIMQualifier[] getQualifiers() { + return this.iQualiImpl.getQualifiers(); + } + + /** + * Gets a qualifier value by name. + * + * @param pName + * The name of the qualifier to get. + * @return null if the qualifier does not exist or value is + * null, otherwise returns the reference to the + * qualifier. + */ + public Object getQualifierValue(String pName) { + return this.iQualiImpl.getQualifierValue(pName); + } + + /** + * Gets the name of the parent of this CIM class. + * + * @return The name of the parent class. + */ + public String getSuperClassName() { + return this.iSuperClass; + } + + /** + * Checks whether the specified qualifier is one of the qualifiers in this + * CIM class. + * + * @param pName + * The name of the qualifier. + * @return true if the qualifier exists in this CIM class, + * otherwise false. + */ + public boolean hasQualifier(String pName) { + return this.iQualiImpl.hasQualifier(pName); + } + + /** + * Checks whether the specified qualifier is one of the qualifiers defined + * for this class with the specified value. This method will return + * false if the qualifier is not applied or if the value does + * not match. + * + * @param pName + * The name of the qualifier. + * @param pValue + * The value to be tested. + * @return true if the qualifier exists and has the value, + * otherwise false. + */ + public boolean hasQualifierValue(String pName, Object pValue) { + return this.iQualiImpl.hasQualifierValue(pName, pValue); + } + + /** + * Identifies whether or not this CIM class is an association. An + * association is a relationship between two or more classes or instances of + * two or more classes. The properties of an association class include + * references, or pointers, to the two or more instances. All CIM classes + * can be included in one or more associations. + * + * @return true if this CIM class is an association; otherwise, + * false. + */ + public boolean isAssociation() { + return this.iIsAssoc; + } + + /** + * Identifies whether or not this class is keyed. Only keyed classes can + * have instances. Returns true if this CIM class has one or + * more key properties. Otherwise, returns false. + * + * @return true if this CIM class has a key property, otherwise + * returns false. + */ + public boolean isKeyed() { + return this.iIsKeyed; + } + + /** + * Returns a new CIM instance initialized with the default CIM properties, + * values and name of this CIM class. + * + * @return A CIM instance of this CIM class. + */ + public CIMInstance newInstance() { + return new CIMInstance(this.iObjPath, this.iProps); + } + + /** + * Returns a String representation of the CIM class. This + * method is intended to be used only for debugging purposes, and the format + * of the returned string may vary between implementations. The returned + * string may be empty but may not be null. + * + * @return A String representation of this CIM class. + */ + @Override + public String toString() { + return MOF.classDeclaration(this, MOF.EMPTY); + } + + /** + * Checks whether an array of properties contains a key. + * + * @param pProps + * Array of properties. + * @return true if at least one of the class properties is a + * key, false otherwise. + */ + private static boolean hasKey(CIMClassProperty[] pProps) { + if (pProps == null) return false; + for (int i = 0; i < pProps.length; i++) + if (pProps[i].isKey()) return true; + return false; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/javax/cim/CIMClassProperty.java b/src/main/java/org/metricshub/wbem/javax/cim/CIMClassProperty.java similarity index 89% rename from src/main/java/org/sentrysoftware/wbem/javax/cim/CIMClassProperty.java rename to src/main/java/org/metricshub/wbem/javax/cim/CIMClassProperty.java index c6a90f4..b6a8d2f 100644 --- a/src/main/java/org/sentrysoftware/wbem/javax/cim/CIMClassProperty.java +++ b/src/main/java/org/metricshub/wbem/javax/cim/CIMClassProperty.java @@ -1,263 +1,261 @@ -/* - (C) Copyright IBM Corp. 2006, 2012 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-10-06 ebak Make SBLIM client JSR48 compliant - * 1660756 2007-02-22 ebak Embedded object support - * 1669961 2006-04-16 lupusalex CIMTypedElement.getType() =>getDataType() - * 1737123 2007-06-15 ebak Differences to JSR48 public review draft - * 1737141 2007-06-18 ebak Sync up with JSR48 evolution - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2750520 2009-04-10 blaschke-oss Code cleanup from empty statement et al - * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics - * 2823494 2009-08-03 rgummada Change Boolean constructor to static - * 2935258 2010-01-22 blaschke-oss Sync up javax.cim.* javadoc with JSR48 1.0.0 - * 2944839 2010-02-08 blaschke-oss Remove redundant toString() methods - * 2944842 2010-02-08 blaschke-oss Missing thrown ArrayIndexOutOfBoundsException - * 3400209 2011-08-31 blaschke-oss Highlighted Static Analysis (PMD) issues - * 3565581 2012-09-07 blaschke-oss TCK: remove unnecessary overriding methods - */ - -package org.sentrysoftware.wbem.javax.cim; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cim.CIMQualifiedElementInterfaceImpl; - -//Sync'd against JSR48 1.0.0 javadoc (build 1.5.0_10) on Wed Jan 20 02:20:58 EST 2010 -/** - * This class represents a CIM property (when used for a CIMClass) - * as defined by the Distributed Management Task Force (DMTF) CIM Infrastructure Specification (DSP004). This class is to be used for all CIMClass - * properties. NOTE: For instance properties, use the class - * CIMProperty. - * - * @param - * Type parameter. - * - */ -public class CIMClassProperty extends CIMProperty implements CIMQualifiedElementInterface { - - private static final long serialVersionUID = -1455588144409014311L; - - private CIMQualifiedElementInterfaceImpl iQualiImpl; - - /** - * This method constructs an instance of CIMClassProperty. - * - * @param pName - * The name of the property. - * @param pType - * The data type of the property. - * @param pValue - * The value of the property. - * @param pQualifiers - * The qualifiers for the property. - * @param pKey - * true if the property is a key, otherwise - * false. - * @param pPropagated - * true if the property was inherited, otherwise - * false. - * @param pOriginClass - * The original class in which the property was defined. - */ - public CIMClassProperty(String pName, CIMDataType pType, E pValue, - CIMQualifier[] pQualifiers, boolean pKey, boolean pPropagated, String pOriginClass) { - super(pName, pType, pValue, pKey | hasKey(pQualifiers), pPropagated, pOriginClass); - this.iQualiImpl = new CIMQualifiedElementInterfaceImpl(pQualifiers, pKey, true); - } - - /** - * Compares this object against the specified object. The result is - * true if and only if the argument is not null and is a - * CIMClassProperty that represents the same name, type and - * value as this object. - * - * @param pObj - * The object to compare with. - * @return true if the objects are the same; false - * otherwise. - */ - @Override - public boolean equals(Object pObj) { - if (!(pObj instanceof CIMClassProperty)) return false; - if (!super.equals(pObj)) return false; - return this.iQualiImpl.equals(((CIMClassProperty) pObj).iQualiImpl); - } - - /** - * Returns a CIMClassProperty filtered as specified. - * - * @param pIncludeQualifiers - * If true all qualifiers are returned; otherwise no - * qualifiers. - * @param pIncludeClassOrigin - * If true the class origin is included; otherwise - * no class origin is present. - * @return A filtered CIMClassProperty. - */ - public CIMClassProperty filter(boolean pIncludeQualifiers, boolean pIncludeClassOrigin) { - return filter(pIncludeQualifiers, pIncludeClassOrigin, false); - } - - /** - * Returns a CIMClassProperty filtered as specified. - * - * @param pIncludeQualifiers - * If true all qualifiers are returned; otherwise no - * qualifiers. - * @param pIncludeClassOrigin - * If true the class origin is included; otherwise - * no class origin is present. - * @param pLocalOnly - * If true only the qualifiers that were not - * propagated will be included. - * @return CIMClassProperty A filtered CIMClassProperty. - */ - public CIMClassProperty filter(boolean pIncludeQualifiers, boolean pIncludeClassOrigin, - boolean pLocalOnly) { - // FIXME: should key depend on pIncludeQualifiers? - return new CIMClassProperty(getName(), getDataType(), getValue(), - pIncludeQualifiers ? this.iQualiImpl.getQualifiers(pLocalOnly) : null, isKey(), - isPropagated(), pIncludeClassOrigin ? getOriginClass() : null); - } - - /** - * Get a qualifier by index. - * - * @param pIndex - * The index of the qualifier to retrieve. - * @return The qualifier at the specified index. - * @throws ArrayIndexOutOfBoundsException - */ - public CIMQualifier getQualifier(int pIndex) throws ArrayIndexOutOfBoundsException { - return this.iQualiImpl.getQualifier(pIndex); - } - - /** - * Gets a qualifier by name. - * - * @param pName - * The name of the qualifier to get. - * @return The qualifier requested or null if the qualifier - * does not exist. - */ - public CIMQualifier getQualifier(String pName) { - return this.iQualiImpl.getQualifier(pName); - } - - /** - * Get the number of qualifiers defined for this property. - * - * @return The number of qualifiers defined for this property. - */ - public int getQualifierCount() { - return this.iQualiImpl.getQualifierCount(); - } - - /** - * Returns the list of qualifiers for this property. - * - * @return Qualifiers for this property. - */ - public CIMQualifier[] getQualifiers() { - return this.iQualiImpl.getQualifiers(); - } - - /** - * Gets a qualifier value by name. - * - * @param pName - * The name of the qualifier to get. - * @return null if the qualifier does not exist or value is - * null, otherwise returns the reference to the - * qualifier. - */ - public Object getQualifierValue(String pName) { - return this.iQualiImpl.getQualifierValue(pName); - } - - /** - * Checks whether the specified qualifier is one of the qualifiers defined - * for this property. - * - * @param pName - * The name of the qualifier. - * @return true if the qualifier exists in this property, - * otherwise false. - */ - public boolean hasQualifier(String pName) { - return this.iQualiImpl.hasQualifier(pName); - } - - /** - * Checks whether the specified qualifier is one of the qualifiers defined - * for this property with the specified value. This method will return - * false if the qualifier is not applied or if the value does - * not match. - * - * @param pName - * The name of the qualifier. - * @param pValue - * The value to be tested. - * @return true if the qualifier exists in this property, - * otherwise false. - */ - public boolean hasQualifierValue(String pName, Object pValue) { - return this.iQualiImpl.hasQualifierValue(pName, pValue); - } - - /** - * Checks whether an array of qualifiers contains a key. - * - * @param pQualiA - * Array of qualifiers. - * - * @return true if at least one of the qualifiers is a key, - * false otherwise. - */ - private static boolean hasKey(CIMQualifier[] pQualiA) { - if (pQualiA == null) return false; - Boolean trueBool = Boolean.TRUE; - for (int i = 0; i < pQualiA.length; i++) { - CIMQualifier quali = pQualiA[i]; - if ("key".equalsIgnoreCase(quali.getName())) { return trueBool.equals(quali.getValue()); } - } - return false; - } - -} +/* + (C) Copyright IBM Corp. 2006, 2012 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-10-06 ebak Make SBLIM client JSR48 compliant + * 1660756 2007-02-22 ebak Embedded object support + * 1669961 2006-04-16 lupusalex CIMTypedElement.getType() =>getDataType() + * 1737123 2007-06-15 ebak Differences to JSR48 public review draft + * 1737141 2007-06-18 ebak Sync up with JSR48 evolution + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2750520 2009-04-10 blaschke-oss Code cleanup from empty statement et al + * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics + * 2823494 2009-08-03 rgummada Change Boolean constructor to static + * 2935258 2010-01-22 blaschke-oss Sync up javax.cim.* javadoc with JSR48 1.0.0 + * 2944839 2010-02-08 blaschke-oss Remove redundant toString() methods + * 2944842 2010-02-08 blaschke-oss Missing thrown ArrayIndexOutOfBoundsException + * 3400209 2011-08-31 blaschke-oss Highlighted Static Analysis (PMD) issues + * 3565581 2012-09-07 blaschke-oss TCK: remove unnecessary overriding methods + */ + +package org.metricshub.wbem.javax.cim; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.sblim.cimclient.internal.cim.CIMQualifiedElementInterfaceImpl; + +//Sync'd against JSR48 1.0.0 javadoc (build 1.5.0_10) on Wed Jan 20 02:20:58 EST 2010 +/** + * This class represents a CIM property (when used for a CIMClass) + * as defined by the Distributed Management Task Force (DMTF) CIM Infrastructure Specification (DSP004). This class is to be used for all CIMClass + * properties. NOTE: For instance properties, use the class + * CIMProperty. + * + * @param + * Type parameter. + * + */ +public class CIMClassProperty extends CIMProperty implements CIMQualifiedElementInterface { + + private static final long serialVersionUID = -1455588144409014311L; + + private CIMQualifiedElementInterfaceImpl iQualiImpl; + + /** + * This method constructs an instance of CIMClassProperty. + * + * @param pName + * The name of the property. + * @param pType + * The data type of the property. + * @param pValue + * The value of the property. + * @param pQualifiers + * The qualifiers for the property. + * @param pKey + * true if the property is a key, otherwise + * false. + * @param pPropagated + * true if the property was inherited, otherwise + * false. + * @param pOriginClass + * The original class in which the property was defined. + */ + public CIMClassProperty(String pName, CIMDataType pType, E pValue, + CIMQualifier[] pQualifiers, boolean pKey, boolean pPropagated, String pOriginClass) { + super(pName, pType, pValue, pKey | hasKey(pQualifiers), pPropagated, pOriginClass); + this.iQualiImpl = new CIMQualifiedElementInterfaceImpl(pQualifiers, pKey, true); + } + + /** + * Compares this object against the specified object. The result is + * true if and only if the argument is not null and is a + * CIMClassProperty that represents the same name, type and + * value as this object. + * + * @param pObj + * The object to compare with. + * @return true if the objects are the same; false + * otherwise. + */ + @Override + public boolean equals(Object pObj) { + if (!(pObj instanceof CIMClassProperty)) return false; + if (!super.equals(pObj)) return false; + return this.iQualiImpl.equals(((CIMClassProperty) pObj).iQualiImpl); + } + + /** + * Returns a CIMClassProperty filtered as specified. + * + * @param pIncludeQualifiers + * If true all qualifiers are returned; otherwise no + * qualifiers. + * @param pIncludeClassOrigin + * If true the class origin is included; otherwise + * no class origin is present. + * @return A filtered CIMClassProperty. + */ + public CIMClassProperty filter(boolean pIncludeQualifiers, boolean pIncludeClassOrigin) { + return filter(pIncludeQualifiers, pIncludeClassOrigin, false); + } + + /** + * Returns a CIMClassProperty filtered as specified. + * + * @param pIncludeQualifiers + * If true all qualifiers are returned; otherwise no + * qualifiers. + * @param pIncludeClassOrigin + * If true the class origin is included; otherwise + * no class origin is present. + * @param pLocalOnly + * If true only the qualifiers that were not + * propagated will be included. + * @return CIMClassProperty A filtered CIMClassProperty. + */ + public CIMClassProperty filter(boolean pIncludeQualifiers, boolean pIncludeClassOrigin, + boolean pLocalOnly) { + // FIXME: should key depend on pIncludeQualifiers? + return new CIMClassProperty(getName(), getDataType(), getValue(), + pIncludeQualifiers ? this.iQualiImpl.getQualifiers(pLocalOnly) : null, isKey(), + isPropagated(), pIncludeClassOrigin ? getOriginClass() : null); + } + + /** + * Get a qualifier by index. + * + * @param pIndex + * The index of the qualifier to retrieve. + * @return The qualifier at the specified index. + * @throws ArrayIndexOutOfBoundsException + */ + public CIMQualifier getQualifier(int pIndex) throws ArrayIndexOutOfBoundsException { + return this.iQualiImpl.getQualifier(pIndex); + } + + /** + * Gets a qualifier by name. + * + * @param pName + * The name of the qualifier to get. + * @return The qualifier requested or null if the qualifier + * does not exist. + */ + public CIMQualifier getQualifier(String pName) { + return this.iQualiImpl.getQualifier(pName); + } + + /** + * Get the number of qualifiers defined for this property. + * + * @return The number of qualifiers defined for this property. + */ + public int getQualifierCount() { + return this.iQualiImpl.getQualifierCount(); + } + + /** + * Returns the list of qualifiers for this property. + * + * @return Qualifiers for this property. + */ + public CIMQualifier[] getQualifiers() { + return this.iQualiImpl.getQualifiers(); + } + + /** + * Gets a qualifier value by name. + * + * @param pName + * The name of the qualifier to get. + * @return null if the qualifier does not exist or value is + * null, otherwise returns the reference to the + * qualifier. + */ + public Object getQualifierValue(String pName) { + return this.iQualiImpl.getQualifierValue(pName); + } + + /** + * Checks whether the specified qualifier is one of the qualifiers defined + * for this property. + * + * @param pName + * The name of the qualifier. + * @return true if the qualifier exists in this property, + * otherwise false. + */ + public boolean hasQualifier(String pName) { + return this.iQualiImpl.hasQualifier(pName); + } + + /** + * Checks whether the specified qualifier is one of the qualifiers defined + * for this property with the specified value. This method will return + * false if the qualifier is not applied or if the value does + * not match. + * + * @param pName + * The name of the qualifier. + * @param pValue + * The value to be tested. + * @return true if the qualifier exists in this property, + * otherwise false. + */ + public boolean hasQualifierValue(String pName, Object pValue) { + return this.iQualiImpl.hasQualifierValue(pName, pValue); + } + + /** + * Checks whether an array of qualifiers contains a key. + * + * @param pQualiA + * Array of qualifiers. + * + * @return true if at least one of the qualifiers is a key, + * false otherwise. + */ + private static boolean hasKey(CIMQualifier[] pQualiA) { + if (pQualiA == null) return false; + Boolean trueBool = Boolean.TRUE; + for (int i = 0; i < pQualiA.length; i++) { + CIMQualifier quali = pQualiA[i]; + if ("key".equalsIgnoreCase(quali.getName())) { return trueBool.equals(quali.getValue()); } + } + return false; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/javax/cim/CIMDataType.java b/src/main/java/org/metricshub/wbem/javax/cim/CIMDataType.java similarity index 92% rename from src/main/java/org/sentrysoftware/wbem/javax/cim/CIMDataType.java rename to src/main/java/org/metricshub/wbem/javax/cim/CIMDataType.java index 4ffa30d..aca33c9 100644 --- a/src/main/java/org/sentrysoftware/wbem/javax/cim/CIMDataType.java +++ b/src/main/java/org/metricshub/wbem/javax/cim/CIMDataType.java @@ -1,737 +1,735 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1663270 2007-02-19 ebak Minor performance problems - * 1565892 2006-10-06 ebak Make SBLIM client JSR48 compliant - * 1660756 2007-02-22 ebak Embedded object support - * 1669225 2007-04-16 lupusalex Ctor CIMDataType(int) shall be private - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2870455 2009-09-30 blaschke-oss Missing CLASS_ARRAY_T in CIMDataType - * 2935258 2010-01-22 blaschke-oss Sync up javax.cim.* javadoc with JSR48 1.0.0 - * 3004779 2010-06-16 blaschke-oss TCK: CIMDataType not throwing IllegalArgumentException - * 3513353 2012-03-30 blaschke-oss TCK: CIMDataType arrays must have length >= 1 - * 3513349 2012-03-31 blaschke-oss TCK: CIMDataType must not accept null string - * 3517503 2012-04-13 blaschke-oss Missing parm in CIMDataType ctor javadoc - * 3521131 2012-04-24 blaschke-oss Sync up javax.* javadoc with JSR48 1.0.0 Final II - * 2632 2013-05-02 blaschke-oss Potential Null Point Exception in CIMDataType - */ - -package org.sentrysoftware.wbem.javax.cim; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.Serializable; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.util.MOF; - -//Sync'd against JSR48 1.0.0 javadoc (version 1.7.0_02) on Sun Apr 22 15:31:53 EDT 2012 -/** - * This class represents a CIM data type as defined by the Distributed - * Management Task Force (DMTF) CIM - * Infrastructure Specification (DSP004). The specification only allows a set number of data types. This - * class defines the mapping of CIM data types to Java objects.
      - *
      - * Note: CIM allows the fixed size of an array as part of the data type. The - * predefined classes are unbounded.
      - *
      - * The following table shows the mapping of CIM data type to Java.
      - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
      CIM Data TypeJava Representation
      uint8UnsignedInteger8
      sint8Byte
      uint16UnsignedInteger16
      sint16Short
      uint32UnsignedInteger32
      sint32Integer
      uint64UnsignedInteger64
      sint64Long
      stringString
      booleanBoolean
      real32Float
      real64Double
      datetimeCIMDataTimeAbsolute
      - * CIMDataTimeInterval
      <classname> refCIMObjectPath
      char16Character
      mapping of CIM data type to Java
      - */ -public class CIMDataType extends Object implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * Boolean - * - * @see Boolean - */ - public static final int BOOLEAN = 9; - - /** - * Boolean unbounded array data type - * - * @see Boolean - */ - public static final CIMDataType BOOLEAN_ARRAY_T = new CIMDataType(BOOLEAN, true); - - /** - * Boolean data type - * - * @see Boolean - */ - public static final CIMDataType BOOLEAN_T = new CIMDataType(BOOLEAN, false); - - /** - * 16-bit UCS-2 character - * - * @see Character - */ - public static final int CHAR16 = 13; - - /** - * 16-bit UCS-2 character unbounded Array type - * - * @see Character - */ - public static final CIMDataType CHAR16_ARRAY_T = new CIMDataType(CHAR16, true); - - /** - * 16-bit UCS-2 character data type - * - * @see Character - */ - public static final CIMDataType CHAR16_T = new CIMDataType(CHAR16, false); - - /** - * CIMClass type - */ - public static final int CLASS = 17; - - /** - * CIMClass unbounded Array type - * - * @see CIMClass - */ - public static final CIMDataType CLASS_ARRAY_T = new CIMDataType(CLASS, true); - - /** - * CIMClass type - * - * @see CIMClass - */ - public static final CIMDataType CLASS_T = new CIMDataType(CLASS, false); - - /** - * A string containing the date-time - * - * @see CIMDateTimeInterval CIMDateTimeAbsolute - */ - public static final int DATETIME = 12; - - /** - * A date-time unbounded array data type - * - * @see CIMDateTimeInterval CIMDateTimeAbsolute - */ - public static final CIMDataType DATETIME_ARRAY_T = new CIMDataType(DATETIME, true); - - /** - * A date-time data type - * - * @see CIMDateTimeInterval CIMDateTimeAbsolute - */ - public static final CIMDataType DATETIME_T = new CIMDataType(DATETIME, false); - - /** - * Invalid type - */ - public static final int INVALID = -1; - - /** - * Invalid data type - */ - public static final CIMDataType INVALID_T = new CIMDataType(INVALID, false); - - /** - * Null type - */ - public static final int NULL = 16; - - /** - * CIMInstance type - * - * @see CIMInstance - */ - public static final int OBJECT = 15; - - /** - * CIMInstance unbounded Array type - * - * @see CIMInstance - */ - public static final CIMDataType OBJECT_ARRAY_T = new CIMDataType(OBJECT, true); - - /** - * CIMInstance type data type (Note: For CIMV2, this can only be used when - * the property has either an EmbeddedInstance or EmbeddedObject qualifier) - * - * @see CIMInstance - */ - public static final CIMDataType OBJECT_T = new CIMDataType(OBJECT, false); - - /** - * IEEE 4-byte floating-point - * - * @see Float - */ - public static final int REAL32 = 10; - - /** - * IEEE 4-byte floating-point unbounded array data type - * - * @see Float - */ - public static final CIMDataType REAL32_ARRAY_T = new CIMDataType(REAL32, true); - - /** - * IEEE 4-byte floating-point data type - * - * @see Float - */ - public static final CIMDataType REAL32_T = new CIMDataType(REAL32, false); - - /** - * IEEE 8-byte floating-point - * - * @see Double - */ - public static final int REAL64 = 11; - - /** - * IEEE 8-byte floating-point unbounded array data type - * - * @see Double - */ - public static final CIMDataType REAL64_ARRAY_T = new CIMDataType(REAL64, true); - - /** - * IEEE 8-byte floating-point data type - * - * @see Double - */ - public static final CIMDataType REAL64_T = new CIMDataType(REAL64, false); - - /** - * Reference type - * - * @see CIMObjectPath - */ - public static final int REFERENCE = 14; - - /** - * Signed 16-bit integer - * - * @see Short - */ - public static final int SINT16 = 3; - - /** - * Signed 16-bit integer unbounded array data type - * - * @see Short - */ - public static final CIMDataType SINT16_ARRAY_T = new CIMDataType(SINT16, true); - - /** - * Signed 16-bit integer data type - * - * @see Short - */ - public static final CIMDataType SINT16_T = new CIMDataType(SINT16, false); - - /** - * Signed 32-bit integer - * - * @see Integer - */ - public static final int SINT32 = 5; - - /** - * Signed 32-bit integer unbounded array data type - * - * @see Integer - */ - public static final CIMDataType SINT32_ARRAY_T = new CIMDataType(SINT32, true); - - /** - * Signed 32-bit integer data type - * - * @see Integer - */ - public static final CIMDataType SINT32_T = new CIMDataType(SINT32, false); - - /** - * Signed 64-bit integer - */ - public static final int SINT64 = 7; - - /** - * Signed 64-bit integer unbounded array data type - * - * @see Long - */ - public static final CIMDataType SINT64_ARRAY_T = new CIMDataType(SINT64, true); - - /** - * Signed 64-bit integer data type - * - * @see Long - */ - public static final CIMDataType SINT64_T = new CIMDataType(SINT64, false); - - /** - * Signed 8-bit integer - * - * @see Byte - */ - public static final int SINT8 = 1; - - /** - * Signed 8-bit integer unbounded array data type - * - * @see Byte - */ - public static final CIMDataType SINT8_ARRAY_T = new CIMDataType(SINT8, true); - - /** - * Signed 8-bit integer data type - * - * @see Byte - */ - public static final CIMDataType SINT8_T = new CIMDataType(SINT8, false); - - /** - * UCS-2 string - * - * @see String - */ - public static final int STRING = 8; - - /** - * UCS-2 string unbounded array data type - * - * @see String - */ - public static final CIMDataType STRING_ARRAY_T = new CIMDataType(STRING, true); - - /** - * UCS-2 string data type - * - * @see String - */ - public static final CIMDataType STRING_T = new CIMDataType(STRING, false); - - /** - * Unsigned 16-bit integer - * - * @see UnsignedInteger16 - */ - public static final int UINT16 = 2; - - /** - * Unsigned 16-bit integer unbounded array data type - * - * @see UnsignedInteger16 - */ - public static final CIMDataType UINT16_ARRAY_T = new CIMDataType(UINT16, true); - - /** - * Unsigned 16-bit integer data type - * - * @see UnsignedInteger16 - */ - public static final CIMDataType UINT16_T = new CIMDataType(UINT16, false); - - /** - * Unsigned 32-bit integer - * - * @see UnsignedInteger32 - */ - public static final int UINT32 = 4; - - /** - * Unsigned 32-bit integer unbounded array data type - * - * @see UnsignedInteger32 - */ - public static final CIMDataType UINT32_ARRAY_T = new CIMDataType(UINT32, true); - - /** - * Unsigned 32-bit integer data type - * - * @see UnsignedInteger32 - */ - public static final CIMDataType UINT32_T = new CIMDataType(UINT32, false); - - /** - * Unsigned 64-bit integer - * - * @see UnsignedInteger64 - */ - public static final int UINT64 = 6; - - /** - * Unsigned 64-bit integer unbounded array data type - * - * @see UnsignedInteger64 - */ - public static final CIMDataType UINT64_ARRAY_T = new CIMDataType(UINT64, true); - - /** - * Unsigned 64-bit integer data type - * - * @see UnsignedInteger64 - */ - public static final CIMDataType UINT64_T = new CIMDataType(UINT64, false); - - /** - * Unsigned 8-bit integer - * - * @see UnsignedInteger8 - */ - public static final int UINT8 = 0; - - /** - * Unsigned 8-bit integer unbounded array data type - * - * @see UnsignedInteger8 - */ - public static final CIMDataType UINT8_ARRAY_T = new CIMDataType(UINT8, true); - - /** - * Unsigned 8-bit integer data type - * - * @see UnsignedInteger8 - */ - public static final CIMDataType UINT8_T = new CIMDataType(UINT8, false); - - private int iTypeCode; - - /** - * non array if <0
      - * unbounded if =0
      - * bounded if >0 - */ - private int iBound; - - private String iRefClassName; - - /** - * Sets the data type (non-array). - * - * @param pType - * The data type of the class. - */ - private void setType(int pType) { - this.iTypeCode = pType; - this.iBound = -1; - } - - /** - * Sets the data type (array). - * - * @param pType - * The data type of the class. - * @param pBound - * Array bounds or unbounded if zero. - * - */ - private void setType(int pType, int pBound) { - this.iTypeCode = pType; - this.iBound = pBound; - } - - /** - * Constructs a CIMDataType. - * - * @param pType - * The data type as defined in the CIM class. - * @param pIsArray - * true if data type is unbounded array, - * false if data type is scalar. - * @throws IllegalArgumentException - */ - public CIMDataType(int pType, boolean pIsArray) throws IllegalArgumentException { - if (pIsArray) { - setType(pType, 0); - } else { - setType(pType); - } - } - - /** - * Constructs a CIMDataType array object of the specified type - * and size. This should only be used when the size is being limited/defined - * as part of the data type. - * - * @param pType - * The data type as defined in the CIM class. - * @param pSize - * The maximum number of elements in the array. - * @throws IllegalArgumentException - * If the pSize value specified is not a positive - * integer. - */ - public CIMDataType(int pType, int pSize) throws IllegalArgumentException { - if (pSize <= 0) throw new IllegalArgumentException( - "Maximum number of elements must be positive integer!"); - setType(pType, pSize); - } - - /** - * Creates a new CIM REFERENCE data type object with the specified class - * reference. - * - * @param pClassName - * The CIM class reference name. - * @throws IllegalArgumentException - * If the pClassName is null. - */ - public CIMDataType(String pClassName) { - if (pClassName == null) throw new IllegalArgumentException("Class name must not be null!"); - setType(REFERENCE); - this.iRefClassName = pClassName; - } - - /** - * Creates a new CIM REFERENCE array data type object with the specified - * class reference. - * - * @param pClassName - * The CIM class reference name. - * @param pSize - * The size of the array. 0 indicates the array is unbounded. - * @throws IllegalArgumentException - * If the pClassName is null. - */ - public CIMDataType(String pClassName, int pSize) { - if (pClassName == null) throw new IllegalArgumentException("Class name must not be null!"); - if (pSize < 0) throw new IllegalArgumentException( - "Maximum number of elements cannot be negative integer!"); - setType(REFERENCE, pSize); - this.iRefClassName = pClassName; - } - - /** - * Checks that the specified CIMDataType is equal to this - * CIMDataType. - * - * @param pObj - * The object to compare. - * @return true if the specified object is equal to this - * CIMDataType; false otherwise. - */ - @Override - public boolean equals(Object pObj) { - if (this == pObj) return true; - if (!(pObj instanceof CIMDataType)) return false; - CIMDataType that = (CIMDataType) pObj; - if (this.iRefClassName == null && that.iRefClassName != null) return false; - boolean refMatch = (this.iRefClassName == null ? true : this.iRefClassName - .equals(that.iRefClassName)); - return (this.iTypeCode == that.iTypeCode && isArray() == that.isArray() && refMatch); - } - - /** - * Get the data type of an object. - * - * @param pObj - * The object whose data type is to be returned. - * @return The data type of the specified object. - * @throws IllegalArgumentException - * If pObj is not a valid CIM Type. - */ - public static final CIMDataType getDataType(Object pObj) throws IllegalArgumentException { - if (pObj instanceof Byte) { return SINT8_T; } - if (pObj instanceof Byte[]) { return SINT8_ARRAY_T; } - if (pObj instanceof Short) { return SINT16_T; } - if (pObj instanceof Short[]) { return SINT16_ARRAY_T; } - if (pObj instanceof Integer) { return SINT32_T; } - if (pObj instanceof Integer[]) { return SINT32_ARRAY_T; } - if (pObj instanceof Long) { return SINT64_T; } - if (pObj instanceof Long[]) { return SINT64_ARRAY_T; } - if (pObj instanceof UnsignedInteger8) { return UINT8_T; } - if (pObj instanceof UnsignedInteger8[]) { return UINT8_ARRAY_T; } - if (pObj instanceof UnsignedInteger16) { return UINT16_T; } - if (pObj instanceof UnsignedInteger16[]) { return UINT16_ARRAY_T; } - if (pObj instanceof UnsignedInteger32) { return UINT32_T; } - if (pObj instanceof UnsignedInteger32[]) { return UINT32_ARRAY_T; } - if (pObj instanceof UnsignedInteger64) { return UINT64_T; } - if (pObj instanceof UnsignedInteger64[]) { return UINT64_ARRAY_T; } - if (pObj instanceof Boolean) { return BOOLEAN_T; } - if (pObj instanceof Boolean[]) { return BOOLEAN_ARRAY_T; } - if (pObj instanceof Character) { return CHAR16_T; } - if (pObj instanceof Character[]) { return CHAR16_ARRAY_T; } - if (pObj instanceof String) { return STRING_T; } - if (pObj instanceof String[]) { return STRING_ARRAY_T; } - if (pObj instanceof Float) { return REAL32_T; } - if (pObj instanceof Float[]) { return REAL32_ARRAY_T; } - if (pObj instanceof Double) { return REAL64_T; } - if (pObj instanceof Double[]) { return REAL64_ARRAY_T; } - if (pObj instanceof CIMDateTime) { return DATETIME_T; } - if (pObj instanceof CIMDateTime[]) { return DATETIME_ARRAY_T; } - if (pObj instanceof CIMClass) { return CLASS_T; } - if (pObj instanceof CIMClass[]) { return CLASS_ARRAY_T; } - if (pObj instanceof CIMInstance) { return OBJECT_T; } - if (pObj instanceof CIMInstance[]) { return OBJECT_ARRAY_T; } - if (pObj instanceof CIMObjectPath) { - CIMObjectPath op = (CIMObjectPath) pObj; - return new CIMDataType(op.getObjectName()); - } - if (pObj instanceof CIMObjectPath[]) { - CIMObjectPath[] ops = (CIMObjectPath[]) pObj; - for (int i = 0; i < ops.length; i++) - if (ops[i] != null) return new CIMDataType(ops[i].getObjectName(), 0); - } - // TODO: tracing - /* - * String msg= "Cannot determine the CIMDataType of class:"+ - * pObj.getClass().getName()+"!"; - */ - throw new IllegalArgumentException("Invalid CIM Type!"); - } - - /** - * Returns the class name of the CIM REFERENCE data type. - * - * @return The CIM REFERENCE class name. - */ - public String getRefClassName() { - return this.iRefClassName; - } - - /** - * Returns the size of the maximum number of elements an array data type may - * hold. - * - * @return The maximum size of the array data type. - */ - public int getSize() { - return this.iBound; - } - - /** - * Returns the data type. - * - * @return The data type. - */ - public int getType() { - return this.iTypeCode; - } - - /** - * Checks if the data type is an array type. - * - * @return true if the data type is an array type, - * false otherwise. - */ - public boolean isArray() { - return this.iBound >= 0; - } - - /** - * Returns a String representation of the - * CIMDataType. This method is intended to be used only for - * debugging purposes, and the format of the returned string may vary - * between implementations. The returned string may be empty but may not be - * null. - * - * @return A string representation of this data type. - */ - @Override - public String toString() { - return MOF.dataType(this); - } -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1663270 2007-02-19 ebak Minor performance problems + * 1565892 2006-10-06 ebak Make SBLIM client JSR48 compliant + * 1660756 2007-02-22 ebak Embedded object support + * 1669225 2007-04-16 lupusalex Ctor CIMDataType(int) shall be private + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2870455 2009-09-30 blaschke-oss Missing CLASS_ARRAY_T in CIMDataType + * 2935258 2010-01-22 blaschke-oss Sync up javax.cim.* javadoc with JSR48 1.0.0 + * 3004779 2010-06-16 blaschke-oss TCK: CIMDataType not throwing IllegalArgumentException + * 3513353 2012-03-30 blaschke-oss TCK: CIMDataType arrays must have length >= 1 + * 3513349 2012-03-31 blaschke-oss TCK: CIMDataType must not accept null string + * 3517503 2012-04-13 blaschke-oss Missing parm in CIMDataType ctor javadoc + * 3521131 2012-04-24 blaschke-oss Sync up javax.* javadoc with JSR48 1.0.0 Final II + * 2632 2013-05-02 blaschke-oss Potential Null Point Exception in CIMDataType + */ + +package org.metricshub.wbem.javax.cim; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.Serializable; + +import org.metricshub.wbem.sblim.cimclient.internal.util.MOF; + +//Sync'd against JSR48 1.0.0 javadoc (version 1.7.0_02) on Sun Apr 22 15:31:53 EDT 2012 +/** + * This class represents a CIM data type as defined by the Distributed + * Management Task Force (DMTF) CIM + * Infrastructure Specification (DSP004). The specification only allows a set number of data types. This + * class defines the mapping of CIM data types to Java objects.
      + *
      + * Note: CIM allows the fixed size of an array as part of the data type. The + * predefined classes are unbounded.
      + *
      + * The following table shows the mapping of CIM data type to Java.
      + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
      CIM Data TypeJava Representation
      uint8UnsignedInteger8
      sint8Byte
      uint16UnsignedInteger16
      sint16Short
      uint32UnsignedInteger32
      sint32Integer
      uint64UnsignedInteger64
      sint64Long
      stringString
      booleanBoolean
      real32Float
      real64Double
      datetimeCIMDataTimeAbsolute
      + * CIMDataTimeInterval
      <classname> refCIMObjectPath
      char16Character
      mapping of CIM data type to Java
      + */ +public class CIMDataType extends Object implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * Boolean + * + * @see Boolean + */ + public static final int BOOLEAN = 9; + + /** + * Boolean unbounded array data type + * + * @see Boolean + */ + public static final CIMDataType BOOLEAN_ARRAY_T = new CIMDataType(BOOLEAN, true); + + /** + * Boolean data type + * + * @see Boolean + */ + public static final CIMDataType BOOLEAN_T = new CIMDataType(BOOLEAN, false); + + /** + * 16-bit UCS-2 character + * + * @see Character + */ + public static final int CHAR16 = 13; + + /** + * 16-bit UCS-2 character unbounded Array type + * + * @see Character + */ + public static final CIMDataType CHAR16_ARRAY_T = new CIMDataType(CHAR16, true); + + /** + * 16-bit UCS-2 character data type + * + * @see Character + */ + public static final CIMDataType CHAR16_T = new CIMDataType(CHAR16, false); + + /** + * CIMClass type + */ + public static final int CLASS = 17; + + /** + * CIMClass unbounded Array type + * + * @see CIMClass + */ + public static final CIMDataType CLASS_ARRAY_T = new CIMDataType(CLASS, true); + + /** + * CIMClass type + * + * @see CIMClass + */ + public static final CIMDataType CLASS_T = new CIMDataType(CLASS, false); + + /** + * A string containing the date-time + * + * @see CIMDateTimeInterval CIMDateTimeAbsolute + */ + public static final int DATETIME = 12; + + /** + * A date-time unbounded array data type + * + * @see CIMDateTimeInterval CIMDateTimeAbsolute + */ + public static final CIMDataType DATETIME_ARRAY_T = new CIMDataType(DATETIME, true); + + /** + * A date-time data type + * + * @see CIMDateTimeInterval CIMDateTimeAbsolute + */ + public static final CIMDataType DATETIME_T = new CIMDataType(DATETIME, false); + + /** + * Invalid type + */ + public static final int INVALID = -1; + + /** + * Invalid data type + */ + public static final CIMDataType INVALID_T = new CIMDataType(INVALID, false); + + /** + * Null type + */ + public static final int NULL = 16; + + /** + * CIMInstance type + * + * @see CIMInstance + */ + public static final int OBJECT = 15; + + /** + * CIMInstance unbounded Array type + * + * @see CIMInstance + */ + public static final CIMDataType OBJECT_ARRAY_T = new CIMDataType(OBJECT, true); + + /** + * CIMInstance type data type (Note: For CIMV2, this can only be used when + * the property has either an EmbeddedInstance or EmbeddedObject qualifier) + * + * @see CIMInstance + */ + public static final CIMDataType OBJECT_T = new CIMDataType(OBJECT, false); + + /** + * IEEE 4-byte floating-point + * + * @see Float + */ + public static final int REAL32 = 10; + + /** + * IEEE 4-byte floating-point unbounded array data type + * + * @see Float + */ + public static final CIMDataType REAL32_ARRAY_T = new CIMDataType(REAL32, true); + + /** + * IEEE 4-byte floating-point data type + * + * @see Float + */ + public static final CIMDataType REAL32_T = new CIMDataType(REAL32, false); + + /** + * IEEE 8-byte floating-point + * + * @see Double + */ + public static final int REAL64 = 11; + + /** + * IEEE 8-byte floating-point unbounded array data type + * + * @see Double + */ + public static final CIMDataType REAL64_ARRAY_T = new CIMDataType(REAL64, true); + + /** + * IEEE 8-byte floating-point data type + * + * @see Double + */ + public static final CIMDataType REAL64_T = new CIMDataType(REAL64, false); + + /** + * Reference type + * + * @see CIMObjectPath + */ + public static final int REFERENCE = 14; + + /** + * Signed 16-bit integer + * + * @see Short + */ + public static final int SINT16 = 3; + + /** + * Signed 16-bit integer unbounded array data type + * + * @see Short + */ + public static final CIMDataType SINT16_ARRAY_T = new CIMDataType(SINT16, true); + + /** + * Signed 16-bit integer data type + * + * @see Short + */ + public static final CIMDataType SINT16_T = new CIMDataType(SINT16, false); + + /** + * Signed 32-bit integer + * + * @see Integer + */ + public static final int SINT32 = 5; + + /** + * Signed 32-bit integer unbounded array data type + * + * @see Integer + */ + public static final CIMDataType SINT32_ARRAY_T = new CIMDataType(SINT32, true); + + /** + * Signed 32-bit integer data type + * + * @see Integer + */ + public static final CIMDataType SINT32_T = new CIMDataType(SINT32, false); + + /** + * Signed 64-bit integer + */ + public static final int SINT64 = 7; + + /** + * Signed 64-bit integer unbounded array data type + * + * @see Long + */ + public static final CIMDataType SINT64_ARRAY_T = new CIMDataType(SINT64, true); + + /** + * Signed 64-bit integer data type + * + * @see Long + */ + public static final CIMDataType SINT64_T = new CIMDataType(SINT64, false); + + /** + * Signed 8-bit integer + * + * @see Byte + */ + public static final int SINT8 = 1; + + /** + * Signed 8-bit integer unbounded array data type + * + * @see Byte + */ + public static final CIMDataType SINT8_ARRAY_T = new CIMDataType(SINT8, true); + + /** + * Signed 8-bit integer data type + * + * @see Byte + */ + public static final CIMDataType SINT8_T = new CIMDataType(SINT8, false); + + /** + * UCS-2 string + * + * @see String + */ + public static final int STRING = 8; + + /** + * UCS-2 string unbounded array data type + * + * @see String + */ + public static final CIMDataType STRING_ARRAY_T = new CIMDataType(STRING, true); + + /** + * UCS-2 string data type + * + * @see String + */ + public static final CIMDataType STRING_T = new CIMDataType(STRING, false); + + /** + * Unsigned 16-bit integer + * + * @see UnsignedInteger16 + */ + public static final int UINT16 = 2; + + /** + * Unsigned 16-bit integer unbounded array data type + * + * @see UnsignedInteger16 + */ + public static final CIMDataType UINT16_ARRAY_T = new CIMDataType(UINT16, true); + + /** + * Unsigned 16-bit integer data type + * + * @see UnsignedInteger16 + */ + public static final CIMDataType UINT16_T = new CIMDataType(UINT16, false); + + /** + * Unsigned 32-bit integer + * + * @see UnsignedInteger32 + */ + public static final int UINT32 = 4; + + /** + * Unsigned 32-bit integer unbounded array data type + * + * @see UnsignedInteger32 + */ + public static final CIMDataType UINT32_ARRAY_T = new CIMDataType(UINT32, true); + + /** + * Unsigned 32-bit integer data type + * + * @see UnsignedInteger32 + */ + public static final CIMDataType UINT32_T = new CIMDataType(UINT32, false); + + /** + * Unsigned 64-bit integer + * + * @see UnsignedInteger64 + */ + public static final int UINT64 = 6; + + /** + * Unsigned 64-bit integer unbounded array data type + * + * @see UnsignedInteger64 + */ + public static final CIMDataType UINT64_ARRAY_T = new CIMDataType(UINT64, true); + + /** + * Unsigned 64-bit integer data type + * + * @see UnsignedInteger64 + */ + public static final CIMDataType UINT64_T = new CIMDataType(UINT64, false); + + /** + * Unsigned 8-bit integer + * + * @see UnsignedInteger8 + */ + public static final int UINT8 = 0; + + /** + * Unsigned 8-bit integer unbounded array data type + * + * @see UnsignedInteger8 + */ + public static final CIMDataType UINT8_ARRAY_T = new CIMDataType(UINT8, true); + + /** + * Unsigned 8-bit integer data type + * + * @see UnsignedInteger8 + */ + public static final CIMDataType UINT8_T = new CIMDataType(UINT8, false); + + private int iTypeCode; + + /** + * non array if <0
      + * unbounded if =0
      + * bounded if >0 + */ + private int iBound; + + private String iRefClassName; + + /** + * Sets the data type (non-array). + * + * @param pType + * The data type of the class. + */ + private void setType(int pType) { + this.iTypeCode = pType; + this.iBound = -1; + } + + /** + * Sets the data type (array). + * + * @param pType + * The data type of the class. + * @param pBound + * Array bounds or unbounded if zero. + * + */ + private void setType(int pType, int pBound) { + this.iTypeCode = pType; + this.iBound = pBound; + } + + /** + * Constructs a CIMDataType. + * + * @param pType + * The data type as defined in the CIM class. + * @param pIsArray + * true if data type is unbounded array, + * false if data type is scalar. + * @throws IllegalArgumentException + */ + public CIMDataType(int pType, boolean pIsArray) throws IllegalArgumentException { + if (pIsArray) { + setType(pType, 0); + } else { + setType(pType); + } + } + + /** + * Constructs a CIMDataType array object of the specified type + * and size. This should only be used when the size is being limited/defined + * as part of the data type. + * + * @param pType + * The data type as defined in the CIM class. + * @param pSize + * The maximum number of elements in the array. + * @throws IllegalArgumentException + * If the pSize value specified is not a positive + * integer. + */ + public CIMDataType(int pType, int pSize) throws IllegalArgumentException { + if (pSize <= 0) throw new IllegalArgumentException( + "Maximum number of elements must be positive integer!"); + setType(pType, pSize); + } + + /** + * Creates a new CIM REFERENCE data type object with the specified class + * reference. + * + * @param pClassName + * The CIM class reference name. + * @throws IllegalArgumentException + * If the pClassName is null. + */ + public CIMDataType(String pClassName) { + if (pClassName == null) throw new IllegalArgumentException("Class name must not be null!"); + setType(REFERENCE); + this.iRefClassName = pClassName; + } + + /** + * Creates a new CIM REFERENCE array data type object with the specified + * class reference. + * + * @param pClassName + * The CIM class reference name. + * @param pSize + * The size of the array. 0 indicates the array is unbounded. + * @throws IllegalArgumentException + * If the pClassName is null. + */ + public CIMDataType(String pClassName, int pSize) { + if (pClassName == null) throw new IllegalArgumentException("Class name must not be null!"); + if (pSize < 0) throw new IllegalArgumentException( + "Maximum number of elements cannot be negative integer!"); + setType(REFERENCE, pSize); + this.iRefClassName = pClassName; + } + + /** + * Checks that the specified CIMDataType is equal to this + * CIMDataType. + * + * @param pObj + * The object to compare. + * @return true if the specified object is equal to this + * CIMDataType; false otherwise. + */ + @Override + public boolean equals(Object pObj) { + if (this == pObj) return true; + if (!(pObj instanceof CIMDataType)) return false; + CIMDataType that = (CIMDataType) pObj; + if (this.iRefClassName == null && that.iRefClassName != null) return false; + boolean refMatch = (this.iRefClassName == null ? true : this.iRefClassName + .equals(that.iRefClassName)); + return (this.iTypeCode == that.iTypeCode && isArray() == that.isArray() && refMatch); + } + + /** + * Get the data type of an object. + * + * @param pObj + * The object whose data type is to be returned. + * @return The data type of the specified object. + * @throws IllegalArgumentException + * If pObj is not a valid CIM Type. + */ + public static final CIMDataType getDataType(Object pObj) throws IllegalArgumentException { + if (pObj instanceof Byte) { return SINT8_T; } + if (pObj instanceof Byte[]) { return SINT8_ARRAY_T; } + if (pObj instanceof Short) { return SINT16_T; } + if (pObj instanceof Short[]) { return SINT16_ARRAY_T; } + if (pObj instanceof Integer) { return SINT32_T; } + if (pObj instanceof Integer[]) { return SINT32_ARRAY_T; } + if (pObj instanceof Long) { return SINT64_T; } + if (pObj instanceof Long[]) { return SINT64_ARRAY_T; } + if (pObj instanceof UnsignedInteger8) { return UINT8_T; } + if (pObj instanceof UnsignedInteger8[]) { return UINT8_ARRAY_T; } + if (pObj instanceof UnsignedInteger16) { return UINT16_T; } + if (pObj instanceof UnsignedInteger16[]) { return UINT16_ARRAY_T; } + if (pObj instanceof UnsignedInteger32) { return UINT32_T; } + if (pObj instanceof UnsignedInteger32[]) { return UINT32_ARRAY_T; } + if (pObj instanceof UnsignedInteger64) { return UINT64_T; } + if (pObj instanceof UnsignedInteger64[]) { return UINT64_ARRAY_T; } + if (pObj instanceof Boolean) { return BOOLEAN_T; } + if (pObj instanceof Boolean[]) { return BOOLEAN_ARRAY_T; } + if (pObj instanceof Character) { return CHAR16_T; } + if (pObj instanceof Character[]) { return CHAR16_ARRAY_T; } + if (pObj instanceof String) { return STRING_T; } + if (pObj instanceof String[]) { return STRING_ARRAY_T; } + if (pObj instanceof Float) { return REAL32_T; } + if (pObj instanceof Float[]) { return REAL32_ARRAY_T; } + if (pObj instanceof Double) { return REAL64_T; } + if (pObj instanceof Double[]) { return REAL64_ARRAY_T; } + if (pObj instanceof CIMDateTime) { return DATETIME_T; } + if (pObj instanceof CIMDateTime[]) { return DATETIME_ARRAY_T; } + if (pObj instanceof CIMClass) { return CLASS_T; } + if (pObj instanceof CIMClass[]) { return CLASS_ARRAY_T; } + if (pObj instanceof CIMInstance) { return OBJECT_T; } + if (pObj instanceof CIMInstance[]) { return OBJECT_ARRAY_T; } + if (pObj instanceof CIMObjectPath) { + CIMObjectPath op = (CIMObjectPath) pObj; + return new CIMDataType(op.getObjectName()); + } + if (pObj instanceof CIMObjectPath[]) { + CIMObjectPath[] ops = (CIMObjectPath[]) pObj; + for (int i = 0; i < ops.length; i++) + if (ops[i] != null) return new CIMDataType(ops[i].getObjectName(), 0); + } + // TODO: tracing + /* + * String msg= "Cannot determine the CIMDataType of class:"+ + * pObj.getClass().getName()+"!"; + */ + throw new IllegalArgumentException("Invalid CIM Type!"); + } + + /** + * Returns the class name of the CIM REFERENCE data type. + * + * @return The CIM REFERENCE class name. + */ + public String getRefClassName() { + return this.iRefClassName; + } + + /** + * Returns the size of the maximum number of elements an array data type may + * hold. + * + * @return The maximum size of the array data type. + */ + public int getSize() { + return this.iBound; + } + + /** + * Returns the data type. + * + * @return The data type. + */ + public int getType() { + return this.iTypeCode; + } + + /** + * Checks if the data type is an array type. + * + * @return true if the data type is an array type, + * false otherwise. + */ + public boolean isArray() { + return this.iBound >= 0; + } + + /** + * Returns a String representation of the + * CIMDataType. This method is intended to be used only for + * debugging purposes, and the format of the returned string may vary + * between implementations. The returned string may be empty but may not be + * null. + * + * @return A string representation of this data type. + */ + @Override + public String toString() { + return MOF.dataType(this); + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/javax/cim/CIMDateTime.java b/src/main/java/org/metricshub/wbem/javax/cim/CIMDateTime.java similarity index 84% rename from src/main/java/org/sentrysoftware/wbem/javax/cim/CIMDateTime.java rename to src/main/java/org/metricshub/wbem/javax/cim/CIMDateTime.java index 9e4612f..1c44ded 100644 --- a/src/main/java/org/sentrysoftware/wbem/javax/cim/CIMDateTime.java +++ b/src/main/java/org/metricshub/wbem/javax/cim/CIMDateTime.java @@ -1,137 +1,135 @@ -/* - (C) Copyright IBM Corp. 2006, 2012 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-10-06 ebak Make SBLIM client JSR48 compliant - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings - * 2227442 2008-11-05 blaschke-oss Add missing serialVersionUID - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2795671 2009-05-22 raman_arora Add Type to Comparable - * 2935258 2010-01-22 blaschke-oss Sync up javax.cim.* javadoc with JSR48 1.0.0 - * 3496301 2012-03-02 blaschke-oss Sync up javax.* javadoc with JSR48 1.0.0 Final - */ - -package org.sentrysoftware.wbem.javax.cim; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.Serializable; - -//Sync'd against JSR48 1.0.0 javadoc (build 1.6.0_18) on Thu Mar 01 12:21:26 EST 2012 -/** - * This abstract class represents a CIM Datetime data type as defined by the - * Distributed Management Task Force (DMTF) CIM - * Infrastructure Specification (DSP004). It is in the format yyyyMMddHHmmss.SSSSSSsutc where: - *
        - *
      • yyyy - is a 4 digit year
      • - *
      • MM - is the month
      • - *
      • dd - is the day of the month
      • - *
      • HH - is the hour (24 hour clock)
      • - *
      • mm - is the minute
      • - *
      • ss - is the second
      • - *
      • SSSSSS - is the number of microseconds
      • - *
      • s - is "+" or "-", indicating the sign of the UTC (Universal Coordinated - * Time; for all intents and purposes the same as Greenwich Mean Time) - * correction field, or a ":". In the case of a ":" the value is interpreted as - * a time interval, and yyyyMM are interpreted as days.
      • - *
      • utc - is the offset from UTC in minutes (using the sign indicated by s). - * It is ignored for a time interval.
      • - *
      - * - * For example, the absolute datetime for Monday, May 25, 1998, at 1:30 PM EST - * would be represented as: 19980525133015.000000-300. Values must be - * zero-padded so that the entire string is always the same 25-character length. - * Fields which are not significant must be replaced with asterisk characters. - * Similarly, intervals use the same format, except that the interpretation of - * the fields is based on elapsed time.
      - * For example, the interval datetime for an elapsed time of 1 day, 13 hours, 23 - * minutes, 12 seconds would be: 00000001132312.000000:000. A UTC offset of zero - * is always used for interval properties. - */ -public abstract class CIMDateTime extends Object implements Serializable, Comparable { - - private static final long serialVersionUID = 3424668043014662166L; - - /** - * Creates a CIMDateTime object using a string. - * - * @param pDateString - * A string in the format of yyyyMMddHHmmss.SSSSSSsutc. - * @throws IllegalArgumentException - * If string is not in the correct format. - */ - public CIMDateTime(String pDateString) throws IllegalArgumentException { - // FIXME: what to do here? - } - - protected CIMDateTime() { - // FIXME: what to do here? - } - - /** - * Determines whether the CIMDateTime that is passed in is - * equal to the current CIMDateTime object. - * - * @param pObj - * The CIMDateTime object to compare to. - * @return true if this CIMDateTime object is equal to the one - * that was passed in, otherwise false. - */ - @Override - public boolean equals(Object pObj) { - if (!(pObj instanceof CIMDateTime)) return false; - CIMDateTime that = (CIMDateTime) pObj; - return getDateTimeString().equals(that.getDateTimeString()); - } - - /** - * Gets the internal string representation of this object. - * - * @return The internal representation of the CIMDateTime - * object. - */ - public abstract String getDateTimeString(); - - /** - * Returns the hash code for this object. - * - * @return A hash code value for this object. - * @see java.lang.Object#hashCode() - */ - @Override - public abstract int hashCode(); -} +/* + (C) Copyright IBM Corp. 2006, 2012 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-10-06 ebak Make SBLIM client JSR48 compliant + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings + * 2227442 2008-11-05 blaschke-oss Add missing serialVersionUID + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2795671 2009-05-22 raman_arora Add Type to Comparable + * 2935258 2010-01-22 blaschke-oss Sync up javax.cim.* javadoc with JSR48 1.0.0 + * 3496301 2012-03-02 blaschke-oss Sync up javax.* javadoc with JSR48 1.0.0 Final + */ + +package org.metricshub.wbem.javax.cim; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.Serializable; + +//Sync'd against JSR48 1.0.0 javadoc (build 1.6.0_18) on Thu Mar 01 12:21:26 EST 2012 +/** + * This abstract class represents a CIM Datetime data type as defined by the + * Distributed Management Task Force (DMTF) CIM + * Infrastructure Specification (DSP004). It is in the format yyyyMMddHHmmss.SSSSSSsutc where: + *
        + *
      • yyyy - is a 4 digit year
      • + *
      • MM - is the month
      • + *
      • dd - is the day of the month
      • + *
      • HH - is the hour (24 hour clock)
      • + *
      • mm - is the minute
      • + *
      • ss - is the second
      • + *
      • SSSSSS - is the number of microseconds
      • + *
      • s - is "+" or "-", indicating the sign of the UTC (Universal Coordinated + * Time; for all intents and purposes the same as Greenwich Mean Time) + * correction field, or a ":". In the case of a ":" the value is interpreted as + * a time interval, and yyyyMM are interpreted as days.
      • + *
      • utc - is the offset from UTC in minutes (using the sign indicated by s). + * It is ignored for a time interval.
      • + *
      + * + * For example, the absolute datetime for Monday, May 25, 1998, at 1:30 PM EST + * would be represented as: 19980525133015.000000-300. Values must be + * zero-padded so that the entire string is always the same 25-character length. + * Fields which are not significant must be replaced with asterisk characters. + * Similarly, intervals use the same format, except that the interpretation of + * the fields is based on elapsed time.
      + * For example, the interval datetime for an elapsed time of 1 day, 13 hours, 23 + * minutes, 12 seconds would be: 00000001132312.000000:000. A UTC offset of zero + * is always used for interval properties. + */ +public abstract class CIMDateTime extends Object implements Serializable, Comparable { + + private static final long serialVersionUID = 3424668043014662166L; + + /** + * Creates a CIMDateTime object using a string. + * + * @param pDateString + * A string in the format of yyyyMMddHHmmss.SSSSSSsutc. + * @throws IllegalArgumentException + * If string is not in the correct format. + */ + public CIMDateTime(String pDateString) throws IllegalArgumentException { + // FIXME: what to do here? + } + + protected CIMDateTime() { + // FIXME: what to do here? + } + + /** + * Determines whether the CIMDateTime that is passed in is + * equal to the current CIMDateTime object. + * + * @param pObj + * The CIMDateTime object to compare to. + * @return true if this CIMDateTime object is equal to the one + * that was passed in, otherwise false. + */ + @Override + public boolean equals(Object pObj) { + if (!(pObj instanceof CIMDateTime)) return false; + CIMDateTime that = (CIMDateTime) pObj; + return getDateTimeString().equals(that.getDateTimeString()); + } + + /** + * Gets the internal string representation of this object. + * + * @return The internal representation of the CIMDateTime + * object. + */ + public abstract String getDateTimeString(); + + /** + * Returns the hash code for this object. + * + * @return A hash code value for this object. + * @see java.lang.Object#hashCode() + */ + @Override + public abstract int hashCode(); +} diff --git a/src/main/java/org/sentrysoftware/wbem/javax/cim/CIMDateTimeAbsolute.java b/src/main/java/org/metricshub/wbem/javax/cim/CIMDateTimeAbsolute.java similarity index 91% rename from src/main/java/org/sentrysoftware/wbem/javax/cim/CIMDateTimeAbsolute.java rename to src/main/java/org/metricshub/wbem/javax/cim/CIMDateTimeAbsolute.java index e54ee6d..510a514 100644 --- a/src/main/java/org/sentrysoftware/wbem/javax/cim/CIMDateTimeAbsolute.java +++ b/src/main/java/org/metricshub/wbem/javax/cim/CIMDateTimeAbsolute.java @@ -1,404 +1,402 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-10-06 ebak Make SBLIM client JSR48 compliant - * 1678807 2007-03-12 ebak Minor CIMDateTime suggestions - * 1931621 2008-04-02 blaschke-oss CIMDateTimeAbsolute(Calendar) does not respect DST - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2750520 2009-04-10 blaschke-oss Code cleanup from empty statement et al - * 2795671 2009-05-22 raman_arora Add Type to Comparable - * 2806362 2009-06-14 blaschke-oss Missing new CIMDateTimeAbsolute.getUTCOffset() method - * 2935258 2010-01-22 blaschke-oss Sync up javax.cim.* javadoc with JSR48 1.0.0 - * 2944826 2010-02-08 blaschke-oss getUTCOffset() incorrect if not significant field - * 2973300 2010-03-19 blaschke-oss TCK: CIMDateTimeXXX.compareTo() does not handle null - * 3022501 2010-06-30 blaschke-oss Possible integer overflow in getTotalUSec - * 3400209 2011-08-31 blaschke-oss Highlighted Static Analysis (PMD) issues - * 3565581 2012-09-07 blaschke-oss TCK: remove unnecessary overriding methods - * 2674 2013-09-26 blaschke-oss Null pointer exception in CIMDateTime(String) - * 2716 2013-12-11 blaschke-oss Sync up javax.* javadoc with JSR48 1.0.0 Final V - */ - -package org.sentrysoftware.wbem.javax.cim; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.Calendar; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cim.DTStringReader; -import org.sentrysoftware.wbem.sblim.cimclient.internal.cim.DTStringWriter; - -//Sync'd against JSR48 1.0.0 javadoc (version 1.7.0_03) on Tue Dec 10 07:02:50 EST 2013 -/** - * This class represents the datetime data type when used as a time value as - * specified in the CIM Infrastructure specification. It is in the format - * yyyyMMddHHmmss.SSSSSSsutc where: - *
        - *
      • yyyy - is a 4 digit year
      • - *
      • MM - is the month
      • - *
      • dd - is the day of the month
      • - *
      • HH - is the hour (24 hour clock)
      • - *
      • mm - is the minute
      • - *
      • ss - is the second
      • - *
      • SSSSSS - is the number of microseconds
      • - *
      • s - is "+" or "-", indicating the sign of the UTC (Universal Coordinated - * Time; for all intents and purposes the same as Greenwich Mean Time)
      • - *
      • utc - is the offset from UTC in minutes (using the sign indicated by s).
      • - *
      - * For example Monday, May 25, 1998, at 1:30 PM EST would be represented as: - * 19980525133015.000000-300. Values must be zero-padded so that the entire - * string is always the same 25-character length. Fields which are not - * significant must be replaced with asterisk characters. - */ -public class CIMDateTimeAbsolute extends CIMDateTime { - - private static final long serialVersionUID = 7556792806296945178l; - - private int iYear, iMonth, iDay, iHour, iMin, iSec, iUSec, iUtc; - - private boolean iUnsignificantUtc; - - private String iStr; - - /** - * Create a CIMDateTimeAbsolute object using the current - * Time/Date of the system. - */ - public CIMDateTimeAbsolute() { - set(Calendar.getInstance()); - } - - /** - * Create a CIMDateTimeAbsolute object using a - * Calendar object. - * - * @param pCalendar - * A Calendar object used to initialize this object. - * @throws IllegalArgumentException - * If Calendar object is null. - */ - public CIMDateTimeAbsolute(Calendar pCalendar) throws IllegalArgumentException { - if (pCalendar == null) throw new IllegalArgumentException("Null Calendar is not allowed!"); - if (pCalendar.get(Calendar.YEAR) > 9999) throw new IllegalArgumentException( - "The year field cannot be greater than 9999!"); - set(pCalendar); - } - - /** - * Creates a CIMDateTimeAbsolute object using a string. - * - * @param pDateTime - * A string in the format of yyyyMMddHHmmss.SSSSSSsutc. - * @throws IllegalArgumentException - * If string is not in the correct format or null. - */ - public CIMDateTimeAbsolute(String pDateTime) throws IllegalArgumentException { - if (pDateTime == null) throw new IllegalArgumentException("Null DateTime is not allowed!"); - DTStringReader reader = new DTStringReader(pDateTime); - this.iYear = reader.readAndCheck(4, "year", 0, 9999, true); - this.iMonth = reader.readAndCheck(2, "month", 1, 12, true); - this.iDay = reader.readAndCheck(2, "day", 1, 31, true); - this.iHour = reader.readAndCheck(2, "hour", 0, 23, true); - this.iMin = reader.readAndCheck(2, "minute", 0, 59, true); - this.iSec = reader.readAndCheck(2, "second", 0, 59, true); - reader.read('.'); - this.iUSec = reader.readAndCheck(6, "microSeconds", 0, 999999, true); - char sign = reader.read(); - if (sign != '+' && sign != '-') { - String msg = "Illegal character '" + sign + "' at position " + reader.getPos() - + "! '+' or '-' is expected."; - throw new IllegalArgumentException(msg); - } - this.iUtc = reader.read(3, "utc", true); - if (reader.isUnsignificant()) { - this.iUnsignificantUtc = true; - } else if (sign == '-') { - this.iUtc = -this.iUtc; - } - if (reader.read() != 0) throw new IllegalArgumentException("Extra character at the end of " - + pDateTime + " !"); - this.iStr = pDateTime; - } - - /** - * Compares the CIMDateTimeAbsolute object with this one. If - * either date has "Not Significant" fields then we can only compare the - * significant fields. - * - * @param pDateTime - * The CIMDateTimeAbsolute to be compared with this - * one. - * @return -1, zero, or 1 as this date is less than, equal to, or greater - * than the specified date. - * @throws IllegalArgumentException - * If the object passed in is not an instance of - * CIMDataTimeAbsolute. - */ - public int compareTo(CIMDateTime pDateTime) throws IllegalArgumentException { - if (!(pDateTime instanceof CIMDateTimeAbsolute)) { - String msg = "pDateTime must be a CIMDateTimeAbsolute instance while it is a " - + (pDateTime == null ? "null!" : pDateTime.getClass().getName() + " instance!"); - throw new IllegalArgumentException(msg); - } - - CIMDateTimeAbsolute that = (CIMDateTimeAbsolute) pDateTime; - /* - * Comparison: 1. building Calendars from both dates. If a field is not - * significant it and it's corresponding pair is cleared. - */ - int mask = getMask() & that.getMask(); - long thisMicros = getTotalUSec(mask); - long thatMicros = that.getTotalUSec(mask); - long val = thisMicros - thatMicros; - if (val == 0) return 0; - return val < 0 ? -1 : 1; - } - - /** - * Gets the internal string representation of the date/time object. - * - * @return The internal representation of the date/time object. - */ - @Override - public String getDateTimeString() { - if (this.iStr != null) return this.iStr; - // yyyyMMddHHmmss.uuuuuuSutc - DTStringWriter dTWriter = new DTStringWriter(); - dTWriter.write(4, this.iYear); - dTWriter.write(2, this.iMonth); - dTWriter.write(2, this.iDay); - dTWriter.write(2, this.iHour); - dTWriter.write(2, this.iMin); - dTWriter.write(2, this.iSec); - dTWriter.write('.'); - dTWriter.write(6, this.iUSec); - if (this.iUnsignificantUtc) dTWriter.write("+***"); - else dTWriter.writeSigned(3, this.iUtc); - return this.iStr = dTWriter.toString(); - } - - /** - * Returns day value of this date. - * - * @return If day field "not significant" this returns -1, otherwise returns - * day of this date. - */ - public int getDay() { - return this.iDay; - } - - /** - * Returns hour value of this date. - * - * @return If hour field "not significant" this returns -1, otherwise - * returns hour of this date. - */ - public int getHour() { - return this.iHour; - } - - /** - * Returns microsecond value of this date. - * - * @return If microsecond field "not significant" this returns -1, otherwise - * returns microseconds of this date. - */ - public int getMicrosecond() { - return this.iUSec; - } - - /** - * Returns minute value of this date. - * - * @return If minute field "not significant" this returns -1, otherwise - * returns minute of this date. - */ - public int getMinute() { - return this.iMin; - } - - /** - * Returns month value of this date. - * - * @return If month field "not significant" this returns -1, otherwise - * returns the month of this date. - */ - public int getMonth() { - return this.iMonth; - } - - /** - * Returns second value of this date. - * - * @return If second field "not significant" this returns -1, otherwise - * returns second of this date. - */ - public int getSecond() { - return this.iSec; - } - - /** - * Returns UTC offset value of this date. - * - * @return UTC offset of this date. - */ - public int getUTCOffset() { - return this.iUnsignificantUtc ? -1 : this.iUtc; - } - - /** - * Returns year value of this Date. - * - * @return If year field "not significant" this returns -1, otherwise - * returns the year of this date. - */ - public int getYear() { - return this.iYear; - } - - /** - * Returns the hash code for this object. - * - * @return A hash code value for this object. - * @see java.lang.Object#hashCode() - */ - @Override - public int hashCode() { - return getDateTimeString().hashCode(); - } - - /** - * Returns a String representation of the - * CIMDateTimeAbsolute. This method is intended to be used only - * for debugging purposes, and the format of the returned string may vary - * between implementations. The returned string may be empty but may not be - * null. - * - * @return String representation of this datetime. - */ - @Override - public String toString() { - return getDateTimeString(); - } - - private static final int YEAR = 1, MONTH = 2, DAY = 4, HOUR = 8, MIN = 16, SEC = 32, USEC = 64, - UTC = 128; - - /** - * Get mask of this CIMDateTimeAbsolute where bit is set if the - * corresponding field is significant or clear if it is not significant. - * - * @return Mask of significant fields in datetime object. - */ - private int getMask() { - int mask = 0; - if (this.iYear != -1) mask |= YEAR; - if (this.iMonth != -1) mask |= MONTH; - if (this.iDay != -1) mask |= DAY; - if (this.iHour != -1) mask |= HOUR; - if (this.iMin != -1) mask |= MIN; - if (this.iSec != -1) mask |= SEC; - if (this.iUSec != -1) mask |= USEC; - if (!this.iUnsignificantUtc) mask |= UTC; - return mask; - } - - /** - * Get value of a field based on mask. - * - * @param pMask - * Mask of significant fields. - * @param pField - * Field. - * @param pValue - * Value of field. - * @param pInitValue - * Initial value of field. - * @return Value of field if field significant, otherwise initial value. - */ - private int mask(int pMask, int pField, int pValue, int pInitValue) { - return ((pMask & pField) > 0) ? pValue : pInitValue; - } - - /** - * Get total microseconds of CIMDateTimeAbsolute object where - * only significant fields are used in calculation. - * - * @param pMask - * Mask of significant fields. - * @return Total microseconds of significant fields in datetime. - */ - private long getTotalUSec(int pMask) { - Calendar cal = Calendar.getInstance(); - cal.set(Calendar.YEAR, mask(pMask, YEAR, this.iYear, 0)); - cal.set(Calendar.MONTH, mask(pMask, MONTH, this.iMonth - 1, 0)); - cal.set(Calendar.DAY_OF_MONTH, mask(pMask, DAY, this.iDay, 1)); - cal.set(Calendar.HOUR_OF_DAY, mask(pMask, HOUR, this.iHour, 0)); - cal.set(Calendar.MINUTE, mask(pMask, MIN, this.iMin, 0)); - cal.set(Calendar.SECOND, mask(pMask, SEC, this.iSec, 0)); - int millis = this.iUSec / 1000, micros = this.iUSec % 1000; - cal.set(Calendar.MILLISECOND, mask(pMask, USEC, millis, 0)); - long totalMicros = cal.getTimeInMillis() * 1000; - if ((pMask & USEC) > 0) totalMicros += micros; - /* - * UTC is added to the calculated micros - */ - if ((pMask & UTC) > 0) totalMicros += this.iUtc * 60000000L; - return totalMicros; - } - - /** - * Initializes this CIMDateTimeAbsolute object from the - * Calendar passed in. - * - * @param pCal - * Calendar object. - */ - private void set(Calendar pCal) { - this.iYear = pCal.get(Calendar.YEAR); - this.iMonth = pCal.get(Calendar.MONTH) + 1; - this.iDay = pCal.get(Calendar.DAY_OF_MONTH); - this.iHour = pCal.get(Calendar.HOUR_OF_DAY); - this.iMin = pCal.get(Calendar.MINUTE); - this.iSec = pCal.get(Calendar.SECOND); - this.iUSec = pCal.get(Calendar.MILLISECOND) * 1000; - if (pCal.getTimeZone().inDaylightTime(pCal.getTime())) { - this.iUtc = (pCal.get(Calendar.ZONE_OFFSET) + pCal.get(Calendar.DST_OFFSET)) / 60000; - } else { - this.iUtc = pCal.get(Calendar.ZONE_OFFSET) / 60000; - } - } - -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-10-06 ebak Make SBLIM client JSR48 compliant + * 1678807 2007-03-12 ebak Minor CIMDateTime suggestions + * 1931621 2008-04-02 blaschke-oss CIMDateTimeAbsolute(Calendar) does not respect DST + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2750520 2009-04-10 blaschke-oss Code cleanup from empty statement et al + * 2795671 2009-05-22 raman_arora Add Type to Comparable + * 2806362 2009-06-14 blaschke-oss Missing new CIMDateTimeAbsolute.getUTCOffset() method + * 2935258 2010-01-22 blaschke-oss Sync up javax.cim.* javadoc with JSR48 1.0.0 + * 2944826 2010-02-08 blaschke-oss getUTCOffset() incorrect if not significant field + * 2973300 2010-03-19 blaschke-oss TCK: CIMDateTimeXXX.compareTo() does not handle null + * 3022501 2010-06-30 blaschke-oss Possible integer overflow in getTotalUSec + * 3400209 2011-08-31 blaschke-oss Highlighted Static Analysis (PMD) issues + * 3565581 2012-09-07 blaschke-oss TCK: remove unnecessary overriding methods + * 2674 2013-09-26 blaschke-oss Null pointer exception in CIMDateTime(String) + * 2716 2013-12-11 blaschke-oss Sync up javax.* javadoc with JSR48 1.0.0 Final V + */ + +package org.metricshub.wbem.javax.cim; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.Calendar; + +import org.metricshub.wbem.sblim.cimclient.internal.cim.DTStringReader; +import org.metricshub.wbem.sblim.cimclient.internal.cim.DTStringWriter; + +//Sync'd against JSR48 1.0.0 javadoc (version 1.7.0_03) on Tue Dec 10 07:02:50 EST 2013 +/** + * This class represents the datetime data type when used as a time value as + * specified in the CIM Infrastructure specification. It is in the format + * yyyyMMddHHmmss.SSSSSSsutc where: + *
        + *
      • yyyy - is a 4 digit year
      • + *
      • MM - is the month
      • + *
      • dd - is the day of the month
      • + *
      • HH - is the hour (24 hour clock)
      • + *
      • mm - is the minute
      • + *
      • ss - is the second
      • + *
      • SSSSSS - is the number of microseconds
      • + *
      • s - is "+" or "-", indicating the sign of the UTC (Universal Coordinated + * Time; for all intents and purposes the same as Greenwich Mean Time)
      • + *
      • utc - is the offset from UTC in minutes (using the sign indicated by s).
      • + *
      + * For example Monday, May 25, 1998, at 1:30 PM EST would be represented as: + * 19980525133015.000000-300. Values must be zero-padded so that the entire + * string is always the same 25-character length. Fields which are not + * significant must be replaced with asterisk characters. + */ +public class CIMDateTimeAbsolute extends CIMDateTime { + + private static final long serialVersionUID = 7556792806296945178l; + + private int iYear, iMonth, iDay, iHour, iMin, iSec, iUSec, iUtc; + + private boolean iUnsignificantUtc; + + private String iStr; + + /** + * Create a CIMDateTimeAbsolute object using the current + * Time/Date of the system. + */ + public CIMDateTimeAbsolute() { + set(Calendar.getInstance()); + } + + /** + * Create a CIMDateTimeAbsolute object using a + * Calendar object. + * + * @param pCalendar + * A Calendar object used to initialize this object. + * @throws IllegalArgumentException + * If Calendar object is null. + */ + public CIMDateTimeAbsolute(Calendar pCalendar) throws IllegalArgumentException { + if (pCalendar == null) throw new IllegalArgumentException("Null Calendar is not allowed!"); + if (pCalendar.get(Calendar.YEAR) > 9999) throw new IllegalArgumentException( + "The year field cannot be greater than 9999!"); + set(pCalendar); + } + + /** + * Creates a CIMDateTimeAbsolute object using a string. + * + * @param pDateTime + * A string in the format of yyyyMMddHHmmss.SSSSSSsutc. + * @throws IllegalArgumentException + * If string is not in the correct format or null. + */ + public CIMDateTimeAbsolute(String pDateTime) throws IllegalArgumentException { + if (pDateTime == null) throw new IllegalArgumentException("Null DateTime is not allowed!"); + DTStringReader reader = new DTStringReader(pDateTime); + this.iYear = reader.readAndCheck(4, "year", 0, 9999, true); + this.iMonth = reader.readAndCheck(2, "month", 1, 12, true); + this.iDay = reader.readAndCheck(2, "day", 1, 31, true); + this.iHour = reader.readAndCheck(2, "hour", 0, 23, true); + this.iMin = reader.readAndCheck(2, "minute", 0, 59, true); + this.iSec = reader.readAndCheck(2, "second", 0, 59, true); + reader.read('.'); + this.iUSec = reader.readAndCheck(6, "microSeconds", 0, 999999, true); + char sign = reader.read(); + if (sign != '+' && sign != '-') { + String msg = "Illegal character '" + sign + "' at position " + reader.getPos() + + "! '+' or '-' is expected."; + throw new IllegalArgumentException(msg); + } + this.iUtc = reader.read(3, "utc", true); + if (reader.isUnsignificant()) { + this.iUnsignificantUtc = true; + } else if (sign == '-') { + this.iUtc = -this.iUtc; + } + if (reader.read() != 0) throw new IllegalArgumentException("Extra character at the end of " + + pDateTime + " !"); + this.iStr = pDateTime; + } + + /** + * Compares the CIMDateTimeAbsolute object with this one. If + * either date has "Not Significant" fields then we can only compare the + * significant fields. + * + * @param pDateTime + * The CIMDateTimeAbsolute to be compared with this + * one. + * @return -1, zero, or 1 as this date is less than, equal to, or greater + * than the specified date. + * @throws IllegalArgumentException + * If the object passed in is not an instance of + * CIMDataTimeAbsolute. + */ + public int compareTo(CIMDateTime pDateTime) throws IllegalArgumentException { + if (!(pDateTime instanceof CIMDateTimeAbsolute)) { + String msg = "pDateTime must be a CIMDateTimeAbsolute instance while it is a " + + (pDateTime == null ? "null!" : pDateTime.getClass().getName() + " instance!"); + throw new IllegalArgumentException(msg); + } + + CIMDateTimeAbsolute that = (CIMDateTimeAbsolute) pDateTime; + /* + * Comparison: 1. building Calendars from both dates. If a field is not + * significant it and it's corresponding pair is cleared. + */ + int mask = getMask() & that.getMask(); + long thisMicros = getTotalUSec(mask); + long thatMicros = that.getTotalUSec(mask); + long val = thisMicros - thatMicros; + if (val == 0) return 0; + return val < 0 ? -1 : 1; + } + + /** + * Gets the internal string representation of the date/time object. + * + * @return The internal representation of the date/time object. + */ + @Override + public String getDateTimeString() { + if (this.iStr != null) return this.iStr; + // yyyyMMddHHmmss.uuuuuuSutc + DTStringWriter dTWriter = new DTStringWriter(); + dTWriter.write(4, this.iYear); + dTWriter.write(2, this.iMonth); + dTWriter.write(2, this.iDay); + dTWriter.write(2, this.iHour); + dTWriter.write(2, this.iMin); + dTWriter.write(2, this.iSec); + dTWriter.write('.'); + dTWriter.write(6, this.iUSec); + if (this.iUnsignificantUtc) dTWriter.write("+***"); + else dTWriter.writeSigned(3, this.iUtc); + return this.iStr = dTWriter.toString(); + } + + /** + * Returns day value of this date. + * + * @return If day field "not significant" this returns -1, otherwise returns + * day of this date. + */ + public int getDay() { + return this.iDay; + } + + /** + * Returns hour value of this date. + * + * @return If hour field "not significant" this returns -1, otherwise + * returns hour of this date. + */ + public int getHour() { + return this.iHour; + } + + /** + * Returns microsecond value of this date. + * + * @return If microsecond field "not significant" this returns -1, otherwise + * returns microseconds of this date. + */ + public int getMicrosecond() { + return this.iUSec; + } + + /** + * Returns minute value of this date. + * + * @return If minute field "not significant" this returns -1, otherwise + * returns minute of this date. + */ + public int getMinute() { + return this.iMin; + } + + /** + * Returns month value of this date. + * + * @return If month field "not significant" this returns -1, otherwise + * returns the month of this date. + */ + public int getMonth() { + return this.iMonth; + } + + /** + * Returns second value of this date. + * + * @return If second field "not significant" this returns -1, otherwise + * returns second of this date. + */ + public int getSecond() { + return this.iSec; + } + + /** + * Returns UTC offset value of this date. + * + * @return UTC offset of this date. + */ + public int getUTCOffset() { + return this.iUnsignificantUtc ? -1 : this.iUtc; + } + + /** + * Returns year value of this Date. + * + * @return If year field "not significant" this returns -1, otherwise + * returns the year of this date. + */ + public int getYear() { + return this.iYear; + } + + /** + * Returns the hash code for this object. + * + * @return A hash code value for this object. + * @see java.lang.Object#hashCode() + */ + @Override + public int hashCode() { + return getDateTimeString().hashCode(); + } + + /** + * Returns a String representation of the + * CIMDateTimeAbsolute. This method is intended to be used only + * for debugging purposes, and the format of the returned string may vary + * between implementations. The returned string may be empty but may not be + * null. + * + * @return String representation of this datetime. + */ + @Override + public String toString() { + return getDateTimeString(); + } + + private static final int YEAR = 1, MONTH = 2, DAY = 4, HOUR = 8, MIN = 16, SEC = 32, USEC = 64, + UTC = 128; + + /** + * Get mask of this CIMDateTimeAbsolute where bit is set if the + * corresponding field is significant or clear if it is not significant. + * + * @return Mask of significant fields in datetime object. + */ + private int getMask() { + int mask = 0; + if (this.iYear != -1) mask |= YEAR; + if (this.iMonth != -1) mask |= MONTH; + if (this.iDay != -1) mask |= DAY; + if (this.iHour != -1) mask |= HOUR; + if (this.iMin != -1) mask |= MIN; + if (this.iSec != -1) mask |= SEC; + if (this.iUSec != -1) mask |= USEC; + if (!this.iUnsignificantUtc) mask |= UTC; + return mask; + } + + /** + * Get value of a field based on mask. + * + * @param pMask + * Mask of significant fields. + * @param pField + * Field. + * @param pValue + * Value of field. + * @param pInitValue + * Initial value of field. + * @return Value of field if field significant, otherwise initial value. + */ + private int mask(int pMask, int pField, int pValue, int pInitValue) { + return ((pMask & pField) > 0) ? pValue : pInitValue; + } + + /** + * Get total microseconds of CIMDateTimeAbsolute object where + * only significant fields are used in calculation. + * + * @param pMask + * Mask of significant fields. + * @return Total microseconds of significant fields in datetime. + */ + private long getTotalUSec(int pMask) { + Calendar cal = Calendar.getInstance(); + cal.set(Calendar.YEAR, mask(pMask, YEAR, this.iYear, 0)); + cal.set(Calendar.MONTH, mask(pMask, MONTH, this.iMonth - 1, 0)); + cal.set(Calendar.DAY_OF_MONTH, mask(pMask, DAY, this.iDay, 1)); + cal.set(Calendar.HOUR_OF_DAY, mask(pMask, HOUR, this.iHour, 0)); + cal.set(Calendar.MINUTE, mask(pMask, MIN, this.iMin, 0)); + cal.set(Calendar.SECOND, mask(pMask, SEC, this.iSec, 0)); + int millis = this.iUSec / 1000, micros = this.iUSec % 1000; + cal.set(Calendar.MILLISECOND, mask(pMask, USEC, millis, 0)); + long totalMicros = cal.getTimeInMillis() * 1000; + if ((pMask & USEC) > 0) totalMicros += micros; + /* + * UTC is added to the calculated micros + */ + if ((pMask & UTC) > 0) totalMicros += this.iUtc * 60000000L; + return totalMicros; + } + + /** + * Initializes this CIMDateTimeAbsolute object from the + * Calendar passed in. + * + * @param pCal + * Calendar object. + */ + private void set(Calendar pCal) { + this.iYear = pCal.get(Calendar.YEAR); + this.iMonth = pCal.get(Calendar.MONTH) + 1; + this.iDay = pCal.get(Calendar.DAY_OF_MONTH); + this.iHour = pCal.get(Calendar.HOUR_OF_DAY); + this.iMin = pCal.get(Calendar.MINUTE); + this.iSec = pCal.get(Calendar.SECOND); + this.iUSec = pCal.get(Calendar.MILLISECOND) * 1000; + if (pCal.getTimeZone().inDaylightTime(pCal.getTime())) { + this.iUtc = (pCal.get(Calendar.ZONE_OFFSET) + pCal.get(Calendar.DST_OFFSET)) / 60000; + } else { + this.iUtc = pCal.get(Calendar.ZONE_OFFSET) / 60000; + } + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/javax/cim/CIMDateTimeInterval.java b/src/main/java/org/metricshub/wbem/javax/cim/CIMDateTimeInterval.java similarity index 93% rename from src/main/java/org/sentrysoftware/wbem/javax/cim/CIMDateTimeInterval.java rename to src/main/java/org/metricshub/wbem/javax/cim/CIMDateTimeInterval.java index 4488470..d36ea4f 100644 --- a/src/main/java/org/sentrysoftware/wbem/javax/cim/CIMDateTimeInterval.java +++ b/src/main/java/org/metricshub/wbem/javax/cim/CIMDateTimeInterval.java @@ -1,565 +1,563 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-10-06 ebak Make SBLIM client JSR48 compliant - * 1678807 2007-03-12 ebak Minor CIMDateTime suggestions - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2750520 2009-04-10 blaschke-oss Code cleanup from empty statement et al - * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors - * 2795671 2009-05-22 raman_arora Add Type to Comparable - * 2935258 2010-01-22 blaschke-oss Sync up javax.cim.* javadoc with JSR48 1.0.0 - * 2944830 2010-02-08 blaschke-oss Fix spelling of checkGranurality() - * 2973300 2010-03-19 blaschke-oss TCK: CIMDateTimeXXX.compareTo() does not handle null - * 2989367 2010-04-29 blaschke-oss CIMDateTimeInterval(long) constructor range wrong - * 2989424 2010-04-29 blaschke-oss TCK: CIMDateTimeInterval constructor - * 2992349 2010-04-29 blaschke-oss CIMDateTimeInterval hr/min/sec max is 23/59/59, not 24/60/60 - * 2994249 2010-04-30 blaschke-oss CIMDateTimeInterval(long) calculates milliseconds - * 3018178 2010-06-18 blaschke-oss CIMDateTimeInterval clean up - * 3026302 2010-07-07 blaschke-oss CIMDateTimeInterval uses # constructor instead of valueOf - * 3400209 2011-08-31 blaschke-oss Highlighted Static Analysis (PMD) issues - * 3565581 2012-09-07 blaschke-oss TCK: remove unnecessary overriding methods - * 2674 2013-09-26 blaschke-oss Null pointer exception in CIMDateTime(String) - * 2716 2013-12-11 blaschke-oss Sync up javax.* javadoc with JSR48 1.0.0 Final V - */ - -package org.sentrysoftware.wbem.javax.cim; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cim.DTStringReader; -import org.sentrysoftware.wbem.sblim.cimclient.internal.cim.DTStringWriter; - -//Sync'd against JSR48 1.0.0 javadoc (version 1.7.0_03) on Tue Dec 10 07:02:50 EST 2013 -/** - * This class represents the datetime data type when used as a time value as - * specified by the Distributed Management Task Force (DMTF) CIM Infrastructure Specification (DSP004). It is in the format ddddddddHHMMSS.mmmmmm:000 where: - *
        - *
      • dddddddd - is the days in interval
      • - *
      • HH - is the hours in interval
      • - *
      • MM - is the minutes in interval
      • - *
      • SS - is the seconds in interval
      • - *
      • mmmmmm - is the microseconds in interval
      • - *
      - * For example, an elapsed time of 1 day, 13 hours, 23 minutes, 12 seconds would - * be: 00000001132312.000000:000. A UTC offset of zero is always used for - * interval properties.
      - * Fields that are not significant MUST be replaced with asterisk ("*") - * characters. Not significant fields are those that are beyond the resolution - * of the data source. This is used to indicate the precision of the value and - * can only be done for an adjacent set of fields, starting with the least - * significant field (mmmmmm), and continuing to more significant fields. The - * granularity of using asterisks is always the entire field, except for the - * mmmmmm field where the granularity is single digits. The UTC offset field - * MUST NOT contain asterisks.
      - * For example, if an interval of 1 day, 13 hours, 23 minutes, 12 seconds, and - * 125 milliseconds was measured with a precision of 1 millisecond, the format - * would be: 00000001132312.125***:000. - * - */ -public class CIMDateTimeInterval extends CIMDateTime { - - private static final long serialVersionUID = -7362881414085831668l; - - private int iDays, iHours, iMinutes, iSeconds, iUSeconds; - - private String iStr; - - private boolean iTotalMicrosCalced; - - private long iTotalMicros; - - private int iUnsignificantUSecDigits; - - private static final int MAX_DAY = 99999999, MAX_HOUR = 23, MAX_MIN = 59, MAX_SEC = 59, - MAX_MILLISEC = 999, MAX_MICROSEC = 999999; - - private static final long MAX_INTERVAL = ((((long) MAX_DAY * 24 * 60 * 60) - + ((long) MAX_HOUR * 60 * 60) + ((long) MAX_MIN * 60) + MAX_SEC) * 1000) - + MAX_MILLISEC; - - private static final long MILLISEC_ACCURACY_DIV = 1000, - SEC_ACCURACY_DIV = 1000 * MILLISEC_ACCURACY_DIV, - MIN_ACCURACY_DIV = 60 * SEC_ACCURACY_DIV, HOUR_ACCURACY_DIV = 60 * MIN_ACCURACY_DIV, - DAY_ACCURACY_DIV = 24 * HOUR_ACCURACY_DIV, - NO_ACCURACY_DIV = 100000000 * DAY_ACCURACY_DIV; - - private static final long[] USEC_ACCURACY_DIV_A = { 1, 10, 100, MILLISEC_ACCURACY_DIV, 10000, - 100000, SEC_ACCURACY_DIV }; - - private long iAccuracyDivisor = 1; - - /** - * Constructs a CIMDateTimeInterval using the individual values - * of the interval (day, hours, minutes, seconds and microseconds). Any - * property that has a -1 will make that field "not significant" (i.e. that - * field has asterisks in the datetime string). - * - * @param pDays - * Number of days in the interval (-1 - 99999999). - * @param pHours - * Number of hours in the interval (-1 - 23). - * @param pMinutes - * Number of minutes in the interval (-1 - 59). - * @param pSeconds - * Number of seconds in the interval (-1 - 59). - * @param pMicroseconds - * Number of microseconds in the interval (-1 - 999999). - * @throws IllegalArgumentException - * If any value is not valid. - */ - public CIMDateTimeInterval(int pDays, int pHours, int pMinutes, int pSeconds, int pMicroseconds) - throws IllegalArgumentException { - boolean notSignificant = checkLimits("pDays", pDays, 0, MAX_DAY, false); - if (notSignificant) this.iAccuracyDivisor = NO_ACCURACY_DIV; - notSignificant = checkLimits("pHours", pHours, 0, MAX_HOUR, notSignificant); - if (notSignificant && this.iAccuracyDivisor == 1) this.iAccuracyDivisor = DAY_ACCURACY_DIV; - notSignificant = checkLimits("pMinutes", pMinutes, 0, MAX_MIN, notSignificant); - if (notSignificant && this.iAccuracyDivisor == 1) this.iAccuracyDivisor = HOUR_ACCURACY_DIV; - notSignificant = checkLimits("pSeconds", pSeconds, 0, MAX_SEC, notSignificant); - if (notSignificant && this.iAccuracyDivisor == 1) this.iAccuracyDivisor = MIN_ACCURACY_DIV; - notSignificant = checkLimits("pMicroseconds", pMicroseconds, 0, MAX_MICROSEC, - notSignificant); - if (notSignificant) { - this.iUnsignificantUSecDigits = 6; - if (this.iAccuracyDivisor == 1) this.iAccuracyDivisor = USEC_ACCURACY_DIV_A[this.iUnsignificantUSecDigits]; - } else { - this.iUnsignificantUSecDigits = 0; - } - - this.iDays = pDays; - this.iHours = pHours; - this.iMinutes = pMinutes; - this.iSeconds = pSeconds; - this.iUSeconds = pMicroseconds; - - debug("CIMDateTimeInterval(" + pDays + "," + pHours + "," + pMinutes + "," + pSeconds + "," - + pMicroseconds + "): days=" + this.iDays + ", hours=" + this.iHours + ", mins=" - + this.iMinutes + ", secs=" + this.iSeconds + ", usecs=" + this.iUSeconds - + ", acc div=" + this.iAccuracyDivisor + ", unsig digits=" - + this.iUnsignificantUSecDigits); - } - - /** - * Constructs a CIMDateTimeInterval using a milliseconds value. - * - * @param pMilliseconds - * Number of milliseconds in the interval (0 - 8639999999999999). - * @throws IllegalArgumentException - */ - public CIMDateTimeInterval(long pMilliseconds) throws IllegalArgumentException { - if (pMilliseconds < 0 || pMilliseconds > MAX_INTERVAL) throw new IllegalArgumentException( - "pMilliseconds must be between 0 and " + MAX_INTERVAL + ". " + pMilliseconds - + " is illegal!"); - long totalUSecs = pMilliseconds * 1000; - long totalSecs = pMilliseconds / 1000; - long totalMins = totalSecs / 60; - long totalHours = totalMins / 60; - long totalDays = totalHours / 24; - - this.iUSeconds = (int) (totalUSecs % 1000000); - this.iSeconds = (int) (totalSecs % 60); - this.iMinutes = (int) (totalMins % 60); - this.iHours = (int) (totalHours % 24); - this.iDays = (int) totalDays; - - this.iUnsignificantUSecDigits = 3; - this.iAccuracyDivisor = USEC_ACCURACY_DIV_A[this.iUnsignificantUSecDigits]; - - this.iTotalMicrosCalced = true; - this.iTotalMicros = pMilliseconds * 1000; - - debug("CIMDateTimeInterval(" + pMilliseconds + "): days=" + this.iDays + ", hours=" - + this.iHours + ", mins=" + this.iMinutes + ", secs=" + this.iSeconds + ", usecs=" - + this.iUSeconds + ", acc div=" + this.iAccuracyDivisor + ", unsig digits=" - + this.iUnsignificantUSecDigits); - } - - /** - * Creates a CIMDateTimeInterval object using a string. - * - * @param pIntervalString - * A string in the format of ddddddddHHMMSS.mmmmmm:000. - * @throws IllegalArgumentException - * If string is not in the correct format or null. - */ - public CIMDateTimeInterval(String pIntervalString) throws IllegalArgumentException { - if (pIntervalString == null) throw new IllegalArgumentException( - "Null IntervalString is not allowed!"); - if (pIntervalString.length() != LENGTH) throw new IllegalArgumentException("Length of " - + pIntervalString + " must be " + LENGTH + ", " + pIntervalString.length() - + " is not valid!"); - String intervalStr = setAccuracy(pIntervalString); - DTStringReader dtReader = new DTStringReader(intervalStr); - this.iDays = dtReader.readAndCheck(8, "days", 0, MAX_DAY, true); - this.iHours = dtReader.readAndCheck(2, "hours", 0, MAX_HOUR, true); - this.iMinutes = dtReader.readAndCheck(2, "minutes", 0, MAX_MIN, true); - this.iSeconds = dtReader.readAndCheck(2, "seconds", 0, MAX_SEC, true); - dtReader.read('.'); - this.iUSeconds = dtReader.readAndCheck(6, "microseconds", 0, MAX_MICROSEC, false); - if (this.iAccuracyDivisor >= SEC_ACCURACY_DIV) this.iUSeconds = -1; - dtReader.read(':'); - int zeros = dtReader.read(3, "zeros", false); - if (zeros != 0) { - String msg = "In " + pIntervalString - + " the last 3 characters after ':' must be zeros!"; - throw new IllegalArgumentException(msg); - } - - debug("CIMDateTimeInterval(\"" + pIntervalString + "\"): days=" + this.iDays + ", hours=" - + this.iHours + ", mins=" + this.iMinutes + ", secs=" + this.iSeconds + ", usecs=" - + this.iUSeconds + ", acc div=" + this.iAccuracyDivisor + ", unsig digits=" - + this.iUnsignificantUSecDigits); - } - - /** - * Compares the CIMDateTimeInterval object with this one. If - * either interval has "Not Significant" fields then we only compare the - * significant fields. - * - * @param pObj - * The CIMDateTimeInterval to be compared with this - * one. - * @return -1, zero, or 1 as this interval is less than, equal to, or - * greater than the specified interval. - * @throws IllegalArgumentException - * If the object passed in is not an instance of - * CIMDataTimeInterval. - */ - public int compareTo(CIMDateTime pObj) throws IllegalArgumentException { - if (!(pObj instanceof CIMDateTimeInterval)) { - String msg = "This method requires a CIMDateTimeInterval instance, while it has received a " - + (pObj == null ? "null!" : pObj.getClass().getName() + " instance!"); - throw new IllegalArgumentException(msg); - } - CIMDateTimeInterval that = (CIMDateTimeInterval) pObj; - long accuracyDivisor = Math.max(this.iAccuracyDivisor, that.iAccuracyDivisor); - debug("this.acDiv=" + this.iAccuracyDivisor + ", that.acDiv=" + that.iAccuracyDivisor - + ", acDiv=" + accuracyDivisor); - Long thisMicros = Long.valueOf(calcMicros(accuracyDivisor)); - Long thatMicros = Long.valueOf(that.calcMicros(accuracyDivisor)); - debug("thisUs=" + thisMicros + ", thatUs=" + thatMicros); - return thisMicros.compareTo(thatMicros); - } - - /** - * Gets the internal string representation of this object. - * - * @return The internal representation of the - * CIMDateTimeInterval object. - */ - @Override - public String getDateTimeString() { - if (this.iStr != null) return this.iStr; - // ddddddddHHMMSS.mmmmmm:000 - DTStringWriter dtWriter = new DTStringWriter(); - dtWriter.write(8, this.iDays); - dtWriter.write(2, this.iHours); - dtWriter.write(2, this.iMinutes); - dtWriter.write(2, this.iSeconds); - dtWriter.write('.'); - dtWriter.writeUSec(this.iUSeconds / (int) this.iAccuracyDivisor, - this.iUnsignificantUSecDigits); - dtWriter.write(":000"); - return dtWriter.toString(); - } - - /** - * Returns days value of this interval. - * - * @return If days field "not significant" this returns -1, otherwise - * returns number of days in the interval. - */ - public int getDays() { - return this.iDays; - } - - /** - * Returns hours value of this interval. - * - * @return If hours field "not significant" this returns -1, otherwise - * returns number of hours in the interval. - */ - public int getHours() { - return this.iHours; - } - - /** - * Returns microseconds value of this interval. - * - * @return If microseconds field "not significant" this returns -1, - * otherwise returns number of microseconds in the interval. - */ - public int getMicroseconds() { - return this.iUSeconds; - } - - /** - * Returns minutes value of this interval. - * - * @return If minutes field "not significant" this returns -1, otherwise - * returns number of minutes in the interval. - */ - public int getMinutes() { - return this.iMinutes; - } - - /** - * Returns seconds value of this interval. - * - * @return If seconds field "not significant" this returns -1, otherwise - * returns number of seconds in the interval. - */ - public int getSeconds() { - return this.iSeconds; - } - - /** - * Returns the total length of the interval in milliseconds. - * - * @return The length of the interval in milliseconds. - */ - public long getTotalMilliseconds() { - return getTotalMicros() / 1000; - } - - /** - * Returns the hash code for this object. - * - * @return A hash code value for this object. - * @see java.lang.Object#hashCode() - */ - @Override - public int hashCode() { - return getDateTimeString().hashCode(); - } - - /** - * Returns a String representation of the - * CIMDateTimeInterval. This method is intended to be used only - * for debugging purposes, and the format of the returned string may vary - * between implementations. The returned string may be empty but may not be - * null. - * - * @return String representation of this datetime. - */ - @Override - public String toString() { - return getDateTimeString(); - } - - // ddddddddHHMMSS.mmmmmm:000 - - private static final int DAY_START_IDX = 0, HOUR_START_IDX = 8, MIN_START_IDX = 10, - SEC_START_IDX = 12, DOT_IDX = 14, USEC_START_IDX = 15, UTC_START_IDX = 21, LENGTH = 25; - - /** - * Checks the granularity of the CIMDateTimeAbsolute precision. - * - * @param pIdx - * Index of first asterisk in datetime string. - * @param pFieldName - * Name of field. - * @param pFieldStartIdx - * Index of first character in field of datetime string. - * @param pNextStartIdx - * Index of first character in subsequent field of datetime - * string. - * @return true if field is completely unsignificant, - * false otherwise. - * @throws IllegalArgumentException - * If field is not completely significant or completely - * unsignificant (mix of asterisks and digits). - */ - private boolean checkGranularity(int pIdx, String pFieldName, int pFieldStartIdx, - int pNextStartIdx) throws IllegalArgumentException { - if (pIdx > pFieldStartIdx && pIdx < pNextStartIdx) throw new IllegalArgumentException( - "Partial unsignificant digits are not allowed for field " + pFieldName + " in " - + this.iStr + "!"); - return pIdx == pFieldStartIdx; - } - - /** - * Find index of first asterisk within string. - * - * @param pIvStr - * Time interval string. - * @return Index of first asterisk or -1 if asterisk does not exist. - */ - private static int findStar(String pIvStr) { - for (int i = 0; i < UTC_START_IDX; i++) - if (pIvStr.charAt(i) == '*') return i; - return -1; - } - - /** - * Verify that all characters in the string after the starting index are - * asterisks. - * - * @param pIvStr - * Time interval string. - * @param pStartIdx - * Starting index. - */ - private static void checkStars(String pIvStr, int pStartIdx) { - for (int i = pStartIdx; i < UTC_START_IDX; i++) { - char ch = pIvStr.charAt(i); - if (i != DOT_IDX && ch != '*') throw new IllegalArgumentException("In " + pIvStr - + " every digit character after the first '*' character must " + "be '*', '" - + ch + "' is invalid!"); - } - } - - /** - * Determines the accuracy (precision) of the interval string and replaces - * all asterisks in microsecond field with zeros. - * - * @param pIntervalStr - * Time interval string. - * @return Corrected time interval string with iAccuracyDivisor - * set. - */ - private String setAccuracy(String pIntervalStr) throws IllegalArgumentException { - this.iStr = pIntervalStr; - /* - * String transformation. Checking the correct location of '*' - * characters. '*' characters in usec field are replaced into '0' - * characters - */ - int startIdx = findStar(this.iStr); - if (startIdx < 0) return this.iStr; - // all remaining digit fields must contain '*' characters except for utc - checkStars(this.iStr, startIdx + 1); - if (checkGranularity(startIdx, "Day", DAY_START_IDX, HOUR_START_IDX)) { - this.iAccuracyDivisor = NO_ACCURACY_DIV; - } else if (checkGranularity(startIdx, "Hour", HOUR_START_IDX, MIN_START_IDX)) { - this.iAccuracyDivisor = DAY_ACCURACY_DIV; - } else if (checkGranularity(startIdx, "Minute", MIN_START_IDX, SEC_START_IDX)) { - this.iAccuracyDivisor = HOUR_ACCURACY_DIV; - } else if (checkGranularity(startIdx, "Second", SEC_START_IDX, DOT_IDX)) { - this.iAccuracyDivisor = MIN_ACCURACY_DIV; - } else { - // dealing with usec granularity - this.iUnsignificantUSecDigits = UTC_START_IDX - startIdx; - this.iAccuracyDivisor = USEC_ACCURACY_DIV_A[this.iUnsignificantUSecDigits]; - } - // all '*' in usec field is replaced into '0' - char[] buf = this.iStr.toCharArray(); - if (startIdx < USEC_START_IDX) startIdx = USEC_START_IDX; - for (int i = startIdx; i < UTC_START_IDX; i++) { - if (i == DOT_IDX) continue; - if (this.iStr.charAt(i) != '*') throw new IllegalArgumentException( - "All remaining digits must be marked as unsignificant in " + this.iStr + " !"); - buf[i] = '0'; - } - return new String(buf); - } - - /** - * Get total microseconds of CIMDateTimeInterval object. - * - * @return Total microseconds of time interval. - */ - private long getTotalMicros() { - if (this.iTotalMicrosCalced) return this.iTotalMicros; - this.iTotalMicrosCalced = true; - // iTotalMicros = iUSeconds + 1000000 * (iSeconds + 60 * (iMinutes + 60 - // * (iHours + 24 * iDays))); - this.iTotalMicros = this.iUSeconds > 0 ? this.iUSeconds : 0; - if (this.iSeconds > 0) this.iTotalMicros += SEC_ACCURACY_DIV * this.iSeconds; - if (this.iMinutes > 0) this.iTotalMicros += MIN_ACCURACY_DIV * this.iMinutes; - if (this.iHours > 0) this.iTotalMicros += HOUR_ACCURACY_DIV * this.iHours; - if (this.iDays > 0) this.iTotalMicros += DAY_ACCURACY_DIV * this.iDays; - debug("days=" + this.iDays + " ,hours=" + this.iHours + " ,mins=" + this.iMinutes - + ", secs=" + this.iSeconds + ", usecs=" + this.iUSeconds + ", totalMicros=" - + this.iTotalMicros); - return this.iTotalMicros; - } - - /** - * Calculates microseconds of CIMDateTimeInterval object taking - * accuracy (precision) into consideration. - * - * @param pAccuracyDivisor - * Accuracy divisor of time interval. - * @return Total microseconds of time interval rounded down to precision. - */ - private long calcMicros(long pAccuracyDivisor) { - long remainder = getTotalMicros() % pAccuracyDivisor; - return getTotalMicros() - remainder; - } - - /** - * Checks validity of time interval field, making sure value is between - * minimum and maximum values and is not significant if following an - * unsignifcant field. - * - * @param pName - * Name of field. - * @param pValue - * Value of field. - * @param pLow - * Minimum value of field. - * @param pHigh - * Maximum value of field. - * @param pNotSignificant - * trueif previous field not significant. - * @return true if field is not significant, false - * otherwise. - * @throws IllegalArgumentException - */ - private static boolean checkLimits(String pName, int pValue, int pLow, int pHigh, - boolean pNotSignificant) throws IllegalArgumentException { - if (pValue == -1) return true; - if (pNotSignificant) throw new IllegalArgumentException( - "Not significant fields must be followed by not significant fields!"); - if (pValue < pLow || pValue > pHigh) throw new IllegalArgumentException(pName - + " must be between " + pLow + " and " + pHigh + ". " + pValue + " is invalid!"); - return false; - } - - /** - * Prints debug message. - * - * @param pMsg - * Debug message. - */ - private static void debug(String pMsg) { - // System.out.println(pMsg); - } -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-10-06 ebak Make SBLIM client JSR48 compliant + * 1678807 2007-03-12 ebak Minor CIMDateTime suggestions + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2750520 2009-04-10 blaschke-oss Code cleanup from empty statement et al + * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors + * 2795671 2009-05-22 raman_arora Add Type to Comparable + * 2935258 2010-01-22 blaschke-oss Sync up javax.cim.* javadoc with JSR48 1.0.0 + * 2944830 2010-02-08 blaschke-oss Fix spelling of checkGranurality() + * 2973300 2010-03-19 blaschke-oss TCK: CIMDateTimeXXX.compareTo() does not handle null + * 2989367 2010-04-29 blaschke-oss CIMDateTimeInterval(long) constructor range wrong + * 2989424 2010-04-29 blaschke-oss TCK: CIMDateTimeInterval constructor + * 2992349 2010-04-29 blaschke-oss CIMDateTimeInterval hr/min/sec max is 23/59/59, not 24/60/60 + * 2994249 2010-04-30 blaschke-oss CIMDateTimeInterval(long) calculates milliseconds + * 3018178 2010-06-18 blaschke-oss CIMDateTimeInterval clean up + * 3026302 2010-07-07 blaschke-oss CIMDateTimeInterval uses # constructor instead of valueOf + * 3400209 2011-08-31 blaschke-oss Highlighted Static Analysis (PMD) issues + * 3565581 2012-09-07 blaschke-oss TCK: remove unnecessary overriding methods + * 2674 2013-09-26 blaschke-oss Null pointer exception in CIMDateTime(String) + * 2716 2013-12-11 blaschke-oss Sync up javax.* javadoc with JSR48 1.0.0 Final V + */ + +package org.metricshub.wbem.javax.cim; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.sblim.cimclient.internal.cim.DTStringReader; +import org.metricshub.wbem.sblim.cimclient.internal.cim.DTStringWriter; + +//Sync'd against JSR48 1.0.0 javadoc (version 1.7.0_03) on Tue Dec 10 07:02:50 EST 2013 +/** + * This class represents the datetime data type when used as a time value as + * specified by the Distributed Management Task Force (DMTF) CIM Infrastructure Specification (DSP004). It is in the format ddddddddHHMMSS.mmmmmm:000 where: + *
        + *
      • dddddddd - is the days in interval
      • + *
      • HH - is the hours in interval
      • + *
      • MM - is the minutes in interval
      • + *
      • SS - is the seconds in interval
      • + *
      • mmmmmm - is the microseconds in interval
      • + *
      + * For example, an elapsed time of 1 day, 13 hours, 23 minutes, 12 seconds would + * be: 00000001132312.000000:000. A UTC offset of zero is always used for + * interval properties.
      + * Fields that are not significant MUST be replaced with asterisk ("*") + * characters. Not significant fields are those that are beyond the resolution + * of the data source. This is used to indicate the precision of the value and + * can only be done for an adjacent set of fields, starting with the least + * significant field (mmmmmm), and continuing to more significant fields. The + * granularity of using asterisks is always the entire field, except for the + * mmmmmm field where the granularity is single digits. The UTC offset field + * MUST NOT contain asterisks.
      + * For example, if an interval of 1 day, 13 hours, 23 minutes, 12 seconds, and + * 125 milliseconds was measured with a precision of 1 millisecond, the format + * would be: 00000001132312.125***:000. + * + */ +public class CIMDateTimeInterval extends CIMDateTime { + + private static final long serialVersionUID = -7362881414085831668l; + + private int iDays, iHours, iMinutes, iSeconds, iUSeconds; + + private String iStr; + + private boolean iTotalMicrosCalced; + + private long iTotalMicros; + + private int iUnsignificantUSecDigits; + + private static final int MAX_DAY = 99999999, MAX_HOUR = 23, MAX_MIN = 59, MAX_SEC = 59, + MAX_MILLISEC = 999, MAX_MICROSEC = 999999; + + private static final long MAX_INTERVAL = ((((long) MAX_DAY * 24 * 60 * 60) + + ((long) MAX_HOUR * 60 * 60) + ((long) MAX_MIN * 60) + MAX_SEC) * 1000) + + MAX_MILLISEC; + + private static final long MILLISEC_ACCURACY_DIV = 1000, + SEC_ACCURACY_DIV = 1000 * MILLISEC_ACCURACY_DIV, + MIN_ACCURACY_DIV = 60 * SEC_ACCURACY_DIV, HOUR_ACCURACY_DIV = 60 * MIN_ACCURACY_DIV, + DAY_ACCURACY_DIV = 24 * HOUR_ACCURACY_DIV, + NO_ACCURACY_DIV = 100000000 * DAY_ACCURACY_DIV; + + private static final long[] USEC_ACCURACY_DIV_A = { 1, 10, 100, MILLISEC_ACCURACY_DIV, 10000, + 100000, SEC_ACCURACY_DIV }; + + private long iAccuracyDivisor = 1; + + /** + * Constructs a CIMDateTimeInterval using the individual values + * of the interval (day, hours, minutes, seconds and microseconds). Any + * property that has a -1 will make that field "not significant" (i.e. that + * field has asterisks in the datetime string). + * + * @param pDays + * Number of days in the interval (-1 - 99999999). + * @param pHours + * Number of hours in the interval (-1 - 23). + * @param pMinutes + * Number of minutes in the interval (-1 - 59). + * @param pSeconds + * Number of seconds in the interval (-1 - 59). + * @param pMicroseconds + * Number of microseconds in the interval (-1 - 999999). + * @throws IllegalArgumentException + * If any value is not valid. + */ + public CIMDateTimeInterval(int pDays, int pHours, int pMinutes, int pSeconds, int pMicroseconds) + throws IllegalArgumentException { + boolean notSignificant = checkLimits("pDays", pDays, 0, MAX_DAY, false); + if (notSignificant) this.iAccuracyDivisor = NO_ACCURACY_DIV; + notSignificant = checkLimits("pHours", pHours, 0, MAX_HOUR, notSignificant); + if (notSignificant && this.iAccuracyDivisor == 1) this.iAccuracyDivisor = DAY_ACCURACY_DIV; + notSignificant = checkLimits("pMinutes", pMinutes, 0, MAX_MIN, notSignificant); + if (notSignificant && this.iAccuracyDivisor == 1) this.iAccuracyDivisor = HOUR_ACCURACY_DIV; + notSignificant = checkLimits("pSeconds", pSeconds, 0, MAX_SEC, notSignificant); + if (notSignificant && this.iAccuracyDivisor == 1) this.iAccuracyDivisor = MIN_ACCURACY_DIV; + notSignificant = checkLimits("pMicroseconds", pMicroseconds, 0, MAX_MICROSEC, + notSignificant); + if (notSignificant) { + this.iUnsignificantUSecDigits = 6; + if (this.iAccuracyDivisor == 1) this.iAccuracyDivisor = USEC_ACCURACY_DIV_A[this.iUnsignificantUSecDigits]; + } else { + this.iUnsignificantUSecDigits = 0; + } + + this.iDays = pDays; + this.iHours = pHours; + this.iMinutes = pMinutes; + this.iSeconds = pSeconds; + this.iUSeconds = pMicroseconds; + + debug("CIMDateTimeInterval(" + pDays + "," + pHours + "," + pMinutes + "," + pSeconds + "," + + pMicroseconds + "): days=" + this.iDays + ", hours=" + this.iHours + ", mins=" + + this.iMinutes + ", secs=" + this.iSeconds + ", usecs=" + this.iUSeconds + + ", acc div=" + this.iAccuracyDivisor + ", unsig digits=" + + this.iUnsignificantUSecDigits); + } + + /** + * Constructs a CIMDateTimeInterval using a milliseconds value. + * + * @param pMilliseconds + * Number of milliseconds in the interval (0 - 8639999999999999). + * @throws IllegalArgumentException + */ + public CIMDateTimeInterval(long pMilliseconds) throws IllegalArgumentException { + if (pMilliseconds < 0 || pMilliseconds > MAX_INTERVAL) throw new IllegalArgumentException( + "pMilliseconds must be between 0 and " + MAX_INTERVAL + ". " + pMilliseconds + + " is illegal!"); + long totalUSecs = pMilliseconds * 1000; + long totalSecs = pMilliseconds / 1000; + long totalMins = totalSecs / 60; + long totalHours = totalMins / 60; + long totalDays = totalHours / 24; + + this.iUSeconds = (int) (totalUSecs % 1000000); + this.iSeconds = (int) (totalSecs % 60); + this.iMinutes = (int) (totalMins % 60); + this.iHours = (int) (totalHours % 24); + this.iDays = (int) totalDays; + + this.iUnsignificantUSecDigits = 3; + this.iAccuracyDivisor = USEC_ACCURACY_DIV_A[this.iUnsignificantUSecDigits]; + + this.iTotalMicrosCalced = true; + this.iTotalMicros = pMilliseconds * 1000; + + debug("CIMDateTimeInterval(" + pMilliseconds + "): days=" + this.iDays + ", hours=" + + this.iHours + ", mins=" + this.iMinutes + ", secs=" + this.iSeconds + ", usecs=" + + this.iUSeconds + ", acc div=" + this.iAccuracyDivisor + ", unsig digits=" + + this.iUnsignificantUSecDigits); + } + + /** + * Creates a CIMDateTimeInterval object using a string. + * + * @param pIntervalString + * A string in the format of ddddddddHHMMSS.mmmmmm:000. + * @throws IllegalArgumentException + * If string is not in the correct format or null. + */ + public CIMDateTimeInterval(String pIntervalString) throws IllegalArgumentException { + if (pIntervalString == null) throw new IllegalArgumentException( + "Null IntervalString is not allowed!"); + if (pIntervalString.length() != LENGTH) throw new IllegalArgumentException("Length of " + + pIntervalString + " must be " + LENGTH + ", " + pIntervalString.length() + + " is not valid!"); + String intervalStr = setAccuracy(pIntervalString); + DTStringReader dtReader = new DTStringReader(intervalStr); + this.iDays = dtReader.readAndCheck(8, "days", 0, MAX_DAY, true); + this.iHours = dtReader.readAndCheck(2, "hours", 0, MAX_HOUR, true); + this.iMinutes = dtReader.readAndCheck(2, "minutes", 0, MAX_MIN, true); + this.iSeconds = dtReader.readAndCheck(2, "seconds", 0, MAX_SEC, true); + dtReader.read('.'); + this.iUSeconds = dtReader.readAndCheck(6, "microseconds", 0, MAX_MICROSEC, false); + if (this.iAccuracyDivisor >= SEC_ACCURACY_DIV) this.iUSeconds = -1; + dtReader.read(':'); + int zeros = dtReader.read(3, "zeros", false); + if (zeros != 0) { + String msg = "In " + pIntervalString + + " the last 3 characters after ':' must be zeros!"; + throw new IllegalArgumentException(msg); + } + + debug("CIMDateTimeInterval(\"" + pIntervalString + "\"): days=" + this.iDays + ", hours=" + + this.iHours + ", mins=" + this.iMinutes + ", secs=" + this.iSeconds + ", usecs=" + + this.iUSeconds + ", acc div=" + this.iAccuracyDivisor + ", unsig digits=" + + this.iUnsignificantUSecDigits); + } + + /** + * Compares the CIMDateTimeInterval object with this one. If + * either interval has "Not Significant" fields then we only compare the + * significant fields. + * + * @param pObj + * The CIMDateTimeInterval to be compared with this + * one. + * @return -1, zero, or 1 as this interval is less than, equal to, or + * greater than the specified interval. + * @throws IllegalArgumentException + * If the object passed in is not an instance of + * CIMDataTimeInterval. + */ + public int compareTo(CIMDateTime pObj) throws IllegalArgumentException { + if (!(pObj instanceof CIMDateTimeInterval)) { + String msg = "This method requires a CIMDateTimeInterval instance, while it has received a " + + (pObj == null ? "null!" : pObj.getClass().getName() + " instance!"); + throw new IllegalArgumentException(msg); + } + CIMDateTimeInterval that = (CIMDateTimeInterval) pObj; + long accuracyDivisor = Math.max(this.iAccuracyDivisor, that.iAccuracyDivisor); + debug("this.acDiv=" + this.iAccuracyDivisor + ", that.acDiv=" + that.iAccuracyDivisor + + ", acDiv=" + accuracyDivisor); + Long thisMicros = Long.valueOf(calcMicros(accuracyDivisor)); + Long thatMicros = Long.valueOf(that.calcMicros(accuracyDivisor)); + debug("thisUs=" + thisMicros + ", thatUs=" + thatMicros); + return thisMicros.compareTo(thatMicros); + } + + /** + * Gets the internal string representation of this object. + * + * @return The internal representation of the + * CIMDateTimeInterval object. + */ + @Override + public String getDateTimeString() { + if (this.iStr != null) return this.iStr; + // ddddddddHHMMSS.mmmmmm:000 + DTStringWriter dtWriter = new DTStringWriter(); + dtWriter.write(8, this.iDays); + dtWriter.write(2, this.iHours); + dtWriter.write(2, this.iMinutes); + dtWriter.write(2, this.iSeconds); + dtWriter.write('.'); + dtWriter.writeUSec(this.iUSeconds / (int) this.iAccuracyDivisor, + this.iUnsignificantUSecDigits); + dtWriter.write(":000"); + return dtWriter.toString(); + } + + /** + * Returns days value of this interval. + * + * @return If days field "not significant" this returns -1, otherwise + * returns number of days in the interval. + */ + public int getDays() { + return this.iDays; + } + + /** + * Returns hours value of this interval. + * + * @return If hours field "not significant" this returns -1, otherwise + * returns number of hours in the interval. + */ + public int getHours() { + return this.iHours; + } + + /** + * Returns microseconds value of this interval. + * + * @return If microseconds field "not significant" this returns -1, + * otherwise returns number of microseconds in the interval. + */ + public int getMicroseconds() { + return this.iUSeconds; + } + + /** + * Returns minutes value of this interval. + * + * @return If minutes field "not significant" this returns -1, otherwise + * returns number of minutes in the interval. + */ + public int getMinutes() { + return this.iMinutes; + } + + /** + * Returns seconds value of this interval. + * + * @return If seconds field "not significant" this returns -1, otherwise + * returns number of seconds in the interval. + */ + public int getSeconds() { + return this.iSeconds; + } + + /** + * Returns the total length of the interval in milliseconds. + * + * @return The length of the interval in milliseconds. + */ + public long getTotalMilliseconds() { + return getTotalMicros() / 1000; + } + + /** + * Returns the hash code for this object. + * + * @return A hash code value for this object. + * @see java.lang.Object#hashCode() + */ + @Override + public int hashCode() { + return getDateTimeString().hashCode(); + } + + /** + * Returns a String representation of the + * CIMDateTimeInterval. This method is intended to be used only + * for debugging purposes, and the format of the returned string may vary + * between implementations. The returned string may be empty but may not be + * null. + * + * @return String representation of this datetime. + */ + @Override + public String toString() { + return getDateTimeString(); + } + + // ddddddddHHMMSS.mmmmmm:000 + + private static final int DAY_START_IDX = 0, HOUR_START_IDX = 8, MIN_START_IDX = 10, + SEC_START_IDX = 12, DOT_IDX = 14, USEC_START_IDX = 15, UTC_START_IDX = 21, LENGTH = 25; + + /** + * Checks the granularity of the CIMDateTimeAbsolute precision. + * + * @param pIdx + * Index of first asterisk in datetime string. + * @param pFieldName + * Name of field. + * @param pFieldStartIdx + * Index of first character in field of datetime string. + * @param pNextStartIdx + * Index of first character in subsequent field of datetime + * string. + * @return true if field is completely unsignificant, + * false otherwise. + * @throws IllegalArgumentException + * If field is not completely significant or completely + * unsignificant (mix of asterisks and digits). + */ + private boolean checkGranularity(int pIdx, String pFieldName, int pFieldStartIdx, + int pNextStartIdx) throws IllegalArgumentException { + if (pIdx > pFieldStartIdx && pIdx < pNextStartIdx) throw new IllegalArgumentException( + "Partial unsignificant digits are not allowed for field " + pFieldName + " in " + + this.iStr + "!"); + return pIdx == pFieldStartIdx; + } + + /** + * Find index of first asterisk within string. + * + * @param pIvStr + * Time interval string. + * @return Index of first asterisk or -1 if asterisk does not exist. + */ + private static int findStar(String pIvStr) { + for (int i = 0; i < UTC_START_IDX; i++) + if (pIvStr.charAt(i) == '*') return i; + return -1; + } + + /** + * Verify that all characters in the string after the starting index are + * asterisks. + * + * @param pIvStr + * Time interval string. + * @param pStartIdx + * Starting index. + */ + private static void checkStars(String pIvStr, int pStartIdx) { + for (int i = pStartIdx; i < UTC_START_IDX; i++) { + char ch = pIvStr.charAt(i); + if (i != DOT_IDX && ch != '*') throw new IllegalArgumentException("In " + pIvStr + + " every digit character after the first '*' character must " + "be '*', '" + + ch + "' is invalid!"); + } + } + + /** + * Determines the accuracy (precision) of the interval string and replaces + * all asterisks in microsecond field with zeros. + * + * @param pIntervalStr + * Time interval string. + * @return Corrected time interval string with iAccuracyDivisor + * set. + */ + private String setAccuracy(String pIntervalStr) throws IllegalArgumentException { + this.iStr = pIntervalStr; + /* + * String transformation. Checking the correct location of '*' + * characters. '*' characters in usec field are replaced into '0' + * characters + */ + int startIdx = findStar(this.iStr); + if (startIdx < 0) return this.iStr; + // all remaining digit fields must contain '*' characters except for utc + checkStars(this.iStr, startIdx + 1); + if (checkGranularity(startIdx, "Day", DAY_START_IDX, HOUR_START_IDX)) { + this.iAccuracyDivisor = NO_ACCURACY_DIV; + } else if (checkGranularity(startIdx, "Hour", HOUR_START_IDX, MIN_START_IDX)) { + this.iAccuracyDivisor = DAY_ACCURACY_DIV; + } else if (checkGranularity(startIdx, "Minute", MIN_START_IDX, SEC_START_IDX)) { + this.iAccuracyDivisor = HOUR_ACCURACY_DIV; + } else if (checkGranularity(startIdx, "Second", SEC_START_IDX, DOT_IDX)) { + this.iAccuracyDivisor = MIN_ACCURACY_DIV; + } else { + // dealing with usec granularity + this.iUnsignificantUSecDigits = UTC_START_IDX - startIdx; + this.iAccuracyDivisor = USEC_ACCURACY_DIV_A[this.iUnsignificantUSecDigits]; + } + // all '*' in usec field is replaced into '0' + char[] buf = this.iStr.toCharArray(); + if (startIdx < USEC_START_IDX) startIdx = USEC_START_IDX; + for (int i = startIdx; i < UTC_START_IDX; i++) { + if (i == DOT_IDX) continue; + if (this.iStr.charAt(i) != '*') throw new IllegalArgumentException( + "All remaining digits must be marked as unsignificant in " + this.iStr + " !"); + buf[i] = '0'; + } + return new String(buf); + } + + /** + * Get total microseconds of CIMDateTimeInterval object. + * + * @return Total microseconds of time interval. + */ + private long getTotalMicros() { + if (this.iTotalMicrosCalced) return this.iTotalMicros; + this.iTotalMicrosCalced = true; + // iTotalMicros = iUSeconds + 1000000 * (iSeconds + 60 * (iMinutes + 60 + // * (iHours + 24 * iDays))); + this.iTotalMicros = this.iUSeconds > 0 ? this.iUSeconds : 0; + if (this.iSeconds > 0) this.iTotalMicros += SEC_ACCURACY_DIV * this.iSeconds; + if (this.iMinutes > 0) this.iTotalMicros += MIN_ACCURACY_DIV * this.iMinutes; + if (this.iHours > 0) this.iTotalMicros += HOUR_ACCURACY_DIV * this.iHours; + if (this.iDays > 0) this.iTotalMicros += DAY_ACCURACY_DIV * this.iDays; + debug("days=" + this.iDays + " ,hours=" + this.iHours + " ,mins=" + this.iMinutes + + ", secs=" + this.iSeconds + ", usecs=" + this.iUSeconds + ", totalMicros=" + + this.iTotalMicros); + return this.iTotalMicros; + } + + /** + * Calculates microseconds of CIMDateTimeInterval object taking + * accuracy (precision) into consideration. + * + * @param pAccuracyDivisor + * Accuracy divisor of time interval. + * @return Total microseconds of time interval rounded down to precision. + */ + private long calcMicros(long pAccuracyDivisor) { + long remainder = getTotalMicros() % pAccuracyDivisor; + return getTotalMicros() - remainder; + } + + /** + * Checks validity of time interval field, making sure value is between + * minimum and maximum values and is not significant if following an + * unsignifcant field. + * + * @param pName + * Name of field. + * @param pValue + * Value of field. + * @param pLow + * Minimum value of field. + * @param pHigh + * Maximum value of field. + * @param pNotSignificant + * trueif previous field not significant. + * @return true if field is not significant, false + * otherwise. + * @throws IllegalArgumentException + */ + private static boolean checkLimits(String pName, int pValue, int pLow, int pHigh, + boolean pNotSignificant) throws IllegalArgumentException { + if (pValue == -1) return true; + if (pNotSignificant) throw new IllegalArgumentException( + "Not significant fields must be followed by not significant fields!"); + if (pValue < pLow || pValue > pHigh) throw new IllegalArgumentException(pName + + " must be between " + pLow + " and " + pHigh + ". " + pValue + " is invalid!"); + return false; + } + + /** + * Prints debug message. + * + * @param pMsg + * Debug message. + */ + private static void debug(String pMsg) { + // System.out.println(pMsg); + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/javax/cim/CIMElement.java b/src/main/java/org/metricshub/wbem/javax/cim/CIMElement.java similarity index 84% rename from src/main/java/org/sentrysoftware/wbem/javax/cim/CIMElement.java rename to src/main/java/org/metricshub/wbem/javax/cim/CIMElement.java index 3393264..27888fa 100644 --- a/src/main/java/org/sentrysoftware/wbem/javax/cim/CIMElement.java +++ b/src/main/java/org/metricshub/wbem/javax/cim/CIMElement.java @@ -1,148 +1,146 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Alexander Wolf-Reber, a.wolf-reber@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-09-26 lupusalex Make SBLIM client JSR48 compliant - * 1737141 2007-06-18 ebak Sync up with JSR48 evolution - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2227442 2008-11-05 blaschke-oss Add missing serialVersionUID - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors - * 2795671 2009-05-22 raman_arora Add Type to Comparable - * 2935258 2010-01-22 blaschke-oss Sync up javax.cim.* javadoc with JSR48 1.0.0 - * 3410126 2011-09-15 blaschke-oss TCK: CIM element name cannot be null - * 2716 2013-12-11 blaschke-oss Sync up javax.* javadoc with JSR48 1.0.0 Final V - */ - -package org.sentrysoftware.wbem.javax.cim; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.Serializable; - -//Sync'd against JSR48 1.0.0 javadoc (version 1.7.0_03) on Tue Dec 10 07:02:50 EST 2013 -/** - * CIMElement is an abstract base class that represents a CIM - * Element as defined by the Distributed Management Task Force (DMTF) CIM Infrastructure Specification (DSP004). - */ -public abstract class CIMElement extends Object implements Serializable, Comparable { - - private static final long serialVersionUID = -3310480832682118922L; - - private String iName; - - /** - * Creates a new CIM element with the given name. - * - * @param pName - * The string for the name of the element. - * @throws IllegalArgumentException - * If name is null. - */ - public CIMElement(String pName) { - if (pName == null) throw new IllegalArgumentException("CIM element name cannot be null"); - this.iName = pName; - } - - /** - * Compares this element name to the CIMElement passed in. - * - * @param pObj - * The CIMElement to be compared. - * @return A negative integer, zero, or a positive integer as this object is - * less than, equal to, or greater than the specified object. - */ - public int compareTo(CIMElement pObj) { - if (pObj == null) return -1; - CIMElement that = pObj; - return this.iName.compareToIgnoreCase(that.iName); - } - - /** - * Takes a CIM element and returns true if it is equal to this - * CIM element. Otherwise, it returns false. Useful for - * comparing two CIM elements, for example, to determine whether a CIM - * element exists in a Collection. - * - * @param pObj - * The object to be compared a CIM element. - * @return true indicates the specified CIM element equals this - * CIM element, false indicates the CIM element does - * not equal this CIM element. - */ - @Override - public boolean equals(Object pObj) { - if (pObj instanceof CIMElement) { return this.iName - .equalsIgnoreCase(((CIMElement) pObj).iName); } - return false; - } - - /** - * Returns a string representing the name of a CIM element instance. - * - * @return The name of this CIM element. - */ - public String getName() { - return this.iName; - } - - /** - * Returns a hash code value for the CIM element. This method is supported - * for the benefit of hashtables such as those provided by - * java.util.Hashtable. - * - * @return A hash code value for this CIM element. - */ - @Override - public int hashCode() { - return this.iName.hashCode(); - } - - /** - * Returns a String representation of the - * CIMElement. This method is intended to be used only for - * debugging purposes. The format of the returned string may vary between - * implementations. The returned string may be empty but may not be - * null - * - * @return String representation of this CIM element. - */ - @Override - public String toString() { - return this.iName; - } -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Alexander Wolf-Reber, a.wolf-reber@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-09-26 lupusalex Make SBLIM client JSR48 compliant + * 1737141 2007-06-18 ebak Sync up with JSR48 evolution + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2227442 2008-11-05 blaschke-oss Add missing serialVersionUID + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors + * 2795671 2009-05-22 raman_arora Add Type to Comparable + * 2935258 2010-01-22 blaschke-oss Sync up javax.cim.* javadoc with JSR48 1.0.0 + * 3410126 2011-09-15 blaschke-oss TCK: CIM element name cannot be null + * 2716 2013-12-11 blaschke-oss Sync up javax.* javadoc with JSR48 1.0.0 Final V + */ + +package org.metricshub.wbem.javax.cim; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.Serializable; + +//Sync'd against JSR48 1.0.0 javadoc (version 1.7.0_03) on Tue Dec 10 07:02:50 EST 2013 +/** + * CIMElement is an abstract base class that represents a CIM + * Element as defined by the Distributed Management Task Force (DMTF) CIM Infrastructure Specification (DSP004). + */ +public abstract class CIMElement extends Object implements Serializable, Comparable { + + private static final long serialVersionUID = -3310480832682118922L; + + private String iName; + + /** + * Creates a new CIM element with the given name. + * + * @param pName + * The string for the name of the element. + * @throws IllegalArgumentException + * If name is null. + */ + public CIMElement(String pName) { + if (pName == null) throw new IllegalArgumentException("CIM element name cannot be null"); + this.iName = pName; + } + + /** + * Compares this element name to the CIMElement passed in. + * + * @param pObj + * The CIMElement to be compared. + * @return A negative integer, zero, or a positive integer as this object is + * less than, equal to, or greater than the specified object. + */ + public int compareTo(CIMElement pObj) { + if (pObj == null) return -1; + CIMElement that = pObj; + return this.iName.compareToIgnoreCase(that.iName); + } + + /** + * Takes a CIM element and returns true if it is equal to this + * CIM element. Otherwise, it returns false. Useful for + * comparing two CIM elements, for example, to determine whether a CIM + * element exists in a Collection. + * + * @param pObj + * The object to be compared a CIM element. + * @return true indicates the specified CIM element equals this + * CIM element, false indicates the CIM element does + * not equal this CIM element. + */ + @Override + public boolean equals(Object pObj) { + if (pObj instanceof CIMElement) { return this.iName + .equalsIgnoreCase(((CIMElement) pObj).iName); } + return false; + } + + /** + * Returns a string representing the name of a CIM element instance. + * + * @return The name of this CIM element. + */ + public String getName() { + return this.iName; + } + + /** + * Returns a hash code value for the CIM element. This method is supported + * for the benefit of hashtables such as those provided by + * java.util.Hashtable. + * + * @return A hash code value for this CIM element. + */ + @Override + public int hashCode() { + return this.iName.hashCode(); + } + + /** + * Returns a String representation of the + * CIMElement. This method is intended to be used only for + * debugging purposes. The format of the returned string may vary between + * implementations. The returned string may be empty but may not be + * null + * + * @return String representation of this CIM element. + */ + @Override + public String toString() { + return this.iName; + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/javax/cim/CIMFlavor.java b/src/main/java/org/metricshub/wbem/javax/cim/CIMFlavor.java similarity index 75% rename from src/main/java/org/sentrysoftware/wbem/javax/cim/CIMFlavor.java rename to src/main/java/org/metricshub/wbem/javax/cim/CIMFlavor.java index b8bb603..fd9faac 100644 --- a/src/main/java/org/sentrysoftware/wbem/javax/cim/CIMFlavor.java +++ b/src/main/java/org/metricshub/wbem/javax/cim/CIMFlavor.java @@ -1,89 +1,87 @@ -/* - (C) Copyright IBM Corp. 2006, 2010 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-10-06 ebak Make SBLIM client JSR48 compliant - * 1737123 2007-06-15 ebak Differences to JSR48 public review draft - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors - * 2935258 2010-01-22 blaschke-oss Sync up javax.cim.* javadoc with JSR48 1.0.0 - */ - -package org.sentrysoftware.wbem.javax.cim; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.Serializable; - -//Sync'd against JSR48 1.0.0 javadoc (build 1.5.0_10) on Wed Jan 20 02:20:58 EST 2010 -/** - * This class represents a CIM Flavor as defined by the Distributed Management - * Task Force (DMTF) CIM Infrastructure - * Specification (DSP004). CIM flavors specify overriding and inheritance rules. These - * rules specify how qualifiers are transmitted from classes to derived classes. - */ -public class CIMFlavor extends Object implements Serializable { - - private static final long serialVersionUID = -4177389103635687939l; - - /** - * The qualifier cannot be overridden. - */ - public static final int DISABLEOVERRIDE = 1; - - /** - * The qualifier applies only to the class in which it is declared. - */ - public static final int RESTRICTED = 2; - - /** - * The qualifier can be specified in multiple locales (language and country - * combination). - */ - public static final int TRANSLATE = 4; - - private static final int[] flavors = { DISABLEOVERRIDE, RESTRICTED, TRANSLATE }; - - /** - * Returns an array of possible flavors. - * - * @return All possible flavors. - */ - public static int[] getFlavors() { - return flavors; - } - -} +/* + (C) Copyright IBM Corp. 2006, 2010 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-10-06 ebak Make SBLIM client JSR48 compliant + * 1737123 2007-06-15 ebak Differences to JSR48 public review draft + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors + * 2935258 2010-01-22 blaschke-oss Sync up javax.cim.* javadoc with JSR48 1.0.0 + */ + +package org.metricshub.wbem.javax.cim; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.Serializable; + +//Sync'd against JSR48 1.0.0 javadoc (build 1.5.0_10) on Wed Jan 20 02:20:58 EST 2010 +/** + * This class represents a CIM Flavor as defined by the Distributed Management + * Task Force (DMTF) CIM Infrastructure + * Specification (DSP004). CIM flavors specify overriding and inheritance rules. These + * rules specify how qualifiers are transmitted from classes to derived classes. + */ +public class CIMFlavor extends Object implements Serializable { + + private static final long serialVersionUID = -4177389103635687939l; + + /** + * The qualifier cannot be overridden. + */ + public static final int DISABLEOVERRIDE = 1; + + /** + * The qualifier applies only to the class in which it is declared. + */ + public static final int RESTRICTED = 2; + + /** + * The qualifier can be specified in multiple locales (language and country + * combination). + */ + public static final int TRANSLATE = 4; + + private static final int[] flavors = { DISABLEOVERRIDE, RESTRICTED, TRANSLATE }; + + /** + * Returns an array of possible flavors. + * + * @return All possible flavors. + */ + public static int[] getFlavors() { + return flavors; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/javax/cim/CIMInstance.java b/src/main/java/org/metricshub/wbem/javax/cim/CIMInstance.java similarity index 89% rename from src/main/java/org/sentrysoftware/wbem/javax/cim/CIMInstance.java rename to src/main/java/org/metricshub/wbem/javax/cim/CIMInstance.java index f9954ef..3380ff9 100644 --- a/src/main/java/org/sentrysoftware/wbem/javax/cim/CIMInstance.java +++ b/src/main/java/org/metricshub/wbem/javax/cim/CIMInstance.java @@ -1,368 +1,366 @@ -/* - (C) Copyright IBM Corp. 2006, 2012 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-10-06 ebak Make SBLIM client JSR48 compliant - * 1669961 2006-04-16 lupusalex CIMTypedElement.getType() =>getDataType() - * 1776114 2007-08-21 ebak Cannot derive instance of class CIM_IndicationSubscription - * 1855726 2008-02-11 blaschke-oss CIMInstance.deriveInstance is setting wrong CIMObjectPath - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics - * 2935258 2010-01-22 blaschke-oss Sync up javax.cim.* javadoc with JSR48 1.0.0 - * 2944842 2010-02-08 blaschke-oss Missing thrown ArrayIndexOutOfBoundsException - * 3529151 2012-08-22 blaschke-oss TCK: CIMInstance property APIs include keys from COP - */ - -package org.sentrysoftware.wbem.javax.cim; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.logging.Level; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cim.CIMElementSorter; -import org.sentrysoftware.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; -import org.sentrysoftware.wbem.sblim.cimclient.internal.util.MOF; -import org.sentrysoftware.wbem.sblim.cimclient.internal.util.StringSorter; - -//Sync'd against JSR48 1.0.0 javadoc (build 1.5.0_10) on Wed Jan 20 02:20:58 EST 2010 -/** - * This class represents a CIM instance as defined by the Distributed Management - * Task Force (DMTF) CIM Infrastructure - * Specification (DSP004). - */ -public class CIMInstance extends Object implements CIMNamedElementInterface, Serializable { - - private static final long serialVersionUID = -249160087013230559L; - - private static final CIMProperty[] EMPTY_PROP_A = new CIMProperty[0]; - - private CIMObjectPath iObjPath; - - private CIMProperty[] iProps; - - /** - * Constructs a CIMInstance object using the name and - * properties specified. - * - * @param pName - * The CIMObjectPath for this - * CIMInstance. - * @param pProps - * The properties for this CIMInstance. - * @throws IllegalArgumentException - * If pName is null or - * pName.getObjectName() is null.
      - * [OPTIONAL] - If the key property values do not match the - * values in the property array. This is optional due to the - * cost of the verification. Some implementations may leave it - * up to the developer to ensure that the values match. - */ - public CIMInstance(CIMObjectPath pName, CIMProperty[] pProps) - throws IllegalArgumentException { - if (pName == null) { - String msg = "CIMObjectPath parameter cannot be null!"; - // TODO: tracing - throw new IllegalArgumentException(msg); - } - if (pName.getObjectName() == null) { - String msg = "ObjectName cannot be null!"; - // TODO: tracing - throw new IllegalArgumentException(msg); - } - - this.iObjPath = pName; - if (pProps != null) { - this.iProps = pProps; - CIMElementSorter.sort(this.iProps); - } else { - this.iProps = new CIMProperty[0]; - } - } - - /** - * Returns a CIMInstance with the updated - * CIMObjectPath. - * - * @param pPath - * The complete CIMObjectPath for this instance. - * @return A new CIMInstance with the updated - * CIMObjectPath. - */ - public CIMInstance deriveInstance(CIMObjectPath pPath) { - return new CIMInstance(pPath, this.iProps); - } - - /** - * Returns a CIMInstance with the updated values for the - * properties in pPropA. Any new properties are ignored. - * - * @param pPropA - * The array of properties to update. - * @return A new instance with the updated properties. - */ - public CIMInstance deriveInstance(CIMProperty[] pPropA) { - if (pPropA == null || pPropA.length == 0) return this; - CIMProperty[] newPropA = new CIMProperty[getPropertyCount()]; - for (int i = 0; i < newPropA.length; i++) - newPropA[i] = this.iProps[i]; - for (int i = 0; i < pPropA.length; i++) { - CIMProperty newProp = pPropA[i]; - int idx = CIMElementSorter.findIdx(newPropA, newProp.getName()); - if (idx < 0) continue; - CIMProperty oldProp = newPropA[idx]; - /* - * 1776114 -> reference type comparison shouldn't be sensitive to - * the referenced class name due to derivation - */ - if (!typesEqual(oldProp, newProp)) { - LogAndTraceBroker.getBroker().trace( - Level.FINE, - "CIMInstance.deriveInstance() can update only property " - + "values but not property types!\n" + "original property: " - + oldProp + "\nnew property: " + newProp); - continue; - } - newPropA[idx] = new CIMProperty(oldProp.getName(), newProp.getDataType(), - newProp.getValue(), oldProp.isKey(), oldProp.isPropagated(), oldProp - .getOriginClass()); - } - return new CIMInstance(this.iObjPath, newPropA); - } - - /** - * Indicates whether some other instance is equal to this one. Two - * CIMInstances are considered equal if the names are the same. - * This method does NOT compare each property value. - * - * @param pObj - * The object to compare. - * @return true if the specified path references the same - * instance, otherwise false. - */ - @Override - public boolean equals(Object pObj) { - if (!(pObj instanceof CIMInstance)) return false; - CIMInstance that = (CIMInstance) pObj; - return this.iObjPath.equals(that.iObjPath); - } - - /** - * This method returns a new CIMInstance with properties - * filtered according to the input parameters. Inclusion of class origin and - * qualifiers can also be controlled. - * - * @param pLocalOnly - * Include only the properties values that were instantiated in - * this instance. - * @param pIncludeClassOrigin - * classOrigins are only included if true. - * @param pPropertyList - * If the pPropertyList input parameter is not - * null, the members of the array define one or more - * Property names. The returned Instance does not include - * elements for any Properties missing from this list. If the - * pPropertyList input parameter is an empty array - * this signifies that no Properties are included in each - * returned class. If the pPropertyList input - * parameter is null this specifies that all - * Properties are included in each returned class. If the - * pPropertyList contains duplicate elements or - * invalid property names, they are ignored. - * @return CIMInstance matching the input filter. - */ - public CIMInstance filterProperties(boolean pLocalOnly, boolean pIncludeClassOrigin, - String[] pPropertyList) { - StringSorter.sort(pPropertyList); - ArrayList> propAList = new ArrayList>(); - for (int i = 0; i < getPropertyCount(); i++) { - CIMProperty prop = getProperty(i); - if (pLocalOnly && prop.isPropagated()) continue; - if (pPropertyList != null && !StringSorter.find(pPropertyList, prop.getName())) continue; - propAList.add(new CIMProperty(prop.getName(), prop.getDataType(), prop - .getValue(), prop.isKey(), prop.isPropagated(), pIncludeClassOrigin ? prop - .getOriginClass() : null)); - } - return new CIMInstance(this.iObjPath, propAList.toArray(EMPTY_PROP_A)); - } - - /** - * Get the name of the class that instantiates this CIM instance. - * - * @return Name of class that instantiates this CIM instance. - */ - public String getClassName() { - return this.iObjPath.getObjectName(); - } - - /** - * Get the key properties for this instance. - * - * @return An array of key properties. - */ - public CIMProperty[] getKeys() { - return this.iObjPath.getKeys(); - } - - /** - * Returns the CIMObjectPath that represents this instance. - * - * @return The CIMObjectPath that represents this instance. - */ - public CIMObjectPath getObjectPath() { - return this.iObjPath; - } - - /** - * Retrieve an array of the properties for this instance. - * - * @return An array of the CIM properties for this instance. - */ - public CIMProperty[] getProperties() { - return this.iProps == null ? new CIMProperty[0] : this.iProps; - } - - /** - * Get a class property by index. - * - * @param pIndex - * The index of the class property to retrieve. - * @return The CIMProperty at the specified index. - * @throws ArrayIndexOutOfBoundsException - */ - public CIMProperty getProperty(int pIndex) throws ArrayIndexOutOfBoundsException { - return this.iProps[pIndex]; - } - - /** - * Returns the specified property. - * - * @param pName - * The text string for the name of the property. - * @return The property requested or null if the property does - * not exist. - */ - public CIMProperty getProperty(String pName) { - return getProperty(pName, null); - } - - /** - * Returns the specified CIMProperty. - * - * @param pName - * The string name of the property to get. - * @param pOriginClass - * (Optional) The string name of the class in which the property - * was defined. - * @return null if the property does not exist, otherwise - * returns the CIM property. - */ - public CIMProperty getProperty(String pName, String pOriginClass) { - CIMProperty prop = (CIMProperty) CIMElementSorter.find(this.iProps, pName); - if (prop == null) return null; - if (pOriginClass == null) return prop; - if (pOriginClass.equalsIgnoreCase(prop.getOriginClass())) return prop; - return null; - } - - /** - * Get the number of properties defined in this CIMInstance. - * - * @return The number of properties defined in the CIMInstance. - */ - public int getPropertyCount() { - return this.iProps == null ? 0 : this.iProps.length; - } - - /** - * Returns the value of a property of this CIM Instance. - * - * @param name - * The name of the property. - * @return The value for the specified property name or null if - * the property does not exist. - */ - public Object getPropertyValue(String name) { - CIMProperty prop = getProperty(name); - return prop == null ? null : prop.getValue(); - } - - /** - * Computes the hash code for this instance. The hash code will be the - * object path of the instance not including the host or namespace - * information. - * - * @return The integer representing the hash code for this object path. - */ - @Override - public int hashCode() { - return toString().hashCode(); - } - - /** - * Returns a String representation of the - * CIMInstance. This method is intended to be used only for - * debugging purposes, and the format of the returned string may vary - * between implementations. The returned string may be empty but may not be - * null. - * - * @return String representation of this instance. - */ - @Override - public String toString() { - return MOF.instanceDeclaration(this, MOF.EMPTY); - } - - /** - * Indicates whether the data types of the two properties are equal. - * - * @param pProp0 - * First property. - *@param pProp1 - * Second property. - * @return true if the data types are the same, - * false otherwise. - */ - private static boolean typesEqual(CIMProperty pProp0, CIMProperty pProp1) { - CIMDataType type0 = pProp0.getDataType(), type1 = pProp0.getDataType(); - return type0.getType() == type1.getType() && type0.isArray() == type1.isArray(); - - } - -} +/* + (C) Copyright IBM Corp. 2006, 2012 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-10-06 ebak Make SBLIM client JSR48 compliant + * 1669961 2006-04-16 lupusalex CIMTypedElement.getType() =>getDataType() + * 1776114 2007-08-21 ebak Cannot derive instance of class CIM_IndicationSubscription + * 1855726 2008-02-11 blaschke-oss CIMInstance.deriveInstance is setting wrong CIMObjectPath + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics + * 2935258 2010-01-22 blaschke-oss Sync up javax.cim.* javadoc with JSR48 1.0.0 + * 2944842 2010-02-08 blaschke-oss Missing thrown ArrayIndexOutOfBoundsException + * 3529151 2012-08-22 blaschke-oss TCK: CIMInstance property APIs include keys from COP + */ + +package org.metricshub.wbem.javax.cim; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.logging.Level; + +import org.metricshub.wbem.sblim.cimclient.internal.cim.CIMElementSorter; +import org.metricshub.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; +import org.metricshub.wbem.sblim.cimclient.internal.util.MOF; +import org.metricshub.wbem.sblim.cimclient.internal.util.StringSorter; + +//Sync'd against JSR48 1.0.0 javadoc (build 1.5.0_10) on Wed Jan 20 02:20:58 EST 2010 +/** + * This class represents a CIM instance as defined by the Distributed Management + * Task Force (DMTF) CIM Infrastructure + * Specification (DSP004). + */ +public class CIMInstance extends Object implements CIMNamedElementInterface, Serializable { + + private static final long serialVersionUID = -249160087013230559L; + + private static final CIMProperty[] EMPTY_PROP_A = new CIMProperty[0]; + + private CIMObjectPath iObjPath; + + private CIMProperty[] iProps; + + /** + * Constructs a CIMInstance object using the name and + * properties specified. + * + * @param pName + * The CIMObjectPath for this + * CIMInstance. + * @param pProps + * The properties for this CIMInstance. + * @throws IllegalArgumentException + * If pName is null or + * pName.getObjectName() is null.
      + * [OPTIONAL] - If the key property values do not match the + * values in the property array. This is optional due to the + * cost of the verification. Some implementations may leave it + * up to the developer to ensure that the values match. + */ + public CIMInstance(CIMObjectPath pName, CIMProperty[] pProps) + throws IllegalArgumentException { + if (pName == null) { + String msg = "CIMObjectPath parameter cannot be null!"; + // TODO: tracing + throw new IllegalArgumentException(msg); + } + if (pName.getObjectName() == null) { + String msg = "ObjectName cannot be null!"; + // TODO: tracing + throw new IllegalArgumentException(msg); + } + + this.iObjPath = pName; + if (pProps != null) { + this.iProps = pProps; + CIMElementSorter.sort(this.iProps); + } else { + this.iProps = new CIMProperty[0]; + } + } + + /** + * Returns a CIMInstance with the updated + * CIMObjectPath. + * + * @param pPath + * The complete CIMObjectPath for this instance. + * @return A new CIMInstance with the updated + * CIMObjectPath. + */ + public CIMInstance deriveInstance(CIMObjectPath pPath) { + return new CIMInstance(pPath, this.iProps); + } + + /** + * Returns a CIMInstance with the updated values for the + * properties in pPropA. Any new properties are ignored. + * + * @param pPropA + * The array of properties to update. + * @return A new instance with the updated properties. + */ + public CIMInstance deriveInstance(CIMProperty[] pPropA) { + if (pPropA == null || pPropA.length == 0) return this; + CIMProperty[] newPropA = new CIMProperty[getPropertyCount()]; + for (int i = 0; i < newPropA.length; i++) + newPropA[i] = this.iProps[i]; + for (int i = 0; i < pPropA.length; i++) { + CIMProperty newProp = pPropA[i]; + int idx = CIMElementSorter.findIdx(newPropA, newProp.getName()); + if (idx < 0) continue; + CIMProperty oldProp = newPropA[idx]; + /* + * 1776114 -> reference type comparison shouldn't be sensitive to + * the referenced class name due to derivation + */ + if (!typesEqual(oldProp, newProp)) { + LogAndTraceBroker.getBroker().trace( + Level.FINE, + "CIMInstance.deriveInstance() can update only property " + + "values but not property types!\n" + "original property: " + + oldProp + "\nnew property: " + newProp); + continue; + } + newPropA[idx] = new CIMProperty(oldProp.getName(), newProp.getDataType(), + newProp.getValue(), oldProp.isKey(), oldProp.isPropagated(), oldProp + .getOriginClass()); + } + return new CIMInstance(this.iObjPath, newPropA); + } + + /** + * Indicates whether some other instance is equal to this one. Two + * CIMInstances are considered equal if the names are the same. + * This method does NOT compare each property value. + * + * @param pObj + * The object to compare. + * @return true if the specified path references the same + * instance, otherwise false. + */ + @Override + public boolean equals(Object pObj) { + if (!(pObj instanceof CIMInstance)) return false; + CIMInstance that = (CIMInstance) pObj; + return this.iObjPath.equals(that.iObjPath); + } + + /** + * This method returns a new CIMInstance with properties + * filtered according to the input parameters. Inclusion of class origin and + * qualifiers can also be controlled. + * + * @param pLocalOnly + * Include only the properties values that were instantiated in + * this instance. + * @param pIncludeClassOrigin + * classOrigins are only included if true. + * @param pPropertyList + * If the pPropertyList input parameter is not + * null, the members of the array define one or more + * Property names. The returned Instance does not include + * elements for any Properties missing from this list. If the + * pPropertyList input parameter is an empty array + * this signifies that no Properties are included in each + * returned class. If the pPropertyList input + * parameter is null this specifies that all + * Properties are included in each returned class. If the + * pPropertyList contains duplicate elements or + * invalid property names, they are ignored. + * @return CIMInstance matching the input filter. + */ + public CIMInstance filterProperties(boolean pLocalOnly, boolean pIncludeClassOrigin, + String[] pPropertyList) { + StringSorter.sort(pPropertyList); + ArrayList> propAList = new ArrayList>(); + for (int i = 0; i < getPropertyCount(); i++) { + CIMProperty prop = getProperty(i); + if (pLocalOnly && prop.isPropagated()) continue; + if (pPropertyList != null && !StringSorter.find(pPropertyList, prop.getName())) continue; + propAList.add(new CIMProperty(prop.getName(), prop.getDataType(), prop + .getValue(), prop.isKey(), prop.isPropagated(), pIncludeClassOrigin ? prop + .getOriginClass() : null)); + } + return new CIMInstance(this.iObjPath, propAList.toArray(EMPTY_PROP_A)); + } + + /** + * Get the name of the class that instantiates this CIM instance. + * + * @return Name of class that instantiates this CIM instance. + */ + public String getClassName() { + return this.iObjPath.getObjectName(); + } + + /** + * Get the key properties for this instance. + * + * @return An array of key properties. + */ + public CIMProperty[] getKeys() { + return this.iObjPath.getKeys(); + } + + /** + * Returns the CIMObjectPath that represents this instance. + * + * @return The CIMObjectPath that represents this instance. + */ + public CIMObjectPath getObjectPath() { + return this.iObjPath; + } + + /** + * Retrieve an array of the properties for this instance. + * + * @return An array of the CIM properties for this instance. + */ + public CIMProperty[] getProperties() { + return this.iProps == null ? new CIMProperty[0] : this.iProps; + } + + /** + * Get a class property by index. + * + * @param pIndex + * The index of the class property to retrieve. + * @return The CIMProperty at the specified index. + * @throws ArrayIndexOutOfBoundsException + */ + public CIMProperty getProperty(int pIndex) throws ArrayIndexOutOfBoundsException { + return this.iProps[pIndex]; + } + + /** + * Returns the specified property. + * + * @param pName + * The text string for the name of the property. + * @return The property requested or null if the property does + * not exist. + */ + public CIMProperty getProperty(String pName) { + return getProperty(pName, null); + } + + /** + * Returns the specified CIMProperty. + * + * @param pName + * The string name of the property to get. + * @param pOriginClass + * (Optional) The string name of the class in which the property + * was defined. + * @return null if the property does not exist, otherwise + * returns the CIM property. + */ + public CIMProperty getProperty(String pName, String pOriginClass) { + CIMProperty prop = (CIMProperty) CIMElementSorter.find(this.iProps, pName); + if (prop == null) return null; + if (pOriginClass == null) return prop; + if (pOriginClass.equalsIgnoreCase(prop.getOriginClass())) return prop; + return null; + } + + /** + * Get the number of properties defined in this CIMInstance. + * + * @return The number of properties defined in the CIMInstance. + */ + public int getPropertyCount() { + return this.iProps == null ? 0 : this.iProps.length; + } + + /** + * Returns the value of a property of this CIM Instance. + * + * @param name + * The name of the property. + * @return The value for the specified property name or null if + * the property does not exist. + */ + public Object getPropertyValue(String name) { + CIMProperty prop = getProperty(name); + return prop == null ? null : prop.getValue(); + } + + /** + * Computes the hash code for this instance. The hash code will be the + * object path of the instance not including the host or namespace + * information. + * + * @return The integer representing the hash code for this object path. + */ + @Override + public int hashCode() { + return toString().hashCode(); + } + + /** + * Returns a String representation of the + * CIMInstance. This method is intended to be used only for + * debugging purposes, and the format of the returned string may vary + * between implementations. The returned string may be empty but may not be + * null. + * + * @return String representation of this instance. + */ + @Override + public String toString() { + return MOF.instanceDeclaration(this, MOF.EMPTY); + } + + /** + * Indicates whether the data types of the two properties are equal. + * + * @param pProp0 + * First property. + *@param pProp1 + * Second property. + * @return true if the data types are the same, + * false otherwise. + */ + private static boolean typesEqual(CIMProperty pProp0, CIMProperty pProp1) { + CIMDataType type0 = pProp0.getDataType(), type1 = pProp0.getDataType(); + return type0.getType() == type1.getType() && type0.isArray() == type1.isArray(); + + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/javax/cim/CIMMethod.java b/src/main/java/org/metricshub/wbem/javax/cim/CIMMethod.java similarity index 88% rename from src/main/java/org/sentrysoftware/wbem/javax/cim/CIMMethod.java rename to src/main/java/org/metricshub/wbem/javax/cim/CIMMethod.java index de77c23..0c4624c 100644 --- a/src/main/java/org/sentrysoftware/wbem/javax/cim/CIMMethod.java +++ b/src/main/java/org/metricshub/wbem/javax/cim/CIMMethod.java @@ -1,305 +1,303 @@ -/* - (C) Copyright IBM Corp. 2006, 2012 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Change History - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-10-06 ebak Make SBLIM client JSR48 compliant - * 1660756 2007-02-22 ebak Embedded object support - * 1737141 2007-06-18 ebak Sync up with JSR48 evolution - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2750520 2009-04-10 blaschke-oss Code cleanup from empty statement et al - * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics - * 2935258 2010-01-22 blaschke-oss Sync up javax.cim.* javadoc with JSR48 1.0.0 - * 2944842 2010-02-08 blaschke-oss Missing thrown ArrayIndexOutOfBoundsException - * 3001333 2010-05-19 blaschke-oss CIMMethod class ignores propagated parameter - * 3400209 2011-08-31 blaschke-oss Highlighted Static Analysis (PMD) issues - * 3565581 2012-09-07 blaschke-oss TCK: remove unnecessary overriding methods - */ - -package org.sentrysoftware.wbem.javax.cim; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.Arrays; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cim.CIMElementSorter; -import org.sentrysoftware.wbem.sblim.cimclient.internal.cim.CIMQualifiedElementInterfaceImpl; -import org.sentrysoftware.wbem.sblim.cimclient.internal.util.MOF; - -//Sync'd against JSR48 1.0.0 javadoc (build 1.5.0_10) on Wed Jan 20 02:20:59 EST 2010 -/** - * This class represents a CIM Method as defined by the Distributed Management - * Task Force (DMTF) CIM Infrastructure - * Specification (DSP004). - * - * @param - * Type parameter. - */ -public class CIMMethod extends CIMTypedElement implements CIMQualifiedElementInterface { - - private static final long serialVersionUID = -3920536802046705977L; - - private CIMQualifiedElementInterfaceImpl iQualiImpl; - - private CIMParameter[] iParams; - - private boolean iPropagated; - - private String iOriginClass; - - /** - * Constructs a CIMMethod object with the specified - * information. - * - * @param pName - * The name of the method. - * @param pType - * The data type of the method. - * @param pQualis - * The method qualifiers. - * @param pParams - * The array of parameters for this method. - * @param pPropagated - * Is this method propagated from the superclass. - * @param pOriginClass - * The class this method was defined or overridden in. - */ - public CIMMethod(String pName, CIMDataType pType, CIMQualifier[] pQualis, - CIMParameter[] pParams, boolean pPropagated, String pOriginClass) { - super(pName, pType); - this.iQualiImpl = new CIMQualifiedElementInterfaceImpl(pQualis, false, true); - this.iParams = (CIMParameter[]) CIMElementSorter.sort(pParams); - this.iPropagated = pPropagated; - this.iOriginClass = pOriginClass; - } - - /** - * Compares this object against the specified object. The result is - * true if and only if the argument is not null - * and is a CIMMethod object that represents the same value as - * this object. - * - * @param pObj - * The object to compare. - * @return true if the objects are the same; false - * otherwise. - */ - @Override - public boolean equals(Object pObj) { - if (!(pObj instanceof CIMMethod)) return false; - if (!super.equals(pObj)) return false; - CIMMethod that = (CIMMethod) pObj; - if (!this.iQualiImpl.equals(that.iQualiImpl)) return false; - if (this.iPropagated != that.iPropagated) return false; - return Arrays.equals(getParameters(), that.getParameters()); - } - - /** - * Returns a CIMMethod filtered as specified. - * - * @param pIncludeQualifiers - * If true all qualifiers are returned; otherwise no - * qualifiers. - * @param pIncludeClassOrigin - * If true the class origin is included; otherwise - * no class origin is present. - * @return A filtered CIMMethod. - */ - public CIMMethod filter(boolean pIncludeQualifiers, boolean pIncludeClassOrigin) { - return filter(pIncludeQualifiers, pIncludeClassOrigin, false); - } - - /** - * Returns a CIMMethod filtered as specified. - * - * @param pIncludeQualifiers - * If true all qualifiers are returned; otherwise no - * qualifiers. - * @param pIncludeClassOrigin - * If true the class origin is included; otherwise - * no class origin is present - * @param pLocalOnly - * If true only the qualifiers defined on this class - * are included; otherwise all qualifiers are included. - * - * @return A filtered CIMMethod. - */ - public CIMMethod filter(boolean pIncludeQualifiers, boolean pIncludeClassOrigin, - boolean pLocalOnly) { - return new CIMMethod(getName(), getDataType(), pIncludeQualifiers ? this.iQualiImpl - .getQualifiers(pLocalOnly) : null, this.iParams, this.iPropagated, - pIncludeClassOrigin ? this.iOriginClass : null); - } - - /** - * Returns the class name in which this method was defined or overridden. - * - * @return Name of class where this property was defined. - */ - public String getOriginClass() { - return this.iOriginClass; - } - - /** - * Get the parameter that matches the specified name. - * - * @param pName - * The name of the CIMParameter to retrieve. - * @return CIMParameter matching the name specified; otherwise - * null. - */ - public CIMParameter getParameter(String pName) { - return (CIMParameter) CIMElementSorter.find(this.iParams, pName); - } - - /** - * Returns an array of the parameters for this method. - * - * @return The parameters for this method. - */ - public CIMParameter[] getParameters() { - return this.iParams == null ? new CIMParameter[0] : this.iParams; - } - - /** - * Get a qualifier by index. - * - * @param pIndex - * The index of the qualifier. - * @return The Qualifier at index pIndex. - * @throws ArrayIndexOutOfBoundsException - */ - public CIMQualifier getQualifier(int pIndex) throws ArrayIndexOutOfBoundsException { - return this.iQualiImpl.getQualifier(pIndex); - } - - /** - * Gets a qualifier by name. - * - * @param pName - * The name of the qualifier to get. - * @return null if the qualifier does not exist, otherwise - * returns the reference to the qualifier. - */ - public CIMQualifier getQualifier(String pName) { - return this.iQualiImpl.getQualifier(pName); - } - - /** - * Get the number of qualifiers defined for this CIM Method. - * - * @return The number of qualifiers. - */ - public int getQualifierCount() { - return this.iQualiImpl.getQualifierCount(); - } - - /** - * Returns the list of qualifiers for this class. - * - * @return Qualifiers for this class. - */ - public CIMQualifier[] getQualifiers() { - return this.iQualiImpl.getQualifiers(); - } - - /** - * Gets a qualifier value by name. - * - * @param pName - * The name of the qualifier to get. - * @return null if the qualifier does not exist or value is - * null, otherwise returns the reference to the - * qualifier. - */ - public Object getQualifierValue(String pName) { - return this.iQualiImpl.getQualifierValue(pName); - } - - /** - * Checks whether the specified qualifier is one of the qualifiers in this - * CIM method. - * - * @param pName - * The name of the qualifier. - * @return true if the qualifier exists in this CIM method, - * otherwise false. - */ - public boolean hasQualifier(String pName) { - return this.iQualiImpl.hasQualifier(pName); - } - - /** - * Checks whether the specified qualifier is one of the qualifiers defined - * for this method with the specified value. This method will return - * false if the qualifier is not applied or if the value does - * not match. - * - * @param pName - * The name of the qualifier. - * @param pValue - * The value to be tested. - * @return true if the qualifier exists and has this value, - * otherwise false. - */ - public boolean hasQualifierValue(String pName, Object pValue) { - return this.iQualiImpl.hasQualifierValue(pName, pValue); - } - - /** - * Determines if this method is Propagated. - * - * @return true if this method is propagated. - */ - public boolean isPropagated() { - return this.iPropagated; - } - - /** - * Returns a String representation of the - * CIMMethod. This method is intended to be used only for - * debugging purposes, and the format of the returned string may vary - * between implementations. The returned string may be empty but may not be - * null. - * - * @return The string representation of this method. - */ - @Override - public String toString() { - return MOF.methodDeclaration(this, MOF.EMPTY); - } - -} +/* + (C) Copyright IBM Corp. 2006, 2012 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Change History + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-10-06 ebak Make SBLIM client JSR48 compliant + * 1660756 2007-02-22 ebak Embedded object support + * 1737141 2007-06-18 ebak Sync up with JSR48 evolution + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2750520 2009-04-10 blaschke-oss Code cleanup from empty statement et al + * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics + * 2935258 2010-01-22 blaschke-oss Sync up javax.cim.* javadoc with JSR48 1.0.0 + * 2944842 2010-02-08 blaschke-oss Missing thrown ArrayIndexOutOfBoundsException + * 3001333 2010-05-19 blaschke-oss CIMMethod class ignores propagated parameter + * 3400209 2011-08-31 blaschke-oss Highlighted Static Analysis (PMD) issues + * 3565581 2012-09-07 blaschke-oss TCK: remove unnecessary overriding methods + */ + +package org.metricshub.wbem.javax.cim; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.Arrays; + +import org.metricshub.wbem.sblim.cimclient.internal.cim.CIMElementSorter; +import org.metricshub.wbem.sblim.cimclient.internal.cim.CIMQualifiedElementInterfaceImpl; +import org.metricshub.wbem.sblim.cimclient.internal.util.MOF; + +//Sync'd against JSR48 1.0.0 javadoc (build 1.5.0_10) on Wed Jan 20 02:20:59 EST 2010 +/** + * This class represents a CIM Method as defined by the Distributed Management + * Task Force (DMTF) CIM Infrastructure + * Specification (DSP004). + * + * @param + * Type parameter. + */ +public class CIMMethod extends CIMTypedElement implements CIMQualifiedElementInterface { + + private static final long serialVersionUID = -3920536802046705977L; + + private CIMQualifiedElementInterfaceImpl iQualiImpl; + + private CIMParameter[] iParams; + + private boolean iPropagated; + + private String iOriginClass; + + /** + * Constructs a CIMMethod object with the specified + * information. + * + * @param pName + * The name of the method. + * @param pType + * The data type of the method. + * @param pQualis + * The method qualifiers. + * @param pParams + * The array of parameters for this method. + * @param pPropagated + * Is this method propagated from the superclass. + * @param pOriginClass + * The class this method was defined or overridden in. + */ + public CIMMethod(String pName, CIMDataType pType, CIMQualifier[] pQualis, + CIMParameter[] pParams, boolean pPropagated, String pOriginClass) { + super(pName, pType); + this.iQualiImpl = new CIMQualifiedElementInterfaceImpl(pQualis, false, true); + this.iParams = (CIMParameter[]) CIMElementSorter.sort(pParams); + this.iPropagated = pPropagated; + this.iOriginClass = pOriginClass; + } + + /** + * Compares this object against the specified object. The result is + * true if and only if the argument is not null + * and is a CIMMethod object that represents the same value as + * this object. + * + * @param pObj + * The object to compare. + * @return true if the objects are the same; false + * otherwise. + */ + @Override + public boolean equals(Object pObj) { + if (!(pObj instanceof CIMMethod)) return false; + if (!super.equals(pObj)) return false; + CIMMethod that = (CIMMethod) pObj; + if (!this.iQualiImpl.equals(that.iQualiImpl)) return false; + if (this.iPropagated != that.iPropagated) return false; + return Arrays.equals(getParameters(), that.getParameters()); + } + + /** + * Returns a CIMMethod filtered as specified. + * + * @param pIncludeQualifiers + * If true all qualifiers are returned; otherwise no + * qualifiers. + * @param pIncludeClassOrigin + * If true the class origin is included; otherwise + * no class origin is present. + * @return A filtered CIMMethod. + */ + public CIMMethod filter(boolean pIncludeQualifiers, boolean pIncludeClassOrigin) { + return filter(pIncludeQualifiers, pIncludeClassOrigin, false); + } + + /** + * Returns a CIMMethod filtered as specified. + * + * @param pIncludeQualifiers + * If true all qualifiers are returned; otherwise no + * qualifiers. + * @param pIncludeClassOrigin + * If true the class origin is included; otherwise + * no class origin is present + * @param pLocalOnly + * If true only the qualifiers defined on this class + * are included; otherwise all qualifiers are included. + * + * @return A filtered CIMMethod. + */ + public CIMMethod filter(boolean pIncludeQualifiers, boolean pIncludeClassOrigin, + boolean pLocalOnly) { + return new CIMMethod(getName(), getDataType(), pIncludeQualifiers ? this.iQualiImpl + .getQualifiers(pLocalOnly) : null, this.iParams, this.iPropagated, + pIncludeClassOrigin ? this.iOriginClass : null); + } + + /** + * Returns the class name in which this method was defined or overridden. + * + * @return Name of class where this property was defined. + */ + public String getOriginClass() { + return this.iOriginClass; + } + + /** + * Get the parameter that matches the specified name. + * + * @param pName + * The name of the CIMParameter to retrieve. + * @return CIMParameter matching the name specified; otherwise + * null. + */ + public CIMParameter getParameter(String pName) { + return (CIMParameter) CIMElementSorter.find(this.iParams, pName); + } + + /** + * Returns an array of the parameters for this method. + * + * @return The parameters for this method. + */ + public CIMParameter[] getParameters() { + return this.iParams == null ? new CIMParameter[0] : this.iParams; + } + + /** + * Get a qualifier by index. + * + * @param pIndex + * The index of the qualifier. + * @return The Qualifier at index pIndex. + * @throws ArrayIndexOutOfBoundsException + */ + public CIMQualifier getQualifier(int pIndex) throws ArrayIndexOutOfBoundsException { + return this.iQualiImpl.getQualifier(pIndex); + } + + /** + * Gets a qualifier by name. + * + * @param pName + * The name of the qualifier to get. + * @return null if the qualifier does not exist, otherwise + * returns the reference to the qualifier. + */ + public CIMQualifier getQualifier(String pName) { + return this.iQualiImpl.getQualifier(pName); + } + + /** + * Get the number of qualifiers defined for this CIM Method. + * + * @return The number of qualifiers. + */ + public int getQualifierCount() { + return this.iQualiImpl.getQualifierCount(); + } + + /** + * Returns the list of qualifiers for this class. + * + * @return Qualifiers for this class. + */ + public CIMQualifier[] getQualifiers() { + return this.iQualiImpl.getQualifiers(); + } + + /** + * Gets a qualifier value by name. + * + * @param pName + * The name of the qualifier to get. + * @return null if the qualifier does not exist or value is + * null, otherwise returns the reference to the + * qualifier. + */ + public Object getQualifierValue(String pName) { + return this.iQualiImpl.getQualifierValue(pName); + } + + /** + * Checks whether the specified qualifier is one of the qualifiers in this + * CIM method. + * + * @param pName + * The name of the qualifier. + * @return true if the qualifier exists in this CIM method, + * otherwise false. + */ + public boolean hasQualifier(String pName) { + return this.iQualiImpl.hasQualifier(pName); + } + + /** + * Checks whether the specified qualifier is one of the qualifiers defined + * for this method with the specified value. This method will return + * false if the qualifier is not applied or if the value does + * not match. + * + * @param pName + * The name of the qualifier. + * @param pValue + * The value to be tested. + * @return true if the qualifier exists and has this value, + * otherwise false. + */ + public boolean hasQualifierValue(String pName, Object pValue) { + return this.iQualiImpl.hasQualifierValue(pName, pValue); + } + + /** + * Determines if this method is Propagated. + * + * @return true if this method is propagated. + */ + public boolean isPropagated() { + return this.iPropagated; + } + + /** + * Returns a String representation of the + * CIMMethod. This method is intended to be used only for + * debugging purposes, and the format of the returned string may vary + * between implementations. The returned string may be empty but may not be + * null. + * + * @return The string representation of this method. + */ + @Override + public String toString() { + return MOF.methodDeclaration(this, MOF.EMPTY); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/javax/cim/CIMNamedElementInterface.java b/src/main/java/org/metricshub/wbem/javax/cim/CIMNamedElementInterface.java similarity index 67% rename from src/main/java/org/sentrysoftware/wbem/javax/cim/CIMNamedElementInterface.java rename to src/main/java/org/metricshub/wbem/javax/cim/CIMNamedElementInterface.java index 318a916..7b78352 100644 --- a/src/main/java/org/sentrysoftware/wbem/javax/cim/CIMNamedElementInterface.java +++ b/src/main/java/org/metricshub/wbem/javax/cim/CIMNamedElementInterface.java @@ -1,61 +1,59 @@ -/* - (C) Copyright IBM Corp. 2006, 2010 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------------------------- - * 2006-04-25 ebak Initial commit - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2935258 2010-01-22 blaschke-oss Sync up javax.cim.* javadoc with JSR48 1.0.0 - */ - -package org.sentrysoftware.wbem.javax.cim; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -//Sync'd against JSR48 1.0.0 javadoc (build 1.5.0_10) on Wed Jan 20 02:20:59 EST 2010 -/** - * The NamedElementInterface is used by CIM Elements that are named. For - * example, CIM Qualifier Types, CIM Classes and CIM Instances are all named and - * can be retrieved by a WBEM client. - */ -public interface CIMNamedElementInterface { - - /** - * Retrieve the ObjectPath that represents the name for this element. - * - * @return The Object Path that represents the element. - */ - CIMObjectPath getObjectPath(); - -} +/* + (C) Copyright IBM Corp. 2006, 2010 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------------------------- + * 2006-04-25 ebak Initial commit + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2935258 2010-01-22 blaschke-oss Sync up javax.cim.* javadoc with JSR48 1.0.0 + */ + +package org.metricshub.wbem.javax.cim; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +//Sync'd against JSR48 1.0.0 javadoc (build 1.5.0_10) on Wed Jan 20 02:20:59 EST 2010 +/** + * The NamedElementInterface is used by CIM Elements that are named. For + * example, CIM Qualifier Types, CIM Classes and CIM Instances are all named and + * can be retrieved by a WBEM client. + */ +public interface CIMNamedElementInterface { + + /** + * Retrieve the ObjectPath that represents the name for this element. + * + * @return The Object Path that represents the element. + */ + CIMObjectPath getObjectPath(); + +} diff --git a/src/main/java/org/sentrysoftware/wbem/javax/cim/CIMObjectPath.java b/src/main/java/org/metricshub/wbem/javax/cim/CIMObjectPath.java similarity index 90% rename from src/main/java/org/sentrysoftware/wbem/javax/cim/CIMObjectPath.java rename to src/main/java/org/metricshub/wbem/javax/cim/CIMObjectPath.java index a44e867..3db7a92 100644 --- a/src/main/java/org/sentrysoftware/wbem/javax/cim/CIMObjectPath.java +++ b/src/main/java/org/metricshub/wbem/javax/cim/CIMObjectPath.java @@ -1,674 +1,672 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-10-06 ebak Make SBLIM client JSR48 compliant - * 1669961 2006-04-16 lupusalex CIMTypedElement.getType() =>getDataType() - * 1716991 2006-05-11 lupusalex FVT: CIMObjectPath.equals() should ignore host name - * 1737141 2007-06-18 ebak Sync up with JSR48 evolution - * 1917321 2008-05-29 rgummada javadoc update to constructors with 2 and more parms - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors - * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics - * 2845128 2009-09-24 blaschke-oss CIMObjectPath.toString() misses host - * 2935258 2010-01-22 blaschke-oss Sync up javax.cim.* javadoc with JSR48 1.0.0 - * 2944824 2010-02-08 blaschke-oss Missing getXmlSchemaName() in CIMObjectPath - * 2975975 2010-03-24 blaschke-oss TCK: CIMObjectPath(String) does not handle null - * 3023141 2010-07-01 blaschke-oss CIMObjectPath uses # constructor instead of valueOf - * 3496349 2012-03-02 blaschke-oss JSR48 1.0.0: add CIMObjectPath getKeyValue - * 3510090 2012-03-23 blaschke-oss Fix CIMObjectPath.toString() inconsistencies - * 3513343 2012-03-31 blaschke-oss TCK: CIMObjectPath must validate XML schema name - * 3513347 2012-03-31 blaschke-oss TCK: CIMObjectPath allows empty string - * 3521131 2012-04-24 blaschke-oss Sync up javax.* javadoc with JSR48 1.0.0 Final II - * 3521119 2012-04-24 blaschke-oss JSR48 1.0.0: remove CIMObjectPath 2/3/4-parm ctors - * 3529151 2012-08-22 blaschke-oss TCK: CIMInstance property APIs include keys from COP - * 2660 2013-09-04 blaschke-oss CIMObjectPath.equalsModelPath same as equals - * 2716 2013-12-11 blaschke-oss Sync up javax.* javadoc with JSR48 1.0.0 Final V - */ - -package org.sentrysoftware.wbem.javax.cim; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.Serializable; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Arrays; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cim.CIMElementSorter; -import org.sentrysoftware.wbem.sblim.cimclient.internal.uri.BooleanValue; -import org.sentrysoftware.wbem.sblim.cimclient.internal.uri.CharValue; -import org.sentrysoftware.wbem.sblim.cimclient.internal.uri.DateTimeValue; -import org.sentrysoftware.wbem.sblim.cimclient.internal.uri.IntegerValue; -import org.sentrysoftware.wbem.sblim.cimclient.internal.uri.KeyValuePair; -import org.sentrysoftware.wbem.sblim.cimclient.internal.uri.KeyValuePairs; -import org.sentrysoftware.wbem.sblim.cimclient.internal.uri.RealValue; -import org.sentrysoftware.wbem.sblim.cimclient.internal.uri.ReferenceValue; -import org.sentrysoftware.wbem.sblim.cimclient.internal.uri.StringValue; -import org.sentrysoftware.wbem.sblim.cimclient.internal.uri.URI; -import org.sentrysoftware.wbem.sblim.cimclient.internal.uri.URIString; -import org.sentrysoftware.wbem.sblim.cimclient.internal.uri.Value; -import org.sentrysoftware.wbem.sblim.cimclient.internal.util.MOF; - -//Sync'd against JSR48 1.0.0 javadoc (version 1.7.0_03) on Tue Dec 10 07:02:50 EST 2013 -/** - * This class represents the CIM Object Path as defined by the Distributed - * Management Task Force (DMTF) CIM - * Infrastructure Specification (DSP004). In order to uniquely identify a given object, a CIM object path - * includes the host, namespace, object name and keys (if the object is an - * instance).
      - *
      - * For example, the object path:
      - *
      - * - * http://myserver/root/cimv2:My_ComputerSystem.Name=mycomputer, - * CreationClassName=My_ComputerSystem - *
      - *
      - * has two parts:
      - *
      - *
      • Namespace Path
      • - *
      • - * http://myserver/root/cimv2 - * JSR48 defines the namespace path to include the scheme, host, port (optional) - * and namespace - * The example specifies the "root/cimv2" namespace on the host - * myserver.
      • Model Path
      • - *
      • My_ComputerSystem.Name=mycomputer,CreationClassName=My_ComputerSystem - *
        - * DSP0004 defines the model path for a class or qualifier type as the name of - * the class/qualifier type
        - * DSP0004 defines the model path for an instance as the class - * name.(key=value),*
        - * The example specifies an instance for the class - * My_ComputerSystem which is uniquely identified by two key - * properties and values:
      • Name=mycomputer
      • - *
      • - * CreationClassName=My_ComputerSystem
      - */ -public class CIMObjectPath extends Object implements Serializable { - - private static final long serialVersionUID = 4593259690658425064L; - - private String iScheme, iHost, iPort, iNamespace, iObjectName, iXmlSchemaName; - - private CIMProperty[] iKeys; - - /** - * Class TypeValuePair represents a type-value pair with special - * identification functionality for integer and real numbers. - * - */ - private static class TypeValuePair { - - private CIMDataType iType; - - private Object iValue; - - /** - * Constructs a type-value pair with the specified type and value. - * - * @param pType - * Type. - * @param pValue - * Value. - */ - public TypeValuePair(CIMDataType pType, Object pValue) { - this.iType = pType; - this.iValue = pValue; - } - - /** - * Constructs a type-value pair with the specified integer value. - * - * @param intVal - * Integer value. - */ - public TypeValuePair(IntegerValue intVal) { - if (intVal.isSigned()) { - switch (intVal.getBitWidth()) { - case 8: - this.iType = CIMDataType.SINT8_T; - this.iValue = Byte.valueOf(intVal.byteValue()); - break; - case 16: - this.iType = CIMDataType.SINT16_T; - this.iValue = Short.valueOf(intVal.shortValue()); - break; - case 32: - this.iType = CIMDataType.SINT32_T; - this.iValue = Integer.valueOf(intVal.intValue()); - break; - default: - this.iType = CIMDataType.SINT64_T; - this.iValue = Long.valueOf(intVal.longValue()); - } - - } else { // unsigned integers - switch (intVal.getBitWidth()) { - case 8: - this.iType = CIMDataType.UINT8_T; - this.iValue = new UnsignedInteger8(intVal.shortValue()); - break; - case 16: - this.iType = CIMDataType.UINT16_T; - this.iValue = new UnsignedInteger16(intVal.intValue()); - break; - case 32: - this.iType = CIMDataType.UINT32_T; - this.iValue = new UnsignedInteger32(intVal.longValue()); - break; - default: - this.iType = CIMDataType.UINT64_T; - this.iValue = new UnsignedInteger64(intVal.bigIntValue()); - } - } - } - - /** - * Constructs a type-value pair with the specified real value. - * - * @param pRealVal - * Real value. - */ - public TypeValuePair(RealValue pRealVal) { - // TODO: handle precision - if (pRealVal.isDouble()) { - this.iType = CIMDataType.REAL64_T; - this.iValue = new Double(pRealVal.doubleValue()); - } else { - this.iType = CIMDataType.REAL32_T; - this.iValue = new Float(pRealVal.floatValue()); - } - } - - /** - * Returns the type of the type-value pair. - * - * @return Type of type-value pair. - */ - public CIMDataType getType() { - return this.iType; - } - - /** - * Returns the value of the type-value pair. - * - * @return Value of type-value pair. - */ - public Object getValue() { - return this.iValue; - } - - } - - /** - * Extracts and returns sorted list of key-value pairs from the URI. - * - * @param pURI - * The Uniform Resource Identifier. - * @return Sorted array of keys in URI. - */ - private CIMProperty[] getKeysFromURI(URI pURI) { - KeyValuePairs pairs = pURI.getKeyValuePairs(); - if (pairs == null) return null; - CIMProperty[] keys = new CIMProperty[pairs.size()]; - for (int i = 0; i < pairs.size(); i++) { - KeyValuePair pair = (KeyValuePair) pairs.elementAt(i); - String name = pair.getKey(); - Value uriVal = pair.getValue(); - TypeValuePair typeValue; - if (uriVal instanceof StringValue) { - typeValue = new TypeValuePair(CIMDataType.STRING_T, uriVal.toString()); - } else if (uriVal instanceof ReferenceValue) { - ReferenceValue refVal = (ReferenceValue) uriVal; - CIMObjectPath op = new CIMObjectPath(refVal.getRef()); - typeValue = new TypeValuePair(new CIMDataType(op.getObjectName()), op); - } else if (uriVal instanceof BooleanValue) { - typeValue = new TypeValuePair(CIMDataType.BOOLEAN_T, ((BooleanValue) uriVal) - .getBoolean()); - } else if (uriVal instanceof CharValue) { - typeValue = new TypeValuePair(CIMDataType.CHAR16_T, ((CharValue) uriVal) - .getCharacter()); - } else if (uriVal instanceof IntegerValue) { - typeValue = new TypeValuePair((IntegerValue) uriVal); - } else if (uriVal instanceof RealValue) { - typeValue = new TypeValuePair((RealValue) uriVal); - } else if (uriVal instanceof DateTimeValue) { - typeValue = new TypeValuePair(CIMDataType.DATETIME_T, ((DateTimeValue) uriVal) - .getDateTime()); - } else { - // TODO: error or warning tracing - typeValue = new TypeValuePair(CIMDataType.INVALID_T, null); - } - keys[i] = new CIMProperty(name, typeValue.getType(), typeValue.getValue(), - true, false, null); - } - return (CIMProperty[]) CIMElementSorter.sort(keys); - } - - /** - * Initializes the elements of the CIMObjectPath from the given - * URI. - * - * @param pURI - * The Uniform Resource Identifier. - */ - private void setURI(URI pURI) { - this.iNamespace = pURI.getNamespaceName(); - this.iScheme = pURI.getNamespaceType(); - this.iHost = pURI.getHost(); - this.iPort = pURI.getPort(); - this.iObjectName = pURI.getClassName(); - this.iKeys = getKeysFromURI(pURI); - } - - /** - * Constructs a CIM Object Path referencing an instance of the specified CIM - * element in the given URI. - * - * @param pURI - * The Uniform Resource Identifier. - */ - private CIMObjectPath(URI pURI) { - setURI(pURI); - } - - /** - * Constructs a CIM Object Path referencing a CIM element. The name can - * refer to a class name or a qualifier type name, depending on the - * particular CIM element identified. In order to refer to an instance, the - * key properties and their corresponding values must be set.
      - *
      - * Should be able to handle strings, like:
      - * - * http://myserver.org:5066/root/cimv2:My_ComputerSystem.Name="mycmp",CreationClassName="My_ComputerSystem" - *
      - * http://myserver.org/root/cimv2:My_ComputerSystem.Name="mycmp",CreationClassName="My_ComputerSystem" - *
      - * //myserver.org/root/cimv2:My_ComputerSystem
      - * /root/cimv2:My_ComputerSystem - *
      - * - * @param pObjectPath - * The string representation of an object path for a CIM element - * that will be parsed and used to initialize the object. - * @throws IllegalArgumentException - * If the pObjectPath is null or an - * empty string. - */ - public CIMObjectPath(String pObjectPath) { - URI uri; - - if (pObjectPath == null) throw new IllegalArgumentException("ObjectPath is null!"); - if (pObjectPath.trim().length() == 0) throw new IllegalArgumentException( - "ObjectPath is empty!"); - - try { - uri = URI.parse(pObjectPath); - } catch (IllegalArgumentException asURI) { - try { - uri = URI.parseRef(new URIString(pObjectPath), false); - } catch (IllegalArgumentException asUntypedRef) { - try { - uri = URI.parseRef(new URIString(pObjectPath), true); - } catch (IllegalArgumentException asTypedRef) { - String msg = "Parsing of ObjectPath string has failed!\n" - + "Nested error messages:\n" + "When parsing as normal URI string:\n" - + asURI.getMessage() + "When parsing as untyped reference:\n" - + asUntypedRef.getMessage() + "When parsing as typed reference:\n" - + asTypedRef.getMessage(); - // TODO: tracing - throw new IllegalArgumentException(msg); - } - } - } - setURI(uri); - } - - /** - * Constructs a CIM Object Path referencing an instance of the specified CIM - * element as defined in the specified namespace on the specified host and - * identified by the given key properties and their corresponding values. - * Note that the connection mechanism and the port number to which a client - * connection is established are also specified.
      - *
      - * NOTE: When using this API against OpenPegasus CIMOM, do not provide the - * preceding '/' in the namespace parameter. For example, OpenPegasus will - * accept "root/cimv2" as a namespace but will not accept - * "/root/cimv2". - * - * @param pScheme - * The connection scheme to the host (e.g. http, https, ...) - * @param pHost - * The host name or IP Address. - * @param pPort - * The port on the host to which the connection was established. - * @param pNamespace - * The namepace in which the CIM element is defined. - * @param pObjectName - * The name of the CIM element referenced. - * @param pKeys - * The keys and their corresponding values that identify an - * instance of the CIM element. - */ - public CIMObjectPath(String pScheme, String pHost, String pPort, String pNamespace, - String pObjectName, CIMProperty[] pKeys) { - this.iScheme = pScheme; - this.iHost = pHost; - this.iPort = pPort; - this.iNamespace = pNamespace; - this.iObjectName = pObjectName; - if (pKeys != null) { - for (int i = 0; i < pKeys.length; i++) - if (!pKeys[i].isKey()) throw new IllegalArgumentException( - "All CIMObjectPath properties must be keys!"); - } - this.iKeys = (CIMProperty[]) CIMElementSorter.sort(pKeys); - } - - /** - * Constructs a CIM Object Path referencing an instance of the specified CIM - * element as defined in the specified namespace on the specified host and - * identified by the given key properties and their corresponding values. - * Note that the connection mechanism and the port number to which a client - * connection is established are also specified.
      - *
      - * NOTE: When using this API against OpenPegasus CIMOM, do not provide the - * preceding '/' in the namespace parameter. For example, OpenPegasus will - * accept "root/cimv2" as a namespace but will not accept - * "/root/cimv2". - * - * @param pScheme - * The connection scheme to the host (e.g. http, https, ...) - * @param pHost - * The host name or IP Address. - * @param pPort - * The port on the host to which the connection was established. - * @param pNamespace - * The namepace in which the CIM element is defined. - * @param pObjectName - * The name of the CIM element referenced. - * @param pKeys - * The keys and their corresponding values that identify an - * instance of the CIM element. - * @param pXmlSchemaName - * The name of the XML Schema for this object. This is only - * needed for protocols that require this information. - */ - public CIMObjectPath(String pScheme, String pHost, String pPort, String pNamespace, - String pObjectName, CIMProperty[] pKeys, String pXmlSchemaName) { - this(pScheme, pHost, pPort, pNamespace, pObjectName, pKeys); - if (pXmlSchemaName != null) { - try { - new URL(pXmlSchemaName); - } catch (MalformedURLException e) { - throw new IllegalArgumentException(e); - } - } - this.iXmlSchemaName = pXmlSchemaName; - } - - /** - * Compares this CIM object path with the specified CIM object path for - * equality. - * - * @param pObj - * The object to compare to this CIM object path. Only the model - * paths are compared. - * @return true if the specified path references the same - * object, otherwise false is returned. - */ - @Override - public boolean equals(Object pObj) { - return equalsWorker(pObj, true); - } - - private boolean equalsWorker(Object pObj, boolean pIncludeNamespacePath) { - if (!(pObj instanceof CIMObjectPath)) return false; - CIMObjectPath that = (CIMObjectPath) pObj; - // hostname information is not any longer part of the comparison, since - // there is no reliable way to attach hostnames - if (pIncludeNamespacePath) { - boolean namespaceEqual = (this.iNamespace == null ? that.iNamespace == null - : this.iNamespace.equalsIgnoreCase(that.iNamespace)); - if (!namespaceEqual) return false; - } - return (this.iObjectName == null ? that.iObjectName == null : this.iObjectName - .equalsIgnoreCase(that.iObjectName)) - && keysEqual(that); - } - - /** - * Compares this CIM object path's keys with the specified CIM object path's - * keys for equality.
      - *
      - * NOTE: CIMProperty.equals() shouldn't be used for keys, - * because the XML doesn't contain originClass and propagated information. - * - * @param pThat - * The object path whose keys are to be compared to this CIM - * object path's keys. - * @return true if the keys are the same, otherwise - * false is returned. - */ - private boolean keysEqual(CIMObjectPath pThat) { - if (pThat == this) return true; - if (this.iKeys == null) return pThat.iKeys == null; - if (pThat.iKeys == null) return false; - if (this.iKeys.length != pThat.iKeys.length) return false; - for (int i = 0; i < this.iKeys.length; i++) { - CIMProperty thisKey = this.iKeys[i], thatKey = pThat.iKeys[i]; - if (!equals(thisKey, thatKey)) { return false; } - } - return true; - } - - /** - * Compares two properties for equality. - * - * @param pThis - * First property. - * @param pThat - * Second property. - * @return true if the properties are equal, false - * otherwise. - */ - private boolean equals(CIMProperty pThis, CIMProperty pThat) { - if (pThis.getDataType() != null && pThis.getDataType().isArray()) { return ncEqualsIC(pThis - .getName(), pThat.getName()) - && ncEquals(pThis.getDataType(), pThat.getDataType()) - && Arrays.equals((Object[]) pThis.getValue(), (Object[]) pThat.getValue()); - - } - return ncEqualsIC(pThis.getName(), pThat.getName()) - && ncEquals(pThis.getDataType(), pThat.getDataType()) - && ncEquals(pThis.getValue(), pThat.getValue()); - } - - /** - * Compares two objects for equality. - * - * @param pThis - * First object. - * @param pThat - * Second object. - * @return true if the objects are equal, false - * otherwise. - */ - private boolean ncEquals(Object pThis, Object pThat) { - return pThis == null ? pThat == null : pThis.equals(pThat); - } - - /** - * Compares two strings for equality, ignoring case. - * - * @param pThis - * First string. - * @param pThat - * Second string. - * @return true if the strings are equal, false - * otherwise. - */ - private boolean ncEqualsIC(String pThis, String pThat) { - return pThis == null ? pThat == null : pThis.equalsIgnoreCase(pThat); - } - - /** - * Compares this model path with the specified model path for equality. If - * the model path includes references, then the references will also be - * compared for the model path (i.e. the namespace part of the object path - * will be ignored). - * - * @param pModelPath - * The object to compare. - * @return true if the specified path references the same - * object, otherwise false. - */ - public boolean equalsModelPath(CIMObjectPath pModelPath) { - return equalsWorker(pModelPath, false); - } - - /** - * Gets the host. - * - * @return The name of the host. - */ - public String getHost() { - return this.iHost; - } - - /** - * Gets a key property by name. - * - * @param pName - * The name of the key property to retrieve. - * @return The CIMProperty with the given name, or - * null if it is not found. - */ - public CIMProperty getKey(String pName) { - return (CIMProperty) CIMElementSorter.find(this.iKeys, pName); - } - - /** - * Gets all key properties. - * - * @return The container of key properties. - */ - public CIMProperty[] getKeys() { - return this.iKeys == null ? new CIMProperty[0] : this.iKeys; - } - - /** - * @param pName - * The name of the key property to retrieve. - * @return The value of the key property. - */ - public Object getKeyValue(String pName) { - CIMProperty prop = getKey(pName); - return prop == null ? prop : prop.getValue(); - } - - /** - * Gets the namespace. - * - * @return The name of the namespace. - */ - public String getNamespace() { - return this.iNamespace; - } - - /** - * Gets the object name. Depending on the type of CIM element referenced, - * this may be either a class name or a qualifier type name. - * - * @return The name of this CIM element. - */ - public String getObjectName() { - return this.iObjectName; - } - - /** - * Gets the the port on the host to which the connection was established. - * - * @return The port on the host. - */ - public String getPort() { - return this.iPort; - } - - /** - * Get the connection scheme. - * - * @return The connection scheme (e.g. http, https,...) - */ - public String getScheme() { - return this.iScheme; - } - - /** - * Get the XML Schema for this object (optional). - * - * @return The XML Schema name. - */ - public String getXmlSchemaName() { - return this.iXmlSchemaName; - } - - /** - * Computes the hash code for this object path. - * - * @return The integer representing the hash code for this object path. - */ - @Override - public int hashCode() { - return toString().hashCode(); - } - - /** - * Returns a String representation of the CIM object path. This - * method is intended to be used only for debugging purposes. The format of - * the value returned may vary between implementations. The string returned - * may be empty but may not be null. - * - * @return A string representation of this CIM object path. - */ - @Override - public String toString() { - return MOF.objectHandle(this, false, false); - } - -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-10-06 ebak Make SBLIM client JSR48 compliant + * 1669961 2006-04-16 lupusalex CIMTypedElement.getType() =>getDataType() + * 1716991 2006-05-11 lupusalex FVT: CIMObjectPath.equals() should ignore host name + * 1737141 2007-06-18 ebak Sync up with JSR48 evolution + * 1917321 2008-05-29 rgummada javadoc update to constructors with 2 and more parms + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors + * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics + * 2845128 2009-09-24 blaschke-oss CIMObjectPath.toString() misses host + * 2935258 2010-01-22 blaschke-oss Sync up javax.cim.* javadoc with JSR48 1.0.0 + * 2944824 2010-02-08 blaschke-oss Missing getXmlSchemaName() in CIMObjectPath + * 2975975 2010-03-24 blaschke-oss TCK: CIMObjectPath(String) does not handle null + * 3023141 2010-07-01 blaschke-oss CIMObjectPath uses # constructor instead of valueOf + * 3496349 2012-03-02 blaschke-oss JSR48 1.0.0: add CIMObjectPath getKeyValue + * 3510090 2012-03-23 blaschke-oss Fix CIMObjectPath.toString() inconsistencies + * 3513343 2012-03-31 blaschke-oss TCK: CIMObjectPath must validate XML schema name + * 3513347 2012-03-31 blaschke-oss TCK: CIMObjectPath allows empty string + * 3521131 2012-04-24 blaschke-oss Sync up javax.* javadoc with JSR48 1.0.0 Final II + * 3521119 2012-04-24 blaschke-oss JSR48 1.0.0: remove CIMObjectPath 2/3/4-parm ctors + * 3529151 2012-08-22 blaschke-oss TCK: CIMInstance property APIs include keys from COP + * 2660 2013-09-04 blaschke-oss CIMObjectPath.equalsModelPath same as equals + * 2716 2013-12-11 blaschke-oss Sync up javax.* javadoc with JSR48 1.0.0 Final V + */ + +package org.metricshub.wbem.javax.cim; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.Serializable; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.Arrays; + +import org.metricshub.wbem.sblim.cimclient.internal.cim.CIMElementSorter; +import org.metricshub.wbem.sblim.cimclient.internal.uri.BooleanValue; +import org.metricshub.wbem.sblim.cimclient.internal.uri.CharValue; +import org.metricshub.wbem.sblim.cimclient.internal.uri.DateTimeValue; +import org.metricshub.wbem.sblim.cimclient.internal.uri.IntegerValue; +import org.metricshub.wbem.sblim.cimclient.internal.uri.KeyValuePair; +import org.metricshub.wbem.sblim.cimclient.internal.uri.KeyValuePairs; +import org.metricshub.wbem.sblim.cimclient.internal.uri.RealValue; +import org.metricshub.wbem.sblim.cimclient.internal.uri.ReferenceValue; +import org.metricshub.wbem.sblim.cimclient.internal.uri.StringValue; +import org.metricshub.wbem.sblim.cimclient.internal.uri.URI; +import org.metricshub.wbem.sblim.cimclient.internal.uri.URIString; +import org.metricshub.wbem.sblim.cimclient.internal.uri.Value; +import org.metricshub.wbem.sblim.cimclient.internal.util.MOF; + +//Sync'd against JSR48 1.0.0 javadoc (version 1.7.0_03) on Tue Dec 10 07:02:50 EST 2013 +/** + * This class represents the CIM Object Path as defined by the Distributed + * Management Task Force (DMTF) CIM + * Infrastructure Specification (DSP004). In order to uniquely identify a given object, a CIM object path + * includes the host, namespace, object name and keys (if the object is an + * instance).
      + *
      + * For example, the object path:
      + *
      + * + * http://myserver/root/cimv2:My_ComputerSystem.Name=mycomputer, + * CreationClassName=My_ComputerSystem + *
      + *
      + * has two parts:
      + *
      + *
      • Namespace Path
      • + *
      • + * http://myserver/root/cimv2 + * JSR48 defines the namespace path to include the scheme, host, port (optional) + * and namespace + * The example specifies the "root/cimv2" namespace on the host + * myserver.
      • Model Path
      • + *
      • My_ComputerSystem.Name=mycomputer,CreationClassName=My_ComputerSystem + *
        + * DSP0004 defines the model path for a class or qualifier type as the name of + * the class/qualifier type
        + * DSP0004 defines the model path for an instance as the class + * name.(key=value),*
        + * The example specifies an instance for the class + * My_ComputerSystem which is uniquely identified by two key + * properties and values:
      • Name=mycomputer
      • + *
      • + * CreationClassName=My_ComputerSystem
      + */ +public class CIMObjectPath extends Object implements Serializable { + + private static final long serialVersionUID = 4593259690658425064L; + + private String iScheme, iHost, iPort, iNamespace, iObjectName, iXmlSchemaName; + + private CIMProperty[] iKeys; + + /** + * Class TypeValuePair represents a type-value pair with special + * identification functionality for integer and real numbers. + * + */ + private static class TypeValuePair { + + private CIMDataType iType; + + private Object iValue; + + /** + * Constructs a type-value pair with the specified type and value. + * + * @param pType + * Type. + * @param pValue + * Value. + */ + public TypeValuePair(CIMDataType pType, Object pValue) { + this.iType = pType; + this.iValue = pValue; + } + + /** + * Constructs a type-value pair with the specified integer value. + * + * @param intVal + * Integer value. + */ + public TypeValuePair(IntegerValue intVal) { + if (intVal.isSigned()) { + switch (intVal.getBitWidth()) { + case 8: + this.iType = CIMDataType.SINT8_T; + this.iValue = Byte.valueOf(intVal.byteValue()); + break; + case 16: + this.iType = CIMDataType.SINT16_T; + this.iValue = Short.valueOf(intVal.shortValue()); + break; + case 32: + this.iType = CIMDataType.SINT32_T; + this.iValue = Integer.valueOf(intVal.intValue()); + break; + default: + this.iType = CIMDataType.SINT64_T; + this.iValue = Long.valueOf(intVal.longValue()); + } + + } else { // unsigned integers + switch (intVal.getBitWidth()) { + case 8: + this.iType = CIMDataType.UINT8_T; + this.iValue = new UnsignedInteger8(intVal.shortValue()); + break; + case 16: + this.iType = CIMDataType.UINT16_T; + this.iValue = new UnsignedInteger16(intVal.intValue()); + break; + case 32: + this.iType = CIMDataType.UINT32_T; + this.iValue = new UnsignedInteger32(intVal.longValue()); + break; + default: + this.iType = CIMDataType.UINT64_T; + this.iValue = new UnsignedInteger64(intVal.bigIntValue()); + } + } + } + + /** + * Constructs a type-value pair with the specified real value. + * + * @param pRealVal + * Real value. + */ + public TypeValuePair(RealValue pRealVal) { + // TODO: handle precision + if (pRealVal.isDouble()) { + this.iType = CIMDataType.REAL64_T; + this.iValue = new Double(pRealVal.doubleValue()); + } else { + this.iType = CIMDataType.REAL32_T; + this.iValue = new Float(pRealVal.floatValue()); + } + } + + /** + * Returns the type of the type-value pair. + * + * @return Type of type-value pair. + */ + public CIMDataType getType() { + return this.iType; + } + + /** + * Returns the value of the type-value pair. + * + * @return Value of type-value pair. + */ + public Object getValue() { + return this.iValue; + } + + } + + /** + * Extracts and returns sorted list of key-value pairs from the URI. + * + * @param pURI + * The Uniform Resource Identifier. + * @return Sorted array of keys in URI. + */ + private CIMProperty[] getKeysFromURI(URI pURI) { + KeyValuePairs pairs = pURI.getKeyValuePairs(); + if (pairs == null) return null; + CIMProperty[] keys = new CIMProperty[pairs.size()]; + for (int i = 0; i < pairs.size(); i++) { + KeyValuePair pair = (KeyValuePair) pairs.elementAt(i); + String name = pair.getKey(); + Value uriVal = pair.getValue(); + TypeValuePair typeValue; + if (uriVal instanceof StringValue) { + typeValue = new TypeValuePair(CIMDataType.STRING_T, uriVal.toString()); + } else if (uriVal instanceof ReferenceValue) { + ReferenceValue refVal = (ReferenceValue) uriVal; + CIMObjectPath op = new CIMObjectPath(refVal.getRef()); + typeValue = new TypeValuePair(new CIMDataType(op.getObjectName()), op); + } else if (uriVal instanceof BooleanValue) { + typeValue = new TypeValuePair(CIMDataType.BOOLEAN_T, ((BooleanValue) uriVal) + .getBoolean()); + } else if (uriVal instanceof CharValue) { + typeValue = new TypeValuePair(CIMDataType.CHAR16_T, ((CharValue) uriVal) + .getCharacter()); + } else if (uriVal instanceof IntegerValue) { + typeValue = new TypeValuePair((IntegerValue) uriVal); + } else if (uriVal instanceof RealValue) { + typeValue = new TypeValuePair((RealValue) uriVal); + } else if (uriVal instanceof DateTimeValue) { + typeValue = new TypeValuePair(CIMDataType.DATETIME_T, ((DateTimeValue) uriVal) + .getDateTime()); + } else { + // TODO: error or warning tracing + typeValue = new TypeValuePair(CIMDataType.INVALID_T, null); + } + keys[i] = new CIMProperty(name, typeValue.getType(), typeValue.getValue(), + true, false, null); + } + return (CIMProperty[]) CIMElementSorter.sort(keys); + } + + /** + * Initializes the elements of the CIMObjectPath from the given + * URI. + * + * @param pURI + * The Uniform Resource Identifier. + */ + private void setURI(URI pURI) { + this.iNamespace = pURI.getNamespaceName(); + this.iScheme = pURI.getNamespaceType(); + this.iHost = pURI.getHost(); + this.iPort = pURI.getPort(); + this.iObjectName = pURI.getClassName(); + this.iKeys = getKeysFromURI(pURI); + } + + /** + * Constructs a CIM Object Path referencing an instance of the specified CIM + * element in the given URI. + * + * @param pURI + * The Uniform Resource Identifier. + */ + private CIMObjectPath(URI pURI) { + setURI(pURI); + } + + /** + * Constructs a CIM Object Path referencing a CIM element. The name can + * refer to a class name or a qualifier type name, depending on the + * particular CIM element identified. In order to refer to an instance, the + * key properties and their corresponding values must be set.
      + *
      + * Should be able to handle strings, like:
      + * + * http://myserver.org:5066/root/cimv2:My_ComputerSystem.Name="mycmp",CreationClassName="My_ComputerSystem" + *
      + * http://myserver.org/root/cimv2:My_ComputerSystem.Name="mycmp",CreationClassName="My_ComputerSystem" + *
      + * //myserver.org/root/cimv2:My_ComputerSystem
      + * /root/cimv2:My_ComputerSystem + *
      + * + * @param pObjectPath + * The string representation of an object path for a CIM element + * that will be parsed and used to initialize the object. + * @throws IllegalArgumentException + * If the pObjectPath is null or an + * empty string. + */ + public CIMObjectPath(String pObjectPath) { + URI uri; + + if (pObjectPath == null) throw new IllegalArgumentException("ObjectPath is null!"); + if (pObjectPath.trim().length() == 0) throw new IllegalArgumentException( + "ObjectPath is empty!"); + + try { + uri = URI.parse(pObjectPath); + } catch (IllegalArgumentException asURI) { + try { + uri = URI.parseRef(new URIString(pObjectPath), false); + } catch (IllegalArgumentException asUntypedRef) { + try { + uri = URI.parseRef(new URIString(pObjectPath), true); + } catch (IllegalArgumentException asTypedRef) { + String msg = "Parsing of ObjectPath string has failed!\n" + + "Nested error messages:\n" + "When parsing as normal URI string:\n" + + asURI.getMessage() + "When parsing as untyped reference:\n" + + asUntypedRef.getMessage() + "When parsing as typed reference:\n" + + asTypedRef.getMessage(); + // TODO: tracing + throw new IllegalArgumentException(msg); + } + } + } + setURI(uri); + } + + /** + * Constructs a CIM Object Path referencing an instance of the specified CIM + * element as defined in the specified namespace on the specified host and + * identified by the given key properties and their corresponding values. + * Note that the connection mechanism and the port number to which a client + * connection is established are also specified.
      + *
      + * NOTE: When using this API against OpenPegasus CIMOM, do not provide the + * preceding '/' in the namespace parameter. For example, OpenPegasus will + * accept "root/cimv2" as a namespace but will not accept + * "/root/cimv2". + * + * @param pScheme + * The connection scheme to the host (e.g. http, https, ...) + * @param pHost + * The host name or IP Address. + * @param pPort + * The port on the host to which the connection was established. + * @param pNamespace + * The namepace in which the CIM element is defined. + * @param pObjectName + * The name of the CIM element referenced. + * @param pKeys + * The keys and their corresponding values that identify an + * instance of the CIM element. + */ + public CIMObjectPath(String pScheme, String pHost, String pPort, String pNamespace, + String pObjectName, CIMProperty[] pKeys) { + this.iScheme = pScheme; + this.iHost = pHost; + this.iPort = pPort; + this.iNamespace = pNamespace; + this.iObjectName = pObjectName; + if (pKeys != null) { + for (int i = 0; i < pKeys.length; i++) + if (!pKeys[i].isKey()) throw new IllegalArgumentException( + "All CIMObjectPath properties must be keys!"); + } + this.iKeys = (CIMProperty[]) CIMElementSorter.sort(pKeys); + } + + /** + * Constructs a CIM Object Path referencing an instance of the specified CIM + * element as defined in the specified namespace on the specified host and + * identified by the given key properties and their corresponding values. + * Note that the connection mechanism and the port number to which a client + * connection is established are also specified.
      + *
      + * NOTE: When using this API against OpenPegasus CIMOM, do not provide the + * preceding '/' in the namespace parameter. For example, OpenPegasus will + * accept "root/cimv2" as a namespace but will not accept + * "/root/cimv2". + * + * @param pScheme + * The connection scheme to the host (e.g. http, https, ...) + * @param pHost + * The host name or IP Address. + * @param pPort + * The port on the host to which the connection was established. + * @param pNamespace + * The namepace in which the CIM element is defined. + * @param pObjectName + * The name of the CIM element referenced. + * @param pKeys + * The keys and their corresponding values that identify an + * instance of the CIM element. + * @param pXmlSchemaName + * The name of the XML Schema for this object. This is only + * needed for protocols that require this information. + */ + public CIMObjectPath(String pScheme, String pHost, String pPort, String pNamespace, + String pObjectName, CIMProperty[] pKeys, String pXmlSchemaName) { + this(pScheme, pHost, pPort, pNamespace, pObjectName, pKeys); + if (pXmlSchemaName != null) { + try { + new URL(pXmlSchemaName); + } catch (MalformedURLException e) { + throw new IllegalArgumentException(e); + } + } + this.iXmlSchemaName = pXmlSchemaName; + } + + /** + * Compares this CIM object path with the specified CIM object path for + * equality. + * + * @param pObj + * The object to compare to this CIM object path. Only the model + * paths are compared. + * @return true if the specified path references the same + * object, otherwise false is returned. + */ + @Override + public boolean equals(Object pObj) { + return equalsWorker(pObj, true); + } + + private boolean equalsWorker(Object pObj, boolean pIncludeNamespacePath) { + if (!(pObj instanceof CIMObjectPath)) return false; + CIMObjectPath that = (CIMObjectPath) pObj; + // hostname information is not any longer part of the comparison, since + // there is no reliable way to attach hostnames + if (pIncludeNamespacePath) { + boolean namespaceEqual = (this.iNamespace == null ? that.iNamespace == null + : this.iNamespace.equalsIgnoreCase(that.iNamespace)); + if (!namespaceEqual) return false; + } + return (this.iObjectName == null ? that.iObjectName == null : this.iObjectName + .equalsIgnoreCase(that.iObjectName)) + && keysEqual(that); + } + + /** + * Compares this CIM object path's keys with the specified CIM object path's + * keys for equality.
      + *
      + * NOTE: CIMProperty.equals() shouldn't be used for keys, + * because the XML doesn't contain originClass and propagated information. + * + * @param pThat + * The object path whose keys are to be compared to this CIM + * object path's keys. + * @return true if the keys are the same, otherwise + * false is returned. + */ + private boolean keysEqual(CIMObjectPath pThat) { + if (pThat == this) return true; + if (this.iKeys == null) return pThat.iKeys == null; + if (pThat.iKeys == null) return false; + if (this.iKeys.length != pThat.iKeys.length) return false; + for (int i = 0; i < this.iKeys.length; i++) { + CIMProperty thisKey = this.iKeys[i], thatKey = pThat.iKeys[i]; + if (!equals(thisKey, thatKey)) { return false; } + } + return true; + } + + /** + * Compares two properties for equality. + * + * @param pThis + * First property. + * @param pThat + * Second property. + * @return true if the properties are equal, false + * otherwise. + */ + private boolean equals(CIMProperty pThis, CIMProperty pThat) { + if (pThis.getDataType() != null && pThis.getDataType().isArray()) { return ncEqualsIC(pThis + .getName(), pThat.getName()) + && ncEquals(pThis.getDataType(), pThat.getDataType()) + && Arrays.equals((Object[]) pThis.getValue(), (Object[]) pThat.getValue()); + + } + return ncEqualsIC(pThis.getName(), pThat.getName()) + && ncEquals(pThis.getDataType(), pThat.getDataType()) + && ncEquals(pThis.getValue(), pThat.getValue()); + } + + /** + * Compares two objects for equality. + * + * @param pThis + * First object. + * @param pThat + * Second object. + * @return true if the objects are equal, false + * otherwise. + */ + private boolean ncEquals(Object pThis, Object pThat) { + return pThis == null ? pThat == null : pThis.equals(pThat); + } + + /** + * Compares two strings for equality, ignoring case. + * + * @param pThis + * First string. + * @param pThat + * Second string. + * @return true if the strings are equal, false + * otherwise. + */ + private boolean ncEqualsIC(String pThis, String pThat) { + return pThis == null ? pThat == null : pThis.equalsIgnoreCase(pThat); + } + + /** + * Compares this model path with the specified model path for equality. If + * the model path includes references, then the references will also be + * compared for the model path (i.e. the namespace part of the object path + * will be ignored). + * + * @param pModelPath + * The object to compare. + * @return true if the specified path references the same + * object, otherwise false. + */ + public boolean equalsModelPath(CIMObjectPath pModelPath) { + return equalsWorker(pModelPath, false); + } + + /** + * Gets the host. + * + * @return The name of the host. + */ + public String getHost() { + return this.iHost; + } + + /** + * Gets a key property by name. + * + * @param pName + * The name of the key property to retrieve. + * @return The CIMProperty with the given name, or + * null if it is not found. + */ + public CIMProperty getKey(String pName) { + return (CIMProperty) CIMElementSorter.find(this.iKeys, pName); + } + + /** + * Gets all key properties. + * + * @return The container of key properties. + */ + public CIMProperty[] getKeys() { + return this.iKeys == null ? new CIMProperty[0] : this.iKeys; + } + + /** + * @param pName + * The name of the key property to retrieve. + * @return The value of the key property. + */ + public Object getKeyValue(String pName) { + CIMProperty prop = getKey(pName); + return prop == null ? prop : prop.getValue(); + } + + /** + * Gets the namespace. + * + * @return The name of the namespace. + */ + public String getNamespace() { + return this.iNamespace; + } + + /** + * Gets the object name. Depending on the type of CIM element referenced, + * this may be either a class name or a qualifier type name. + * + * @return The name of this CIM element. + */ + public String getObjectName() { + return this.iObjectName; + } + + /** + * Gets the the port on the host to which the connection was established. + * + * @return The port on the host. + */ + public String getPort() { + return this.iPort; + } + + /** + * Get the connection scheme. + * + * @return The connection scheme (e.g. http, https,...) + */ + public String getScheme() { + return this.iScheme; + } + + /** + * Get the XML Schema for this object (optional). + * + * @return The XML Schema name. + */ + public String getXmlSchemaName() { + return this.iXmlSchemaName; + } + + /** + * Computes the hash code for this object path. + * + * @return The integer representing the hash code for this object path. + */ + @Override + public int hashCode() { + return toString().hashCode(); + } + + /** + * Returns a String representation of the CIM object path. This + * method is intended to be used only for debugging purposes. The format of + * the value returned may vary between implementations. The string returned + * may be empty but may not be null. + * + * @return A string representation of this CIM object path. + */ + @Override + public String toString() { + return MOF.objectHandle(this, false, false); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/javax/cim/CIMParameter.java b/src/main/java/org/metricshub/wbem/javax/cim/CIMParameter.java similarity index 86% rename from src/main/java/org/sentrysoftware/wbem/javax/cim/CIMParameter.java rename to src/main/java/org/metricshub/wbem/javax/cim/CIMParameter.java index eac1e7d..b1c6d22 100644 --- a/src/main/java/org/sentrysoftware/wbem/javax/cim/CIMParameter.java +++ b/src/main/java/org/metricshub/wbem/javax/cim/CIMParameter.java @@ -1,231 +1,229 @@ -/* - (C) Copyright IBM Corp. 2006, 2012 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-10-06 ebak Make SBLIM client JSR48 compliant - * 1660756 2007-02-22 ebak Embedded object support - * 1737141 2007-06-19 ebak Sync up with JSR48 evolution - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2750520 2009-04-10 blaschke-oss Code cleanup from empty statement et al - * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics - * 2935258 2010-01-22 blaschke-oss Sync up javax.cim.* javadoc with JSR48 1.0.0 - * 2944842 2010-02-08 blaschke-oss Missing thrown ArrayIndexOutOfBoundsException - * 3400209 2011-08-31 blaschke-oss Highlighted Static Analysis (PMD) issues - * 3565581 2012-09-07 blaschke-oss TCK: remove unnecessary overriding methods - */ - -package org.sentrysoftware.wbem.javax.cim; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cim.CIMQualifiedElementInterfaceImpl; -import org.sentrysoftware.wbem.sblim.cimclient.internal.util.MOF; - -//Sync'd against JSR48 1.0.0 javadoc (build 1.5.0_10) on Wed Jan 20 02:20:59 EST 2010 -/** - * This class represents a CIM Parameter. A CIM Parameter is a schema item, thus - * it can only be part of a CIMMethod definition for a - * CIMClass. A parameter can be used to define an input, output or - * input/output parameter. A CIMParameter consists of a name, data - * type and qualifiers. CIMParameters do not have values - so you - * can not set a default value. CIM Parameters are defined by the Distributed - * Management Task Force (DMTF) CIM - * Infrastructure Specification (DSP004). To invoke a method, you would use CIMArgument. - * - * @param - * Type parameter. - * - * @see CIMMethod - */ -public class CIMParameter extends CIMTypedElement implements CIMQualifiedElementInterface { - - private static final long serialVersionUID = -4741931597423829396L; - - private CIMQualifiedElementInterfaceImpl iQualiImpl; - - /** - * Constructs a CIMParameter object using the specified name, - * data type and qualifiers. Takes a string for the name of an existing CIM - * parameter and creates a new instance of a CIM parameter, using the name - * and identifier of the existing CIM parameter. - * - * @param pName - * Name of this parameter. - * @param pType - * Data type of this parameter. - * @param pQualifiers - * Qualifiers for this parameter. - */ - public CIMParameter(String pName, CIMDataType pType, CIMQualifier[] pQualifiers) { - super(pName, pType); - this.iQualiImpl = new CIMQualifiedElementInterfaceImpl(pQualifiers, false, true); - } - - /** - * Compares this object against the specified object. The result is - * true if and only if the argument is not null - * and is a CIMParameter object that represents the same value - * as this object. - * - * @param pObj - * The object to compare. - * @return true if the objects are the same; false - * otherwise. - */ - @Override - public boolean equals(Object pObj) { - if (!(pObj instanceof CIMParameter)) return false; - if (!super.equals(pObj)) return false; - CIMParameter that = (CIMParameter) pObj; - return this.iQualiImpl.equals(that.iQualiImpl); - } - - /** - * Returns a CIMParameter filtered as specified. - * - * @param pIncludeQualifiers - * If true all qualifiers are returned; otherwise no - * qualifiers. - * @param pLocalOnly - * If true only the qualifiers that were not - * propagated will be included. - * @return A filtered CIMParameter. - */ - public CIMParameter filter(boolean pIncludeQualifiers, boolean pLocalOnly) { - return new CIMParameter(getName(), getDataType(), pIncludeQualifiers ? this.iQualiImpl - .getQualifiers(pLocalOnly) : null); - } - - /** - * Get a qualifier by index. - * - * @param pIndex - * The index of the qualifier. - * @return The Qualifier at index pIndex. - * @throws ArrayIndexOutOfBoundsException - */ - public CIMQualifier getQualifier(int pIndex) throws ArrayIndexOutOfBoundsException { - return this.iQualiImpl.getQualifier(pIndex); - } - - /** - * Gets a qualifier by name. - * - * @param pName - * The name of the qualifier to get. - * @return null if the qualifier does not exist, otherwise - * returns the reference to the qualifier. - */ - public CIMQualifier getQualifier(String pName) { - return this.iQualiImpl.getQualifier(pName); - } - - /** - * Get the number of qualifiers defined for this CIM Parameter. - * - * @return The number of qualifiers. - */ - public int getQualifierCount() { - return this.iQualiImpl.getQualifierCount(); - } - - /** - * Returns the list of qualifiers for this class. - * - * @return Qualifiers for this class. - */ - public CIMQualifier[] getQualifiers() { - return this.iQualiImpl.getQualifiers(); - } - - /** - * Gets a qualifier value by name. - * - * @param pName - * The name of the qualifier to get. - * @return null if the qualifier does not exist or value is - * null, otherwise returns the reference to the - * qualifier. - */ - public Object getQualifierValue(String pName) { - return this.iQualiImpl.getQualifierValue(pName); - } - - /** - * Checks whether the specified qualifier is one of the qualifiers in this - * CIM element. - * - * @param pName - * The name of the qualifier. - * @return true if the qualifier exists in this CIM parameter, - * otherwise false. - */ - public boolean hasQualifier(String pName) { - return this.iQualiImpl.hasQualifier(pName); - } - - /** - * Checks whether the specified qualifier is one of the qualifiers defined - * for this parameter with the specified value. This method will return - * false if the qualifier is not applied or if the value does - * not match. - * - * @param pName - * The name of the qualifier. - * @param pValue - * The value to be tested. - * @return true if the qualifier exists in this property, - * otherwise false. - */ - public boolean hasQualifierValue(String pName, Object pValue) { - return this.iQualiImpl.hasQualifierValue(pName, pValue); - } - - /** - * Returns a String representation of the - * CIMParameter. This method is intended to be used only for - * debugging purposes, and the format of the returned string may vary - * between implementations. The returned string may be empty but may not be - * null. - * - * @return String representation of this parameter. - */ - @Override - public String toString() { - return MOF.parameter(this, MOF.EMPTY); - } - -} +/* + (C) Copyright IBM Corp. 2006, 2012 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-10-06 ebak Make SBLIM client JSR48 compliant + * 1660756 2007-02-22 ebak Embedded object support + * 1737141 2007-06-19 ebak Sync up with JSR48 evolution + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2750520 2009-04-10 blaschke-oss Code cleanup from empty statement et al + * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics + * 2935258 2010-01-22 blaschke-oss Sync up javax.cim.* javadoc with JSR48 1.0.0 + * 2944842 2010-02-08 blaschke-oss Missing thrown ArrayIndexOutOfBoundsException + * 3400209 2011-08-31 blaschke-oss Highlighted Static Analysis (PMD) issues + * 3565581 2012-09-07 blaschke-oss TCK: remove unnecessary overriding methods + */ + +package org.metricshub.wbem.javax.cim; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.sblim.cimclient.internal.cim.CIMQualifiedElementInterfaceImpl; +import org.metricshub.wbem.sblim.cimclient.internal.util.MOF; + +//Sync'd against JSR48 1.0.0 javadoc (build 1.5.0_10) on Wed Jan 20 02:20:59 EST 2010 +/** + * This class represents a CIM Parameter. A CIM Parameter is a schema item, thus + * it can only be part of a CIMMethod definition for a + * CIMClass. A parameter can be used to define an input, output or + * input/output parameter. A CIMParameter consists of a name, data + * type and qualifiers. CIMParameters do not have values - so you + * can not set a default value. CIM Parameters are defined by the Distributed + * Management Task Force (DMTF) CIM + * Infrastructure Specification (DSP004). To invoke a method, you would use CIMArgument. + * + * @param + * Type parameter. + * + * @see CIMMethod + */ +public class CIMParameter extends CIMTypedElement implements CIMQualifiedElementInterface { + + private static final long serialVersionUID = -4741931597423829396L; + + private CIMQualifiedElementInterfaceImpl iQualiImpl; + + /** + * Constructs a CIMParameter object using the specified name, + * data type and qualifiers. Takes a string for the name of an existing CIM + * parameter and creates a new instance of a CIM parameter, using the name + * and identifier of the existing CIM parameter. + * + * @param pName + * Name of this parameter. + * @param pType + * Data type of this parameter. + * @param pQualifiers + * Qualifiers for this parameter. + */ + public CIMParameter(String pName, CIMDataType pType, CIMQualifier[] pQualifiers) { + super(pName, pType); + this.iQualiImpl = new CIMQualifiedElementInterfaceImpl(pQualifiers, false, true); + } + + /** + * Compares this object against the specified object. The result is + * true if and only if the argument is not null + * and is a CIMParameter object that represents the same value + * as this object. + * + * @param pObj + * The object to compare. + * @return true if the objects are the same; false + * otherwise. + */ + @Override + public boolean equals(Object pObj) { + if (!(pObj instanceof CIMParameter)) return false; + if (!super.equals(pObj)) return false; + CIMParameter that = (CIMParameter) pObj; + return this.iQualiImpl.equals(that.iQualiImpl); + } + + /** + * Returns a CIMParameter filtered as specified. + * + * @param pIncludeQualifiers + * If true all qualifiers are returned; otherwise no + * qualifiers. + * @param pLocalOnly + * If true only the qualifiers that were not + * propagated will be included. + * @return A filtered CIMParameter. + */ + public CIMParameter filter(boolean pIncludeQualifiers, boolean pLocalOnly) { + return new CIMParameter(getName(), getDataType(), pIncludeQualifiers ? this.iQualiImpl + .getQualifiers(pLocalOnly) : null); + } + + /** + * Get a qualifier by index. + * + * @param pIndex + * The index of the qualifier. + * @return The Qualifier at index pIndex. + * @throws ArrayIndexOutOfBoundsException + */ + public CIMQualifier getQualifier(int pIndex) throws ArrayIndexOutOfBoundsException { + return this.iQualiImpl.getQualifier(pIndex); + } + + /** + * Gets a qualifier by name. + * + * @param pName + * The name of the qualifier to get. + * @return null if the qualifier does not exist, otherwise + * returns the reference to the qualifier. + */ + public CIMQualifier getQualifier(String pName) { + return this.iQualiImpl.getQualifier(pName); + } + + /** + * Get the number of qualifiers defined for this CIM Parameter. + * + * @return The number of qualifiers. + */ + public int getQualifierCount() { + return this.iQualiImpl.getQualifierCount(); + } + + /** + * Returns the list of qualifiers for this class. + * + * @return Qualifiers for this class. + */ + public CIMQualifier[] getQualifiers() { + return this.iQualiImpl.getQualifiers(); + } + + /** + * Gets a qualifier value by name. + * + * @param pName + * The name of the qualifier to get. + * @return null if the qualifier does not exist or value is + * null, otherwise returns the reference to the + * qualifier. + */ + public Object getQualifierValue(String pName) { + return this.iQualiImpl.getQualifierValue(pName); + } + + /** + * Checks whether the specified qualifier is one of the qualifiers in this + * CIM element. + * + * @param pName + * The name of the qualifier. + * @return true if the qualifier exists in this CIM parameter, + * otherwise false. + */ + public boolean hasQualifier(String pName) { + return this.iQualiImpl.hasQualifier(pName); + } + + /** + * Checks whether the specified qualifier is one of the qualifiers defined + * for this parameter with the specified value. This method will return + * false if the qualifier is not applied or if the value does + * not match. + * + * @param pName + * The name of the qualifier. + * @param pValue + * The value to be tested. + * @return true if the qualifier exists in this property, + * otherwise false. + */ + public boolean hasQualifierValue(String pName, Object pValue) { + return this.iQualiImpl.hasQualifierValue(pName, pValue); + } + + /** + * Returns a String representation of the + * CIMParameter. This method is intended to be used only for + * debugging purposes, and the format of the returned string may vary + * between implementations. The returned string may be empty but may not be + * null. + * + * @return String representation of this parameter. + */ + @Override + public String toString() { + return MOF.parameter(this, MOF.EMPTY); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/javax/cim/CIMProperty.java b/src/main/java/org/metricshub/wbem/javax/cim/CIMProperty.java similarity index 86% rename from src/main/java/org/sentrysoftware/wbem/javax/cim/CIMProperty.java rename to src/main/java/org/metricshub/wbem/javax/cim/CIMProperty.java index 6a69a50..c37c0c5 100644 --- a/src/main/java/org/sentrysoftware/wbem/javax/cim/CIMProperty.java +++ b/src/main/java/org/metricshub/wbem/javax/cim/CIMProperty.java @@ -1,169 +1,167 @@ -/* - (C) Copyright IBM Corp. 2006, 2012 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-10-06 ebak Make SBLIM client JSR48 compliant - * 1737141 2007-06-18 ebak Sync up with JSR48 evolution - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2750520 2009-04-10 blaschke-oss Code cleanup from empty statement et al - * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors - * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics - * 2935258 2010-01-22 blaschke-oss Sync up javax.cim.* javadoc with JSR48 1.0.0 - * 3400209 2011-08-31 blaschke-oss Highlighted Static Analysis (PMD) issues - * 3496301 2012-03-02 blaschke-oss Sync up javax.* javadoc with JSR48 1.0.0 Final - * 3565581 2012-09-07 blaschke-oss TCK: remove unnecessary overriding methods - */ - -package org.sentrysoftware.wbem.javax.cim; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -//Sync'd against JSR48 1.0.0 javadoc (build 1.6.0_18) on Thu Mar 01 12:21:26 EST 2012 -/** - * This class represents a CIM Property as defined by the Distributed Management - * Task Force (DMTF) CIM Infrastructure - * Specification (DSP004). A CIM Property Object consists of a name, data type and value. - * The CIM Property object also includes a flag to signify whether the property - * is a key property (used as part of the name of the CIM element), a flag to - * signify whether it was propagated from a parent class and the class origin - * information (where the property was originally defined). - * - * @param - * Type parameter. - */ -public class CIMProperty extends CIMValuedElement { - - private static final long serialVersionUID = -4741931597423829396L; - - private boolean iKey, iPropagated; - - private String iOriginClass; - - /** - * Constructs a CIMProperty to be used in instances. For a - * CIMClass, CIMClassProperty shall be used. This - * can only be used for non-Key properties, non-propagated properties and - * when the the origin class is not needed. - * - * @param pName - * The name of the property. - * @param pType - * The CIMDataType of the property. - * @param pValue - * The value of the property. - */ - public CIMProperty(String pName, CIMDataType pType, E pValue) { - this(pName, pType, pValue, false, false, null); - } - - /** - * Constructs a CIMProperty to be used in instances. For a - * CIMClass, CIMClassProperty shall be used. - * - * @param pName - * The name of the property. - * @param pType - * The CIMDataType of the property. - * @param pValue - * The value of the property. - * @param pKey - * true if the property is a key; otherwise - * false. - * @param pPropagated - * true if the value was propagated from the class. - * @param pOriginClass - * The class in which this property was defined or overridden. - */ - public CIMProperty(String pName, CIMDataType pType, E pValue, boolean pKey, - boolean pPropagated, String pOriginClass) { - super(pName, pType, pValue); - this.iKey = pKey; - this.iPropagated = pPropagated; - this.iOriginClass = pOriginClass; - } - - /** - * Compares this object against the specified object. The result is - * true if and only if the argument is not null - * and is a CIMProperty that represents the same name, type and - * value as this object. - * - * @param pObj - * The object to compare with. - * @return true if the objects are the same; false - * otherwise. - */ - @Override - public boolean equals(Object pObj) { - if (!(pObj instanceof CIMProperty)) return false; - if (!super.equals(pObj)) return false; - CIMProperty that = (CIMProperty) pObj; - return this.iKey == that.iKey - && this.iPropagated == that.iPropagated - && (this.iOriginClass == null ? that.iOriginClass == null : this.iOriginClass - .equalsIgnoreCase(that.iOriginClass)); - } - - /** - * Returns the class in which this property was defined or overridden. - * - * @return Name of class where this property was defined. - */ - public String getOriginClass() { - return this.iOriginClass; - } - - /** - * Convenience method for determining if this property is a Key. - * - * @return true if this property is a key. - */ - public boolean isKey() { - return this.iKey; - } - - /** - * Determines if this property is Propagated. When this property is part of - * a class, this value designates that the class origin value is the same as - * the class name. - * - * @return true if this property is propagated. - */ - public boolean isPropagated() { - return this.iPropagated; - } - -} +/* + (C) Copyright IBM Corp. 2006, 2012 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-10-06 ebak Make SBLIM client JSR48 compliant + * 1737141 2007-06-18 ebak Sync up with JSR48 evolution + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2750520 2009-04-10 blaschke-oss Code cleanup from empty statement et al + * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors + * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics + * 2935258 2010-01-22 blaschke-oss Sync up javax.cim.* javadoc with JSR48 1.0.0 + * 3400209 2011-08-31 blaschke-oss Highlighted Static Analysis (PMD) issues + * 3496301 2012-03-02 blaschke-oss Sync up javax.* javadoc with JSR48 1.0.0 Final + * 3565581 2012-09-07 blaschke-oss TCK: remove unnecessary overriding methods + */ + +package org.metricshub.wbem.javax.cim; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +//Sync'd against JSR48 1.0.0 javadoc (build 1.6.0_18) on Thu Mar 01 12:21:26 EST 2012 +/** + * This class represents a CIM Property as defined by the Distributed Management + * Task Force (DMTF) CIM Infrastructure + * Specification (DSP004). A CIM Property Object consists of a name, data type and value. + * The CIM Property object also includes a flag to signify whether the property + * is a key property (used as part of the name of the CIM element), a flag to + * signify whether it was propagated from a parent class and the class origin + * information (where the property was originally defined). + * + * @param + * Type parameter. + */ +public class CIMProperty extends CIMValuedElement { + + private static final long serialVersionUID = -4741931597423829396L; + + private boolean iKey, iPropagated; + + private String iOriginClass; + + /** + * Constructs a CIMProperty to be used in instances. For a + * CIMClass, CIMClassProperty shall be used. This + * can only be used for non-Key properties, non-propagated properties and + * when the the origin class is not needed. + * + * @param pName + * The name of the property. + * @param pType + * The CIMDataType of the property. + * @param pValue + * The value of the property. + */ + public CIMProperty(String pName, CIMDataType pType, E pValue) { + this(pName, pType, pValue, false, false, null); + } + + /** + * Constructs a CIMProperty to be used in instances. For a + * CIMClass, CIMClassProperty shall be used. + * + * @param pName + * The name of the property. + * @param pType + * The CIMDataType of the property. + * @param pValue + * The value of the property. + * @param pKey + * true if the property is a key; otherwise + * false. + * @param pPropagated + * true if the value was propagated from the class. + * @param pOriginClass + * The class in which this property was defined or overridden. + */ + public CIMProperty(String pName, CIMDataType pType, E pValue, boolean pKey, + boolean pPropagated, String pOriginClass) { + super(pName, pType, pValue); + this.iKey = pKey; + this.iPropagated = pPropagated; + this.iOriginClass = pOriginClass; + } + + /** + * Compares this object against the specified object. The result is + * true if and only if the argument is not null + * and is a CIMProperty that represents the same name, type and + * value as this object. + * + * @param pObj + * The object to compare with. + * @return true if the objects are the same; false + * otherwise. + */ + @Override + public boolean equals(Object pObj) { + if (!(pObj instanceof CIMProperty)) return false; + if (!super.equals(pObj)) return false; + CIMProperty that = (CIMProperty) pObj; + return this.iKey == that.iKey + && this.iPropagated == that.iPropagated + && (this.iOriginClass == null ? that.iOriginClass == null : this.iOriginClass + .equalsIgnoreCase(that.iOriginClass)); + } + + /** + * Returns the class in which this property was defined or overridden. + * + * @return Name of class where this property was defined. + */ + public String getOriginClass() { + return this.iOriginClass; + } + + /** + * Convenience method for determining if this property is a Key. + * + * @return true if this property is a key. + */ + public boolean isKey() { + return this.iKey; + } + + /** + * Determines if this property is Propagated. When this property is part of + * a class, this value designates that the class origin value is the same as + * the class name. + * + * @return true if this property is propagated. + */ + public boolean isPropagated() { + return this.iPropagated; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/javax/cim/CIMQualifiedElementInterface.java b/src/main/java/org/metricshub/wbem/javax/cim/CIMQualifiedElementInterface.java similarity index 80% rename from src/main/java/org/sentrysoftware/wbem/javax/cim/CIMQualifiedElementInterface.java rename to src/main/java/org/metricshub/wbem/javax/cim/CIMQualifiedElementInterface.java index cf82a7f..5097df7 100644 --- a/src/main/java/org/sentrysoftware/wbem/javax/cim/CIMQualifiedElementInterface.java +++ b/src/main/java/org/metricshub/wbem/javax/cim/CIMQualifiedElementInterface.java @@ -1,124 +1,122 @@ -/* - (C) Copyright IBM Corp. 2006, 2010 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-10-06 ebak Make SBLIM client JSR48 compliant - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics - * 2935258 2010-01-22 blaschke-oss Sync up javax.cim.* javadoc with JSR48 1.0.0 - */ - -package org.sentrysoftware.wbem.javax.cim; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -//Sync'd against JSR48 1.0.0 javadoc (build 1.5.0_10) on Wed Jan 20 02:20:59 EST 2010 -/** - * The CIMQualifiedElementInterface is used by CIM Elements that - * have qualifiers. For example, CIM Classes, CIM Properties, CIM Methods and - * CIM Parameters are all CIM Elements that have qualifiers. - */ -public interface CIMQualifiedElementInterface { - - /** - * Get a qualifier by index. - * - * @param pIndex - * The index of the qualifier. - * @return The Qualifier at index pIndex. - */ - public CIMQualifier getQualifier(int pIndex); - - /** - * Gets a qualifier by name. - * - * @param pName - * The name of the qualifier to get. - * @return null if the qualifier does not exist, otherwise - * returns the reference to the qualifier. - */ - public CIMQualifier getQualifier(String pName); - - /** - * Get the number of qualifiers defined for this CIM Element. - * - * @return The number of qualifiers. - */ - public int getQualifierCount(); - - /** - * Returns the list of qualifiers for this class. - * - * @return Qualifiers for this class. - */ - public CIMQualifier[] getQualifiers(); - - /** - * Gets a qualifier value by name. - * - * @param pName - * The name of the qualifier to get. - * @return null if the qualifier does not exist or value is - * null, otherwise returns the reference to the - * qualifier. - */ - public Object getQualifierValue(String pName); - - /** - * Checks whether the specified qualifier is one of the qualifiers in this - * CIM element. - * - * @param pName - * The name of the qualifier. - * @return true if the qualifier exists in this CIM element, - * otherwise false. - */ - public boolean hasQualifier(String pName); - - /** - * Checks whether the specified qualifier is one of the qualifiers defined - * for this property with the specified value. This method will return - * false if the qualifier is not applied or if the value does - * not match. - * - * @param pName - * The name of the qualifier. - * @param pValue - * The value to be tested. - * @return true if the qualifier exists and has the value, - * otherwise false. - */ - public boolean hasQualifierValue(String pName, Object pValue); - -} +/* + (C) Copyright IBM Corp. 2006, 2010 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-10-06 ebak Make SBLIM client JSR48 compliant + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics + * 2935258 2010-01-22 blaschke-oss Sync up javax.cim.* javadoc with JSR48 1.0.0 + */ + +package org.metricshub.wbem.javax.cim; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +//Sync'd against JSR48 1.0.0 javadoc (build 1.5.0_10) on Wed Jan 20 02:20:59 EST 2010 +/** + * The CIMQualifiedElementInterface is used by CIM Elements that + * have qualifiers. For example, CIM Classes, CIM Properties, CIM Methods and + * CIM Parameters are all CIM Elements that have qualifiers. + */ +public interface CIMQualifiedElementInterface { + + /** + * Get a qualifier by index. + * + * @param pIndex + * The index of the qualifier. + * @return The Qualifier at index pIndex. + */ + public CIMQualifier getQualifier(int pIndex); + + /** + * Gets a qualifier by name. + * + * @param pName + * The name of the qualifier to get. + * @return null if the qualifier does not exist, otherwise + * returns the reference to the qualifier. + */ + public CIMQualifier getQualifier(String pName); + + /** + * Get the number of qualifiers defined for this CIM Element. + * + * @return The number of qualifiers. + */ + public int getQualifierCount(); + + /** + * Returns the list of qualifiers for this class. + * + * @return Qualifiers for this class. + */ + public CIMQualifier[] getQualifiers(); + + /** + * Gets a qualifier value by name. + * + * @param pName + * The name of the qualifier to get. + * @return null if the qualifier does not exist or value is + * null, otherwise returns the reference to the + * qualifier. + */ + public Object getQualifierValue(String pName); + + /** + * Checks whether the specified qualifier is one of the qualifiers in this + * CIM element. + * + * @param pName + * The name of the qualifier. + * @return true if the qualifier exists in this CIM element, + * otherwise false. + */ + public boolean hasQualifier(String pName); + + /** + * Checks whether the specified qualifier is one of the qualifiers defined + * for this property with the specified value. This method will return + * false if the qualifier is not applied or if the value does + * not match. + * + * @param pName + * The name of the qualifier. + * @param pValue + * The value to be tested. + * @return true if the qualifier exists and has the value, + * otherwise false. + */ + public boolean hasQualifierValue(String pName, Object pValue); + +} diff --git a/src/main/java/org/sentrysoftware/wbem/javax/cim/CIMQualifier.java b/src/main/java/org/metricshub/wbem/javax/cim/CIMQualifier.java similarity index 85% rename from src/main/java/org/sentrysoftware/wbem/javax/cim/CIMQualifier.java rename to src/main/java/org/metricshub/wbem/javax/cim/CIMQualifier.java index c89b9ab..0e0051f 100644 --- a/src/main/java/org/sentrysoftware/wbem/javax/cim/CIMQualifier.java +++ b/src/main/java/org/metricshub/wbem/javax/cim/CIMQualifier.java @@ -1,181 +1,179 @@ -/* - (C) Copyright IBM Corp. 2006, 2012 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-10-06 ebak Make SBLIM client JSR48 compliant - * 1737141 2007-06-18 ebak Sync up with JSR48 evolution - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2750520 2009-04-10 blaschke-oss Code cleanup from empty statement et al - * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors - * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics - * 2935258 2010-01-22 blaschke-oss Sync up javax.cim.* javadoc with JSR48 1.0.0 - * 3400209 2011-08-31 blaschke-oss Highlighted Static Analysis (PMD) issues - * 3565581 2012-09-07 blaschke-oss TCK: remove unnecessary overriding methods - */ - -package org.sentrysoftware.wbem.javax.cim; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.sblim.cimclient.internal.util.MOF; - -//Sync'd against JSR48 1.0.0 javadoc (build 1.5.0_10) on Wed Jan 20 02:20:59 EST 2010 -/** - * This class represents a CIM qualifier as defined by the Distributed - * Management Task Force (DMTF) CIM - * Infrastructure Specification (DSP004). A qualifier provides additional information about classes, - * associations, methods, parameters, properties, and/or references. A - * CIMQualifier must have a CIM Qualifier Type. A qualifier and its - * qualifier type must have the same name and data type. CIM Qualifiers can only - * be applied to elements that are allowed by the scope defined by the CIM - * Qualifier Type. - * - * @param - * Type parameter. - * @see CIMQualifierType - */ -public class CIMQualifier extends CIMValuedElement { - - private static final long serialVersionUID = 3568987946093931214L; - - private int iFlavor; - - private boolean iPropagated; - - /** - * Constructs a CIM qualifier with the specified name, type, value, and - * flavors. - * - * @param pName - * The name of the qualifier. - * @param pType - * The data type of the qualifier. - * @param pValue - * The value of the qualifier. - * @param pFlavor - * A list of override permissions. Flavors can be overridden from - * the Qualifier Type definition to either restrict the - * subclassing of a qualifier or to allow it. For the list of CIM - * Flavors see the CIMFlavor class. - * @see CIMFlavor - */ - public CIMQualifier(String pName, CIMDataType pType, E pValue, int pFlavor) { - this(pName, pType, pValue, pFlavor, false); - } - - /** - * Constructs a CIM qualifier with the specified name, type, value, and - * flavors. - * - * @param pName - * The name of the qualifier. - * @param pType - * The data type of the qualifier. - * @param pValue - * The value of the qualifier. - * @param pFlavor - * A list of override permissions. Flavors can be overridden from - * the Qualifier Type definition to either restrict the - * subclassing of a qualifier or to allow it. For the list of CIM - * Flavors see the CIMFlavor class. - * @param pIsPropagated - * true if the qualifier was propagated; - * false otherwise. - * @see CIMFlavor - */ - public CIMQualifier(String pName, CIMDataType pType, E pValue, int pFlavor, - boolean pIsPropagated) { - super(pName, pType, pValue); - this.iFlavor = pFlavor; - this.iPropagated = pIsPropagated; - } - - /** - * Compares this CIMQualifier against the specified - * CIMQualifier. The result is true if and only if - * the argument is not null and is a CIMQualifier - * that represents the same name, type and value as this - * CIMQualifier. - * - * @param pObj - * The object to compare. - * @return true if the input qualifier is equal, otherwise - * false. - */ - @Override - public boolean equals(Object pObj) { - if (!(pObj instanceof CIMQualifier)) return false; - if (!super.equals(pObj)) return false; - CIMQualifier that = (CIMQualifier) pObj; - return this.iFlavor == that.iFlavor && this.iPropagated == that.iPropagated; - } - - /** - * Returns the CIM flavors for this CIM qualifier. - * - * @return A BitSet of CIM flavors in this CIM qualifier. - */ - public int getFlavor() { - return this.iFlavor; - } - - /** - * Determines if this qualifier is propagated. If the qualifier was - * inherited, this value will be true. If the qualifier was - * applied to the element directly, this value will be false. - * - * @return true if this property is propagated; - * false otherwise. - */ - public boolean isPropagated() { - return this.iPropagated; - } - - /** - * Returns a String representation of the - * CIMQualifier. This method is intended to be used only for - * debugging purposes, and the format of the returned string may vary - * between implementations. The returned string may be empty but may not be - * null. - * - * @return A string representation of this qualifier. - */ - @Override - public String toString() { - return MOF.qualifier(this); - } - -} +/* + (C) Copyright IBM Corp. 2006, 2012 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-10-06 ebak Make SBLIM client JSR48 compliant + * 1737141 2007-06-18 ebak Sync up with JSR48 evolution + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2750520 2009-04-10 blaschke-oss Code cleanup from empty statement et al + * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors + * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics + * 2935258 2010-01-22 blaschke-oss Sync up javax.cim.* javadoc with JSR48 1.0.0 + * 3400209 2011-08-31 blaschke-oss Highlighted Static Analysis (PMD) issues + * 3565581 2012-09-07 blaschke-oss TCK: remove unnecessary overriding methods + */ + +package org.metricshub.wbem.javax.cim; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.sblim.cimclient.internal.util.MOF; + +//Sync'd against JSR48 1.0.0 javadoc (build 1.5.0_10) on Wed Jan 20 02:20:59 EST 2010 +/** + * This class represents a CIM qualifier as defined by the Distributed + * Management Task Force (DMTF) CIM + * Infrastructure Specification (DSP004). A qualifier provides additional information about classes, + * associations, methods, parameters, properties, and/or references. A + * CIMQualifier must have a CIM Qualifier Type. A qualifier and its + * qualifier type must have the same name and data type. CIM Qualifiers can only + * be applied to elements that are allowed by the scope defined by the CIM + * Qualifier Type. + * + * @param + * Type parameter. + * @see CIMQualifierType + */ +public class CIMQualifier extends CIMValuedElement { + + private static final long serialVersionUID = 3568987946093931214L; + + private int iFlavor; + + private boolean iPropagated; + + /** + * Constructs a CIM qualifier with the specified name, type, value, and + * flavors. + * + * @param pName + * The name of the qualifier. + * @param pType + * The data type of the qualifier. + * @param pValue + * The value of the qualifier. + * @param pFlavor + * A list of override permissions. Flavors can be overridden from + * the Qualifier Type definition to either restrict the + * subclassing of a qualifier or to allow it. For the list of CIM + * Flavors see the CIMFlavor class. + * @see CIMFlavor + */ + public CIMQualifier(String pName, CIMDataType pType, E pValue, int pFlavor) { + this(pName, pType, pValue, pFlavor, false); + } + + /** + * Constructs a CIM qualifier with the specified name, type, value, and + * flavors. + * + * @param pName + * The name of the qualifier. + * @param pType + * The data type of the qualifier. + * @param pValue + * The value of the qualifier. + * @param pFlavor + * A list of override permissions. Flavors can be overridden from + * the Qualifier Type definition to either restrict the + * subclassing of a qualifier or to allow it. For the list of CIM + * Flavors see the CIMFlavor class. + * @param pIsPropagated + * true if the qualifier was propagated; + * false otherwise. + * @see CIMFlavor + */ + public CIMQualifier(String pName, CIMDataType pType, E pValue, int pFlavor, + boolean pIsPropagated) { + super(pName, pType, pValue); + this.iFlavor = pFlavor; + this.iPropagated = pIsPropagated; + } + + /** + * Compares this CIMQualifier against the specified + * CIMQualifier. The result is true if and only if + * the argument is not null and is a CIMQualifier + * that represents the same name, type and value as this + * CIMQualifier. + * + * @param pObj + * The object to compare. + * @return true if the input qualifier is equal, otherwise + * false. + */ + @Override + public boolean equals(Object pObj) { + if (!(pObj instanceof CIMQualifier)) return false; + if (!super.equals(pObj)) return false; + CIMQualifier that = (CIMQualifier) pObj; + return this.iFlavor == that.iFlavor && this.iPropagated == that.iPropagated; + } + + /** + * Returns the CIM flavors for this CIM qualifier. + * + * @return A BitSet of CIM flavors in this CIM qualifier. + */ + public int getFlavor() { + return this.iFlavor; + } + + /** + * Determines if this qualifier is propagated. If the qualifier was + * inherited, this value will be true. If the qualifier was + * applied to the element directly, this value will be false. + * + * @return true if this property is propagated; + * false otherwise. + */ + public boolean isPropagated() { + return this.iPropagated; + } + + /** + * Returns a String representation of the + * CIMQualifier. This method is intended to be used only for + * debugging purposes, and the format of the returned string may vary + * between implementations. The returned string may be empty but may not be + * null. + * + * @return A string representation of this qualifier. + */ + @Override + public String toString() { + return MOF.qualifier(this); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/javax/cim/CIMQualifierType.java b/src/main/java/org/metricshub/wbem/javax/cim/CIMQualifierType.java similarity index 85% rename from src/main/java/org/sentrysoftware/wbem/javax/cim/CIMQualifierType.java rename to src/main/java/org/metricshub/wbem/javax/cim/CIMQualifierType.java index e215e40..7cad6a2 100644 --- a/src/main/java/org/sentrysoftware/wbem/javax/cim/CIMQualifierType.java +++ b/src/main/java/org/metricshub/wbem/javax/cim/CIMQualifierType.java @@ -1,174 +1,172 @@ -/* - (C) Copyright IBM Corp. 2006, 2012 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-10-06 ebak Make SBLIM client JSR48 compliant - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2750520 2009-04-10 blaschke-oss Code cleanup from empty statement et al - * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics - * 2935258 2010-01-22 blaschke-oss Sync up javax.cim.* javadoc with JSR48 1.0.0 - * 2975989 2010-03-24 blaschke-oss TCK: CIMQualifierType constructor does not handle null - * 3400209 2011-08-31 blaschke-oss Highlighted Static Analysis (PMD) issues - * 3565581 2012-09-07 blaschke-oss TCK: remove unnecessary overriding methods - */ - -package org.sentrysoftware.wbem.javax.cim; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.sblim.cimclient.internal.util.MOF; - -//Sync'd against JSR48 1.0.0 javadoc (build 1.5.0_10) on Wed Jan 20 02:20:59 EST 2010 -/** - * The CIMQualifierType class represents a CIM Qualifier Type as defined by the - * Distributed Management Task Force (DMTF) CIM - * Infrastructure Specification (DSP004). A Qualifier Type supplies the definition/rules for a qualifier. - * A qualifier must have a qualifier type. CIMQualifierType has the following - * components: - *
        - *
      • Name - The name of the qualifier type.
      • - *
      • Data Type - The data type of the qualifier type.
      • - *
      • Value - The default value of the qualifier type (can be - * null/uninitialized)
      • - *
      • Scopes - The scopes applicable to this qualifier type. In - * other words what CIM Elements can the qualifier based on this type be applied - * to.
      • - *
      • Flavors - The flavors applicable to this qualifier type. - * Flavors describe the propagation and override rules for a qualifier.
      • - *
      - * - * @param - * Type parameter. - * @see CIMScope - * @see CIMFlavor - * @see CIMQualifier - */ -public class CIMQualifierType extends CIMValuedElement implements CIMNamedElementInterface { - - private static final long serialVersionUID = -4563643521754840535L; - - private CIMObjectPath iObjPath; - - private int iScope, iFlavor; - - /** - * Constructs a new CIM qualifier type, using the name, type of the - * specified CIM qualifier type. - * - * @param pPath - * The CIMObjectPath of a CIM qualifier type. - * @param pType - * The CIMDataType of the qualifier type. - * @param pValue - * The default value or null if no default value. - * @param pScope - * The applicable scopes for the qualifier type. - * @param pFlavor - * The applicable flavors for the qualifier type. - * @throws IllegalArgumentException - * If the value/data type does not match. - */ - public CIMQualifierType(CIMObjectPath pPath, CIMDataType pType, E pValue, int pScope, - int pFlavor) throws IllegalArgumentException { - super(pPath == null ? null : pPath.getObjectName(), pType, pValue); - this.iObjPath = pPath; - this.iScope = pScope; - this.iFlavor = pFlavor; - } - - /** - * Compares this object against the specified object. The result is - * true if and only if the argument is not null - * and is a CIMQualifierType object that represents the same - * value as this object. - * - * @param pObj - * The object to compare. - * @return true if the specified object it is the same as this - * CIMQualifierType. Otherwise, false. - */ - @Override - public boolean equals(Object pObj) { - if (!(pObj instanceof CIMQualifierType)) return false; - if (!super.equals(pObj)) return false; - CIMQualifierType that = (CIMQualifierType) pObj; - return this.iObjPath.equals(that.iObjPath) && this.iScope == that.iScope; - } - - /** - * Returns the flavors of this qualifier type as a BitSet. - * - * @return BitSet of flavors for this qualifier type. - */ - public int getFlavor() { - return this.iFlavor; - } - - /** - * Get the object path for this CIMQualifierType. - * - * @return The CIMObjectPath that represents this qualifier - * type. - */ - public CIMObjectPath getObjectPath() { - return this.iObjPath; - } - - /** - * Returns the scopes of this qualifier type as a bit set. - * - * @return Bit set of CIM element scopes for which this qualifier type is - * applicable. - */ - public int getScope() { - return this.iScope; - } - - /** - * Returns a String representation of the - * CIMQualifierType This method is intended to be used only for - * debugging purposes, and the format of the returned string may vary - * between implementations. The returned string may be empty but may not be - * null. - * - * @return A string representation of this qualifier type. - */ - @Override - public String toString() { - return MOF.qualifierDeclaration(this); - } - -} +/* + (C) Copyright IBM Corp. 2006, 2012 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-10-06 ebak Make SBLIM client JSR48 compliant + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2750520 2009-04-10 blaschke-oss Code cleanup from empty statement et al + * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics + * 2935258 2010-01-22 blaschke-oss Sync up javax.cim.* javadoc with JSR48 1.0.0 + * 2975989 2010-03-24 blaschke-oss TCK: CIMQualifierType constructor does not handle null + * 3400209 2011-08-31 blaschke-oss Highlighted Static Analysis (PMD) issues + * 3565581 2012-09-07 blaschke-oss TCK: remove unnecessary overriding methods + */ + +package org.metricshub.wbem.javax.cim; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.sblim.cimclient.internal.util.MOF; + +//Sync'd against JSR48 1.0.0 javadoc (build 1.5.0_10) on Wed Jan 20 02:20:59 EST 2010 +/** + * The CIMQualifierType class represents a CIM Qualifier Type as defined by the + * Distributed Management Task Force (DMTF) CIM + * Infrastructure Specification (DSP004). A Qualifier Type supplies the definition/rules for a qualifier. + * A qualifier must have a qualifier type. CIMQualifierType has the following + * components: + *
        + *
      • Name - The name of the qualifier type.
      • + *
      • Data Type - The data type of the qualifier type.
      • + *
      • Value - The default value of the qualifier type (can be + * null/uninitialized)
      • + *
      • Scopes - The scopes applicable to this qualifier type. In + * other words what CIM Elements can the qualifier based on this type be applied + * to.
      • + *
      • Flavors - The flavors applicable to this qualifier type. + * Flavors describe the propagation and override rules for a qualifier.
      • + *
      + * + * @param + * Type parameter. + * @see CIMScope + * @see CIMFlavor + * @see CIMQualifier + */ +public class CIMQualifierType extends CIMValuedElement implements CIMNamedElementInterface { + + private static final long serialVersionUID = -4563643521754840535L; + + private CIMObjectPath iObjPath; + + private int iScope, iFlavor; + + /** + * Constructs a new CIM qualifier type, using the name, type of the + * specified CIM qualifier type. + * + * @param pPath + * The CIMObjectPath of a CIM qualifier type. + * @param pType + * The CIMDataType of the qualifier type. + * @param pValue + * The default value or null if no default value. + * @param pScope + * The applicable scopes for the qualifier type. + * @param pFlavor + * The applicable flavors for the qualifier type. + * @throws IllegalArgumentException + * If the value/data type does not match. + */ + public CIMQualifierType(CIMObjectPath pPath, CIMDataType pType, E pValue, int pScope, + int pFlavor) throws IllegalArgumentException { + super(pPath == null ? null : pPath.getObjectName(), pType, pValue); + this.iObjPath = pPath; + this.iScope = pScope; + this.iFlavor = pFlavor; + } + + /** + * Compares this object against the specified object. The result is + * true if and only if the argument is not null + * and is a CIMQualifierType object that represents the same + * value as this object. + * + * @param pObj + * The object to compare. + * @return true if the specified object it is the same as this + * CIMQualifierType. Otherwise, false. + */ + @Override + public boolean equals(Object pObj) { + if (!(pObj instanceof CIMQualifierType)) return false; + if (!super.equals(pObj)) return false; + CIMQualifierType that = (CIMQualifierType) pObj; + return this.iObjPath.equals(that.iObjPath) && this.iScope == that.iScope; + } + + /** + * Returns the flavors of this qualifier type as a BitSet. + * + * @return BitSet of flavors for this qualifier type. + */ + public int getFlavor() { + return this.iFlavor; + } + + /** + * Get the object path for this CIMQualifierType. + * + * @return The CIMObjectPath that represents this qualifier + * type. + */ + public CIMObjectPath getObjectPath() { + return this.iObjPath; + } + + /** + * Returns the scopes of this qualifier type as a bit set. + * + * @return Bit set of CIM element scopes for which this qualifier type is + * applicable. + */ + public int getScope() { + return this.iScope; + } + + /** + * Returns a String representation of the + * CIMQualifierType This method is intended to be used only for + * debugging purposes, and the format of the returned string may vary + * between implementations. The returned string may be empty but may not be + * null. + * + * @return A string representation of this qualifier type. + */ + @Override + public String toString() { + return MOF.qualifierDeclaration(this); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/javax/cim/CIMScope.java b/src/main/java/org/metricshub/wbem/javax/cim/CIMScope.java similarity index 78% rename from src/main/java/org/sentrysoftware/wbem/javax/cim/CIMScope.java rename to src/main/java/org/metricshub/wbem/javax/cim/CIMScope.java index e76bc81..f0c082d 100644 --- a/src/main/java/org/sentrysoftware/wbem/javax/cim/CIMScope.java +++ b/src/main/java/org/metricshub/wbem/javax/cim/CIMScope.java @@ -1,113 +1,111 @@ -/* - (C) Copyright IBM Corp. 2006, 2010 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-10-06 ebak Make SBLIM client JSR48 compliant - * 1737123 2007-06-15 ebak Differences to JSR48 public review draft - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2935258 2010-01-22 blaschke-oss Sync up javax.cim.* javadoc with JSR48 1.0.0 - */ - -package org.sentrysoftware.wbem.javax.cim; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.Serializable; - -//Sync'd against JSR48 1.0.0 javadoc (build 1.5.0_10) on Wed Jan 20 02:20:59 EST 2010 -/** - * This class represents a CIM Scope as defined by the Distributed Management - * Task Force (DMTF) CIM Infrastructure - * Specification (DSP004). This class is used in a CIMQualifierType to define - * what elements the qualifier can be applied to. - */ -public class CIMScope extends Object implements Serializable { - - private static final long serialVersionUID = -4563643521754840535l; - - /** - * Scope representing a qualifier that can be applied to any element. - */ - public static final int ANY = 127; - - /** - * Scope representing a qualifier that can be applied to an association. - */ - public static final int ASSOCIATION = 2; - - /** - * Scope representing a qualifier that can be applied to a CIM class. - */ - public static final int CLASS = 1; - - /** - * Scope representing a qualifier that can be applied to an indication. - */ - public static final int INDICATION = 4; - - /** - * Scope representing a qualifier that can be applied to a method. - */ - public static final int METHOD = 32; - - /** - * Scope representing a qualifier that can be applied to a parameter. - */ - public static final int PARAMETER = 64; - - /** - * Scope representing a qualifier that can be applied to a property. - */ - public static final int PROPERTY = 8; - - /** - * Scope representing a qualifier that can be applied to a reference. - */ - public static final int REFERENCE = 16; - - private static final int[] SCOPES = { ANY, ASSOCIATION, CLASS, INDICATION, METHOD, PARAMETER, - PROPERTY, REFERENCE }; - - /** - * Returns the complete set of possible scopes. - * - * @return An int array of all scopes. - */ - public static int[] getScopes() { - return SCOPES; - } - -} +/* + (C) Copyright IBM Corp. 2006, 2010 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-10-06 ebak Make SBLIM client JSR48 compliant + * 1737123 2007-06-15 ebak Differences to JSR48 public review draft + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2935258 2010-01-22 blaschke-oss Sync up javax.cim.* javadoc with JSR48 1.0.0 + */ + +package org.metricshub.wbem.javax.cim; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.Serializable; + +//Sync'd against JSR48 1.0.0 javadoc (build 1.5.0_10) on Wed Jan 20 02:20:59 EST 2010 +/** + * This class represents a CIM Scope as defined by the Distributed Management + * Task Force (DMTF) CIM Infrastructure + * Specification (DSP004). This class is used in a CIMQualifierType to define + * what elements the qualifier can be applied to. + */ +public class CIMScope extends Object implements Serializable { + + private static final long serialVersionUID = -4563643521754840535l; + + /** + * Scope representing a qualifier that can be applied to any element. + */ + public static final int ANY = 127; + + /** + * Scope representing a qualifier that can be applied to an association. + */ + public static final int ASSOCIATION = 2; + + /** + * Scope representing a qualifier that can be applied to a CIM class. + */ + public static final int CLASS = 1; + + /** + * Scope representing a qualifier that can be applied to an indication. + */ + public static final int INDICATION = 4; + + /** + * Scope representing a qualifier that can be applied to a method. + */ + public static final int METHOD = 32; + + /** + * Scope representing a qualifier that can be applied to a parameter. + */ + public static final int PARAMETER = 64; + + /** + * Scope representing a qualifier that can be applied to a property. + */ + public static final int PROPERTY = 8; + + /** + * Scope representing a qualifier that can be applied to a reference. + */ + public static final int REFERENCE = 16; + + private static final int[] SCOPES = { ANY, ASSOCIATION, CLASS, INDICATION, METHOD, PARAMETER, + PROPERTY, REFERENCE }; + + /** + * Returns the complete set of possible scopes. + * + * @return An int array of all scopes. + */ + public static int[] getScopes() { + return SCOPES; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/javax/cim/CIMTypedElement.java b/src/main/java/org/metricshub/wbem/javax/cim/CIMTypedElement.java similarity index 79% rename from src/main/java/org/sentrysoftware/wbem/javax/cim/CIMTypedElement.java rename to src/main/java/org/metricshub/wbem/javax/cim/CIMTypedElement.java index 653f563..2a42582 100644 --- a/src/main/java/org/sentrysoftware/wbem/javax/cim/CIMTypedElement.java +++ b/src/main/java/org/metricshub/wbem/javax/cim/CIMTypedElement.java @@ -1,127 +1,125 @@ -/* - (C) Copyright IBM Corp. 2006, 2011 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-10-06 ebak Make SBLIM client JSR48 compliant - * 1669961 2006-04-16 lupusalex CIMTypedElement.getType() =>getDataType() - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2227442 2008-11-05 blaschke-oss Add missing serialVersionUID - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2935258 2010-01-22 blaschke-oss Sync up javax.cim.* javadoc with JSR48 1.0.0 - * 3400209 2011-08-31 blaschke-oss Highlighted Static Analysis (PMD) issues - */ - -package org.sentrysoftware.wbem.javax.cim; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.sblim.cimclient.internal.util.MOF; - -//Sync'd against JSR48 1.0.0 javadoc (build 1.5.0_10) on Wed Jan 20 02:20:59 EST 2010 -/** - * CIMTypedElement is an abstract class that represents a CIM - * element that contains just the data type, but no value. - */ -public abstract class CIMTypedElement extends CIMElement { - - private static final long serialVersionUID = -8839964536590822815L; - - private CIMDataType iType; - - /** - * Constructs a CIMTypedElement with the given name and data - * type. - * - * @param pName - * Name of the element. - * @param pType - * Data type of the element. - */ - public CIMTypedElement(String pName, CIMDataType pType) { - super(pName); - this.iType = pType; - } - - /** - * Compares this object against the specified object. The result is - * true if and only if the argument is not null - * and is a CIMTypedElement that represents the same name and - * type as this object. - * - * @param pObj - * The object to compare with. - * @return true if the objects are the same; false - * otherwise. - */ - @Override - public boolean equals(Object pObj) { - if (!(pObj instanceof CIMTypedElement)) return false; - CIMTypedElement that = (CIMTypedElement) pObj; - if (!super.equals(that)) return false; - return this.iType.equals(that.iType); - } - - /** - * Returns the CIMDataType for this CIM Element. - * - * @return CIMDataType of this CIM element. - */ - public CIMDataType getDataType() { - return this.iType; - } - - /** - * Returns a hash code value for the CIM typed element. This method is - * supported for the benefit of hashtables such as those provided by - * java.util.Hashtable. - * - * @return A hash code value for this CIM typed element. - */ - @Override - public int hashCode() { - return toString().hashCode(); - } - - /** - * Returns a String representation of the CIM Element. This - * method is intended to be used only for debugging purposes, and the format - * of the returned string may vary between implementations. The returned - * string may be empty but may not be null. - * - * @return String representation of this element. - */ - @Override - public String toString() { - return MOF.typedElement(this, MOF.EMPTY); - } -} +/* + (C) Copyright IBM Corp. 2006, 2011 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-10-06 ebak Make SBLIM client JSR48 compliant + * 1669961 2006-04-16 lupusalex CIMTypedElement.getType() =>getDataType() + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2227442 2008-11-05 blaschke-oss Add missing serialVersionUID + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2935258 2010-01-22 blaschke-oss Sync up javax.cim.* javadoc with JSR48 1.0.0 + * 3400209 2011-08-31 blaschke-oss Highlighted Static Analysis (PMD) issues + */ + +package org.metricshub.wbem.javax.cim; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.sblim.cimclient.internal.util.MOF; + +//Sync'd against JSR48 1.0.0 javadoc (build 1.5.0_10) on Wed Jan 20 02:20:59 EST 2010 +/** + * CIMTypedElement is an abstract class that represents a CIM + * element that contains just the data type, but no value. + */ +public abstract class CIMTypedElement extends CIMElement { + + private static final long serialVersionUID = -8839964536590822815L; + + private CIMDataType iType; + + /** + * Constructs a CIMTypedElement with the given name and data + * type. + * + * @param pName + * Name of the element. + * @param pType + * Data type of the element. + */ + public CIMTypedElement(String pName, CIMDataType pType) { + super(pName); + this.iType = pType; + } + + /** + * Compares this object against the specified object. The result is + * true if and only if the argument is not null + * and is a CIMTypedElement that represents the same name and + * type as this object. + * + * @param pObj + * The object to compare with. + * @return true if the objects are the same; false + * otherwise. + */ + @Override + public boolean equals(Object pObj) { + if (!(pObj instanceof CIMTypedElement)) return false; + CIMTypedElement that = (CIMTypedElement) pObj; + if (!super.equals(that)) return false; + return this.iType.equals(that.iType); + } + + /** + * Returns the CIMDataType for this CIM Element. + * + * @return CIMDataType of this CIM element. + */ + public CIMDataType getDataType() { + return this.iType; + } + + /** + * Returns a hash code value for the CIM typed element. This method is + * supported for the benefit of hashtables such as those provided by + * java.util.Hashtable. + * + * @return A hash code value for this CIM typed element. + */ + @Override + public int hashCode() { + return toString().hashCode(); + } + + /** + * Returns a String representation of the CIM Element. This + * method is intended to be used only for debugging purposes, and the format + * of the returned string may vary between implementations. The returned + * string may be empty but may not be null. + * + * @return String representation of this element. + */ + @Override + public String toString() { + return MOF.typedElement(this, MOF.EMPTY); + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/javax/cim/CIMValuedElement.java b/src/main/java/org/metricshub/wbem/javax/cim/CIMValuedElement.java similarity index 83% rename from src/main/java/org/sentrysoftware/wbem/javax/cim/CIMValuedElement.java rename to src/main/java/org/metricshub/wbem/javax/cim/CIMValuedElement.java index ccc0f9d..9e4f5f6 100644 --- a/src/main/java/org/sentrysoftware/wbem/javax/cim/CIMValuedElement.java +++ b/src/main/java/org/metricshub/wbem/javax/cim/CIMValuedElement.java @@ -1,155 +1,153 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-10-06 ebak Make SBLIM client JSR48 compliant - * 1669961 2006-04-16 lupusalex CIMTypedElement.getType() =>getDataType() - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics - * 2935258 2010-01-22 blaschke-oss Sync up javax.cim.* javadoc with JSR48 1.0.0 - * 3400209 2011-08-31 blaschke-oss Highlighted Static Analysis (PMD) issues - * 3411879 2011-09-20 blaschke-oss TCK: CIM element value must match type - * 2716 2013-12-11 blaschke-oss Sync up javax.* javadoc with JSR48 1.0.0 Final V - */ - -package org.sentrysoftware.wbem.javax.cim; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.Arrays; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.util.MOF; - -//Sync'd against JSR48 1.0.0 javadoc (version 1.7.0_03) on Tue Dec 10 07:02:50 EST 2013 -/** - * CIMValuedElement is a base class used by any element that - * contains a name, type and value. - * - * @param - * Type parameter. - */ -public abstract class CIMValuedElement extends CIMTypedElement { - - private static final long serialVersionUID = 4234L; - - private E iValue; - - /** - * Creates a new CIM element with the given name, type and value. - * - * @param pName - * The string for the name for this element. - * @param pType - * The data type for this element. - * @param pValue - * The value for this element. null is a valid - * value. - * @throws IllegalArgumentException - * If the value does not match the data type. - */ - protected CIMValuedElement(String pName, CIMDataType pType, E pValue) { - super(pName, pType); - - if (pType != null && pValue != null) { - CIMDataType valueDataType; - try { - valueDataType = CIMDataType.getDataType(pValue); - } catch (IllegalArgumentException e) { - // Value has unknown data type, cannot validate - valueDataType = null; - } - if (valueDataType != null && valueDataType.getType() != pType.getType()) throw new IllegalArgumentException( - "CIM value does not match type: " + valueDataType.getType() + " != " - + pType.getType()); - } - - this.iValue = pValue; - } - - /** - * Compares this object against the specified object. The result is - * true if and only if the argument is not null - * and is a CIMValuedElement that represents the same name, - * type and value as this object. - * - * @param pObj - * The object to compare with. - * @return true if the objects are the same; false - * otherwise. - */ - @Override - public boolean equals(Object pObj) { - if (!(pObj instanceof CIMValuedElement)) return false; - CIMValuedElement that = (CIMValuedElement) pObj; - if (!super.equals(that)) return false; - if (getDataType().isArray()) { return Arrays.equals((Object[]) this.iValue, - (Object[]) that.iValue); } - return this.iValue == null ? that.iValue == null : this.iValue.equals(that.iValue); - } - - /** - * Returns the value for this CIM Element. - * - * @return The value of the CIM Element. null is a valid value. - */ - public E getValue() { - return this.iValue; - } - - /** - * Returns a hash code value for the CIM valued element. This method is - * supported for the benefit of hashtables such as those provided by - * java.util.Hashtable. - * - * @return A hash code value for this CIM valued element. - */ - @Override - public int hashCode() { - return toString().hashCode(); - } - - /** - * Returns a String representation of the CIM Element. This - * method is intended to be used only for debugging purposes, and the format - * of the returned string may vary between implementations. The returned - * string may be empty but may not be null. - * - * @return String representation of this element. - */ - @Override - public String toString() { - return MOF.valuedElement(this, MOF.EMPTY); - } - -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-10-06 ebak Make SBLIM client JSR48 compliant + * 1669961 2006-04-16 lupusalex CIMTypedElement.getType() =>getDataType() + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics + * 2935258 2010-01-22 blaschke-oss Sync up javax.cim.* javadoc with JSR48 1.0.0 + * 3400209 2011-08-31 blaschke-oss Highlighted Static Analysis (PMD) issues + * 3411879 2011-09-20 blaschke-oss TCK: CIM element value must match type + * 2716 2013-12-11 blaschke-oss Sync up javax.* javadoc with JSR48 1.0.0 Final V + */ + +package org.metricshub.wbem.javax.cim; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.Arrays; + +import org.metricshub.wbem.sblim.cimclient.internal.util.MOF; + +//Sync'd against JSR48 1.0.0 javadoc (version 1.7.0_03) on Tue Dec 10 07:02:50 EST 2013 +/** + * CIMValuedElement is a base class used by any element that + * contains a name, type and value. + * + * @param + * Type parameter. + */ +public abstract class CIMValuedElement extends CIMTypedElement { + + private static final long serialVersionUID = 4234L; + + private E iValue; + + /** + * Creates a new CIM element with the given name, type and value. + * + * @param pName + * The string for the name for this element. + * @param pType + * The data type for this element. + * @param pValue + * The value for this element. null is a valid + * value. + * @throws IllegalArgumentException + * If the value does not match the data type. + */ + protected CIMValuedElement(String pName, CIMDataType pType, E pValue) { + super(pName, pType); + + if (pType != null && pValue != null) { + CIMDataType valueDataType; + try { + valueDataType = CIMDataType.getDataType(pValue); + } catch (IllegalArgumentException e) { + // Value has unknown data type, cannot validate + valueDataType = null; + } + if (valueDataType != null && valueDataType.getType() != pType.getType()) throw new IllegalArgumentException( + "CIM value does not match type: " + valueDataType.getType() + " != " + + pType.getType()); + } + + this.iValue = pValue; + } + + /** + * Compares this object against the specified object. The result is + * true if and only if the argument is not null + * and is a CIMValuedElement that represents the same name, + * type and value as this object. + * + * @param pObj + * The object to compare with. + * @return true if the objects are the same; false + * otherwise. + */ + @Override + public boolean equals(Object pObj) { + if (!(pObj instanceof CIMValuedElement)) return false; + CIMValuedElement that = (CIMValuedElement) pObj; + if (!super.equals(that)) return false; + if (getDataType().isArray()) { return Arrays.equals((Object[]) this.iValue, + (Object[]) that.iValue); } + return this.iValue == null ? that.iValue == null : this.iValue.equals(that.iValue); + } + + /** + * Returns the value for this CIM Element. + * + * @return The value of the CIM Element. null is a valid value. + */ + public E getValue() { + return this.iValue; + } + + /** + * Returns a hash code value for the CIM valued element. This method is + * supported for the benefit of hashtables such as those provided by + * java.util.Hashtable. + * + * @return A hash code value for this CIM valued element. + */ + @Override + public int hashCode() { + return toString().hashCode(); + } + + /** + * Returns a String representation of the CIM Element. This + * method is intended to be used only for debugging purposes, and the format + * of the returned string may vary between implementations. The returned + * string may be empty but may not be null. + * + * @return String representation of this element. + */ + @Override + public String toString() { + return MOF.valuedElement(this, MOF.EMPTY); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/javax/cim/UnsignedInteger16.java b/src/main/java/org/metricshub/wbem/javax/cim/UnsignedInteger16.java similarity index 88% rename from src/main/java/org/sentrysoftware/wbem/javax/cim/UnsignedInteger16.java rename to src/main/java/org/metricshub/wbem/javax/cim/UnsignedInteger16.java index 96b0dbf..433742b 100644 --- a/src/main/java/org/sentrysoftware/wbem/javax/cim/UnsignedInteger16.java +++ b/src/main/java/org/metricshub/wbem/javax/cim/UnsignedInteger16.java @@ -1,247 +1,245 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-10-09 ebak Make SBLIM client JSR48 compliant - * 1737123 2007-06-15 ebak Differences to JSR48 public review draft - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2750520 2009-04-10 blaschke-oss Code cleanup from empty statement et al - * 2795671 2009-05-22 raman_arora Add Type to Comparable - * 2935258 2010-01-22 blaschke-oss Sync up javax.cim.* javadoc with JSR48 1.0.0 - * 2973233 2010-03-19 blaschke-oss TCK: UnsignedIntegerNN.hashCode() not working - * 2719 2013-12-10 blaschke-oss TCK: CIM APIs should not generate NullPointerException - * 2716 2013-12-11 blaschke-oss Sync up javax.* javadoc with JSR48 1.0.0 Final V - */ - -package org.sentrysoftware.wbem.javax.cim; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -//Sync'd against JSR48 1.0.0 javadoc (version 1.7.0_03) on Tue Dec 10 07:02:50 EST 2013 -/** - * This class represents an UnsignedInteger16. A - * uint16 data type is defined by the (DMTF) CIM Infrastructure Specification (DSP004). - */ -public class UnsignedInteger16 extends Number implements Comparable { - - private static final long serialVersionUID = -4992164525643467216L; - - /** - * The maximum value for an UnsignedInteger16. - */ - public static final int MAX_VALUE = 65535; - - /** - * The minimum value for an UnsignedInteger16. - */ - public static final int MIN_VALUE = 0; - - private int iValue; - - /** - * Sets the value of this integer object if it falls within the range of - * minimum and maximum values. - * - * @param pValue - * The integer. - * @throws NumberFormatException - * If the integer is out of range. - */ - private void setValue(int pValue) throws NumberFormatException { - if (pValue > MAX_VALUE || pValue < MIN_VALUE) { - String msg = "uint16:" + pValue + " is out of range!"; - throw new NumberFormatException(msg); - } - this.iValue = pValue; - } - - /** - * Constructs an unsigned 16-bit integer object for the specified int value. - * Only the lower 16 bits are considered. - * - * @param pValue - * The integer to be represented as an unsigned 16-bit integer. - * @throws NumberFormatException - * If the number is out of range. - */ - public UnsignedInteger16(int pValue) throws NumberFormatException { - setValue(pValue); - } - - /** - * Constructs an unsigned 16-bit integer object for the specified string. - * Only the lower 16 bits are considered. - * - * @param pValue - * The string to be represented as an unsigned 16-bit integer. - * @throws NumberFormatException - * If the number is out of range. - * @throws IllegalArgumentException - * If value is null. - */ - public UnsignedInteger16(String pValue) throws NumberFormatException { - if (pValue == null) throw new IllegalArgumentException("String value cannot be null!"); - setValue(Integer.parseInt(pValue)); - } - - /** - * Compares this object with the specified object for order. Returns a - * negative integer, zero, or a positive integer as this object is less - * than, equal to, or greater than the specified object. - * - * @param pOther - * The Object to be compared. - * @return A negative integer, zero, or a positive integer as this object is - * less than, equal to, or greater than the specified object. - * @throws ClassCastException - * If the specified object's type prevents it from being - * compared to this Object. - * @throws IllegalArgumentException - * If value is null. - */ - public int compareTo(UnsignedInteger16 pOther) { - if (pOther == null) throw new IllegalArgumentException( - "Other UnsignedInteger16 cannot be null!"); - UnsignedInteger16 that = pOther; - int d = this.iValue - that.iValue; - if (d == 0) return 0; - return d < 0 ? -1 : 1; - } - - /** - * Compares this object against the specified object. The result is - * true if and only if the argument is not null and is an - * UnsignedInteger16 object that represents the same value as - * this object. - * - * @param pObj - * The object to compare. - * @return true if the objects are the same; false - * otherwise. - */ - @Override - public boolean equals(Object pObj) { - if (!(pObj instanceof UnsignedInteger16)) return false; - return this.iValue == ((UnsignedInteger16) pObj).iValue; - } - - /** - * Returns the value of this unsigned integer object as a byte. - * - * @return The byte value of this unsigned integer object. - */ - @Override - public byte byteValue() { - return (byte) this.iValue; - } - - /** - * Returns the value of this unsigned integer object as a - * double. - * - * @return Value of this unsigned integer object as a double. - */ - @Override - public double doubleValue() { - return this.iValue; - } - - /** - * Returns the value of this unsigned integer object as a float - * . - * - * @return Value of this unsigned integer object as a float. - */ - @Override - public float floatValue() { - return this.iValue; - } - - /** - * Computes the hash code for this unsigned integer object. - * - * @return The integer representing the hash code for this unsigned integer - * object. - */ - @Override - public int hashCode() { - return Integer.valueOf(this.iValue).hashCode(); - } - - /** - * Returns the value of this unsigned integer object as an int. - * - * @return Value of this unsigned integer object as an int. - */ - @Override - public int intValue() { - return this.iValue; - } - - /** - * Returns the value of this unsigned integer object as a long. - * - * @return Value of this unsigned integer object as a long. - */ - @Override - public long longValue() { - return this.iValue; - } - - /** - * Returns the value of this unsigned integer object as a short - * . - * - * @return Value of this unsigned integer object as a short. - */ - @Override - public short shortValue() { - return (short) this.iValue; - } - - /** - * Returns the text representation of this unsigned integer object. - * - * @return Text representation of this unsigned integer. - */ - @Override - public String toString() { - return Integer.toString(this.iValue); - } - -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-10-09 ebak Make SBLIM client JSR48 compliant + * 1737123 2007-06-15 ebak Differences to JSR48 public review draft + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2750520 2009-04-10 blaschke-oss Code cleanup from empty statement et al + * 2795671 2009-05-22 raman_arora Add Type to Comparable + * 2935258 2010-01-22 blaschke-oss Sync up javax.cim.* javadoc with JSR48 1.0.0 + * 2973233 2010-03-19 blaschke-oss TCK: UnsignedIntegerNN.hashCode() not working + * 2719 2013-12-10 blaschke-oss TCK: CIM APIs should not generate NullPointerException + * 2716 2013-12-11 blaschke-oss Sync up javax.* javadoc with JSR48 1.0.0 Final V + */ + +package org.metricshub.wbem.javax.cim; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +//Sync'd against JSR48 1.0.0 javadoc (version 1.7.0_03) on Tue Dec 10 07:02:50 EST 2013 +/** + * This class represents an UnsignedInteger16. A + * uint16 data type is defined by the (DMTF) CIM Infrastructure Specification (DSP004). + */ +public class UnsignedInteger16 extends Number implements Comparable { + + private static final long serialVersionUID = -4992164525643467216L; + + /** + * The maximum value for an UnsignedInteger16. + */ + public static final int MAX_VALUE = 65535; + + /** + * The minimum value for an UnsignedInteger16. + */ + public static final int MIN_VALUE = 0; + + private int iValue; + + /** + * Sets the value of this integer object if it falls within the range of + * minimum and maximum values. + * + * @param pValue + * The integer. + * @throws NumberFormatException + * If the integer is out of range. + */ + private void setValue(int pValue) throws NumberFormatException { + if (pValue > MAX_VALUE || pValue < MIN_VALUE) { + String msg = "uint16:" + pValue + " is out of range!"; + throw new NumberFormatException(msg); + } + this.iValue = pValue; + } + + /** + * Constructs an unsigned 16-bit integer object for the specified int value. + * Only the lower 16 bits are considered. + * + * @param pValue + * The integer to be represented as an unsigned 16-bit integer. + * @throws NumberFormatException + * If the number is out of range. + */ + public UnsignedInteger16(int pValue) throws NumberFormatException { + setValue(pValue); + } + + /** + * Constructs an unsigned 16-bit integer object for the specified string. + * Only the lower 16 bits are considered. + * + * @param pValue + * The string to be represented as an unsigned 16-bit integer. + * @throws NumberFormatException + * If the number is out of range. + * @throws IllegalArgumentException + * If value is null. + */ + public UnsignedInteger16(String pValue) throws NumberFormatException { + if (pValue == null) throw new IllegalArgumentException("String value cannot be null!"); + setValue(Integer.parseInt(pValue)); + } + + /** + * Compares this object with the specified object for order. Returns a + * negative integer, zero, or a positive integer as this object is less + * than, equal to, or greater than the specified object. + * + * @param pOther + * The Object to be compared. + * @return A negative integer, zero, or a positive integer as this object is + * less than, equal to, or greater than the specified object. + * @throws ClassCastException + * If the specified object's type prevents it from being + * compared to this Object. + * @throws IllegalArgumentException + * If value is null. + */ + public int compareTo(UnsignedInteger16 pOther) { + if (pOther == null) throw new IllegalArgumentException( + "Other UnsignedInteger16 cannot be null!"); + UnsignedInteger16 that = pOther; + int d = this.iValue - that.iValue; + if (d == 0) return 0; + return d < 0 ? -1 : 1; + } + + /** + * Compares this object against the specified object. The result is + * true if and only if the argument is not null and is an + * UnsignedInteger16 object that represents the same value as + * this object. + * + * @param pObj + * The object to compare. + * @return true if the objects are the same; false + * otherwise. + */ + @Override + public boolean equals(Object pObj) { + if (!(pObj instanceof UnsignedInteger16)) return false; + return this.iValue == ((UnsignedInteger16) pObj).iValue; + } + + /** + * Returns the value of this unsigned integer object as a byte. + * + * @return The byte value of this unsigned integer object. + */ + @Override + public byte byteValue() { + return (byte) this.iValue; + } + + /** + * Returns the value of this unsigned integer object as a + * double. + * + * @return Value of this unsigned integer object as a double. + */ + @Override + public double doubleValue() { + return this.iValue; + } + + /** + * Returns the value of this unsigned integer object as a float + * . + * + * @return Value of this unsigned integer object as a float. + */ + @Override + public float floatValue() { + return this.iValue; + } + + /** + * Computes the hash code for this unsigned integer object. + * + * @return The integer representing the hash code for this unsigned integer + * object. + */ + @Override + public int hashCode() { + return Integer.valueOf(this.iValue).hashCode(); + } + + /** + * Returns the value of this unsigned integer object as an int. + * + * @return Value of this unsigned integer object as an int. + */ + @Override + public int intValue() { + return this.iValue; + } + + /** + * Returns the value of this unsigned integer object as a long. + * + * @return Value of this unsigned integer object as a long. + */ + @Override + public long longValue() { + return this.iValue; + } + + /** + * Returns the value of this unsigned integer object as a short + * . + * + * @return Value of this unsigned integer object as a short. + */ + @Override + public short shortValue() { + return (short) this.iValue; + } + + /** + * Returns the text representation of this unsigned integer object. + * + * @return Text representation of this unsigned integer. + */ + @Override + public String toString() { + return Integer.toString(this.iValue); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/javax/cim/UnsignedInteger32.java b/src/main/java/org/metricshub/wbem/javax/cim/UnsignedInteger32.java similarity index 88% rename from src/main/java/org/sentrysoftware/wbem/javax/cim/UnsignedInteger32.java rename to src/main/java/org/metricshub/wbem/javax/cim/UnsignedInteger32.java index c14fc95..7722dce 100644 --- a/src/main/java/org/sentrysoftware/wbem/javax/cim/UnsignedInteger32.java +++ b/src/main/java/org/metricshub/wbem/javax/cim/UnsignedInteger32.java @@ -1,246 +1,244 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-10-09 ebak Make SBLIM client JSR48 compliant - * 1737123 2007-06-15 ebak Differences to JSR48 public review draft - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2750520 2009-04-10 blaschke-oss Code cleanup from empty statement et al - * 2795671 2009-05-22 raman_arora Add Type to Comparable - * 2935258 2010-01-22 blaschke-oss Sync up javax.cim.* javadoc with JSR48 1.0.0 - * 2973233 2010-03-19 blaschke-oss TCK: UnsignedIntegerNN.hashCode() not working - * 2719 2013-12-10 blaschke-oss TCK: CIM APIs should not generate NullPointerException - * 2716 2013-12-11 blaschke-oss Sync up javax.* javadoc with JSR48 1.0.0 Final V - */ - -package org.sentrysoftware.wbem.javax.cim; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -//Sync'd against JSR48 1.0.0 javadoc (version 1.7.0_03) on Tue Dec 10 07:02:50 EST 2013 -/** - * This class represents an UnsignedInteger32. A - * uint32 data type is defined by the (DMTF) CIM Infrastructure Specification (DSP004). - */ -public class UnsignedInteger32 extends Number implements Comparable { - - private static final long serialVersionUID = -8861436527534071393L; - - /** - * The maximum value for an UnsignedInteger32. - */ - public static final long MAX_VALUE = 4294967295l; - - /** - * The minimum value for an UnsignedInteger32. - */ - public static final long MIN_VALUE = 0l; - - private long iValue; - - /** - * Sets the value of this integer object if it falls within the range of - * minimum and maximum values. - * - * @param pValue - * The integer. - * @throws NumberFormatException - * If the integer is out of range. - */ - private void setValue(long pValue) throws NumberFormatException { - if (pValue > MAX_VALUE || pValue < MIN_VALUE) { - String msg = "uint32:" + pValue + " is out of range!"; - throw new NumberFormatException(msg); - } - this.iValue = pValue; - } - - /** - * Constructs an unsigned 32-bit integer object for the specified long - * value. Only the lower 32 bits are considered. - * - * @param pValue - * The long to be represented as an unsigned 32-bit integer. - * @throws NumberFormatException - * If the number is out of range. - */ - public UnsignedInteger32(long pValue) throws NumberFormatException { - setValue(pValue); - } - - /** - * Constructs an unsigned 32-bit integer object for the specified string. - * Only the lower 32 bits are considered. - * - * @param pValue - * The string to be represented as an unsigned 32-bit integer. - * @throws NumberFormatException - * If the number is out of range. - * @throws IllegalArgumentException - * If value is null. - */ - public UnsignedInteger32(String pValue) throws NumberFormatException { - if (pValue == null) throw new IllegalArgumentException("String value cannot be null!"); - setValue(Long.parseLong(pValue)); - } - - /** - * Compares this object with the specified object for order. Returns a - * negative integer, zero, or a positive integer as this object is less - * than, equal to, or greater than the specified object. - * - * @param pOther - * The Object to be compared. - * @return A negative integer, zero, or a positive integer as this object is - * less than, equal to, or greater than the specified object. - * @throws ClassCastException - * If the specified object's type prevents it from being - * compared to this Object. - * @throws IllegalArgumentException - * If value is null. - */ - public int compareTo(UnsignedInteger32 pOther) { - if (pOther == null) throw new IllegalArgumentException( - "Other UnsignedInteger32 cannot be null!"); - UnsignedInteger32 that = pOther; - long d = this.iValue - that.iValue; - if (d == 0) return 0; - return d < 0 ? -1 : 1; - } - - /** - * Compares this object against the specified object. The result is - * true if and only if the argument is not null and is an - * UnsignedInteger32 object that represents the same value as this object. - * - * @param pObj - * The object to compare. - * @return true if the objects are the same; false - * otherwise. - */ - @Override - public boolean equals(Object pObj) { - if (!(pObj instanceof UnsignedInteger32)) return false; - return this.iValue == ((UnsignedInteger32) pObj).iValue; - } - - /** - * Returns the value of this unsigned integer object as a byte. - * - * @return The byte value of this unsigned integer object. - */ - @Override - public byte byteValue() { - return (byte) this.iValue; - } - - /** - * Returns the value of this unsigned integer object as a - * double. - * - * @return Value of this unsigned integer object as a double. - */ - @Override - public double doubleValue() { - return this.iValue; - } - - /** - * Returns the value of this unsigned integer object as a float - * . - * - * @return Value of this unsigned integer object as a float. - */ - @Override - public float floatValue() { - return this.iValue; - } - - /** - * Computes the hash code for this unsigned integer object. - * - * @return The integer representing the hash code for this unsigned integer - * object. - */ - @Override - public int hashCode() { - return Long.valueOf(this.iValue).hashCode(); - } - - /** - * Returns the value of this unsigned integer object as an int. - * - * @return Value of this unsigned integer object as an int. - */ - @Override - public int intValue() { - return (int) this.iValue; - } - - /** - * Returns the value of this unsigned integer object as a long. - * - * @return Value of this unsigned integer object as a long. - */ - @Override - public long longValue() { - return this.iValue; - } - - /** - * Returns the value of this unsigned integer object as a short - * . - * - * @return Value of this unsigned integer object as a short. - */ - @Override - public short shortValue() { - return (short) this.iValue; - } - - /** - * Returns the text representation of this unsigned integer object. - * - * @return Text representation of this unsigned integer. - */ - @Override - public String toString() { - return Long.toString(this.iValue); - } - -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-10-09 ebak Make SBLIM client JSR48 compliant + * 1737123 2007-06-15 ebak Differences to JSR48 public review draft + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2750520 2009-04-10 blaschke-oss Code cleanup from empty statement et al + * 2795671 2009-05-22 raman_arora Add Type to Comparable + * 2935258 2010-01-22 blaschke-oss Sync up javax.cim.* javadoc with JSR48 1.0.0 + * 2973233 2010-03-19 blaschke-oss TCK: UnsignedIntegerNN.hashCode() not working + * 2719 2013-12-10 blaschke-oss TCK: CIM APIs should not generate NullPointerException + * 2716 2013-12-11 blaschke-oss Sync up javax.* javadoc with JSR48 1.0.0 Final V + */ + +package org.metricshub.wbem.javax.cim; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +//Sync'd against JSR48 1.0.0 javadoc (version 1.7.0_03) on Tue Dec 10 07:02:50 EST 2013 +/** + * This class represents an UnsignedInteger32. A + * uint32 data type is defined by the (DMTF) CIM Infrastructure Specification (DSP004). + */ +public class UnsignedInteger32 extends Number implements Comparable { + + private static final long serialVersionUID = -8861436527534071393L; + + /** + * The maximum value for an UnsignedInteger32. + */ + public static final long MAX_VALUE = 4294967295l; + + /** + * The minimum value for an UnsignedInteger32. + */ + public static final long MIN_VALUE = 0l; + + private long iValue; + + /** + * Sets the value of this integer object if it falls within the range of + * minimum and maximum values. + * + * @param pValue + * The integer. + * @throws NumberFormatException + * If the integer is out of range. + */ + private void setValue(long pValue) throws NumberFormatException { + if (pValue > MAX_VALUE || pValue < MIN_VALUE) { + String msg = "uint32:" + pValue + " is out of range!"; + throw new NumberFormatException(msg); + } + this.iValue = pValue; + } + + /** + * Constructs an unsigned 32-bit integer object for the specified long + * value. Only the lower 32 bits are considered. + * + * @param pValue + * The long to be represented as an unsigned 32-bit integer. + * @throws NumberFormatException + * If the number is out of range. + */ + public UnsignedInteger32(long pValue) throws NumberFormatException { + setValue(pValue); + } + + /** + * Constructs an unsigned 32-bit integer object for the specified string. + * Only the lower 32 bits are considered. + * + * @param pValue + * The string to be represented as an unsigned 32-bit integer. + * @throws NumberFormatException + * If the number is out of range. + * @throws IllegalArgumentException + * If value is null. + */ + public UnsignedInteger32(String pValue) throws NumberFormatException { + if (pValue == null) throw new IllegalArgumentException("String value cannot be null!"); + setValue(Long.parseLong(pValue)); + } + + /** + * Compares this object with the specified object for order. Returns a + * negative integer, zero, or a positive integer as this object is less + * than, equal to, or greater than the specified object. + * + * @param pOther + * The Object to be compared. + * @return A negative integer, zero, or a positive integer as this object is + * less than, equal to, or greater than the specified object. + * @throws ClassCastException + * If the specified object's type prevents it from being + * compared to this Object. + * @throws IllegalArgumentException + * If value is null. + */ + public int compareTo(UnsignedInteger32 pOther) { + if (pOther == null) throw new IllegalArgumentException( + "Other UnsignedInteger32 cannot be null!"); + UnsignedInteger32 that = pOther; + long d = this.iValue - that.iValue; + if (d == 0) return 0; + return d < 0 ? -1 : 1; + } + + /** + * Compares this object against the specified object. The result is + * true if and only if the argument is not null and is an + * UnsignedInteger32 object that represents the same value as this object. + * + * @param pObj + * The object to compare. + * @return true if the objects are the same; false + * otherwise. + */ + @Override + public boolean equals(Object pObj) { + if (!(pObj instanceof UnsignedInteger32)) return false; + return this.iValue == ((UnsignedInteger32) pObj).iValue; + } + + /** + * Returns the value of this unsigned integer object as a byte. + * + * @return The byte value of this unsigned integer object. + */ + @Override + public byte byteValue() { + return (byte) this.iValue; + } + + /** + * Returns the value of this unsigned integer object as a + * double. + * + * @return Value of this unsigned integer object as a double. + */ + @Override + public double doubleValue() { + return this.iValue; + } + + /** + * Returns the value of this unsigned integer object as a float + * . + * + * @return Value of this unsigned integer object as a float. + */ + @Override + public float floatValue() { + return this.iValue; + } + + /** + * Computes the hash code for this unsigned integer object. + * + * @return The integer representing the hash code for this unsigned integer + * object. + */ + @Override + public int hashCode() { + return Long.valueOf(this.iValue).hashCode(); + } + + /** + * Returns the value of this unsigned integer object as an int. + * + * @return Value of this unsigned integer object as an int. + */ + @Override + public int intValue() { + return (int) this.iValue; + } + + /** + * Returns the value of this unsigned integer object as a long. + * + * @return Value of this unsigned integer object as a long. + */ + @Override + public long longValue() { + return this.iValue; + } + + /** + * Returns the value of this unsigned integer object as a short + * . + * + * @return Value of this unsigned integer object as a short. + */ + @Override + public short shortValue() { + return (short) this.iValue; + } + + /** + * Returns the text representation of this unsigned integer object. + * + * @return Text representation of this unsigned integer. + */ + @Override + public String toString() { + return Long.toString(this.iValue); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/javax/cim/UnsignedInteger64.java b/src/main/java/org/metricshub/wbem/javax/cim/UnsignedInteger64.java similarity index 89% rename from src/main/java/org/sentrysoftware/wbem/javax/cim/UnsignedInteger64.java rename to src/main/java/org/metricshub/wbem/javax/cim/UnsignedInteger64.java index f07f7c1..ced03b6 100644 --- a/src/main/java/org/sentrysoftware/wbem/javax/cim/UnsignedInteger64.java +++ b/src/main/java/org/metricshub/wbem/javax/cim/UnsignedInteger64.java @@ -1,278 +1,276 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-10-09 ebak Make SBLIM client JSR48 compliant - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2750520 2009-04-10 blaschke-oss Code cleanup from empty statement et al - * 2795671 2009-05-22 raman_arora Add Type to Comparable - * 2935258 2010-01-19 blaschke-oss Sync up javax.cim.* javadoc with JSR48 1.0.0 - * 2973230 2010-03-19 blaschke-oss TCK: UnsignedInteger64.equals() does not handle null - * 2719 2013-12-10 blaschke-oss TCK: CIM APIs should not generate NullPointerException - * 2716 2013-12-11 blaschke-oss Sync up javax.* javadoc with JSR48 1.0.0 Final V - */ - -package org.sentrysoftware.wbem.javax.cim; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.math.BigInteger; - -//Sync'd against JSR48 1.0.0 javadoc (version 1.7.0_03) on Tue Dec 10 07:02:50 EST 2013 -/** - * This class represents an UnsignedInteger64. A - * uint64 data type is defined by the (DMTF) CIM Infrastructure Specification (DSP004). - */ -public class UnsignedInteger64 extends Number implements Comparable { - - private static final long serialVersionUID = -3734165689168941119L; - - /** - * The maximum value for an UnsignedInteger64. - */ - public static final BigInteger MAX_VALUE = new BigInteger("18446744073709551615"); - - /** - * The minimum value for an UnsignedInteger64. - */ - public static final BigInteger MIN_VALUE = BigInteger.ZERO; - - private BigInteger iValue; - - /** - * Sets the value of this integer object if it falls within the range of - * minimum and maximum values. - * - * @param pValue - * The integer. - * @throws NumberFormatException - * If the integer is out of range. - */ - private void setValue(BigInteger pValue) throws NumberFormatException { - if (pValue.compareTo(MAX_VALUE) > 0 || pValue.compareTo(MIN_VALUE) < 0) { - String msg = "uint64:" + pValue + " is out of range!"; - throw new NumberFormatException(msg); - } - this.iValue = pValue; - } - - /** - * Constructs an unsigned 64-bit integer object for the specified - * BigInteger. Only the lower 64 bits are considered. - * - * @param pValue - * The BigInteger to be represented as an unsigned - * 64-bit integer. - * @throws NumberFormatException - * If the number is out of range. - * @throws IllegalArgumentException - * If value is null. - */ - public UnsignedInteger64(BigInteger pValue) throws NumberFormatException { - if (pValue == null) throw new IllegalArgumentException("BigInteger value cannot be null!"); - setValue(pValue); - } - - /** - * Constructs an unsigned 64-bit integer object for the specified array of - * bytes. Only the lower 64 bits are considered. - * - * @param pValue - * The byte array to be represented as an unsigned 64-bit - * integer. - * @throws NumberFormatException - * If the number is out of range. - * @throws IllegalArgumentException - * If value is null. - */ - public UnsignedInteger64(byte[] pValue) throws NumberFormatException { - if (pValue == null) throw new IllegalArgumentException("byte[] value cannot be null!"); - setValue(new BigInteger(pValue)); - } - - /** - * Constructs an unsigned 64-bit integer object from the specified string. - * Only the lower 64 bits are considered. - * - * @param pValue - * The string to be represented as an unsigned 64-bit integer. - * @throws NumberFormatException - * If the number is out of range. - * @throws IllegalArgumentException - * If value is null. - */ - public UnsignedInteger64(String pValue) throws NumberFormatException { - if (pValue == null) throw new IllegalArgumentException("String value cannot be null!"); - setValue(new BigInteger(pValue)); - } - - /** - * Get the value as a BigInteger. - * - * @return BigInteger representation of this object. - */ - public BigInteger bigIntegerValue() { - return this.iValue; - } - - /** - * Compares this object with the specified object for order. Returns a - * negative integer, zero, or a positive integer as this object is less - * than, equal to, or greater than the specified object. - * - * @param pOther - * The Object to be compared. - * @return A negative integer, zero, or a positive integer as this object is - * less than, equal to, or greater than the specified object. - * @throws ClassCastException - * If the specified object's type prevents it from being - * compared to this Object. - * @throws IllegalArgumentException - * If value is null. - */ - public int compareTo(UnsignedInteger64 pOther) { - if (pOther == null) throw new IllegalArgumentException( - "Other UnsignedInteger64 cannot be null!"); - UnsignedInteger64 that = pOther; - int d = this.iValue.compareTo(that.iValue); - if (d == 0) return 0; - return d < 0 ? -1 : 1; - } - - /** - * Compares this object against the specified object. The result is - * true if and only if the argument is not null - * and is an UnsignedInteger64 object that represents the same - * value as this object. - * - * @param pOther - * The object to compare. - * @return true if the objects are the same; false - * otherwise. - */ - @Override - public boolean equals(Object pOther) { - if (!(pOther instanceof UnsignedInteger64)) return false; - return this.iValue.equals(((UnsignedInteger64) pOther).iValue); - } - - /** - * Returns the value of this unsigned integer object as a byte. - * - * @return The byte value of this unsigned integer object. - */ - @Override - public byte byteValue() { - return this.iValue.byteValue(); - } - - /** - * Returns the value of this unsigned integer object as a - * double. - * - * @return Value of this unsigned integer object as a double. - */ - @Override - public double doubleValue() { - return this.iValue.doubleValue(); - } - - /** - * Returns the value of this unsigned integer object as a float - * . - * - * @return Value of this unsigned integer object as a float. - */ - @Override - public float floatValue() { - return this.iValue.floatValue(); - } - - /** - * Computes the hash code for this unsigned integer object. - * - * @return The integer representing the hash code for this unsigned integer - * object. - */ - @Override - public int hashCode() { - return this.iValue.hashCode(); - } - - /** - * Returns the value of this unsigned integer object as an int. - * - * @return Value of this unsigned integer object as an int. - */ - @Override - public int intValue() { - return this.iValue.intValue(); - } - - /** - * Returns the value of this unsigned integer object as a long. - * - * @return Value of this unsigned integer object as a long. - */ - @Override - public long longValue() { - return this.iValue.longValue(); - } - - /** - * Returns the value of this unsigned integer object as a short - * . - * - * @return Value of this unsigned integer object as a short. - */ - @Override - public short shortValue() { - return this.iValue.shortValue(); - } - - /** - * Returns the text representation of this unsigned integer object. - * - * @return Text representation of this unsigned integer. - */ - @Override - public String toString() { - return this.iValue.toString(); - } - -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-10-09 ebak Make SBLIM client JSR48 compliant + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2750520 2009-04-10 blaschke-oss Code cleanup from empty statement et al + * 2795671 2009-05-22 raman_arora Add Type to Comparable + * 2935258 2010-01-19 blaschke-oss Sync up javax.cim.* javadoc with JSR48 1.0.0 + * 2973230 2010-03-19 blaschke-oss TCK: UnsignedInteger64.equals() does not handle null + * 2719 2013-12-10 blaschke-oss TCK: CIM APIs should not generate NullPointerException + * 2716 2013-12-11 blaschke-oss Sync up javax.* javadoc with JSR48 1.0.0 Final V + */ + +package org.metricshub.wbem.javax.cim; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.math.BigInteger; + +//Sync'd against JSR48 1.0.0 javadoc (version 1.7.0_03) on Tue Dec 10 07:02:50 EST 2013 +/** + * This class represents an UnsignedInteger64. A + * uint64 data type is defined by the (DMTF) CIM Infrastructure Specification (DSP004). + */ +public class UnsignedInteger64 extends Number implements Comparable { + + private static final long serialVersionUID = -3734165689168941119L; + + /** + * The maximum value for an UnsignedInteger64. + */ + public static final BigInteger MAX_VALUE = new BigInteger("18446744073709551615"); + + /** + * The minimum value for an UnsignedInteger64. + */ + public static final BigInteger MIN_VALUE = BigInteger.ZERO; + + private BigInteger iValue; + + /** + * Sets the value of this integer object if it falls within the range of + * minimum and maximum values. + * + * @param pValue + * The integer. + * @throws NumberFormatException + * If the integer is out of range. + */ + private void setValue(BigInteger pValue) throws NumberFormatException { + if (pValue.compareTo(MAX_VALUE) > 0 || pValue.compareTo(MIN_VALUE) < 0) { + String msg = "uint64:" + pValue + " is out of range!"; + throw new NumberFormatException(msg); + } + this.iValue = pValue; + } + + /** + * Constructs an unsigned 64-bit integer object for the specified + * BigInteger. Only the lower 64 bits are considered. + * + * @param pValue + * The BigInteger to be represented as an unsigned + * 64-bit integer. + * @throws NumberFormatException + * If the number is out of range. + * @throws IllegalArgumentException + * If value is null. + */ + public UnsignedInteger64(BigInteger pValue) throws NumberFormatException { + if (pValue == null) throw new IllegalArgumentException("BigInteger value cannot be null!"); + setValue(pValue); + } + + /** + * Constructs an unsigned 64-bit integer object for the specified array of + * bytes. Only the lower 64 bits are considered. + * + * @param pValue + * The byte array to be represented as an unsigned 64-bit + * integer. + * @throws NumberFormatException + * If the number is out of range. + * @throws IllegalArgumentException + * If value is null. + */ + public UnsignedInteger64(byte[] pValue) throws NumberFormatException { + if (pValue == null) throw new IllegalArgumentException("byte[] value cannot be null!"); + setValue(new BigInteger(pValue)); + } + + /** + * Constructs an unsigned 64-bit integer object from the specified string. + * Only the lower 64 bits are considered. + * + * @param pValue + * The string to be represented as an unsigned 64-bit integer. + * @throws NumberFormatException + * If the number is out of range. + * @throws IllegalArgumentException + * If value is null. + */ + public UnsignedInteger64(String pValue) throws NumberFormatException { + if (pValue == null) throw new IllegalArgumentException("String value cannot be null!"); + setValue(new BigInteger(pValue)); + } + + /** + * Get the value as a BigInteger. + * + * @return BigInteger representation of this object. + */ + public BigInteger bigIntegerValue() { + return this.iValue; + } + + /** + * Compares this object with the specified object for order. Returns a + * negative integer, zero, or a positive integer as this object is less + * than, equal to, or greater than the specified object. + * + * @param pOther + * The Object to be compared. + * @return A negative integer, zero, or a positive integer as this object is + * less than, equal to, or greater than the specified object. + * @throws ClassCastException + * If the specified object's type prevents it from being + * compared to this Object. + * @throws IllegalArgumentException + * If value is null. + */ + public int compareTo(UnsignedInteger64 pOther) { + if (pOther == null) throw new IllegalArgumentException( + "Other UnsignedInteger64 cannot be null!"); + UnsignedInteger64 that = pOther; + int d = this.iValue.compareTo(that.iValue); + if (d == 0) return 0; + return d < 0 ? -1 : 1; + } + + /** + * Compares this object against the specified object. The result is + * true if and only if the argument is not null + * and is an UnsignedInteger64 object that represents the same + * value as this object. + * + * @param pOther + * The object to compare. + * @return true if the objects are the same; false + * otherwise. + */ + @Override + public boolean equals(Object pOther) { + if (!(pOther instanceof UnsignedInteger64)) return false; + return this.iValue.equals(((UnsignedInteger64) pOther).iValue); + } + + /** + * Returns the value of this unsigned integer object as a byte. + * + * @return The byte value of this unsigned integer object. + */ + @Override + public byte byteValue() { + return this.iValue.byteValue(); + } + + /** + * Returns the value of this unsigned integer object as a + * double. + * + * @return Value of this unsigned integer object as a double. + */ + @Override + public double doubleValue() { + return this.iValue.doubleValue(); + } + + /** + * Returns the value of this unsigned integer object as a float + * . + * + * @return Value of this unsigned integer object as a float. + */ + @Override + public float floatValue() { + return this.iValue.floatValue(); + } + + /** + * Computes the hash code for this unsigned integer object. + * + * @return The integer representing the hash code for this unsigned integer + * object. + */ + @Override + public int hashCode() { + return this.iValue.hashCode(); + } + + /** + * Returns the value of this unsigned integer object as an int. + * + * @return Value of this unsigned integer object as an int. + */ + @Override + public int intValue() { + return this.iValue.intValue(); + } + + /** + * Returns the value of this unsigned integer object as a long. + * + * @return Value of this unsigned integer object as a long. + */ + @Override + public long longValue() { + return this.iValue.longValue(); + } + + /** + * Returns the value of this unsigned integer object as a short + * . + * + * @return Value of this unsigned integer object as a short. + */ + @Override + public short shortValue() { + return this.iValue.shortValue(); + } + + /** + * Returns the text representation of this unsigned integer object. + * + * @return Text representation of this unsigned integer. + */ + @Override + public String toString() { + return this.iValue.toString(); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/javax/cim/UnsignedInteger8.java b/src/main/java/org/metricshub/wbem/javax/cim/UnsignedInteger8.java similarity index 88% rename from src/main/java/org/sentrysoftware/wbem/javax/cim/UnsignedInteger8.java rename to src/main/java/org/metricshub/wbem/javax/cim/UnsignedInteger8.java index 3382f78..9b97880 100644 --- a/src/main/java/org/sentrysoftware/wbem/javax/cim/UnsignedInteger8.java +++ b/src/main/java/org/metricshub/wbem/javax/cim/UnsignedInteger8.java @@ -1,249 +1,247 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-10-09 ebak Make SBLIM client JSR48 compliant - * 1737123 2007-06-15 ebak Differences to JSR48 public review draft - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2750520 2009-04-10 blaschke-oss Code cleanup from empty statement et al - * 2795671 2009-05-22 raman_arora Add Type to Comparable - * 2935258 2010-01-22 blaschke-oss Sync up javax.cim.* javadoc with JSR48 1.0.0 - * 2944833 2010-02-08 blaschke-oss Need private setValue in UnsignedInteger8 - * 2973233 2010-03-19 blaschke-oss TCK: UnsignedIntegerNN.hashCode() not working - * 2719 2013-12-10 blaschke-oss TCK: CIM APIs should not generate NullPointerException - * 2716 2013-12-11 blaschke-oss Sync up javax.* javadoc with JSR48 1.0.0 Final V - */ - -package org.sentrysoftware.wbem.javax.cim; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -//Sync'd against JSR48 1.0.0 javadoc (version 1.7.0_03) on Tue Dec 10 07:02:50 EST 2013 -/** - * This class represents an UnsignedInteger8. A uint8 - * data type is defined by the (DMTF) CIM - * Infrastructure Specification (DSP004). - */ -public class UnsignedInteger8 extends Number implements Comparable { - - private static final long serialVersionUID = 4392496278679167896L; - - /** - * The maximum possible value for an UnsignedInteger8. - */ - public static final short MAX_VALUE = 255; - - /** - * The minimum possible value for an UnsignedInteger8. - */ - public static final short MIN_VALUE = 0; - - private short iValue; - - /** - * Sets the value of this integer object if it falls within the range of - * minimum and maximum values. - * - * @param pValue - * The integer. - * @throws NumberFormatException - * If the integer is out of range. - */ - private void setValue(short pValue) throws NumberFormatException { - if (pValue > MAX_VALUE || pValue < MIN_VALUE) { - String msg = "uint8:" + pValue + " is out of range!"; - throw new NumberFormatException(msg); - } - this.iValue = pValue; - } - - /** - * Constructs an unsigned 8-bit integer object for the specified short - * value. Only the lower 8 bits are considered. - * - * @param pValue - * The short to be represented as an unsigned 8-bit integer - * object. - * @throws NumberFormatException - * If the number is out of range. - */ - public UnsignedInteger8(short pValue) throws NumberFormatException { - setValue(pValue); - } - - /** - * Constructs an unsigned 8-bit integer object for the specified string. - * Only the lower 8 bits are considered. - * - * @param pValue - * The string to be represented as an unsigned 8-bit integer. - * @throws NumberFormatException - * If the number is out of range. - * @throws IllegalArgumentException - * If value is null. - */ - public UnsignedInteger8(String pValue) throws NumberFormatException { - if (pValue == null) throw new IllegalArgumentException("String value cannot be null!"); - setValue(Short.parseShort(pValue)); - } - - /** - * Compares this object with the specified object for order. Returns a - * negative integer, zero, or a positive integer as this object is less - * than, equal to, or greater than the specified object. - * - * @param pOther - * The Object to be compared. - * @return A negative integer, zero, or a positive integer as this object is - * less than, equal to, or greater than the specified object. - * @throws ClassCastException - * If the specified object's type prevents it from being - * compared to this Object. - * @throws IllegalArgumentException - * If value is null. - */ - public int compareTo(UnsignedInteger8 pOther) { - if (pOther == null) throw new IllegalArgumentException( - "Other UnsignedInteger8 cannot be null!"); - UnsignedInteger8 that = pOther; - int d = this.iValue - that.iValue; - if (d == 0) return 0; - return d < 0 ? -1 : 1; - } - - /** - * Compares this object against the specified object. The result is true if - * and only if the argument is not null and is an - * UnsignedInteger8 object that represents the same value as - * this object. - * - * @param pObj - * The object to compare. - * @return true if the objects are the same; false - * otherwise. - */ - @Override - public boolean equals(Object pObj) { - if (!(pObj instanceof UnsignedInteger8)) return false; - return this.iValue == ((UnsignedInteger8) pObj).iValue; - } - - /** - * Returns the value of this unsigned integer object as a byte. - * - * @return The byte value of this unsigned integer object. - */ - @Override - public byte byteValue() { - return (byte) this.iValue; - } - - /** - * Returns the value of this unsigned integer object as a - * double. - * - * @return Value of this unsigned integer object as a double. - */ - @Override - public double doubleValue() { - return this.iValue; - } - - /** - * Returns the value of this unsigned integer object as a float - * . - * - * @return Value of this unsigned integer object as a float. - */ - @Override - public float floatValue() { - return this.iValue; - } - - /** - * Computes the hash code for this unsigned integer object. - * - * @return The integer representing the hash code for this unsigned integer - * object. - */ - @Override - public int hashCode() { - return Short.valueOf(this.iValue).hashCode(); - } - - /** - * Returns the value of this unsigned integer object as an int. - * - * @return Value of this unsigned integer object as an int. - */ - @Override - public int intValue() { - return this.iValue; - } - - /** - * Returns the value of this unsigned integer object as a long. - * - * @return Value of this unsigned integer object as a long. - */ - @Override - public long longValue() { - return this.iValue; - } - - /** - * Returns the value of this unsigned integer object as a short - * . - * - * @return Value of this unsigned integer object as a short. - */ - @Override - public short shortValue() { - return this.iValue; - } - - /** - * Returns the text representation of this unsigned integer object. - * - * @return Text representation of this unsigned integer. - */ - @Override - public String toString() { - return Short.toString(this.iValue); - } - -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-10-09 ebak Make SBLIM client JSR48 compliant + * 1737123 2007-06-15 ebak Differences to JSR48 public review draft + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2750520 2009-04-10 blaschke-oss Code cleanup from empty statement et al + * 2795671 2009-05-22 raman_arora Add Type to Comparable + * 2935258 2010-01-22 blaschke-oss Sync up javax.cim.* javadoc with JSR48 1.0.0 + * 2944833 2010-02-08 blaschke-oss Need private setValue in UnsignedInteger8 + * 2973233 2010-03-19 blaschke-oss TCK: UnsignedIntegerNN.hashCode() not working + * 2719 2013-12-10 blaschke-oss TCK: CIM APIs should not generate NullPointerException + * 2716 2013-12-11 blaschke-oss Sync up javax.* javadoc with JSR48 1.0.0 Final V + */ + +package org.metricshub.wbem.javax.cim; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +//Sync'd against JSR48 1.0.0 javadoc (version 1.7.0_03) on Tue Dec 10 07:02:50 EST 2013 +/** + * This class represents an UnsignedInteger8. A uint8 + * data type is defined by the (DMTF) CIM + * Infrastructure Specification (DSP004). + */ +public class UnsignedInteger8 extends Number implements Comparable { + + private static final long serialVersionUID = 4392496278679167896L; + + /** + * The maximum possible value for an UnsignedInteger8. + */ + public static final short MAX_VALUE = 255; + + /** + * The minimum possible value for an UnsignedInteger8. + */ + public static final short MIN_VALUE = 0; + + private short iValue; + + /** + * Sets the value of this integer object if it falls within the range of + * minimum and maximum values. + * + * @param pValue + * The integer. + * @throws NumberFormatException + * If the integer is out of range. + */ + private void setValue(short pValue) throws NumberFormatException { + if (pValue > MAX_VALUE || pValue < MIN_VALUE) { + String msg = "uint8:" + pValue + " is out of range!"; + throw new NumberFormatException(msg); + } + this.iValue = pValue; + } + + /** + * Constructs an unsigned 8-bit integer object for the specified short + * value. Only the lower 8 bits are considered. + * + * @param pValue + * The short to be represented as an unsigned 8-bit integer + * object. + * @throws NumberFormatException + * If the number is out of range. + */ + public UnsignedInteger8(short pValue) throws NumberFormatException { + setValue(pValue); + } + + /** + * Constructs an unsigned 8-bit integer object for the specified string. + * Only the lower 8 bits are considered. + * + * @param pValue + * The string to be represented as an unsigned 8-bit integer. + * @throws NumberFormatException + * If the number is out of range. + * @throws IllegalArgumentException + * If value is null. + */ + public UnsignedInteger8(String pValue) throws NumberFormatException { + if (pValue == null) throw new IllegalArgumentException("String value cannot be null!"); + setValue(Short.parseShort(pValue)); + } + + /** + * Compares this object with the specified object for order. Returns a + * negative integer, zero, or a positive integer as this object is less + * than, equal to, or greater than the specified object. + * + * @param pOther + * The Object to be compared. + * @return A negative integer, zero, or a positive integer as this object is + * less than, equal to, or greater than the specified object. + * @throws ClassCastException + * If the specified object's type prevents it from being + * compared to this Object. + * @throws IllegalArgumentException + * If value is null. + */ + public int compareTo(UnsignedInteger8 pOther) { + if (pOther == null) throw new IllegalArgumentException( + "Other UnsignedInteger8 cannot be null!"); + UnsignedInteger8 that = pOther; + int d = this.iValue - that.iValue; + if (d == 0) return 0; + return d < 0 ? -1 : 1; + } + + /** + * Compares this object against the specified object. The result is true if + * and only if the argument is not null and is an + * UnsignedInteger8 object that represents the same value as + * this object. + * + * @param pObj + * The object to compare. + * @return true if the objects are the same; false + * otherwise. + */ + @Override + public boolean equals(Object pObj) { + if (!(pObj instanceof UnsignedInteger8)) return false; + return this.iValue == ((UnsignedInteger8) pObj).iValue; + } + + /** + * Returns the value of this unsigned integer object as a byte. + * + * @return The byte value of this unsigned integer object. + */ + @Override + public byte byteValue() { + return (byte) this.iValue; + } + + /** + * Returns the value of this unsigned integer object as a + * double. + * + * @return Value of this unsigned integer object as a double. + */ + @Override + public double doubleValue() { + return this.iValue; + } + + /** + * Returns the value of this unsigned integer object as a float + * . + * + * @return Value of this unsigned integer object as a float. + */ + @Override + public float floatValue() { + return this.iValue; + } + + /** + * Computes the hash code for this unsigned integer object. + * + * @return The integer representing the hash code for this unsigned integer + * object. + */ + @Override + public int hashCode() { + return Short.valueOf(this.iValue).hashCode(); + } + + /** + * Returns the value of this unsigned integer object as an int. + * + * @return Value of this unsigned integer object as an int. + */ + @Override + public int intValue() { + return this.iValue; + } + + /** + * Returns the value of this unsigned integer object as a long. + * + * @return Value of this unsigned integer object as a long. + */ + @Override + public long longValue() { + return this.iValue; + } + + /** + * Returns the value of this unsigned integer object as a short + * . + * + * @return Value of this unsigned integer object as a short. + */ + @Override + public short shortValue() { + return this.iValue; + } + + /** + * Returns the text representation of this unsigned integer object. + * + * @return Text representation of this unsigned integer. + */ + @Override + public String toString() { + return Short.toString(this.iValue); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/javax/cim/package.html b/src/main/java/org/metricshub/wbem/javax/cim/package.html similarity index 100% rename from src/main/java/org/sentrysoftware/wbem/javax/cim/package.html rename to src/main/java/org/metricshub/wbem/javax/cim/package.html diff --git a/src/main/java/org/sentrysoftware/wbem/javax/wbem/CloseableIterator.java b/src/main/java/org/metricshub/wbem/javax/wbem/CloseableIterator.java similarity index 76% rename from src/main/java/org/sentrysoftware/wbem/javax/wbem/CloseableIterator.java rename to src/main/java/org/metricshub/wbem/javax/wbem/CloseableIterator.java index f1c3225..e77a71b 100644 --- a/src/main/java/org/sentrysoftware/wbem/javax/wbem/CloseableIterator.java +++ b/src/main/java/org/metricshub/wbem/javax/wbem/CloseableIterator.java @@ -1,82 +1,80 @@ -/* - (C) Copyright IBM Corp. 2006, 2010 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Alexander Wolf-Reber, a.wolf-reber@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-11-08 lupusalex Make SBLIM client JSR48 compliant - * 1737141 2007-06-18 ebak Sync up with JSR48 evolution - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics - * 2912104 2009-12-10 blaschke-oss Sync up javax.wbem.* with JSR48 1.0.0 - * 2958941 2010-02-25 blaschke-oss Sync up javax.wbem.* javadoc with JSR48 1.0.0 - */ -package org.sentrysoftware.wbem.javax.wbem; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.Iterator; - -//Sync'd against JSR48 1.0.0 javadoc (build 1.5.0_10) on Wed Jan 20 02:20:59 EST 2010 -/** - * A CloseableIterator is a subclass of Iterator that - * adds support for allowing the underlying implementation to serve up the - * elements as they become available. The methods hasNext() and - * next() may block while waiting for elements from the underlying - * implementation. Since next() or hasNext() can only - * throw runtime exceptions, if a consumer receives a runtime exception for one - * of these methods they must call getWBEMException() to get the - * actual WBEMException. - * - * @param - * Type parameter. - */ -public interface CloseableIterator extends Iterator { - - /** - * Closes the Iterator. This allows the underlying - * implementation to do any cleanup and disconnect from any source that it - * may be using. - */ - public void close(); - - /** - * If next() or hasNext() throws a - * RuntimeException, this method must be called to get the - * WBEMException. - * - * @return The WBEMException or null if one was not thrown. - */ - public WBEMException getWBEMException(); - -} +/* + (C) Copyright IBM Corp. 2006, 2010 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Alexander Wolf-Reber, a.wolf-reber@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-11-08 lupusalex Make SBLIM client JSR48 compliant + * 1737141 2007-06-18 ebak Sync up with JSR48 evolution + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics + * 2912104 2009-12-10 blaschke-oss Sync up javax.wbem.* with JSR48 1.0.0 + * 2958941 2010-02-25 blaschke-oss Sync up javax.wbem.* javadoc with JSR48 1.0.0 + */ +package org.metricshub.wbem.javax.wbem; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.Iterator; + +//Sync'd against JSR48 1.0.0 javadoc (build 1.5.0_10) on Wed Jan 20 02:20:59 EST 2010 +/** + * A CloseableIterator is a subclass of Iterator that + * adds support for allowing the underlying implementation to serve up the + * elements as they become available. The methods hasNext() and + * next() may block while waiting for elements from the underlying + * implementation. Since next() or hasNext() can only + * throw runtime exceptions, if a consumer receives a runtime exception for one + * of these methods they must call getWBEMException() to get the + * actual WBEMException. + * + * @param + * Type parameter. + */ +public interface CloseableIterator extends Iterator { + + /** + * Closes the Iterator. This allows the underlying + * implementation to do any cleanup and disconnect from any source that it + * may be using. + */ + public void close(); + + /** + * If next() or hasNext() throws a + * RuntimeException, this method must be called to get the + * WBEMException. + * + * @return The WBEMException or null if one was not thrown. + */ + public WBEMException getWBEMException(); + +} diff --git a/src/main/java/org/sentrysoftware/wbem/javax/wbem/WBEMException.java b/src/main/java/org/metricshub/wbem/javax/wbem/WBEMException.java similarity index 90% rename from src/main/java/org/sentrysoftware/wbem/javax/wbem/WBEMException.java rename to src/main/java/org/metricshub/wbem/javax/wbem/WBEMException.java index 8ae2f20..c8f325e 100644 --- a/src/main/java/org/sentrysoftware/wbem/javax/wbem/WBEMException.java +++ b/src/main/java/org/metricshub/wbem/javax/wbem/WBEMException.java @@ -1,388 +1,386 @@ -/* - (C) Copyright IBM Corp. 2006, 2012 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-11-08 lupusalex Make SBLIM client JSR48 compliant - * 1715482 2007-05-10 lupusalex CIM_ERR_FAILED thrown when access denied - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2750520 2009-04-10 blaschke-oss Code cleanup from empty statement et al - * 2912104 2009-12-10 blaschke-oss Sync up javax.wbem.* with JSR48 1.0.0 - * 2958941 2010-02-25 blaschke-oss Sync up javax.wbem.* javadoc with JSR48 1.0.0 - * 2958990 2010-02-25 blaschke-oss Remove WBEMException.CIM_ERR_TYPE_MISMATCH - * 2959039 2010-02-25 blaschke-oss Fix WBEMException.toString() logic - * 3490032 2012-02-21 blaschke-oss TCK: WBEMException must validate error ID - * 3496301 2012-03-02 blaschke-oss Sync up javax.* javadoc with JSR48 1.0.0 Final - * 3565581 2012-09-07 blaschke-oss TCK: remove unnecessary overriding methods - */ - -package org.sentrysoftware.wbem.javax.wbem; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMInstance; - -//Sync'd against JSR48 1.0.0 javadoc (build 1.6.0_18) on Thu Mar 01 12:21:26 EST 2012 -/** - * WBEMException is returned when there is a WBEM Operations error. - * WBEMException includes the following:
      - *
        - *
      • ID - The ID of the exception
      • - *
      • Description - Brief description of the exception
      • - *
      • CIMInstance[] - Optional array of CIM_Error - * instances
      • - *
      - */ -public class WBEMException extends Exception { - - private static final long serialVersionUID = 1224653110826327234L; - - /** - * Access Denied Exception. Thrown when the principal is not authenticated - * or authorized. - */ - public static final int CIM_ERR_ACCESS_DENIED = 2; - - /** - * Element already exists. - */ - public static final int CIM_ERR_ALREADY_EXISTS = 11; - - /** - * Class has subclasses. The exception is thrown by the WBEM Server to - * disallow invalidation of the subclasses by the super class deletion. - * Clients must explicitly delete the subclasses first. The check for - * subclasses is made before the check for class instances. - */ - public static final int CIM_ERR_CLASS_HAS_CHILDREN = 8; - - /** - * Class has instances. The exception is thrown by the WBEM Server to - * disallow invalidation of the instances by the class deletion. Clients - * must explicitly delete the instances first. The check for subclasses is - * made before the check for class instances i.e. - * CIM_ERR_CLASS_HAS_CHILDREN is thrown before - * CIM_ERR_CLASS_HAS_INSTANCES - */ - public static final int CIM_ERR_CLASS_HAS_INSTANCES = 9; - - /** - * The WBEM Server does not support continuation on error. - */ - public static final int CIM_ERR_CONTINUATION_ON_ERROR_NOT_SUPPORTED = 26; - - /** - * General Exception. If no other error IDs match the error, this one should - * be returned. - */ - public static final int CIM_ERR_FAILED = 1; - - /** - * Using a filter in the enumeration is not supported by the WBEM Server. - */ - public static final int CIM_ERR_FILTERED_ENUMERATION_NOT_SUPPORTED = 25; - - /** - * Invalid class specified. For e.g. when one tries to add an instance for a - * class that does not exist. This error message uses one parameter, the - * invalid class name. - */ - public static final int CIM_ERR_INVALID_CLASS = 5; - - /** - * The enumeration identified by the specified context cannot be found, is - * in a closed state, does not exist, or is otherwise invalid. - */ - public static final int CIM_ERR_INVALID_ENUMERATION_CONTEXT = 21; - - /** - * Invalid namespace Exception. Thrown when the specified namespace does not - * exist. - */ - public static final int CIM_ERR_INVALID_NAMESPACE = 3; - - /** - * The specified operation timeout is not supported by the WBEM Server. - */ - public static final int CIM_ERR_INVALID_OPERATION_TIMEOUT = 22; - - /** - * Invalid parameter is passed to a method. This error message uses one - * parameter, the parameter which caused the exception. - */ - public static final int CIM_ERR_INVALID_PARAMETER = 4; - - /** - * Invalid query. This error message has two parameters, the invalid snippet - * of the query, and additional info with the actual error in the query. - */ - public static final int CIM_ERR_INVALID_QUERY = 15; - - /** - * The destination is invalid. - */ - public static final int CIM_ERR_INVALID_RESPONSE_DESTINATION = 19; - - /** - * The super class does not exist. - */ - public static final int CIM_ERR_INVALID_SUPERCLASS = 10; - - /** - * The method is not available. - */ - public static final int CIM_ERR_METHOD_NOT_AVAILABLE = 16; - - /** - * The method is not found. - */ - public static final int CIM_ERR_METHOD_NOT_FOUND = 17; - - /** - * The namespace is not empty. - */ - public static final int CIM_ERR_NAMESPACE_NOT_EMPTY = 20; - - /** - * The property does not exist in the class/instance being manipulated. This - * error message uses one parameter, the name of the property that does not - * exist. - */ - public static final int CIM_ERR_NO_SUCH_PROPERTY = 12; - - /** - * Element cannot be found. This error message uses one parameter, the - * element that cannot be found. - */ - public static final int CIM_ERR_NOT_FOUND = 6; - - /** - * The action is not supported. This can be thrown by a provider or the WBEM - * Server itself when it does not support a particular method. - */ - public static final int CIM_ERR_NOT_SUPPORTED = 7; - - /** - * The attempt to abandon a concurrent Pull operation on the same - * enumeration failed, the concurrent Pull operation proceeds normally. - */ - public static final int CIM_ERR_PULL_CANNOT_BE_ABANDONED = 24; - - /** - * The Pull operation has been abandoned due to execution of a concurrent - * CloseEnumeration operation on the same enumeration. - */ - public static final int CIM_ERR_PULL_HAS_BEEN_ABANDONED = 23; - - /** - * The requested query language is not recognized. This error message has - * one parameter, the invalid query language string. - */ - public static final int CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED = 14; - - /** - * The WBEM Server is in the process of shutting down and cannot process the - * operation at this time. - */ - public static final int CIM_ERR_SERVER_IS_SHUTTING_DOWN = 28; - - /** - * The WBEM Server has failed the operation based upon exceeding server - * limits. - */ - public static final int CIM_ERR_SERVER_LIMITS_EXCEEDED = 27; - - private static final String[] MESSAGES = new String[] { - /* 00 */"SUCCESS", - /* 01 */"CIM_ERR_FAILED", - /* 02 */"CIM_ERR_ACCESS_DENIED", - /* 03 */"CIM_ERR_INVALID_NAMESPACE", - /* 04 */"CIM_ERR_INVALID_PARAMETER", - /* 05 */"CIM_ERR_INVALID_CLASS", - /* 06 */"CIM_ERR_NOT_FOUND", - /* 07 */"CIM_ERR_NOT_SUPPORTED", - /* 08 */"CIM_ERR_CLASS_HAS_CHILDREN", - /* 09 */"CIM_ERR_CLASS_HAS_INSTANCES", - /* 10 */"CIM_ERR_INVALID_SUPERCLASS", - /* 11 */"CIM_ERR_ALREADY_EXISTS", - /* 12 */"CIM_ERR_NO_SUCH_PROPERTY", - /* 13 */null, - /* 14 */"CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED", - /* 15 */"CIM_ERR_INVALID_QUERY", - /* 16 */"CIM_ERR_METHOD_NOT_AVAILABLE", - /* 17 */"CIM_ERR_METHOD_NOT_FOUND", - /* 18 */null, - /* 19 */"CIM_ERR_INVALID_RESPONSE_DESTINATION", - /* 20 */"CIM_ERR_NAMESPACE_NOT_EMPTY", - /* 21 */"CIM_ERR_INVALID_ENUMERATION_CONTEXT", - /* 22 */"CIM_ERR_INVALID_OPERATION_TIMEOUT", - /* 23 */"CIM_ERR_PULL_HAS_BEEN_ABANDONED", - /* 24 */"CIM_ERR_PULL_CANNOT_BE_ABANDONED", - /* 25 */"CIM_ERR_FILTERED_ENUMERATION_NOT_SUPPORTED", - /* 26 */"CIM_ERR_CONTINUATION_ON_ERROR_NOT_SUPPORTED", - /* 27 */"CIM_ERR_SERVER_LIMITS_EXCEEDED", - /* 28 */"CIM_ERR_SERVER_IS_SHUTTING_DOWN" }; - - private int iErrorID; - - private CIMInstance[] iCimErrors; - - /** - * Constructs a new exception using the specified ID. The detailed message - * will be null. - * - * @param pID - * The Error ID to use. - * @throws IllegalArgumentException - * If the pID does not match one of the predefined messages. - */ - public WBEMException(int pID) { - this(pID, null, null, null); - } - - /** - * Constructs a new exception using the specified ID and detailed message. - * - * @param pID - * The error ID. - * @param pMessage - * The detailed message. - * @throws IllegalArgumentException - * If the pID does not match one of the predefined messages. - */ - public WBEMException(int pID, String pMessage) { - this(pID, pMessage, null, null); - } - - /** - * Constructs a new exception using the specified ID, detailed message and - * CIM_Error instances. - * - * @param pID - * The error ID. - * @param pMessage - * The detailed message. - * @param pErrors - * Array of CIM_Error instances. - * @throws IllegalArgumentException - * If the pID does not match one of the predefined messages. - */ - public WBEMException(int pID, String pMessage, CIMInstance[] pErrors) { - this(pID, pMessage, pErrors, null); - } - - /** - * Constructs a new exception using the specified ID, detailed message, - * CIM_Error instances and cause. - * - * @param pID - * The error ID. - * @param pMessage - * The detailed message. - * @param pErrors - * Array of CIM_Error instances. - * @param pCause - * Throwable cause. - * @throws IllegalArgumentException - * If the pID does not match one of the predefined messages. - */ - public WBEMException(int pID, String pMessage, CIMInstance[] pErrors, Throwable pCause) { - super(pMessage, pCause); - if (!isValidID(pID)) throw new IllegalArgumentException("Invalid error ID!"); - this.iErrorID = pID; - this.iCimErrors = pErrors; - } - - /** - * Constructs a new exception using the specified detailed message. The - * ID will be CIM_ERR_FAILED. - * - * @param pMessage - * The detailed message. - */ - public WBEMException(String pMessage) { - this(CIM_ERR_FAILED, pMessage, null, null); - } - - /** - * Get the CIM Error Instances. - * - * @return Any CIM Error instances associated with this exception; - * null if none. - */ - public CIMInstance[] getCIMErrors() { - return this.iCimErrors; - } - - /** - * Returns the ID of the error. - * - * @return The ID of the error. - */ - public int getID() { - return this.iErrorID; - } - - /** - * Prints out the ID and the optional detailed message. - * - * @return A String representation of the exception. - */ - @Override - public String toString() { - return "WBEMException: " + getCIMMessage() - + (super.getMessage() != null ? " (" + super.getMessage() + ")" : ""); - } - - /** - * Returns a string representation of the exception ID. - * - * @return A String representation of the exception ID. - */ - private String getCIMMessage() { - return isValidID(this.iErrorID) ? MESSAGES[this.iErrorID] : String.valueOf(this.iErrorID); - } - - /** - * Returns validity of error ID. - * - * @param pID - * The error ID. - * - * @return true if error ID is valid, false - * otherwise. - */ - private boolean isValidID(int pID) { - return pID >= 0 && pID < MESSAGES.length && MESSAGES[pID] != null; - } -} +/* + (C) Copyright IBM Corp. 2006, 2012 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-11-08 lupusalex Make SBLIM client JSR48 compliant + * 1715482 2007-05-10 lupusalex CIM_ERR_FAILED thrown when access denied + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2750520 2009-04-10 blaschke-oss Code cleanup from empty statement et al + * 2912104 2009-12-10 blaschke-oss Sync up javax.wbem.* with JSR48 1.0.0 + * 2958941 2010-02-25 blaschke-oss Sync up javax.wbem.* javadoc with JSR48 1.0.0 + * 2958990 2010-02-25 blaschke-oss Remove WBEMException.CIM_ERR_TYPE_MISMATCH + * 2959039 2010-02-25 blaschke-oss Fix WBEMException.toString() logic + * 3490032 2012-02-21 blaschke-oss TCK: WBEMException must validate error ID + * 3496301 2012-03-02 blaschke-oss Sync up javax.* javadoc with JSR48 1.0.0 Final + * 3565581 2012-09-07 blaschke-oss TCK: remove unnecessary overriding methods + */ + +package org.metricshub.wbem.javax.wbem; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMInstance; + +//Sync'd against JSR48 1.0.0 javadoc (build 1.6.0_18) on Thu Mar 01 12:21:26 EST 2012 +/** + * WBEMException is returned when there is a WBEM Operations error. + * WBEMException includes the following:
      + *
        + *
      • ID - The ID of the exception
      • + *
      • Description - Brief description of the exception
      • + *
      • CIMInstance[] - Optional array of CIM_Error + * instances
      • + *
      + */ +public class WBEMException extends Exception { + + private static final long serialVersionUID = 1224653110826327234L; + + /** + * Access Denied Exception. Thrown when the principal is not authenticated + * or authorized. + */ + public static final int CIM_ERR_ACCESS_DENIED = 2; + + /** + * Element already exists. + */ + public static final int CIM_ERR_ALREADY_EXISTS = 11; + + /** + * Class has subclasses. The exception is thrown by the WBEM Server to + * disallow invalidation of the subclasses by the super class deletion. + * Clients must explicitly delete the subclasses first. The check for + * subclasses is made before the check for class instances. + */ + public static final int CIM_ERR_CLASS_HAS_CHILDREN = 8; + + /** + * Class has instances. The exception is thrown by the WBEM Server to + * disallow invalidation of the instances by the class deletion. Clients + * must explicitly delete the instances first. The check for subclasses is + * made before the check for class instances i.e. + * CIM_ERR_CLASS_HAS_CHILDREN is thrown before + * CIM_ERR_CLASS_HAS_INSTANCES + */ + public static final int CIM_ERR_CLASS_HAS_INSTANCES = 9; + + /** + * The WBEM Server does not support continuation on error. + */ + public static final int CIM_ERR_CONTINUATION_ON_ERROR_NOT_SUPPORTED = 26; + + /** + * General Exception. If no other error IDs match the error, this one should + * be returned. + */ + public static final int CIM_ERR_FAILED = 1; + + /** + * Using a filter in the enumeration is not supported by the WBEM Server. + */ + public static final int CIM_ERR_FILTERED_ENUMERATION_NOT_SUPPORTED = 25; + + /** + * Invalid class specified. For e.g. when one tries to add an instance for a + * class that does not exist. This error message uses one parameter, the + * invalid class name. + */ + public static final int CIM_ERR_INVALID_CLASS = 5; + + /** + * The enumeration identified by the specified context cannot be found, is + * in a closed state, does not exist, or is otherwise invalid. + */ + public static final int CIM_ERR_INVALID_ENUMERATION_CONTEXT = 21; + + /** + * Invalid namespace Exception. Thrown when the specified namespace does not + * exist. + */ + public static final int CIM_ERR_INVALID_NAMESPACE = 3; + + /** + * The specified operation timeout is not supported by the WBEM Server. + */ + public static final int CIM_ERR_INVALID_OPERATION_TIMEOUT = 22; + + /** + * Invalid parameter is passed to a method. This error message uses one + * parameter, the parameter which caused the exception. + */ + public static final int CIM_ERR_INVALID_PARAMETER = 4; + + /** + * Invalid query. This error message has two parameters, the invalid snippet + * of the query, and additional info with the actual error in the query. + */ + public static final int CIM_ERR_INVALID_QUERY = 15; + + /** + * The destination is invalid. + */ + public static final int CIM_ERR_INVALID_RESPONSE_DESTINATION = 19; + + /** + * The super class does not exist. + */ + public static final int CIM_ERR_INVALID_SUPERCLASS = 10; + + /** + * The method is not available. + */ + public static final int CIM_ERR_METHOD_NOT_AVAILABLE = 16; + + /** + * The method is not found. + */ + public static final int CIM_ERR_METHOD_NOT_FOUND = 17; + + /** + * The namespace is not empty. + */ + public static final int CIM_ERR_NAMESPACE_NOT_EMPTY = 20; + + /** + * The property does not exist in the class/instance being manipulated. This + * error message uses one parameter, the name of the property that does not + * exist. + */ + public static final int CIM_ERR_NO_SUCH_PROPERTY = 12; + + /** + * Element cannot be found. This error message uses one parameter, the + * element that cannot be found. + */ + public static final int CIM_ERR_NOT_FOUND = 6; + + /** + * The action is not supported. This can be thrown by a provider or the WBEM + * Server itself when it does not support a particular method. + */ + public static final int CIM_ERR_NOT_SUPPORTED = 7; + + /** + * The attempt to abandon a concurrent Pull operation on the same + * enumeration failed, the concurrent Pull operation proceeds normally. + */ + public static final int CIM_ERR_PULL_CANNOT_BE_ABANDONED = 24; + + /** + * The Pull operation has been abandoned due to execution of a concurrent + * CloseEnumeration operation on the same enumeration. + */ + public static final int CIM_ERR_PULL_HAS_BEEN_ABANDONED = 23; + + /** + * The requested query language is not recognized. This error message has + * one parameter, the invalid query language string. + */ + public static final int CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED = 14; + + /** + * The WBEM Server is in the process of shutting down and cannot process the + * operation at this time. + */ + public static final int CIM_ERR_SERVER_IS_SHUTTING_DOWN = 28; + + /** + * The WBEM Server has failed the operation based upon exceeding server + * limits. + */ + public static final int CIM_ERR_SERVER_LIMITS_EXCEEDED = 27; + + private static final String[] MESSAGES = new String[] { + /* 00 */"SUCCESS", + /* 01 */"CIM_ERR_FAILED", + /* 02 */"CIM_ERR_ACCESS_DENIED", + /* 03 */"CIM_ERR_INVALID_NAMESPACE", + /* 04 */"CIM_ERR_INVALID_PARAMETER", + /* 05 */"CIM_ERR_INVALID_CLASS", + /* 06 */"CIM_ERR_NOT_FOUND", + /* 07 */"CIM_ERR_NOT_SUPPORTED", + /* 08 */"CIM_ERR_CLASS_HAS_CHILDREN", + /* 09 */"CIM_ERR_CLASS_HAS_INSTANCES", + /* 10 */"CIM_ERR_INVALID_SUPERCLASS", + /* 11 */"CIM_ERR_ALREADY_EXISTS", + /* 12 */"CIM_ERR_NO_SUCH_PROPERTY", + /* 13 */null, + /* 14 */"CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED", + /* 15 */"CIM_ERR_INVALID_QUERY", + /* 16 */"CIM_ERR_METHOD_NOT_AVAILABLE", + /* 17 */"CIM_ERR_METHOD_NOT_FOUND", + /* 18 */null, + /* 19 */"CIM_ERR_INVALID_RESPONSE_DESTINATION", + /* 20 */"CIM_ERR_NAMESPACE_NOT_EMPTY", + /* 21 */"CIM_ERR_INVALID_ENUMERATION_CONTEXT", + /* 22 */"CIM_ERR_INVALID_OPERATION_TIMEOUT", + /* 23 */"CIM_ERR_PULL_HAS_BEEN_ABANDONED", + /* 24 */"CIM_ERR_PULL_CANNOT_BE_ABANDONED", + /* 25 */"CIM_ERR_FILTERED_ENUMERATION_NOT_SUPPORTED", + /* 26 */"CIM_ERR_CONTINUATION_ON_ERROR_NOT_SUPPORTED", + /* 27 */"CIM_ERR_SERVER_LIMITS_EXCEEDED", + /* 28 */"CIM_ERR_SERVER_IS_SHUTTING_DOWN" }; + + private int iErrorID; + + private CIMInstance[] iCimErrors; + + /** + * Constructs a new exception using the specified ID. The detailed message + * will be null. + * + * @param pID + * The Error ID to use. + * @throws IllegalArgumentException + * If the pID does not match one of the predefined messages. + */ + public WBEMException(int pID) { + this(pID, null, null, null); + } + + /** + * Constructs a new exception using the specified ID and detailed message. + * + * @param pID + * The error ID. + * @param pMessage + * The detailed message. + * @throws IllegalArgumentException + * If the pID does not match one of the predefined messages. + */ + public WBEMException(int pID, String pMessage) { + this(pID, pMessage, null, null); + } + + /** + * Constructs a new exception using the specified ID, detailed message and + * CIM_Error instances. + * + * @param pID + * The error ID. + * @param pMessage + * The detailed message. + * @param pErrors + * Array of CIM_Error instances. + * @throws IllegalArgumentException + * If the pID does not match one of the predefined messages. + */ + public WBEMException(int pID, String pMessage, CIMInstance[] pErrors) { + this(pID, pMessage, pErrors, null); + } + + /** + * Constructs a new exception using the specified ID, detailed message, + * CIM_Error instances and cause. + * + * @param pID + * The error ID. + * @param pMessage + * The detailed message. + * @param pErrors + * Array of CIM_Error instances. + * @param pCause + * Throwable cause. + * @throws IllegalArgumentException + * If the pID does not match one of the predefined messages. + */ + public WBEMException(int pID, String pMessage, CIMInstance[] pErrors, Throwable pCause) { + super(pMessage, pCause); + if (!isValidID(pID)) throw new IllegalArgumentException("Invalid error ID!"); + this.iErrorID = pID; + this.iCimErrors = pErrors; + } + + /** + * Constructs a new exception using the specified detailed message. The + * ID will be CIM_ERR_FAILED. + * + * @param pMessage + * The detailed message. + */ + public WBEMException(String pMessage) { + this(CIM_ERR_FAILED, pMessage, null, null); + } + + /** + * Get the CIM Error Instances. + * + * @return Any CIM Error instances associated with this exception; + * null if none. + */ + public CIMInstance[] getCIMErrors() { + return this.iCimErrors; + } + + /** + * Returns the ID of the error. + * + * @return The ID of the error. + */ + public int getID() { + return this.iErrorID; + } + + /** + * Prints out the ID and the optional detailed message. + * + * @return A String representation of the exception. + */ + @Override + public String toString() { + return "WBEMException: " + getCIMMessage() + + (super.getMessage() != null ? " (" + super.getMessage() + ")" : ""); + } + + /** + * Returns a string representation of the exception ID. + * + * @return A String representation of the exception ID. + */ + private String getCIMMessage() { + return isValidID(this.iErrorID) ? MESSAGES[this.iErrorID] : String.valueOf(this.iErrorID); + } + + /** + * Returns validity of error ID. + * + * @param pID + * The error ID. + * + * @return true if error ID is valid, false + * otherwise. + */ + private boolean isValidID(int pID) { + return pID >= 0 && pID < MESSAGES.length && MESSAGES[pID] != null; + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/javax/wbem/client/EnumerateResponse.java b/src/main/java/org/metricshub/wbem/javax/wbem/client/EnumerateResponse.java similarity index 76% rename from src/main/java/org/sentrysoftware/wbem/javax/wbem/client/EnumerateResponse.java rename to src/main/java/org/metricshub/wbem/javax/wbem/client/EnumerateResponse.java index e5ffc70..ee5f83f 100644 --- a/src/main/java/org/sentrysoftware/wbem/javax/wbem/client/EnumerateResponse.java +++ b/src/main/java/org/metricshub/wbem/javax/wbem/client/EnumerateResponse.java @@ -1,118 +1,116 @@ -/* - (C) Copyright IBM Corp. 2006, 2010 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Ramandeep S Arora, IBM, arorar@us.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 2845211 2009-08-27 raman_arora Pull Enumeration Feature (SAX Parser) - * 2959264 2010-02-25 blaschke-oss Sync up javax.client.* javadoc with JSR48 1.0.0 - */ -package org.sentrysoftware.wbem.javax.wbem.client; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.wbem.CloseableIterator; - -//Sync'd against JSR48 1.0.0 javadoc (build 1.5.0_10) on Wed Jan 20 02:20:59 EST 2010 -/** - * This class is a container that stores the information from a Pull request. - * - * @param - * Type parameter. - */ -public class EnumerateResponse { - - private String iContext; - - private CloseableIterator iResponses; - - private boolean iEnd; - - /** - * Creates an EnumerateResponse. - * - * @param pContext - * The enumeration context returned. This will be used for any - * future calls for this particular enumeration. - * @param pResponses - * The results of the operation. - * @param pEnd - * true if this is the last of the results; - * false otherwise. - */ - public EnumerateResponse(String pContext, CloseableIterator pResponses, boolean pEnd) { - this.iContext = pContext; - this.iResponses = pResponses; - this.iEnd = pEnd; - } - - /** - * Get the context that can be used for a subsequent pull request. - * - * @return The Enumeration Context returned from the server. - */ - public String getContext() { - return this.iContext; - } - - /** - * Get the CloseableIterator for the returned CIM Elements. - * - * @return CloseableIterator for the elements returned. - */ - public CloseableIterator getResponses() { - return this.iResponses; - } - - /** - * If true, there are no more elements to be returned. - * - * @return true if this is the last of the results; - * false otherwise. - */ - public boolean isEnd() { - return this.iEnd; - } - - /* - This iterates over the responses. As a side effect, - CloseableIterator.hasNext() will not return anything after this is - called. - - public void debug() { CloseableIterator iterator = - this.getResponses(); while (iterator.hasNext()) - System.out.println(iterator.next()); - - System.out.println("Enum Context =" + this.getContext()); - System.out.println("Is End = " + this.isEnd()); - System.out.println("Done...\n"); } - */ -} +/* + (C) Copyright IBM Corp. 2006, 2010 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Ramandeep S Arora, IBM, arorar@us.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 2845211 2009-08-27 raman_arora Pull Enumeration Feature (SAX Parser) + * 2959264 2010-02-25 blaschke-oss Sync up javax.client.* javadoc with JSR48 1.0.0 + */ +package org.metricshub.wbem.javax.wbem.client; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.wbem.CloseableIterator; + +//Sync'd against JSR48 1.0.0 javadoc (build 1.5.0_10) on Wed Jan 20 02:20:59 EST 2010 +/** + * This class is a container that stores the information from a Pull request. + * + * @param + * Type parameter. + */ +public class EnumerateResponse { + + private String iContext; + + private CloseableIterator iResponses; + + private boolean iEnd; + + /** + * Creates an EnumerateResponse. + * + * @param pContext + * The enumeration context returned. This will be used for any + * future calls for this particular enumeration. + * @param pResponses + * The results of the operation. + * @param pEnd + * true if this is the last of the results; + * false otherwise. + */ + public EnumerateResponse(String pContext, CloseableIterator pResponses, boolean pEnd) { + this.iContext = pContext; + this.iResponses = pResponses; + this.iEnd = pEnd; + } + + /** + * Get the context that can be used for a subsequent pull request. + * + * @return The Enumeration Context returned from the server. + */ + public String getContext() { + return this.iContext; + } + + /** + * Get the CloseableIterator for the returned CIM Elements. + * + * @return CloseableIterator for the elements returned. + */ + public CloseableIterator getResponses() { + return this.iResponses; + } + + /** + * If true, there are no more elements to be returned. + * + * @return true if this is the last of the results; + * false otherwise. + */ + public boolean isEnd() { + return this.iEnd; + } + + /* + This iterates over the responses. As a side effect, + CloseableIterator.hasNext() will not return anything after this is + called. + + public void debug() { CloseableIterator iterator = + this.getResponses(); while (iterator.hasNext()) + System.out.println(iterator.next()); + + System.out.println("Enum Context =" + this.getContext()); + System.out.println("Is End = " + this.isEnd()); + System.out.println("Done...\n"); } + */ +} diff --git a/src/main/java/org/sentrysoftware/wbem/javax/wbem/client/PasswordCredential.java b/src/main/java/org/metricshub/wbem/javax/wbem/client/PasswordCredential.java similarity index 81% rename from src/main/java/org/sentrysoftware/wbem/javax/wbem/client/PasswordCredential.java rename to src/main/java/org/metricshub/wbem/javax/wbem/client/PasswordCredential.java index f5c90ee..5978798 100644 --- a/src/main/java/org/sentrysoftware/wbem/javax/wbem/client/PasswordCredential.java +++ b/src/main/java/org/metricshub/wbem/javax/wbem/client/PasswordCredential.java @@ -1,136 +1,134 @@ -/* - (C) Copyright IBM Corp. 2006, 2012 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------------------------- - * 2006-04-25 ebak Initial commit - * 2006-04-27 wolfalex Full implementation - * 1737141 2007-06-18 ebak Sync up with JSR48 evolution - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2899389 2009-11-18 blaschke-oss Password maximum length of 16? - * 2959264 2010-02-25 blaschke-oss Sync up javax.client.* javadoc with JSR48 1.0.0 - * 2978722 2010-03-29 blaschke-oss PasswordCredential(char[]) constructor is wrong - * 3496301 2012-03-02 blaschke-oss Sync up javax.* javadoc with JSR48 1.0.0 Final - */ - -package org.sentrysoftware.wbem.javax.wbem.client; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -//Sync'd against JSR48 1.0.0 javadoc (build 1.6.0_18) on Thu Mar 01 12:21:26 EST 2012 -/** - * PasswordCredential implements a password based credential. This - * is used with UserPrincipal. PasswordCredential - * includes the password and optionally the host information for which the - * password is used to authenticate the UserPrincipal. - * - */ -public class PasswordCredential extends Object { - - private String iPw; - - private String iHostname; - - /** - * Creates a PasswordCredential using the supplied password. - * - * @param pCredential - * The user login password in clear text. - * @throws IllegalArgumentException - * If the credential is null. - */ - public PasswordCredential(char[] pCredential) { - if (pCredential != null) { - this.iPw = new String(pCredential); - } else { - throw new IllegalArgumentException("Invalid password"); - } - } - - /** - * Creates a PasswordCredential using the supplied password. - * - * @param pCredential - * The user login password in clear text. - * @throws IllegalArgumentException - * If the credential is null. - */ - public PasswordCredential(String pCredential) { - if (pCredential != null) { - this.iPw = pCredential; - } else { - throw new IllegalArgumentException("Invalid password"); - } - } - - /** - * Creates a PasswordCredential using the supplied password and - * host name. - * - * @param pCredential - * The user login password in clear text. - * @param pHostname - * The host name information for which the password is used to - * authenticate. - * @throws IllegalArgumentException - * If the credential is null. - */ - public PasswordCredential(String pCredential, String pHostname) { - if (pCredential != null) { - this.iPw = pCredential; - } else { - throw new IllegalArgumentException("Invalid password"); - } - this.iHostname = pHostname; - } - - /** - * Get the host name for which the password is used to authenticate. - * - * @return The host name. - */ - public String getHostName() { - return this.iHostname; - } - - /** - * Return the user login password in clear text. - * - * @return The user login password. - */ - public char[] getUserPassword() { - return this.iPw.toCharArray(); - } - -} +/* + (C) Copyright IBM Corp. 2006, 2012 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------------------------- + * 2006-04-25 ebak Initial commit + * 2006-04-27 wolfalex Full implementation + * 1737141 2007-06-18 ebak Sync up with JSR48 evolution + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2899389 2009-11-18 blaschke-oss Password maximum length of 16? + * 2959264 2010-02-25 blaschke-oss Sync up javax.client.* javadoc with JSR48 1.0.0 + * 2978722 2010-03-29 blaschke-oss PasswordCredential(char[]) constructor is wrong + * 3496301 2012-03-02 blaschke-oss Sync up javax.* javadoc with JSR48 1.0.0 Final + */ + +package org.metricshub.wbem.javax.wbem.client; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +//Sync'd against JSR48 1.0.0 javadoc (build 1.6.0_18) on Thu Mar 01 12:21:26 EST 2012 +/** + * PasswordCredential implements a password based credential. This + * is used with UserPrincipal. PasswordCredential + * includes the password and optionally the host information for which the + * password is used to authenticate the UserPrincipal. + * + */ +public class PasswordCredential extends Object { + + private String iPw; + + private String iHostname; + + /** + * Creates a PasswordCredential using the supplied password. + * + * @param pCredential + * The user login password in clear text. + * @throws IllegalArgumentException + * If the credential is null. + */ + public PasswordCredential(char[] pCredential) { + if (pCredential != null) { + this.iPw = new String(pCredential); + } else { + throw new IllegalArgumentException("Invalid password"); + } + } + + /** + * Creates a PasswordCredential using the supplied password. + * + * @param pCredential + * The user login password in clear text. + * @throws IllegalArgumentException + * If the credential is null. + */ + public PasswordCredential(String pCredential) { + if (pCredential != null) { + this.iPw = pCredential; + } else { + throw new IllegalArgumentException("Invalid password"); + } + } + + /** + * Creates a PasswordCredential using the supplied password and + * host name. + * + * @param pCredential + * The user login password in clear text. + * @param pHostname + * The host name information for which the password is used to + * authenticate. + * @throws IllegalArgumentException + * If the credential is null. + */ + public PasswordCredential(String pCredential, String pHostname) { + if (pCredential != null) { + this.iPw = pCredential; + } else { + throw new IllegalArgumentException("Invalid password"); + } + this.iHostname = pHostname; + } + + /** + * Get the host name for which the password is used to authenticate. + * + * @return The host name. + */ + public String getHostName() { + return this.iHostname; + } + + /** + * Return the user login password in clear text. + * + * @return The user login password. + */ + public char[] getUserPassword() { + return this.iPw.toCharArray(); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/javax/wbem/client/RoleCredential.java b/src/main/java/org/metricshub/wbem/javax/wbem/client/RoleCredential.java similarity index 81% rename from src/main/java/org/sentrysoftware/wbem/javax/wbem/client/RoleCredential.java rename to src/main/java/org/metricshub/wbem/javax/wbem/client/RoleCredential.java index 8ff1641..f87ae5f 100644 --- a/src/main/java/org/sentrysoftware/wbem/javax/wbem/client/RoleCredential.java +++ b/src/main/java/org/metricshub/wbem/javax/wbem/client/RoleCredential.java @@ -1,125 +1,123 @@ -/* - (C) Copyright IBM Corp. 2006, 2010 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------------------------- - * 2006-04-25 ebak Initial commit - * 1737141 2007-06-18 ebak Sync up with JSR48 evolution - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2899859 2009-11-18 blaschke-oss javax.wbem.client missing JSR48 credential/principal APIs - * 2959264 2010-02-25 blaschke-oss Sync up javax.client.* javadoc with JSR48 1.0.0 - * 2978722 2010-03-29 blaschke-oss PasswordCredential(char[]) constructor is wrong - */ - -package org.sentrysoftware.wbem.javax.wbem.client; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -//Sync'd against JSR48 1.0.0 (build 1.5.0_10) on Wed Jan 20 02:20:59 EST 2010 -/** - * RoleCredential implements a password based credential for a - * role. RoleCredential includes the credential (e.g. password) and - * optionally the host information for which the password is used to - * authenticate the RolePrincipal. RoleCredential - * should be used in conjunction with the RolePrincipal instance. - * This should only be used when a client is assuming a role on a WBEM Server - * that requires a password. - */ -public class RoleCredential extends Object { - - private String iCredential; - - private String iHostname; - - /** - * Creates a role credential using the supplied credential. - * - * @param pCredential - * The role credential in clear text. - * @throws IllegalArgumentException - * If the credential is null. - */ - public RoleCredential(char[] pCredential) throws IllegalArgumentException { - if (pCredential == null) throw new IllegalArgumentException("credential cannot be null!"); - this.iCredential = new String(pCredential); - } - - /** - * Creates a role credential using the supplied credential. - * - * @param pCredential - * The role credential in clear text. - * @throws IllegalArgumentException - * If the credential is null. - */ - public RoleCredential(String pCredential) throws IllegalArgumentException { - if (pCredential == null) throw new IllegalArgumentException("credential cannot be null!"); - this.iCredential = pCredential; - } - - /** - * Creates a role credential using the supplied credential and host name. - * - * @param pCredential - * The role credential in clear text. - * @param pHostname - * - The host name for this credential. - * @throws IllegalArgumentException - * If the credential is null. - */ - public RoleCredential(String pCredential, String pHostname) throws IllegalArgumentException { - if (pCredential == null) throw new IllegalArgumentException("credential cannot be null!"); - this.iCredential = pCredential; - this.iHostname = pHostname; - } - - /** - * Return the role credential in clear text. - * - * @return The role credential. - */ - public char[] getCredential() { - return this.iCredential.toCharArray(); - } - - /** - * Get the host name for which the password is used to authenticate. - * - * @return The host name. - */ - public String getHostName() { - return this.iHostname; - } - -} +/* + (C) Copyright IBM Corp. 2006, 2010 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------------------------- + * 2006-04-25 ebak Initial commit + * 1737141 2007-06-18 ebak Sync up with JSR48 evolution + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2899859 2009-11-18 blaschke-oss javax.wbem.client missing JSR48 credential/principal APIs + * 2959264 2010-02-25 blaschke-oss Sync up javax.client.* javadoc with JSR48 1.0.0 + * 2978722 2010-03-29 blaschke-oss PasswordCredential(char[]) constructor is wrong + */ + +package org.metricshub.wbem.javax.wbem.client; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +//Sync'd against JSR48 1.0.0 (build 1.5.0_10) on Wed Jan 20 02:20:59 EST 2010 +/** + * RoleCredential implements a password based credential for a + * role. RoleCredential includes the credential (e.g. password) and + * optionally the host information for which the password is used to + * authenticate the RolePrincipal. RoleCredential + * should be used in conjunction with the RolePrincipal instance. + * This should only be used when a client is assuming a role on a WBEM Server + * that requires a password. + */ +public class RoleCredential extends Object { + + private String iCredential; + + private String iHostname; + + /** + * Creates a role credential using the supplied credential. + * + * @param pCredential + * The role credential in clear text. + * @throws IllegalArgumentException + * If the credential is null. + */ + public RoleCredential(char[] pCredential) throws IllegalArgumentException { + if (pCredential == null) throw new IllegalArgumentException("credential cannot be null!"); + this.iCredential = new String(pCredential); + } + + /** + * Creates a role credential using the supplied credential. + * + * @param pCredential + * The role credential in clear text. + * @throws IllegalArgumentException + * If the credential is null. + */ + public RoleCredential(String pCredential) throws IllegalArgumentException { + if (pCredential == null) throw new IllegalArgumentException("credential cannot be null!"); + this.iCredential = pCredential; + } + + /** + * Creates a role credential using the supplied credential and host name. + * + * @param pCredential + * The role credential in clear text. + * @param pHostname + * - The host name for this credential. + * @throws IllegalArgumentException + * If the credential is null. + */ + public RoleCredential(String pCredential, String pHostname) throws IllegalArgumentException { + if (pCredential == null) throw new IllegalArgumentException("credential cannot be null!"); + this.iCredential = pCredential; + this.iHostname = pHostname; + } + + /** + * Return the role credential in clear text. + * + * @return The role credential. + */ + public char[] getCredential() { + return this.iCredential.toCharArray(); + } + + /** + * Get the host name for which the password is used to authenticate. + * + * @return The host name. + */ + public String getHostName() { + return this.iHostname; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/javax/wbem/client/RolePrincipal.java b/src/main/java/org/metricshub/wbem/javax/wbem/client/RolePrincipal.java similarity index 81% rename from src/main/java/org/sentrysoftware/wbem/javax/wbem/client/RolePrincipal.java rename to src/main/java/org/metricshub/wbem/javax/wbem/client/RolePrincipal.java index 9dccf45..137cb3d 100644 --- a/src/main/java/org/sentrysoftware/wbem/javax/wbem/client/RolePrincipal.java +++ b/src/main/java/org/metricshub/wbem/javax/wbem/client/RolePrincipal.java @@ -1,148 +1,146 @@ -/* - (C) Copyright IBM Corp. 2006, 2010 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------------------------- - * 2006-04-25 ebak Initial commit - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2899859 2009-11-18 blaschke-oss javax.wbem.client missing JSR48 credential/principal APIs - * 2959264 2010-02-25 blaschke-oss Sync up javax.client.* javadoc with JSR48 1.0.0 - */ - -package org.sentrysoftware.wbem.javax.wbem.client; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.security.Principal; - -//Sync'd against JSR48 1.0.0 javadoc (build 1.5.0_10) on Wed Jan 20 02:20:59 EST 2010 -/** - * RolePrincipal implements a Principal identity for a role. That - * is, it represents the role name to be assumed on a system. - * RolePrincipal includes the role and optionally the host - * information for which the role is used to authenticate. - */ -public class RolePrincipal extends Object implements Principal { - - private String iRole; - - private String iHost; - - /** - * This constructor accepts the role name. - * - * @param pRole - * The role name. - */ - public RolePrincipal(String pRole) { - this.iRole = pRole; - } - - /** - * This constructor accepts the role name and host name. - * - * @param pRole - * The role name. - * @param pHost - * The host name. - */ - public RolePrincipal(String pRole, String pHost) { - this.iRole = pRole; - this.iHost = pHost; - } - - /** - * The equals method checks if the specified principal is the - * same principal as this object. The principals are equal if the specified - * object is an instance of RolePrincipal and the user name and - * host name are the same. - * - * @param pObj - * The Principal to compare for equality. - * @return true if they are equal, otherwise false - * . - */ - @Override - public boolean equals(Object pObj) { - if (!(pObj instanceof RolePrincipal)) return false; - RolePrincipal that = (RolePrincipal) pObj; - return (this.iRole == null ? that.iRole == null : this.iRole.equalsIgnoreCase(that.iRole)) - && (this.iHost == null ? that.iHost == null : this.iHost - .equalsIgnoreCase(that.iHost)); - } - - /** - * Get the host for which the principal uses to authenticate. - * - * @return The host name. - */ - public String getHostName() { - return this.iHost; - } - - /** - * Return the name of this principal identity; that is, return the login - * name. - * - * @return The name of this principal identity. - * @see java.security.Principal#getName() - */ - public String getName() { - return this.iRole; - } - - /** - * The hashCode() method returns an integer hash code to - * represent this principal. - * - * @return An integer hash code representing the principal. - */ - @Override - public int hashCode() { - return this.iRole == null ? 0 : this.iRole.hashCode(); - } - - /** - * The toString() method returns a string representation of the - * principal suitable for displaying in messages. It should not be used for - * making authorization checks. - * - * @return A printable string form of the role principal. - */ - @Override - public String toString() { - return this.iRole; - } - -} +/* + (C) Copyright IBM Corp. 2006, 2010 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------------------------- + * 2006-04-25 ebak Initial commit + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2899859 2009-11-18 blaschke-oss javax.wbem.client missing JSR48 credential/principal APIs + * 2959264 2010-02-25 blaschke-oss Sync up javax.client.* javadoc with JSR48 1.0.0 + */ + +package org.metricshub.wbem.javax.wbem.client; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.security.Principal; + +//Sync'd against JSR48 1.0.0 javadoc (build 1.5.0_10) on Wed Jan 20 02:20:59 EST 2010 +/** + * RolePrincipal implements a Principal identity for a role. That + * is, it represents the role name to be assumed on a system. + * RolePrincipal includes the role and optionally the host + * information for which the role is used to authenticate. + */ +public class RolePrincipal extends Object implements Principal { + + private String iRole; + + private String iHost; + + /** + * This constructor accepts the role name. + * + * @param pRole + * The role name. + */ + public RolePrincipal(String pRole) { + this.iRole = pRole; + } + + /** + * This constructor accepts the role name and host name. + * + * @param pRole + * The role name. + * @param pHost + * The host name. + */ + public RolePrincipal(String pRole, String pHost) { + this.iRole = pRole; + this.iHost = pHost; + } + + /** + * The equals method checks if the specified principal is the + * same principal as this object. The principals are equal if the specified + * object is an instance of RolePrincipal and the user name and + * host name are the same. + * + * @param pObj + * The Principal to compare for equality. + * @return true if they are equal, otherwise false + * . + */ + @Override + public boolean equals(Object pObj) { + if (!(pObj instanceof RolePrincipal)) return false; + RolePrincipal that = (RolePrincipal) pObj; + return (this.iRole == null ? that.iRole == null : this.iRole.equalsIgnoreCase(that.iRole)) + && (this.iHost == null ? that.iHost == null : this.iHost + .equalsIgnoreCase(that.iHost)); + } + + /** + * Get the host for which the principal uses to authenticate. + * + * @return The host name. + */ + public String getHostName() { + return this.iHost; + } + + /** + * Return the name of this principal identity; that is, return the login + * name. + * + * @return The name of this principal identity. + * @see java.security.Principal#getName() + */ + public String getName() { + return this.iRole; + } + + /** + * The hashCode() method returns an integer hash code to + * represent this principal. + * + * @return An integer hash code representing the principal. + */ + @Override + public int hashCode() { + return this.iRole == null ? 0 : this.iRole.hashCode(); + } + + /** + * The toString() method returns a string representation of the + * principal suitable for displaying in messages. It should not be used for + * making authorization checks. + * + * @return A printable string form of the role principal. + */ + @Override + public String toString() { + return this.iRole; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/javax/wbem/client/UserPrincipal.java b/src/main/java/org/metricshub/wbem/javax/wbem/client/UserPrincipal.java similarity index 84% rename from src/main/java/org/sentrysoftware/wbem/javax/wbem/client/UserPrincipal.java rename to src/main/java/org/metricshub/wbem/javax/wbem/client/UserPrincipal.java index 4dd3804..d874fe8 100644 --- a/src/main/java/org/sentrysoftware/wbem/javax/wbem/client/UserPrincipal.java +++ b/src/main/java/org/metricshub/wbem/javax/wbem/client/UserPrincipal.java @@ -1,166 +1,164 @@ -/* - (C) Copyright IBM Corp. 2006, 2010 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------------------------- - * 2006-04-25 ebak Initial commit - * 2006-04-27 wolfalex Full implementation - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2899859 2009-11-18 blaschke-oss javax.wbem.client missing JSR48 credential/principal APIs - * 2959264 2010-02-25 blaschke-oss Sync up javax.client.* javadoc with JSR48 1.0.0 - */ -package org.sentrysoftware.wbem.javax.wbem.client; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.security.Principal; - -//Sync'd against JSR48 1.0.0 javadoc (build 1.5.0_10) on Wed Jan 20 02:20:59 EST 2010 -/** - * UserPrincipal implements a Principal identity for a client user - * identity that authenticates with a username and password. In other words, it - * represents the user's login identity on the remote system. - * UserPrincipal includes the username and optionally the host - * information for which the username is used to authenticate. - */ -public class UserPrincipal extends Object implements Principal { - - private String iUserName; - - private String iHostName; - - /** - * This constructor accepts the user name. - * - * @param pUserName - * The user login name. - * @throws IllegalArgumentException - * If the is null. - */ - public UserPrincipal(String pUserName) throws IllegalArgumentException { - if (pUserName == null) throw new IllegalArgumentException("userName is null!"); - this.iUserName = pUserName; - } - - /** - * This constructor accepts the user name and host name. - * - * @param pUserName - * The user login name. - * @param pHostName - * The host name for this principal. - * @throws IllegalArgumentException - * If the pUserName is null. - */ - public UserPrincipal(String pUserName, String pHostName) throws IllegalArgumentException { - if (pUserName == null) throw new IllegalArgumentException("userName is null!"); - this.iUserName = pUserName; - this.iHostName = pHostName; - } - - /** - * The equals method checks if the specified object is the same - * principal as this object. The principals are equal if the specified - * object is an instance of UserPrincipal and the user name and - * authentication host name are the same. - * - * @param pOtherPrincipal - * Principal instance to compare for equality. - * @return true if the object are equal; false - * otherwise. - */ - @Override - public boolean equals(Object pOtherPrincipal) { - if (!(pOtherPrincipal instanceof UserPrincipal)) return false; - UserPrincipal that = (UserPrincipal) pOtherPrincipal; - return (this.iUserName == null ? that.iUserName == null : this.iUserName - .equalsIgnoreCase(that.iUserName)) - && (this.iHostName == null ? that.iHostName == null : this.iHostName - .equalsIgnoreCase(that.iHostName)); - } - - /** - * Return the host name associated with this principal. - * - * @return The host name. - */ - public String getHostName() { - return this.iHostName; - } - - /** - * Return the name of this principal identity; that is, return the login - * name. - * - * @return The name of this principal identity. - * @see java.security.Principal#getName() - */ - public String getName() { - return this.iUserName; - } - - /** - * Return the principal's login user name. - * - * @return The user login name. - */ - public String getUserName() { - return this.iUserName; - } - - /** - * The hashCode method returns an integer hash code to - * represent this principal. It can be used to test for non-equality, or as - * an index key in a hash table. - * - * @return An integer hash code representing the principal. - */ - @Override - public int hashCode() { - return this.iUserName != null ? this.iUserName.hashCode() : 0; - } - - /** - * The toString method returns a string representation of the - * principal suitable for displaying in messages. It should not be used for - * making authorization checks, however. - * - * @return A printable string form of the principal identity. - */ - @Override - public String toString() { - return this.iUserName; - } - -} +/* + (C) Copyright IBM Corp. 2006, 2010 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------------------------- + * 2006-04-25 ebak Initial commit + * 2006-04-27 wolfalex Full implementation + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2899859 2009-11-18 blaschke-oss javax.wbem.client missing JSR48 credential/principal APIs + * 2959264 2010-02-25 blaschke-oss Sync up javax.client.* javadoc with JSR48 1.0.0 + */ +package org.metricshub.wbem.javax.wbem.client; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.security.Principal; + +//Sync'd against JSR48 1.0.0 javadoc (build 1.5.0_10) on Wed Jan 20 02:20:59 EST 2010 +/** + * UserPrincipal implements a Principal identity for a client user + * identity that authenticates with a username and password. In other words, it + * represents the user's login identity on the remote system. + * UserPrincipal includes the username and optionally the host + * information for which the username is used to authenticate. + */ +public class UserPrincipal extends Object implements Principal { + + private String iUserName; + + private String iHostName; + + /** + * This constructor accepts the user name. + * + * @param pUserName + * The user login name. + * @throws IllegalArgumentException + * If the is null. + */ + public UserPrincipal(String pUserName) throws IllegalArgumentException { + if (pUserName == null) throw new IllegalArgumentException("userName is null!"); + this.iUserName = pUserName; + } + + /** + * This constructor accepts the user name and host name. + * + * @param pUserName + * The user login name. + * @param pHostName + * The host name for this principal. + * @throws IllegalArgumentException + * If the pUserName is null. + */ + public UserPrincipal(String pUserName, String pHostName) throws IllegalArgumentException { + if (pUserName == null) throw new IllegalArgumentException("userName is null!"); + this.iUserName = pUserName; + this.iHostName = pHostName; + } + + /** + * The equals method checks if the specified object is the same + * principal as this object. The principals are equal if the specified + * object is an instance of UserPrincipal and the user name and + * authentication host name are the same. + * + * @param pOtherPrincipal + * Principal instance to compare for equality. + * @return true if the object are equal; false + * otherwise. + */ + @Override + public boolean equals(Object pOtherPrincipal) { + if (!(pOtherPrincipal instanceof UserPrincipal)) return false; + UserPrincipal that = (UserPrincipal) pOtherPrincipal; + return (this.iUserName == null ? that.iUserName == null : this.iUserName + .equalsIgnoreCase(that.iUserName)) + && (this.iHostName == null ? that.iHostName == null : this.iHostName + .equalsIgnoreCase(that.iHostName)); + } + + /** + * Return the host name associated with this principal. + * + * @return The host name. + */ + public String getHostName() { + return this.iHostName; + } + + /** + * Return the name of this principal identity; that is, return the login + * name. + * + * @return The name of this principal identity. + * @see java.security.Principal#getName() + */ + public String getName() { + return this.iUserName; + } + + /** + * Return the principal's login user name. + * + * @return The user login name. + */ + public String getUserName() { + return this.iUserName; + } + + /** + * The hashCode method returns an integer hash code to + * represent this principal. It can be used to test for non-equality, or as + * an index key in a hash table. + * + * @return An integer hash code representing the principal. + */ + @Override + public int hashCode() { + return this.iUserName != null ? this.iUserName.hashCode() : 0; + } + + /** + * The toString method returns a string representation of the + * principal suitable for displaying in messages. It should not be used for + * making authorization checks, however. + * + * @return A printable string form of the principal identity. + */ + @Override + public String toString() { + return this.iUserName; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/javax/wbem/client/WBEMClient.java b/src/main/java/org/metricshub/wbem/javax/wbem/client/WBEMClient.java similarity index 97% rename from src/main/java/org/sentrysoftware/wbem/javax/wbem/client/WBEMClient.java rename to src/main/java/org/metricshub/wbem/javax/wbem/client/WBEMClient.java index 6bf4b2d..185c156 100644 --- a/src/main/java/org/sentrysoftware/wbem/javax/wbem/client/WBEMClient.java +++ b/src/main/java/org/metricshub/wbem/javax/wbem/client/WBEMClient.java @@ -1,2254 +1,2252 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Alexander Wolf-Reber, a.wolf-reber@de.ibm.com - * - * Change History - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-11-08 lupusalex Make SBLIM client JSR48 compliant - * 1686000 2007-04-19 ebak modifyInstance() missing from WBEMClient - * 1737141 2007-06-18 ebak Sync up with JSR48 evolution - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors - * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics - * 2845211 2009-08-27 raman_arora Pull Enumeration Feature (SAX Parser) - * 2858933 2009-10-12 raman_arora JSR48 new APIs: associatorClasses & associatorInstances - * 2886829 2009-11-18 raman_arora JSR48 new APIs: referenceClasses & referenceInstances - * 2959586 2010-03-01 blaschke-oss Sync up WBEMClient javadoc with JSR48 1.0.0 - * 2961592 2010-03-01 blaschke-oss Remove WBEMClient.setLocales() UnsupportedOperationException - * 3496301 2012-03-02 blaschke-oss Sync up javax.* javadoc with JSR48 1.0.0 Final - * 3496343 2012-03-02 blaschke-oss JSR48 1.0.0: deprecate WBEMClient associators and references - * 3514537 2012-04-03 blaschke-oss TCK: execQueryInstances requires boolean, not Boolean - * 3521131 2012-04-24 blaschke-oss Sync up javax.* javadoc with JSR48 1.0.0 Final II - * 3521328 2012-04-25 blaschke-oss JSR48 1.0.0: remove WBEMClient associators and references - * 3525657 2012-05-10 blaschke-oss Sync up javax.* javadoc with JSR48 1.0.0 Final III - * 3555752 2012-09-13 blaschke-oss Sync up javax.* javadoc with JSR48 1.0.0 Final IV - * 2716 2013-12-11 blaschke-oss Sync up javax.* javadoc with JSR48 1.0.0 Final V - */ - -package org.sentrysoftware.wbem.javax.wbem.client; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.Locale; - -import org.sentrysoftware.wbem.javax.cim.CIMArgument; -import org.sentrysoftware.wbem.javax.cim.CIMClass; -import org.sentrysoftware.wbem.javax.cim.CIMInstance; -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; -import org.sentrysoftware.wbem.javax.cim.CIMQualifierType; -import org.sentrysoftware.wbem.javax.cim.UnsignedInteger32; -import org.sentrysoftware.wbem.javax.cim.UnsignedInteger64; -import javax.security.auth.Subject; -import org.sentrysoftware.wbem.javax.wbem.CloseableIterator; -import org.sentrysoftware.wbem.javax.wbem.WBEMException; - -//Sync'd against JSR48 1.0.0 javadoc (version 1.7.0_03) on Tue Dec 10 07:02:50 EST 2013 -/** - * The WBEMClient interface is used to invoke WBEM operations - * against a WBEM Server. A WBEMClient implementation can be - * retrieved from the WBEMClientFactory specifying the protocol to - * be used. - * - * @see WBEMClientFactory - */ -public interface WBEMClient { - - /** - * Enumerates CIM classes that are associated to a specified source CIM - * class. - * - * @param pObjectName - * CIMObjectPath defining the source CIM Class whose - * associated classes are to be returned. The - * pObjectName shall include the host, namespace and - * object name. The keys shall not be populated. - * @param pAssociationClass - * This string shall contain a valid CIM Association class name - * or be null. It filters the classes returned to - * contain only classes associated to the source Object via this - * CIM Association class or one of its subclasses. - * @param pResultClass - * This string shall either contain a valid CIM Class name or be - * null. It filters the classes returned to contain - * only the classes of this class name or one of its subclasses. - * @param pRole - * This string shall either contain a valid Property name or be - * null. It filters the classes returned to contain - * only classes associated to the source class via an Association - * class in which the source class plays the specified - * role. (i.e. the Property name in the Association class that - * refers to the source class matches this value) For - * example, if "Antecedent" is specified, then only Associations - * in which the source class is the "Antecedent" reference are - * examined. - * @param pResultRole - * This string shall either contain a valid Property name or be - * null. It filters the classes returned to contain - * only classes associated to the source class via an Association - * class in which the class returned plays the specified - * role. (i.e. the Property name in the Association class that - * refers to the class returned matches this value) - * @param pIncludeQualifiers - * If true, all Qualifiers for each class (including - * Qualifiers on the Object and on any returned Properties) MUST - * be included in the classes returned. If false, no - * Qualifiers are present in each class returned. - * @param pIncludeClassOrigin - * The class origin attribute is the name of the class that first - * defined the property or method. If true, the - * class origin attribute shall be present for each property and - * method on all classes returned. If false, the - * class origin shall not be present. - * @param pPropertyList - * An array of property names used to filter what is contained in - * the classes returned. Each CIMClass returned - * shall only contain elements for the properties of the names - * specified. Duplicate and invalid property names are ignored - * and the request is otherwise processed normally. An empty - * array indicates that no properties should be included in the - * classes returned. A null value indicates that all - * properties should be contained in the classes returned. - * @return If successful, a CloseableIterator containing zero - * or more CIMClasses meeting the specified criteria - * are returned. - * @throws UnsupportedOperationException - * If the client implementation (or protocol) does not support - * the operation. - * @throws WBEMException - * If unsuccessful, one of the following status codes shall be - * returned along with zero or more instances of - * CIM_Error. The ORDERED list is: - * - * - * CIM_ERR_ACCESS_DENIED - * CIM_ERR_NOT_SUPPORTED - * CIM_ERR_INVALID_NAMESPACE - * CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized - * or otherwise incorrect parameters) - * CIM_ERR_FAILED (some other unspecified error occurred) - * - */ - public CloseableIterator associatorClasses(CIMObjectPath pObjectName, - String pAssociationClass, String pResultClass, String pRole, String pResultRole, - boolean pIncludeQualifiers, boolean pIncludeClassOrigin, String[] pPropertyList) - throws WBEMException; - - /** - * Enumerates CIM Instances associated to a specified source CIM Instance. - * - * @param pObjectName - * CIMObjectPath defining the source CIM Instance - * whose associated instances are to be returned. The - * pObjectName must contain the host, namespace, - * object name and keys for the instance. - * @param pAssociationClass - * This string shall either contain a valid CIM Association class - * name or be null. It filters the instances - * returned to contain only instances associated to the source - * instance via this CIM Association class or one of its - * subclasses. - * @param pResultClass - * This string shall either contain a valid CIM Class name or be - * null. It filters the instances returned to - * contain only the instances of this Class name or one of its - * subclasses. - * @param pRole - * This string shall either contain a valid Property name or be - * null. It filters the Objects returned to contain - * only Objects associated to the source Object via an - * Association class in which the source Object plays the - * specified role. (i.e. the Property name in the Association - * class that refers to the source Object matches this - * value) If "Antecedent" is specified, then only Associations in - * which the source Object is the "Antecedent" reference are - * examined. - * @param pResultRole - * This string shall either contain a valid Property name or be - * null. It filters the instances returned to - * contain only instances associated to the source instance via - * an Association class in which the instance returned - * plays the specified role. (i.e. the Property name in the - * Association class that refers to the instance returned - * matches this value) For example, if "Dependent" is specified, - * then only Associations in which the instance returned is the - * "Dependent" reference are examined. - * @param pIncludeClassOrigin - * The class origin attribute is the name of the class that first - * defined the property. If true, the class origin - * attribute may be present for each property on all instances - * returned, even if requested the server may ignore the request - * and not return the class origin. If false, the - * class origin shall not be present. - * @param pPropertyList - * An array of property names used to filter what is contained in - * the Objects returned. Each CIMInstance returned - * only contains elements for the properties of the names - * specified. Duplicate and invalid property names are ignored - * and the request is otherwise processed normally. An empty - * array indicates that no properties should be included in the - * instances returned. A null value indicates that - * all properties should be contained in the instances returned. - * @return If successful, a CloseableIterator containing zero - * or more CIMInstances meeting the specified criteria - * is returned. - * @throws WBEMException - * If unsuccessful, one of the following status codes shall be - * returned along with zero or more instances of - * CIM_Error. The ORDERED list is: - * - * - * CIM_ERR_ACCESS_DENIED - * CIM_ERR_NOT_SUPPORTED - * CIM_ERR_INVALID_NAMESPACE - * CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized - * or otherwise incorrect parameters) - * CIM_ERR_FAILED (some other unspecified error occurred) - * - */ - public CloseableIterator associatorInstances(CIMObjectPath pObjectName, - String pAssociationClass, String pResultClass, String pRole, String pResultRole, - boolean pIncludeClassOrigin, String[] pPropertyList) throws WBEMException; - - /** - * Enumerates the CIMObjectPaths of CIM Objects that are - * associated to a particular source CIM Object. If the source Object is a - * CIM Class, then a CloseableIterator of - * CIMObjectPath s of the classes associated to the source - * Object is returned. If the source Object is a CIM Instance, then a - * CloseableIterator of CIMObjectPaths of the - * CIMInstance objects associated to the source Object is - * returned. - * - * @param pObjectName - * CIMObjectPath defining the source CIM Object - * whose associated Objects are to be returned. This argument may - * contain either a Class name or the modelpath of an Instance. - * (i.e. Keys populated) - * @param pAssociationClass - * This string MUST either contain a valid CIM Association class - * name or be null. It filters the Objects returned - * to contain only Objects associated to the source Object via - * this CIM Association class or one of its subclasses. - * @param pResultClass - * This string MUST either contain a valid CIM Class name or be - * null. It filters the Objects returned to contain - * only the Objects of this Class name or one of its subclasses. - * @param pRole - * This string MUST either contain a valid Property name or be - * null. It filters the Objects returned to contain - * only Objects associated to the source Object via an - * Association class in which the source Object plays the - * specified role. (i.e. the Property name in the Association - * class that refers to the source Object matches this - * value) If "Antecedent" is specified, then only Associations in - * which the source Object is the "Antecedent" reference are - * examined. - * @param pResultRole - * This string MUST either contain a valid Property name or be - * null. It filters the Objects returned to contain - * only Objects associated to the source Object via an - * Association class in which the Object returned plays - * the specified role. (i.e. the Property name in the Association - * class that refers to the Object returned matches this - * value) If "Dependent" is specified, then only Associations in - * which the Object returned is the "Dependent" reference are - * examined. - * @return If successful, a CloseableIterator containing zero - * or more CIMObjectPath objects of the CIM Classes or - * CIM Instances meeting the specified criteria is returned. - * @throws WBEMException - * If unsuccessful, one of the following status codes must be - * returned. The ORDERED list is: - * - * - * CIM_ERR_ACCESS_DENIED - * CIM_ERR_NOT_SUPPORTED - * CIM_ERR_INVALID_NAMESPACE - * CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized - * or otherwise incorrect parameters) - * CIM_ERR_FAILED (some other unspecified error occurred) - * - */ - public CloseableIterator associatorNames(CIMObjectPath pObjectName, - String pAssociationClass, String pResultClass, String pRole, String pResultRole) - throws WBEMException; - - /** - * associatorPaths shall start an enumeration session for - * traversing associations starting from the instance defined in the - * pInstancePath parameter using any specified filtering - * criteria and return zero or more CIMObjectPath objects. - * - * @param pInstancePath - * The CIMObjectPath for the instance for which the - * enumeration is to be performed. - * @param pAssociationClass - * This string MUST either contain a valid CIM Association class - * name or be null. It filters the Objects returned - * to contain only Objects associated to the source Object via - * this CIM Association class or one of its subclasses. - * @param pResultClass - * This string MUST either contain a valid CIM Class name or be - * null. It filters the Objects returned to contain - * only the Objects of this Class name or one of its subclasses. - * @param pRole - * This string MUST either contain a valid Property name or be - * null. It filters the Objects returned to contain - * only Objects associated to the source Object via an - * Association class in which the source Object plays the - * specified role. (i.e. the Property name in the Association - * class that refers to the source Object matches this - * value) If "Antecedent" is specified, then only Associations in - * which the source Object is the "Antecedent" reference are - * examined. - * @param pResultRole - * This string MUST either contain a valid Property name or be - * null. It filters the Objects returned to contain - * only Objects associated to the source Object via an - * Association class in which the Object returned plays - * the specified role. (i.e. the Property name in the Association - * class that refers to the Object returned matches this - * value) If "Dependent" is specified, then only Associations in - * which the Object returned is the "Dependent" reference are - * examined. - * @param pFilterQueryLanguage - * The pFilterQueryLanguage represents the query - * language for the pFilterQuery argument. This must - * be left null if a pFilterQuery is - * not supplied. If the implementation does not support the query - * language specified, the - * CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED error shall - * be returned. If the implementation does not support filtered - * enumerations, the - * CIM_ERR_FILTERED_ENUMERATION_NOT_SUPPORTED error - * shall be returned. - * @param pFilterQuery - * The pFilterQuery specifies a query in the form of - * the query language specified by the - * pFilterQueryLanguage parameter. If this value is - * not null, the pFilterQueryLanguage - * parameter must be non-null. This value shall act - * as an additional filter on the result set. If the - * implementation does not support the query language specified, - * the CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED error - * shall be returned. If the implementation does not support - * filtered enumerations, the - * CIM_ERR_FILTERED_ENUMERATION_NOT_SUPPORTED error - * shall be returned. - * @param pTimeout - * This input parameter determines the minimum time the CIM - * server shall maintain the open enumeration session after the - * last Open or Pull operation (unless the enumeration session is - * closed). If the operation timeout is exceeded, the - * implementation may close the enumeration session at any time, - * releasing any resources allocated to the enumeration session. - * A pTimeout of 0 means that there is no operation - * timeout. That is, the enumeration session is never closed - * based on time. If pTimeout is null, - * the implementation shall choose an operation timeout. All - * other values for pTimeout specify the operation - * timeout in seconds. A implementation may restrict the set of - * allowable values for pTimeout. Specifically, the - * implementation may not allow 0 (no timeout). If the specified - * value is not an allowable value, the implementation shall - * return failure with the status code - * CIM_ERR_INVALID_OPERATION_TIMEOUT. - * @param pContinueOnError - * If true, requests that the operation resume when - * an error is received. If a implementation does not support - * continuation on error and pContinueOnError is - * true, it shall throw a WBEMException - * with the status code - * CIM_ERR_CONTINUATION_ON_ERROR_NOT_SUPPORTED. If a - * implementation supports continuation on error and - * pContinueOnError is true, the - * enumeration session shall remain open when a Pull operation - * fails, and any subsequent successful Pull operations shall - * return the set of elements that would have been returned if - * the failing Pull operations were successful. This behavior is - * subject to the consistency rules defined for pulled - * enumerations. If pContinueOnError is - * false, the enumeration session shall be closed - * when either the operation completes successfully or when a - * WBEMExcetpion is thrown. - * @param pMaxObjects - * Defines the maximum number of elements that this Open - * operation can return. The implementation may deliver any - * number of elements up to pMaxObjects but shall - * not deliver more than pMaxObjects elements. An - * implementation may choose to never return any elements during - * an Open operation, regardless of the value of - * pMaxObjects. Note that a CIM client can use a - * pMaxObjects value of 0 to specify that it does - * not want to retrieve any instances in the Open operation. - * @return The return value of a successful Open operation is an array of - * enumerated elements with a number of entries from 0 up to a - * maximum defined by pMaxObjects. These entries meet - * the criteria defined in the Open operation. Note that returning - * no entries in the array does not imply that the enumeration - * session is exhausted. Client must evaluate the - * EnumerateResponse.isEnd() to determine if there are - * more elements. - * @throws WBEMException - * If unsuccessful, one of the following status codes must be - * returned. The ORDERED list is: - * - * - * CIM_ERR_ACCESS_DENIED - * CIM_ERR_SERVER_IS_SHUTTING_DOWN - * CIM_ERR_NOT_SUPPORTED - * CIM_ERR_INVALID_NAMESPACE - * CIM_ERR_INVALID_OPERATION_TIMEOUT - * CIM_ERR_CONTINUATION_ON_ERROR_NOT_SUPPORTED - * CIM_ERR_INVALID_PARAMETER - * CIM_ERR_NOT_FOUND (the source instance was not found) - * CIM_ERR_FILTERED_ENUMERATION_NOT_SUPPORTED - * CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED - * CIM_ERR_INVALID_QUERY - * CIM_ERR_FAILED (some other unspecified error occurred) - * - */ - public EnumerateResponse associatorPaths(CIMObjectPath pInstancePath, - String pAssociationClass, String pResultClass, String pRole, String pResultRole, - String pFilterQueryLanguage, String pFilterQuery, UnsignedInteger32 pTimeout, - boolean pContinueOnError, UnsignedInteger32 pMaxObjects) throws WBEMException; - - /** - * associators shall start an enumeration session for - * traversing associations starting from the instance defined in the - * pInstancePath parameter using any specified filtering - * criteria and return zero or more CIMInstance objects. - * - * @param pInstancePath - * The CIMObjectPath for the instance for which the - * enumeration is to be performed. - * @param pAssociationClass - * This string MUST either contain a valid CIM Association class - * name or be null. It filters the Objects returned - * to contain only Objects associated to the source Object via - * this CIM Association class or one of its subclasses. - * @param pResultClass - * This string MUST either contain a valid CIM Class name or be - * null. It filters the Objects returned to contain - * only the Objects of this Class name or one of its subclasses. - * @param pRole - * This string MUST either contain a valid Property name or be - * null. It filters the Objects returned to contain - * only Objects associated to the source Object via an - * Association class in which the source Object plays the - * specified role. (i.e. the Property name in the Association - * class that refers to the source Object matches this - * value) If "Antecedent" is specified, then only Associations in - * which the source Object is the "Antecedent" reference are - * examined. - * @param pResultRole - * This string MUST either contain a valid Property name or be - * null. It filters the Objects returned to contain - * only Objects associated to the source Object via an - * Association class in which the Object returned plays - * the specified role. (i.e. the Property name in the Association - * class that refers to the Object returned matches this - * value) If "Dependent" is specified, then only Associations in - * which the Object returned is the "Dependent" reference are - * examined. - * @param pIncludeClassOrigin - * The class origin attribute is the name of the class that first - * defined the property. If true, the class origin - * attribute may be present for each property on all instances - * returned, even if requested the server may ignore the request - * and not return the class origin. If false, the - * class origin shall not be present. - * @param pPropertyList - * An array of property names used to filter what is contained in - * the Objects returned. Each CIMClass or - * CIMInstance returned only contains elements for - * the properties of the names specified. Duplicate and invalid - * property names are ignored and the request is otherwise - * processed normally. An empty array indicates that no - * properties should be included in the Objects returned. A - * null value indicates that all properties should - * be contained in the Objects returned. NOTE: Properties - * should not be specified in this parameter unless a non- - * null value is specified in the - * pResultClass parameter. - * @param pFilterQueryLanguage - * The pFilterQueryLanguage represents the query - * language for the pFilterQuery argument. This must - * be left null if a filterQuery is not supplied. If - * the implementation does not support the query language - * specified, the - * CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED error shall - * be returned. If the implementation does not support filtered - * enumerations, the - * CIM_ERR_FILTERED_ENUMERATION_NOT_SUPPORTED error - * shall be returned. - * @param pFilterQuery - * The pFilterQuery specifies a query in the form of - * the query language specified by the - * pFilterQueryLanguage parameter. If this value is - * not null, the pFilterQueryLanguage - * parameter must be non-null. This value shall act - * as an additional filter on the result set. If the - * implementation does not support the query language specified, - * the CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED error - * shall be returned. If the implementation does not support - * filtered enumerations, the - * CIM_ERR_FILTERED_ENUMERATION_NOT_SUPPORTED error - * shall be returned. - * @param pTimeout - * This input parameter determines the minimum time the CIM - * server shall maintain the open enumeration session after the - * last Open or Pull operation (unless the enumeration session is - * closed). If the operation timeout is exceeded, the - * implementation may close the enumeration session at any time, - * releasing any resources allocated to the enumeration session. - * A pTimeout of 0 means that there is no operation - * timeout. That is, the enumeration session is never closed - * based on time. If pTimeout is null, - * the implementation shall choose an operation timeout. All - * other values for pTimeout specify the operation - * timeout in seconds. A implementation may restrict the set of - * allowable values for pTimeout. Specifically, the - * implementation may not allow 0 (no timeout). If the specified - * value is not an allowable value, the implementation shall - * return failure with the status code - * CIM_ERR_INVALID_OPERATION_TIMEOUT. - * @param pContinueOnError - * If true, requests that the operation resume when - * an error is received. If a implementation does not support - * continuation on error and pContinueOnError is - * true, it shall throw a WBEMException - * with the status code - * CIM_ERR_CONTINUATION_ON_ERROR_NOT_SUPPORTED. If a - * implementation supports continuation on error and - * pContinueOnError is true, the - * enumeration session shall remain open when a Pull operation - * fails, and any subsequent successful Pull operations shall - * return the set of elements that would have been returned if - * the failing Pull operations were successful. This behavior is - * subject to the consistency rules defined for pulled - * enumerations. If pContinueOnError is - * false, the enumeration session shall be closed - * when either the operation completes successfully or when a - * WBEMExcetpion is thrown. - * @param pMaxObjects - * Defines the maximum number of elements that this Open - * operation can return. The implementation may deliver any - * number of elements up to pMaxObjects but shall - * not deliver more than pMaxObjects elements. An - * implementation may choose to never return any elements during - * an Open operation, regardless of the value of - * pMaxObjects. Note that a CIM client can use a - * pMaxObjects value of 0 to specify that it does - * not want to retrieve any instances in the Open operation. - * @return The return value of a successful Open operation is an array of - * enumerated elements with a number of entries from 0 up to a - * maximum defined by pMaxObjects. These entries meet - * the criteria defined in the Open operation. Note that returning - * no entries in the array does not imply that the enumeration - * session is exhausted. Client must evaluate the - * EnumerateResponse.isEnd() to determine if there are - * more elements. - * @throws WBEMException - * If unsuccessful, one of the following status codes must be - * returned. The ORDERED list is: - * - * - * CIM_ERR_ACCESS_DENIED - * CIM_ERR_SERVER_IS_SHUTTING_DOWN - * CIM_ERR_NOT_SUPPORTED - * CIM_ERR_INVALID_NAMESPACE - * CIM_ERR_INVALID_OPERATION_TIMEOUT - * CIM_ERR_CONTINUATION_ON_ERROR_NOT_SUPPORTED - * CIM_ERR_INVALID_PARAMETER - * CIM_ERR_NOT_FOUND (The source instance was not found) - * CIM_ERR_FILTERED_ENUMERATION_NOT_SUPPORTED - * CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED - * CIM_ERR_INVALID_QUERY - * CIM_ERR_FAILED (Some other unspecified error occurred) - * - */ - public EnumerateResponse associators(CIMObjectPath pInstancePath, - String pAssociationClass, String pResultClass, String pRole, String pResultRole, - boolean pIncludeClassOrigin, String[] pPropertyList, String pFilterQueryLanguage, - String pFilterQuery, UnsignedInteger32 pTimeout, boolean pContinueOnError, - UnsignedInteger32 pMaxObjects) throws WBEMException; - - /** - * Closes the WBEMClient session. - */ - public void close(); - - /** - * closeEnumeration shall close an enumeration session that has - * been previously started but not yet completed. Clients should always use - * this method when an enumeration session has been started and the client - * does not retrieve all the results. If a client has started an enumeration - * session and retrieves all the results until the - * EnumerationResponse.isEnd() is true, this method shall not - * be called. - * - * @param pPath - * The CIMObjectPath representing the namespace to - * be used. - * @param pContext - * The enumeration context to close. - * @throws WBEMException - */ - public void closeEnumeration(CIMObjectPath pPath, String pContext) throws WBEMException; - - /** - * Create a CIM class. The namespace from the - * CIMClass.getObjectPath() shall be used. - * - * @param pClass - * The CIMClass to be created. - * @throws UnsupportedOperationException - * If the client implementation (or protocol) does not support - * the operation. - * @throws WBEMException - * If unsuccessful, one of the following status codes must be - * returned. The ORDERED list is: - * - * - * CIM_ERR_ACCESS_DENIED - * CIM_ERR_NOT_SUPPORTED - * CIM_ERR_INVALID_NAMESPACE - * CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized - * or otherwise incorrect parameters) - * CIM_ERR_ALREADY_EXISTS (the CIM Class already exists) - * CIM_ERR_INVALID_SUPERCLASS (the putative CIM Class declares a - * non-existent superclass) - * CIM_ERR_FAILED (some other unspecified error occurred) - * - */ - public void createClass(CIMClass pClass) throws WBEMException; - - /** - * Create a CIM Instance. The namespace from the - * CIMInstance.getObjectPath() shall be used. The keys of the - * CIMInstance may be modified by the implementation and the - * client must use the returned object path to determine the name of the - * instance. It is possible for a client to leave keys of instances empty/ - * null and the provider can fill them in. This is - * implementation specific unless specified by a CIM Schema or in a DMTF - * Profile. - * - * @param pInstance - * The CIMInstance to be created. - * @return CIMObjectPath of the instance created. - * @throws WBEMException - * If unsuccessful, one of the following status codes must be - * returned. The ORDERED list is: - * - * - * CIM_ERR_ACCESS_DENIED - * CIM_ERR_NOT_SUPPORTED (provider does not support this method) - * CIM_ERR_INVALID_NAMESPACE - * CIM_ERR_INVALID_PARAMETER (for this method) - * CIM_ERR_INVALID_CLASS (in this namespace) - * CIM_ERR_ALREADY_EXISTS - * CIM_ERR_FAILED (some other unspecified error occurred) - * - */ - public CIMObjectPath createInstance(CIMInstance pInstance) throws WBEMException; - - /** - * Deletes the CIM class for the object specified by the CIM object path. - * - * @param pPath - * The CIMObjectPath identifying the namespace and - * class name to delete. - * @throws UnsupportedOperationException - * If the client implementation (or protocol) does not support - * the operation. - * @throws WBEMException - * If unsuccessful, one of the following status codes must be - * returned. The ORDERED list is: - * - * - * CIM_ERR_ACCESS_DENIED - * CIM_ERR_NOT_SUPPORTED - * CIM_ERR_INVALID_NAMESPACE - * CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized - * or otherwise incorrect parameters) - * CIM_ERR_NOT_FOUND (the CIM Class to be deleted does not exist) - * CIM_ERR_CLASS_HAS_CHILDREN (the CIM Class has one or more subclasses - * which cannot be deleted) - * CIM_ERR_CLASS_HAS_INSTANCES (the CIM Class has one or more instances - * which cannot be deleted) - * CIM_ERR_FAILED (some other unspecified error occurred) - * - */ - public void deleteClass(CIMObjectPath pPath) throws WBEMException; - - /** - * Delete the CIM instance specified by the CIM object path. - * - * @param pPath - * The object path of the instance to be deleted. It must include - * all of the keys. - * @throws WBEMException - * If unsuccessful, one of the following status codes must be - * returned. The ORDERED list is: - * - * - * CIM_ERR_ACCESS_DENIED - * CIM_ERR_NOT_SUPPORTED (provider does not support this method) - * CIM_ERR_INVALID_NAMESPACE - * CIM_ERR_INVALID_PARAMETER (for this method) - * CIM_ERR_INVALID_CLASS (in this namespace) - * CIM_ERR_NOT_FOUND (if the instance does not exist) - * CIM_ERR_FAILED (some other unspecified error occurred) - * - */ - public void deleteInstance(CIMObjectPath pPath) throws WBEMException; - - /** - * Delete a CIM Qualifier type. - * - * @param pPath - * The CIMObjectPath identifying the name and - * namespace of the CIM qualifier type to delete. - * @throws UnsupportedOperationException - * If the client implementation (or protocol) does not support - * the operation. - * @throws WBEMException - * If unsuccessful, one of the following status codes must be - * returned. The ORDERED list is: - * - * - * CIM_ERR_ACCESS_DENIED - * CIM_ERR_NOT_SUPPORTED - * CIM_ERR_INVALID_NAMESPACE - * CIM_ERR_INVALID_PARAMETER (for this method) - * CIM_ERR_NOT_FOUND (the Qualifier did not exist) - * CIM_ERR_FAILED (some other unspecified error occurred) - * - */ - public void deleteQualifierType(CIMObjectPath pPath) throws WBEMException; - - /** - * Enumerate CIM Classes. - * - * @param pPath - * The object path of the class to be enumerated. Only the - * namespace and object name should be populated. If the object - * name is set to an empty string (i.e. ""), then all base - * classes in the target namespace are returned. - * @param pDeep - * If true, the classes returned shall include - * subclasses. If false, the classes returned shall - * not include subclasses. - * @param pLocalOnly - * If true, only elements (properties, methods and - * qualifiers) defined in, or overridden in the class are - * included in the response. If false, all elements - * of the class definition are returned. - * @param pIncludeQualifiers - * If true, all Qualifiers for each Class and its - * elements (properties, methods, references) are included. If - * false, no Qualifiers are present in the classes - * returned. - * @param pIncludeClassOrigin - * The class origin attribute is the name of the class that first - * defined the property or method. If true, the - * class origin attribute shall be present for each property and - * method on all returned CIMClasses. If - * false, the class origin shall not be present. - * @return A CloseableIterator of CIMClasses. - * @throws UnsupportedOperationException - * If the client implementation (or protocol) does not support - * the operation. - * @throws WBEMException - * If unsuccessful, one of the following status codes must be - * returned. The ORDERED list is: - * - * - * CIM_ERR_ACCESS_DENIED - * CIM_ERR_NOT_SUPPORTED - * CIM_ERR_INVALID_NAMESPACE - * CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized - * or otherwise incorrect parameters) - * CIM_ERR_INVALID_CLASS (the CIM Class that is the basis for this - * enumeration does not exist) - * CIM_ERR_FAILED (some other unspecified error occurred) - * - */ - public CloseableIterator enumerateClasses(CIMObjectPath pPath, boolean pDeep, - boolean pLocalOnly, boolean pIncludeQualifiers, boolean pIncludeClassOrigin) - throws WBEMException; - - /** - * Enumerate the names of CIM Classes. - * - * @param pPath - * The CIMObjectPath identifying the class to be - * enumerated. If the class name in the object path specified is - * an empty string (i.e. ""), all base classes in the target - * namespace are returned. Note that only the namespace and the - * name components should be populated. - * @param pDeep - * If true, the enumeration returned shall contain - * the names of all classes derived from the class being - * enumerated. If false, the enumeration returned - * contains only the names of the first level children of the - * class. - * @return A CloseableIterator of CIMObjectPaths. - * @throws UnsupportedOperationException - * If the client implementation (or protocol) does not support - * the operation. - * @throws WBEMException - * If unsuccessful, one of the following status codes must be - * returned. The ORDERED list is: - * - * - * CIM_ERR_ACCESS_DENIED - * CIM_ERR_NOT_SUPPORTED - * CIM_ERR_INVALID_NAMESPACE - * CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized - * or otherwise incorrect parameters) - * CIM_ERR_INVALID_CLASS (the CIM Class that is the basis for this - * enumeration does not exist) - * CIM_ERR_FAILED (some other unspecified error occurred) - * - */ - public CloseableIterator enumerateClassNames(CIMObjectPath pPath, boolean pDeep) - throws WBEMException; - - /** - * Enumerate the names of the instances for a specified class. The names of - * all subclass instances are returned. - * - * @param pPath - * The CIMObjectPath identifying the class whose - * instances are to be enumerated. Only the namespace and class - * name components are used. All other information (e.g. Keys) is - * ignored. - * @return CloseabelIterator of CIMObjectPaths. - * @throws WBEMException - * If unsuccessful, one of the following status codes must be - * returned. The ORDERED list is: - * - * - * CIM_ERR_ACCESS_DENIED - * CIM_ERR_NOT_SUPPORTED (provider does not support this method) - * CIM_ERR_INVALID_NAMESPACE - * CIM_ERR_INVALID_PARAMETER (for this method) - * CIM_ERR_INVALID_CLASS (in this namespace) - * CIM_ERR_FAILED (some other unspecified error occurred) - * - */ - public CloseableIterator enumerateInstanceNames(CIMObjectPath pPath) - throws WBEMException; - - /** - * enumerateInstancePaths shall enumerate the instances of the - * specified class in pClassPath and return zero or more - * CIMObjectPaths. - * - * @param pClassPath - * The CIMObjectPath for the class for which the - * enumeration is to be performed. - * @param pFilterQueryLanguage - * The pFilterQueryLanguage represents the query - * language for the pFilterQuery argument. This must - * be left null if a pFilterQuery is - * not supplied. If the implementation does not support the query - * language specified, the - * CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED error shall - * be returned. If the implementation does not support filtered - * enumerations, the - * CIM_ERR_FILTERED_ENUMERATION_NOT_SUPPORTED error - * shall be returned. - * @param pFilterQuery - * The pFilterQuery specifies a query in the form of - * the query language specified by the - * pFilterQueryLanguage parameter. If this value is - * not null, the pFilterQueryLanguage - * parameter must be non-null. This value shall act - * as an additional filter on the result set. If the - * implementation does not support the query language specified, - * the CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED error - * shall be returned. If the implementation does not support - * filtered enumerations, the - * CIM_ERR_FILTERED_ENUMERATION_NOT_SUPPORTED error - * shall be returned. - * @param pTimeout - * This input parameter determines the minimum time the CIM - * server shall maintain the open enumeration session after the - * last Open or Pull operation (unless the enumeration session is - * closed). If the operation timeout is exceeded, the - * implementation may close the enumeration session at any time, - * releasing any resources allocated to the enumeration session. - * A pTimeout of 0 means that there is no operation - * timeout. That is, the enumeration session is never closed - * based on time. If pTimeout is null, - * the implementation shall choose an operation timeout. All - * other values for pTimeout specify the operation - * timeout in seconds. A implementation may restrict the set of - * allowable values for pTimeout. Specifically, the - * implementation may not allow 0 (no timeout). If the specified - * value is not an allowable value, the implementation shall - * return failure with the status code - * CIM_ERR_INVALID_OPERATION_TIMEOUT. - * @param pContinueOnError - * If true, requests that the operation resume when - * an error is received. If a implementation does not support - * continuation on error and pContinueOnError is - * true, it shall throw a WBEMException - * with the status code - * CIM_ERR_CONTINUATION_ON_ERROR_NOT_SUPPORTED. If a - * implementation supports continuation on error and - * pContinueOnError is true, the - * enumeration session shall remain open when a Pull operation - * fails, and any subsequent successful Pull operations shall - * return the set of elements that would have been returned if - * the failing Pull operations were successful. This behavior is - * subject to the consistency rules defined for pulled - * enumerations. If pContinueOnError is - * false, the enumeration session shall be closed - * when either the operation completes successfully or when a - * WBEMExcetpion is thrown. - * @param pMaxObjects - * Defines the maximum number of elements that this Open - * operation can return. The implementation may deliver any - * number of elements up to pMaxObjects but shall - * not deliver more than pMaxObjects elements. An - * implementation may choose to never return any elements during - * an Open operation, regardless of the value of - * pMaxObjects. Note that a CIM client can use a - * pMaxObjects value of 0 to specify that it does - * not want to retrieve any instances in the Open operation. - * @return The return value of a successful Open operation is an array of - * enumerated elements with a number of entries from 0 up to a - * maximum defined by pMaxObjects. These entries meet - * the criteria defined in the Open operation. Note that returning - * no entries in the array does not imply that the enumeration - * session is exhausted. Client must evaluate the - * EnumerateResponse.isEnd() to determine if there are - * more elements. - * @throws WBEMException - * If unsuccessful, one of the following status codes must be - * returned. The ORDERED list is: - * - * - * CIM_ERR_ACCESS_DENIED - * CIM_ERR_SERVER_IS_SHUTTING_DOWN - * CIM_ERR_NOT_SUPPORTED - * CIM_ERR_INVALID_NAMESPACE - * CIM_ERR_INVALID_OPERATION_TIMEOUT - * CIM_ERR_CONTINUATION_ON_ERROR_NOT_SUPPORTED - * CIM_ERR_INVALID_PARAMETER - * CIM_ERR_INVALID_CLASS (the source class does not exist) - * CIM_ERR_FILTERED_ENUMERATION_NOT_SUPPORTED - * CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED - * CIM_ERR_INVALID_QUERY - * CIM_ERR_FAILED (some other unspecified error occurred) - * - */ - public EnumerateResponse enumerateInstancePaths(CIMObjectPath pClassPath, - String pFilterQueryLanguage, String pFilterQuery, UnsignedInteger32 pTimeout, - boolean pContinueOnError, UnsignedInteger32 pMaxObjects) throws WBEMException; - - /** - * Enumerate the instances of a class. The instances of all subclasses are - * also returned. - * - * @param pPath - * The object path of the class to be enumerated. Only the - * namespace and class name components are used. Any other - * information (e.g. Keys) is ignored. - * @param pDeep - * If true, this specifies that, for each returned - * Instance of the Class, all properties of the Instance must be - * present (subject to constraints imposed by the other - * parameters), including any which were added by subclassing the - * specified Class. If false, each returned Instance - * includes only properties defined for the specified Class in - * path. - * @param pLocalOnly - * If true, only properties that were instantiated - * in the instance are returned. WBEM Servers may ignore this - * parameter and return all properties. - * @param pIncludeClassOrigin - * The class origin attribute is the name of the class that first - * defined the property. If true, the class origin - * attribute may be present for each property on all returned - * CIMInstances, even if requested the server may ignore the - * request and not return the class origin. If false - * , the class origin shall not be present. - * @param pPropertyList - * An array of property names used to filter what is contained in - * the instances returned. Each instance returned only contains - * elements for the properties of the names specified. Duplicate - * and invalid property names are ignored and the request is - * otherwise processed normally. An empty array indicates that no - * properties should be returned. A null value indicates - * that all properties should be returned. - * @return A CloseableIterator of CIMInstances. - * @throws WBEMException - * If unsuccessful, one of the following status codes must be - * returned. The ORDERED list is: - * - * - * CIM_ERR_ACCESS_DENIED - * CIM_ERR_NOT_SUPPORTED - * CIM_ERR_INVALID_NAMESPACE - * CIM_ERR_INVALID_PARAMETER (for this method) - * CIM_ERR_INVALID_CLASS (in this namespace) - * CIM_ERR_FAILED (some other unspecified error occurred) - * - */ - public CloseableIterator enumerateInstances(CIMObjectPath pPath, boolean pDeep, - boolean pLocalOnly, boolean pIncludeClassOrigin, String[] pPropertyList) - throws WBEMException; - - /** - * enumerateInstances shall enumerate the instances of the - * specified class in pClassPath and return zero or more - * CIMInstances. - * - * @param pClassPath - * The CIMObjectPath for the class for which the - * enumeration is to be performed. - * @param pDeepInheritance - * If true, this specifies that, for each returned - * Instance of the Class, all properties of the Instance must be - * present (subject to constraints imposed by the other - * parameters), including any which were added by subclassing the - * specified Class. If false, each returned Instance - * includes only properties defined for the specified Class in - * path. - * @param pIncludeClassOrigin - * The class origin attribute is the name of the class that first - * defined the property. If true, the class origin - * attribute may be present for each property on all instances - * returned, even if requested the server may ignore the request - * and not return the class origin. If false, the - * class origin shall not be present. - * @param pPropertyList - * An array of property names used to filter what is contained in - * the Objects returned. Each CIMInstance returned - * only contains elements for the properties of the names - * specified. Duplicate and invalid property names are ignored - * and the request is otherwise processed normally. An empty - * array indicates that no properties should be included in the - * Objects returned. A null value indicates that all - * properties should be contained in the Objects returned. - * @param pFilterQueryLanguage - * The pFilterQueryLanguage represents the query - * language for the pFilterQuery argument. This must - * be left null if a pFilterQuery is - * not supplied. If the implementation does not support the query - * language specified, the - * CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED error shall - * be returned. If the implementation does not support filtered - * enumerations, the - * CIM_ERR_FILTERED_ENUMERATION_NOT_SUPPORTED error - * shall be returned. - * @param pFilterQuery - * The pFilterQuery specifies a query in the form of - * the query language specified by the - * pFilterQueryLanguage parameter. If this value is - * not null, the pFilterQueryLanguage - * parameter must be non-null. This value shall act - * as an additional filter on the result set. If the - * implementation does not support the query language specified, - * the CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED error - * shall be returned. If the implementation does not support - * filtered enumerations, the - * CIM_ERR_FILTERED_ENUMERATION_NOT_SUPPORTED error - * shall be returned. - * @param pTimeout - * This input parameter determines the minimum time the CIM - * server shall maintain the open enumeration session after the - * last Open or Pull operation (unless the enumeration session is - * closed). If the operation timeout is exceeded, the - * implementation may close the enumeration session at any time, - * releasing any resources allocated to the enumeration session. - * A pTimeout of 0 means that there is no operation - * timeout. That is, the enumeration session is never closed - * based on time. If pTimeout is null, - * the implementation shall choose an operation timeout. All - * other values for pTimeout specify the operation - * timeout in seconds. A implementation may restrict the set of - * allowable values for pTimeout. Specifically, the - * implementation may not allow 0 (no timeout). If the specified - * value is not an allowable value, the implementation shall - * return failure with the status code - * CIM_ERR_INVALID_OPERATION_TIMEOUT. - * @param pContinueOnError - * If true, requests that the operation resume when - * an error is received. If a implementation does not support - * continuation on error and pContinueOnError is - * true, it shall throw a WBEMException - * with the status code - * CIM_ERR_CONTINUATION_ON_ERROR_NOT_SUPPORTED. If a - * implementation supports continuation on error and - * pContinueOnError is true, the - * enumeration session shall remain open when a Pull operation - * fails, and any subsequent successful Pull operations shall - * return the set of elements that would have been returned if - * the failing Pull operations were successful. This behavior is - * subject to the consistency rules defined for pulled - * enumerations. If pContinueOnError is - * false, the enumeration session shall be closed - * when either the operation completes successfully or when a - * WBEMExcetpion is thrown. - * @param pMaxObjects - * Defines the maximum number of elements that this Open - * operation can return. The implementation may deliver any - * number of elements up to pMaxObjects but shall - * not deliver more than pMaxObjects elements. An - * implementation may choose to never return any elements during - * an Open operation, regardless of the value of - * pMaxObjects. Note that a CIM client can use a - * pMaxObjects value of 0 to specify that it does - * not want to retrieve any instances in the Open operation. - * @return The return value of a successful Open operation is an array of - * enumerated elements with a number of entries from 0 up to a - * maximum defined by pMaxObjects. These entries meet - * the criteria defined in the Open operation. Note that returning - * no entries in the array does not imply that the enumeration - * session is exhausted. Client must evaluate the - * EnumerateResponse.isEnd() to determine if there are - * more elements. - * @throws WBEMException - * If unsuccessful, one of the following status codes must be - * returned. The ORDERED list is: - * - * - * - * CIM_ERR_ACCESS_DENIED - * CIM_ERR_SERVER_IS_SHUTTING_DOWN - * CIM_ERR_NOT_SUPPORTED - * CIM_ERR_INVALID_NAMESPACE - * CIM_ERR_INVALID_OPERATION_TIMEOUT - * CIM_ERR_CONTINUATION_ON_ERROR_NOT_SUPPORTED - * CIM_ERR_INVALID_PARAMETER - * CIM_ERR_INVALID_CLASS (the source class does not exist) - * CIM_ERR_FILTERED_ENUMERATION_NOT_SUPPORTED - * CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED - * CIM_ERR_INVALID_QUERY - * CIM_ERR_FAILED (some other unspecified error occurred) - * - */ - public EnumerateResponse enumerateInstances(CIMObjectPath pClassPath, - boolean pDeepInheritance, boolean pIncludeClassOrigin, String[] pPropertyList, - String pFilterQueryLanguage, String pFilterQuery, UnsignedInteger32 pTimeout, - boolean pContinueOnError, UnsignedInteger32 pMaxObjects) throws WBEMException; - - /** - * Enumerates the CIM Qualifier types for a specific namespace. - * - * @param pPath - * The CIMObjectPath identifying the namespace whose - * qualifier types are to be enumerated. - * @return A CloseableIterator of CIMQualifierType - * s. - * @throws UnsupportedOperationException - * If the client implementation (or protocol) does not support - * the operation. - * @throws WBEMException - * If unsuccessful, one of the following status codes must be - * returned. The ORDERED list is: - * - * - * CIM_ERR_ACCESS_DENIED - * CIM_ERR_NOT_SUPPORTED - * CIM_ERR_INVALID_NAMESPACE - * CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized - * or otherwise incorrect parameters) - * CIM_ERR_FAILED (some other unspecified error occurred) - * - */ - public CloseableIterator> enumerateQualifierTypes(CIMObjectPath pPath) - throws WBEMException; - - /** - * enumerationCount provides an estimated count of the total - * number of objects in an open enumeration session represented by an - * enumeration context. - * - * @param pPath - * The namespace for the enumeration context. - * @param pEnumerationContext - * The enumeration context to count. - * @return The estimated number of objects. - * @throws UnsupportedOperationException - * @throws WBEMException - * If unsuccessful, one of the following status codes must be - * returned. The ORDERED list is: - * - * - * - * CIM_ERR_ACCESS_DENIED - * CIM_ERR_SERVER_IS_SHUTTING_DOWN - * CIM_ERR_NOT_SUPPORTED - * CIM_ERR_INVALID_NAMESPACE - * CIM_ERR_INVALID_PARAMETER - * CIM_ERR_INVALID_ENUMERATION_CONTEXT - * CIM_ERR_SERVER_LIMITS_EXCEEDED - * CIM_ERR_FAILED - * - * - */ - public UnsignedInteger64 enumerationCount(CIMObjectPath pPath, String pEnumerationContext) - throws WBEMException; - - /** - * execQuery shall execute a query to retrieve objects. - * - * @param pPath - * CIMObjectPath identifying the class to query. - * Only the namespace and class name components are used. All - * other information (e.g. Keys) is ignored. - * @param pQuery - * A string containing the text of the query. - * @param pQueryLanguage - * A string that identifies the query language to use to parse - * the query string specified. - * @return A CloseableIterator of CIMInstances. - * @throws WBEMException - * If unsuccessful, one of the following status codes must be - * returned. The ORDERED list is: - * - * - * CIM_ERR_ACCESS_DENIED - * CIM_ERR_NOT_SUPPORTED (provider does not support this method) - * CIM_ERR_INVALID_NAMESPACE - * CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized - * or otherwise incorrect parameters) - * CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED (the requested query language - * is not recognized) - * CIM_ERR_INVALID_QUERY (the query is not a valid query in the specified - * query language) - * CIM_ERR_FAILED (some other unspecified error occurred) - * - */ - public CloseableIterator execQuery(CIMObjectPath pPath, String pQuery, - String pQueryLanguage) throws WBEMException; - - /** - * execQueryInstances shall execute a query to retrieve - * instances. - * - * @param pObjectName - * The CIMObjectPath representing the namespace to - * be used. - * @param pFilterQuery - * The pFilterQuery specifies a query in the form of - * the query language specified by the - * pFilterQueryLanguage parameter. If this value is - * not null, the pFilterQueryLanguage - * parameter must be non-null. This value shall act - * as an additional filter on the result set. If the - * implementation does not support the query language specified, - * the CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED error - * shall be returned. If the implementation does not support - * filtered enumerations, the - * CIM_ERR_FILTERED_ENUMERATION_NOT_SUPPORTED error - * shall be returned. - * @param pFilterQueryLanguage - * The pFilterQueryLanguage represents the query - * language for the pFilterQuery argument. This must - * be left null if a pFilterQuery is - * not supplied. If the implementation does not support the query - * language specified, the - * CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED error shall - * be returned. If the implementation does not support filtered - * enumerations, the - * CIM_ERR_FILTERED_ENUMERATION_NOT_SUPPORTED error - * shall be returned. - * @param pReturnQueryResultClass - * The pReturnQueryResultClass controls whether a - * class definition is returned in pQueryResultClass - * . If it is set to false, - * pQueryResultClass shall be set to - * null on output. If it is set to true - * , the value of the pQueryResultClass on output - * shall be a class definition that defines the properties - * (columns) of each row of the query result. - * @param pTimeout - * This input parameter determines the minimum time the CIM - * server shall maintain the open enumeration session after the - * last Open or Pull operation (unless the enumeration session is - * closed). If the operation timeout is exceeded, the - * implementation may close the enumeration session at any time, - * releasing any resources allocated to the enumeration session. - * A pTimeout of 0 means that there is no operation - * timeout. That is, the enumeration session is never closed - * based on time. If pTimeout is null, - * the implementation shall choose an operation timeout. All - * other values for pTimeout specify the operation - * timeout in seconds. A implementation may restrict the set of - * allowable values for pTimeout. Specifically, the - * implementation may not allow 0 (no timeout). If the specified - * value is not an allowable value, the implementation shall - * return failure with the status code - * CIM_ERR_INVALID_OPERATION_TIMEOUT. - * @param pContinueOnError - * If true, requests that the operation resume when - * an error is received. If a implementation does not support - * continuation on error and pContinueOnError is - * true, it shall throw a WBEMException - * with the status code - * CIM_ERR_CONTINUATION_ON_ERROR_NOT_SUPPORTED. If a - * implementation supports continuation on error and - * pContinueOnError is true, the - * enumeration session shall remain open when a Pull operation - * fails, and any subsequent successful Pull operations shall - * return the set of elements that would have been returned if - * the failing Pull operations were successful. This behavior is - * subject to the consistency rules defined for pulled - * enumerations. If pContinueOnError is - * false, the enumeration session shall be closed - * when either the operation completes successfully or when a - * WBEMExcetpion is thrown. - * @param pMaxObjects - * Defines the maximum number of elements that this Open - * operation can return. The implementation may deliver any - * number of elements up to pMaxObjects but shall - * not deliver more than pMaxObjects elements. An - * implementation may choose to never return any elements during - * an Open operation, regardless of the value of - * pMaxObjects. Note that a CIM client can use a - * pMaxObjects value of 0 to specify that it does - * not want to retrieve any instances in the Open operation. - * @param pQueryResultClass - * The pQueryResultClass is an output argument. It - * shall be null if the - * pReturnQueryResultClass input parameter is set to - * false. Otherwise, it shall return a class - * definition where each property of the class corresponds to one - * entry of the query select list. The class definition - * corresponds to one row of the query result. The class name of - * this returned class shall be "CIM_QueryResult". This class - * definition is valid only in the context of this enumeration. - * @return The return value of a successful Open operation is an array of - * enumerated elements with a number of entries from 0 up to a - * maximum defined by pMaxObjects. These entries meet - * the criteria defined in the Open operation. Note that returning - * no entries in the array does not imply that the enumeration - * session is exhausted. Client must evaluate the - * EnumerateResponse.isEnd() to determine if there are - * more elements. - * @throws UnsupportedOperationException - * @throws WBEMException - * If unsuccessful, one of the following status codes must be - * returned. The ORDERED list is: - * - * - * CIM_ERR_ACCESS_DENIED - * CIM_ERR_SERVER_IS_SHUTTING_DOWN - * CIM_ERR_NOT_SUPPORTED - * CIM_ERR_INVALID_NAMESPACE - * CIM_ERR_INVALID_OPERATION_TIMEOUT - * CIM_ERR_CONTINUATION_ON_ERROR_NOT_SUPPORTED - * CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized - * or otherwise incorrect parameters) - * CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED (the requested filter query - * language is not recognized) - * CIM_ERR_INVALID_QUERY (the filter query is not a valid query in the - * specified filter query language) - * CIM_ERR_QUERY_FEATURE_NOT_SUPPORTED (the query requires support for - * features that are not supported) - * CIM_ERR_FAILED (Some other unspecified error occurred) - * - */ - public EnumerateResponse execQueryInstances(CIMObjectPath pObjectName, - String pFilterQuery, String pFilterQueryLanguage, boolean pReturnQueryResultClass, - UnsignedInteger32 pTimeout, boolean pContinueOnError, UnsignedInteger32 pMaxObjects, - CIMClass pQueryResultClass) throws WBEMException; - - /** - * Returns the CIMClass for the specified - * CIMObjectPath. - * - * @param pName - * The object path of the class to be returned. Only the name - * space and class name components are used. All other - * information (e.g. keys) is ignored. - * @param pLocalOnly - * If true, only elements (properties, methods, - * references) overridden or defined in the class are included in - * the CIMClassreturned. If false, all - * elements of the class definition are returned. - * @param pIncludeQualifiers - * If true, all Qualifiers for the class and its - * elements are included in the CIMClass returned. - * If false, no Qualifier information is contained - * in the CIMClass returned. - * @param pIncludeClassOrigin - * The class origin attribute is the name of the class that first - * defined the property or method. If true, the - * class origin attribute shall be present for each property and - * method on all returned CIMClasses. If - * false, the class origin shall not be present. - * @param pPropertyList - * An array of property names used to filter what is contained in - * the CIMClass returned. The CIMClass - * returned only contains elements for the properties of the - * names specified. Duplicate and invalid property names are - * ignored and the request is otherwise processed normally. An - * empty array indicates that no properties should be returned. A - * null value indicates that all properties should - * be returned. - * @return CIMClass meeting the criteria specified. - * @throws UnsupportedOperationException - * If the client implementation (or protocol) does not support - * the operation. - * @throws WBEMException - * If unsuccessful, one of the following status codes must be - * returned. The ORDERED list is: - * - * - * CIM_ERR_ACCESS_DENIED - * CIM_ERR_INVALID_NAMESPACE - * CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized - * or otherwise incorrect parameters) - * CIM_ERR_NOT_FOUND (the requested CIM Class does not exist in the - * specified namespace) - * CIM_ERR_FAILED (some other unspecified error occurred) - * - */ - public CIMClass getClass(CIMObjectPath pName, boolean pLocalOnly, boolean pIncludeQualifiers, - boolean pIncludeClassOrigin, String[] pPropertyList) throws WBEMException; - - /** - * Get a CIMInstance. - * - * @param pName - * The object path of the instance to be returned. The Keys in - * this CIMObjectPath must be populated. - * @param pLocalOnly - * If true, only properties overridden or defined in - * the class are included in the CIMInstance - * returned. If false, all properties of the class - * definition are returned. WBEM Servers may ignore this - * parameter and return all properties. - * @param pIncludeClassOrigin - * The class origin attribute is the name of the class that first - * defined the property. If true, the class origin - * attribute may be present for each property of the - * CIMInstance, even if requested the server may - * ignore the request and not return the class origin. If - * false, the class origin shall not be present. - * @param pPropertyList - * An array of property names used to filter what is contained in - * the CIMClass returned. The CIMClass - * returned only contains elements for the properties of the - * names specified. Duplicate and invalid property names are - * ignored and the request is otherwise processed normally. An - * empty array indicates that no properties should be returned. A - * null value indicates that all properties should - * be returned. - * @return CIMInstance identified by the - * CIMObjectPath specified. - * @throws WBEMException - * If unsuccessful, one of the following status codes must be - * returned. The ORDERED list is: - * - * - * CIM_ERR_ACCESS_DENIED - * CIM_ERR_NOT_SUPPORTED (provider does not support this method) - * CIM_ERR_INVALID_NAMESPACE - * CIM_ERR_INVALID_PARAMETER (for this method) - * CIM_ERR_INVALID_CLASS (in this namespace) - * CIM_ERR_NOT_FOUND (if instance does not exist) - * CIM_ERR_FAILED (some other unspecified error occurred) - * - */ - public CIMInstance getInstance(CIMObjectPath pName, boolean pLocalOnly, - boolean pIncludeClassOrigin, String[] pPropertyList) throws WBEMException; - - /** - * getInstancePaths shall get the CIMObjectPaths - * using an enumeration context. - * - * @param pPath - * The CIMObjectPath representing the namespace to - * be used. - * @param pContext - * The enumeration context value for the enumeration session to - * be used. - * @param pMaxObjects - * Defines the maximum number of elements that this Open - * operation can return. The implementation may deliver any - * number of elements up to pMaxObjects but shall - * not deliver more than pMaxObjects elements. An - * implementation may choose to never return any elements during - * an Open operation, regardless of the value of - * pMaxObjects. - * @return EnumerateResponse that includes zero or more - * CIMObjectPath objects. - * @throws WBEMException - * If unsuccessful, one of the following status codes must be - * returned. The ORDERED list is: - * - * - * - * CIM_ERR_ACCESS_DENIED - * CIM_ERR_SERVER_IS_SHUTTING_DOWN - * CIM_ERR_NOT_SUPPORTED - * CIM_ERR_INVALID_NAMESPACE - * CIM_ERR_INVALID_PARAMETER - * CIM_ERR_INVALID_ENUMERATION_CONTEXT - * CIM_ERR_SERVER_LIMITS_EXCEEDED - * CIM_ERR_PULL_HAS_BEEN_ABANDONED - * CIM_ERR_FAILED (some other unspecified error occurred) - * - */ - public EnumerateResponse getInstancePaths(CIMObjectPath pPath, String pContext, - UnsignedInteger32 pMaxObjects) throws WBEMException; - - /** - * getInstances shall get the instances from an enumeration - * session started by execQueryInstances. - * - * @param pPath - * The CIMObjectPath representing the namespace to - * be used. - * @param pContext - * The enumeration context value for the enumeration session to - * be used. - * @param pMaxObjects - * Defines the maximum number of elements that this Open - * operation can return. The implementation may deliver any - * number of elements up to pMaxObjects but shall - * not deliver more than pMaxObjects elements. An - * implementation may choose to never return any elements during - * an Open operation, regardless of the value of - * pMaxObjects. Note that a CIM client can use a - * pMaxObjects value of 0 to specify that it does - * not want to retrieve any instances in the Open operation. - * @return EnumerateResponse that includes zero or more - * CIMObjectPath objects. - * @throws WBEMException - * If unsuccessful, one of the following status codes must be - * returned. The ORDERED list is: - * - * - * - * CIM_ERR_ACCESS_DENIED - * CIM_ERR_SERVER_IS_SHUTTING_DOWN - * CIM_ERR_NOT_SUPPORTED - * CIM_ERR_INVALID_NAMESPACE - * CIM_ERR_INVALID_PARAMETER - * CIM_ERR_INVALID_ENUMERATION_CONTEXT - * CIM_ERR_SERVER_LIMITS_EXCEEDED - * CIM_ERR_PULL_HAS_BEEN_ABANDONED - * CIM_ERR_FAILED - * - */ - public EnumerateResponse getInstances(CIMObjectPath pPath, String pContext, - UnsignedInteger32 pMaxObjects) throws WBEMException; - - /** - * getInstancesWithPath shall use the enumeration context - * provided to get the next set of instances for the enumeration session. - * - * @param pPath - * The CIMObjectPath representing the namespace to - * be used. - * @param pContext - * The enumeration context value for the enumeration session to - * be used. - * @param pMaxObjects - * Defines the maximum number of elements that this Open - * operation can return. The implementation may deliver any - * number of elements up to pMaxObjects but shall - * not deliver more than pMaxObjects elements. An - * implementation may choose to never return any elements during - * an Open operation, regardless of the value of - * pMaxObjects. - * @return EnumerateResponse that includes zero or more - * CIMObjectPath. objects. - * @throws WBEMException - * If unsuccessful, one of the following status codes must be - * returned. The ORDERED list is: - * - * - * - * CIM_ERR_ACCESS_DENIED - * CIM_ERR_SERVER_IS_SHUTTING_DOWN - * CIM_ERR_NOT_SUPPORTED - * CIM_ERR_INVALID_NAMESPACE - * CIM_ERR_INVALID_PARAMETER - * CIM_ERR_INVALID_ENUMERATION_CONTEXT - * CIM_ERR_SERVER_LIMITS_EXCEEDED - * CIM_ERR_PULL_HAS_BEEN_ABANDONED - * CIM_ERR_FAILED (some other unspecified error occurred) - * - */ - public EnumerateResponse getInstancesWithPath(CIMObjectPath pPath, - String pContext, UnsignedInteger32 pMaxObjects) throws WBEMException; - - /** - * Get property values. See WBEMClientConstants for a list of - * standard properties. - * - * @param pKey - * The name of the property. - * @return The value of the property. - * @see WBEMClientConstants - */ - public String getProperty(String pKey); - - /** - * Get a CIMQualifierType. - * - * @param pName - * CIMObjectPath that identifies the - * CIMQualifierType to return. - * @return The CIMQualifierType object. - * @throws UnsupportedOperationException - * If the client implementation (or protocol) does not support - * the operation. - * @throws WBEMException - * If unsuccessful, one of the following status codes must be - * returned. The ORDERED list is: - * - * - * CIM_ERR_ACCESS_DENIED - * CIM_ERR_NOT_SUPPORTED - * CIM_ERR_INVALID_NAMESPACE - * CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized - * or otherwise incorrect parameters) - * CIM_ERR_NOT_FOUND (the requested Qualifier declaration did not exist) - * CIM_ERR_FAILED (some other unspecified error occurred) - * - */ - public CIMQualifierType getQualifierType(CIMObjectPath pName) throws WBEMException; - - /** - * Initialize the client connection. This must be called before any - * operations. This must only be called once. - * - * @param pName - * The protocol and host to use (e.g. http://192.168.1.128/). Any - * other fields shall be ignored. - * @param pSubject - * The principal/credential pairs for this connection. - * @param pLocales - * An array of locales in order of priority of preference. - * @throws IllegalArgumentException - * If the host or scheme portion of the object path is null, or - * if the protocol is not supported. - * @throws WBEMException - * If the protocol adapter or security cannot be initialized. - */ - public void initialize(CIMObjectPath pName, Subject pSubject, Locale[] pLocales) - throws IllegalArgumentException, WBEMException; - - /** - * Executes the specified method on the specified object. - * - * @param pName - * CIM object path of the object whose method must be invoked. It - * must include all of the keys. - * @param pMethodName - * The name of the method to be invoked. - * @param pInputArguments - * The CIMArgument array of method input parameters. - *

      - * @param pOutputArguments - * The CIMArgument array of method output - * parameters. The array should be allocated large enough to hold - * all returned parameters. - * @return The return value of the specified method. - * @throws WBEMException - * If unsuccessful, one of the following status codes must be - * returned. The ORDERED list is: - * - * - * CIM_ERR_ACCESS_DENIED - * CIM_ERR_NOT_SUPPORTED (implementation DOES NOT support ANY - * Extrinsic Method Invocation) - * CIM_ERR_INVALID_NAMESPACE - * CIM_ERR_INVALID_PARAMETER (for this method) - * CIM_ERR_NOT_FOUND (if instance does not exist) - * CIM_ERR_METHOD_NOT_FOUND - * CIM_ERR_METHOD_NOT_AVAILABLE - * CIM_ERR_FAILED (some other unspecified error occurred) - * - */ - public Object invokeMethod(CIMObjectPath pName, String pMethodName, - CIMArgument[] pInputArguments, CIMArgument[] pOutputArguments) - throws WBEMException; - - /** - * Modify the CIMClass. - * - * @param pClass - * CIMClass to be modified. - * @throws UnsupportedOperationException - * If the client implementation (or protocol) does not support - * the operation. - * @throws WBEMException - * If unsuccessful, one of the following status codes must be - * returned. The ORDERED list is: - * - * - * CIM_ERR_ACCESS_DENIED - * CIM_ERR_NOT_SUPPORTED - * CIM_ERR_INVALID_NAMESPACE - * CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized - * or otherwise incorrect parameters) - * CIM_ERR_INVALID_SUPERCLASS (the putative CIM Class declares a - * non-existent superclass) - * CIM_ERR_CLASS_HAS_CHILDREN (the modification could not be performed - * because it was not possible to update the subclasses of the Class - * in a consistent fashion) - * CIM_ERR_CLASS_HAS_INSTANCES (the modification could not be performed - * because it was not possible to update the instances of the Class in - * a consistent fashion) - * CIM_ERR_FAILED (some other unspecified error occurred) - * - */ - public void modifyClass(CIMClass pClass) throws WBEMException; - - /** - * Modify some or all of the properties of the specified - * CIMInstance. - * - * @param pInstance - * CIMInstance to be modified. All Keys must be - * populated. - * @param pPropertyList - * An array of property names used to specify which values from - * the CIMInstance specified to set. Properties not - * specified in this list but set in the CIMInstance - * specified are not modified. Duplicate property names are - * ignored and the request is otherwise processed normally. If - * the pPropertyList contains invalid property names - * for the instance to be modified, the server shall reject the - * request. An empty array indicates that no properties should be - * modified. A null value indicates that all - * properties should be modified. - * @throws WBEMException - * If unsuccessful, one of the following status codes must be - * returned. The ORDERED list is: - * - * - * CIM_ERR_ACCESS_DENIED - * CIM_ERR_NOT_SUPPORTED (provider does not support this method) - * CIM_ERR_INVALID_NAMESPACE - * CIM_ERR_INVALID_PARAMETER (for this method) - * CIM_ERR_INVALID_CLASS (in this namespace) - * CIM_ERR_NOT_FOUND (if instance does not exist) - * CIM_ERR_NO_SUCH_PROPERTY (in this instance) - * CIM_ERR_FAILED (some other unspecified error occurred) - * - */ - public void modifyInstance(CIMInstance pInstance, String[] pPropertyList) throws WBEMException; - - /** - * Enumerates the Association classes that refer to a specified source CIM - * Class. - * - * @param pObjectName - * CIMObjectPath defining the source CIM class whose - * referring classes are to be returned. pObjectName - * shall contain the scheme, host, namespace and object name - * (class name). - * @param pResultClass - * This string shall either contain a valid CIM Class name or be - * null. The pResultClass filters the - * classes returned to contain only the classes of this Class - * name or one of its subclasses. - * @param pRole - * This string MUST either contain a valid Property name or be - * null. It filters the Objects returned to contain - * only Objects referring to the source Object via a Property - * with the specified name. If "Antecedent" is specified, then - * only Associations in which the source Object is the - * "Antecedent" reference are returned. - * @param pIncludeQualifiers - * If true, all Qualifiers for each Object - * (including Qualifiers on the Object and on any returned - * Properties) shall be included in the classes returned. If - * false, no Qualifiers shall be present in each - * class returned. - * @param pIncludeClassOrigin - * The class origin attribute is the name of the class that first - * defined the property or method. If true, the - * class Origin attribute shall be present for each property and - * method on all classes returned. If false, the - * class origin shall not be present. - * @param pPropertyList - * An array of property names used to filter what is contained in - * the Objects returned. Each CIMClass returned - * shall only contains elements for the properties of the names - * specified. Duplicate and invalid property names are ignored - * and the request is otherwise processed normally. An empty - * array indicates that no properties should be included in the - * classes returned. A null value indicates that all - * properties should be contained in the classes returned. - * @return If successful, a CloseableIterator referencing zero - * or more CIMClasses meeting the specified criteria. - * @throws UnsupportedOperationException - * If the client implementation (or protocol) does not support - * the operation. - * @throws WBEMException - * If unsuccessful, one of the following status codes shall be - * returned along with zero or more instance of - * CIM_Error. The ORDERED list is: - * - * - * CIM_ERR_ACCESS_DENIED - * CIM_ERR_NOT_SUPPORTED - * CIM_ERR_INVALID_NAMESPACE - * CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized - * or otherwise incorrect parameters) - * CIM_ERR_FAILED (some other unspecified error occurred) - * - */ - - CloseableIterator referenceClasses(CIMObjectPath pObjectName, String pResultClass, - String pRole, boolean pIncludeQualifiers, boolean pIncludeClassOrigin, - String[] pPropertyList) throws WBEMException; - - /** - * Enumerates the Association instances that refer to a specified source CIM - * Instance. - * - * @param pObjectName - * CIMObjectPath defining the source CIM Instance - * whose referring instances are to be returned. The - * pObjectName shall include the host, object name - * and keys. - * @param pResultClass - * This string shall either contain a valid CIM Class name or be - * null. It filters the instances returned to - * contain only the instances of this Class name or one of its - * subclasses. - * @param pRole - * This string shall either contain a valid Property name or be - * null. The role filters the instances returned to - * contain only instances referring to the source instance via a - * property with the specified name. For example, If "Antecedent" - * is specified, then only Associations in which the source - * instance is the "Antecedent" reference are returned. - * @param pIncludeClassOrigin - * The class origin attribute is the name of the class that first - * defined the property. If true, the class origin - * attribute may be present for each property and on all - * instances returned, even if requested the server may ignore - * the request and not return the class origin. If - * false, the class origin shall not be present. - * @param pPropertyList - * An array of property names used to filter what is contained in - * the instances returned. Each CIMInstance returned - * shall only contain elements for the properties of the names - * specified. Duplicate and invalid property names are ignored - * and the request is otherwise processed normally. An empty - * array indicates that no properties should be included in the - * instances returned. A null value indicates that - * all properties supported shall be contained in the instance - * returned. - * @return If successful, a CloseableIterator referencing zero - * or more CIMInstances meeting the specified criteria. - * @throws WBEMException - * If unsuccessful, one of the following status codes shall be - * returned along with zero or more CIM_Error - * instances. The ORDERED list is: - * - * - * CIM_ERR_ACCESS_DENIED - * CIM_ERR_NOT_SUPPORTED - * CIM_ERR_INVALID_NAMESPACE - * CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized - * or otherwise incorrect parameters) - * CIM_ERR_FAILED (some other unspecified error occurred) - * - */ - CloseableIterator referenceInstances(CIMObjectPath pObjectName, - String pResultClass, String pRole, boolean pIncludeClassOrigin, String[] pPropertyList) - throws WBEMException; - - /** - * Enumerates the CIMObjectPaths of Association Objects that - * refer to a particular source CIM Object. If the source Object is a CIM - * Class, then a CloseableIterator of - * CIMObjectPaths of the Association classes that refer to the - * source Object is returned. If the source Object is a CIM Instance, then a - * CloseableIterator of CIMObjectPaths of the - * CIMInstance objects that refer to the source Object is - * returned. - * - * @param pObjectName - * CIMObjectPath defining the source CIM Object - * whose referring Objects are to be returned. This argument may - * contain either a Class name or the modelpath of an Instance. - * (i.e. Keys populated) - * @param pResultClass - * This string MUST either contain a valid CIM Class name or be - * null. It filters the Objects returned to contain - * only the Objects of this Class name or one of its subclasses. - * @param pRole - * This string MUST either contain a valid Property name or be - * null. It filters the Objects returned to contain - * only Objects referring to the source Object via a Property - * with the specified name. If "Antecedent" is specified, then - * only Associations in which the source Object is the - * "Antecedent" reference are returned. - * @return If successful, a CloseableIterator referencing zero - * or more CIMObjectPaths of CIMClasses or - * CIMInstances meeting the specified criteria. - * @throws WBEMException - * If unsuccessful, one of the following status codes must be - * returned. The ORDERED list is: - * - * - * CIM_ERR_ACCESS_DENIED - * CIM_ERR_NOT_SUPPORTED - * CIM_ERR_INVALID_NAMESPACE - * CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized - * or otherwise incorrect parameters) - * CIM_ERR_FAILED (some other unspecified error occurred) - * - */ - public CloseableIterator referenceNames(CIMObjectPath pObjectName, - String pResultClass, String pRole) throws WBEMException; - - /** - * referencePaths shall start an enumeration session for - * association instances that have references that refer to the instance - * defined in the pInstancePath parameter and return zero or - * more CIMObjectPath objects. - * - * @param pInstancePath - * The CIMObjectPath for the instance for which the - * enumeration is to be performed. - * @param pResultClass - * This string MUST either contain a valid CIM Class name or be - * null. It filters the Objects returned to contain - * only the Objects of this Class name or one of its subclasses. - * @param pRole - * This string MUST either contain a valid Property name or be - * null. It filters the Objects returned to contain - * only Objects referring to the source Object via a Property - * with the specified name. If "Antecedent" is specified, then - * only Associations in which the source Object is the - * "Antecedent" reference are returned. - * @param pFilterQueryLanguage - * The pFilterQueryLanguage represents the query - * language for the pFilterQuery argument. This must - * be left null if a pFilterQuery is - * not supplied. If the implementation does not support the query - * language specified, the - * CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED error shall - * be returned. If the implementation does not support filtered - * enumerations, the - * CIM_ERR_FILTERED_ENUMERATION_NOT_SUPPORTED error - * shall be returned. - * @param pFilterQuery - * The pFilterQuery specifies a query in the form of - * the query language specified by the - * pFilterQueryLanguage parameter. If this value is - * not null, the pFilterQueryLanguage - * parameter must be non-null. This value shall act - * as an additional filter on the result set. If the - * implementation does not support the query language specified, - * the CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED error - * shall be returned. If the implementation does not support - * filtered enumerations, the - * CIM_ERR_FILTERED_ENUMERATION_NOT_SUPPORTED error - * shall be returned. - * @param pTimeout - * This input parameter determines the minimum time the CIM - * server shall maintain the open enumeration session after the - * last Open or Pull operation (unless the enumeration session is - * closed). If the operation timeout is exceeded, the - * implementation may close the enumeration session at any time, - * releasing any resources allocated to the enumeration session. - * A pTimeout of 0 means that there is no operation - * timeout. That is, the enumeration session is never closed - * based on time. If pTimeout is null, - * the implementation shall choose an operation timeout. All - * other values for pTimeout specify the operation - * timeout in seconds. A implementation may restrict the set of - * allowable values for pTimeout. Specifically, the - * implementation may not allow 0 (no timeout). If the specified - * value is not an allowable value, the implementation shall - * return failure with the status code - * CIM_ERR_INVALID_OPERATION_TIMEOUT. - * @param pContinueOnError - * If true, requests that the operation resume when - * an error is received. If a implementation does not support - * continuation on error and pContinueOnError is - * true, it shall throw a WBEMException - * with the status code - * CIM_ERR_CONTINUATION_ON_ERROR_NOT_SUPPORTED. If a - * implementation supports continuation on error and - * pContinueOnError is true, the - * enumeration session shall remain open when a Pull operation - * fails, and any subsequent successful Pull operations shall - * return the set of elements that would have been returned if - * the failing Pull operations were successful. This behavior is - * subject to the consistency rules defined for pulled - * enumerations. If pContinueOnError is - * false, the enumeration session shall be closed - * when either the operation completes successfully or when a - * WBEMExcetpion is thrown. - * @param pMaxObjects - * Defines the maximum number of elements that this Open - * operation can return. The implementation may deliver any - * number of elements up to pMaxObjects but shall - * not deliver more than pMaxObjects elements. An - * implementation may choose to never return any elements during - * an Open operation, regardless of the value of - * pMaxObjects. Note that a CIM client can use a - * pMaxObjects value of 0 to specify that it does - * not want to retrieve any instances in the Open operation. - * @return The return value of a successful Open operation is an array of - * enumerated elements with a number of entries from 0 up to a - * maximum defined by pMaxObjects. These entries meet - * the criteria defined in the Open operation. Note that returning - * no entries in the array does not imply that the enumeration - * session is exhausted. Client must evaluate the - * EnumerateResponse.isEnd() to determine if there are - * more elements. - * @throws WBEMException - * If unsuccessful, one of the following status codes must be - * returned. The ORDERED list is: - * - * - * - * CIM_ERR_ACCESS_DENIED - * CIM_ERR_SERVER_IS_SHUTTING_DOWN - * CIM_ERR_NOT_SUPPORTED - * CIM_ERR_INVALID_NAMESPACE - * CIM_ERR_INVALID_OPERATION_TIMEOUT - * CIM_ERR_CONTINUATION_ON_ERROR_NOT_SUPPORTED - * CIM_ERR_INVALID_PARAMETER - * CIM_ERR_NOT_FOUND (the source instance was not found) - * CIM_ERR_FILTERED_ENUMERATION_NOT_SUPPORTED - * CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED - * CIM_ERR_INVALID_QUERY - * CIM_ERR_FAILED (some other unspecified error occurred) - * - */ - public EnumerateResponse referencePaths(CIMObjectPath pInstancePath, - String pResultClass, String pRole, String pFilterQueryLanguage, String pFilterQuery, - UnsignedInteger32 pTimeout, boolean pContinueOnError, UnsignedInteger32 pMaxObjects) - throws WBEMException; - - /** - * references shall start an enumeration session for - * association instances that have references that refer to the instance - * defined in the pInstancePath parameter and return zero or - * more CIMInstance objects. - * - * @param pInstancePath - * The CIMObjectPath for the instance for which the - * enumeration is to be performed. - * @param pResultClass - * This string shall either contain a CIM Class name or be - * null. It filters the instances returned to - * contain only the instances of this Class name or one of its - * subclasses. - * @param pRole - * This string shall either contain a Property name or be - * null. It filters the instances returned to - * contain only instances referring to the source instance via a - * Property with the specified name. If "Antecedent" is - * specified, then only Associations in which the source instance - * is the "Antecedent" reference are returned. - * @param pIncludeClassOrigin - * The class origin attribute is the name of the class that first - * defined the property. If true, the class origin - * attribute may be present for each property on all instances - * returned, even if requested the server may ignore the request - * and not return the class origin. If false, the - * class origin shall not be present. - * @param pPropertyList - * An array of property names used to filter what is contained in - * the instances returned. Each CIMInstance returned - * only contains elements for the properties of the names - * specified. Duplicate and invalid property names are ignored - * and the request is otherwise processed normally. An empty - * array indicates that no properties should be included in the - * Objects returned. A null value indicates that all - * non-null properties of the instance are included. - * @param pFilterQueryLanguage - * The pFilterQueryLanguage represents the query - * language for the pFilterQuery argument. This must - * be left null if a pFilterQuery is - * not supplied. If the implementation does not support the query - * language specified, the - * CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED error shall - * be returned. If the implementation does not support filtered - * enumerations, the - * CIM_ERR_FILTERED_ENUMERATION_NOT_SUPPORTED error - * shall be returned. - * @param pFilterQuery - * The pFilterQuery specifies a query in the form of - * the query language specified by the - * pFilterQueryLanguage parameter. If this value is - * not null, the pFilterQueryLanguage - * parameter must be non-null. This value shall act - * as an additional filter on the result set. If the - * implementation does not support the query language specified, - * the CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED error - * shall be returned. If the implementation does not support - * filtered enumerations, the - * CIM_ERR_FILTERED_ENUMERATION_NOT_SUPPORTED error - * shall be returned. - * @param pTimeout - * This input parameter determines the minimum time the CIM - * server shall maintain the open enumeration session after the - * last Open or Pull operation (unless the enumeration session is - * closed). If the operation timeout is exceeded, the - * implementation may close the enumeration session at any time, - * releasing any resources allocated to the enumeration session. - * A pTimeout of 0 means that there is no operation - * timeout. That is, the enumeration session is never closed - * based on time. If pTimeout is null, - * the implementation shall choose an operation timeout. All - * other values for pTimeout specify the operation - * timeout in seconds. A implementation may restrict the set of - * allowable values for pTimeout. Specifically, the - * implementation may not allow 0 (no timeout). If the specified - * value is not an allowable value, the implementation shall - * return failure with the status code - * CIM_ERR_INVALID_OPERATION_TIMEOUT. - * @param pContinueOnError - * If true, requests that the operation resume when - * an error is received. If a implementation does not support - * continuation on error and pContinueOnError is - * true, it shall throw a WBEMException - * with the status code - * CIM_ERR_CONTINUATION_ON_ERROR_NOT_SUPPORTED. If a - * implementation supports continuation on error and - * pContinueOnError is true, the - * enumeration session shall remain open when a Pull operation - * fails, and any subsequent successful Pull operations shall - * return the set of elements that would have been returned if - * the failing Pull operations were successful. This behavior is - * subject to the consistency rules defined for pulled - * enumerations. If pContinueOnError is - * false, the enumeration session shall be closed - * when either the operation completes successfully or when a - * WBEMExcetpion is thrown. - * @param pMaxObjects - * Defines the maximum number of elements that this Open - * operation can return. The implementation may deliver any - * number of elements up to pMaxObjects but shall - * not deliver more than pMaxObjects elements. An - * implementation may choose to never return any elements during - * an Open operation, regardless of the value of - * pMaxObjects. Note that a CIM client can use a - * pMaxObjects value of 0 to specify that it does - * not want to retrieve any instances in the Open operation. - * @return The return value of a successful Open operation is an array of - * enumerated elements with a number of entries from 0 up to a - * maximum defined by pMaxObjects. These entries meet - * the criteria defined in the Open operation. Note that returning - * no entries in the array does not imply that the enumeration - * session is exhausted. Client must evaluate the - * EnumerateResponse.isEnd() to determine if there are - * more elements. - * @throws WBEMException - * If unsuccessful, one of the following status codes must be - * returned. The ORDERED list is: - * - * - * CIM_ERR_ACCESS_DENIED - * CIM_ERR_SERVER_IS_SHUTTING_DOWN - * CIM_ERR_NOT_SUPPORTED - * CIM_ERR_INVALID_NAMESPACE - * CIM_ERR_INVALID_OPERATION_TIMEOUT - * CIM_ERR_CONTINUATION_ON_ERROR_NOT_SUPPORTED - * CIM_ERR_INVALID_PARAMETER - * CIM_ERR_NOT_FOUND (the source instance was not found) - * CIM_ERR_FILTERED_ENUMERATION_NOT_SUPPORTED - * CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED - * CIM_ERR_INVALID_QUERY - * CIM_ERR_FAILED (some other unspecified error occurred) - * - */ - public EnumerateResponse references(CIMObjectPath pInstancePath, - String pResultClass, String pRole, boolean pIncludeClassOrigin, String[] pPropertyList, - String pFilterQueryLanguage, String pFilterQuery, UnsignedInteger32 pTimeout, - boolean pContinueOnError, UnsignedInteger32 pMaxObjects) throws WBEMException; - - /** - * Change the locales that were provided during initialization. - * - * @param pLocales - * An array of locales in order of priority of preference. - */ - public void setLocales(Locale[] pLocales); - - /** - * Set properties that enable options or protocol specific properties. See - * WBEMClientConstants for a list of standard properties. - * - * @param pKey - * The name of the property. - * @param pValue - * The value of the property. - * @throws IllegalArgumentException - * If the name is not a supported property name. - * @see WBEMClientConstants - */ - public void setProperty(String pKey, String pValue); - - /** - * Add a CIMQualifierType to the specified namespace if it does - * not already exist. Otherwise, it modifies the qualifier type to the value - * specified. - * - * @param pQualifierType - * The CIM qualifier type to be added. - * @throws UnsupportedOperationException - * If the client implementation (or protocol) does not support - * the operation. - * @throws WBEMException - * If unsuccessful, one of the following status codes must be - * returned. The ORDERED list is: - * - * - * CIM_ERR_ACCESS_DENIED - * CIM_ERR_NOT_SUPPORTED - * CIM_ERR_INVALID_NAMESPACE - * CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized - * or otherwise incorrect parameters) - * CIM_ERR_FAILED (some other unspecified error occurred) - * - */ - public void setQualifierType(CIMQualifierType pQualifierType) throws WBEMException; -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Alexander Wolf-Reber, a.wolf-reber@de.ibm.com + * + * Change History + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-11-08 lupusalex Make SBLIM client JSR48 compliant + * 1686000 2007-04-19 ebak modifyInstance() missing from WBEMClient + * 1737141 2007-06-18 ebak Sync up with JSR48 evolution + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors + * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics + * 2845211 2009-08-27 raman_arora Pull Enumeration Feature (SAX Parser) + * 2858933 2009-10-12 raman_arora JSR48 new APIs: associatorClasses & associatorInstances + * 2886829 2009-11-18 raman_arora JSR48 new APIs: referenceClasses & referenceInstances + * 2959586 2010-03-01 blaschke-oss Sync up WBEMClient javadoc with JSR48 1.0.0 + * 2961592 2010-03-01 blaschke-oss Remove WBEMClient.setLocales() UnsupportedOperationException + * 3496301 2012-03-02 blaschke-oss Sync up javax.* javadoc with JSR48 1.0.0 Final + * 3496343 2012-03-02 blaschke-oss JSR48 1.0.0: deprecate WBEMClient associators and references + * 3514537 2012-04-03 blaschke-oss TCK: execQueryInstances requires boolean, not Boolean + * 3521131 2012-04-24 blaschke-oss Sync up javax.* javadoc with JSR48 1.0.0 Final II + * 3521328 2012-04-25 blaschke-oss JSR48 1.0.0: remove WBEMClient associators and references + * 3525657 2012-05-10 blaschke-oss Sync up javax.* javadoc with JSR48 1.0.0 Final III + * 3555752 2012-09-13 blaschke-oss Sync up javax.* javadoc with JSR48 1.0.0 Final IV + * 2716 2013-12-11 blaschke-oss Sync up javax.* javadoc with JSR48 1.0.0 Final V + */ + +package org.metricshub.wbem.javax.wbem.client; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.Locale; + +import org.metricshub.wbem.javax.cim.CIMArgument; +import org.metricshub.wbem.javax.cim.CIMClass; +import org.metricshub.wbem.javax.cim.CIMInstance; +import org.metricshub.wbem.javax.cim.CIMObjectPath; +import org.metricshub.wbem.javax.cim.CIMQualifierType; +import org.metricshub.wbem.javax.wbem.CloseableIterator; +import org.metricshub.wbem.javax.wbem.WBEMException; +import org.metricshub.wbem.javax.cim.UnsignedInteger32; +import org.metricshub.wbem.javax.cim.UnsignedInteger64; +import javax.security.auth.Subject; + +//Sync'd against JSR48 1.0.0 javadoc (version 1.7.0_03) on Tue Dec 10 07:02:50 EST 2013 +/** + * The WBEMClient interface is used to invoke WBEM operations + * against a WBEM Server. A WBEMClient implementation can be + * retrieved from the WBEMClientFactory specifying the protocol to + * be used. + * + * @see WBEMClientFactory + */ +public interface WBEMClient { + + /** + * Enumerates CIM classes that are associated to a specified source CIM + * class. + * + * @param pObjectName + * CIMObjectPath defining the source CIM Class whose + * associated classes are to be returned. The + * pObjectName shall include the host, namespace and + * object name. The keys shall not be populated. + * @param pAssociationClass + * This string shall contain a valid CIM Association class name + * or be null. It filters the classes returned to + * contain only classes associated to the source Object via this + * CIM Association class or one of its subclasses. + * @param pResultClass + * This string shall either contain a valid CIM Class name or be + * null. It filters the classes returned to contain + * only the classes of this class name or one of its subclasses. + * @param pRole + * This string shall either contain a valid Property name or be + * null. It filters the classes returned to contain + * only classes associated to the source class via an Association + * class in which the source class plays the specified + * role. (i.e. the Property name in the Association class that + * refers to the source class matches this value) For + * example, if "Antecedent" is specified, then only Associations + * in which the source class is the "Antecedent" reference are + * examined. + * @param pResultRole + * This string shall either contain a valid Property name or be + * null. It filters the classes returned to contain + * only classes associated to the source class via an Association + * class in which the class returned plays the specified + * role. (i.e. the Property name in the Association class that + * refers to the class returned matches this value) + * @param pIncludeQualifiers + * If true, all Qualifiers for each class (including + * Qualifiers on the Object and on any returned Properties) MUST + * be included in the classes returned. If false, no + * Qualifiers are present in each class returned. + * @param pIncludeClassOrigin + * The class origin attribute is the name of the class that first + * defined the property or method. If true, the + * class origin attribute shall be present for each property and + * method on all classes returned. If false, the + * class origin shall not be present. + * @param pPropertyList + * An array of property names used to filter what is contained in + * the classes returned. Each CIMClass returned + * shall only contain elements for the properties of the names + * specified. Duplicate and invalid property names are ignored + * and the request is otherwise processed normally. An empty + * array indicates that no properties should be included in the + * classes returned. A null value indicates that all + * properties should be contained in the classes returned. + * @return If successful, a CloseableIterator containing zero + * or more CIMClasses meeting the specified criteria + * are returned. + * @throws UnsupportedOperationException + * If the client implementation (or protocol) does not support + * the operation. + * @throws WBEMException + * If unsuccessful, one of the following status codes shall be + * returned along with zero or more instances of + * CIM_Error. The ORDERED list is: + * + * + * CIM_ERR_ACCESS_DENIED + * CIM_ERR_NOT_SUPPORTED + * CIM_ERR_INVALID_NAMESPACE + * CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized + * or otherwise incorrect parameters) + * CIM_ERR_FAILED (some other unspecified error occurred) + * + */ + public CloseableIterator associatorClasses(CIMObjectPath pObjectName, + String pAssociationClass, String pResultClass, String pRole, String pResultRole, + boolean pIncludeQualifiers, boolean pIncludeClassOrigin, String[] pPropertyList) + throws WBEMException; + + /** + * Enumerates CIM Instances associated to a specified source CIM Instance. + * + * @param pObjectName + * CIMObjectPath defining the source CIM Instance + * whose associated instances are to be returned. The + * pObjectName must contain the host, namespace, + * object name and keys for the instance. + * @param pAssociationClass + * This string shall either contain a valid CIM Association class + * name or be null. It filters the instances + * returned to contain only instances associated to the source + * instance via this CIM Association class or one of its + * subclasses. + * @param pResultClass + * This string shall either contain a valid CIM Class name or be + * null. It filters the instances returned to + * contain only the instances of this Class name or one of its + * subclasses. + * @param pRole + * This string shall either contain a valid Property name or be + * null. It filters the Objects returned to contain + * only Objects associated to the source Object via an + * Association class in which the source Object plays the + * specified role. (i.e. the Property name in the Association + * class that refers to the source Object matches this + * value) If "Antecedent" is specified, then only Associations in + * which the source Object is the "Antecedent" reference are + * examined. + * @param pResultRole + * This string shall either contain a valid Property name or be + * null. It filters the instances returned to + * contain only instances associated to the source instance via + * an Association class in which the instance returned + * plays the specified role. (i.e. the Property name in the + * Association class that refers to the instance returned + * matches this value) For example, if "Dependent" is specified, + * then only Associations in which the instance returned is the + * "Dependent" reference are examined. + * @param pIncludeClassOrigin + * The class origin attribute is the name of the class that first + * defined the property. If true, the class origin + * attribute may be present for each property on all instances + * returned, even if requested the server may ignore the request + * and not return the class origin. If false, the + * class origin shall not be present. + * @param pPropertyList + * An array of property names used to filter what is contained in + * the Objects returned. Each CIMInstance returned + * only contains elements for the properties of the names + * specified. Duplicate and invalid property names are ignored + * and the request is otherwise processed normally. An empty + * array indicates that no properties should be included in the + * instances returned. A null value indicates that + * all properties should be contained in the instances returned. + * @return If successful, a CloseableIterator containing zero + * or more CIMInstances meeting the specified criteria + * is returned. + * @throws WBEMException + * If unsuccessful, one of the following status codes shall be + * returned along with zero or more instances of + * CIM_Error. The ORDERED list is: + * + * + * CIM_ERR_ACCESS_DENIED + * CIM_ERR_NOT_SUPPORTED + * CIM_ERR_INVALID_NAMESPACE + * CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized + * or otherwise incorrect parameters) + * CIM_ERR_FAILED (some other unspecified error occurred) + * + */ + public CloseableIterator associatorInstances(CIMObjectPath pObjectName, + String pAssociationClass, String pResultClass, String pRole, String pResultRole, + boolean pIncludeClassOrigin, String[] pPropertyList) throws WBEMException; + + /** + * Enumerates the CIMObjectPaths of CIM Objects that are + * associated to a particular source CIM Object. If the source Object is a + * CIM Class, then a CloseableIterator of + * CIMObjectPath s of the classes associated to the source + * Object is returned. If the source Object is a CIM Instance, then a + * CloseableIterator of CIMObjectPaths of the + * CIMInstance objects associated to the source Object is + * returned. + * + * @param pObjectName + * CIMObjectPath defining the source CIM Object + * whose associated Objects are to be returned. This argument may + * contain either a Class name or the modelpath of an Instance. + * (i.e. Keys populated) + * @param pAssociationClass + * This string MUST either contain a valid CIM Association class + * name or be null. It filters the Objects returned + * to contain only Objects associated to the source Object via + * this CIM Association class or one of its subclasses. + * @param pResultClass + * This string MUST either contain a valid CIM Class name or be + * null. It filters the Objects returned to contain + * only the Objects of this Class name or one of its subclasses. + * @param pRole + * This string MUST either contain a valid Property name or be + * null. It filters the Objects returned to contain + * only Objects associated to the source Object via an + * Association class in which the source Object plays the + * specified role. (i.e. the Property name in the Association + * class that refers to the source Object matches this + * value) If "Antecedent" is specified, then only Associations in + * which the source Object is the "Antecedent" reference are + * examined. + * @param pResultRole + * This string MUST either contain a valid Property name or be + * null. It filters the Objects returned to contain + * only Objects associated to the source Object via an + * Association class in which the Object returned plays + * the specified role. (i.e. the Property name in the Association + * class that refers to the Object returned matches this + * value) If "Dependent" is specified, then only Associations in + * which the Object returned is the "Dependent" reference are + * examined. + * @return If successful, a CloseableIterator containing zero + * or more CIMObjectPath objects of the CIM Classes or + * CIM Instances meeting the specified criteria is returned. + * @throws WBEMException + * If unsuccessful, one of the following status codes must be + * returned. The ORDERED list is: + * + * + * CIM_ERR_ACCESS_DENIED + * CIM_ERR_NOT_SUPPORTED + * CIM_ERR_INVALID_NAMESPACE + * CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized + * or otherwise incorrect parameters) + * CIM_ERR_FAILED (some other unspecified error occurred) + * + */ + public CloseableIterator associatorNames(CIMObjectPath pObjectName, + String pAssociationClass, String pResultClass, String pRole, String pResultRole) + throws WBEMException; + + /** + * associatorPaths shall start an enumeration session for + * traversing associations starting from the instance defined in the + * pInstancePath parameter using any specified filtering + * criteria and return zero or more CIMObjectPath objects. + * + * @param pInstancePath + * The CIMObjectPath for the instance for which the + * enumeration is to be performed. + * @param pAssociationClass + * This string MUST either contain a valid CIM Association class + * name or be null. It filters the Objects returned + * to contain only Objects associated to the source Object via + * this CIM Association class or one of its subclasses. + * @param pResultClass + * This string MUST either contain a valid CIM Class name or be + * null. It filters the Objects returned to contain + * only the Objects of this Class name or one of its subclasses. + * @param pRole + * This string MUST either contain a valid Property name or be + * null. It filters the Objects returned to contain + * only Objects associated to the source Object via an + * Association class in which the source Object plays the + * specified role. (i.e. the Property name in the Association + * class that refers to the source Object matches this + * value) If "Antecedent" is specified, then only Associations in + * which the source Object is the "Antecedent" reference are + * examined. + * @param pResultRole + * This string MUST either contain a valid Property name or be + * null. It filters the Objects returned to contain + * only Objects associated to the source Object via an + * Association class in which the Object returned plays + * the specified role. (i.e. the Property name in the Association + * class that refers to the Object returned matches this + * value) If "Dependent" is specified, then only Associations in + * which the Object returned is the "Dependent" reference are + * examined. + * @param pFilterQueryLanguage + * The pFilterQueryLanguage represents the query + * language for the pFilterQuery argument. This must + * be left null if a pFilterQuery is + * not supplied. If the implementation does not support the query + * language specified, the + * CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED error shall + * be returned. If the implementation does not support filtered + * enumerations, the + * CIM_ERR_FILTERED_ENUMERATION_NOT_SUPPORTED error + * shall be returned. + * @param pFilterQuery + * The pFilterQuery specifies a query in the form of + * the query language specified by the + * pFilterQueryLanguage parameter. If this value is + * not null, the pFilterQueryLanguage + * parameter must be non-null. This value shall act + * as an additional filter on the result set. If the + * implementation does not support the query language specified, + * the CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED error + * shall be returned. If the implementation does not support + * filtered enumerations, the + * CIM_ERR_FILTERED_ENUMERATION_NOT_SUPPORTED error + * shall be returned. + * @param pTimeout + * This input parameter determines the minimum time the CIM + * server shall maintain the open enumeration session after the + * last Open or Pull operation (unless the enumeration session is + * closed). If the operation timeout is exceeded, the + * implementation may close the enumeration session at any time, + * releasing any resources allocated to the enumeration session. + * A pTimeout of 0 means that there is no operation + * timeout. That is, the enumeration session is never closed + * based on time. If pTimeout is null, + * the implementation shall choose an operation timeout. All + * other values for pTimeout specify the operation + * timeout in seconds. A implementation may restrict the set of + * allowable values for pTimeout. Specifically, the + * implementation may not allow 0 (no timeout). If the specified + * value is not an allowable value, the implementation shall + * return failure with the status code + * CIM_ERR_INVALID_OPERATION_TIMEOUT. + * @param pContinueOnError + * If true, requests that the operation resume when + * an error is received. If a implementation does not support + * continuation on error and pContinueOnError is + * true, it shall throw a WBEMException + * with the status code + * CIM_ERR_CONTINUATION_ON_ERROR_NOT_SUPPORTED. If a + * implementation supports continuation on error and + * pContinueOnError is true, the + * enumeration session shall remain open when a Pull operation + * fails, and any subsequent successful Pull operations shall + * return the set of elements that would have been returned if + * the failing Pull operations were successful. This behavior is + * subject to the consistency rules defined for pulled + * enumerations. If pContinueOnError is + * false, the enumeration session shall be closed + * when either the operation completes successfully or when a + * WBEMExcetpion is thrown. + * @param pMaxObjects + * Defines the maximum number of elements that this Open + * operation can return. The implementation may deliver any + * number of elements up to pMaxObjects but shall + * not deliver more than pMaxObjects elements. An + * implementation may choose to never return any elements during + * an Open operation, regardless of the value of + * pMaxObjects. Note that a CIM client can use a + * pMaxObjects value of 0 to specify that it does + * not want to retrieve any instances in the Open operation. + * @return The return value of a successful Open operation is an array of + * enumerated elements with a number of entries from 0 up to a + * maximum defined by pMaxObjects. These entries meet + * the criteria defined in the Open operation. Note that returning + * no entries in the array does not imply that the enumeration + * session is exhausted. Client must evaluate the + * EnumerateResponse.isEnd() to determine if there are + * more elements. + * @throws WBEMException + * If unsuccessful, one of the following status codes must be + * returned. The ORDERED list is: + * + * + * CIM_ERR_ACCESS_DENIED + * CIM_ERR_SERVER_IS_SHUTTING_DOWN + * CIM_ERR_NOT_SUPPORTED + * CIM_ERR_INVALID_NAMESPACE + * CIM_ERR_INVALID_OPERATION_TIMEOUT + * CIM_ERR_CONTINUATION_ON_ERROR_NOT_SUPPORTED + * CIM_ERR_INVALID_PARAMETER + * CIM_ERR_NOT_FOUND (the source instance was not found) + * CIM_ERR_FILTERED_ENUMERATION_NOT_SUPPORTED + * CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED + * CIM_ERR_INVALID_QUERY + * CIM_ERR_FAILED (some other unspecified error occurred) + * + */ + public EnumerateResponse associatorPaths(CIMObjectPath pInstancePath, + String pAssociationClass, String pResultClass, String pRole, String pResultRole, + String pFilterQueryLanguage, String pFilterQuery, UnsignedInteger32 pTimeout, + boolean pContinueOnError, UnsignedInteger32 pMaxObjects) throws WBEMException; + + /** + * associators shall start an enumeration session for + * traversing associations starting from the instance defined in the + * pInstancePath parameter using any specified filtering + * criteria and return zero or more CIMInstance objects. + * + * @param pInstancePath + * The CIMObjectPath for the instance for which the + * enumeration is to be performed. + * @param pAssociationClass + * This string MUST either contain a valid CIM Association class + * name or be null. It filters the Objects returned + * to contain only Objects associated to the source Object via + * this CIM Association class or one of its subclasses. + * @param pResultClass + * This string MUST either contain a valid CIM Class name or be + * null. It filters the Objects returned to contain + * only the Objects of this Class name or one of its subclasses. + * @param pRole + * This string MUST either contain a valid Property name or be + * null. It filters the Objects returned to contain + * only Objects associated to the source Object via an + * Association class in which the source Object plays the + * specified role. (i.e. the Property name in the Association + * class that refers to the source Object matches this + * value) If "Antecedent" is specified, then only Associations in + * which the source Object is the "Antecedent" reference are + * examined. + * @param pResultRole + * This string MUST either contain a valid Property name or be + * null. It filters the Objects returned to contain + * only Objects associated to the source Object via an + * Association class in which the Object returned plays + * the specified role. (i.e. the Property name in the Association + * class that refers to the Object returned matches this + * value) If "Dependent" is specified, then only Associations in + * which the Object returned is the "Dependent" reference are + * examined. + * @param pIncludeClassOrigin + * The class origin attribute is the name of the class that first + * defined the property. If true, the class origin + * attribute may be present for each property on all instances + * returned, even if requested the server may ignore the request + * and not return the class origin. If false, the + * class origin shall not be present. + * @param pPropertyList + * An array of property names used to filter what is contained in + * the Objects returned. Each CIMClass or + * CIMInstance returned only contains elements for + * the properties of the names specified. Duplicate and invalid + * property names are ignored and the request is otherwise + * processed normally. An empty array indicates that no + * properties should be included in the Objects returned. A + * null value indicates that all properties should + * be contained in the Objects returned. NOTE: Properties + * should not be specified in this parameter unless a non- + * null value is specified in the + * pResultClass parameter. + * @param pFilterQueryLanguage + * The pFilterQueryLanguage represents the query + * language for the pFilterQuery argument. This must + * be left null if a filterQuery is not supplied. If + * the implementation does not support the query language + * specified, the + * CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED error shall + * be returned. If the implementation does not support filtered + * enumerations, the + * CIM_ERR_FILTERED_ENUMERATION_NOT_SUPPORTED error + * shall be returned. + * @param pFilterQuery + * The pFilterQuery specifies a query in the form of + * the query language specified by the + * pFilterQueryLanguage parameter. If this value is + * not null, the pFilterQueryLanguage + * parameter must be non-null. This value shall act + * as an additional filter on the result set. If the + * implementation does not support the query language specified, + * the CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED error + * shall be returned. If the implementation does not support + * filtered enumerations, the + * CIM_ERR_FILTERED_ENUMERATION_NOT_SUPPORTED error + * shall be returned. + * @param pTimeout + * This input parameter determines the minimum time the CIM + * server shall maintain the open enumeration session after the + * last Open or Pull operation (unless the enumeration session is + * closed). If the operation timeout is exceeded, the + * implementation may close the enumeration session at any time, + * releasing any resources allocated to the enumeration session. + * A pTimeout of 0 means that there is no operation + * timeout. That is, the enumeration session is never closed + * based on time. If pTimeout is null, + * the implementation shall choose an operation timeout. All + * other values for pTimeout specify the operation + * timeout in seconds. A implementation may restrict the set of + * allowable values for pTimeout. Specifically, the + * implementation may not allow 0 (no timeout). If the specified + * value is not an allowable value, the implementation shall + * return failure with the status code + * CIM_ERR_INVALID_OPERATION_TIMEOUT. + * @param pContinueOnError + * If true, requests that the operation resume when + * an error is received. If a implementation does not support + * continuation on error and pContinueOnError is + * true, it shall throw a WBEMException + * with the status code + * CIM_ERR_CONTINUATION_ON_ERROR_NOT_SUPPORTED. If a + * implementation supports continuation on error and + * pContinueOnError is true, the + * enumeration session shall remain open when a Pull operation + * fails, and any subsequent successful Pull operations shall + * return the set of elements that would have been returned if + * the failing Pull operations were successful. This behavior is + * subject to the consistency rules defined for pulled + * enumerations. If pContinueOnError is + * false, the enumeration session shall be closed + * when either the operation completes successfully or when a + * WBEMExcetpion is thrown. + * @param pMaxObjects + * Defines the maximum number of elements that this Open + * operation can return. The implementation may deliver any + * number of elements up to pMaxObjects but shall + * not deliver more than pMaxObjects elements. An + * implementation may choose to never return any elements during + * an Open operation, regardless of the value of + * pMaxObjects. Note that a CIM client can use a + * pMaxObjects value of 0 to specify that it does + * not want to retrieve any instances in the Open operation. + * @return The return value of a successful Open operation is an array of + * enumerated elements with a number of entries from 0 up to a + * maximum defined by pMaxObjects. These entries meet + * the criteria defined in the Open operation. Note that returning + * no entries in the array does not imply that the enumeration + * session is exhausted. Client must evaluate the + * EnumerateResponse.isEnd() to determine if there are + * more elements. + * @throws WBEMException + * If unsuccessful, one of the following status codes must be + * returned. The ORDERED list is: + * + * + * CIM_ERR_ACCESS_DENIED + * CIM_ERR_SERVER_IS_SHUTTING_DOWN + * CIM_ERR_NOT_SUPPORTED + * CIM_ERR_INVALID_NAMESPACE + * CIM_ERR_INVALID_OPERATION_TIMEOUT + * CIM_ERR_CONTINUATION_ON_ERROR_NOT_SUPPORTED + * CIM_ERR_INVALID_PARAMETER + * CIM_ERR_NOT_FOUND (The source instance was not found) + * CIM_ERR_FILTERED_ENUMERATION_NOT_SUPPORTED + * CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED + * CIM_ERR_INVALID_QUERY + * CIM_ERR_FAILED (Some other unspecified error occurred) + * + */ + public EnumerateResponse associators(CIMObjectPath pInstancePath, + String pAssociationClass, String pResultClass, String pRole, String pResultRole, + boolean pIncludeClassOrigin, String[] pPropertyList, String pFilterQueryLanguage, + String pFilterQuery, UnsignedInteger32 pTimeout, boolean pContinueOnError, + UnsignedInteger32 pMaxObjects) throws WBEMException; + + /** + * Closes the WBEMClient session. + */ + public void close(); + + /** + * closeEnumeration shall close an enumeration session that has + * been previously started but not yet completed. Clients should always use + * this method when an enumeration session has been started and the client + * does not retrieve all the results. If a client has started an enumeration + * session and retrieves all the results until the + * EnumerationResponse.isEnd() is true, this method shall not + * be called. + * + * @param pPath + * The CIMObjectPath representing the namespace to + * be used. + * @param pContext + * The enumeration context to close. + * @throws WBEMException + */ + public void closeEnumeration(CIMObjectPath pPath, String pContext) throws WBEMException; + + /** + * Create a CIM class. The namespace from the + * CIMClass.getObjectPath() shall be used. + * + * @param pClass + * The CIMClass to be created. + * @throws UnsupportedOperationException + * If the client implementation (or protocol) does not support + * the operation. + * @throws WBEMException + * If unsuccessful, one of the following status codes must be + * returned. The ORDERED list is: + * + * + * CIM_ERR_ACCESS_DENIED + * CIM_ERR_NOT_SUPPORTED + * CIM_ERR_INVALID_NAMESPACE + * CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized + * or otherwise incorrect parameters) + * CIM_ERR_ALREADY_EXISTS (the CIM Class already exists) + * CIM_ERR_INVALID_SUPERCLASS (the putative CIM Class declares a + * non-existent superclass) + * CIM_ERR_FAILED (some other unspecified error occurred) + * + */ + public void createClass(CIMClass pClass) throws WBEMException; + + /** + * Create a CIM Instance. The namespace from the + * CIMInstance.getObjectPath() shall be used. The keys of the + * CIMInstance may be modified by the implementation and the + * client must use the returned object path to determine the name of the + * instance. It is possible for a client to leave keys of instances empty/ + * null and the provider can fill them in. This is + * implementation specific unless specified by a CIM Schema or in a DMTF + * Profile. + * + * @param pInstance + * The CIMInstance to be created. + * @return CIMObjectPath of the instance created. + * @throws WBEMException + * If unsuccessful, one of the following status codes must be + * returned. The ORDERED list is: + * + * + * CIM_ERR_ACCESS_DENIED + * CIM_ERR_NOT_SUPPORTED (provider does not support this method) + * CIM_ERR_INVALID_NAMESPACE + * CIM_ERR_INVALID_PARAMETER (for this method) + * CIM_ERR_INVALID_CLASS (in this namespace) + * CIM_ERR_ALREADY_EXISTS + * CIM_ERR_FAILED (some other unspecified error occurred) + * + */ + public CIMObjectPath createInstance(CIMInstance pInstance) throws WBEMException; + + /** + * Deletes the CIM class for the object specified by the CIM object path. + * + * @param pPath + * The CIMObjectPath identifying the namespace and + * class name to delete. + * @throws UnsupportedOperationException + * If the client implementation (or protocol) does not support + * the operation. + * @throws WBEMException + * If unsuccessful, one of the following status codes must be + * returned. The ORDERED list is: + * + * + * CIM_ERR_ACCESS_DENIED + * CIM_ERR_NOT_SUPPORTED + * CIM_ERR_INVALID_NAMESPACE + * CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized + * or otherwise incorrect parameters) + * CIM_ERR_NOT_FOUND (the CIM Class to be deleted does not exist) + * CIM_ERR_CLASS_HAS_CHILDREN (the CIM Class has one or more subclasses + * which cannot be deleted) + * CIM_ERR_CLASS_HAS_INSTANCES (the CIM Class has one or more instances + * which cannot be deleted) + * CIM_ERR_FAILED (some other unspecified error occurred) + * + */ + public void deleteClass(CIMObjectPath pPath) throws WBEMException; + + /** + * Delete the CIM instance specified by the CIM object path. + * + * @param pPath + * The object path of the instance to be deleted. It must include + * all of the keys. + * @throws WBEMException + * If unsuccessful, one of the following status codes must be + * returned. The ORDERED list is: + * + * + * CIM_ERR_ACCESS_DENIED + * CIM_ERR_NOT_SUPPORTED (provider does not support this method) + * CIM_ERR_INVALID_NAMESPACE + * CIM_ERR_INVALID_PARAMETER (for this method) + * CIM_ERR_INVALID_CLASS (in this namespace) + * CIM_ERR_NOT_FOUND (if the instance does not exist) + * CIM_ERR_FAILED (some other unspecified error occurred) + * + */ + public void deleteInstance(CIMObjectPath pPath) throws WBEMException; + + /** + * Delete a CIM Qualifier type. + * + * @param pPath + * The CIMObjectPath identifying the name and + * namespace of the CIM qualifier type to delete. + * @throws UnsupportedOperationException + * If the client implementation (or protocol) does not support + * the operation. + * @throws WBEMException + * If unsuccessful, one of the following status codes must be + * returned. The ORDERED list is: + * + * + * CIM_ERR_ACCESS_DENIED + * CIM_ERR_NOT_SUPPORTED + * CIM_ERR_INVALID_NAMESPACE + * CIM_ERR_INVALID_PARAMETER (for this method) + * CIM_ERR_NOT_FOUND (the Qualifier did not exist) + * CIM_ERR_FAILED (some other unspecified error occurred) + * + */ + public void deleteQualifierType(CIMObjectPath pPath) throws WBEMException; + + /** + * Enumerate CIM Classes. + * + * @param pPath + * The object path of the class to be enumerated. Only the + * namespace and object name should be populated. If the object + * name is set to an empty string (i.e. ""), then all base + * classes in the target namespace are returned. + * @param pDeep + * If true, the classes returned shall include + * subclasses. If false, the classes returned shall + * not include subclasses. + * @param pLocalOnly + * If true, only elements (properties, methods and + * qualifiers) defined in, or overridden in the class are + * included in the response. If false, all elements + * of the class definition are returned. + * @param pIncludeQualifiers + * If true, all Qualifiers for each Class and its + * elements (properties, methods, references) are included. If + * false, no Qualifiers are present in the classes + * returned. + * @param pIncludeClassOrigin + * The class origin attribute is the name of the class that first + * defined the property or method. If true, the + * class origin attribute shall be present for each property and + * method on all returned CIMClasses. If + * false, the class origin shall not be present. + * @return A CloseableIterator of CIMClasses. + * @throws UnsupportedOperationException + * If the client implementation (or protocol) does not support + * the operation. + * @throws WBEMException + * If unsuccessful, one of the following status codes must be + * returned. The ORDERED list is: + * + * + * CIM_ERR_ACCESS_DENIED + * CIM_ERR_NOT_SUPPORTED + * CIM_ERR_INVALID_NAMESPACE + * CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized + * or otherwise incorrect parameters) + * CIM_ERR_INVALID_CLASS (the CIM Class that is the basis for this + * enumeration does not exist) + * CIM_ERR_FAILED (some other unspecified error occurred) + * + */ + public CloseableIterator enumerateClasses(CIMObjectPath pPath, boolean pDeep, + boolean pLocalOnly, boolean pIncludeQualifiers, boolean pIncludeClassOrigin) + throws WBEMException; + + /** + * Enumerate the names of CIM Classes. + * + * @param pPath + * The CIMObjectPath identifying the class to be + * enumerated. If the class name in the object path specified is + * an empty string (i.e. ""), all base classes in the target + * namespace are returned. Note that only the namespace and the + * name components should be populated. + * @param pDeep + * If true, the enumeration returned shall contain + * the names of all classes derived from the class being + * enumerated. If false, the enumeration returned + * contains only the names of the first level children of the + * class. + * @return A CloseableIterator of CIMObjectPaths. + * @throws UnsupportedOperationException + * If the client implementation (or protocol) does not support + * the operation. + * @throws WBEMException + * If unsuccessful, one of the following status codes must be + * returned. The ORDERED list is: + * + * + * CIM_ERR_ACCESS_DENIED + * CIM_ERR_NOT_SUPPORTED + * CIM_ERR_INVALID_NAMESPACE + * CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized + * or otherwise incorrect parameters) + * CIM_ERR_INVALID_CLASS (the CIM Class that is the basis for this + * enumeration does not exist) + * CIM_ERR_FAILED (some other unspecified error occurred) + * + */ + public CloseableIterator enumerateClassNames(CIMObjectPath pPath, boolean pDeep) + throws WBEMException; + + /** + * Enumerate the names of the instances for a specified class. The names of + * all subclass instances are returned. + * + * @param pPath + * The CIMObjectPath identifying the class whose + * instances are to be enumerated. Only the namespace and class + * name components are used. All other information (e.g. Keys) is + * ignored. + * @return CloseabelIterator of CIMObjectPaths. + * @throws WBEMException + * If unsuccessful, one of the following status codes must be + * returned. The ORDERED list is: + * + * + * CIM_ERR_ACCESS_DENIED + * CIM_ERR_NOT_SUPPORTED (provider does not support this method) + * CIM_ERR_INVALID_NAMESPACE + * CIM_ERR_INVALID_PARAMETER (for this method) + * CIM_ERR_INVALID_CLASS (in this namespace) + * CIM_ERR_FAILED (some other unspecified error occurred) + * + */ + public CloseableIterator enumerateInstanceNames(CIMObjectPath pPath) + throws WBEMException; + + /** + * enumerateInstancePaths shall enumerate the instances of the + * specified class in pClassPath and return zero or more + * CIMObjectPaths. + * + * @param pClassPath + * The CIMObjectPath for the class for which the + * enumeration is to be performed. + * @param pFilterQueryLanguage + * The pFilterQueryLanguage represents the query + * language for the pFilterQuery argument. This must + * be left null if a pFilterQuery is + * not supplied. If the implementation does not support the query + * language specified, the + * CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED error shall + * be returned. If the implementation does not support filtered + * enumerations, the + * CIM_ERR_FILTERED_ENUMERATION_NOT_SUPPORTED error + * shall be returned. + * @param pFilterQuery + * The pFilterQuery specifies a query in the form of + * the query language specified by the + * pFilterQueryLanguage parameter. If this value is + * not null, the pFilterQueryLanguage + * parameter must be non-null. This value shall act + * as an additional filter on the result set. If the + * implementation does not support the query language specified, + * the CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED error + * shall be returned. If the implementation does not support + * filtered enumerations, the + * CIM_ERR_FILTERED_ENUMERATION_NOT_SUPPORTED error + * shall be returned. + * @param pTimeout + * This input parameter determines the minimum time the CIM + * server shall maintain the open enumeration session after the + * last Open or Pull operation (unless the enumeration session is + * closed). If the operation timeout is exceeded, the + * implementation may close the enumeration session at any time, + * releasing any resources allocated to the enumeration session. + * A pTimeout of 0 means that there is no operation + * timeout. That is, the enumeration session is never closed + * based on time. If pTimeout is null, + * the implementation shall choose an operation timeout. All + * other values for pTimeout specify the operation + * timeout in seconds. A implementation may restrict the set of + * allowable values for pTimeout. Specifically, the + * implementation may not allow 0 (no timeout). If the specified + * value is not an allowable value, the implementation shall + * return failure with the status code + * CIM_ERR_INVALID_OPERATION_TIMEOUT. + * @param pContinueOnError + * If true, requests that the operation resume when + * an error is received. If a implementation does not support + * continuation on error and pContinueOnError is + * true, it shall throw a WBEMException + * with the status code + * CIM_ERR_CONTINUATION_ON_ERROR_NOT_SUPPORTED. If a + * implementation supports continuation on error and + * pContinueOnError is true, the + * enumeration session shall remain open when a Pull operation + * fails, and any subsequent successful Pull operations shall + * return the set of elements that would have been returned if + * the failing Pull operations were successful. This behavior is + * subject to the consistency rules defined for pulled + * enumerations. If pContinueOnError is + * false, the enumeration session shall be closed + * when either the operation completes successfully or when a + * WBEMExcetpion is thrown. + * @param pMaxObjects + * Defines the maximum number of elements that this Open + * operation can return. The implementation may deliver any + * number of elements up to pMaxObjects but shall + * not deliver more than pMaxObjects elements. An + * implementation may choose to never return any elements during + * an Open operation, regardless of the value of + * pMaxObjects. Note that a CIM client can use a + * pMaxObjects value of 0 to specify that it does + * not want to retrieve any instances in the Open operation. + * @return The return value of a successful Open operation is an array of + * enumerated elements with a number of entries from 0 up to a + * maximum defined by pMaxObjects. These entries meet + * the criteria defined in the Open operation. Note that returning + * no entries in the array does not imply that the enumeration + * session is exhausted. Client must evaluate the + * EnumerateResponse.isEnd() to determine if there are + * more elements. + * @throws WBEMException + * If unsuccessful, one of the following status codes must be + * returned. The ORDERED list is: + * + * + * CIM_ERR_ACCESS_DENIED + * CIM_ERR_SERVER_IS_SHUTTING_DOWN + * CIM_ERR_NOT_SUPPORTED + * CIM_ERR_INVALID_NAMESPACE + * CIM_ERR_INVALID_OPERATION_TIMEOUT + * CIM_ERR_CONTINUATION_ON_ERROR_NOT_SUPPORTED + * CIM_ERR_INVALID_PARAMETER + * CIM_ERR_INVALID_CLASS (the source class does not exist) + * CIM_ERR_FILTERED_ENUMERATION_NOT_SUPPORTED + * CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED + * CIM_ERR_INVALID_QUERY + * CIM_ERR_FAILED (some other unspecified error occurred) + * + */ + public EnumerateResponse enumerateInstancePaths(CIMObjectPath pClassPath, + String pFilterQueryLanguage, String pFilterQuery, UnsignedInteger32 pTimeout, + boolean pContinueOnError, UnsignedInteger32 pMaxObjects) throws WBEMException; + + /** + * Enumerate the instances of a class. The instances of all subclasses are + * also returned. + * + * @param pPath + * The object path of the class to be enumerated. Only the + * namespace and class name components are used. Any other + * information (e.g. Keys) is ignored. + * @param pDeep + * If true, this specifies that, for each returned + * Instance of the Class, all properties of the Instance must be + * present (subject to constraints imposed by the other + * parameters), including any which were added by subclassing the + * specified Class. If false, each returned Instance + * includes only properties defined for the specified Class in + * path. + * @param pLocalOnly + * If true, only properties that were instantiated + * in the instance are returned. WBEM Servers may ignore this + * parameter and return all properties. + * @param pIncludeClassOrigin + * The class origin attribute is the name of the class that first + * defined the property. If true, the class origin + * attribute may be present for each property on all returned + * CIMInstances, even if requested the server may ignore the + * request and not return the class origin. If false + * , the class origin shall not be present. + * @param pPropertyList + * An array of property names used to filter what is contained in + * the instances returned. Each instance returned only contains + * elements for the properties of the names specified. Duplicate + * and invalid property names are ignored and the request is + * otherwise processed normally. An empty array indicates that no + * properties should be returned. A null value indicates + * that all properties should be returned. + * @return A CloseableIterator of CIMInstances. + * @throws WBEMException + * If unsuccessful, one of the following status codes must be + * returned. The ORDERED list is: + * + * + * CIM_ERR_ACCESS_DENIED + * CIM_ERR_NOT_SUPPORTED + * CIM_ERR_INVALID_NAMESPACE + * CIM_ERR_INVALID_PARAMETER (for this method) + * CIM_ERR_INVALID_CLASS (in this namespace) + * CIM_ERR_FAILED (some other unspecified error occurred) + * + */ + public CloseableIterator enumerateInstances(CIMObjectPath pPath, boolean pDeep, + boolean pLocalOnly, boolean pIncludeClassOrigin, String[] pPropertyList) + throws WBEMException; + + /** + * enumerateInstances shall enumerate the instances of the + * specified class in pClassPath and return zero or more + * CIMInstances. + * + * @param pClassPath + * The CIMObjectPath for the class for which the + * enumeration is to be performed. + * @param pDeepInheritance + * If true, this specifies that, for each returned + * Instance of the Class, all properties of the Instance must be + * present (subject to constraints imposed by the other + * parameters), including any which were added by subclassing the + * specified Class. If false, each returned Instance + * includes only properties defined for the specified Class in + * path. + * @param pIncludeClassOrigin + * The class origin attribute is the name of the class that first + * defined the property. If true, the class origin + * attribute may be present for each property on all instances + * returned, even if requested the server may ignore the request + * and not return the class origin. If false, the + * class origin shall not be present. + * @param pPropertyList + * An array of property names used to filter what is contained in + * the Objects returned. Each CIMInstance returned + * only contains elements for the properties of the names + * specified. Duplicate and invalid property names are ignored + * and the request is otherwise processed normally. An empty + * array indicates that no properties should be included in the + * Objects returned. A null value indicates that all + * properties should be contained in the Objects returned. + * @param pFilterQueryLanguage + * The pFilterQueryLanguage represents the query + * language for the pFilterQuery argument. This must + * be left null if a pFilterQuery is + * not supplied. If the implementation does not support the query + * language specified, the + * CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED error shall + * be returned. If the implementation does not support filtered + * enumerations, the + * CIM_ERR_FILTERED_ENUMERATION_NOT_SUPPORTED error + * shall be returned. + * @param pFilterQuery + * The pFilterQuery specifies a query in the form of + * the query language specified by the + * pFilterQueryLanguage parameter. If this value is + * not null, the pFilterQueryLanguage + * parameter must be non-null. This value shall act + * as an additional filter on the result set. If the + * implementation does not support the query language specified, + * the CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED error + * shall be returned. If the implementation does not support + * filtered enumerations, the + * CIM_ERR_FILTERED_ENUMERATION_NOT_SUPPORTED error + * shall be returned. + * @param pTimeout + * This input parameter determines the minimum time the CIM + * server shall maintain the open enumeration session after the + * last Open or Pull operation (unless the enumeration session is + * closed). If the operation timeout is exceeded, the + * implementation may close the enumeration session at any time, + * releasing any resources allocated to the enumeration session. + * A pTimeout of 0 means that there is no operation + * timeout. That is, the enumeration session is never closed + * based on time. If pTimeout is null, + * the implementation shall choose an operation timeout. All + * other values for pTimeout specify the operation + * timeout in seconds. A implementation may restrict the set of + * allowable values for pTimeout. Specifically, the + * implementation may not allow 0 (no timeout). If the specified + * value is not an allowable value, the implementation shall + * return failure with the status code + * CIM_ERR_INVALID_OPERATION_TIMEOUT. + * @param pContinueOnError + * If true, requests that the operation resume when + * an error is received. If a implementation does not support + * continuation on error and pContinueOnError is + * true, it shall throw a WBEMException + * with the status code + * CIM_ERR_CONTINUATION_ON_ERROR_NOT_SUPPORTED. If a + * implementation supports continuation on error and + * pContinueOnError is true, the + * enumeration session shall remain open when a Pull operation + * fails, and any subsequent successful Pull operations shall + * return the set of elements that would have been returned if + * the failing Pull operations were successful. This behavior is + * subject to the consistency rules defined for pulled + * enumerations. If pContinueOnError is + * false, the enumeration session shall be closed + * when either the operation completes successfully or when a + * WBEMExcetpion is thrown. + * @param pMaxObjects + * Defines the maximum number of elements that this Open + * operation can return. The implementation may deliver any + * number of elements up to pMaxObjects but shall + * not deliver more than pMaxObjects elements. An + * implementation may choose to never return any elements during + * an Open operation, regardless of the value of + * pMaxObjects. Note that a CIM client can use a + * pMaxObjects value of 0 to specify that it does + * not want to retrieve any instances in the Open operation. + * @return The return value of a successful Open operation is an array of + * enumerated elements with a number of entries from 0 up to a + * maximum defined by pMaxObjects. These entries meet + * the criteria defined in the Open operation. Note that returning + * no entries in the array does not imply that the enumeration + * session is exhausted. Client must evaluate the + * EnumerateResponse.isEnd() to determine if there are + * more elements. + * @throws WBEMException + * If unsuccessful, one of the following status codes must be + * returned. The ORDERED list is: + * + * + * + * CIM_ERR_ACCESS_DENIED + * CIM_ERR_SERVER_IS_SHUTTING_DOWN + * CIM_ERR_NOT_SUPPORTED + * CIM_ERR_INVALID_NAMESPACE + * CIM_ERR_INVALID_OPERATION_TIMEOUT + * CIM_ERR_CONTINUATION_ON_ERROR_NOT_SUPPORTED + * CIM_ERR_INVALID_PARAMETER + * CIM_ERR_INVALID_CLASS (the source class does not exist) + * CIM_ERR_FILTERED_ENUMERATION_NOT_SUPPORTED + * CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED + * CIM_ERR_INVALID_QUERY + * CIM_ERR_FAILED (some other unspecified error occurred) + * + */ + public EnumerateResponse enumerateInstances(CIMObjectPath pClassPath, + boolean pDeepInheritance, boolean pIncludeClassOrigin, String[] pPropertyList, + String pFilterQueryLanguage, String pFilterQuery, UnsignedInteger32 pTimeout, + boolean pContinueOnError, UnsignedInteger32 pMaxObjects) throws WBEMException; + + /** + * Enumerates the CIM Qualifier types for a specific namespace. + * + * @param pPath + * The CIMObjectPath identifying the namespace whose + * qualifier types are to be enumerated. + * @return A CloseableIterator of CIMQualifierType + * s. + * @throws UnsupportedOperationException + * If the client implementation (or protocol) does not support + * the operation. + * @throws WBEMException + * If unsuccessful, one of the following status codes must be + * returned. The ORDERED list is: + * + * + * CIM_ERR_ACCESS_DENIED + * CIM_ERR_NOT_SUPPORTED + * CIM_ERR_INVALID_NAMESPACE + * CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized + * or otherwise incorrect parameters) + * CIM_ERR_FAILED (some other unspecified error occurred) + * + */ + public CloseableIterator> enumerateQualifierTypes(CIMObjectPath pPath) + throws WBEMException; + + /** + * enumerationCount provides an estimated count of the total + * number of objects in an open enumeration session represented by an + * enumeration context. + * + * @param pPath + * The namespace for the enumeration context. + * @param pEnumerationContext + * The enumeration context to count. + * @return The estimated number of objects. + * @throws UnsupportedOperationException + * @throws WBEMException + * If unsuccessful, one of the following status codes must be + * returned. The ORDERED list is: + * + * + * + * CIM_ERR_ACCESS_DENIED + * CIM_ERR_SERVER_IS_SHUTTING_DOWN + * CIM_ERR_NOT_SUPPORTED + * CIM_ERR_INVALID_NAMESPACE + * CIM_ERR_INVALID_PARAMETER + * CIM_ERR_INVALID_ENUMERATION_CONTEXT + * CIM_ERR_SERVER_LIMITS_EXCEEDED + * CIM_ERR_FAILED + * + * + */ + public UnsignedInteger64 enumerationCount(CIMObjectPath pPath, String pEnumerationContext) + throws WBEMException; + + /** + * execQuery shall execute a query to retrieve objects. + * + * @param pPath + * CIMObjectPath identifying the class to query. + * Only the namespace and class name components are used. All + * other information (e.g. Keys) is ignored. + * @param pQuery + * A string containing the text of the query. + * @param pQueryLanguage + * A string that identifies the query language to use to parse + * the query string specified. + * @return A CloseableIterator of CIMInstances. + * @throws WBEMException + * If unsuccessful, one of the following status codes must be + * returned. The ORDERED list is: + * + * + * CIM_ERR_ACCESS_DENIED + * CIM_ERR_NOT_SUPPORTED (provider does not support this method) + * CIM_ERR_INVALID_NAMESPACE + * CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized + * or otherwise incorrect parameters) + * CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED (the requested query language + * is not recognized) + * CIM_ERR_INVALID_QUERY (the query is not a valid query in the specified + * query language) + * CIM_ERR_FAILED (some other unspecified error occurred) + * + */ + public CloseableIterator execQuery(CIMObjectPath pPath, String pQuery, + String pQueryLanguage) throws WBEMException; + + /** + * execQueryInstances shall execute a query to retrieve + * instances. + * + * @param pObjectName + * The CIMObjectPath representing the namespace to + * be used. + * @param pFilterQuery + * The pFilterQuery specifies a query in the form of + * the query language specified by the + * pFilterQueryLanguage parameter. If this value is + * not null, the pFilterQueryLanguage + * parameter must be non-null. This value shall act + * as an additional filter on the result set. If the + * implementation does not support the query language specified, + * the CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED error + * shall be returned. If the implementation does not support + * filtered enumerations, the + * CIM_ERR_FILTERED_ENUMERATION_NOT_SUPPORTED error + * shall be returned. + * @param pFilterQueryLanguage + * The pFilterQueryLanguage represents the query + * language for the pFilterQuery argument. This must + * be left null if a pFilterQuery is + * not supplied. If the implementation does not support the query + * language specified, the + * CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED error shall + * be returned. If the implementation does not support filtered + * enumerations, the + * CIM_ERR_FILTERED_ENUMERATION_NOT_SUPPORTED error + * shall be returned. + * @param pReturnQueryResultClass + * The pReturnQueryResultClass controls whether a + * class definition is returned in pQueryResultClass + * . If it is set to false, + * pQueryResultClass shall be set to + * null on output. If it is set to true + * , the value of the pQueryResultClass on output + * shall be a class definition that defines the properties + * (columns) of each row of the query result. + * @param pTimeout + * This input parameter determines the minimum time the CIM + * server shall maintain the open enumeration session after the + * last Open or Pull operation (unless the enumeration session is + * closed). If the operation timeout is exceeded, the + * implementation may close the enumeration session at any time, + * releasing any resources allocated to the enumeration session. + * A pTimeout of 0 means that there is no operation + * timeout. That is, the enumeration session is never closed + * based on time. If pTimeout is null, + * the implementation shall choose an operation timeout. All + * other values for pTimeout specify the operation + * timeout in seconds. A implementation may restrict the set of + * allowable values for pTimeout. Specifically, the + * implementation may not allow 0 (no timeout). If the specified + * value is not an allowable value, the implementation shall + * return failure with the status code + * CIM_ERR_INVALID_OPERATION_TIMEOUT. + * @param pContinueOnError + * If true, requests that the operation resume when + * an error is received. If a implementation does not support + * continuation on error and pContinueOnError is + * true, it shall throw a WBEMException + * with the status code + * CIM_ERR_CONTINUATION_ON_ERROR_NOT_SUPPORTED. If a + * implementation supports continuation on error and + * pContinueOnError is true, the + * enumeration session shall remain open when a Pull operation + * fails, and any subsequent successful Pull operations shall + * return the set of elements that would have been returned if + * the failing Pull operations were successful. This behavior is + * subject to the consistency rules defined for pulled + * enumerations. If pContinueOnError is + * false, the enumeration session shall be closed + * when either the operation completes successfully or when a + * WBEMExcetpion is thrown. + * @param pMaxObjects + * Defines the maximum number of elements that this Open + * operation can return. The implementation may deliver any + * number of elements up to pMaxObjects but shall + * not deliver more than pMaxObjects elements. An + * implementation may choose to never return any elements during + * an Open operation, regardless of the value of + * pMaxObjects. Note that a CIM client can use a + * pMaxObjects value of 0 to specify that it does + * not want to retrieve any instances in the Open operation. + * @param pQueryResultClass + * The pQueryResultClass is an output argument. It + * shall be null if the + * pReturnQueryResultClass input parameter is set to + * false. Otherwise, it shall return a class + * definition where each property of the class corresponds to one + * entry of the query select list. The class definition + * corresponds to one row of the query result. The class name of + * this returned class shall be "CIM_QueryResult". This class + * definition is valid only in the context of this enumeration. + * @return The return value of a successful Open operation is an array of + * enumerated elements with a number of entries from 0 up to a + * maximum defined by pMaxObjects. These entries meet + * the criteria defined in the Open operation. Note that returning + * no entries in the array does not imply that the enumeration + * session is exhausted. Client must evaluate the + * EnumerateResponse.isEnd() to determine if there are + * more elements. + * @throws UnsupportedOperationException + * @throws WBEMException + * If unsuccessful, one of the following status codes must be + * returned. The ORDERED list is: + * + * + * CIM_ERR_ACCESS_DENIED + * CIM_ERR_SERVER_IS_SHUTTING_DOWN + * CIM_ERR_NOT_SUPPORTED + * CIM_ERR_INVALID_NAMESPACE + * CIM_ERR_INVALID_OPERATION_TIMEOUT + * CIM_ERR_CONTINUATION_ON_ERROR_NOT_SUPPORTED + * CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized + * or otherwise incorrect parameters) + * CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED (the requested filter query + * language is not recognized) + * CIM_ERR_INVALID_QUERY (the filter query is not a valid query in the + * specified filter query language) + * CIM_ERR_QUERY_FEATURE_NOT_SUPPORTED (the query requires support for + * features that are not supported) + * CIM_ERR_FAILED (Some other unspecified error occurred) + * + */ + public EnumerateResponse execQueryInstances(CIMObjectPath pObjectName, + String pFilterQuery, String pFilterQueryLanguage, boolean pReturnQueryResultClass, + UnsignedInteger32 pTimeout, boolean pContinueOnError, UnsignedInteger32 pMaxObjects, + CIMClass pQueryResultClass) throws WBEMException; + + /** + * Returns the CIMClass for the specified + * CIMObjectPath. + * + * @param pName + * The object path of the class to be returned. Only the name + * space and class name components are used. All other + * information (e.g. keys) is ignored. + * @param pLocalOnly + * If true, only elements (properties, methods, + * references) overridden or defined in the class are included in + * the CIMClassreturned. If false, all + * elements of the class definition are returned. + * @param pIncludeQualifiers + * If true, all Qualifiers for the class and its + * elements are included in the CIMClass returned. + * If false, no Qualifier information is contained + * in the CIMClass returned. + * @param pIncludeClassOrigin + * The class origin attribute is the name of the class that first + * defined the property or method. If true, the + * class origin attribute shall be present for each property and + * method on all returned CIMClasses. If + * false, the class origin shall not be present. + * @param pPropertyList + * An array of property names used to filter what is contained in + * the CIMClass returned. The CIMClass + * returned only contains elements for the properties of the + * names specified. Duplicate and invalid property names are + * ignored and the request is otherwise processed normally. An + * empty array indicates that no properties should be returned. A + * null value indicates that all properties should + * be returned. + * @return CIMClass meeting the criteria specified. + * @throws UnsupportedOperationException + * If the client implementation (or protocol) does not support + * the operation. + * @throws WBEMException + * If unsuccessful, one of the following status codes must be + * returned. The ORDERED list is: + * + * + * CIM_ERR_ACCESS_DENIED + * CIM_ERR_INVALID_NAMESPACE + * CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized + * or otherwise incorrect parameters) + * CIM_ERR_NOT_FOUND (the requested CIM Class does not exist in the + * specified namespace) + * CIM_ERR_FAILED (some other unspecified error occurred) + * + */ + public CIMClass getClass(CIMObjectPath pName, boolean pLocalOnly, boolean pIncludeQualifiers, + boolean pIncludeClassOrigin, String[] pPropertyList) throws WBEMException; + + /** + * Get a CIMInstance. + * + * @param pName + * The object path of the instance to be returned. The Keys in + * this CIMObjectPath must be populated. + * @param pLocalOnly + * If true, only properties overridden or defined in + * the class are included in the CIMInstance + * returned. If false, all properties of the class + * definition are returned. WBEM Servers may ignore this + * parameter and return all properties. + * @param pIncludeClassOrigin + * The class origin attribute is the name of the class that first + * defined the property. If true, the class origin + * attribute may be present for each property of the + * CIMInstance, even if requested the server may + * ignore the request and not return the class origin. If + * false, the class origin shall not be present. + * @param pPropertyList + * An array of property names used to filter what is contained in + * the CIMClass returned. The CIMClass + * returned only contains elements for the properties of the + * names specified. Duplicate and invalid property names are + * ignored and the request is otherwise processed normally. An + * empty array indicates that no properties should be returned. A + * null value indicates that all properties should + * be returned. + * @return CIMInstance identified by the + * CIMObjectPath specified. + * @throws WBEMException + * If unsuccessful, one of the following status codes must be + * returned. The ORDERED list is: + * + * + * CIM_ERR_ACCESS_DENIED + * CIM_ERR_NOT_SUPPORTED (provider does not support this method) + * CIM_ERR_INVALID_NAMESPACE + * CIM_ERR_INVALID_PARAMETER (for this method) + * CIM_ERR_INVALID_CLASS (in this namespace) + * CIM_ERR_NOT_FOUND (if instance does not exist) + * CIM_ERR_FAILED (some other unspecified error occurred) + * + */ + public CIMInstance getInstance(CIMObjectPath pName, boolean pLocalOnly, + boolean pIncludeClassOrigin, String[] pPropertyList) throws WBEMException; + + /** + * getInstancePaths shall get the CIMObjectPaths + * using an enumeration context. + * + * @param pPath + * The CIMObjectPath representing the namespace to + * be used. + * @param pContext + * The enumeration context value for the enumeration session to + * be used. + * @param pMaxObjects + * Defines the maximum number of elements that this Open + * operation can return. The implementation may deliver any + * number of elements up to pMaxObjects but shall + * not deliver more than pMaxObjects elements. An + * implementation may choose to never return any elements during + * an Open operation, regardless of the value of + * pMaxObjects. + * @return EnumerateResponse that includes zero or more + * CIMObjectPath objects. + * @throws WBEMException + * If unsuccessful, one of the following status codes must be + * returned. The ORDERED list is: + * + * + * + * CIM_ERR_ACCESS_DENIED + * CIM_ERR_SERVER_IS_SHUTTING_DOWN + * CIM_ERR_NOT_SUPPORTED + * CIM_ERR_INVALID_NAMESPACE + * CIM_ERR_INVALID_PARAMETER + * CIM_ERR_INVALID_ENUMERATION_CONTEXT + * CIM_ERR_SERVER_LIMITS_EXCEEDED + * CIM_ERR_PULL_HAS_BEEN_ABANDONED + * CIM_ERR_FAILED (some other unspecified error occurred) + * + */ + public EnumerateResponse getInstancePaths(CIMObjectPath pPath, String pContext, + UnsignedInteger32 pMaxObjects) throws WBEMException; + + /** + * getInstances shall get the instances from an enumeration + * session started by execQueryInstances. + * + * @param pPath + * The CIMObjectPath representing the namespace to + * be used. + * @param pContext + * The enumeration context value for the enumeration session to + * be used. + * @param pMaxObjects + * Defines the maximum number of elements that this Open + * operation can return. The implementation may deliver any + * number of elements up to pMaxObjects but shall + * not deliver more than pMaxObjects elements. An + * implementation may choose to never return any elements during + * an Open operation, regardless of the value of + * pMaxObjects. Note that a CIM client can use a + * pMaxObjects value of 0 to specify that it does + * not want to retrieve any instances in the Open operation. + * @return EnumerateResponse that includes zero or more + * CIMObjectPath objects. + * @throws WBEMException + * If unsuccessful, one of the following status codes must be + * returned. The ORDERED list is: + * + * + * + * CIM_ERR_ACCESS_DENIED + * CIM_ERR_SERVER_IS_SHUTTING_DOWN + * CIM_ERR_NOT_SUPPORTED + * CIM_ERR_INVALID_NAMESPACE + * CIM_ERR_INVALID_PARAMETER + * CIM_ERR_INVALID_ENUMERATION_CONTEXT + * CIM_ERR_SERVER_LIMITS_EXCEEDED + * CIM_ERR_PULL_HAS_BEEN_ABANDONED + * CIM_ERR_FAILED + * + */ + public EnumerateResponse getInstances(CIMObjectPath pPath, String pContext, + UnsignedInteger32 pMaxObjects) throws WBEMException; + + /** + * getInstancesWithPath shall use the enumeration context + * provided to get the next set of instances for the enumeration session. + * + * @param pPath + * The CIMObjectPath representing the namespace to + * be used. + * @param pContext + * The enumeration context value for the enumeration session to + * be used. + * @param pMaxObjects + * Defines the maximum number of elements that this Open + * operation can return. The implementation may deliver any + * number of elements up to pMaxObjects but shall + * not deliver more than pMaxObjects elements. An + * implementation may choose to never return any elements during + * an Open operation, regardless of the value of + * pMaxObjects. + * @return EnumerateResponse that includes zero or more + * CIMObjectPath. objects. + * @throws WBEMException + * If unsuccessful, one of the following status codes must be + * returned. The ORDERED list is: + * + * + * + * CIM_ERR_ACCESS_DENIED + * CIM_ERR_SERVER_IS_SHUTTING_DOWN + * CIM_ERR_NOT_SUPPORTED + * CIM_ERR_INVALID_NAMESPACE + * CIM_ERR_INVALID_PARAMETER + * CIM_ERR_INVALID_ENUMERATION_CONTEXT + * CIM_ERR_SERVER_LIMITS_EXCEEDED + * CIM_ERR_PULL_HAS_BEEN_ABANDONED + * CIM_ERR_FAILED (some other unspecified error occurred) + * + */ + public EnumerateResponse getInstancesWithPath(CIMObjectPath pPath, + String pContext, UnsignedInteger32 pMaxObjects) throws WBEMException; + + /** + * Get property values. See WBEMClientConstants for a list of + * standard properties. + * + * @param pKey + * The name of the property. + * @return The value of the property. + * @see WBEMClientConstants + */ + public String getProperty(String pKey); + + /** + * Get a CIMQualifierType. + * + * @param pName + * CIMObjectPath that identifies the + * CIMQualifierType to return. + * @return The CIMQualifierType object. + * @throws UnsupportedOperationException + * If the client implementation (or protocol) does not support + * the operation. + * @throws WBEMException + * If unsuccessful, one of the following status codes must be + * returned. The ORDERED list is: + * + * + * CIM_ERR_ACCESS_DENIED + * CIM_ERR_NOT_SUPPORTED + * CIM_ERR_INVALID_NAMESPACE + * CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized + * or otherwise incorrect parameters) + * CIM_ERR_NOT_FOUND (the requested Qualifier declaration did not exist) + * CIM_ERR_FAILED (some other unspecified error occurred) + * + */ + public CIMQualifierType getQualifierType(CIMObjectPath pName) throws WBEMException; + + /** + * Initialize the client connection. This must be called before any + * operations. This must only be called once. + * + * @param pName + * The protocol and host to use (e.g. http://192.168.1.128/). Any + * other fields shall be ignored. + * @param pSubject + * The principal/credential pairs for this connection. + * @param pLocales + * An array of locales in order of priority of preference. + * @throws IllegalArgumentException + * If the host or scheme portion of the object path is null, or + * if the protocol is not supported. + * @throws WBEMException + * If the protocol adapter or security cannot be initialized. + */ + public void initialize(CIMObjectPath pName, Subject pSubject, Locale[] pLocales) + throws IllegalArgumentException, WBEMException; + + /** + * Executes the specified method on the specified object. + * + * @param pName + * CIM object path of the object whose method must be invoked. It + * must include all of the keys. + * @param pMethodName + * The name of the method to be invoked. + * @param pInputArguments + * The CIMArgument array of method input parameters. + *

      + * @param pOutputArguments + * The CIMArgument array of method output + * parameters. The array should be allocated large enough to hold + * all returned parameters. + * @return The return value of the specified method. + * @throws WBEMException + * If unsuccessful, one of the following status codes must be + * returned. The ORDERED list is: + * + * + * CIM_ERR_ACCESS_DENIED + * CIM_ERR_NOT_SUPPORTED (implementation DOES NOT support ANY + * Extrinsic Method Invocation) + * CIM_ERR_INVALID_NAMESPACE + * CIM_ERR_INVALID_PARAMETER (for this method) + * CIM_ERR_NOT_FOUND (if instance does not exist) + * CIM_ERR_METHOD_NOT_FOUND + * CIM_ERR_METHOD_NOT_AVAILABLE + * CIM_ERR_FAILED (some other unspecified error occurred) + * + */ + public Object invokeMethod(CIMObjectPath pName, String pMethodName, + CIMArgument[] pInputArguments, CIMArgument[] pOutputArguments) + throws WBEMException; + + /** + * Modify the CIMClass. + * + * @param pClass + * CIMClass to be modified. + * @throws UnsupportedOperationException + * If the client implementation (or protocol) does not support + * the operation. + * @throws WBEMException + * If unsuccessful, one of the following status codes must be + * returned. The ORDERED list is: + * + * + * CIM_ERR_ACCESS_DENIED + * CIM_ERR_NOT_SUPPORTED + * CIM_ERR_INVALID_NAMESPACE + * CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized + * or otherwise incorrect parameters) + * CIM_ERR_INVALID_SUPERCLASS (the putative CIM Class declares a + * non-existent superclass) + * CIM_ERR_CLASS_HAS_CHILDREN (the modification could not be performed + * because it was not possible to update the subclasses of the Class + * in a consistent fashion) + * CIM_ERR_CLASS_HAS_INSTANCES (the modification could not be performed + * because it was not possible to update the instances of the Class in + * a consistent fashion) + * CIM_ERR_FAILED (some other unspecified error occurred) + * + */ + public void modifyClass(CIMClass pClass) throws WBEMException; + + /** + * Modify some or all of the properties of the specified + * CIMInstance. + * + * @param pInstance + * CIMInstance to be modified. All Keys must be + * populated. + * @param pPropertyList + * An array of property names used to specify which values from + * the CIMInstance specified to set. Properties not + * specified in this list but set in the CIMInstance + * specified are not modified. Duplicate property names are + * ignored and the request is otherwise processed normally. If + * the pPropertyList contains invalid property names + * for the instance to be modified, the server shall reject the + * request. An empty array indicates that no properties should be + * modified. A null value indicates that all + * properties should be modified. + * @throws WBEMException + * If unsuccessful, one of the following status codes must be + * returned. The ORDERED list is: + * + * + * CIM_ERR_ACCESS_DENIED + * CIM_ERR_NOT_SUPPORTED (provider does not support this method) + * CIM_ERR_INVALID_NAMESPACE + * CIM_ERR_INVALID_PARAMETER (for this method) + * CIM_ERR_INVALID_CLASS (in this namespace) + * CIM_ERR_NOT_FOUND (if instance does not exist) + * CIM_ERR_NO_SUCH_PROPERTY (in this instance) + * CIM_ERR_FAILED (some other unspecified error occurred) + * + */ + public void modifyInstance(CIMInstance pInstance, String[] pPropertyList) throws WBEMException; + + /** + * Enumerates the Association classes that refer to a specified source CIM + * Class. + * + * @param pObjectName + * CIMObjectPath defining the source CIM class whose + * referring classes are to be returned. pObjectName + * shall contain the scheme, host, namespace and object name + * (class name). + * @param pResultClass + * This string shall either contain a valid CIM Class name or be + * null. The pResultClass filters the + * classes returned to contain only the classes of this Class + * name or one of its subclasses. + * @param pRole + * This string MUST either contain a valid Property name or be + * null. It filters the Objects returned to contain + * only Objects referring to the source Object via a Property + * with the specified name. If "Antecedent" is specified, then + * only Associations in which the source Object is the + * "Antecedent" reference are returned. + * @param pIncludeQualifiers + * If true, all Qualifiers for each Object + * (including Qualifiers on the Object and on any returned + * Properties) shall be included in the classes returned. If + * false, no Qualifiers shall be present in each + * class returned. + * @param pIncludeClassOrigin + * The class origin attribute is the name of the class that first + * defined the property or method. If true, the + * class Origin attribute shall be present for each property and + * method on all classes returned. If false, the + * class origin shall not be present. + * @param pPropertyList + * An array of property names used to filter what is contained in + * the Objects returned. Each CIMClass returned + * shall only contains elements for the properties of the names + * specified. Duplicate and invalid property names are ignored + * and the request is otherwise processed normally. An empty + * array indicates that no properties should be included in the + * classes returned. A null value indicates that all + * properties should be contained in the classes returned. + * @return If successful, a CloseableIterator referencing zero + * or more CIMClasses meeting the specified criteria. + * @throws UnsupportedOperationException + * If the client implementation (or protocol) does not support + * the operation. + * @throws WBEMException + * If unsuccessful, one of the following status codes shall be + * returned along with zero or more instance of + * CIM_Error. The ORDERED list is: + * + * + * CIM_ERR_ACCESS_DENIED + * CIM_ERR_NOT_SUPPORTED + * CIM_ERR_INVALID_NAMESPACE + * CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized + * or otherwise incorrect parameters) + * CIM_ERR_FAILED (some other unspecified error occurred) + * + */ + + CloseableIterator referenceClasses(CIMObjectPath pObjectName, String pResultClass, + String pRole, boolean pIncludeQualifiers, boolean pIncludeClassOrigin, + String[] pPropertyList) throws WBEMException; + + /** + * Enumerates the Association instances that refer to a specified source CIM + * Instance. + * + * @param pObjectName + * CIMObjectPath defining the source CIM Instance + * whose referring instances are to be returned. The + * pObjectName shall include the host, object name + * and keys. + * @param pResultClass + * This string shall either contain a valid CIM Class name or be + * null. It filters the instances returned to + * contain only the instances of this Class name or one of its + * subclasses. + * @param pRole + * This string shall either contain a valid Property name or be + * null. The role filters the instances returned to + * contain only instances referring to the source instance via a + * property with the specified name. For example, If "Antecedent" + * is specified, then only Associations in which the source + * instance is the "Antecedent" reference are returned. + * @param pIncludeClassOrigin + * The class origin attribute is the name of the class that first + * defined the property. If true, the class origin + * attribute may be present for each property and on all + * instances returned, even if requested the server may ignore + * the request and not return the class origin. If + * false, the class origin shall not be present. + * @param pPropertyList + * An array of property names used to filter what is contained in + * the instances returned. Each CIMInstance returned + * shall only contain elements for the properties of the names + * specified. Duplicate and invalid property names are ignored + * and the request is otherwise processed normally. An empty + * array indicates that no properties should be included in the + * instances returned. A null value indicates that + * all properties supported shall be contained in the instance + * returned. + * @return If successful, a CloseableIterator referencing zero + * or more CIMInstances meeting the specified criteria. + * @throws WBEMException + * If unsuccessful, one of the following status codes shall be + * returned along with zero or more CIM_Error + * instances. The ORDERED list is: + * + * + * CIM_ERR_ACCESS_DENIED + * CIM_ERR_NOT_SUPPORTED + * CIM_ERR_INVALID_NAMESPACE + * CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized + * or otherwise incorrect parameters) + * CIM_ERR_FAILED (some other unspecified error occurred) + * + */ + CloseableIterator referenceInstances(CIMObjectPath pObjectName, + String pResultClass, String pRole, boolean pIncludeClassOrigin, String[] pPropertyList) + throws WBEMException; + + /** + * Enumerates the CIMObjectPaths of Association Objects that + * refer to a particular source CIM Object. If the source Object is a CIM + * Class, then a CloseableIterator of + * CIMObjectPaths of the Association classes that refer to the + * source Object is returned. If the source Object is a CIM Instance, then a + * CloseableIterator of CIMObjectPaths of the + * CIMInstance objects that refer to the source Object is + * returned. + * + * @param pObjectName + * CIMObjectPath defining the source CIM Object + * whose referring Objects are to be returned. This argument may + * contain either a Class name or the modelpath of an Instance. + * (i.e. Keys populated) + * @param pResultClass + * This string MUST either contain a valid CIM Class name or be + * null. It filters the Objects returned to contain + * only the Objects of this Class name or one of its subclasses. + * @param pRole + * This string MUST either contain a valid Property name or be + * null. It filters the Objects returned to contain + * only Objects referring to the source Object via a Property + * with the specified name. If "Antecedent" is specified, then + * only Associations in which the source Object is the + * "Antecedent" reference are returned. + * @return If successful, a CloseableIterator referencing zero + * or more CIMObjectPaths of CIMClasses or + * CIMInstances meeting the specified criteria. + * @throws WBEMException + * If unsuccessful, one of the following status codes must be + * returned. The ORDERED list is: + * + * + * CIM_ERR_ACCESS_DENIED + * CIM_ERR_NOT_SUPPORTED + * CIM_ERR_INVALID_NAMESPACE + * CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized + * or otherwise incorrect parameters) + * CIM_ERR_FAILED (some other unspecified error occurred) + * + */ + public CloseableIterator referenceNames(CIMObjectPath pObjectName, + String pResultClass, String pRole) throws WBEMException; + + /** + * referencePaths shall start an enumeration session for + * association instances that have references that refer to the instance + * defined in the pInstancePath parameter and return zero or + * more CIMObjectPath objects. + * + * @param pInstancePath + * The CIMObjectPath for the instance for which the + * enumeration is to be performed. + * @param pResultClass + * This string MUST either contain a valid CIM Class name or be + * null. It filters the Objects returned to contain + * only the Objects of this Class name or one of its subclasses. + * @param pRole + * This string MUST either contain a valid Property name or be + * null. It filters the Objects returned to contain + * only Objects referring to the source Object via a Property + * with the specified name. If "Antecedent" is specified, then + * only Associations in which the source Object is the + * "Antecedent" reference are returned. + * @param pFilterQueryLanguage + * The pFilterQueryLanguage represents the query + * language for the pFilterQuery argument. This must + * be left null if a pFilterQuery is + * not supplied. If the implementation does not support the query + * language specified, the + * CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED error shall + * be returned. If the implementation does not support filtered + * enumerations, the + * CIM_ERR_FILTERED_ENUMERATION_NOT_SUPPORTED error + * shall be returned. + * @param pFilterQuery + * The pFilterQuery specifies a query in the form of + * the query language specified by the + * pFilterQueryLanguage parameter. If this value is + * not null, the pFilterQueryLanguage + * parameter must be non-null. This value shall act + * as an additional filter on the result set. If the + * implementation does not support the query language specified, + * the CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED error + * shall be returned. If the implementation does not support + * filtered enumerations, the + * CIM_ERR_FILTERED_ENUMERATION_NOT_SUPPORTED error + * shall be returned. + * @param pTimeout + * This input parameter determines the minimum time the CIM + * server shall maintain the open enumeration session after the + * last Open or Pull operation (unless the enumeration session is + * closed). If the operation timeout is exceeded, the + * implementation may close the enumeration session at any time, + * releasing any resources allocated to the enumeration session. + * A pTimeout of 0 means that there is no operation + * timeout. That is, the enumeration session is never closed + * based on time. If pTimeout is null, + * the implementation shall choose an operation timeout. All + * other values for pTimeout specify the operation + * timeout in seconds. A implementation may restrict the set of + * allowable values for pTimeout. Specifically, the + * implementation may not allow 0 (no timeout). If the specified + * value is not an allowable value, the implementation shall + * return failure with the status code + * CIM_ERR_INVALID_OPERATION_TIMEOUT. + * @param pContinueOnError + * If true, requests that the operation resume when + * an error is received. If a implementation does not support + * continuation on error and pContinueOnError is + * true, it shall throw a WBEMException + * with the status code + * CIM_ERR_CONTINUATION_ON_ERROR_NOT_SUPPORTED. If a + * implementation supports continuation on error and + * pContinueOnError is true, the + * enumeration session shall remain open when a Pull operation + * fails, and any subsequent successful Pull operations shall + * return the set of elements that would have been returned if + * the failing Pull operations were successful. This behavior is + * subject to the consistency rules defined for pulled + * enumerations. If pContinueOnError is + * false, the enumeration session shall be closed + * when either the operation completes successfully or when a + * WBEMExcetpion is thrown. + * @param pMaxObjects + * Defines the maximum number of elements that this Open + * operation can return. The implementation may deliver any + * number of elements up to pMaxObjects but shall + * not deliver more than pMaxObjects elements. An + * implementation may choose to never return any elements during + * an Open operation, regardless of the value of + * pMaxObjects. Note that a CIM client can use a + * pMaxObjects value of 0 to specify that it does + * not want to retrieve any instances in the Open operation. + * @return The return value of a successful Open operation is an array of + * enumerated elements with a number of entries from 0 up to a + * maximum defined by pMaxObjects. These entries meet + * the criteria defined in the Open operation. Note that returning + * no entries in the array does not imply that the enumeration + * session is exhausted. Client must evaluate the + * EnumerateResponse.isEnd() to determine if there are + * more elements. + * @throws WBEMException + * If unsuccessful, one of the following status codes must be + * returned. The ORDERED list is: + * + * + * + * CIM_ERR_ACCESS_DENIED + * CIM_ERR_SERVER_IS_SHUTTING_DOWN + * CIM_ERR_NOT_SUPPORTED + * CIM_ERR_INVALID_NAMESPACE + * CIM_ERR_INVALID_OPERATION_TIMEOUT + * CIM_ERR_CONTINUATION_ON_ERROR_NOT_SUPPORTED + * CIM_ERR_INVALID_PARAMETER + * CIM_ERR_NOT_FOUND (the source instance was not found) + * CIM_ERR_FILTERED_ENUMERATION_NOT_SUPPORTED + * CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED + * CIM_ERR_INVALID_QUERY + * CIM_ERR_FAILED (some other unspecified error occurred) + * + */ + public EnumerateResponse referencePaths(CIMObjectPath pInstancePath, + String pResultClass, String pRole, String pFilterQueryLanguage, String pFilterQuery, + UnsignedInteger32 pTimeout, boolean pContinueOnError, UnsignedInteger32 pMaxObjects) + throws WBEMException; + + /** + * references shall start an enumeration session for + * association instances that have references that refer to the instance + * defined in the pInstancePath parameter and return zero or + * more CIMInstance objects. + * + * @param pInstancePath + * The CIMObjectPath for the instance for which the + * enumeration is to be performed. + * @param pResultClass + * This string shall either contain a CIM Class name or be + * null. It filters the instances returned to + * contain only the instances of this Class name or one of its + * subclasses. + * @param pRole + * This string shall either contain a Property name or be + * null. It filters the instances returned to + * contain only instances referring to the source instance via a + * Property with the specified name. If "Antecedent" is + * specified, then only Associations in which the source instance + * is the "Antecedent" reference are returned. + * @param pIncludeClassOrigin + * The class origin attribute is the name of the class that first + * defined the property. If true, the class origin + * attribute may be present for each property on all instances + * returned, even if requested the server may ignore the request + * and not return the class origin. If false, the + * class origin shall not be present. + * @param pPropertyList + * An array of property names used to filter what is contained in + * the instances returned. Each CIMInstance returned + * only contains elements for the properties of the names + * specified. Duplicate and invalid property names are ignored + * and the request is otherwise processed normally. An empty + * array indicates that no properties should be included in the + * Objects returned. A null value indicates that all + * non-null properties of the instance are included. + * @param pFilterQueryLanguage + * The pFilterQueryLanguage represents the query + * language for the pFilterQuery argument. This must + * be left null if a pFilterQuery is + * not supplied. If the implementation does not support the query + * language specified, the + * CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED error shall + * be returned. If the implementation does not support filtered + * enumerations, the + * CIM_ERR_FILTERED_ENUMERATION_NOT_SUPPORTED error + * shall be returned. + * @param pFilterQuery + * The pFilterQuery specifies a query in the form of + * the query language specified by the + * pFilterQueryLanguage parameter. If this value is + * not null, the pFilterQueryLanguage + * parameter must be non-null. This value shall act + * as an additional filter on the result set. If the + * implementation does not support the query language specified, + * the CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED error + * shall be returned. If the implementation does not support + * filtered enumerations, the + * CIM_ERR_FILTERED_ENUMERATION_NOT_SUPPORTED error + * shall be returned. + * @param pTimeout + * This input parameter determines the minimum time the CIM + * server shall maintain the open enumeration session after the + * last Open or Pull operation (unless the enumeration session is + * closed). If the operation timeout is exceeded, the + * implementation may close the enumeration session at any time, + * releasing any resources allocated to the enumeration session. + * A pTimeout of 0 means that there is no operation + * timeout. That is, the enumeration session is never closed + * based on time. If pTimeout is null, + * the implementation shall choose an operation timeout. All + * other values for pTimeout specify the operation + * timeout in seconds. A implementation may restrict the set of + * allowable values for pTimeout. Specifically, the + * implementation may not allow 0 (no timeout). If the specified + * value is not an allowable value, the implementation shall + * return failure with the status code + * CIM_ERR_INVALID_OPERATION_TIMEOUT. + * @param pContinueOnError + * If true, requests that the operation resume when + * an error is received. If a implementation does not support + * continuation on error and pContinueOnError is + * true, it shall throw a WBEMException + * with the status code + * CIM_ERR_CONTINUATION_ON_ERROR_NOT_SUPPORTED. If a + * implementation supports continuation on error and + * pContinueOnError is true, the + * enumeration session shall remain open when a Pull operation + * fails, and any subsequent successful Pull operations shall + * return the set of elements that would have been returned if + * the failing Pull operations were successful. This behavior is + * subject to the consistency rules defined for pulled + * enumerations. If pContinueOnError is + * false, the enumeration session shall be closed + * when either the operation completes successfully or when a + * WBEMExcetpion is thrown. + * @param pMaxObjects + * Defines the maximum number of elements that this Open + * operation can return. The implementation may deliver any + * number of elements up to pMaxObjects but shall + * not deliver more than pMaxObjects elements. An + * implementation may choose to never return any elements during + * an Open operation, regardless of the value of + * pMaxObjects. Note that a CIM client can use a + * pMaxObjects value of 0 to specify that it does + * not want to retrieve any instances in the Open operation. + * @return The return value of a successful Open operation is an array of + * enumerated elements with a number of entries from 0 up to a + * maximum defined by pMaxObjects. These entries meet + * the criteria defined in the Open operation. Note that returning + * no entries in the array does not imply that the enumeration + * session is exhausted. Client must evaluate the + * EnumerateResponse.isEnd() to determine if there are + * more elements. + * @throws WBEMException + * If unsuccessful, one of the following status codes must be + * returned. The ORDERED list is: + * + * + * CIM_ERR_ACCESS_DENIED + * CIM_ERR_SERVER_IS_SHUTTING_DOWN + * CIM_ERR_NOT_SUPPORTED + * CIM_ERR_INVALID_NAMESPACE + * CIM_ERR_INVALID_OPERATION_TIMEOUT + * CIM_ERR_CONTINUATION_ON_ERROR_NOT_SUPPORTED + * CIM_ERR_INVALID_PARAMETER + * CIM_ERR_NOT_FOUND (the source instance was not found) + * CIM_ERR_FILTERED_ENUMERATION_NOT_SUPPORTED + * CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED + * CIM_ERR_INVALID_QUERY + * CIM_ERR_FAILED (some other unspecified error occurred) + * + */ + public EnumerateResponse references(CIMObjectPath pInstancePath, + String pResultClass, String pRole, boolean pIncludeClassOrigin, String[] pPropertyList, + String pFilterQueryLanguage, String pFilterQuery, UnsignedInteger32 pTimeout, + boolean pContinueOnError, UnsignedInteger32 pMaxObjects) throws WBEMException; + + /** + * Change the locales that were provided during initialization. + * + * @param pLocales + * An array of locales in order of priority of preference. + */ + public void setLocales(Locale[] pLocales); + + /** + * Set properties that enable options or protocol specific properties. See + * WBEMClientConstants for a list of standard properties. + * + * @param pKey + * The name of the property. + * @param pValue + * The value of the property. + * @throws IllegalArgumentException + * If the name is not a supported property name. + * @see WBEMClientConstants + */ + public void setProperty(String pKey, String pValue); + + /** + * Add a CIMQualifierType to the specified namespace if it does + * not already exist. Otherwise, it modifies the qualifier type to the value + * specified. + * + * @param pQualifierType + * The CIM qualifier type to be added. + * @throws UnsupportedOperationException + * If the client implementation (or protocol) does not support + * the operation. + * @throws WBEMException + * If unsuccessful, one of the following status codes must be + * returned. The ORDERED list is: + * + * + * CIM_ERR_ACCESS_DENIED + * CIM_ERR_NOT_SUPPORTED + * CIM_ERR_INVALID_NAMESPACE + * CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized + * or otherwise incorrect parameters) + * CIM_ERR_FAILED (some other unspecified error occurred) + * + */ + public void setQualifierType(CIMQualifierType pQualifierType) throws WBEMException; +} diff --git a/src/main/java/org/sentrysoftware/wbem/javax/wbem/client/WBEMClientConstants.java b/src/main/java/org/metricshub/wbem/javax/wbem/client/WBEMClientConstants.java similarity index 85% rename from src/main/java/org/sentrysoftware/wbem/javax/wbem/client/WBEMClientConstants.java rename to src/main/java/org/metricshub/wbem/javax/wbem/client/WBEMClientConstants.java index becaeab..5d4ecf9 100644 --- a/src/main/java/org/sentrysoftware/wbem/javax/wbem/client/WBEMClientConstants.java +++ b/src/main/java/org/metricshub/wbem/javax/wbem/client/WBEMClientConstants.java @@ -1,160 +1,158 @@ -/* - (C) Copyright IBM Corp. 2009, 2012 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Dave Blaschke, blaschke@us.ibm.com - * - * Change History - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 2882448 2009-10-21 blaschke-oss Add WBEMClientConstants from JSR48 - * 2884718 2009-10-23 blaschke-oss Merge JSR48 and SBLIM client properties - * 2930341 2010-01-12 blaschke-oss Sync up WBEMClientConstants with JSR48 1.0.0 - * 2959264 2010-02-25 blaschke-oss Sync up javax.client.* javadoc with JSR48 1.0.0 - * 3496301 2012-03-02 blaschke-oss Sync up javax.* javadoc with JSR48 1.0.0 Final - * 3496355 2012-03-02 blaschke-oss JSR48 1.0.0: add new WBEMClientConstants - * 3521157 2012-05-10 blaschke-oss JSR48 1.0.0: PROP_ENABLE_*_LOGGING is Level, not 0/1 - */ -package org.sentrysoftware.wbem.javax.wbem.client; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -//Sync'd against JSR48 1.0.0 javadoc (build 1.6.0_18) on Thu Mar 01 12:21:26 EST 2012 -/** - * This class defines the constants used for WBEMClient - * configuration. If a property is tagged as optional an implementation may or - * may not support the property. If the implementation does not support the - * property, it must throw an IllegalArgumentException if the - * property value is attempted to be set. - */ -public class WBEMClientConstants { - - /** - * Use this property to set the list of ciphers the client will support. - * Setting this value to null will use the default set of ciphers provided - * by the version of Java being used. Optional. - */ - public static final String PROP_CLIENT_CIPHERS = "javax.wbem.client.ciphers"; - - /** - * This property along with the PROP_CLIENT_KEYSTORE_PASSWORD and - * PROP_CLIENT_TRUSTSTORE are used to configure mutual authentication. This - * property is used to provide the filename of the keystore. The path can be - * relative or full. Optional. - */ - public static final String PROP_CLIENT_KEYSTORE = "javax.wbem.client.keyStore"; - - /** - * This property along with the PROP_CLIENT_KEYSTORE and - * PROP_CLIENT_TRUSTSTORE are used to configure mutual authentication. This - * property is used to provide the password of the keystore. Optional. - */ - public static final String PROP_CLIENT_KEYSTORE_PASSWORD = "javax.wbem.client.keyStorePassword"; - - /** - * This property along with the PROP_CLIENT_KEYSTORE and - * PROP_CLIENT_KEYSTORE_PASSWORD are used to configure mutual - * authentication. This property is used to provide the filename of the - * truststore. The path can be relative or full. Optional. - */ - public static final String PROP_CLIENT_TRUSTSTORE = "javax.wbem.client.trustStore"; - - /** - * The value for this property is the level of debug requested. - */ - public static final String PROP_ENABLE_CONSOLE_LOGGING = "javax.wbem.client.log.console.enabled"; - - /** - * The value for this property is the level of debug requested. - */ - public static final String PROP_ENABLE_FILE_LOGGING = "javax.wbem.client.log.file.enabled"; - - /** - * The maximum size in bytes for each log file. The default is 5MB. Note - * that when the last entry is written, it may go past the limit. - */ - public static final String PROP_LOG_BYTE_LIMIT = "javax.wbem.client.log.maxfilesize"; - - /** - * Set this property to the directory where the log files are created. The - * default is the directory in which the WBEM client program is run. - */ - public static final String PROP_LOG_DIR = "javax.wbem.client.log.dir"; - - /** - * The name of the client log file. For a WBEM client using the CIM-XML or - * WS-Management protocol the default is cimclient_log_N.txt where N is the - * logfile number. The first client log file number is 0. - */ - public static final String PROP_LOG_FILENAME = "javax.wbem.client.log.filename"; - - /** - * The number of log files that will be used. They will be used in - * round-robin fashion. The default is 3. - */ - public static final String PROP_LOG_NUM_FILES = "javax.wbem.client.log.numfiles"; - - /** - * The timeout for the client to wait for connections. This value is in - * milliseconds. The default is 0 - unlimited. This value must be a valid - * integer. - */ - public static final String PROP_TIMEOUT = "javax.wbem.client.timeout"; - - /** - * This property will enable HTTP chunking for a client request. Set this - * property to "1" to use chunking. Set to "0" to not use chunking. The - * default is 1. Optional. - */ - public static final String PROPERTY_WBEM_CHUNKING = "javax.wbem.chunking"; - - /** - * The CIM-XML Protocol as defined by the DMTF in the following - * specifications: - * - *
      -	 * DSP0200 - CIM Operations over HTTP 
      -	 * DSP0201 - Representation of CIM Using XML 
      -	 * DSP0203 - CIM DTD
      -	 * 
      -	 */
      -	public static final String PROTOCOL_CIMXML = "CIM-XML";
      -
      -	/**
      -	 * The WS-Management Protocol as defined by the DMTF in the following
      -	 * specifications:
      -	 * 
      -	 * 
      -	 * DSP0226 - WS-Management 
      -	 * DSP0227 - WS-Management CIM Binding Specification 
      -	 * DSP0230 - WS-CIM Mapping Specification
      -	 * 
      -	 */
      -	public static final String PROTOCOL_WSMANAGEMENT = "WS-Management";
      -}
      +/*
      +  (C) Copyright IBM Corp. 2009, 2012
      +
      +  THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE
      +  ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE
      +  CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT.
      +
      +  You can obtain a current copy of the Eclipse Public License from
      +  http://www.opensource.org/licenses/eclipse-1.0.php
      +
      +  @author : Dave Blaschke, blaschke@us.ibm.com
      + * 
      + * Change History
      + * Flag       Date        Prog         Description
      + * -------------------------------------------------------------------------------
      + * 2882448    2009-10-21  blaschke-oss Add WBEMClientConstants from JSR48
      + * 2884718    2009-10-23  blaschke-oss Merge JSR48 and SBLIM client properties
      + * 2930341    2010-01-12  blaschke-oss Sync up WBEMClientConstants with JSR48 1.0.0
      + * 2959264    2010-02-25  blaschke-oss Sync up javax.client.* javadoc with JSR48 1.0.0
      + * 3496301    2012-03-02  blaschke-oss Sync up javax.* javadoc with JSR48 1.0.0 Final
      + * 3496355    2012-03-02  blaschke-oss JSR48 1.0.0: add new WBEMClientConstants
      + * 3521157    2012-05-10  blaschke-oss JSR48 1.0.0: PROP_ENABLE_*_LOGGING is Level, not 0/1
      + */
      +package org.metricshub.wbem.javax.wbem.client;
      +
      +/*-
      + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲
      + * WBEM Java Client
      + * ჻჻჻჻჻჻
      + * Copyright 2023 - 2025 MetricsHub
      + * ჻჻჻჻჻჻
      + * Licensed under the Apache License, Version 2.0 (the "License");
      + * you may not use this file except in compliance with the License.
      + * You may obtain a copy of the License at
      + *
      + *      http://www.apache.org/licenses/LICENSE-2.0
      + *
      + * Unless required by applicable law or agreed to in writing, software
      + * distributed under the License is distributed on an "AS IS" BASIS,
      + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      + * See the License for the specific language governing permissions and
      + * limitations under the License.
      + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱
      + */
      +
      +//Sync'd against JSR48 1.0.0 javadoc (build 1.6.0_18) on Thu Mar 01 12:21:26 EST 2012
      +/**
      + * This class defines the constants used for WBEMClient
      + * configuration. If a property is tagged as optional an implementation may or
      + * may not support the property. If the implementation does not support the
      + * property, it must throw an IllegalArgumentException if the
      + * property value is attempted to be set.
      + */
      +public class WBEMClientConstants {
      +
      +	/**
      +	 * Use this property to set the list of ciphers the client will support.
      +	 * Setting this value to null will use the default set of ciphers provided
      +	 * by the version of Java being used. Optional.
      +	 */
      +	public static final String PROP_CLIENT_CIPHERS = "javax.wbem.client.ciphers";
      +
      +	/**
      +	 * This property along with the PROP_CLIENT_KEYSTORE_PASSWORD and
      +	 * PROP_CLIENT_TRUSTSTORE are used to configure mutual authentication. This
      +	 * property is used to provide the filename of the keystore. The path can be
      +	 * relative or full. Optional.
      +	 */
      +	public static final String PROP_CLIENT_KEYSTORE = "javax.wbem.client.keyStore";
      +
      +	/**
      +	 * This property along with the PROP_CLIENT_KEYSTORE and
      +	 * PROP_CLIENT_TRUSTSTORE are used to configure mutual authentication. This
      +	 * property is used to provide the password of the keystore. Optional.
      +	 */
      +	public static final String PROP_CLIENT_KEYSTORE_PASSWORD = "javax.wbem.client.keyStorePassword";
      +
      +	/**
      +	 * This property along with the PROP_CLIENT_KEYSTORE and
      +	 * PROP_CLIENT_KEYSTORE_PASSWORD are used to configure mutual
      +	 * authentication. This property is used to provide the filename of the
      +	 * truststore. The path can be relative or full. Optional.
      +	 */
      +	public static final String PROP_CLIENT_TRUSTSTORE = "javax.wbem.client.trustStore";
      +
      +	/**
      +	 * The value for this property is the level of debug requested.
      +	 */
      +	public static final String PROP_ENABLE_CONSOLE_LOGGING = "javax.wbem.client.log.console.enabled";
      +
      +	/**
      +	 * The value for this property is the level of debug requested.
      +	 */
      +	public static final String PROP_ENABLE_FILE_LOGGING = "javax.wbem.client.log.file.enabled";
      +
      +	/**
      +	 * The maximum size in bytes for each log file. The default is 5MB. Note
      +	 * that when the last entry is written, it may go past the limit.
      +	 */
      +	public static final String PROP_LOG_BYTE_LIMIT = "javax.wbem.client.log.maxfilesize";
      +
      +	/**
      +	 * Set this property to the directory where the log files are created. The
      +	 * default is the directory in which the WBEM client program is run.
      +	 */
      +	public static final String PROP_LOG_DIR = "javax.wbem.client.log.dir";
      +
      +	/**
      +	 * The name of the client log file. For a WBEM client using the CIM-XML or
      +	 * WS-Management protocol the default is cimclient_log_N.txt where N is the
      +	 * logfile number. The first client log file number is 0.
      +	 */
      +	public static final String PROP_LOG_FILENAME = "javax.wbem.client.log.filename";
      +
      +	/**
      +	 * The number of log files that will be used. They will be used in
      +	 * round-robin fashion. The default is 3.
      +	 */
      +	public static final String PROP_LOG_NUM_FILES = "javax.wbem.client.log.numfiles";
      +
      +	/**
      +	 * The timeout for the client to wait for connections. This value is in
      +	 * milliseconds. The default is 0 - unlimited. This value must be a valid
      +	 * integer.
      +	 */
      +	public static final String PROP_TIMEOUT = "javax.wbem.client.timeout";
      +
      +	/**
      +	 * This property will enable HTTP chunking for a client request. Set this
      +	 * property to "1" to use chunking. Set to "0" to not use chunking. The
      +	 * default is 1. Optional.
      +	 */
      +	public static final String PROPERTY_WBEM_CHUNKING = "javax.wbem.chunking";
      +
      +	/**
      +	 * The CIM-XML Protocol as defined by the DMTF in the following
      +	 * specifications:
      +	 * 
      +	 * 
      +	 * DSP0200 - CIM Operations over HTTP 
      +	 * DSP0201 - Representation of CIM Using XML 
      +	 * DSP0203 - CIM DTD
      +	 * 
      +	 */
      +	public static final String PROTOCOL_CIMXML = "CIM-XML";
      +
      +	/**
      +	 * The WS-Management Protocol as defined by the DMTF in the following
      +	 * specifications:
      +	 * 
      +	 * 
      +	 * DSP0226 - WS-Management 
      +	 * DSP0227 - WS-Management CIM Binding Specification 
      +	 * DSP0230 - WS-CIM Mapping Specification
      +	 * 
      +	 */
      +	public static final String PROTOCOL_WSMANAGEMENT = "WS-Management";
      +}
      diff --git a/src/main/java/org/sentrysoftware/wbem/javax/wbem/client/WBEMClientFactory.java b/src/main/java/org/metricshub/wbem/javax/wbem/client/WBEMClientFactory.java
      similarity index 77%
      rename from src/main/java/org/sentrysoftware/wbem/javax/wbem/client/WBEMClientFactory.java
      rename to src/main/java/org/metricshub/wbem/javax/wbem/client/WBEMClientFactory.java
      index ec48a00..b896b10 100644
      --- a/src/main/java/org/sentrysoftware/wbem/javax/wbem/client/WBEMClientFactory.java
      +++ b/src/main/java/org/metricshub/wbem/javax/wbem/client/WBEMClientFactory.java
      @@ -1,116 +1,113 @@
      -/*
      -  (C) Copyright IBM Corp. 2006, 2012
      -
      -  THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE
      -  ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE
      -  CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT.
      -
      -  You can obtain a current copy of the Eclipse Public License from
      -  http://www.opensource.org/licenses/eclipse-1.0.php
      -
      -  @author : Alexander Wolf-Reber, a.wolf-reber@de.ibm.com
      - * 
      - * Change History
      - * Flag       Date        Prog         Description
      - * -------------------------------------------------------------------------------
      - * 1565892    2006-11-08  lupusalex    Make SBLIM client JSR48 compliant
      - * 1737141    2007-06-18  ebak         Sync up with JSR48 evolution
      - * 2003590    2008-06-30  blaschke-oss Change licensing from CPL to EPL
      - * 2204488 	  2008-10-28  raman_arora  Fix code to remove compiler warnings
      - * 2524131    2009-01-21  raman_arora  Upgrade client to JDK 1.5 (Phase 1)
      - * 2882448    2009-10-21  blaschke-oss Add WBEMClientConstants from JSR48
      - * 2959264    2010-02-25  blaschke-oss Sync up javax.client.* javadoc with JSR48 1.0.0
      - * 3490355    2012-02-21  blaschke-oss TCK: Cannot instantiate WBEMClientFactory
      - */
      -
      -package org.sentrysoftware.wbem.javax.wbem.client;
      -
      -/*-
      - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲
      - * WBEM Java Client
      - * ჻჻჻჻჻჻
      - * Copyright (C) 2023 Sentry Software
      - * ჻჻჻჻჻჻
      - * This program is free software: you can redistribute it and/or modify
      - * it under the terms of the GNU Lesser General Public License as
      - * published by the Free Software Foundation, either version 3 of the
      - * License, or (at your option) any later version.
      - *
      - * This program is distributed in the hope that it will be useful,
      - * but WITHOUT ANY WARRANTY; without even the implied warranty of
      - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      - * GNU General Lesser Public License for more details.
      - *
      - * You should have received a copy of the GNU General Lesser Public
      - * License along with this program.  If not, see
      - * .
      - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱
      - */
      -
      -import org.sentrysoftware.wbem.javax.wbem.WBEMException;
      -
      -import org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.WBEMClientCIMXML;
      -
      -//Sync'd against JSR48 1.0.0 javadoc (build 1.5.0_10) on Wed Jan 20 02:20:59 EST 2010
      -/**
      - * This class defines the functionality of a WBEMClient factory,
      - * which is used to retrieve a WBEMClient for a specified protocol.
      - * An example of how to use the factory is included below.
      - * 
      - * 
      - *   ...
      - *   WBEMClient cc = null;
      - *   
      - *   try {
      - *     cc = WBEMClientFactory.getClient(WBEMClientConstants.PROTOCOL_CIMXML);
      - *   } catch (Exception e) {
      - *     System.out.println("Received error when trying to retrieve client handle");
      - *     System.exit(-1);
      - *   }
      - *   
      - *   // initialize the client 
      - *   cc.initialize(cns, s, null);
      - *   ...
      - * 
      - */ - -public class WBEMClientFactory extends Object { - - private static final String[] cProtocols = { WBEMClientConstants.PROTOCOL_CIMXML }; - - /** - * - */ - public WBEMClientFactory() { /**/} - - /** - * Get a WBEMClient for a protocol. - * - * @param pProtocol - * The protocol name (e.g. "CIM-XML"). - * @return The WBEMClient implementation for the protocol - * specified. - * @throws IllegalArgumentException - *
      If the protocol is - * null or empty.
      If the protocol is not - * supported.
      - * @throws WBEMException - * If the protocol implementation could not be loaded. - */ - public static WBEMClient getClient(String pProtocol) throws WBEMException { - - if (WBEMClientConstants.PROTOCOL_CIMXML.equalsIgnoreCase(pProtocol)) { return new WBEMClientCIMXML(); } - - throw new IllegalArgumentException("\"" + pProtocol + "\" is not a supported protocol"); - } - - /** - * Get the names of the supported protocols. - * - * @return A string array of the supported protocols. - */ - public static String[] getSupportedProtocols() { - return cProtocols; - } - -} +/* + (C) Copyright IBM Corp. 2006, 2012 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Alexander Wolf-Reber, a.wolf-reber@de.ibm.com + * + * Change History + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-11-08 lupusalex Make SBLIM client JSR48 compliant + * 1737141 2007-06-18 ebak Sync up with JSR48 evolution + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2882448 2009-10-21 blaschke-oss Add WBEMClientConstants from JSR48 + * 2959264 2010-02-25 blaschke-oss Sync up javax.client.* javadoc with JSR48 1.0.0 + * 3490355 2012-02-21 blaschke-oss TCK: Cannot instantiate WBEMClientFactory + */ + +package org.metricshub.wbem.javax.wbem.client; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.wbem.WBEMException; +import org.metricshub.wbem.sblim.cimclient.internal.wbem.WBEMClientCIMXML; + +//Sync'd against JSR48 1.0.0 javadoc (build 1.5.0_10) on Wed Jan 20 02:20:59 EST 2010 +/** + * This class defines the functionality of a WBEMClient factory, + * which is used to retrieve a WBEMClient for a specified protocol. + * An example of how to use the factory is included below. + * + *
      + *   ...
      + *   WBEMClient cc = null;
      + *   
      + *   try {
      + *     cc = WBEMClientFactory.getClient(WBEMClientConstants.PROTOCOL_CIMXML);
      + *   } catch (Exception e) {
      + *     System.out.println("Received error when trying to retrieve client handle");
      + *     System.exit(-1);
      + *   }
      + *   
      + *   // initialize the client 
      + *   cc.initialize(cns, s, null);
      + *   ...
      + * 
      + */ + +public class WBEMClientFactory extends Object { + + private static final String[] cProtocols = { WBEMClientConstants.PROTOCOL_CIMXML }; + + /** + * + */ + public WBEMClientFactory() { /**/} + + /** + * Get a WBEMClient for a protocol. + * + * @param pProtocol + * The protocol name (e.g. "CIM-XML"). + * @return The WBEMClient implementation for the protocol + * specified. + * @throws IllegalArgumentException + *
      If the protocol is + * null or empty.
      If the protocol is not + * supported.
      + * @throws WBEMException + * If the protocol implementation could not be loaded. + */ + public static WBEMClient getClient(String pProtocol) throws WBEMException { + + if (WBEMClientConstants.PROTOCOL_CIMXML.equalsIgnoreCase(pProtocol)) { return new WBEMClientCIMXML(); } + + throw new IllegalArgumentException("\"" + pProtocol + "\" is not a supported protocol"); + } + + /** + * Get the names of the supported protocols. + * + * @return A string array of the supported protocols. + */ + public static String[] getSupportedProtocols() { + return cProtocols; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/javax/wbem/client/package.html b/src/main/java/org/metricshub/wbem/javax/wbem/client/package.html similarity index 100% rename from src/main/java/org/sentrysoftware/wbem/javax/wbem/client/package.html rename to src/main/java/org/metricshub/wbem/javax/wbem/client/package.html diff --git a/src/main/java/org/sentrysoftware/wbem/javax/wbem/listener/IndicationListener.java b/src/main/java/org/metricshub/wbem/javax/wbem/listener/IndicationListener.java similarity index 70% rename from src/main/java/org/sentrysoftware/wbem/javax/wbem/listener/IndicationListener.java rename to src/main/java/org/metricshub/wbem/javax/wbem/listener/IndicationListener.java index 5fc1a9e..137e86c 100644 --- a/src/main/java/org/sentrysoftware/wbem/javax/wbem/listener/IndicationListener.java +++ b/src/main/java/org/metricshub/wbem/javax/wbem/listener/IndicationListener.java @@ -1,70 +1,68 @@ -/* - (C) Copyright IBM Corp. 2006, 2010 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Alexander Wolf-Reber, IBM, a.wolf-reber@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1565892 2006-12-14 lupusalex Make SBLIM client JSR48 compliant - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2959240 2010-02-25 blaschke-oss Sync up javax.listener.* javadoc with JSR48 1.0.0 - */ - -package org.sentrysoftware.wbem.javax.wbem.listener; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.EventListener; - -import org.sentrysoftware.wbem.javax.cim.CIMInstance; - -//Sync'd against JSR48 1.0.0 javadoc (build 1.5.0_10) on Wed Jan 20 02:20:59 EST 2010 -/** - * This interface is implemented by the code that wants to create a listener for - * indications. See the WBEMListenerFactory class for an example. - */ -public interface IndicationListener extends EventListener { - - /** - * Called when an indication has been received by the listener - * - * @param pIndicationURL - * The URL to which the indication was posted. For example if the - * indication was delivered over the https protocol to the - * destination listener https://hostname:6111/, pIndicationURL - * would be set to https://hostname:6111/. - * @param pIndication - * The indication received. - */ - public void indicationOccured(String pIndicationURL, CIMInstance pIndication); - -} +/* + (C) Copyright IBM Corp. 2006, 2010 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Alexander Wolf-Reber, IBM, a.wolf-reber@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1565892 2006-12-14 lupusalex Make SBLIM client JSR48 compliant + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2959240 2010-02-25 blaschke-oss Sync up javax.listener.* javadoc with JSR48 1.0.0 + */ + +package org.metricshub.wbem.javax.wbem.listener; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.EventListener; + +import org.metricshub.wbem.javax.cim.CIMInstance; + +//Sync'd against JSR48 1.0.0 javadoc (build 1.5.0_10) on Wed Jan 20 02:20:59 EST 2010 +/** + * This interface is implemented by the code that wants to create a listener for + * indications. See the WBEMListenerFactory class for an example. + */ +public interface IndicationListener extends EventListener { + + /** + * Called when an indication has been received by the listener + * + * @param pIndicationURL + * The URL to which the indication was posted. For example if the + * indication was delivered over the https protocol to the + * destination listener https://hostname:6111/, pIndicationURL + * would be set to https://hostname:6111/. + * @param pIndication + * The indication received. + */ + public void indicationOccured(String pIndicationURL, CIMInstance pIndication); + +} diff --git a/src/main/java/org/sentrysoftware/wbem/javax/wbem/listener/WBEMListener.java b/src/main/java/org/metricshub/wbem/javax/wbem/listener/WBEMListener.java similarity index 80% rename from src/main/java/org/sentrysoftware/wbem/javax/wbem/listener/WBEMListener.java rename to src/main/java/org/metricshub/wbem/javax/wbem/listener/WBEMListener.java index f7cbce3..7b09f81 100644 --- a/src/main/java/org/sentrysoftware/wbem/javax/wbem/listener/WBEMListener.java +++ b/src/main/java/org/metricshub/wbem/javax/wbem/listener/WBEMListener.java @@ -1,124 +1,122 @@ -/* - (C) Copyright IBM Corp. 2006, 2012 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Alexander Wolf-Reber, IBM, a.wolf-reber@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1565892 2006-12-14 lupusalex Make SBLIM client JSR48 compliant - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2959240 2010-02-25 blaschke-oss Sync up javax.listener.* javadoc with JSR48 1.0.0 - * 3496385 2012-03-02 blaschke-oss JSR48 1.0.0: add WBEMListener get/setProperty - */ - -package org.sentrysoftware.wbem.javax.wbem.listener; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.IOException; - -//Sync'd against JSR48 1.0.0 javadoc (build 1.6.0_18) on Thu Mar 01 12:21:26 EST 2012 -/** - * The WBEMListener interface is used to add/remove WBEM Indication - * Listeners. The implementation of a WBEMListener can be retrieved - * from the WBEMListenerFactor by specifying the protocol to use to - * listen for indications. - */ -public interface WBEMListener { - - /** - * Add a new listener using the specified port. - * - * @param pListener - * The Indication Listener that will be called when an indication - * is received. - * @param pPort - * The port to listen on. Use 0 to specify any available port. - * @param pTransport - * The transport to use (e.g. HTTP or HTTPS). - * @return The port that was used. - * @throws IOException - * If the port is already in use. - */ - public int addListener(IndicationListener pListener, int pPort, String pTransport) - throws IOException; - - /** - * Add a new listener using the specified port. - * - * @param pListener - * The Indication Listener that will be called when an indication - * is received. - * @param pPort - * The port to listen on. Use 0 to specify any available port. - * @param pTransport - * The transport to use (e.g. HTTP or HTTPS). - * @param localAddr - * The local IP address to bind to. This is only needed in - * multi-homed systems. - * @return The port that was used. - * @throws IOException - * If the port is already in use. - */ - public int addListener(IndicationListener pListener, int pPort, String pTransport, - String localAddr) throws IOException; - - /** - * Get a property value. - * - * @param pName - * The name of the property. - * @return The value of the property. - */ - public String getProperty(String pName); - - /** - * Remove the listener associated with the specified port. - * - * @param pPort - * The port. - */ - public void removeListener(int pPort); - - /** - * Set a property for the WBEM Listener. - * - * @param pName - * The name of the property. - * @param pValue - * The value of the property. - * @throws IllegalArgumentException - * If the name is not a supported property name. - */ - public void setProperty(String pName, String pValue); - -} +/* + (C) Copyright IBM Corp. 2006, 2012 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Alexander Wolf-Reber, IBM, a.wolf-reber@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1565892 2006-12-14 lupusalex Make SBLIM client JSR48 compliant + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2959240 2010-02-25 blaschke-oss Sync up javax.listener.* javadoc with JSR48 1.0.0 + * 3496385 2012-03-02 blaschke-oss JSR48 1.0.0: add WBEMListener get/setProperty + */ + +package org.metricshub.wbem.javax.wbem.listener; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.IOException; + +//Sync'd against JSR48 1.0.0 javadoc (build 1.6.0_18) on Thu Mar 01 12:21:26 EST 2012 +/** + * The WBEMListener interface is used to add/remove WBEM Indication + * Listeners. The implementation of a WBEMListener can be retrieved + * from the WBEMListenerFactor by specifying the protocol to use to + * listen for indications. + */ +public interface WBEMListener { + + /** + * Add a new listener using the specified port. + * + * @param pListener + * The Indication Listener that will be called when an indication + * is received. + * @param pPort + * The port to listen on. Use 0 to specify any available port. + * @param pTransport + * The transport to use (e.g. HTTP or HTTPS). + * @return The port that was used. + * @throws IOException + * If the port is already in use. + */ + public int addListener(IndicationListener pListener, int pPort, String pTransport) + throws IOException; + + /** + * Add a new listener using the specified port. + * + * @param pListener + * The Indication Listener that will be called when an indication + * is received. + * @param pPort + * The port to listen on. Use 0 to specify any available port. + * @param pTransport + * The transport to use (e.g. HTTP or HTTPS). + * @param localAddr + * The local IP address to bind to. This is only needed in + * multi-homed systems. + * @return The port that was used. + * @throws IOException + * If the port is already in use. + */ + public int addListener(IndicationListener pListener, int pPort, String pTransport, + String localAddr) throws IOException; + + /** + * Get a property value. + * + * @param pName + * The name of the property. + * @return The value of the property. + */ + public String getProperty(String pName); + + /** + * Remove the listener associated with the specified port. + * + * @param pPort + * The port. + */ + public void removeListener(int pPort); + + /** + * Set a property for the WBEM Listener. + * + * @param pName + * The name of the property. + * @param pValue + * The value of the property. + * @throws IllegalArgumentException + * If the name is not a supported property name. + */ + public void setProperty(String pName, String pValue); + +} diff --git a/src/main/java/org/sentrysoftware/wbem/javax/wbem/listener/WBEMListenerConstants.java b/src/main/java/org/metricshub/wbem/javax/wbem/listener/WBEMListenerConstants.java similarity index 76% rename from src/main/java/org/sentrysoftware/wbem/javax/wbem/listener/WBEMListenerConstants.java rename to src/main/java/org/metricshub/wbem/javax/wbem/listener/WBEMListenerConstants.java index 3408129..4645fa0 100644 --- a/src/main/java/org/sentrysoftware/wbem/javax/wbem/listener/WBEMListenerConstants.java +++ b/src/main/java/org/metricshub/wbem/javax/wbem/listener/WBEMListenerConstants.java @@ -1,81 +1,79 @@ -/* - (C) Copyright IBM Corp. 2012 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Dave Blaschke, blaschke@us.ibm.com - * - * Change History - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 3496380 2012-03-02 blaschke-oss JSR48 1.0.0: add new WBEMListenerConstants - */ -package org.sentrysoftware.wbem.javax.wbem.listener; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -//Sync'd against JSR48 1.0.0 javadoc (build 1.6.0_18) on Thu Mar 01 12:21:26 EST 2012 -/** - * This class defines the constants used for WBEMListener - * configuration. If a property is tagged as optional an implementation may or - * may not support the property. If the implementation does not support the - * property, it must throw an IllegalArgumentException if the - * property value is attempted to be set. - */ -public class WBEMListenerConstants { - - /** - * Use this property to set the list of ciphers the listener will support. - * Setting this value to null will use the default set of ciphers provided - * by the version of Java being used. Optional. - */ - public static final String PROP_LISTENER_CIPHERS = "javax.wbem.listener.ciphers"; - - /** - * This property along with the PROP_LISTENER_KEYSTORE_PASSWORD and - * PROP_LISTENER_TRUSTSTORE are used to configure mutual authentication. - * This property is used to provide the filename of the keystore. The path - * can be relative or full. Optional. - */ - public static final String PROP_LISTENER_KEYSTORE = "javax.wbem.listener.keyStore"; - - /** - * This property along with the PROP_LISTENER_KEYSTORE and - * PROP_LISTENER_TRUSTSTORE are used to configure mutual authentication. - * This property is used to provide the password of the keystore. Optional. - */ - public static final String PROP_LISTENER_KEYSTORE_PASSWORD = "javax.wbem.listener.keyStorePassword"; - - /** - * This property along with the PROP_LISTENER_KEYSTORE and - * PROP_LISTENER_KEYSTORE_PASSWORD are used to configure mutual - * authentication. This property is used to provide the filename of the - * truststore. The path can be relative or full. Optional. - */ - public static final String PROP_LISTENER_TRUSTSTORE = "javax.wbem.listener.trustStore"; -} +/* + (C) Copyright IBM Corp. 2012 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Dave Blaschke, blaschke@us.ibm.com + * + * Change History + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 3496380 2012-03-02 blaschke-oss JSR48 1.0.0: add new WBEMListenerConstants + */ +package org.metricshub.wbem.javax.wbem.listener; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +//Sync'd against JSR48 1.0.0 javadoc (build 1.6.0_18) on Thu Mar 01 12:21:26 EST 2012 +/** + * This class defines the constants used for WBEMListener + * configuration. If a property is tagged as optional an implementation may or + * may not support the property. If the implementation does not support the + * property, it must throw an IllegalArgumentException if the + * property value is attempted to be set. + */ +public class WBEMListenerConstants { + + /** + * Use this property to set the list of ciphers the listener will support. + * Setting this value to null will use the default set of ciphers provided + * by the version of Java being used. Optional. + */ + public static final String PROP_LISTENER_CIPHERS = "javax.wbem.listener.ciphers"; + + /** + * This property along with the PROP_LISTENER_KEYSTORE_PASSWORD and + * PROP_LISTENER_TRUSTSTORE are used to configure mutual authentication. + * This property is used to provide the filename of the keystore. The path + * can be relative or full. Optional. + */ + public static final String PROP_LISTENER_KEYSTORE = "javax.wbem.listener.keyStore"; + + /** + * This property along with the PROP_LISTENER_KEYSTORE and + * PROP_LISTENER_TRUSTSTORE are used to configure mutual authentication. + * This property is used to provide the password of the keystore. Optional. + */ + public static final String PROP_LISTENER_KEYSTORE_PASSWORD = "javax.wbem.listener.keyStorePassword"; + + /** + * This property along with the PROP_LISTENER_KEYSTORE and + * PROP_LISTENER_KEYSTORE_PASSWORD are used to configure mutual + * authentication. This property is used to provide the filename of the + * truststore. The path can be relative or full. Optional. + */ + public static final String PROP_LISTENER_TRUSTSTORE = "javax.wbem.listener.trustStore"; +} diff --git a/src/main/java/org/sentrysoftware/wbem/javax/wbem/listener/WBEMListenerFactory.java b/src/main/java/org/metricshub/wbem/javax/wbem/listener/WBEMListenerFactory.java similarity index 76% rename from src/main/java/org/sentrysoftware/wbem/javax/wbem/listener/WBEMListenerFactory.java rename to src/main/java/org/metricshub/wbem/javax/wbem/listener/WBEMListenerFactory.java index d52009b..3e20ed4 100644 --- a/src/main/java/org/sentrysoftware/wbem/javax/wbem/listener/WBEMListenerFactory.java +++ b/src/main/java/org/metricshub/wbem/javax/wbem/listener/WBEMListenerFactory.java @@ -1,108 +1,106 @@ -/* - (C) Copyright IBM Corp. 2006, 2012 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Alexander Wolf-Reber, IBM, a.wolf-reber@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1565892 2006-12-14 lupusalex Make SBLIM client JSR48 compliant - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2798931 2009-06-01 raman_arora Fix spelling of getPROTOCOLS() - * 2882448 2009-10-21 blaschke-oss Add WBEMClientConstants from JSR48 - * 2959240 2010-02-25 blaschke-oss Sync up javax.listener.* javadoc with JSR48 1.0.0 - * 3490009 2012-02-21 blaschke-oss TCK: Too many WBEMListenerFactory class methods - * 3529062 2012-05-23 blaschke-oss WBEMListenerFactory should return new instance - */ - -package org.sentrysoftware.wbem.javax.wbem.listener; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.wbem.client.WBEMClientConstants; - -import org.sentrysoftware.wbem.sblim.cimclient.WBEMListenerSBLIM; - -//Sync'd against JSR48 1.0.0 javadoc (build 1.5.0_10) on Wed Jan 20 02:20:59 EST 2010 -/** - * This class is a factory for getting a WBEMListener - * implementation for a specified protocol. An example of how to use the factory - * is included below. - * - *
      - * ...
      - * class MyListener implements IndicationListener {
      - * 
      - *   public void indicationOccured(String pIndicationURL, CIMInstance pIndication) {
      - *     System.out.println(pIndication);
      - * 	 }
      - * }
      - * 
      - * String protocol = WBEMClientConstants.PROTOCOL_CIMXML;
      - * WBEMListener api = WBEMListenerFactory.getListener(protocol);
      - * int port = api.addListener(MyListener, 1234, protocol);
      - * 
      - */ -public class WBEMListenerFactory extends Object { - - private static final String[] PROTOCOLS = { WBEMClientConstants.PROTOCOL_CIMXML }; - - /** - * - */ - public WBEMListenerFactory() { /**/} - - /** - * Get a WBEM Listener implementation for the specified protocol. - * - * @param pProtocol - * The protocol name. - * @return Implementation of WBEMListener. - * @throws IllegalArgumentException - * Could not load protocol implementation. - */ - public static WBEMListener getListener(String pProtocol) throws IllegalArgumentException { - - if (WBEMClientConstants.PROTOCOL_CIMXML.equalsIgnoreCase(pProtocol)) { return new WBEMListenerSBLIM(); } - throw new IllegalArgumentException("Protocol: " + pProtocol - + " is not supported! Invoke getProtocols() for the list of " - + "supported protocols."); - } - - /** - * Get the names of the supported protocols. - * - * @return A string array of the protocol names supported. - */ - public static String[] getProtocols() { - return PROTOCOLS; - } -} +/* + (C) Copyright IBM Corp. 2006, 2012 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Alexander Wolf-Reber, IBM, a.wolf-reber@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1565892 2006-12-14 lupusalex Make SBLIM client JSR48 compliant + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2798931 2009-06-01 raman_arora Fix spelling of getPROTOCOLS() + * 2882448 2009-10-21 blaschke-oss Add WBEMClientConstants from JSR48 + * 2959240 2010-02-25 blaschke-oss Sync up javax.listener.* javadoc with JSR48 1.0.0 + * 3490009 2012-02-21 blaschke-oss TCK: Too many WBEMListenerFactory class methods + * 3529062 2012-05-23 blaschke-oss WBEMListenerFactory should return new instance + */ + +package org.metricshub.wbem.javax.wbem.listener; + +import org.metricshub.wbem.sblim.cimclient.WBEMListenerSBLIM; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.wbem.client.WBEMClientConstants; + +//Sync'd against JSR48 1.0.0 javadoc (build 1.5.0_10) on Wed Jan 20 02:20:59 EST 2010 +/** + * This class is a factory for getting a WBEMListener + * implementation for a specified protocol. An example of how to use the factory + * is included below. + * + *
      + * ...
      + * class MyListener implements IndicationListener {
      + * 
      + *   public void indicationOccured(String pIndicationURL, CIMInstance pIndication) {
      + *     System.out.println(pIndication);
      + * 	 }
      + * }
      + * 
      + * String protocol = WBEMClientConstants.PROTOCOL_CIMXML;
      + * WBEMListener api = WBEMListenerFactory.getListener(protocol);
      + * int port = api.addListener(MyListener, 1234, protocol);
      + * 
      + */ +public class WBEMListenerFactory extends Object { + + private static final String[] PROTOCOLS = { WBEMClientConstants.PROTOCOL_CIMXML }; + + /** + * + */ + public WBEMListenerFactory() { /**/} + + /** + * Get a WBEM Listener implementation for the specified protocol. + * + * @param pProtocol + * The protocol name. + * @return Implementation of WBEMListener. + * @throws IllegalArgumentException + * Could not load protocol implementation. + */ + public static WBEMListener getListener(String pProtocol) throws IllegalArgumentException { + + if (WBEMClientConstants.PROTOCOL_CIMXML.equalsIgnoreCase(pProtocol)) { return new WBEMListenerSBLIM(); } + throw new IllegalArgumentException("Protocol: " + pProtocol + + " is not supported! Invoke getProtocols() for the list of " + + "supported protocols."); + } + + /** + * Get the names of the supported protocols. + * + * @return A string array of the protocol names supported. + */ + public static String[] getProtocols() { + return PROTOCOLS; + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/javax/wbem/listener/package.html b/src/main/java/org/metricshub/wbem/javax/wbem/listener/package.html similarity index 100% rename from src/main/java/org/sentrysoftware/wbem/javax/wbem/listener/package.html rename to src/main/java/org/metricshub/wbem/javax/wbem/listener/package.html diff --git a/src/main/java/org/sentrysoftware/wbem/javax/wbem/package.html b/src/main/java/org/metricshub/wbem/javax/wbem/package.html similarity index 100% rename from src/main/java/org/sentrysoftware/wbem/javax/wbem/package.html rename to src/main/java/org/metricshub/wbem/javax/wbem/package.html diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/CIMXMLTraceListener.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/CIMXMLTraceListener.java similarity index 68% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/CIMXMLTraceListener.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/CIMXMLTraceListener.java index 18cfdf6..c789c16 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/CIMXMLTraceListener.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/CIMXMLTraceListener.java @@ -1,68 +1,66 @@ -/* - (C) Copyright IBM Corp. 2012 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Alexander Wolf-Reber, IBM, a.wolf-reber@de.ibm.com - * Dave Blaschke, IBM, blaschke@us.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 3554738 2012-08-16 blaschke-oss dump CIM xml by LogAndTraceBroker.trace() - */ - -package org.sentrysoftware.wbem.sblim.cimclient; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.logging.Level; - -/** - * The interface CIMXMLTraceListener must be implemented if you want to attach - * your own CIM-XML logging framework to the CIM Client. - * - * @see LogAndTraceManager - */ -public interface CIMXMLTraceListener { - - /** - * Receive a CIM-XML trace message. - * - * @param pLevel - * One of the message level identifiers, e.g. FINE - * @param pMessage - * The CIM-XML message text - * @param pOutgoing - * true if CIM-XML is outgoing (being sent from - * client to server), false if CIM-XML is incoming - * (being sent from server to client) - */ - public void traceCIMXML(Level pLevel, String pMessage, boolean pOutgoing); - -} +/* + (C) Copyright IBM Corp. 2012 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Alexander Wolf-Reber, IBM, a.wolf-reber@de.ibm.com + * Dave Blaschke, IBM, blaschke@us.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 3554738 2012-08-16 blaschke-oss dump CIM xml by LogAndTraceBroker.trace() + */ + +package org.metricshub.wbem.sblim.cimclient; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.logging.Level; + +/** + * The interface CIMXMLTraceListener must be implemented if you want to attach + * your own CIM-XML logging framework to the CIM Client. + * + * @see LogAndTraceManager + */ +public interface CIMXMLTraceListener { + + /** + * Receive a CIM-XML trace message. + * + * @param pLevel + * One of the message level identifiers, e.g. FINE + * @param pMessage + * The CIM-XML message text + * @param pOutgoing + * true if CIM-XML is outgoing (being sent from + * client to server), false if CIM-XML is incoming + * (being sent from server to client) + */ + public void traceCIMXML(Level pLevel, String pMessage, boolean pOutgoing); + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/GenericExts.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/GenericExts.java similarity index 75% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/GenericExts.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/GenericExts.java index a807115..e9689f2 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/GenericExts.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/GenericExts.java @@ -1,105 +1,103 @@ -/* - (C) Copyright IBM Corp. 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Ramandeep Arora, arorar@us.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2797696 2009-05-27 raman_arora Input files use unsafe operations - * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics - */ - -package org.sentrysoftware.wbem.sblim.cimclient; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.ArrayList; -import java.util.Vector; - -/** - * Class GenericExts is responsible for generic initialization - */ -public class GenericExts { - - /** - * initArrayList : If arrayList is null then it will return the new - * arrayList of same type if it is not null then it will clear the arrayList - * - * @param - * : Type Parameter - * - * @param pAL - * : ArrayList to be initialized - * @return ArrayList : initialized ArrayList - */ - public static ArrayList initClearArrayList(ArrayList pAL) { - if (pAL == null) return new ArrayList(); - pAL.clear(); - return pAL; - } - - /** - * initArrayList : If arrayList is null then it will return the new - * arrayList of same type if it is not null then it will return the same - * arrayList - * - * @param - * : Type Parameter - * - * @param pAL - * : ArrayList to be initialized - * @return ArrayList : initialized ArrayList - */ - public static ArrayList initArrayList(ArrayList pAL) { - if (pAL == null) return new ArrayList(); - return pAL; - } - - /** - * cloneVector : Generic deep copy of the vector. If original vector is null - * then return value will also be null. - * - * @param - * : Type of vector - * - * @param oldVec - * : The original vector. - * - * @return Vector<T> : Deep copy of original vector. - */ - public static synchronized Vector cloneVector(Vector oldVec) { - if (oldVec == null) return null; - Vector newVec = new Vector(oldVec.size()); - for (T obj : oldVec) - newVec.add(obj); - return newVec; - } -} +/* + (C) Copyright IBM Corp. 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Ramandeep Arora, arorar@us.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2797696 2009-05-27 raman_arora Input files use unsafe operations + * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics + */ + +package org.metricshub.wbem.sblim.cimclient; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.ArrayList; +import java.util.Vector; + +/** + * Class GenericExts is responsible for generic initialization + */ +public class GenericExts { + + /** + * initArrayList : If arrayList is null then it will return the new + * arrayList of same type if it is not null then it will clear the arrayList + * + * @param + * : Type Parameter + * + * @param pAL + * : ArrayList to be initialized + * @return ArrayList : initialized ArrayList + */ + public static ArrayList initClearArrayList(ArrayList pAL) { + if (pAL == null) return new ArrayList(); + pAL.clear(); + return pAL; + } + + /** + * initArrayList : If arrayList is null then it will return the new + * arrayList of same type if it is not null then it will return the same + * arrayList + * + * @param + * : Type Parameter + * + * @param pAL + * : ArrayList to be initialized + * @return ArrayList : initialized ArrayList + */ + public static ArrayList initArrayList(ArrayList pAL) { + if (pAL == null) return new ArrayList(); + return pAL; + } + + /** + * cloneVector : Generic deep copy of the vector. If original vector is null + * then return value will also be null. + * + * @param + * : Type of vector + * + * @param oldVec + * : The original vector. + * + * @return Vector<T> : Deep copy of original vector. + */ + public static synchronized Vector cloneVector(Vector oldVec) { + if (oldVec == null) return null; + Vector newVec = new Vector(oldVec.size()); + for (T obj : oldVec) + newVec.add(obj); + return newVec; + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/IndicationListenerSBLIM.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/IndicationListenerSBLIM.java similarity index 72% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/IndicationListenerSBLIM.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/IndicationListenerSBLIM.java index f90f8ef..2f0b230 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/IndicationListenerSBLIM.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/IndicationListenerSBLIM.java @@ -1,77 +1,75 @@ -/* - (C) Copyright IBM Corp. 2012 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Alexander Wolf-Reber, IBM, a.wolf-reber@de.ibm.com - * @author : Dave Blaschke, IBM, blaschke@us.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 3477087 2012-01-23 blaschke-oss Need Access to an Indication Sender's IP Address - */ - -package org.sentrysoftware.wbem.sblim.cimclient; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.net.InetAddress; -import java.util.EventListener; - -import org.sentrysoftware.wbem.javax.cim.CIMInstance; - -/** - * This interface is implemented by the code that wants to create a listener for - * indications. See the WBEMListenerFactory class for an example. - * - * The difference between this interface and IndicationListener is - * that the JSR48 standard (javax.wbem.listener.IndicationListener) - * does not allow for the listener to receive the IP of the indication sender - * whereas this internal interface ( - * org.sblim.cimclinet.IndicationListenerSBLIM) does. - */ -public interface IndicationListenerSBLIM extends EventListener { - - /** - * Called when an indication has been received by the listener - * - * @param pIndicationURL - * The URL to which the indication was posted. For example if the - * indication was delivered over the https protocol to the - * destination listener https://hostname:6111/, pIndicationURL - * would be set to https://hostname:6111/. - * @param pIndication - * The indication received. - * @param pSenderIP - * The internet address of the indication sender. - */ - public void indicationOccured(String pIndicationURL, CIMInstance pIndication, - InetAddress pSenderIP); - -} +/* + (C) Copyright IBM Corp. 2012 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Alexander Wolf-Reber, IBM, a.wolf-reber@de.ibm.com + * @author : Dave Blaschke, IBM, blaschke@us.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 3477087 2012-01-23 blaschke-oss Need Access to an Indication Sender's IP Address + */ + +package org.metricshub.wbem.sblim.cimclient; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.net.InetAddress; +import java.util.EventListener; + +import org.metricshub.wbem.javax.cim.CIMInstance; + +/** + * This interface is implemented by the code that wants to create a listener for + * indications. See the WBEMListenerFactory class for an example. + * + * The difference between this interface and IndicationListener is + * that the JSR48 standard (javax.wbem.listener.IndicationListener) + * does not allow for the listener to receive the IP of the indication sender + * whereas this internal interface ( + * org.sblim.cimclinet.IndicationListenerSBLIM) does. + */ +public interface IndicationListenerSBLIM extends EventListener { + + /** + * Called when an indication has been received by the listener + * + * @param pIndicationURL + * The URL to which the indication was posted. For example if the + * indication was delivered over the https protocol to the + * destination listener https://hostname:6111/, pIndicationURL + * would be set to https://hostname:6111/. + * @param pIndication + * The indication received. + * @param pSenderIP + * The internet address of the indication sender. + */ + public void indicationOccured(String pIndicationURL, CIMInstance pIndication, + InetAddress pSenderIP); + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/LogAndTraceManager.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/LogAndTraceManager.java similarity index 84% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/LogAndTraceManager.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/LogAndTraceManager.java index 49b51f3..f7aa039 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/LogAndTraceManager.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/LogAndTraceManager.java @@ -1,220 +1,218 @@ -/* - (C) Copyright IBM Corp. 2006, 2012 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Alexander Wolf-Reber, IBM, a.wolf-reber@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1565892 2006-11-13 lupusalex Make SBLIM client JSR48 compliant - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 3554738 2012-08-16 blaschke-oss dump CIM xml by LogAndTraceBroker.trace() - */ - -package org.sentrysoftware.wbem.sblim.cimclient; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.OutputStream; -import java.util.Collections; -import java.util.List; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; - -/** - * Class LogAndTraceManager provides the means to register/unregister log and - * trace listeners. It is the entry point for application that want to redirect - * the CIM Client's log and trace messages into their own logging framework. - * - */ -public class LogAndTraceManager { - - private static LogAndTraceManager cManager = new LogAndTraceManager(); - - /** - * Returns the singleton instance of the manager. - * - * @return The manager - */ - public static LogAndTraceManager getManager() { - return cManager; - } - - private LogAndTraceManager() { - super(); - } - - /** - * Adds a listener for log messages. The listener will be notified of any - * log event. - * - * @param pListener - * The listener - */ - public void addLogListener(LogListener pListener) { - LogAndTraceBroker.getBroker().addLogListener(pListener); - } - - /** - * Remove a listener. This listener will not be notified of log events - * anymore. - * - * @param pListener - * The listener - */ - public void removeLogListener(LogListener pListener) { - LogAndTraceBroker.getBroker().removeLogListener(pListener); - } - - /** - * Removes all listeners. Caution: This will also remove the internal - * console and file loggers. - */ - public void clearLogListeners() { - LogAndTraceBroker.getBroker().clearLogListeners(); - } - - /** - * Gets the registered log listeners including the internal console and file - * loggers. - * - * @return An unmodifiable list of listeners - */ - public List getLogListeners() { - return Collections.unmodifiableList(LogAndTraceBroker.getBroker().getLogListeners()); - } - - /** - * Adds a listener for log messages. The listener will be notified of any - * trace event. - * - * @param pListener - * The listener - */ - public void addTraceListener(TraceListener pListener) { - LogAndTraceBroker.getBroker().addTraceListener(pListener); - } - - /** - * Removes a listener. This listener will not be notified of trace events - * anymore. - * - * @param pListener - * The listener - */ - public void removeTraceListener(TraceListener pListener) { - LogAndTraceBroker.getBroker().removeTraceListener(pListener); - } - - /** - * Removes all listeners. Caution this will also remove the internal trace - * file listener. - */ - public void clearTraceListeners() { - LogAndTraceBroker.getBroker().clearTraceListeners(); - } - - /** - * Gets the registered trace listeners including the internal console and - * file loggers. - * - * @return A unmodifiable list of listeners - */ - public List getTraceListeners() { - return Collections.unmodifiableList(LogAndTraceBroker.getBroker().getTraceListeners()); - } - - /** - * Adds a listener for CIM-XML trace messages. The listener will be notified - * of any CIM-XML trace event. - * - * @param pListener - * The listener - */ - public void addCIMXMLTraceListener(CIMXMLTraceListener pListener) { - LogAndTraceBroker.getBroker().addCIMXMLTraceListener(pListener); - } - - /** - * Removes a CIM-XML trace listener. This listener will not be notified of - * CIM-XML trace events anymore. - * - * @param pListener - * The listener - */ - public void removeCIMXMLTraceListener(CIMXMLTraceListener pListener) { - LogAndTraceBroker.getBroker().removeCIMXMLTraceListener(pListener); - } - - /** - * Removes all CIM-XML trace listeners. - */ - public void clearCIMXMLTraceListeners() { - LogAndTraceBroker.getBroker().clearCIMXMLTraceListeners(); - } - - /** - * Gets the registered CIM-XML trace listeners. - * - * @return A unmodifiable list of listeners - */ - public List getCIMXMLTraceListeners() { - return Collections - .unmodifiableList(LogAndTraceBroker.getBroker().getCIMXMLTraceListeners()); - } - - /** - * Returns the stream to which the CIM-XML traces are sent. A value of - * null means that tracing is effectively disabled. Otherwise - * the CIM-XML tracing can be activated either globally or per-connection - * via the "sblim.wbem.cimxmlTracing" configuration property. - * - * @return The CIM-XML trace stream - */ - public OutputStream getXmlTraceStream() { - return LogAndTraceBroker.getBroker().getXmlTraceStream(); - } - - /** - * Sets the stream to which the CIM-XML traces are sent. A value of - * null means that tracing is effectively disabled. Otherwise - * the CIM-XML tracing can be activated either globally or per-connection - * via the "sblim.wbem.cimxmlTracing" configuration property. - * - * @param pStream - * The CIM-XML trace stream - */ - public void setXmlTraceStream(OutputStream pStream) { - LogAndTraceBroker.getBroker().setXmlTraceStream(pStream); - } - -} +/* + (C) Copyright IBM Corp. 2006, 2012 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Alexander Wolf-Reber, IBM, a.wolf-reber@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1565892 2006-11-13 lupusalex Make SBLIM client JSR48 compliant + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 3554738 2012-08-16 blaschke-oss dump CIM xml by LogAndTraceBroker.trace() + */ + +package org.metricshub.wbem.sblim.cimclient; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.OutputStream; +import java.util.Collections; +import java.util.List; + +import org.metricshub.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; + +/** + * Class LogAndTraceManager provides the means to register/unregister log and + * trace listeners. It is the entry point for application that want to redirect + * the CIM Client's log and trace messages into their own logging framework. + * + */ +public class LogAndTraceManager { + + private static LogAndTraceManager cManager = new LogAndTraceManager(); + + /** + * Returns the singleton instance of the manager. + * + * @return The manager + */ + public static LogAndTraceManager getManager() { + return cManager; + } + + private LogAndTraceManager() { + super(); + } + + /** + * Adds a listener for log messages. The listener will be notified of any + * log event. + * + * @param pListener + * The listener + */ + public void addLogListener(LogListener pListener) { + LogAndTraceBroker.getBroker().addLogListener(pListener); + } + + /** + * Remove a listener. This listener will not be notified of log events + * anymore. + * + * @param pListener + * The listener + */ + public void removeLogListener(LogListener pListener) { + LogAndTraceBroker.getBroker().removeLogListener(pListener); + } + + /** + * Removes all listeners. Caution: This will also remove the internal + * console and file loggers. + */ + public void clearLogListeners() { + LogAndTraceBroker.getBroker().clearLogListeners(); + } + + /** + * Gets the registered log listeners including the internal console and file + * loggers. + * + * @return An unmodifiable list of listeners + */ + public List getLogListeners() { + return Collections.unmodifiableList(LogAndTraceBroker.getBroker().getLogListeners()); + } + + /** + * Adds a listener for log messages. The listener will be notified of any + * trace event. + * + * @param pListener + * The listener + */ + public void addTraceListener(TraceListener pListener) { + LogAndTraceBroker.getBroker().addTraceListener(pListener); + } + + /** + * Removes a listener. This listener will not be notified of trace events + * anymore. + * + * @param pListener + * The listener + */ + public void removeTraceListener(TraceListener pListener) { + LogAndTraceBroker.getBroker().removeTraceListener(pListener); + } + + /** + * Removes all listeners. Caution this will also remove the internal trace + * file listener. + */ + public void clearTraceListeners() { + LogAndTraceBroker.getBroker().clearTraceListeners(); + } + + /** + * Gets the registered trace listeners including the internal console and + * file loggers. + * + * @return A unmodifiable list of listeners + */ + public List getTraceListeners() { + return Collections.unmodifiableList(LogAndTraceBroker.getBroker().getTraceListeners()); + } + + /** + * Adds a listener for CIM-XML trace messages. The listener will be notified + * of any CIM-XML trace event. + * + * @param pListener + * The listener + */ + public void addCIMXMLTraceListener(CIMXMLTraceListener pListener) { + LogAndTraceBroker.getBroker().addCIMXMLTraceListener(pListener); + } + + /** + * Removes a CIM-XML trace listener. This listener will not be notified of + * CIM-XML trace events anymore. + * + * @param pListener + * The listener + */ + public void removeCIMXMLTraceListener(CIMXMLTraceListener pListener) { + LogAndTraceBroker.getBroker().removeCIMXMLTraceListener(pListener); + } + + /** + * Removes all CIM-XML trace listeners. + */ + public void clearCIMXMLTraceListeners() { + LogAndTraceBroker.getBroker().clearCIMXMLTraceListeners(); + } + + /** + * Gets the registered CIM-XML trace listeners. + * + * @return A unmodifiable list of listeners + */ + public List getCIMXMLTraceListeners() { + return Collections + .unmodifiableList(LogAndTraceBroker.getBroker().getCIMXMLTraceListeners()); + } + + /** + * Returns the stream to which the CIM-XML traces are sent. A value of + * null means that tracing is effectively disabled. Otherwise + * the CIM-XML tracing can be activated either globally or per-connection + * via the "sblim.wbem.cimxmlTracing" configuration property. + * + * @return The CIM-XML trace stream + */ + public OutputStream getXmlTraceStream() { + return LogAndTraceBroker.getBroker().getXmlTraceStream(); + } + + /** + * Sets the stream to which the CIM-XML traces are sent. A value of + * null means that tracing is effectively disabled. Otherwise + * the CIM-XML tracing can be activated either globally or per-connection + * via the "sblim.wbem.cimxmlTracing" configuration property. + * + * @param pStream + * The CIM-XML trace stream + */ + public void setXmlTraceStream(OutputStream pStream) { + LogAndTraceBroker.getBroker().setXmlTraceStream(pStream); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/LogListener.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/LogListener.java similarity index 67% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/LogListener.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/LogListener.java index d6bcfe2..6a647ef 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/LogListener.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/LogListener.java @@ -1,68 +1,66 @@ -/* - (C) Copyright IBM Corp. 2006, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Alexander Wolf-Reber, IBM, a.wolf-reber@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1565892 2006-11-13 lupusalex Make SBLIM client JSR48 compliant - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.cimclient; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.logging.Level; - -/** - * The interface LogListener must be implemented if you want to attach your own - * logging framework to the CIM Client. - * - * @see LogAndTraceManager - */ -public interface LogListener { - - /** - * Receive a message. - * - * @param pLevel - * One of the message level identifiers, e.g. SEVERE - * @param pMessageKey - * The identifier of the message - * @param pMessage - * The message text - * @param pParameters - * The parameters for the message - */ - public void log(Level pLevel, String pMessageKey, String pMessage, Object[] pParameters); -} +/* + (C) Copyright IBM Corp. 2006, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Alexander Wolf-Reber, IBM, a.wolf-reber@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1565892 2006-11-13 lupusalex Make SBLIM client JSR48 compliant + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.cimclient; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.logging.Level; + +/** + * The interface LogListener must be implemented if you want to attach your own + * logging framework to the CIM Client. + * + * @see LogAndTraceManager + */ +public interface LogListener { + + /** + * Receive a message. + * + * @param pLevel + * One of the message level identifiers, e.g. SEVERE + * @param pMessageKey + * The identifier of the message + * @param pMessage + * The message text + * @param pParameters + * The parameters for the message + */ + public void log(Level pLevel, String pMessageKey, String pMessage, Object[] pParameters); +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/TraceListener.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/TraceListener.java similarity index 73% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/TraceListener.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/TraceListener.java index f8fc366..04adebc 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/TraceListener.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/TraceListener.java @@ -1,83 +1,81 @@ -/* - (C) Copyright IBM Corp. 2006, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Alexander Wolf-Reber, IBM, a.wolf-reber@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1565892 2006-11-14 lupusalex Make SBLIM client JSR48 compliant - * 1711092 2006-05-02 lupusalex Some fixes/additions of log&trace messages - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.cimclient; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.logging.Level; - -/** - * The interface TraceListener must be implemented if you want to attach your - * own logging framework to the CIM Client. - * - * @see LogAndTraceManager - */ -public interface TraceListener { - - /** - * Receive a trace message. - * - * @param pLevel - * One of the message level identifiers, e.g. FINE - * @param pOrigin - * The java class/method/line-of-code sending the message. Might - * be null if algorithm failed to determine origin. - * @param pMessage - * The message text - */ - public void trace(Level pLevel, StackTraceElement pOrigin, String pMessage); - - /** - * Receive a trace message. - * - * @param pLevel - * One of the message level identifiers, e.g. SEVERE - * @param pOrigin - * The java class/method/line-of-code sending the message - * @param pMessage - * The message text - * @param pThrown - * The throwable associated with the message - */ - public void trace(Level pLevel, StackTraceElement pOrigin, String pMessage, Throwable pThrown); - -} +/* + (C) Copyright IBM Corp. 2006, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Alexander Wolf-Reber, IBM, a.wolf-reber@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1565892 2006-11-14 lupusalex Make SBLIM client JSR48 compliant + * 1711092 2006-05-02 lupusalex Some fixes/additions of log&trace messages + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.cimclient; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.logging.Level; + +/** + * The interface TraceListener must be implemented if you want to attach your + * own logging framework to the CIM Client. + * + * @see LogAndTraceManager + */ +public interface TraceListener { + + /** + * Receive a trace message. + * + * @param pLevel + * One of the message level identifiers, e.g. FINE + * @param pOrigin + * The java class/method/line-of-code sending the message. Might + * be null if algorithm failed to determine origin. + * @param pMessage + * The message text + */ + public void trace(Level pLevel, StackTraceElement pOrigin, String pMessage); + + /** + * Receive a trace message. + * + * @param pLevel + * One of the message level identifiers, e.g. SEVERE + * @param pOrigin + * The java class/method/line-of-code sending the message + * @param pMessage + * The message text + * @param pThrown + * The throwable associated with the message + */ + public void trace(Level pLevel, StackTraceElement pOrigin, String pMessage, Throwable pThrown); + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/WBEMClientSBLIM.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/WBEMClientSBLIM.java similarity index 88% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/WBEMClientSBLIM.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/WBEMClientSBLIM.java index 5acae87..056329c 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/WBEMClientSBLIM.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/WBEMClientSBLIM.java @@ -1,278 +1,277 @@ -/* - WBEMClientSBLIM.java - - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Alexander Wolf-Reber, IBM, a.wolf-reber@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1565892 2006-11-08 lupusalex Make SBLIM client JSR48 compliant - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors - * 2942520 2010-03-08 blaschke-oss IPv6 link local address with scope_id including a dot not supported - * 3516848 2012-04-11 blaschke-oss enumerateNamespaces() method to WBEMClient - * 3522904 2012-05-02 blaschke-oss Add new API WBEMClientSBLIM.isActive() - * 2616 2013-02-23 blaschke-oss Add new API WBEMClientSBLIM.sendIndication() - */ - -package org.sentrysoftware.wbem.sblim.cimclient; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.net.URI; -import java.util.Locale; -import java.util.Properties; - -import org.sentrysoftware.wbem.javax.cim.CIMInstance; -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; -import javax.net.SocketFactory; -import javax.security.auth.Subject; -import org.sentrysoftware.wbem.javax.wbem.CloseableIterator; -import org.sentrysoftware.wbem.javax.wbem.WBEMException; -import org.sentrysoftware.wbem.javax.wbem.client.WBEMClient; - -/** - * Class WBEMClientSBLIM contains the SBLIM CIM Client specific extensions to - * the WBEMClient interface. - * - * @see WBEMClient - * - */ -public interface WBEMClientSBLIM extends WBEMClient { - - /** - * Initialize the client connection. This must be called before any - * operations. This must only be called once. - * - * @param pUri - * The protocol and host to use. Any other fields will be - * ignored. - * @param pSubject - * The principal/credential pairs for this connection. - * @param pLocales - * An array of locales in order of priority of preference. - * @throws IllegalArgumentException - * If the host or scheme portion of the object path is null, or - * if the protocol is not supported. - * @throws WBEMException - * If the protocol adapter or security cannot be initialized. - */ - public void initialize(URI pUri, Subject pSubject, Locale[] pLocales) - throws IllegalArgumentException, WBEMException; - - /** - * Returns the client specific configuration properties. Note that only - * these properties are returned that override the global settings. The - * global settings can be accessed via the java.lang.System - * class.
      - * If the no client specific configuration is set, this method returns - * null - * - * @return The configuration properties - * @see System#getProperties() - */ - public Properties getProperties(); - - /** - * Sets the client specific configuration properties. Any previously set - * client specific properties are overwritten. The given properties are - * handled as an overlay on the global settings. That means that properties - * specified here override the corresponding global properties whereas - * properties not specified here are taken from the global properties. The - * global settings can be accessed via the java.lang.System - * class. - * - * @param pProperties - * The session specific properties. null resets this - * client to the global settings. - * - * @see System#setProperties(Properties) - */ - public void setProperties(Properties pProperties); - - /** - * Returns the effective value of a given configuration property. The method - * will return the local value of the current thread if one was set or - * otherwise client specific value if one was set or otherwise the global - * value if one was set or otherwise the default value. Valid property names - * can be found in the WBEMConfigurationProperties interface. - * - * @param pKey - * The name of the configuration property - * - * @return The value of the given configuration property - * @see WBEMConfigurationProperties - */ - public String getProperty(String pKey); - - /** - * Sets a client specific configuration property. This property will - * override the corresponding global property for this client instance. The - * global settings can be accessed via the java.lang.System - * class. Valid property names can be found in the - * WBEMConfigurationProperties interface. Unknown properties - * are ignored. - * - * @param pKey - * The name of the configuration property - * @param pValue - * The value of the configuration property. null - * resets to the global setting. - * @see WBEMConfigurationProperties - * @see System#setProperty(String, String) - */ - public void setProperty(String pKey, String pValue); - - /** - * Returns the configuration properties that are local to the current - * thread. Note that only these properties are returned that override the - * global and the client settings. The global settings can be accessed via - * the java.lang.System class, the client setting via - * getProperties().
      - * If the no client specific configuration is set, this method returns - * null - * - * @return The configuration properties - * @see System#getProperties() - * @see #getProperties() - */ - public Properties getLocalProperties(); - - /** - * Sets the configuration properties that are local to the current thread. - * Any previously set local properties (of the current thread) are - * overwritten. The given properties are handled as an overlay on the global - * settings and the client settings. That means that properties specified - * here override the corresponding properties whereas properties not - * specified here are taken from the client or global properties. The global - * settings can be accessed via the java.lang.System class, the - * client setting via getProperties(). - * - * @param pProperties - * The thread specific properties. null remove the - * local setting of the current thread. - * - * @see System#setProperties(Properties) - * @see #setProperties(Properties) - */ - public void setLocalProperties(Properties pProperties); - - /** - * Sets a local configuration property for the current thread. This property - * will override the corresponding global and client property for this - * client instance. The global settings can be accessed via the - * java.lang.System class, the client setting via - * getProperties(). Valid property names can be found in the - * WBEMConfigurationProperties interface. Unknown properties - * are ignored. - * - * @param pKey - * The name of the configuration property - * @param pValue - * The value of the configuration property. null - * resets to the global setting. - * @see WBEMConfigurationProperties - * @see System#setProperty(String, String) - * @see #setProperty(String, String) - */ - public void setLocalProperty(String pKey, String pValue); - - /** - * Gets the custom socket factory if one is set. The client uses this - * factory for socket creation instead of the default one. - * - * @return The custom factory used for socket creation. null - * indicates set the JRE default factory is used. - */ - public SocketFactory getCustomSocketFactory(); - - /** - * Sets a custom socket factory. The client will use this factory for socket - * creation instead of the JRE default. - * - * @param pFactory - * The factory to use for socket creation. null - * resets to the JRE default factory. - * @throws UnsupportedOperationException - * Some protocols might not communicate via TCP sockets - */ - public void setCustomSocketFactory(SocketFactory pFactory) throws UnsupportedOperationException; - - /** - * Enumerate the names of the instances of CIM namespaces. - * - * @param pNamespace - * The Interop Namespace, if known. If null, the default Interop - * Namespace names defined by DSP1033 are used. - * @return A CloseableIterator of CIMObjectPaths. - * @throws WBEMException - * If unsuccessful, one of the following status codes must be - * returned. The ORDERED list is: - * - *
      -	 *      CIM_ERR_FAILED (some other unspecified error occurred)
      -	 * 
      - */ - public CloseableIterator enumerateNamespaces(String pNamespace) - throws WBEMException; - - /** - * Returns an indication of whether the client is active (initialized and - * not closed) or inactive (not initialized or closed). - * - * @return true if client is active, false - * otherwise. - */ - public boolean isActive(); - - /** - * Sends the indication to the specified recipient. - * - * @param pRecipient - * URI of indication recipient. - * @param pIndication - * Indication. - * @return true if indication received successfully, - * false otherwise. - * @throws WBEMException - * If unsuccessful, one of the following status codes must be - * returned. The ORDERED list is: - * - *
      -	 *      CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
      -	 *            or otherwise incorrect parameters)
      -	 *      CIM_ERR_FAILED (some other unspecified error occurred)
      -	 * 
      - */ - public boolean sendIndication(URI pRecipient, CIMInstance pIndication) throws WBEMException; -} +/* + WBEMClientSBLIM.java + + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Alexander Wolf-Reber, IBM, a.wolf-reber@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1565892 2006-11-08 lupusalex Make SBLIM client JSR48 compliant + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors + * 2942520 2010-03-08 blaschke-oss IPv6 link local address with scope_id including a dot not supported + * 3516848 2012-04-11 blaschke-oss enumerateNamespaces() method to WBEMClient + * 3522904 2012-05-02 blaschke-oss Add new API WBEMClientSBLIM.isActive() + * 2616 2013-02-23 blaschke-oss Add new API WBEMClientSBLIM.sendIndication() + */ + +package org.metricshub.wbem.sblim.cimclient; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.net.URI; +import java.util.Locale; +import java.util.Properties; + +import javax.net.SocketFactory; +import javax.security.auth.Subject; + +import org.metricshub.wbem.javax.cim.CIMInstance; +import org.metricshub.wbem.javax.cim.CIMObjectPath; +import org.metricshub.wbem.javax.wbem.CloseableIterator; +import org.metricshub.wbem.javax.wbem.WBEMException; +import org.metricshub.wbem.javax.wbem.client.WBEMClient; + +/** + * Class WBEMClientSBLIM contains the SBLIM CIM Client specific extensions to + * the WBEMClient interface. + * + * @see WBEMClient + * + */ +public interface WBEMClientSBLIM extends WBEMClient { + + /** + * Initialize the client connection. This must be called before any + * operations. This must only be called once. + * + * @param pUri + * The protocol and host to use. Any other fields will be + * ignored. + * @param pSubject + * The principal/credential pairs for this connection. + * @param pLocales + * An array of locales in order of priority of preference. + * @throws IllegalArgumentException + * If the host or scheme portion of the object path is null, or + * if the protocol is not supported. + * @throws WBEMException + * If the protocol adapter or security cannot be initialized. + */ + public void initialize(URI pUri, Subject pSubject, Locale[] pLocales) + throws IllegalArgumentException, WBEMException; + + /** + * Returns the client specific configuration properties. Note that only + * these properties are returned that override the global settings. The + * global settings can be accessed via the java.lang.System + * class.
      + * If the no client specific configuration is set, this method returns + * null + * + * @return The configuration properties + * @see System#getProperties() + */ + public Properties getProperties(); + + /** + * Sets the client specific configuration properties. Any previously set + * client specific properties are overwritten. The given properties are + * handled as an overlay on the global settings. That means that properties + * specified here override the corresponding global properties whereas + * properties not specified here are taken from the global properties. The + * global settings can be accessed via the java.lang.System + * class. + * + * @param pProperties + * The session specific properties. null resets this + * client to the global settings. + * + * @see System#setProperties(Properties) + */ + public void setProperties(Properties pProperties); + + /** + * Returns the effective value of a given configuration property. The method + * will return the local value of the current thread if one was set or + * otherwise client specific value if one was set or otherwise the global + * value if one was set or otherwise the default value. Valid property names + * can be found in the WBEMConfigurationProperties interface. + * + * @param pKey + * The name of the configuration property + * + * @return The value of the given configuration property + * @see WBEMConfigurationProperties + */ + public String getProperty(String pKey); + + /** + * Sets a client specific configuration property. This property will + * override the corresponding global property for this client instance. The + * global settings can be accessed via the java.lang.System + * class. Valid property names can be found in the + * WBEMConfigurationProperties interface. Unknown properties + * are ignored. + * + * @param pKey + * The name of the configuration property + * @param pValue + * The value of the configuration property. null + * resets to the global setting. + * @see WBEMConfigurationProperties + * @see System#setProperty(String, String) + */ + public void setProperty(String pKey, String pValue); + + /** + * Returns the configuration properties that are local to the current + * thread. Note that only these properties are returned that override the + * global and the client settings. The global settings can be accessed via + * the java.lang.System class, the client setting via + * getProperties().
      + * If the no client specific configuration is set, this method returns + * null + * + * @return The configuration properties + * @see System#getProperties() + * @see #getProperties() + */ + public Properties getLocalProperties(); + + /** + * Sets the configuration properties that are local to the current thread. + * Any previously set local properties (of the current thread) are + * overwritten. The given properties are handled as an overlay on the global + * settings and the client settings. That means that properties specified + * here override the corresponding properties whereas properties not + * specified here are taken from the client or global properties. The global + * settings can be accessed via the java.lang.System class, the + * client setting via getProperties(). + * + * @param pProperties + * The thread specific properties. null remove the + * local setting of the current thread. + * + * @see System#setProperties(Properties) + * @see #setProperties(Properties) + */ + public void setLocalProperties(Properties pProperties); + + /** + * Sets a local configuration property for the current thread. This property + * will override the corresponding global and client property for this + * client instance. The global settings can be accessed via the + * java.lang.System class, the client setting via + * getProperties(). Valid property names can be found in the + * WBEMConfigurationProperties interface. Unknown properties + * are ignored. + * + * @param pKey + * The name of the configuration property + * @param pValue + * The value of the configuration property. null + * resets to the global setting. + * @see WBEMConfigurationProperties + * @see System#setProperty(String, String) + * @see #setProperty(String, String) + */ + public void setLocalProperty(String pKey, String pValue); + + /** + * Gets the custom socket factory if one is set. The client uses this + * factory for socket creation instead of the default one. + * + * @return The custom factory used for socket creation. null + * indicates set the JRE default factory is used. + */ + public SocketFactory getCustomSocketFactory(); + + /** + * Sets a custom socket factory. The client will use this factory for socket + * creation instead of the JRE default. + * + * @param pFactory + * The factory to use for socket creation. null + * resets to the JRE default factory. + * @throws UnsupportedOperationException + * Some protocols might not communicate via TCP sockets + */ + public void setCustomSocketFactory(SocketFactory pFactory) throws UnsupportedOperationException; + + /** + * Enumerate the names of the instances of CIM namespaces. + * + * @param pNamespace + * The Interop Namespace, if known. If null, the default Interop + * Namespace names defined by DSP1033 are used. + * @return A CloseableIterator of CIMObjectPaths. + * @throws WBEMException + * If unsuccessful, one of the following status codes must be + * returned. The ORDERED list is: + * + *
      +	 *      CIM_ERR_FAILED (some other unspecified error occurred)
      +	 * 
      + */ + public CloseableIterator enumerateNamespaces(String pNamespace) + throws WBEMException; + + /** + * Returns an indication of whether the client is active (initialized and + * not closed) or inactive (not initialized or closed). + * + * @return true if client is active, false + * otherwise. + */ + public boolean isActive(); + + /** + * Sends the indication to the specified recipient. + * + * @param pRecipient + * URI of indication recipient. + * @param pIndication + * Indication. + * @return true if indication received successfully, + * false otherwise. + * @throws WBEMException + * If unsuccessful, one of the following status codes must be + * returned. The ORDERED list is: + * + *
      +	 *      CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
      +	 *            or otherwise incorrect parameters)
      +	 *      CIM_ERR_FAILED (some other unspecified error occurred)
      +	 * 
      + */ + public boolean sendIndication(URI pRecipient, CIMInstance pIndication) throws WBEMException; +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/WBEMConfigurationProperties.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/WBEMConfigurationProperties.java similarity index 95% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/WBEMConfigurationProperties.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/WBEMConfigurationProperties.java index be80a47..e1a36c4 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/WBEMConfigurationProperties.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/WBEMConfigurationProperties.java @@ -1,1154 +1,1152 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Alexander Wolf-Reber, a.wolf-reber@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-11-08 lupusalex Make SBLIM client JSR48 compliant - * 1688273 2007-04-19 lupusalex Full support of HTTP trailers - * 1815707 2007-10-30 ebak TLS support - * 1827728 2007-11-12 ebak embeddedInstances: attribute EmbeddedObject not set - * 1848607 2007-12-11 ebak Strict EmbeddedObject types - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2372030 2008-12-01 blaschke-oss Add property to control synchronized SSL handshaking - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors - * 2846231 2009-09-23 rgummada connection failure on CIMOM w/o user/pw - * 2930341 2010-01-12 blaschke-oss Sync up WBEMClientConstants with JSR48 1.0.0 - * 2957387 2010-03-03 blaschke-oss EmbededObject XML attribute must not be all uppercases - * 2970881 2010-03-15 blaschke-oss Add property to control EmbeddedObject case - * 3046073 2010-09-07 blaschke-oss Performance hit due to socket conn. creation with timeout - * 3111718 2010-11-18 blaschke-oss org.sblim.cimclient SSL Code is using the wrong SSL Property - * 3185763 2011-02-25 blaschke-oss Reliable indication support - Phase 1 - * 3195069 2011-02-28 blaschke-oss Need support to disable SSL Handshake - * 3197423 2011-03-02 blaschke-oss Server authentication with PegasusLocalAuthInfo failing - * 3277928 2011-04-06 blaschke-oss CIM-XML tracing cannot be enabled in the field - * 3206904 2011-05-03 blaschke-oss Indication listener deadlock causes JVM to run out sockets - * 3288721 2011-05-20 blaschke-oss Need the function of indication reordering - * 3459036 2011-12-13 blaschke-oss Linked list for RI queue not efficient for many LDs - * 3485074 2012-02-06 blaschke-oss An Indication trace request - * 3492246 2012-02-23 blaschke-oss Rename new indication trace property - * 3492214 2012-02-23 blaschke-oss Add a SenderIPAddress property indications - * 3492224 2012-02-23 blaschke-oss Need two different timeouts for Socket connections - * 3521157 2012-05-10 blaschke-oss JSR48 1.0.0: PROP_ENABLE_*_LOGGING is Level, not 0/1 - * 3524050 2012-06-06 blaschke-oss Improve WWW-Authenticate in HTTPClient.java - * 3536399 2012-08-25 hellerda Add client/listener peer authentication properties - * 3572993 2012-10-01 blaschke-oss parseDouble("2.2250738585072012e-308") DoS vulnerability - * 3598613 2013-01-11 blaschke-oss different data type in cim instance and cim object path - * 2618 2013-02-27 blaschke-oss Need to add property to disable weak cipher suites for the secure indication - * 2628 2013-03-26 blaschke-oss Limit size of LinkedList of CIMEvents to be dispatched - * 2635 2013-05-16 blaschke-oss Slowloris DoS attack for CIM indication listener port - * 2642 2013-05-21 blaschke-oss Seperate properties needed for cim client and listener to filter out ciphers - * 2647 2013-07-01 blaschke-oss Add two ssl protocol properties for http server and client - * 2654 2013-07-29 blaschke-oss Check jcc idle time with CIMOM keepalive timeout to avoid EOF - * 2151 2013-08-20 blaschke-oss gzip compression not supported - * 2711 2013-11-13 blaschke-oss LOCALNAMESPACEPATH allows 0 NAMESPACE children - */ -package org.sentrysoftware.wbem.sblim.cimclient; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -/** - * The interface WBEMConfigurationProperties contains the names of all - * configuration properties that are recognized by the CIM Client. - * - */ -public interface WBEMConfigurationProperties { - - /** - * A URL string giving the location of the CIM client config file.
      - *
      - * By default the SBLIM CIM Client looks for - *
        - *
      • file:sblim-cim-client2.properties
      • - *
      • file:%USER_HOME%/sblim-cim-client2.properties
      • - *
      • file:/etc/java/sblim-cim-client2.properties
      • - *
      - * The first file found will be used. The default search list is not applied - * if this property is set, even if the given URL does not exist.
      - */ - public static final String CONFIG_URL = "sblim.wbem.configURL"; - - /** - * Sets the minimum level for messages to be written to the log file.
      - *
      - * Type: Discrete
      - * Recognition: Startup
      - * Range: OFF, SEVERE, WARNING, INFO, CONFIG, ALL
      - * Default: OFF, which disables file logging completely. - */ - public static final String LOG_FILE_LEVEL = "sblim.wbem.logFileLevel"; - - /** - * A string specifying the location of the log file. The string may include - * the following special components that will be replaced at runtime:
      - *
        - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
        /the local pathname separator
        %tthe system temporary directory
        %hthe value of the "user.home" system property
        %gthe generation number to distinguish rotated logs
        %ua unique number to resolve conflicts
        %%translates to a single percent sign "%"
        - *
      - * Thus for example a pattern of %t/java%g.log with a count of - * 2 would typically cause log files to be written on Unix to - * /var/tmp/java2.log
      - *
      - * Type: String
      - * Recognition: Startup
      - * Default: %t/cimclient_log_%g.txt. - */ - public static final String LOG_FILE_LOCATION = "sblim.wbem.logFileLocation"; - - /** - * Sets the maximum size in bytes of a single log file. When the limit is - * reached a new file is created. A limit of zero will create a new log file - * for every log record !
      - *
      - * Type: Integer
      - * Recognition: Startup
      - * Range: 0 .. Integer.MAX_VALUE
      - * Default: 100.000
      - */ - public static final String LOG_FILE_SIZE_LIMIT = "sblim.wbem.logFileSizeLimit"; - - /** - * Sets the number of log files to cycle through. When the number is - * exceeded the oldest file is dropped.
      - *
      - * Type: Integer
      - * Recognition: Startup
      - * Range: 1 .. Integer.MAX_VALUE
      - * Default: 5
      - */ - public static final String LOG_FILE_COUNT = "sblim.wbem.logFileCount"; - - /** - * Sets the minimum level for messages to be written to the console logger - * file.
      - *
      - * Type: Discrete
      - * Recognition: Startup
      - * Range: OFF, SEVERE, WARNING, INFO, CONFIG, ALL
      - * Default: OFF, which disables console logging completely. - */ - public static final String LOG_CONSOLE_LEVEL = "sblim.wbem.logConsoleLevel"; - - /** - * Sets the type of the console logger. Maybe either message log or trace - * log.
      - *
      - * Type: Discrete
      - * Recognition: Startup
      - * Range: MESSAGE, TRACE
      - * Default: MESSAGE. - */ - public static final String LOG_CONSOLE_TYPE = "sblim.wbem.logConsoleType"; - - /** - * Sets the minimum level for messages to be written to the trace file.
      - *
      - * Type: Discrete
      - * Recognition: Startup
      - * Range: - * OFF, SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST, ALL
      - * Default: OFF, which disables file tracing completely
      - */ - public static final String TRACE_FILE_LEVEL = "sblim.wbem.traceFileLevel"; - - /** - * A string specifying the location of the trace file. The string may - * include the following special components that will be replaced at - * runtime:
      - *
        - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
        /the local pathname separator
        %tthe system temporary directory
        %hthe value of the "user.home" system property
        %gthe generation number to distinguish rotated logs
        %ua unique number to resolve conflicts
        %%translates to a single percent sign "%"
        - *
      - * Thus for example a pattern of %t/java%g.log with a count of - * 2 would typically cause log files to be written on Unix to - * /var/tmp/java2.log
      - *
      - * Type: String
      - * Recognition: Startup
      - * Default: %t/cimclient_trace_%g.txt
      - */ - public static final String TRACE_FILE_LOCATION = "sblim.wbem.traceFileLocation"; - - /** - * Sets the maximum size in bytes of a single log file. When the limit is - * reached a new file is created. A limit of zero creates a new file for - * each trace record !
      - *
      - * Type: Integer
      - * Recognition: Startup
      - * Range: 0 .. Integer.MAX_VALUE
      - * Default: 1.000.000
      - */ - public static final String TRACE_FILE_SIZE_LIMIT = "sblim.wbem.traceFileSizeLimit"; - - /** - * Sets the number of log files to cycle through. When the number is - * exceeded the oldest file is dropped.
      - *
      - * Type: Integer
      - * Recognition: Startup
      - * Range: 1 .. Integer.MAX_VALUE
      - * Default: 5
      - */ - public static final String TRACE_FILE_COUNT = "sblim.wbem.traceFileCount"; - - /** - * The timeout for http requests. A timeout of zero is interpreted as - * infinite timeout.
      - *
      - * Type: Integer
      - * Unit: Milliseconds
      - * Recognition: Anytime
      - * Range: 0 .. Integer.MAX_VALUE
      - * Default: 0
      - */ - public static final String HTTP_TIMEOUT = "sblim.wbem.httpTimeout"; - - /** - * The size of the internal http connection pools. Each - * WBEMClient instance has it's own http connection pool. A - * positive value defines the number of connections, zero that no connection - * will be reused, and -1 all connections will be reused (when it's - * possible).
      - *
      - * Type: Integer
      - * Recognition: Anytime
      - * Range: -1, 0, 1 .. Integer.MAX_VALUE
      - * Default: 16
      - */ - public static final String HTTP_POOL_SIZE = "sblim.wbem.httpPoolSize"; - - /** - * The Java class name of the authentication module to use for http - * authentication.
      - *
      - * Type: String
      - * Recognition: On next authentication
      - * Range: - * - * org.sblim.cimclient.internal.http.WwwAuthInfo, org.sblim.cimclient.internal.http.PegasusLocalAuthInfo or any self-written subclass of org.sblim.cimclient.internal.http.AuthorizationInfo - *
      - * Default: org.sblim.cimclient.internal.http.WwwAuthInfo
      - */ - public static final String HTTP_AUTHENTICATION_MODULE = "sblim.wbem.httpAuthModule"; - - /** - * The WWW-Authenticate information to use when sending the first request to - * a server.
      - *
      - * Note: This string must exactly match what the server returns in the
      - * WWW-Authenticate field of an HTTP 401 response when authentication
      - * fails. The following two strings are examples:
      - *
      - * - * - * Basic realm="Secure Area" - * Digest realm="testrealm@host.com",qop="auth,auth-int",nonce="dcd98b7102dd2f0e8b11d0f600bfb0c093",opaque="5ccc069c403ebaf9f0171e9517f40e41" - * - * - * Type: String
      - * Recognition: On next authentication
      - * Range: Basic, Digest
      - * Default: none
      - */ - public static final String HTTP_WWW_AUTHENTICATE_INFO = "sblim.wbem.httpWwwAuthenticateInfo"; - - /** - * Specifies if MPOST is used for transmitting http messages. If false, POST - * is used.
      - *
      - * Type: Boolean
      - * Recognition: Anytime
      - * Range: true, false
      - * Default: true
      - */ - public static final String HTTP_USE_MPOST = "sblim.wbem.httpMPOST"; - - /** - * Specifies if chunking is used for transmitting http messages.
      - *
      - * Type: Boolean
      - * Recognition: Anytime
      - * Range: true, false
      - * Default: true
      - */ - public static final String HTTP_USE_CHUNKING = "sblim.wbem.httpChunking"; - - /** - * Specifies the http protocol version to use. This option is useful if the - * protocol negotiation fails.
      - *
      - * Type: String
      - * Recognition: Anytime
      - * Range: 1.0, 1.1
      - * Default: 1.1
      - */ - public static final String HTTP_VERSION = "sblim.wbem.httpVersion"; - - /** - * Specifies how often the client will retry to connect to a CIMOM which - * refused the connection in the first place.
      - *
      - * Type: Integer
      - * Recognition: Anytime
      - * Range: 0 .. Integer.MAX_VALUE
      - * Default: 0
      - */ - public static final String HTTP_CONNECTION_RETRIES = "sblim.wbem.httpConnectionRetries"; - - /** - * Specifies if the client will discard and request again http documents - * with less than a given number of bytes.
      - *
      - * Type: Boolean
      - * Recognition: Anytime
      - * Range: true, false
      - * Default: false
      - */ - public static final String HTTP_ENABLE_CONTENT_LENGTH_RETRY = "sblim.wbem.httpEnableContentLengthRetry"; - - /** - * Specifies the threshold above which a http document is regarded as valid - * by the content length retry algorithm.
      - *
      - * Type: Integer
      - * Recognition: Anytime
      - * Range: 0 .. Integer.MAX_VALUE
      - * Default: 50
      - */ - public static final String HTTP_CONTENT_LENGTH_THRESHOLD = "sblim.wbem.httpContentLengthThreshold"; - - /** - * The file path of the SSL keystore.
      - *
      - * Type: String
      - * Recognition: On next SSL connection
      - * Default: none
      - */ - public static final String KEYSTORE_PATH = "javax.net.ssl.keyStore"; - - /** - * The type of the keystore.
      - *
      - * Type: String
      - * Recognition: On next SSL connection
      - * Range: PKCS12, JKS, ...
      - * Default: JKS
      - */ - public static final String KEYSTORE_TYPE = "javax.net.ssl.keyStoreType"; - - /** - * The password of the keystore.
      - *
      - * Type: String
      - * Recognition: On next SSL connection
      - * Default: none
      - */ - public static final String KEYSTORE_PASSWORD = "javax.net.ssl.keyStorePassword"; - - /** - * The file path of the SSL truststore.
      - *
      - * Type: String
      - * Recognition: On next SSL connection
      - * Default: none
      - */ - public static final String TRUSTSTORE_PATH = "javax.net.ssl.trustStore"; - - /** - * The type of the truststore.
      - *
      - * Type: String
      - * Recognition: On next SSL connection
      - * Range: PKCS12, JKS, ...
      - * Default: JKS
      - */ - public static final String TRUSTSTORE_TYPE = "javax.net.ssl.trustStoreType"; - - /** - * The password of the truststore.
      - *
      - * Type: String
      - * Recognition: On next SSL connection
      - * Default: none
      - */ - public static final String TRUSTSTORE_PASSWORD = "javax.net.ssl.trustStorePassword"; - - /** - * The provider to use for creation of SSL client sockets.
      - *
      - * Security property: JRE global access via Security.setProperty() and Security.getProperty() ! - *
      - *
      - * Type: Java class name
      - * Recognition: On next SSL connection
      - * Default: Security.getProviders("SSLContext.SSL")
      - */ - public static final String SSL_SOCKET_PROVIDER = "sblim.wbem.sslSocketProvider"; - - /** - * The provider to use for creation of SSL server sockets.
      - *
      - * Security property: JRE global access via Security.setProperty() and Security.getProperty() ! - *
      - *
      - * Type: Java class name
      - * Recognition: On next SSL connection
      - * Default: Security.getProviders("SSLContext.SSL")
      - */ - public static final String SSL_SERVER_SOCKET_PROVIDER = "sblim.wbem.sslServerSocketProvider"; - - /** - * The protocol used for SSLContext.getInstance(String protocol). For - * IBMJSSE2 provider it can be "SSL_TLS".
      - *
      - * Security property: JRE global access via - * Security.setProperty() and - * Security.getProperty()
      - * Recognition: On next SSL connection
      - * Default: "SSL" - */ - public static final String SSL_PROTOCOL = "ssl.Protocol"; - - /** - * The protocol used for SSLContext.getInstance(String protocol) by a - * client. This property overrides any value set via the ssl.Protocol - * property.
      - *
      - * Recognition: On next SSL connection
      - * Default: none - */ - public static final String SSL_CLIENT_PROTOCOL = "sblim.wbem.sslClientProtocol"; - - /** - * The protocol used for SSLContext.getInstance(String protocol) by a - * listener. This property overrides any value set via the ssl.Protocol - * property.
      - *
      - * Recognition: On next SSL connection
      - * Default: none - */ - public static final String SSL_LISTENER_PROTOCOL = "sblim.wbem.sslListenerProtocol"; - - /** - * The key manager factory algorithm name.
      - *
      - * Security property: JRE global access via Security.setProperty() and Security.getProperty() ! - *
      - *
      - * Type: String
      - * Recognition: On next SSL connection
      - * Range: IbmX509, SunX509, ...
      - * Default: JRE specific
      - */ - public static final String SSL_KEYMANAGER_ALGORITHM = "ssl.KeyManagerFactory.algorithm"; - - /** - * The trust manager factory algorithm name.
      - *
      - * Security property: JRE global access via Security.setProperty() and Security.getProperty() ! - *
      - *
      - * Type: String
      - * Recognition: On next SSL connection
      - * Range: IbmX509, SunX509, ...
      - * Default: JRE specific
      - */ - public static final String SSL_TRUSTMANAGER_ALGORITHM = "ssl.TrustManagerFactory.algorithm"; - - /** - * Determines if a HTTPS client will attempt to authenticate the server - * (i.e. CIMOM) by verifying the server certificate.
      - *
      - * If false, do not attempt verification. If true, the client will attempt - * to verify the server certificate against the contents of the truststore; - * in this case a valid path must be defined in "javax.net.ssl.trustStore" - * or no connection will be permitted.
      - *
      - * Type: Boolean
      - * Recognition: On initialization of a new client
      - * Default: false
      - */ - public static final String SSL_CLIENT_PEER_VERIFICATION = "sblim.wbem.sslClientPeerVerification"; - - /** - * Determines how a HTTPS listener will handle authentication of a client - * (i.e. indication sender):
      - *
        - * - * - * - * - * - * - * - * - * - * - * - * - * - *
        ignoredo not examine the client certificate
        acceptexamine client certificate if presented; do not fail if not presented - *
        requireexamine client certificate; fail if not presented
        - *
      - * If set to "ignore", do not attempt verification. If set to "accept" or - * "require", the listener will attempt to verify the sender against the - * contents of the truststore; in this case a valid path must be defined in - * "javax.net.ssl.trustStore" or no connection will be permitted.
      - *
      - * Type: String
      - * Recognition: On next call to addListener()
      - * Default: ignore
      - */ - public static final String SSL_LISTENER_PEER_VERIFICATION = "sblim.wbem.sslListenerPeerVerification"; - - /** - * The comma-separated list of cipher suites that are to be disabled by the - * client when connecting via an SSL socket. In general, this is the list of - * cipher suites considered "too weak" for use in a particular environment.
      - *
      - * Type: String
      - * Recognition: On initialization of a new client
      - * Default: none
      - */ - public static final String SSL_CLIENT_CIPHER_SUITES_TO_DISABLE = "sblim.wbem.sslClientCipherSuitesToDisable"; - - /** - * The comma-separated list of cipher suites that are to be disabled by the - * listener when connecting via an SSL socket. In general, this is the list - * of cipher suites considered "too weak" for use in a particular - * environment.
      - *
      - * Type: String
      - * Recognition: On next call to addListener()
      - * Default: none
      - */ - public static final String SSL_LISTENER_CIPHER_SUITES_TO_DISABLE = "sblim.wbem.sslListenerCipherSuitesToDisable"; - - /** - * Specifies the XML parser for parsing CIM-XML responses.
      - * The SAX parser is the default choice since it is fast, resource saving - * and interoperable. The streaming algorithm of the PULL parser uses the - * fewest possible resources but at the prize to keep the CIMOMs response - * open for a long time. That works with many but not all CIMOMs. The DOM - * parser is slow and resource hungry but nice to debug.
      - *
      - * Type: Discrete
      - * Recognition: Anytime
      - * Range: DOM, PULL, SAX
      - * Default: SAX
      - */ - public static final String CIMXML_PARSER = "sblim.wbem.cimxmlParser"; - - /** - * Enables or disables tracing of CIM-XML communication. The trace is sent - * to an output stream the application has to set via the LogAndTraceManager - * class.
      - *
      - * Type: Boolean
      - * Recognition: Anytime
      - * Range: true, false
      - * Default: false
      - */ - public static final String CIMXML_TRACING = "sblim.wbem.cimxmlTracing"; - - /** - * Specifies the stream to use for tracing CIM-XML communication in the - * event the application does not set one via the LogAndTraceManager class. - * This stream can either be standard output (System.out), standard error - * output (System.err) or a filename to be opened by the client. - * - * Note: This property has no effect unless sblim.wbem.cimxmlTracing is set - * to true. - * - * Note: This property has no effect if the application already set the - * stream prior to client initialization. If the application sets the stream - * after client initialization, the stream specified by this property is - * overridden. - * - * Note: If a filename is specified, it is opened and all CIM-XML - * communication is written to it - no checks are made for an existing file - * or for filling up the disk. USE WITH CAUTION. - * - * Type: String
      - * Recognition: Startup
      - * Range: System.out, System.err, filename
      - * Default: none
      - */ - public static final String CIMXML_TRACE_STREAM = "sblim.wbem.cimxmlTraceStream"; - - /** - * - * Tells the XML builder how to sign embedded objects. This is necessary due to - * the non-consequent handling of embedded objects on different CIMOMs. - * "AttribOnly" - only the EmbeddedObject="instance/object" is used - * (should be good for Pegasus) - * "EmbObjQuali" - on qualified CIM-XML elements the EmbeddedObject qualifier is used - * for embedded classes and instances - * "EmbObjAndEmbInstQuali" - - * on qualified CIM-XML elements the EmbeddedObject qualifier is used - * for embedded classes and the EmbeddedInstance="className" qualifier - * is used for embedded instances - * Type: String - * Recognition: Anytime - * Range: AttribOnly, EmbObjQuali, EmbObjAndEmbInstQuali - * Default: AttribOnly - * - */ - public static final String CIMXML_EMBOBJBUILDER = "sblim.wbem.cimxmlEmbObjBuilder"; - - /** - * - * If set the type of valueless EmbeddedObjects are mapped to CLASS_T. It should work well - * with OpenPegasus-2.7.0. - * If unset no type mapping is done for valuless EmbeddedObjects. - * - * Type: Boolean - * Default: true - * - */ - public static final String CIMXML_PARSER_STRICT_EMBOBJ_TYPES = "sblim.wbem.cimxmlParser.strictEmbObjTypes"; - - /** - * - * If set to false, the embedded object entity in all requests is in mixed case - * (EmbeddedObject) per DSP0203. If set to true, the embedded object entity is in - * upper case (EMBEDDEDOBJECT) - this works with some older CIMOMs, such as OpenPegasus - * 2.6.1 and 2.7.0. - * - * <!ENTITY % EmbeddedObject "EmbeddedObject (object|instance) #IMPLIED"> - * - * Type: Boolean - * Recognition: Startup - * Range: true, false - * Default: true - * - */ - public static final String CIMXML_BUILDER_UPPERCASE_EMBOBJ_ENTITIES = "sblim.wbem.cimxmlBuilder.upperCaseEmbObjEntities"; - - /** - * - * If set to true, SSL handshakes are performed after an SSL socket is created by the - * socket factory. If set to false, handshakes are not performed, which is useful if - * if the handshake has already taken place. - * - * Type: Boolean - * Recognition: Anytime - * Default: true - * - */ - public static final String PERFORM_SSL_HANDSHAKE = "sblim.wbem.performSslHandshake"; - - /** - * - * If set to false, SSL handshakes are not synchronized. If set to true, SSL handshakes - * are synchronized as a workaround for an IBMJSSE1 problem with thread-safe handshakes. - * - * Note: This property has no affect unless sblim.wbem.performSslHandshake is set to - * true. - * - * Type: Boolean - * Recognition: Anytime - * Default: false - * - */ - public static final String SYNCHRONIZED_SSL_HANDSHAKE = "sblim.wbem.synchronizedSslHandshake"; - - /** - * - * If set to true, socket connections are attempted with the timeout value defined by - * sblim.wbem.socketConnectTimeout. If set to false, socket connections are attempted - * without a timeout. Using a timeout for socket connections is the preferred method - * but may introduce intermittent, significant performance impacts during the connection - * process in Java 5+ (see Sun bug 5092063). - * - * Type: Boolean - * Recognition: Anytime - * Default: true - * - */ - public static final String SOCKET_CONNECT_WITH_TIMEOUT = "sblim.wbem.socketConnectWithTimeout"; - - /** - * - * The timeout for socket connect requests. A timeout of zero is interpreted - * as infinite timeout. - * - * Note: This property has no effect unless socket connection with timeout is - * enabled (see the sblim.wbem.socketConnectWithTimeout property). - * - * Type: Integer - * Unit: Milliseconds - * Recognition: Anytime - * Range: 0 .. Integer.MAX_VALUE - * Default: 0 - * - */ - public static final String SOCKET_CONNECT_TIMEOUT = "sblim.wbem.socketConnectTimeout"; - - /** - * The idle timeout between socket requests after which the socket is - * automatically reset (closed, then reopened). A timeout of zero is - * interpreted as infinite timeout.
      - * Type: Integer
      - * Unit: Milliseconds
      - * Recognition: Anytime
      - * Range: 0 .. Integer.MAX_VALUE
      - * Default: 0
      - */ - public static final String SOCKET_IDLE_TIMEOUT = "sblim.wbem.socketIdleTimeout"; - - /** - * - * Turn on/off usage of the default user/password, which can be used - * if the CIMOM requires a "garbage" credential. If set to false, - * user-supplied credentials will be applied. If set to true, - * default credentials will be applied when both the user-supplied - * principal and credential are null/empty. - * - * Type: Boolean - * Recognition: Startup - * Default: false - * - */ - public static final String KEY_CREDENTIALS_DEFAULT_ENABLED = "sblim.wbem.default.authorization.enabled"; - - /** - * - * The name of the user for the "garbage" credential. - * - * Note: This property has no effect unless default authorization is - * enabled (see the sblim.wbem.default.authorization.enabled property) - * AND both the user-supplied principal and credential are null/empty. - * - * Type: String - * Recognition: Startup - * Default: "default" - * - */ - public static final String KEY_DEFAULT_PRINCIPAL = "sblim.wbem.default.principal"; - - /** - * - * The credential of the user for the "garbage" credential. - * - * Note: This property has no effect unless default authorization is - * enabled (see the sblim.wbem.default.authorization.enabled property) - * AND both the user-supplied principal and credential are null/empty. - * - * Type: String - * Recognition: Startup - * Default: "default" - * - */ - public static final String KEY_DEFAULT_CREDENTIAL = "sblim.wbem.default.credential"; - - /** - * The timeout for http connections of an indication listener. A timeout of - * zero is interpreted as infinite timeout.
      - *
      - * Type: Integer
      - * Unit: Milliseconds
      - * Recognition: On next creation of a WBEMListener
      - * Range: 0 .. Integer.MAX_VALUE
      - * Default: 10000
      - */ - public static final String LISTENER_HTTP_TIMEOUT = "sblim.wbem.listenerHttpTimeout"; - - /** - * The header timeout for http connections of an indication listener. The - * header timeout is defined as the maximum amount of time allowed to read - * in the entire http header. A timeout of zero is interpreted as infinite - * timeout.
      - *
      - * Note: One form of DoS attack sends periodic http header lines in an - * attempt to keep the socket open indefinitely. This timeout can be used to - * thwart such an attempt.
      - *
      - * Type: Integer
      - * Unit: Milliseconds
      - * Recognition: On next creation of a WBEMListener
      - * Range: 0 .. Integer.MAX_VALUE
      - * Default: 30000
      - */ - public static final String LISTENER_HTTP_HEADER_TIMEOUT = "sblim.wbem.listenerHttpHeaderTimeout"; - - /** - * The maximum allowable timeouts an http connection of an indication - * listener can have before the client ignores it. In other words, the - * number of times an IP exceeds sblim.wbem.listenerHttpTimeout and - * sblim.wbem.listenerHttpHeaderTimeout before it is blocked. A value of - * zero is interpreted as unlimited timeouts.
      - *
      - * Type: Integer
      - * Recognition: On next creation of a WBEMListener
      - * Range: 0 .. Integer.MAX_VALUE
      - * Default: 0
      - */ - public static final String LISTENER_HTTP_MAX_ALLOWED_TIMEOUTS = "sblim.wbem.listenerHttpMaxAllowedTimeouts"; - - /** - * The size of the thread pool for the connection handlers of the indication - * for http connections of an indication listener. This is the maximum - * number of handler threads the pool might create on heavy load.
      - * A value of -1 is interpreted as infinity.
      - * Type: Integer
      - * Unit: Count
      - * Recognition: On next creation of a WBEMListener
      - * Range: -1 .. Integer.MAX_VALUE
      - * Default: 8
      - */ - public static final String LISTENER_MAX_POOL_SIZE = "sblim.wbem.listenerPoolMaxSize"; - - /** - * The minimal number of connection handlers of the indication listener that - * will be kept open by the thread pool regardless of the current load.
      - * Type: Integer
      - * Unit: Count
      - * Recognition: On next creation of a WBEMListener
      - * Range: 0 .. Integer.MAX_VALUE
      - * Default: 2
      - */ - public static final String LISTENER_MIN_POOL_SIZE = "sblim.wbem.listenerPoolMinSize"; - - /** - * The maximum number of queued connections (the fixed capacity of the - * ArrayBlockingQueue of pending connections incoming to the listener). - * Whereas increasing this number will result in a correspondingly greater - * memory usage, making the number too small can result in HTTP 503 - * "Service temporarily overloaded" returned to server if there is no room - * in queue for an incoming connection.
      - * Type: Integer
      - * Unit: Count
      - * Recognition: On next creation of a WBEMListener
      - * Range: 1 .. Integer.MAX_VALUE
      - * Default: 32
      - */ - public static final String LISTENER_MAX_QUEUE_SIZE = "sblim.wbem.listenerQueueMaxSize"; - - /** - * The number of queued connections that is tolerated before the thread pool - * creates an additional handler thread. Increasing this value leads to a - * less "nervous" creation/destruction of handlers. However it - * makes the listener more vulnerable to frozen connections.
      - *
      - * Type: Integer
      - * Unit: Count
      - * Recognition: On next creation of a WBEMListener
      - * Range: 0 .. Integer.MAX_VALUE
      - * Default: 2
      - */ - public static final String LISTENER_BACKLOG = "sblim.wbem.listenerBacklog"; - - /** - * The idle time of a worker that is tolerated before the worker is - * destroyed by the thread pool. By setting the minimal pool size >0 you can - * protect a given number of worker from destruction.
      - *
      - * Type: Long
      - * Unit: Milliseconds
      - * Recognition: On next creation of a WBEMListener
      - * Range: 0 .. Long.MAX_VALUE
      - * Default: 30000
      - */ - public static final String LISTENER_HANDLER_MAX_IDLE = "sblim.wbem.listenerHandlerMaxIdle"; - - /** - * The maximum number of queued events (the fixed capacity of the LinkedList - * of indications awaiting delivery to the listener). When the maximum is - * reached, the oldest indications are discarded to make room for the newest - * ones. A value of 0 is interpreted as infinity.
      - * Type: Integer
      - * Unit: Count
      - * Recognition: On next creation of a WBEMListener
      - * Range: 0 .. Integer.MAX_VALUE
      - * Default: 0
      - */ - public static final String LISTENER_MAX_QUEUED_EVENTS = "sblim.wbem.listenerMaxQueuedEvents"; - - /** - * - * If set to true, reliable indication support is enabled and indications - * are processed accordingly. If set to false, reliable indication - * support is disabled and indications are passed directly to listener. - * - * If reliable indication support is enabled, incoming indications are - * handled as documented in DSP1054 which includes queuing unexpected - * indications, caching all indications for the duration of their sequence - * identifier lifetime, and logging missing, duplicate and out-of-order - * indications. - * - * The sequence identifier lifetime is defined as: - * DeliveryRetryAttempts * DeliveryRetryInterval * 10 - * These values can be set by the sblim.wbem.listenerDeliveryRetryAttempts - * and sblim.wbem.listenerDeliveryRetryInterval properties below. - * - * Unexpected indications are queued in either a linked list or a hash - * table based on the sblim.wbem.listenerReliableIndicationHashtableCapacity - * property below. The linked list is better suited for a small number of - * listener destinations per WBEMListener while the hash table is better - * suited for a large number. - * - * Type: Boolean - * Recognition: On next creation of a WBEMListener - * Default: false - * - */ - public static final String LISTENER_ENABLE_RELIABLE_INDICATIONS = "sblim.wbem.listenerEnableReliableIndications"; - - /** - * - * The default value to use for the CIM_IndicationService DeliveryRetryAttempts - * property. See DSP1054 for details on reliable indications. - * - * Note: This property has no effect unless reliable indication support is - * enabled. See the sblim.wbem.listenerEnableReliableIndications property. - * - * Type: Long - * Unit: Count - * Recognition: On next creation of a WBEMListener - * Range: 1 .. 1000 - * Default: 3 - * - */ - public static final String LISTENER_DELIVERY_RETRY_ATTEMPTS = "sblim.wbem.listenerDeliveryRetryAttempts"; - - /** - * - * The default value to use for the CIM_IndicationService DeliveryRetryInterval - * property. See DSP1054 for details on reliable indications. - * - * Note: This property has no effect unless reliable indication support is - * enabled. See the sblim.wbem.listenerEnableReliableIndications property. - * - * Type: Long - * Unit: Seconds - * Recognition: On next creation of a WBEMListener - * Range: 1 .. 86400 - * Default: 20 - * - */ - public static final String LISTENER_DELIVERY_RETRY_INTERVAL = "sblim.wbem.listenerDeliveryRetryInterval"; - - /** - * - * The default value to use for the reliable indication handler's initial - * hash table capacity. A value of 0 indicates use a linked list instead. - * Linked lists are better suited for a small number of listener destinations - * per WBEMListener while hash tables are better suited for a large number. - * - * Note: This property has no effect unless reliable indication support is - * enabled. See the sblim.wbem.listenerEnableReliableIndications property. - * - * Type: Integer - * Unit: Count - * Recognition: On next creation of a WBEMListener - * Range: 0 .. 25000 - * Default: 0 - * - */ - public static final String LISTENER_RELIABLE_INDICATION_HASHTABLE_CAPACITY = "sblim.wbem.listenerReliableIndicationHashtableCapacity"; - - /** - * - * The filter to use for tracing of incoming indications at the FINE level. - * - * If string is empty, no tracing of incoming indications will occur. If - * string is not empty, it identifies one or more properties to be included - * in the trace of all incoming indications. An optional class can be used - * to filter the output to include only those indications that contain the - * substring. For example, to trace the SequenceContext and SequenceNumber - * properties of all alerts, use the following: - * - * alert:sequencecontext,sequencenumber - * - * To trace the IndicationTime of all indications, use the following: - * - * indicationtime - * - * Note: This property has no effect unless tracing is enabled. See the - * sblim.wbem.traceFileLevel property. - * - * Type: String - * Recognition: On next creation of WBEMListener - * Format: [class:]property[,property]* - * - */ - public static final String LISTENER_INDICATION_TRACE_FILTER = "sblim.wbem.listenerIndicationTraceFilter"; - - /** - * - * If set to true, a property will be added to all indications that identifies - * the sender's IP address. If set to false, the property will not be added. - * - * The property is a CIMProperty with: - * name = "SBLIMJCC_SenderIPAddress" - * data type = CIMDataType.STRING_T - * value = String returned by InetAddress.getHostAddress() (i.e. 1.2.3.4) - * - * Type: Boolean - * Recognition: On next creation of a WBEMListener - * Default: false - * - */ - public static final String LISTENER_ADD_SENDER_IP_ADDRESS = "sblim.wbem.listenerAddSenderIPAddress"; - - /** - * - * If set to true, numeric string values passed to the java.lang.Double - * constructor or its parseDouble method will be checked to make sure they - * are not in the range that hangs Java 6- (see Sun bug 4421494). If - * set to false, the string values will not be checked. - * - * Note: This property should only be set to true if running on Java 5 or - * Java 6 prior to update 24. - * - * Type: Boolean - * Recognition: Startup - * Default: true - * - */ - public static final String VERIFY_JAVA_LANG_DOUBLE_STRINGS = "sblim.wbem.verifyJavaLangDoubleStrings"; - - /** - * - * If set to true, numeric key data types in a CIMInstance's CIMObjectPath - * will be synchronized to match those of the corresponding keys within - * the CIMInstance's CIMProperty[]. If set to false, the numeric key data - * types will not be synchronized. - * - * Note: Only numeric key data types in CIMInstances from CIMOM responses - * are synchronized, application calls to the CIMInstance constructor are - * not affected. - * - * Type: Boolean - * Recognition: Startup - * Default: false - * - */ - public static final String SYNCHRONIZE_NUMERIC_KEY_DATA_TYPES = "sblim.wbem.synchronizeNumericKeyDataTypes"; - - /** - * - * If set to true, gzip encoding is enabled. If set to false, gzip encoding - * is not enabled. When enabled, outgoing requests include the HTTP header - * "Accept-Encoding: gzip" to indicate to the CIMOM that the client handles - * message bodies compressed with gzip. If the incoming response includes - * "Content-Encoding: gzip" the message body will be decompressed with gzip - * before being processed. - * - * Note: This property does not affect indications or outgoing requests. - * - * Type: Boolean - * Recognition: Anytime - * Default: false - * - */ - public static final String ENABLE_GZIP_ENCODING = "sblim.wbem.enableGzipEncoding"; - - /** - * - * If set to true, the CIM-XML parser will allow empty LOCALNAMESPACEPATH - * elements in incoming responses. If set to false, the parser will not - * allow empty LOCALNAMESPACEPATH elements. - * - * Note: Some older CIMOMs sent empty LOCALNAMESPACEPATHs, relying on the - * client to provide the local namespace path. This is a violation of - * DSP0201, which dictates that LOCALNAMESPACEPATH must contain at least - * one NAMESPACE child. By default, this property is set to false so the - * client can adhere to the CIM-XML specifications. Set this property to - * true if "LOCALNAMESPACEPATH requires NAMESPACE" exceptions occur while - * interacting with one of these older CIMOMs. - * - * Type: Boolean - * Recognition: Anytime - * Default: false - * - */ - public static final String CIMXML_PARSER_ALLOW_EMPTY_LOCALNAMESPACEPATH = "sblim.wbem.cimxmlParser.allowEmptyLocalNameSpacePath"; - - /** - * AMMO-863 - *

      - * New configuration property to force the use of a strict mode for the - * HTTP header Connection=Keep-alive (that may not be used for HTTP/1.1). - */ - public static final String HTTP_KEEP_ALIVE_STRICT_MODE = "sblim.wbem.httpKeepAliveStrictMode"; -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Alexander Wolf-Reber, a.wolf-reber@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-11-08 lupusalex Make SBLIM client JSR48 compliant + * 1688273 2007-04-19 lupusalex Full support of HTTP trailers + * 1815707 2007-10-30 ebak TLS support + * 1827728 2007-11-12 ebak embeddedInstances: attribute EmbeddedObject not set + * 1848607 2007-12-11 ebak Strict EmbeddedObject types + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2372030 2008-12-01 blaschke-oss Add property to control synchronized SSL handshaking + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors + * 2846231 2009-09-23 rgummada connection failure on CIMOM w/o user/pw + * 2930341 2010-01-12 blaschke-oss Sync up WBEMClientConstants with JSR48 1.0.0 + * 2957387 2010-03-03 blaschke-oss EmbededObject XML attribute must not be all uppercases + * 2970881 2010-03-15 blaschke-oss Add property to control EmbeddedObject case + * 3046073 2010-09-07 blaschke-oss Performance hit due to socket conn. creation with timeout + * 3111718 2010-11-18 blaschke-oss org.sblim.cimclient SSL Code is using the wrong SSL Property + * 3185763 2011-02-25 blaschke-oss Reliable indication support - Phase 1 + * 3195069 2011-02-28 blaschke-oss Need support to disable SSL Handshake + * 3197423 2011-03-02 blaschke-oss Server authentication with PegasusLocalAuthInfo failing + * 3277928 2011-04-06 blaschke-oss CIM-XML tracing cannot be enabled in the field + * 3206904 2011-05-03 blaschke-oss Indication listener deadlock causes JVM to run out sockets + * 3288721 2011-05-20 blaschke-oss Need the function of indication reordering + * 3459036 2011-12-13 blaschke-oss Linked list for RI queue not efficient for many LDs + * 3485074 2012-02-06 blaschke-oss An Indication trace request + * 3492246 2012-02-23 blaschke-oss Rename new indication trace property + * 3492214 2012-02-23 blaschke-oss Add a SenderIPAddress property indications + * 3492224 2012-02-23 blaschke-oss Need two different timeouts for Socket connections + * 3521157 2012-05-10 blaschke-oss JSR48 1.0.0: PROP_ENABLE_*_LOGGING is Level, not 0/1 + * 3524050 2012-06-06 blaschke-oss Improve WWW-Authenticate in HTTPClient.java + * 3536399 2012-08-25 hellerda Add client/listener peer authentication properties + * 3572993 2012-10-01 blaschke-oss parseDouble("2.2250738585072012e-308") DoS vulnerability + * 3598613 2013-01-11 blaschke-oss different data type in cim instance and cim object path + * 2618 2013-02-27 blaschke-oss Need to add property to disable weak cipher suites for the secure indication + * 2628 2013-03-26 blaschke-oss Limit size of LinkedList of CIMEvents to be dispatched + * 2635 2013-05-16 blaschke-oss Slowloris DoS attack for CIM indication listener port + * 2642 2013-05-21 blaschke-oss Seperate properties needed for cim client and listener to filter out ciphers + * 2647 2013-07-01 blaschke-oss Add two ssl protocol properties for http server and client + * 2654 2013-07-29 blaschke-oss Check jcc idle time with CIMOM keepalive timeout to avoid EOF + * 2151 2013-08-20 blaschke-oss gzip compression not supported + * 2711 2013-11-13 blaschke-oss LOCALNAMESPACEPATH allows 0 NAMESPACE children + */ +package org.metricshub.wbem.sblim.cimclient; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +/** + * The interface WBEMConfigurationProperties contains the names of all + * configuration properties that are recognized by the CIM Client. + * + */ +public interface WBEMConfigurationProperties { + + /** + * A URL string giving the location of the CIM client config file.
      + *
      + * By default the SBLIM CIM Client looks for + *

        + *
      • file:sblim-cim-client2.properties
      • + *
      • file:%USER_HOME%/sblim-cim-client2.properties
      • + *
      • file:/etc/java/sblim-cim-client2.properties
      • + *
      + * The first file found will be used. The default search list is not applied + * if this property is set, even if the given URL does not exist.
      + */ + public static final String CONFIG_URL = "sblim.wbem.configURL"; + + /** + * Sets the minimum level for messages to be written to the log file.
      + *
      + * Type: Discrete
      + * Recognition: Startup
      + * Range: OFF, SEVERE, WARNING, INFO, CONFIG, ALL
      + * Default: OFF, which disables file logging completely. + */ + public static final String LOG_FILE_LEVEL = "sblim.wbem.logFileLevel"; + + /** + * A string specifying the location of the log file. The string may include + * the following special components that will be replaced at runtime:
      + *
        + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
        /the local pathname separator
        %tthe system temporary directory
        %hthe value of the "user.home" system property
        %gthe generation number to distinguish rotated logs
        %ua unique number to resolve conflicts
        %%translates to a single percent sign "%"
        + *
      + * Thus for example a pattern of %t/java%g.log with a count of + * 2 would typically cause log files to be written on Unix to + * /var/tmp/java2.log
      + *
      + * Type: String
      + * Recognition: Startup
      + * Default: %t/cimclient_log_%g.txt. + */ + public static final String LOG_FILE_LOCATION = "sblim.wbem.logFileLocation"; + + /** + * Sets the maximum size in bytes of a single log file. When the limit is + * reached a new file is created. A limit of zero will create a new log file + * for every log record !
      + *
      + * Type: Integer
      + * Recognition: Startup
      + * Range: 0 .. Integer.MAX_VALUE
      + * Default: 100.000
      + */ + public static final String LOG_FILE_SIZE_LIMIT = "sblim.wbem.logFileSizeLimit"; + + /** + * Sets the number of log files to cycle through. When the number is + * exceeded the oldest file is dropped.
      + *
      + * Type: Integer
      + * Recognition: Startup
      + * Range: 1 .. Integer.MAX_VALUE
      + * Default: 5
      + */ + public static final String LOG_FILE_COUNT = "sblim.wbem.logFileCount"; + + /** + * Sets the minimum level for messages to be written to the console logger + * file.
      + *
      + * Type: Discrete
      + * Recognition: Startup
      + * Range: OFF, SEVERE, WARNING, INFO, CONFIG, ALL
      + * Default: OFF, which disables console logging completely. + */ + public static final String LOG_CONSOLE_LEVEL = "sblim.wbem.logConsoleLevel"; + + /** + * Sets the type of the console logger. Maybe either message log or trace + * log.
      + *
      + * Type: Discrete
      + * Recognition: Startup
      + * Range: MESSAGE, TRACE
      + * Default: MESSAGE. + */ + public static final String LOG_CONSOLE_TYPE = "sblim.wbem.logConsoleType"; + + /** + * Sets the minimum level for messages to be written to the trace file.
      + *
      + * Type: Discrete
      + * Recognition: Startup
      + * Range: + * OFF, SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST, ALL
      + * Default: OFF, which disables file tracing completely
      + */ + public static final String TRACE_FILE_LEVEL = "sblim.wbem.traceFileLevel"; + + /** + * A string specifying the location of the trace file. The string may + * include the following special components that will be replaced at + * runtime:
      + *
        + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
        /the local pathname separator
        %tthe system temporary directory
        %hthe value of the "user.home" system property
        %gthe generation number to distinguish rotated logs
        %ua unique number to resolve conflicts
        %%translates to a single percent sign "%"
        + *
      + * Thus for example a pattern of %t/java%g.log with a count of + * 2 would typically cause log files to be written on Unix to + * /var/tmp/java2.log
      + *
      + * Type: String
      + * Recognition: Startup
      + * Default: %t/cimclient_trace_%g.txt
      + */ + public static final String TRACE_FILE_LOCATION = "sblim.wbem.traceFileLocation"; + + /** + * Sets the maximum size in bytes of a single log file. When the limit is + * reached a new file is created. A limit of zero creates a new file for + * each trace record !
      + *
      + * Type: Integer
      + * Recognition: Startup
      + * Range: 0 .. Integer.MAX_VALUE
      + * Default: 1.000.000
      + */ + public static final String TRACE_FILE_SIZE_LIMIT = "sblim.wbem.traceFileSizeLimit"; + + /** + * Sets the number of log files to cycle through. When the number is + * exceeded the oldest file is dropped.
      + *
      + * Type: Integer
      + * Recognition: Startup
      + * Range: 1 .. Integer.MAX_VALUE
      + * Default: 5
      + */ + public static final String TRACE_FILE_COUNT = "sblim.wbem.traceFileCount"; + + /** + * The timeout for http requests. A timeout of zero is interpreted as + * infinite timeout.
      + *
      + * Type: Integer
      + * Unit: Milliseconds
      + * Recognition: Anytime
      + * Range: 0 .. Integer.MAX_VALUE
      + * Default: 0
      + */ + public static final String HTTP_TIMEOUT = "sblim.wbem.httpTimeout"; + + /** + * The size of the internal http connection pools. Each + * WBEMClient instance has it's own http connection pool. A + * positive value defines the number of connections, zero that no connection + * will be reused, and -1 all connections will be reused (when it's + * possible).
      + *
      + * Type: Integer
      + * Recognition: Anytime
      + * Range: -1, 0, 1 .. Integer.MAX_VALUE
      + * Default: 16
      + */ + public static final String HTTP_POOL_SIZE = "sblim.wbem.httpPoolSize"; + + /** + * The Java class name of the authentication module to use for http + * authentication.
      + *
      + * Type: String
      + * Recognition: On next authentication
      + * Range: + * + * org.sblim.cimclient.internal.http.WwwAuthInfo, org.sblim.cimclient.internal.http.PegasusLocalAuthInfo or any self-written subclass of org.sblim.cimclient.internal.http.AuthorizationInfo + *
      + * Default: org.sblim.cimclient.internal.http.WwwAuthInfo
      + */ + public static final String HTTP_AUTHENTICATION_MODULE = "sblim.wbem.httpAuthModule"; + + /** + * The WWW-Authenticate information to use when sending the first request to + * a server.
      + *
      + * Note: This string must exactly match what the server returns in the
      + * WWW-Authenticate field of an HTTP 401 response when authentication
      + * fails. The following two strings are examples:
      + *
      + * + * + * Basic realm="Secure Area" + * Digest realm="testrealm@host.com",qop="auth,auth-int",nonce="dcd98b7102dd2f0e8b11d0f600bfb0c093",opaque="5ccc069c403ebaf9f0171e9517f40e41" + * + * + * Type: String
      + * Recognition: On next authentication
      + * Range: Basic, Digest
      + * Default: none
      + */ + public static final String HTTP_WWW_AUTHENTICATE_INFO = "sblim.wbem.httpWwwAuthenticateInfo"; + + /** + * Specifies if MPOST is used for transmitting http messages. If false, POST + * is used.
      + *
      + * Type: Boolean
      + * Recognition: Anytime
      + * Range: true, false
      + * Default: true
      + */ + public static final String HTTP_USE_MPOST = "sblim.wbem.httpMPOST"; + + /** + * Specifies if chunking is used for transmitting http messages.
      + *
      + * Type: Boolean
      + * Recognition: Anytime
      + * Range: true, false
      + * Default: true
      + */ + public static final String HTTP_USE_CHUNKING = "sblim.wbem.httpChunking"; + + /** + * Specifies the http protocol version to use. This option is useful if the + * protocol negotiation fails.
      + *
      + * Type: String
      + * Recognition: Anytime
      + * Range: 1.0, 1.1
      + * Default: 1.1
      + */ + public static final String HTTP_VERSION = "sblim.wbem.httpVersion"; + + /** + * Specifies how often the client will retry to connect to a CIMOM which + * refused the connection in the first place.
      + *
      + * Type: Integer
      + * Recognition: Anytime
      + * Range: 0 .. Integer.MAX_VALUE
      + * Default: 0
      + */ + public static final String HTTP_CONNECTION_RETRIES = "sblim.wbem.httpConnectionRetries"; + + /** + * Specifies if the client will discard and request again http documents + * with less than a given number of bytes.
      + *
      + * Type: Boolean
      + * Recognition: Anytime
      + * Range: true, false
      + * Default: false
      + */ + public static final String HTTP_ENABLE_CONTENT_LENGTH_RETRY = "sblim.wbem.httpEnableContentLengthRetry"; + + /** + * Specifies the threshold above which a http document is regarded as valid + * by the content length retry algorithm.
      + *
      + * Type: Integer
      + * Recognition: Anytime
      + * Range: 0 .. Integer.MAX_VALUE
      + * Default: 50
      + */ + public static final String HTTP_CONTENT_LENGTH_THRESHOLD = "sblim.wbem.httpContentLengthThreshold"; + + /** + * The file path of the SSL keystore.
      + *
      + * Type: String
      + * Recognition: On next SSL connection
      + * Default: none
      + */ + public static final String KEYSTORE_PATH = "javax.net.ssl.keyStore"; + + /** + * The type of the keystore.
      + *
      + * Type: String
      + * Recognition: On next SSL connection
      + * Range: PKCS12, JKS, ...
      + * Default: JKS
      + */ + public static final String KEYSTORE_TYPE = "javax.net.ssl.keyStoreType"; + + /** + * The password of the keystore.
      + *
      + * Type: String
      + * Recognition: On next SSL connection
      + * Default: none
      + */ + public static final String KEYSTORE_PASSWORD = "javax.net.ssl.keyStorePassword"; + + /** + * The file path of the SSL truststore.
      + *
      + * Type: String
      + * Recognition: On next SSL connection
      + * Default: none
      + */ + public static final String TRUSTSTORE_PATH = "javax.net.ssl.trustStore"; + + /** + * The type of the truststore.
      + *
      + * Type: String
      + * Recognition: On next SSL connection
      + * Range: PKCS12, JKS, ...
      + * Default: JKS
      + */ + public static final String TRUSTSTORE_TYPE = "javax.net.ssl.trustStoreType"; + + /** + * The password of the truststore.
      + *
      + * Type: String
      + * Recognition: On next SSL connection
      + * Default: none
      + */ + public static final String TRUSTSTORE_PASSWORD = "javax.net.ssl.trustStorePassword"; + + /** + * The provider to use for creation of SSL client sockets.
      + *
      + * Security property: JRE global access via Security.setProperty() and Security.getProperty() ! + *
      + *
      + * Type: Java class name
      + * Recognition: On next SSL connection
      + * Default: Security.getProviders("SSLContext.SSL")
      + */ + public static final String SSL_SOCKET_PROVIDER = "sblim.wbem.sslSocketProvider"; + + /** + * The provider to use for creation of SSL server sockets.
      + *
      + * Security property: JRE global access via Security.setProperty() and Security.getProperty() ! + *
      + *
      + * Type: Java class name
      + * Recognition: On next SSL connection
      + * Default: Security.getProviders("SSLContext.SSL")
      + */ + public static final String SSL_SERVER_SOCKET_PROVIDER = "sblim.wbem.sslServerSocketProvider"; + + /** + * The protocol used for SSLContext.getInstance(String protocol). For + * IBMJSSE2 provider it can be "SSL_TLS".
      + *
      + * Security property: JRE global access via + * Security.setProperty() and + * Security.getProperty()
      + * Recognition: On next SSL connection
      + * Default: "SSL" + */ + public static final String SSL_PROTOCOL = "ssl.Protocol"; + + /** + * The protocol used for SSLContext.getInstance(String protocol) by a + * client. This property overrides any value set via the ssl.Protocol + * property.
      + *
      + * Recognition: On next SSL connection
      + * Default: none + */ + public static final String SSL_CLIENT_PROTOCOL = "sblim.wbem.sslClientProtocol"; + + /** + * The protocol used for SSLContext.getInstance(String protocol) by a + * listener. This property overrides any value set via the ssl.Protocol + * property.
      + *
      + * Recognition: On next SSL connection
      + * Default: none + */ + public static final String SSL_LISTENER_PROTOCOL = "sblim.wbem.sslListenerProtocol"; + + /** + * The key manager factory algorithm name.
      + *
      + * Security property: JRE global access via Security.setProperty() and Security.getProperty() ! + *
      + *
      + * Type: String
      + * Recognition: On next SSL connection
      + * Range: IbmX509, SunX509, ...
      + * Default: JRE specific
      + */ + public static final String SSL_KEYMANAGER_ALGORITHM = "ssl.KeyManagerFactory.algorithm"; + + /** + * The trust manager factory algorithm name.
      + *
      + * Security property: JRE global access via Security.setProperty() and Security.getProperty() ! + *
      + *
      + * Type: String
      + * Recognition: On next SSL connection
      + * Range: IbmX509, SunX509, ...
      + * Default: JRE specific
      + */ + public static final String SSL_TRUSTMANAGER_ALGORITHM = "ssl.TrustManagerFactory.algorithm"; + + /** + * Determines if a HTTPS client will attempt to authenticate the server + * (i.e. CIMOM) by verifying the server certificate.
      + *
      + * If false, do not attempt verification. If true, the client will attempt + * to verify the server certificate against the contents of the truststore; + * in this case a valid path must be defined in "javax.net.ssl.trustStore" + * or no connection will be permitted.
      + *
      + * Type: Boolean
      + * Recognition: On initialization of a new client
      + * Default: false
      + */ + public static final String SSL_CLIENT_PEER_VERIFICATION = "sblim.wbem.sslClientPeerVerification"; + + /** + * Determines how a HTTPS listener will handle authentication of a client + * (i.e. indication sender):
      + *
        + * + * + * + * + * + * + * + * + * + * + * + * + * + *
        ignoredo not examine the client certificate
        acceptexamine client certificate if presented; do not fail if not presented + *
        requireexamine client certificate; fail if not presented
        + *
      + * If set to "ignore", do not attempt verification. If set to "accept" or + * "require", the listener will attempt to verify the sender against the + * contents of the truststore; in this case a valid path must be defined in + * "javax.net.ssl.trustStore" or no connection will be permitted.
      + *
      + * Type: String
      + * Recognition: On next call to addListener()
      + * Default: ignore
      + */ + public static final String SSL_LISTENER_PEER_VERIFICATION = "sblim.wbem.sslListenerPeerVerification"; + + /** + * The comma-separated list of cipher suites that are to be disabled by the + * client when connecting via an SSL socket. In general, this is the list of + * cipher suites considered "too weak" for use in a particular environment.
      + *
      + * Type: String
      + * Recognition: On initialization of a new client
      + * Default: none
      + */ + public static final String SSL_CLIENT_CIPHER_SUITES_TO_DISABLE = "sblim.wbem.sslClientCipherSuitesToDisable"; + + /** + * The comma-separated list of cipher suites that are to be disabled by the + * listener when connecting via an SSL socket. In general, this is the list + * of cipher suites considered "too weak" for use in a particular + * environment.
      + *
      + * Type: String
      + * Recognition: On next call to addListener()
      + * Default: none
      + */ + public static final String SSL_LISTENER_CIPHER_SUITES_TO_DISABLE = "sblim.wbem.sslListenerCipherSuitesToDisable"; + + /** + * Specifies the XML parser for parsing CIM-XML responses.
      + * The SAX parser is the default choice since it is fast, resource saving + * and interoperable. The streaming algorithm of the PULL parser uses the + * fewest possible resources but at the prize to keep the CIMOMs response + * open for a long time. That works with many but not all CIMOMs. The DOM + * parser is slow and resource hungry but nice to debug.
      + *
      + * Type: Discrete
      + * Recognition: Anytime
      + * Range: DOM, PULL, SAX
      + * Default: SAX
      + */ + public static final String CIMXML_PARSER = "sblim.wbem.cimxmlParser"; + + /** + * Enables or disables tracing of CIM-XML communication. The trace is sent + * to an output stream the application has to set via the LogAndTraceManager + * class.
      + *
      + * Type: Boolean
      + * Recognition: Anytime
      + * Range: true, false
      + * Default: false
      + */ + public static final String CIMXML_TRACING = "sblim.wbem.cimxmlTracing"; + + /** + * Specifies the stream to use for tracing CIM-XML communication in the + * event the application does not set one via the LogAndTraceManager class. + * This stream can either be standard output (System.out), standard error + * output (System.err) or a filename to be opened by the client. + * + * Note: This property has no effect unless sblim.wbem.cimxmlTracing is set + * to true. + * + * Note: This property has no effect if the application already set the + * stream prior to client initialization. If the application sets the stream + * after client initialization, the stream specified by this property is + * overridden. + * + * Note: If a filename is specified, it is opened and all CIM-XML + * communication is written to it - no checks are made for an existing file + * or for filling up the disk. USE WITH CAUTION. + * + * Type: String
      + * Recognition: Startup
      + * Range: System.out, System.err, filename
      + * Default: none
      + */ + public static final String CIMXML_TRACE_STREAM = "sblim.wbem.cimxmlTraceStream"; + + /** + * + * Tells the XML builder how to sign embedded objects. This is necessary due to + * the non-consequent handling of embedded objects on different CIMOMs. + * "AttribOnly" - only the EmbeddedObject="instance/object" is used + * (should be good for Pegasus) + * "EmbObjQuali" - on qualified CIM-XML elements the EmbeddedObject qualifier is used + * for embedded classes and instances + * "EmbObjAndEmbInstQuali" - + * on qualified CIM-XML elements the EmbeddedObject qualifier is used + * for embedded classes and the EmbeddedInstance="className" qualifier + * is used for embedded instances + * Type: String + * Recognition: Anytime + * Range: AttribOnly, EmbObjQuali, EmbObjAndEmbInstQuali + * Default: AttribOnly + * + */ + public static final String CIMXML_EMBOBJBUILDER = "sblim.wbem.cimxmlEmbObjBuilder"; + + /** + * + * If set the type of valueless EmbeddedObjects are mapped to CLASS_T. It should work well + * with OpenPegasus-2.7.0. + * If unset no type mapping is done for valuless EmbeddedObjects. + * + * Type: Boolean + * Default: true + * + */ + public static final String CIMXML_PARSER_STRICT_EMBOBJ_TYPES = "sblim.wbem.cimxmlParser.strictEmbObjTypes"; + + /** + * + * If set to false, the embedded object entity in all requests is in mixed case + * (EmbeddedObject) per DSP0203. If set to true, the embedded object entity is in + * upper case (EMBEDDEDOBJECT) - this works with some older CIMOMs, such as OpenPegasus + * 2.6.1 and 2.7.0. + * + * <!ENTITY % EmbeddedObject "EmbeddedObject (object|instance) #IMPLIED"> + * + * Type: Boolean + * Recognition: Startup + * Range: true, false + * Default: true + * + */ + public static final String CIMXML_BUILDER_UPPERCASE_EMBOBJ_ENTITIES = "sblim.wbem.cimxmlBuilder.upperCaseEmbObjEntities"; + + /** + * + * If set to true, SSL handshakes are performed after an SSL socket is created by the + * socket factory. If set to false, handshakes are not performed, which is useful if + * if the handshake has already taken place. + * + * Type: Boolean + * Recognition: Anytime + * Default: true + * + */ + public static final String PERFORM_SSL_HANDSHAKE = "sblim.wbem.performSslHandshake"; + + /** + * + * If set to false, SSL handshakes are not synchronized. If set to true, SSL handshakes + * are synchronized as a workaround for an IBMJSSE1 problem with thread-safe handshakes. + * + * Note: This property has no affect unless sblim.wbem.performSslHandshake is set to + * true. + * + * Type: Boolean + * Recognition: Anytime + * Default: false + * + */ + public static final String SYNCHRONIZED_SSL_HANDSHAKE = "sblim.wbem.synchronizedSslHandshake"; + + /** + * + * If set to true, socket connections are attempted with the timeout value defined by + * sblim.wbem.socketConnectTimeout. If set to false, socket connections are attempted + * without a timeout. Using a timeout for socket connections is the preferred method + * but may introduce intermittent, significant performance impacts during the connection + * process in Java 5+ (see Sun bug 5092063). + * + * Type: Boolean + * Recognition: Anytime + * Default: true + * + */ + public static final String SOCKET_CONNECT_WITH_TIMEOUT = "sblim.wbem.socketConnectWithTimeout"; + + /** + * + * The timeout for socket connect requests. A timeout of zero is interpreted + * as infinite timeout. + * + * Note: This property has no effect unless socket connection with timeout is + * enabled (see the sblim.wbem.socketConnectWithTimeout property). + * + * Type: Integer + * Unit: Milliseconds + * Recognition: Anytime + * Range: 0 .. Integer.MAX_VALUE + * Default: 0 + * + */ + public static final String SOCKET_CONNECT_TIMEOUT = "sblim.wbem.socketConnectTimeout"; + + /** + * The idle timeout between socket requests after which the socket is + * automatically reset (closed, then reopened). A timeout of zero is + * interpreted as infinite timeout.
      + * Type: Integer
      + * Unit: Milliseconds
      + * Recognition: Anytime
      + * Range: 0 .. Integer.MAX_VALUE
      + * Default: 0
      + */ + public static final String SOCKET_IDLE_TIMEOUT = "sblim.wbem.socketIdleTimeout"; + + /** + * + * Turn on/off usage of the default user/password, which can be used + * if the CIMOM requires a "garbage" credential. If set to false, + * user-supplied credentials will be applied. If set to true, + * default credentials will be applied when both the user-supplied + * principal and credential are null/empty. + * + * Type: Boolean + * Recognition: Startup + * Default: false + * + */ + public static final String KEY_CREDENTIALS_DEFAULT_ENABLED = "sblim.wbem.default.authorization.enabled"; + + /** + * + * The name of the user for the "garbage" credential. + * + * Note: This property has no effect unless default authorization is + * enabled (see the sblim.wbem.default.authorization.enabled property) + * AND both the user-supplied principal and credential are null/empty. + * + * Type: String + * Recognition: Startup + * Default: "default" + * + */ + public static final String KEY_DEFAULT_PRINCIPAL = "sblim.wbem.default.principal"; + + /** + * + * The credential of the user for the "garbage" credential. + * + * Note: This property has no effect unless default authorization is + * enabled (see the sblim.wbem.default.authorization.enabled property) + * AND both the user-supplied principal and credential are null/empty. + * + * Type: String + * Recognition: Startup + * Default: "default" + * + */ + public static final String KEY_DEFAULT_CREDENTIAL = "sblim.wbem.default.credential"; + + /** + * The timeout for http connections of an indication listener. A timeout of + * zero is interpreted as infinite timeout.
      + *
      + * Type: Integer
      + * Unit: Milliseconds
      + * Recognition: On next creation of a WBEMListener
      + * Range: 0 .. Integer.MAX_VALUE
      + * Default: 10000
      + */ + public static final String LISTENER_HTTP_TIMEOUT = "sblim.wbem.listenerHttpTimeout"; + + /** + * The header timeout for http connections of an indication listener. The + * header timeout is defined as the maximum amount of time allowed to read + * in the entire http header. A timeout of zero is interpreted as infinite + * timeout.
      + *
      + * Note: One form of DoS attack sends periodic http header lines in an + * attempt to keep the socket open indefinitely. This timeout can be used to + * thwart such an attempt.
      + *
      + * Type: Integer
      + * Unit: Milliseconds
      + * Recognition: On next creation of a WBEMListener
      + * Range: 0 .. Integer.MAX_VALUE
      + * Default: 30000
      + */ + public static final String LISTENER_HTTP_HEADER_TIMEOUT = "sblim.wbem.listenerHttpHeaderTimeout"; + + /** + * The maximum allowable timeouts an http connection of an indication + * listener can have before the client ignores it. In other words, the + * number of times an IP exceeds sblim.wbem.listenerHttpTimeout and + * sblim.wbem.listenerHttpHeaderTimeout before it is blocked. A value of + * zero is interpreted as unlimited timeouts.
      + *
      + * Type: Integer
      + * Recognition: On next creation of a WBEMListener
      + * Range: 0 .. Integer.MAX_VALUE
      + * Default: 0
      + */ + public static final String LISTENER_HTTP_MAX_ALLOWED_TIMEOUTS = "sblim.wbem.listenerHttpMaxAllowedTimeouts"; + + /** + * The size of the thread pool for the connection handlers of the indication + * for http connections of an indication listener. This is the maximum + * number of handler threads the pool might create on heavy load.
      + * A value of -1 is interpreted as infinity.
      + * Type: Integer
      + * Unit: Count
      + * Recognition: On next creation of a WBEMListener
      + * Range: -1 .. Integer.MAX_VALUE
      + * Default: 8
      + */ + public static final String LISTENER_MAX_POOL_SIZE = "sblim.wbem.listenerPoolMaxSize"; + + /** + * The minimal number of connection handlers of the indication listener that + * will be kept open by the thread pool regardless of the current load.
      + * Type: Integer
      + * Unit: Count
      + * Recognition: On next creation of a WBEMListener
      + * Range: 0 .. Integer.MAX_VALUE
      + * Default: 2
      + */ + public static final String LISTENER_MIN_POOL_SIZE = "sblim.wbem.listenerPoolMinSize"; + + /** + * The maximum number of queued connections (the fixed capacity of the + * ArrayBlockingQueue of pending connections incoming to the listener). + * Whereas increasing this number will result in a correspondingly greater + * memory usage, making the number too small can result in HTTP 503 + * "Service temporarily overloaded" returned to server if there is no room + * in queue for an incoming connection.
      + * Type: Integer
      + * Unit: Count
      + * Recognition: On next creation of a WBEMListener
      + * Range: 1 .. Integer.MAX_VALUE
      + * Default: 32
      + */ + public static final String LISTENER_MAX_QUEUE_SIZE = "sblim.wbem.listenerQueueMaxSize"; + + /** + * The number of queued connections that is tolerated before the thread pool + * creates an additional handler thread. Increasing this value leads to a + * less "nervous" creation/destruction of handlers. However it + * makes the listener more vulnerable to frozen connections.
      + *
      + * Type: Integer
      + * Unit: Count
      + * Recognition: On next creation of a WBEMListener
      + * Range: 0 .. Integer.MAX_VALUE
      + * Default: 2
      + */ + public static final String LISTENER_BACKLOG = "sblim.wbem.listenerBacklog"; + + /** + * The idle time of a worker that is tolerated before the worker is + * destroyed by the thread pool. By setting the minimal pool size >0 you can + * protect a given number of worker from destruction.
      + *
      + * Type: Long
      + * Unit: Milliseconds
      + * Recognition: On next creation of a WBEMListener
      + * Range: 0 .. Long.MAX_VALUE
      + * Default: 30000
      + */ + public static final String LISTENER_HANDLER_MAX_IDLE = "sblim.wbem.listenerHandlerMaxIdle"; + + /** + * The maximum number of queued events (the fixed capacity of the LinkedList + * of indications awaiting delivery to the listener). When the maximum is + * reached, the oldest indications are discarded to make room for the newest + * ones. A value of 0 is interpreted as infinity.
      + * Type: Integer
      + * Unit: Count
      + * Recognition: On next creation of a WBEMListener
      + * Range: 0 .. Integer.MAX_VALUE
      + * Default: 0
      + */ + public static final String LISTENER_MAX_QUEUED_EVENTS = "sblim.wbem.listenerMaxQueuedEvents"; + + /** + * + * If set to true, reliable indication support is enabled and indications + * are processed accordingly. If set to false, reliable indication + * support is disabled and indications are passed directly to listener. + * + * If reliable indication support is enabled, incoming indications are + * handled as documented in DSP1054 which includes queuing unexpected + * indications, caching all indications for the duration of their sequence + * identifier lifetime, and logging missing, duplicate and out-of-order + * indications. + * + * The sequence identifier lifetime is defined as: + * DeliveryRetryAttempts * DeliveryRetryInterval * 10 + * These values can be set by the sblim.wbem.listenerDeliveryRetryAttempts + * and sblim.wbem.listenerDeliveryRetryInterval properties below. + * + * Unexpected indications are queued in either a linked list or a hash + * table based on the sblim.wbem.listenerReliableIndicationHashtableCapacity + * property below. The linked list is better suited for a small number of + * listener destinations per WBEMListener while the hash table is better + * suited for a large number. + * + * Type: Boolean + * Recognition: On next creation of a WBEMListener + * Default: false + * + */ + public static final String LISTENER_ENABLE_RELIABLE_INDICATIONS = "sblim.wbem.listenerEnableReliableIndications"; + + /** + * + * The default value to use for the CIM_IndicationService DeliveryRetryAttempts + * property. See DSP1054 for details on reliable indications. + * + * Note: This property has no effect unless reliable indication support is + * enabled. See the sblim.wbem.listenerEnableReliableIndications property. + * + * Type: Long + * Unit: Count + * Recognition: On next creation of a WBEMListener + * Range: 1 .. 1000 + * Default: 3 + * + */ + public static final String LISTENER_DELIVERY_RETRY_ATTEMPTS = "sblim.wbem.listenerDeliveryRetryAttempts"; + + /** + * + * The default value to use for the CIM_IndicationService DeliveryRetryInterval + * property. See DSP1054 for details on reliable indications. + * + * Note: This property has no effect unless reliable indication support is + * enabled. See the sblim.wbem.listenerEnableReliableIndications property. + * + * Type: Long + * Unit: Seconds + * Recognition: On next creation of a WBEMListener + * Range: 1 .. 86400 + * Default: 20 + * + */ + public static final String LISTENER_DELIVERY_RETRY_INTERVAL = "sblim.wbem.listenerDeliveryRetryInterval"; + + /** + * + * The default value to use for the reliable indication handler's initial + * hash table capacity. A value of 0 indicates use a linked list instead. + * Linked lists are better suited for a small number of listener destinations + * per WBEMListener while hash tables are better suited for a large number. + * + * Note: This property has no effect unless reliable indication support is + * enabled. See the sblim.wbem.listenerEnableReliableIndications property. + * + * Type: Integer + * Unit: Count + * Recognition: On next creation of a WBEMListener + * Range: 0 .. 25000 + * Default: 0 + * + */ + public static final String LISTENER_RELIABLE_INDICATION_HASHTABLE_CAPACITY = "sblim.wbem.listenerReliableIndicationHashtableCapacity"; + + /** + * + * The filter to use for tracing of incoming indications at the FINE level. + * + * If string is empty, no tracing of incoming indications will occur. If + * string is not empty, it identifies one or more properties to be included + * in the trace of all incoming indications. An optional class can be used + * to filter the output to include only those indications that contain the + * substring. For example, to trace the SequenceContext and SequenceNumber + * properties of all alerts, use the following: + * + * alert:sequencecontext,sequencenumber + * + * To trace the IndicationTime of all indications, use the following: + * + * indicationtime + * + * Note: This property has no effect unless tracing is enabled. See the + * sblim.wbem.traceFileLevel property. + * + * Type: String + * Recognition: On next creation of WBEMListener + * Format: [class:]property[,property]* + * + */ + public static final String LISTENER_INDICATION_TRACE_FILTER = "sblim.wbem.listenerIndicationTraceFilter"; + + /** + * + * If set to true, a property will be added to all indications that identifies + * the sender's IP address. If set to false, the property will not be added. + * + * The property is a CIMProperty with: + * name = "SBLIMJCC_SenderIPAddress" + * data type = CIMDataType.STRING_T + * value = String returned by InetAddress.getHostAddress() (i.e. 1.2.3.4) + * + * Type: Boolean + * Recognition: On next creation of a WBEMListener + * Default: false + * + */ + public static final String LISTENER_ADD_SENDER_IP_ADDRESS = "sblim.wbem.listenerAddSenderIPAddress"; + + /** + * + * If set to true, numeric string values passed to the java.lang.Double + * constructor or its parseDouble method will be checked to make sure they + * are not in the range that hangs Java 6- (see Sun bug 4421494). If + * set to false, the string values will not be checked. + * + * Note: This property should only be set to true if running on Java 5 or + * Java 6 prior to update 24. + * + * Type: Boolean + * Recognition: Startup + * Default: true + * + */ + public static final String VERIFY_JAVA_LANG_DOUBLE_STRINGS = "sblim.wbem.verifyJavaLangDoubleStrings"; + + /** + * + * If set to true, numeric key data types in a CIMInstance's CIMObjectPath + * will be synchronized to match those of the corresponding keys within + * the CIMInstance's CIMProperty[]. If set to false, the numeric key data + * types will not be synchronized. + * + * Note: Only numeric key data types in CIMInstances from CIMOM responses + * are synchronized, application calls to the CIMInstance constructor are + * not affected. + * + * Type: Boolean + * Recognition: Startup + * Default: false + * + */ + public static final String SYNCHRONIZE_NUMERIC_KEY_DATA_TYPES = "sblim.wbem.synchronizeNumericKeyDataTypes"; + + /** + * + * If set to true, gzip encoding is enabled. If set to false, gzip encoding + * is not enabled. When enabled, outgoing requests include the HTTP header + * "Accept-Encoding: gzip" to indicate to the CIMOM that the client handles + * message bodies compressed with gzip. If the incoming response includes + * "Content-Encoding: gzip" the message body will be decompressed with gzip + * before being processed. + * + * Note: This property does not affect indications or outgoing requests. + * + * Type: Boolean + * Recognition: Anytime + * Default: false + * + */ + public static final String ENABLE_GZIP_ENCODING = "sblim.wbem.enableGzipEncoding"; + + /** + * + * If set to true, the CIM-XML parser will allow empty LOCALNAMESPACEPATH + * elements in incoming responses. If set to false, the parser will not + * allow empty LOCALNAMESPACEPATH elements. + * + * Note: Some older CIMOMs sent empty LOCALNAMESPACEPATHs, relying on the + * client to provide the local namespace path. This is a violation of + * DSP0201, which dictates that LOCALNAMESPACEPATH must contain at least + * one NAMESPACE child. By default, this property is set to false so the + * client can adhere to the CIM-XML specifications. Set this property to + * true if "LOCALNAMESPACEPATH requires NAMESPACE" exceptions occur while + * interacting with one of these older CIMOMs. + * + * Type: Boolean + * Recognition: Anytime + * Default: false + * + */ + public static final String CIMXML_PARSER_ALLOW_EMPTY_LOCALNAMESPACEPATH = "sblim.wbem.cimxmlParser.allowEmptyLocalNameSpacePath"; + + /** + * AMMO-863 + *

      + * New configuration property to force the use of a strict mode for the + * HTTP header Connection=Keep-alive (that may not be used for HTTP/1.1). + */ + public static final String HTTP_KEEP_ALIVE_STRICT_MODE = "sblim.wbem.httpKeepAliveStrictMode"; +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/WBEMListenerSBLIM.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/WBEMListenerSBLIM.java similarity index 88% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/WBEMListenerSBLIM.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/WBEMListenerSBLIM.java index b1be5ee..66ae31a 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/WBEMListenerSBLIM.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/WBEMListenerSBLIM.java @@ -1,465 +1,462 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, IBM, ebak@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1565892 2007-01-08 ebak Make SBLIM client JSR48 compliant - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors - * 3023348 2010-07-02 blaschke-oss Listener uses # constructor instead of valueOf - * 3400209 2011-08-31 blaschke-oss Highlighted Static Analysis (PMD) issues - * 3469018 2012-01-03 blaschke-oss Properties not passed to CIMIndicationHandler - * 3477087 2012-01-23 blaschke-oss Need Access to an Indication Sender's IP Address - * 3496385 2012-03-02 blaschke-oss JSR48 1.0.0: add WBEMListener get/setProperty - * 3513228 2012-04-23 blaschke-oss Reliable Indications support can create lots of threads - * 3529062 2012-05-23 blaschke-oss WBEMListenerFactory should return new instance - * 3529065 2012-05-31 hellerda Enable WBEMListener get/setProperty - * 2628 2013-03-26 blaschke-oss Limit size of LinkedList of CIMEvents to be dispatched - * 2635 2013-05-16 blaschke-oss Slowloris DoS attack for CIM indication listener port - * 2657 2013-08-20 blaschke-oss Potential null pointer exception in handleConnection - */ - -package org.sentrysoftware.wbem.sblim.cimclient; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.IOException; -import java.net.BindException; -import java.util.Enumeration; -import java.util.EventListener; -import java.util.HashMap; -import java.util.Map; -import java.util.Properties; - -import org.sentrysoftware.wbem.javax.wbem.listener.IndicationListener; -import org.sentrysoftware.wbem.javax.wbem.listener.WBEMListener; -import org.sentrysoftware.wbem.javax.wbem.listener.WBEMListenerConstants; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.http.HttpConnectionHandler; -import org.sentrysoftware.wbem.sblim.cimclient.internal.http.HttpServerConnection; -import org.sentrysoftware.wbem.sblim.cimclient.internal.util.WBEMConfiguration; -import org.sentrysoftware.wbem.sblim.cimclient.internal.util.WBEMConstants; -import org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.indications.CIMEventDispatcher; -import org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.indications.CIMIndicationHandler; - -/** - * Class WBEMListenerSBLIM is the SBLIM implementation of the WBEMListener - * interface. - * - */ -public class WBEMListenerSBLIM implements WBEMListener { - - /** - * The real implementation of a listener that starts a HTTP server and - * processes incoming indications - * - */ - public class WBEMListenerImpl { - - private EventListener iIndicationListener; - - private HttpServerConnection iConnection; - - private CIMIndicationHandler iIndicationHandler; - - private HttpConnectionHandler iConnectionHandler; - - /** - * Ctor. - * - * @param pLocalAddress - * The local address to bind the port to. If null the port is - * bound to all local addresses. For use on multi-homed - * systems. - * @param pPort - * The port to listen on. If zero any free port will be - * chosen. - * @param pSSL - * SSL secured connection? - * @param pIndicationListener - * The indication listener to forward the incoming - * indications to (an instance of IndicationListener or - * IndicationListenerSBLIM). - * @param pProperties - * The configuration. - * @throws IOException - */ - public WBEMListenerImpl(String pLocalAddress, int pPort, boolean pSSL, - EventListener pIndicationListener, Properties pProperties) throws IOException { - - // Merge any properties passed via addListener - if (pProperties != null) { - for (Enumeration e = pProperties.keys(); e.hasMoreElements();) { - String key = (String) e.nextElement(); - String value = pProperties.getProperty(key); - setProperty(key, value); - } - } - WBEMConfiguration config = WBEMListenerSBLIM.this.iConfiguration; - if (!(pIndicationListener instanceof IndicationListener) - && !(pIndicationListener instanceof IndicationListenerSBLIM)) throw new IllegalArgumentException( - "Listener must be instance of IndicationListener or IndicationListenerSBLIM"); - this.iIndicationListener = pIndicationListener; - CIMEventDispatcher eventDispatcher = new CIMEventDispatcher(this.iIndicationListener, - config.getListenerMaxQueuedEvents()); - this.iIndicationHandler = new CIMIndicationHandler(eventDispatcher, config); - this.iConnectionHandler = new HttpConnectionHandler(this.iIndicationHandler, config); - this.iConnection = new HttpServerConnection(this.iConnectionHandler, pLocalAddress, - pPort, pSSL, config); - } - - @Override - protected void finalize() throws Throwable { - try { - stop(); - } finally { - super.finalize(); - } - } - - /** - * Starts the HTTP server connection receiving the indications. - */ - public void start() { - this.iConnection.start(); - } - - /** - * Stops the HTTP server connection receiving the indications and the - * indication handler. - */ - public void stop() { - this.iConnection.close(); - this.iIndicationHandler.close(); - } - - /** - * Returns the listener we forward the indications to. - * - * @return The listener. - */ - public IndicationListener getIndicationListener() { - return (this.iIndicationListener instanceof IndicationListener) ? (IndicationListener) this.iIndicationListener - : null; - } - - /** - * Returns the listener we forward the indications to. - * - * @return The listener. - */ - public IndicationListenerSBLIM getIndicationListenerSBLIM() { - return (this.iIndicationListener instanceof IndicationListenerSBLIM) ? (IndicationListenerSBLIM) this.iIndicationListener - : null; - } - - /** - * Returns the listener port. - * - * @return The listener port. - */ - public int getListenerPort() { - return this.iConnection.getPort(); - } - - /** - * Get the IPs blocked by the listener. - * - * @return The comma-separated list of blocked IPs. - */ - public String getBlockedIPs() { - return this.iConnectionHandler.getBlockedIPs(); - } - - /** - * Set the IPs to be blocked by the listener. - * - * @param pIPs - * The comma-separated list of blocked IPs. - */ - public void setBlockedIPs(String pIPs) { - this.iConnectionHandler.setBlockedIPs(pIPs); - } - } - - protected final WBEMConfiguration iConfiguration = new WBEMConfiguration(new Properties()); - - private Map iPortMap = new HashMap(); - - /** - * Ctor. - */ - public WBEMListenerSBLIM() { - super(); - } - - /* - * (non-Javadoc) - * - * @see org.sentrysoftware.wbem.javax.wbem.listener.WBEMListener#addListener(javax.wbem.listener. - * IndicationListener, int, java.lang.String) - */ - public int addListener(IndicationListener pListener, int pPort, String pTransport) - throws IOException { - return addListener((EventListener) pListener, pPort, pTransport, null, null); - } - - /* - * (non-Javadoc) - * - * @see org.sentrysoftware.wbem.javax.wbem.listener.WBEMListener#addListener(javax.wbem.listener. - * IndicationListener, int, java.lang.String, java.lang.String) - */ - public int addListener(IndicationListener pListener, int pPort, String pTransport, - String pLocalAddr) throws IOException { - return addListener((EventListener) pListener, pPort, pTransport, pLocalAddr, null); - } - - /** - * Add a new listener using the specified port. - * - * @param pListener - * The Indication Listener that will be called when an indication - * is received. - * @param pPort - * The port to listen on. Use 0 to specify any available port. - * @param pTransport - * The transport to use (e.g. HTTP or HTTPS). - * @param pLocalAddr - * The local IP address to bind to. This is only needed in - * multi-homed systems. A value of null will bind to - * all IP addresses. - * @param pConfigurationProperties - * The individual configuration properties for this listener. - * @return The port that was used. - * @throws IOException - * This exception is thrown when binding to pPort fails. - */ - public int addListener(IndicationListener pListener, int pPort, String pTransport, - String pLocalAddr, Properties pConfigurationProperties) throws IOException { - - return addListener((EventListener) pListener, pPort, pTransport, pLocalAddr, - pConfigurationProperties); - } - - /** - * Add a new listener using the specified port. - * - * @param pListener - * The SBLIM Indication Listener that will be called when an - * indication is received. - * @param pPort - * The port to listen on. Use 0 to specify any available port. - * @param pTransport - * The transport to use (e.g. HTTP or HTTPS). - * @return The port that was used. - * @throws IOException - * This exception is thrown when binding to pPort fails. - */ - public int addListener(IndicationListenerSBLIM pListener, int pPort, String pTransport) - throws IOException { - return addListener((EventListener) pListener, pPort, pTransport, null, null); - } - - /** - * Add a new listener using the specified port and local address. - * - * @param pListener - * The SBLIM Indication Listener that will be called when an - * indication is received. - * @param pPort - * The port to listen on. Use 0 to specify any available port. - * @param pTransport - * The transport to use (e.g. HTTP or HTTPS). - * @param pLocalAddr - * The local IP address to bind to. This is only needed in - * multi-homed systems. A value of null will bind to - * all IP addresses. - * @return The port that was used. - * @throws IOException - * This exception is thrown when binding to pPort fails. - */ - public int addListener(IndicationListenerSBLIM pListener, int pPort, String pTransport, - String pLocalAddr) throws IOException { - return addListener((EventListener) pListener, pPort, pTransport, pLocalAddr, null); - } - - /** - * Add a new listener using the specified port, local address and - * properties. - * - * @param pListener - * The SBLIM Indication Listener that will be called when an - * indication is received. - * @param pPort - * The port to listen on. Use 0 to specify any available port. - * @param pTransport - * The transport to use (e.g. HTTP or HTTPS). - * @param pLocalAddr - * The local IP address to bind to. This is only needed in - * multi-homed systems. A value of null will bind to - * all IP addresses. - * @param pConfigurationProperties - * The individual configuration properties for this listener. - * @return The port that was used. - * @throws IOException - * This exception is thrown when binding to pPort fails. - */ - public int addListener(IndicationListenerSBLIM pListener, int pPort, String pTransport, - String pLocalAddr, Properties pConfigurationProperties) throws IOException { - - return addListener((EventListener) pListener, pPort, pTransport, pLocalAddr, - pConfigurationProperties); - } - - /** - * Add a new listener using the specified port, local address and - * properties. This is the worker routine for all public addListener - * methods. - * - * @param pListener - * The indication listener (IndicationListener or - * IndicationListenerSBLIM) that will be called when - * an indication is received. - * @param pPort - * The port to listen on. Use 0 to specify any available port. - * @param pTransport - * The transport to use (e.g. HTTP or HTTPS). - * @param pLocalAddr - * The local IP address to bind to. This is only needed in - * multi-homed systems. A value of null will bind to - * all IP addresses. - * @param pConfigurationProperties - * The individual configuration properties for this listener. - * @return The port that was used. - * @throws IOException - * This exception is thrown when binding to pPort fails. - */ - private synchronized int addListener(EventListener pListener, int pPort, String pTransport, - String pLocalAddr, Properties pConfigurationProperties) throws IOException { - - if (pPort > 0 && this.iPortMap.containsKey(Integer.valueOf(pPort))) { throw new BindException( - "Port already in use."); } - boolean ssl; - if (pTransport.equalsIgnoreCase(WBEMConstants.HTTP)) ssl = false; - else if (pTransport.equalsIgnoreCase(WBEMConstants.HTTPS)) ssl = true; - else throw new IllegalArgumentException("Unknown transport: " + pTransport - + "! Valid values are http and https."); - - WBEMListenerImpl listener = new WBEMListenerImpl(pLocalAddr, pPort, ssl, pListener, - pConfigurationProperties); - listener.start(); - - this.iPortMap.put(Integer.valueOf(listener.getListenerPort()), listener); - - return listener.getListenerPort(); - } - - /** - * Get the IPs blocked by the listener associated with the specified port. - * - * @param pPort - * The port. - * @return The comma-separated list of blocked IPs. - */ - public String getBlockedIPs(int pPort) { - if (pPort <= 0 || !this.iPortMap.containsKey(Integer.valueOf(pPort))) { throw new IllegalArgumentException( - "Port not in use."); } - WBEMListenerImpl listener = this.iPortMap.get(Integer.valueOf(pPort)); - return listener != null ? listener.getBlockedIPs() : null; - } - - public String getProperty(String pName) { - if (pName.startsWith("javax.wbem.")) { - // Process JSR48 properties - if (pName.equals(WBEMListenerConstants.PROP_LISTENER_KEYSTORE)) { - return this.iConfiguration.getSslKeyStorePath(); - } else if (pName.equals(WBEMListenerConstants.PROP_LISTENER_KEYSTORE_PASSWORD)) { - return this.iConfiguration.getSslKeyStorePassword(); - } else if (pName.equals(WBEMListenerConstants.PROP_LISTENER_TRUSTSTORE)) { - return this.iConfiguration.getSslTrustStorePath(); - } else { - return null; - } - } - return this.iConfiguration.getDomainProperty(pName); - } - - public synchronized void removeListener(int pPort) { - WBEMListenerImpl listener = this.iPortMap.remove(Integer.valueOf(pPort)); - if (listener != null) { - listener.stop(); - } - } - - /** - * Set the IPs to be blocked by the listener associated with the specified - * port. - * - * @param pPort - * The port. - * @param pIPs - * The comma-separated list of blocked IPs. - */ - public void setBlockedIPs(int pPort, String pIPs) { - if (pPort <= 0 || !this.iPortMap.containsKey(Integer.valueOf(pPort))) { throw new IllegalArgumentException( - "Port not in use."); } - WBEMListenerImpl listener = this.iPortMap.get(Integer.valueOf(pPort)); - if (listener != null) { - listener.setBlockedIPs(pIPs); - } - } - - public void setProperty(String pName, String pValue) { - if (pName.startsWith("javax.wbem.")) { - // Process JSR48 properties - if (pName.equals(WBEMListenerConstants.PROP_LISTENER_KEYSTORE)) { - this.iConfiguration.setDomainProperty(WBEMConfigurationProperties.KEYSTORE_PATH, - pValue); - } else if (pName.equals(WBEMListenerConstants.PROP_LISTENER_KEYSTORE_PASSWORD)) { - this.iConfiguration.setDomainProperty( - WBEMConfigurationProperties.KEYSTORE_PASSWORD, pValue); - } else if (pName.equals(WBEMListenerConstants.PROP_LISTENER_TRUSTSTORE)) { - this.iConfiguration.setDomainProperty(WBEMConfigurationProperties.TRUSTSTORE_PATH, - pValue); - } else { - throw new IllegalArgumentException(pName); - } - } else { - this.iConfiguration.setDomainProperty(pName, pValue); - } - } -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, IBM, ebak@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1565892 2007-01-08 ebak Make SBLIM client JSR48 compliant + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors + * 3023348 2010-07-02 blaschke-oss Listener uses # constructor instead of valueOf + * 3400209 2011-08-31 blaschke-oss Highlighted Static Analysis (PMD) issues + * 3469018 2012-01-03 blaschke-oss Properties not passed to CIMIndicationHandler + * 3477087 2012-01-23 blaschke-oss Need Access to an Indication Sender's IP Address + * 3496385 2012-03-02 blaschke-oss JSR48 1.0.0: add WBEMListener get/setProperty + * 3513228 2012-04-23 blaschke-oss Reliable Indications support can create lots of threads + * 3529062 2012-05-23 blaschke-oss WBEMListenerFactory should return new instance + * 3529065 2012-05-31 hellerda Enable WBEMListener get/setProperty + * 2628 2013-03-26 blaschke-oss Limit size of LinkedList of CIMEvents to be dispatched + * 2635 2013-05-16 blaschke-oss Slowloris DoS attack for CIM indication listener port + * 2657 2013-08-20 blaschke-oss Potential null pointer exception in handleConnection + */ + +package org.metricshub.wbem.sblim.cimclient; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.IOException; +import java.net.BindException; +import java.util.Enumeration; +import java.util.EventListener; +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; + +import org.metricshub.wbem.javax.wbem.listener.IndicationListener; +import org.metricshub.wbem.javax.wbem.listener.WBEMListenerConstants; +import org.metricshub.wbem.sblim.cimclient.internal.http.HttpConnectionHandler; +import org.metricshub.wbem.sblim.cimclient.internal.http.HttpServerConnection; +import org.metricshub.wbem.sblim.cimclient.internal.util.WBEMConfiguration; +import org.metricshub.wbem.sblim.cimclient.internal.util.WBEMConstants; +import org.metricshub.wbem.sblim.cimclient.internal.wbem.indications.CIMEventDispatcher; +import org.metricshub.wbem.sblim.cimclient.internal.wbem.indications.CIMIndicationHandler; +import org.metricshub.wbem.javax.wbem.listener.WBEMListener; + +/** + * Class WBEMListenerSBLIM is the SBLIM implementation of the WBEMListener + * interface. + * + */ +public class WBEMListenerSBLIM implements WBEMListener { + + /** + * The real implementation of a listener that starts a HTTP server and + * processes incoming indications + * + */ + public class WBEMListenerImpl { + + private EventListener iIndicationListener; + + private HttpServerConnection iConnection; + + private CIMIndicationHandler iIndicationHandler; + + private HttpConnectionHandler iConnectionHandler; + + /** + * Ctor. + * + * @param pLocalAddress + * The local address to bind the port to. If null the port is + * bound to all local addresses. For use on multi-homed + * systems. + * @param pPort + * The port to listen on. If zero any free port will be + * chosen. + * @param pSSL + * SSL secured connection? + * @param pIndicationListener + * The indication listener to forward the incoming + * indications to (an instance of IndicationListener or + * IndicationListenerSBLIM). + * @param pProperties + * The configuration. + * @throws IOException + */ + public WBEMListenerImpl(String pLocalAddress, int pPort, boolean pSSL, + EventListener pIndicationListener, Properties pProperties) throws IOException { + + // Merge any properties passed via addListener + if (pProperties != null) { + for (Enumeration e = pProperties.keys(); e.hasMoreElements();) { + String key = (String) e.nextElement(); + String value = pProperties.getProperty(key); + setProperty(key, value); + } + } + WBEMConfiguration config = WBEMListenerSBLIM.this.iConfiguration; + if (!(pIndicationListener instanceof IndicationListener) + && !(pIndicationListener instanceof IndicationListenerSBLIM)) throw new IllegalArgumentException( + "Listener must be instance of IndicationListener or IndicationListenerSBLIM"); + this.iIndicationListener = pIndicationListener; + CIMEventDispatcher eventDispatcher = new CIMEventDispatcher(this.iIndicationListener, + config.getListenerMaxQueuedEvents()); + this.iIndicationHandler = new CIMIndicationHandler(eventDispatcher, config); + this.iConnectionHandler = new HttpConnectionHandler(this.iIndicationHandler, config); + this.iConnection = new HttpServerConnection(this.iConnectionHandler, pLocalAddress, + pPort, pSSL, config); + } + + @Override + protected void finalize() throws Throwable { + try { + stop(); + } finally { + super.finalize(); + } + } + + /** + * Starts the HTTP server connection receiving the indications. + */ + public void start() { + this.iConnection.start(); + } + + /** + * Stops the HTTP server connection receiving the indications and the + * indication handler. + */ + public void stop() { + this.iConnection.close(); + this.iIndicationHandler.close(); + } + + /** + * Returns the listener we forward the indications to. + * + * @return The listener. + */ + public IndicationListener getIndicationListener() { + return (this.iIndicationListener instanceof IndicationListener) ? (IndicationListener) this.iIndicationListener + : null; + } + + /** + * Returns the listener we forward the indications to. + * + * @return The listener. + */ + public IndicationListenerSBLIM getIndicationListenerSBLIM() { + return (this.iIndicationListener instanceof IndicationListenerSBLIM) ? (IndicationListenerSBLIM) this.iIndicationListener + : null; + } + + /** + * Returns the listener port. + * + * @return The listener port. + */ + public int getListenerPort() { + return this.iConnection.getPort(); + } + + /** + * Get the IPs blocked by the listener. + * + * @return The comma-separated list of blocked IPs. + */ + public String getBlockedIPs() { + return this.iConnectionHandler.getBlockedIPs(); + } + + /** + * Set the IPs to be blocked by the listener. + * + * @param pIPs + * The comma-separated list of blocked IPs. + */ + public void setBlockedIPs(String pIPs) { + this.iConnectionHandler.setBlockedIPs(pIPs); + } + } + + protected final WBEMConfiguration iConfiguration = new WBEMConfiguration(new Properties()); + + private Map iPortMap = new HashMap(); + + /** + * Ctor. + */ + public WBEMListenerSBLIM() { + super(); + } + + /* + * (non-Javadoc) + * + * @see org.metricshub.wbem.javax.wbem.listener.WBEMListener#addListener(javax.wbem.listener. + * IndicationListener, int, java.lang.String) + */ + public int addListener(IndicationListener pListener, int pPort, String pTransport) + throws IOException { + return addListener((EventListener) pListener, pPort, pTransport, null, null); + } + + /* + * (non-Javadoc) + * + * @see org.metricshub.wbem.javax.wbem.listener.WBEMListener#addListener(javax.wbem.listener. + * IndicationListener, int, java.lang.String, java.lang.String) + */ + public int addListener(IndicationListener pListener, int pPort, String pTransport, + String pLocalAddr) throws IOException { + return addListener((EventListener) pListener, pPort, pTransport, pLocalAddr, null); + } + + /** + * Add a new listener using the specified port. + * + * @param pListener + * The Indication Listener that will be called when an indication + * is received. + * @param pPort + * The port to listen on. Use 0 to specify any available port. + * @param pTransport + * The transport to use (e.g. HTTP or HTTPS). + * @param pLocalAddr + * The local IP address to bind to. This is only needed in + * multi-homed systems. A value of null will bind to + * all IP addresses. + * @param pConfigurationProperties + * The individual configuration properties for this listener. + * @return The port that was used. + * @throws IOException + * This exception is thrown when binding to pPort fails. + */ + public int addListener(IndicationListener pListener, int pPort, String pTransport, + String pLocalAddr, Properties pConfigurationProperties) throws IOException { + + return addListener((EventListener) pListener, pPort, pTransport, pLocalAddr, + pConfigurationProperties); + } + + /** + * Add a new listener using the specified port. + * + * @param pListener + * The SBLIM Indication Listener that will be called when an + * indication is received. + * @param pPort + * The port to listen on. Use 0 to specify any available port. + * @param pTransport + * The transport to use (e.g. HTTP or HTTPS). + * @return The port that was used. + * @throws IOException + * This exception is thrown when binding to pPort fails. + */ + public int addListener(IndicationListenerSBLIM pListener, int pPort, String pTransport) + throws IOException { + return addListener((EventListener) pListener, pPort, pTransport, null, null); + } + + /** + * Add a new listener using the specified port and local address. + * + * @param pListener + * The SBLIM Indication Listener that will be called when an + * indication is received. + * @param pPort + * The port to listen on. Use 0 to specify any available port. + * @param pTransport + * The transport to use (e.g. HTTP or HTTPS). + * @param pLocalAddr + * The local IP address to bind to. This is only needed in + * multi-homed systems. A value of null will bind to + * all IP addresses. + * @return The port that was used. + * @throws IOException + * This exception is thrown when binding to pPort fails. + */ + public int addListener(IndicationListenerSBLIM pListener, int pPort, String pTransport, + String pLocalAddr) throws IOException { + return addListener((EventListener) pListener, pPort, pTransport, pLocalAddr, null); + } + + /** + * Add a new listener using the specified port, local address and + * properties. + * + * @param pListener + * The SBLIM Indication Listener that will be called when an + * indication is received. + * @param pPort + * The port to listen on. Use 0 to specify any available port. + * @param pTransport + * The transport to use (e.g. HTTP or HTTPS). + * @param pLocalAddr + * The local IP address to bind to. This is only needed in + * multi-homed systems. A value of null will bind to + * all IP addresses. + * @param pConfigurationProperties + * The individual configuration properties for this listener. + * @return The port that was used. + * @throws IOException + * This exception is thrown when binding to pPort fails. + */ + public int addListener(IndicationListenerSBLIM pListener, int pPort, String pTransport, + String pLocalAddr, Properties pConfigurationProperties) throws IOException { + + return addListener((EventListener) pListener, pPort, pTransport, pLocalAddr, + pConfigurationProperties); + } + + /** + * Add a new listener using the specified port, local address and + * properties. This is the worker routine for all public addListener + * methods. + * + * @param pListener + * The indication listener (IndicationListener or + * IndicationListenerSBLIM) that will be called when + * an indication is received. + * @param pPort + * The port to listen on. Use 0 to specify any available port. + * @param pTransport + * The transport to use (e.g. HTTP or HTTPS). + * @param pLocalAddr + * The local IP address to bind to. This is only needed in + * multi-homed systems. A value of null will bind to + * all IP addresses. + * @param pConfigurationProperties + * The individual configuration properties for this listener. + * @return The port that was used. + * @throws IOException + * This exception is thrown when binding to pPort fails. + */ + private synchronized int addListener(EventListener pListener, int pPort, String pTransport, + String pLocalAddr, Properties pConfigurationProperties) throws IOException { + + if (pPort > 0 && this.iPortMap.containsKey(Integer.valueOf(pPort))) { throw new BindException( + "Port already in use."); } + boolean ssl; + if (pTransport.equalsIgnoreCase(WBEMConstants.HTTP)) ssl = false; + else if (pTransport.equalsIgnoreCase(WBEMConstants.HTTPS)) ssl = true; + else throw new IllegalArgumentException("Unknown transport: " + pTransport + + "! Valid values are http and https."); + + WBEMListenerImpl listener = new WBEMListenerImpl(pLocalAddr, pPort, ssl, pListener, + pConfigurationProperties); + listener.start(); + + this.iPortMap.put(Integer.valueOf(listener.getListenerPort()), listener); + + return listener.getListenerPort(); + } + + /** + * Get the IPs blocked by the listener associated with the specified port. + * + * @param pPort + * The port. + * @return The comma-separated list of blocked IPs. + */ + public String getBlockedIPs(int pPort) { + if (pPort <= 0 || !this.iPortMap.containsKey(Integer.valueOf(pPort))) { throw new IllegalArgumentException( + "Port not in use."); } + WBEMListenerImpl listener = this.iPortMap.get(Integer.valueOf(pPort)); + return listener != null ? listener.getBlockedIPs() : null; + } + + public String getProperty(String pName) { + if (pName.startsWith("javax.wbem.")) { + // Process JSR48 properties + if (pName.equals(WBEMListenerConstants.PROP_LISTENER_KEYSTORE)) { + return this.iConfiguration.getSslKeyStorePath(); + } else if (pName.equals(WBEMListenerConstants.PROP_LISTENER_KEYSTORE_PASSWORD)) { + return this.iConfiguration.getSslKeyStorePassword(); + } else if (pName.equals(WBEMListenerConstants.PROP_LISTENER_TRUSTSTORE)) { + return this.iConfiguration.getSslTrustStorePath(); + } else { + return null; + } + } + return this.iConfiguration.getDomainProperty(pName); + } + + public synchronized void removeListener(int pPort) { + WBEMListenerImpl listener = this.iPortMap.remove(Integer.valueOf(pPort)); + if (listener != null) { + listener.stop(); + } + } + + /** + * Set the IPs to be blocked by the listener associated with the specified + * port. + * + * @param pPort + * The port. + * @param pIPs + * The comma-separated list of blocked IPs. + */ + public void setBlockedIPs(int pPort, String pIPs) { + if (pPort <= 0 || !this.iPortMap.containsKey(Integer.valueOf(pPort))) { throw new IllegalArgumentException( + "Port not in use."); } + WBEMListenerImpl listener = this.iPortMap.get(Integer.valueOf(pPort)); + if (listener != null) { + listener.setBlockedIPs(pIPs); + } + } + + public void setProperty(String pName, String pValue) { + if (pName.startsWith("javax.wbem.")) { + // Process JSR48 properties + if (pName.equals(WBEMListenerConstants.PROP_LISTENER_KEYSTORE)) { + this.iConfiguration.setDomainProperty(WBEMConfigurationProperties.KEYSTORE_PATH, + pValue); + } else if (pName.equals(WBEMListenerConstants.PROP_LISTENER_KEYSTORE_PASSWORD)) { + this.iConfiguration.setDomainProperty( + WBEMConfigurationProperties.KEYSTORE_PASSWORD, pValue); + } else if (pName.equals(WBEMListenerConstants.PROP_LISTENER_TRUSTSTORE)) { + this.iConfiguration.setDomainProperty(WBEMConfigurationProperties.TRUSTSTORE_PATH, + pValue); + } else { + throw new IllegalArgumentException(pName); + } + } else { + this.iConfiguration.setDomainProperty(pName, pValue); + } + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/discovery/AdvertisementCatalog.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/discovery/AdvertisementCatalog.java similarity index 91% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/discovery/AdvertisementCatalog.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/discovery/AdvertisementCatalog.java index 15c2234..b1100e1 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/discovery/AdvertisementCatalog.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/discovery/AdvertisementCatalog.java @@ -1,560 +1,559 @@ -/* - (C) Copyright IBM Corp. 2007, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Alexander Wolf-Reber, IBM, a.wolf-reber@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1678915 2007-03-12 lupusalex Integrated WBEM service discovery via SLP - * 1729361 2007-06-04 lupusalex Multicast discovery is broken in DiscovererSLP - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors - */ - -package org.sentrysoftware.wbem.sblim.cimclient.discovery; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; - -import javax.security.auth.Subject; -import org.sentrysoftware.wbem.javax.wbem.client.WBEMClient; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Locale; -import java.util.logging.Level; -import java.util.Map; -import java.util.Set; - -/** - * Class AdvertisementCatalog implements a catalog for WBEM service - * advertisements. In practice we usually have multiple advertisements for a - * single service, because the DMTF mandates an advertisement per remote service - * access point (e.g. http, https, rmi). This class tries to ease the management - * of this by indexing services by the unique service id and therefore surfacing - * which advertisements belong to the same service. The application might then - * choose it's preferred communication mechanism. - * - * No thread synchronization provided, this is the responsibility of - * the caller. - * @since 2.0.2 - */ -public class AdvertisementCatalog { - - /** - * Interface EventListener specifies listener that are called when an - * advertisement is added to or removed from the catalog, expires or is - * renewed. - * - */ - public static interface EventListener { - - /** - * Called when an advertisement is added to the catalog that has not - * been a member of the catalog before. - * - * @param pEvent - * The type of the event. One of the constants - * EVENT_ADD, EVENT_REMOVE, EVENT_EXPIRE, EVENT_RENEW - * in AdvertisementCatalog. - * - * @param pAdvertisment - * The added advertisement - */ - public void advertisementEvent(int pEvent, WBEMServiceAdvertisement pAdvertisment); - } - - /** - * Class AdvertisementDecorator decorates a WBEMAdvertisement with state - * information required by the AdvertisementCatalog class - * - * @pattern Decorator - * iAvertisement!=null - */ - private static class AdvertisementDecorator implements WBEMServiceAdvertisement { - - private WBEMServiceAdvertisement iAdvertisement; - - private boolean iRefresh = false; - - /** - * Ctor. - * - * @param pAdvertisement - * The advertisement to decorate - */ - protected AdvertisementDecorator(WBEMServiceAdvertisement pAdvertisement) { - if (pAdvertisement == null) throw new IllegalArgumentException("Advertisement is null"); - this.iAdvertisement = pAdvertisement; - } - - /** - * Returns advertisement - * - * @return The value of advertisement. - */ - protected WBEMServiceAdvertisement getAdvertisementXXX() { - return this.iAdvertisement; - } - - /** - * Returns refresh - * - * @return The value of refresh. - */ - protected boolean isRefresh() { - return this.iRefresh; - } - - /** - * Sets advertisement - * - * @param pAdvertisement - * The new value of advertisement. - */ - protected void setAdvertisement(WBEMServiceAdvertisement pAdvertisement) { - this.iAdvertisement = pAdvertisement; - } - - /** - * Sets refresh - * - * @param pRefresh - * The new value of refresh. - */ - protected void setRefresh(boolean pRefresh) { - this.iRefresh = pRefresh; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals(Object pObj) { - return this.iAdvertisement.equals(pObj); - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#hashCode() - */ - @Override - public int hashCode() { - return this.iAdvertisement.hashCode(); - } - - /** - * @see WBEMServiceAdvertisement#createClient(javax.security.auth.Subject, java.util.Locale[]) - */ - public WBEMClient createClient(Subject pSubject, Locale[] pLocales) throws Exception { - return this.iAdvertisement.createClient(pSubject, pLocales); - } - - /** - * @see WBEMServiceAdvertisement#getAttribute(java.lang.String) - */ - public String getAttribute(String pAttributeName) { - return this.iAdvertisement.getAttribute(pAttributeName); - } - - /** - * @see WBEMServiceAdvertisement#getAttributes() - */ - public Set> getAttributes() { - return this.iAdvertisement.getAttributes(); - } - - /** - * @see WBEMServiceAdvertisement#getConcreteServiceType() - */ - public String getConcreteServiceType() { - return this.iAdvertisement.getConcreteServiceType(); - } - - /** - * @see WBEMServiceAdvertisement#getDirectory() - */ - public String getDirectory() { - return this.iAdvertisement.getDirectory(); - } - - /** - * @see WBEMServiceAdvertisement#getInteropNamespaces() - */ - public String[] getInteropNamespaces() { - return this.iAdvertisement.getInteropNamespaces(); - } - - /** - * @see WBEMServiceAdvertisement#getServiceId() - */ - public String getServiceId() { - return this.iAdvertisement.getServiceId(); - } - - /** - * @see WBEMServiceAdvertisement#getServiceUrl() - */ - public String getServiceUrl() { - return this.iAdvertisement.getServiceUrl(); - } - - /** - * @see WBEMServiceAdvertisement#isExpired() - */ - public boolean isExpired() { - return this.iAdvertisement.isExpired(); - } - - /** - * @see WBEMServiceAdvertisement#setExpired(boolean) - */ - public void setExpired(boolean pExpired) { - this.iAdvertisement.setExpired(pExpired); - } - } - - /** - * Event code when advertisement is added - */ - public static int EVENT_ADD = 1; - - /** - * Event code when advertisement is removed - */ - public static int EVENT_REMOVE = 2; - - /** - * Event code when advertisement expires - */ - public static int EVENT_EXPIRE = 4; - - /** - * Event code when advertisement is renewed - */ - public static int EVENT_RENEW = 8; - - private List iListeners = new LinkedList(); - - private HashMap> iCatalogByDirectory = new HashMap>(); - - private Map> iCatalogById = new HashMap>(); - - /** - * Ctor. - */ - public AdvertisementCatalog() { - /**/ - } - - /** - * Adds a listener for "add" events. The listener will be called whenever a - * advertisement is added to the catalog. - * - * @param pListener - * The listener - */ - public void addEventListener(EventListener pListener) { - this.iListeners.add(pListener); - } - - /** - * Adds new advertisements to the catalog. Existing advertisements sharing - * concrete type, url and directory are replaced. - * - * @param pAdvertisements - * The new advertisements - */ - public void addAdvertisements(WBEMServiceAdvertisement[] pAdvertisements) { - for (int i = 0; i < pAdvertisements.length; ++i) { - String url = ""; - try { - WBEMServiceAdvertisement advertisement = pAdvertisements[i]; - url = advertisement.getServiceUrl(); - WBEMProtocol protocol = makeProtocol(advertisement); - String serviceId = advertisement.getAttribute(WBEMServiceAdvertisement.SERVICE_ID); - { - List innerList = this.iCatalogByDirectory - .get(advertisement.getDirectory()); - if (innerList == null) { - innerList = new ArrayList(); - this.iCatalogByDirectory.put(advertisement.getDirectory(), innerList); - } - AdvertisementDecorator entry = findAdvertisement(innerList, advertisement); - if (entry != null) { - boolean wasExpired = entry.isExpired(); - entry.setAdvertisement(advertisement); - entry.setRefresh(false); - entry.setExpired(false); - if (wasExpired) { - notifyEventListeners(EVENT_RENEW, advertisement); - } - } else { - innerList.add(new AdvertisementDecorator(advertisement)); - notifyEventListeners(EVENT_ADD, advertisement); - } - } - { - Map innerMap = this.iCatalogById - .get(serviceId); - if (innerMap == null) { - innerMap = new HashMap(); - this.iCatalogById.put(serviceId, innerMap); - } - innerMap.put(protocol, advertisement); - } - } catch (Exception e) { - LogAndTraceBroker.getBroker().trace(Level.FINE, - "Incomplete advertisement for" + url, e); - } - } - } - - /** - * Returns the advertisement from the catalog corresponding to a given id - * and with the protocol preferred most. - * - * @param pId - * The service id - * @param pProtocols - * An array containing the desired protocols in order of - * preference. If a service doesn't advertise any of the given - * protocols this service returns null. - * @return The corresponding advertisement - */ - public WBEMServiceAdvertisement getAdvertisement(final String pId, - final WBEMProtocol[] pProtocols) { - Map innerMap = this.iCatalogById.get(pId); - if (innerMap == null) { return null; } - for (int i = 0; i < pProtocols.length; ++i) { - WBEMServiceAdvertisement advertisement = innerMap.get(pProtocols[i]); - if (advertisement != null) { return advertisement; } - } - return null; - } - - /** - * Returns the advertisements from the catalog corresponding to a given - * directory - * - * @param pDirectory - * The directory service - * @return The corresponding advertisements - */ - public WBEMServiceAdvertisement[] getAdvertisementsByDirectory(String pDirectory) { - List result = this.iCatalogByDirectory.get(pDirectory); - return (result != null ? (WBEMServiceAdvertisement[]) result - .toArray(new WBEMServiceAdvertisement[result.size()]) - : new WBEMServiceAdvertisement[] {}); - } - - /** - * Returns the advertisements from the catalog corresponding to a given id - * - * @param pId - * The service id - * @return The corresponding advertisements - */ - public WBEMServiceAdvertisement[] getAdvertisementsById(String pId) { - Map innerMap = this.iCatalogById.get(pId); - if (innerMap == null) { return null; } - Collection advertisements = innerMap.values(); - return advertisements.toArray(new WBEMServiceAdvertisement[advertisements.size()]); - } - - /** - * Returns an array of service ids known by this catalog - * - * @return The service ids - */ - public String[] getKnownIds() { - Set ids = this.iCatalogById.keySet(); - return ids.toArray(new String[ids.size()]); - } - - /** - * Refreshes the advertisements from a given directory. All existing - * advertisements from this directory are deleted first before the new ones - * are added. - * - * @param pDirectory - * The directory services we got the advertisements from - * @param pAdvertisements - * The advertisements - */ - public void refreshAdvertisements(final String[] pDirectory, - WBEMServiceAdvertisement[] pAdvertisements) { - for (int i = 0; i < pDirectory.length; ++i) { - markRefresh(pDirectory[i]); - } - addAdvertisements(pAdvertisements); - for (int i = 0; i < pDirectory.length; ++i) { - expire(pDirectory[i]); - } - } - - /** - * Removes a listener - * - * @param pListener - * The listener to remove - */ - public void removeEventListener(EventListener pListener) { - this.iListeners.remove(pListener); - } - - /** - * Removes the expired advertisements from the catalog. - * - * @param pDirectory - * When not null only the expired advertisements of - * the given directory are removed. Otherwise all expired - * advertisements are removed. - */ - public void removeExpired(String pDirectory) { - - if (pDirectory == null) { - Iterator iter = this.iCatalogByDirectory.keySet().iterator(); - while (iter.hasNext()) { - removeExpired(iter.next()); - } - return; - } - - List advertisementList = this.iCatalogByDirectory.get(pDirectory); - Iterator iter = advertisementList.iterator(); - while (iter.hasNext()) { - AdvertisementDecorator decorator = iter.next(); - if (decorator.isExpired()) { - iter.remove(); - notifyEventListeners(EVENT_REMOVE, decorator); - Map innerMap = this.iCatalogById - .get(decorator.getServiceId()); - innerMap.remove(makeProtocol(decorator)); - } - } - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - StringBuffer result = new StringBuffer(); - result.append("AdvertisementCatalog:"); - Iterator>> outer = this.iCatalogById - .entrySet().iterator(); - while (outer.hasNext()) { - Map.Entry> entry = outer.next(); - if (entry.getValue() == null) { - continue; - } - result.append("[service-id:\""); - result.append(entry.getKey()); - result.append("\""); - Map innerMap = entry.getValue(); - Iterator> inner = innerMap.entrySet() - .iterator(); - while (inner.hasNext()) { - Map.Entry innerEntry = inner.next(); - result.append("["); - result.append(innerEntry.getKey().toString()); - result.append("]"); - } - result.append("]"); - } - return result.toString(); - } - - private void expire(String pDirectory) { - List advertisementList = this.iCatalogByDirectory.get(pDirectory); - if (advertisementList == null) { return; } - Iterator iter = advertisementList.iterator(); - while (iter.hasNext()) { - AdvertisementDecorator advertisement = iter.next(); - if (advertisement.isRefresh()) { - advertisement.setRefresh(false); - advertisement.setExpired(true); - notifyEventListeners(EVENT_EXPIRE, advertisement); - } - } - } - - private AdvertisementDecorator findAdvertisement(List pList, - WBEMServiceAdvertisement pAdvertisement) { - Iterator iter = pList.iterator(); - while (iter.hasNext()) { - AdvertisementDecorator entry = iter.next(); - if (entry.getServiceUrl().equals(pAdvertisement.getServiceUrl())) { return entry; } - } - return null; - } - - private WBEMProtocol makeProtocol(WBEMServiceAdvertisement advertisement) { - String presentation = advertisement.getAttribute(WBEMServiceAdvertisement.COMM_MECHANISM); - if ("OTHER".equalsIgnoreCase(presentation)) { - presentation = advertisement - .getAttribute(WBEMServiceAdvertisement.OTHER_COMM_MECHN_DESC); - } - String transport = advertisement.getServiceUrl().split(":", 2)[0]; - WBEMProtocol protocol = new WBEMProtocol(transport, presentation); - return protocol; - } - - private void markRefresh(String pDirectory) { - List advertisementList = this.iCatalogByDirectory.get(pDirectory); - if (advertisementList == null) { return; } - Iterator iter = advertisementList.iterator(); - while (iter.hasNext()) { - AdvertisementDecorator advertisement = iter.next(); - advertisement.setRefresh(true); - } - } - - private void notifyEventListeners(int pEvent, WBEMServiceAdvertisement pAdvertisement) { - Iterator iter = this.iListeners.iterator(); - while (iter.hasNext()) { - iter.next().advertisementEvent(pEvent, pAdvertisement); - } - } - -} +/* + (C) Copyright IBM Corp. 2007, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Alexander Wolf-Reber, IBM, a.wolf-reber@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1678915 2007-03-12 lupusalex Integrated WBEM service discovery via SLP + * 1729361 2007-06-04 lupusalex Multicast discovery is broken in DiscovererSLP + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors + */ + +package org.metricshub.wbem.sblim.cimclient.discovery; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import javax.security.auth.Subject; + +import org.metricshub.wbem.javax.wbem.client.WBEMClient; +import org.metricshub.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Locale; +import java.util.logging.Level; +import java.util.Map; +import java.util.Set; + +/** + * Class AdvertisementCatalog implements a catalog for WBEM service + * advertisements. In practice we usually have multiple advertisements for a + * single service, because the DMTF mandates an advertisement per remote service + * access point (e.g. http, https, rmi). This class tries to ease the management + * of this by indexing services by the unique service id and therefore surfacing + * which advertisements belong to the same service. The application might then + * choose it's preferred communication mechanism. + * + * No thread synchronization provided, this is the responsibility of + * the caller. + * @since 2.0.2 + */ +public class AdvertisementCatalog { + + /** + * Interface EventListener specifies listener that are called when an + * advertisement is added to or removed from the catalog, expires or is + * renewed. + * + */ + public static interface EventListener { + + /** + * Called when an advertisement is added to the catalog that has not + * been a member of the catalog before. + * + * @param pEvent + * The type of the event. One of the constants + * EVENT_ADD, EVENT_REMOVE, EVENT_EXPIRE, EVENT_RENEW + * in AdvertisementCatalog. + * + * @param pAdvertisment + * The added advertisement + */ + public void advertisementEvent(int pEvent, WBEMServiceAdvertisement pAdvertisment); + } + + /** + * Class AdvertisementDecorator decorates a WBEMAdvertisement with state + * information required by the AdvertisementCatalog class + * + * @pattern Decorator + * iAvertisement!=null + */ + private static class AdvertisementDecorator implements WBEMServiceAdvertisement { + + private WBEMServiceAdvertisement iAdvertisement; + + private boolean iRefresh = false; + + /** + * Ctor. + * + * @param pAdvertisement + * The advertisement to decorate + */ + protected AdvertisementDecorator(WBEMServiceAdvertisement pAdvertisement) { + if (pAdvertisement == null) throw new IllegalArgumentException("Advertisement is null"); + this.iAdvertisement = pAdvertisement; + } + + /** + * Returns advertisement + * + * @return The value of advertisement. + */ + protected WBEMServiceAdvertisement getAdvertisementXXX() { + return this.iAdvertisement; + } + + /** + * Returns refresh + * + * @return The value of refresh. + */ + protected boolean isRefresh() { + return this.iRefresh; + } + + /** + * Sets advertisement + * + * @param pAdvertisement + * The new value of advertisement. + */ + protected void setAdvertisement(WBEMServiceAdvertisement pAdvertisement) { + this.iAdvertisement = pAdvertisement; + } + + /** + * Sets refresh + * + * @param pRefresh + * The new value of refresh. + */ + protected void setRefresh(boolean pRefresh) { + this.iRefresh = pRefresh; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#equals(java.lang.Object) + */ + @Override + public boolean equals(Object pObj) { + return this.iAdvertisement.equals(pObj); + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#hashCode() + */ + @Override + public int hashCode() { + return this.iAdvertisement.hashCode(); + } + + /** + * @see WBEMServiceAdvertisement#createClient(javax.security.auth.Subject, java.util.Locale[]) + */ + public WBEMClient createClient(Subject pSubject, Locale[] pLocales) throws Exception { + return this.iAdvertisement.createClient(pSubject, pLocales); + } + + /** + * @see WBEMServiceAdvertisement#getAttribute(java.lang.String) + */ + public String getAttribute(String pAttributeName) { + return this.iAdvertisement.getAttribute(pAttributeName); + } + + /** + * @see WBEMServiceAdvertisement#getAttributes() + */ + public Set> getAttributes() { + return this.iAdvertisement.getAttributes(); + } + + /** + * @see WBEMServiceAdvertisement#getConcreteServiceType() + */ + public String getConcreteServiceType() { + return this.iAdvertisement.getConcreteServiceType(); + } + + /** + * @see WBEMServiceAdvertisement#getDirectory() + */ + public String getDirectory() { + return this.iAdvertisement.getDirectory(); + } + + /** + * @see WBEMServiceAdvertisement#getInteropNamespaces() + */ + public String[] getInteropNamespaces() { + return this.iAdvertisement.getInteropNamespaces(); + } + + /** + * @see WBEMServiceAdvertisement#getServiceId() + */ + public String getServiceId() { + return this.iAdvertisement.getServiceId(); + } + + /** + * @see WBEMServiceAdvertisement#getServiceUrl() + */ + public String getServiceUrl() { + return this.iAdvertisement.getServiceUrl(); + } + + /** + * @see WBEMServiceAdvertisement#isExpired() + */ + public boolean isExpired() { + return this.iAdvertisement.isExpired(); + } + + /** + * @see WBEMServiceAdvertisement#setExpired(boolean) + */ + public void setExpired(boolean pExpired) { + this.iAdvertisement.setExpired(pExpired); + } + } + + /** + * Event code when advertisement is added + */ + public static int EVENT_ADD = 1; + + /** + * Event code when advertisement is removed + */ + public static int EVENT_REMOVE = 2; + + /** + * Event code when advertisement expires + */ + public static int EVENT_EXPIRE = 4; + + /** + * Event code when advertisement is renewed + */ + public static int EVENT_RENEW = 8; + + private List iListeners = new LinkedList(); + + private HashMap> iCatalogByDirectory = new HashMap>(); + + private Map> iCatalogById = new HashMap>(); + + /** + * Ctor. + */ + public AdvertisementCatalog() { + /**/ + } + + /** + * Adds a listener for "add" events. The listener will be called whenever a + * advertisement is added to the catalog. + * + * @param pListener + * The listener + */ + public void addEventListener(EventListener pListener) { + this.iListeners.add(pListener); + } + + /** + * Adds new advertisements to the catalog. Existing advertisements sharing + * concrete type, url and directory are replaced. + * + * @param pAdvertisements + * The new advertisements + */ + public void addAdvertisements(WBEMServiceAdvertisement[] pAdvertisements) { + for (int i = 0; i < pAdvertisements.length; ++i) { + String url = ""; + try { + WBEMServiceAdvertisement advertisement = pAdvertisements[i]; + url = advertisement.getServiceUrl(); + WBEMProtocol protocol = makeProtocol(advertisement); + String serviceId = advertisement.getAttribute(WBEMServiceAdvertisement.SERVICE_ID); + { + List innerList = this.iCatalogByDirectory + .get(advertisement.getDirectory()); + if (innerList == null) { + innerList = new ArrayList(); + this.iCatalogByDirectory.put(advertisement.getDirectory(), innerList); + } + AdvertisementDecorator entry = findAdvertisement(innerList, advertisement); + if (entry != null) { + boolean wasExpired = entry.isExpired(); + entry.setAdvertisement(advertisement); + entry.setRefresh(false); + entry.setExpired(false); + if (wasExpired) { + notifyEventListeners(EVENT_RENEW, advertisement); + } + } else { + innerList.add(new AdvertisementDecorator(advertisement)); + notifyEventListeners(EVENT_ADD, advertisement); + } + } + { + Map innerMap = this.iCatalogById + .get(serviceId); + if (innerMap == null) { + innerMap = new HashMap(); + this.iCatalogById.put(serviceId, innerMap); + } + innerMap.put(protocol, advertisement); + } + } catch (Exception e) { + LogAndTraceBroker.getBroker().trace(Level.FINE, + "Incomplete advertisement for" + url, e); + } + } + } + + /** + * Returns the advertisement from the catalog corresponding to a given id + * and with the protocol preferred most. + * + * @param pId + * The service id + * @param pProtocols + * An array containing the desired protocols in order of + * preference. If a service doesn't advertise any of the given + * protocols this service returns null. + * @return The corresponding advertisement + */ + public WBEMServiceAdvertisement getAdvertisement(final String pId, + final WBEMProtocol[] pProtocols) { + Map innerMap = this.iCatalogById.get(pId); + if (innerMap == null) { return null; } + for (int i = 0; i < pProtocols.length; ++i) { + WBEMServiceAdvertisement advertisement = innerMap.get(pProtocols[i]); + if (advertisement != null) { return advertisement; } + } + return null; + } + + /** + * Returns the advertisements from the catalog corresponding to a given + * directory + * + * @param pDirectory + * The directory service + * @return The corresponding advertisements + */ + public WBEMServiceAdvertisement[] getAdvertisementsByDirectory(String pDirectory) { + List result = this.iCatalogByDirectory.get(pDirectory); + return (result != null ? (WBEMServiceAdvertisement[]) result + .toArray(new WBEMServiceAdvertisement[result.size()]) + : new WBEMServiceAdvertisement[] {}); + } + + /** + * Returns the advertisements from the catalog corresponding to a given id + * + * @param pId + * The service id + * @return The corresponding advertisements + */ + public WBEMServiceAdvertisement[] getAdvertisementsById(String pId) { + Map innerMap = this.iCatalogById.get(pId); + if (innerMap == null) { return null; } + Collection advertisements = innerMap.values(); + return advertisements.toArray(new WBEMServiceAdvertisement[advertisements.size()]); + } + + /** + * Returns an array of service ids known by this catalog + * + * @return The service ids + */ + public String[] getKnownIds() { + Set ids = this.iCatalogById.keySet(); + return ids.toArray(new String[ids.size()]); + } + + /** + * Refreshes the advertisements from a given directory. All existing + * advertisements from this directory are deleted first before the new ones + * are added. + * + * @param pDirectory + * The directory services we got the advertisements from + * @param pAdvertisements + * The advertisements + */ + public void refreshAdvertisements(final String[] pDirectory, + WBEMServiceAdvertisement[] pAdvertisements) { + for (int i = 0; i < pDirectory.length; ++i) { + markRefresh(pDirectory[i]); + } + addAdvertisements(pAdvertisements); + for (int i = 0; i < pDirectory.length; ++i) { + expire(pDirectory[i]); + } + } + + /** + * Removes a listener + * + * @param pListener + * The listener to remove + */ + public void removeEventListener(EventListener pListener) { + this.iListeners.remove(pListener); + } + + /** + * Removes the expired advertisements from the catalog. + * + * @param pDirectory + * When not null only the expired advertisements of + * the given directory are removed. Otherwise all expired + * advertisements are removed. + */ + public void removeExpired(String pDirectory) { + + if (pDirectory == null) { + Iterator iter = this.iCatalogByDirectory.keySet().iterator(); + while (iter.hasNext()) { + removeExpired(iter.next()); + } + return; + } + + List advertisementList = this.iCatalogByDirectory.get(pDirectory); + Iterator iter = advertisementList.iterator(); + while (iter.hasNext()) { + AdvertisementDecorator decorator = iter.next(); + if (decorator.isExpired()) { + iter.remove(); + notifyEventListeners(EVENT_REMOVE, decorator); + Map innerMap = this.iCatalogById + .get(decorator.getServiceId()); + innerMap.remove(makeProtocol(decorator)); + } + } + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + StringBuffer result = new StringBuffer(); + result.append("AdvertisementCatalog:"); + Iterator>> outer = this.iCatalogById + .entrySet().iterator(); + while (outer.hasNext()) { + Map.Entry> entry = outer.next(); + if (entry.getValue() == null) { + continue; + } + result.append("[service-id:\""); + result.append(entry.getKey()); + result.append("\""); + Map innerMap = entry.getValue(); + Iterator> inner = innerMap.entrySet() + .iterator(); + while (inner.hasNext()) { + Map.Entry innerEntry = inner.next(); + result.append("["); + result.append(innerEntry.getKey().toString()); + result.append("]"); + } + result.append("]"); + } + return result.toString(); + } + + private void expire(String pDirectory) { + List advertisementList = this.iCatalogByDirectory.get(pDirectory); + if (advertisementList == null) { return; } + Iterator iter = advertisementList.iterator(); + while (iter.hasNext()) { + AdvertisementDecorator advertisement = iter.next(); + if (advertisement.isRefresh()) { + advertisement.setRefresh(false); + advertisement.setExpired(true); + notifyEventListeners(EVENT_EXPIRE, advertisement); + } + } + } + + private AdvertisementDecorator findAdvertisement(List pList, + WBEMServiceAdvertisement pAdvertisement) { + Iterator iter = pList.iterator(); + while (iter.hasNext()) { + AdvertisementDecorator entry = iter.next(); + if (entry.getServiceUrl().equals(pAdvertisement.getServiceUrl())) { return entry; } + } + return null; + } + + private WBEMProtocol makeProtocol(WBEMServiceAdvertisement advertisement) { + String presentation = advertisement.getAttribute(WBEMServiceAdvertisement.COMM_MECHANISM); + if ("OTHER".equalsIgnoreCase(presentation)) { + presentation = advertisement + .getAttribute(WBEMServiceAdvertisement.OTHER_COMM_MECHN_DESC); + } + String transport = advertisement.getServiceUrl().split(":", 2)[0]; + WBEMProtocol protocol = new WBEMProtocol(transport, presentation); + return protocol; + } + + private void markRefresh(String pDirectory) { + List advertisementList = this.iCatalogByDirectory.get(pDirectory); + if (advertisementList == null) { return; } + Iterator iter = advertisementList.iterator(); + while (iter.hasNext()) { + AdvertisementDecorator advertisement = iter.next(); + advertisement.setRefresh(true); + } + } + + private void notifyEventListeners(int pEvent, WBEMServiceAdvertisement pAdvertisement) { + Iterator iter = this.iListeners.iterator(); + while (iter.hasNext()) { + iter.next().advertisementEvent(pEvent, pAdvertisement); + } + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/discovery/Discoverer.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/discovery/Discoverer.java similarity index 71% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/discovery/Discoverer.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/discovery/Discoverer.java index dd700c1..92f333f 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/discovery/Discoverer.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/discovery/Discoverer.java @@ -1,73 +1,71 @@ -/* - (C) Copyright IBM Corp. 2007, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Alexander Wolf-Reber, IBM, a.wolf-reber@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1678915 2007-03-12 lupusalex Integrated WBEM service discovery via SLP - * 1729361 2007-06-04 lupusalex Multicast discovery is broken in DiscovererSLP - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.discovery; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -/** - * Interface Discoverer offers methodology for discovering WBEM services. - * - * Implementations SHALL ensure thread-safety - * @since 2.0.2 - */ -public interface Discoverer { - - /** - * Finds WBEM services using a given list of directory servers - * - * @param pDirectoryUrls - * An array of directory servers. For SLP this would be a list of - * DA URLs. - * @return The array of WBEM service advertisements found - */ - public WBEMServiceAdvertisement[] findWbemServices(String[] pDirectoryUrls); - - /** - * Finds directory services. The semantics of this method might be protocol - * specific. E.g. for SLP this sends a multicast into the local subnet - * looking first for directory agent, second for service agents. - * - * @return A String[] containing the URLs of the directories - * @since 2.0.3 - */ - public String[] findDirectoryServices(); -} +/* + (C) Copyright IBM Corp. 2007, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Alexander Wolf-Reber, IBM, a.wolf-reber@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1678915 2007-03-12 lupusalex Integrated WBEM service discovery via SLP + * 1729361 2007-06-04 lupusalex Multicast discovery is broken in DiscovererSLP + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.cimclient.discovery; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +/** + * Interface Discoverer offers methodology for discovering WBEM services. + * + * Implementations SHALL ensure thread-safety + * @since 2.0.2 + */ +public interface Discoverer { + + /** + * Finds WBEM services using a given list of directory servers + * + * @param pDirectoryUrls + * An array of directory servers. For SLP this would be a list of + * DA URLs. + * @return The array of WBEM service advertisements found + */ + public WBEMServiceAdvertisement[] findWbemServices(String[] pDirectoryUrls); + + /** + * Finds directory services. The semantics of this method might be protocol + * specific. E.g. for SLP this sends a multicast into the local subnet + * looking first for directory agent, second for service agents. + * + * @return A String[] containing the URLs of the directories + * @since 2.0.3 + */ + public String[] findDirectoryServices(); +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/discovery/DiscovererFactory.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/discovery/DiscovererFactory.java similarity index 69% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/discovery/DiscovererFactory.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/discovery/DiscovererFactory.java index 3a0a8cd..47b40bc 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/discovery/DiscovererFactory.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/discovery/DiscovererFactory.java @@ -1,93 +1,91 @@ -/* - (C) Copyright IBM Corp. 2007, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Alexander Wolf-Reber, IBM, a.wolf-reber@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1678915 2007-03-12 lupusalex Integrated WBEM service discovery via SLP - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.discovery; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.Locale; - -import org.sentrysoftware.wbem.sblim.cimclient.discovery.Discoverer; -import org.sentrysoftware.wbem.sblim.cimclient.internal.discovery.slp.DiscovererSLP; - -/** - * Class DiscovererFactory is responsible for creating concrete instances of the - * Discoverer interface. - * - * This class is thread-safe. - * - * @since 2.0.2 - */ -public class DiscovererFactory { - - /** - * The Service Location Protocol (SLP) - */ - public static final String SLP = "SLP"; - - private static final String[] cProtocols = new String[] { SLP }; - - /** - * Returns the concrete Discoverer for a given discovery protocol. - * - * @param pProtocol The discovery protocol, e.g. "SLP" - * @return The corresponding discoverer - * @throws IllegalArgumentException On unsupported protocols - * Factory Method - */ - public static Discoverer getDiscoverer(String pProtocol) throws IllegalArgumentException { - if (SLP.equalsIgnoreCase(pProtocol)) { - return new DiscovererSLP(Locale.US); - } - throw new IllegalArgumentException("Protocol " + pProtocol + " not supported."); - } - - /** - * Return an array of all supported discovery protocols - * - * @return The supported protocols - */ - public static String[] getSupportedProtocols() { - return cProtocols; - } - - private DiscovererFactory() { - /**/} -} +/* + (C) Copyright IBM Corp. 2007, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Alexander Wolf-Reber, IBM, a.wolf-reber@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1678915 2007-03-12 lupusalex Integrated WBEM service discovery via SLP + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.cimclient.discovery; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.Locale; + +import org.metricshub.wbem.sblim.cimclient.internal.discovery.slp.DiscovererSLP; +import org.metricshub.wbem.sblim.cimclient.discovery.Discoverer; + +/** + * Class DiscovererFactory is responsible for creating concrete instances of the + * Discoverer interface. + * + * This class is thread-safe. + * + * @since 2.0.2 + */ +public class DiscovererFactory { + + /** + * The Service Location Protocol (SLP) + */ + public static final String SLP = "SLP"; + + private static final String[] cProtocols = new String[] { SLP }; + + /** + * Returns the concrete Discoverer for a given discovery protocol. + * + * @param pProtocol The discovery protocol, e.g. "SLP" + * @return The corresponding discoverer + * @throws IllegalArgumentException On unsupported protocols + * Factory Method + */ + public static Discoverer getDiscoverer(String pProtocol) throws IllegalArgumentException { + if (SLP.equalsIgnoreCase(pProtocol)) { + return new DiscovererSLP(Locale.US); + } + throw new IllegalArgumentException("Protocol " + pProtocol + " not supported."); + } + + /** + * Return an array of all supported discovery protocols + * + * @return The supported protocols + */ + public static String[] getSupportedProtocols() { + return cProtocols; + } + + private DiscovererFactory() { + /**/} +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/discovery/WBEMProtocol.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/discovery/WBEMProtocol.java similarity index 78% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/discovery/WBEMProtocol.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/discovery/WBEMProtocol.java index d8c8f97..a1f31c7 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/discovery/WBEMProtocol.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/discovery/WBEMProtocol.java @@ -1,144 +1,142 @@ -/* - (C) Copyright IBM Corp. 2007, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Alexander Wolf-Reber, IBM, a.wolf-reber@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1678915 2007-03-29 lupusalex Integrated WBEM service discovery via SLP - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.discovery; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -/** - * Class WBEMProtocol encapsulates a transport/presentation protocol pair. E.g. - * "HTTPS/CIM-XML" - * - * iTransport != null
      iPresentation != null
      - * @since 2.0.2 - */ -public class WBEMProtocol { - - private String iTransport; - - private String iPresentation; - - /** - * Ctor. - * - * @param pTransport - * The transport protocol (e.g. HTTP, HTTPS, RMI) - * @param pPresentation - * The presentation protocol (e.g. CIM-XML) - */ - public WBEMProtocol(String pTransport, String pPresentation) { - this.iTransport = pTransport != null ? pTransport.toUpperCase() : ""; - this.iPresentation = pPresentation != null ? pPresentation.toUpperCase() : ""; - } - - /** - * Returns the presentation protocol (e.g. CIM-XML) - * - * @return The value. - */ - public String getPresentation() { - return this.iPresentation; - } - - /** - * Sets the presentation protocol - * - * @param pPresentation - * The new value (e.g. CIM-XML) - */ - public void setPresentation(String pPresentation) { - this.iPresentation = pPresentation != null ? pPresentation : ""; - } - - /** - * Returns transport protocol (e.g. HTTP) - * - * @return The value. - */ - public String getTransport() { - return this.iTransport; - } - - /** - * Sets the transport protocol - * - * @param pTransport - * The new value (e.g. HTTP). - */ - public void setTransport(String pTransport) { - this.iTransport = pTransport != null ? pTransport : ""; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals(Object pObj) { - if (pObj instanceof WBEMProtocol) { - WBEMProtocol that = (WBEMProtocol) pObj; - return (this.iTransport.equals(that.iTransport)) - && (this.iPresentation.equals(that.iPresentation)); - } - return false; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#hashCode() - */ - @Override - public int hashCode() { - return this.iTransport.hashCode() + this.iPresentation.hashCode(); - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return this.iTransport + "/" + this.iPresentation; - } - -} +/* + (C) Copyright IBM Corp. 2007, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Alexander Wolf-Reber, IBM, a.wolf-reber@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1678915 2007-03-29 lupusalex Integrated WBEM service discovery via SLP + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.cimclient.discovery; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +/** + * Class WBEMProtocol encapsulates a transport/presentation protocol pair. E.g. + * "HTTPS/CIM-XML" + * + * iTransport != null
      iPresentation != null
      + * @since 2.0.2 + */ +public class WBEMProtocol { + + private String iTransport; + + private String iPresentation; + + /** + * Ctor. + * + * @param pTransport + * The transport protocol (e.g. HTTP, HTTPS, RMI) + * @param pPresentation + * The presentation protocol (e.g. CIM-XML) + */ + public WBEMProtocol(String pTransport, String pPresentation) { + this.iTransport = pTransport != null ? pTransport.toUpperCase() : ""; + this.iPresentation = pPresentation != null ? pPresentation.toUpperCase() : ""; + } + + /** + * Returns the presentation protocol (e.g. CIM-XML) + * + * @return The value. + */ + public String getPresentation() { + return this.iPresentation; + } + + /** + * Sets the presentation protocol + * + * @param pPresentation + * The new value (e.g. CIM-XML) + */ + public void setPresentation(String pPresentation) { + this.iPresentation = pPresentation != null ? pPresentation : ""; + } + + /** + * Returns transport protocol (e.g. HTTP) + * + * @return The value. + */ + public String getTransport() { + return this.iTransport; + } + + /** + * Sets the transport protocol + * + * @param pTransport + * The new value (e.g. HTTP). + */ + public void setTransport(String pTransport) { + this.iTransport = pTransport != null ? pTransport : ""; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#equals(java.lang.Object) + */ + @Override + public boolean equals(Object pObj) { + if (pObj instanceof WBEMProtocol) { + WBEMProtocol that = (WBEMProtocol) pObj; + return (this.iTransport.equals(that.iTransport)) + && (this.iPresentation.equals(that.iPresentation)); + } + return false; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#hashCode() + */ + @Override + public int hashCode() { + return this.iTransport.hashCode() + this.iPresentation.hashCode(); + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return this.iTransport + "/" + this.iPresentation; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/discovery/WBEMServiceAdvertisement.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/discovery/WBEMServiceAdvertisement.java similarity index 91% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/discovery/WBEMServiceAdvertisement.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/discovery/WBEMServiceAdvertisement.java index 7e0b8f7..803a842 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/discovery/WBEMServiceAdvertisement.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/discovery/WBEMServiceAdvertisement.java @@ -1,344 +1,343 @@ -/* - (C) Copyright IBM Corp. 2007, 2012 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Alexander Wolf-Reber, IBM, a.wolf-reber@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1678915 2007-03-12 lupusalex Integrated WBEM service discovery via SLP - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 3469427 2012-01-04 blaschke-oss Fix broken HTML links - */ - -package org.sentrysoftware.wbem.sblim.cimclient.discovery; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.Locale; -import java.util.Set; -import java.util.Map.Entry; - -import javax.security.auth.Subject; -import org.sentrysoftware.wbem.javax.wbem.client.WBEMClient; - -/** - * Interface WBEMServiceAdvertisement is encapsulates the information collected - * about a service during discovery. The DMTF specifies a set a attributes that - * each service must advertise. These attributes are found as string constants - * in this interface and the method getAttribute() is offered to get an - * attribute by name. This design was chosen because the set of attributes might - * be extended by DMTF and vendor implementations. It's also unclear if upcoming - * new discovery protocols will have the same set of attributes as SLP. - * - * Immutable - * This class is thread-safe - * @since 2.0.2 - */ -public interface WBEMServiceAdvertisement { - - /** - * template-type (string): The scheme name of the service scheme. The scheme - * name consists of the service type name and an optional naming authority - * name, separated from the service type name by a period. See RFC 2609 - * section 3.2.2 for the conventions governing service type names. - */ - public static final String TEMPLATE_TYPE = "template-type"; - - /** - * template-version (string): The version number of the service type - * specification. - */ - public static final String TEMPLATE_VERSION = "template-version"; - - /** - * template-description (string): A description of the service suitable for - * inclusion in text read by people. - */ - public static final String TEMPLATE_DESCRIPTION = "template-description"; - - /** - * template-url-syntax (string): The template-url-syntax MUST be the WBEM - * URI Mapping of the location of one service access point offered by the - * WBEM Server over TCP transport. This attribute must provide sufficient - * addressing information so that the WBEM Server can be addressed directly - * using the URL. The WBEM URI Mapping is defined in the WBEM URI Mapping - * Specification 1.0.0 (DSP0207).
      - *
      - * Example: (template-url-syntax=https://localhost:5989) - */ - public static final String TEMPLATE_URL_SYNTAX = "template-url-syntax"; - - /** - * service-hi-name (string, optional): This string is used as a name of the - * CIM service for human interfaces. This attribute MUST be the - * CIM_ObjectManager.ElementName property value. - */ - public static final String SERVICE_HI_NAME = "service-hi-name"; - - /** - * service-hi-description (string, optional): This string is used as a - * description of the CIM service for human interfaces.This attribute MUST - * be the CIM_ObjectManager.Description property value. - */ - public static final String SERVICE_HI_DESC = "service-hi-description"; - - /** - * service-id (string, literal): The ID of this WBEM Server. The value MUST - * be the CIM_ObjectManager.Name property value. - */ - public static final String SERVICE_ID = "service-id"; - - /** - * CommunicationMechanism (string, literal): The communication mechanism - * (protocol) used by the CIM Object Manager for this service-location-tcp - * defined in this advertisement. This information MUST be the - * CIM_ObjectManagerCommunicationMechanism.CommunicationMechanism property - * value. CIM-XML is defined in the CIM Operations over HTTP specification - * which can be found at http://www.dmtf.org/
      - *
      - * Values: "Unknown", "Other", "cim-xml" - */ - public static final String COMM_MECHANISM = "CommunicationMechanism"; - - /** - * OtherCommunicationMechanismDescription (string, literal, optional): The - * other communication mechanism defined for the CIM Server in the case the - * "Other" value is set in the CommunicationMechanism string. This attribute - * MUST be the - * CIM_ObjectManagerCommunicationMechanism.OtherCommunicationMechanism - * property value. This attribute is optional because it is only required if - * the "other" value is set in CommunicationMechansim. The value returned is - * a free-form string. - */ - public static final String OTHER_COMM_MECHN_DESC = "OtherCommunicationMechanismDescription"; - - /** - * InteropSchemaNamespace (string, literal, multiple): Namespace within the - * target WBEM Server where the CIM Interop Schema can be accessed. Multiple - * namespaces may be provided. Each namespace provided MUST contain the same - * information. - */ - public static final String INTEROP_NS = "InteropSchemaNamespace"; - - /** - * ProtocolVersion (string, literal, optional): The version of the protocol. - * It MUST be the CIM_ObjectManagerCommunicationMechanism.Version property - * value. - */ - public static final String PROTOCOL_VERSION = "ProtocolVersion"; - - /** - * FunctionalProfilesSupported (string, literal, multiple): - * ProfilesSupported defines the CIM Operation profiles supported by the CIM - * Object Manager. This attribute MUST be the - * CIM_ObjectManagerCommunicationMechansim.FunctionalProfilesSupported - * property value.
      - *
      - * Values: - "Unknown", "Other", "Basic Read", "Basic Write", - "Schema Manipulation", "Instance Manipulation", - "Association Traversal", "Query Execution", - "Qualifier Declaration", "Indications" - */ - public static final String FUNCTIONAL_PROF_SUPP = "FunctionalProfilesSupported"; - - /** - * FunctionalProfileDescriptions (string, literal, multiple, optional): - * Other profile description if the "other" value is set in the - * ProfilesSupported attribute. This attribute is optional because it is - * returned only if the "other" value is set in the ProfilesSupported - * attribute. If provided it MUST be equal to the - * CIM_ObjectManagerCommunicationMechanism.FunctionalProfileDescriptions - * property value. - */ - public static final String FUNCTIONAL_PROF_DESC = "FunctionalProfileDescriptions"; - - /** - * MultipleOperationsSupported (boolean): Defines whether the CIM Object - * Manager supports batch operations. This attribute MUST be the - * CIM_ObjectManagerCommunicationMechanism.MultipleOperationsSupported - * property value. - */ - public static final String MULT_OPERATIONS_SUPP = "MultipleOperationsSupported"; - - /** - * AuthenticationMechanismsSupported (string, literal, multiple): Defines - * the authentication mechanism supported by the CIM Object Manager. This - * attributed MUST be the CIM_ObjectManagerCommunicationMechanism. - * AuthenticationMechanismsSupported property value.
      - *
      - * Values: "Unknown", "None", "Other", "Basic", "Digest" - */ - public static final String AUTH_MECH_SUPP = "AuthenticationMechanismsSupported"; - - /** - * AuthenticationMechansimDescriptions (string, literal, multiple, - * optional): Defines other Authentication mechanisms supported by the CIM - * Object Manager in the case where the "Other" value is set in any of the - * AuthenticationMechanismSupported attribute values. If provided, this - * attribute MUST be the CIM_ObjectManagerCommunicationMechanism. - * AuthenticationMechansimDescriptions property value. - */ - public static final String AUTH_MECH_DESC = "AuthenticationMechansimDescriptions"; - - /** - * Namespace (string, literal, multiple, optional): Namespace(s) supported - * on the CIM Object Manager. This attribute MUST be the CIM_Namespace.name - * property value for each instance of CIM_Namespace that exists. This - * attribute is optional. NOTE: This value is literal (L) because the - * namespace names MUST not be translated into other languages. - */ - public static final String NAMESPACE = "Namespace"; - - /** - * Classinfo (string, multiple, optional): This attributes is optional but - * if used, the values MUST be the CIM_Namespace.Classinfo property value. - * The values represent the classinfo (CIM Schema version, etc.) for the - * namespaces defined in the corresponding namespace listed in the Namespace - * attribute. Each entry in this attribute MUST correspond to the namespace - * defined in the same position of the namespace attribute. There must be - * one entry in this attribute for each entry in the namespace attribute. - */ - public static final String CLASSINFO = "Classinfo"; - - /** - * RegisteredProfilesSupported (string, literal, multiple): - * RegisteredProfilesSupported defines the Profiles that this WBEM Server - * has support for. Each entry in this attribute MUST be in the form of - * Organization:Profile Name{:Subprofile Name}
      - *
      - * Examples:
      - *
      - * - * DMTF:CIM Server
      - * DMTF:CIM Server:Protocol Adapter
      - * DMTF:CIM Server:Provider Registration
      - *

      - * The Organization MUST be the CIM_RegisteredProfile.RegisteredOrganization - * property value. The Profile Name MUST be the - * CIM_RegisteredProfile.RegisteredName property value. The subprofile Name - * MUST be the CIM_RegisteredProfile.RegisteredName property value when it - * is used as a Dependent in the CIM_SubProfileRequiresProfile association - * for the specified Profile Name (used as the antecedent). - * - */ - public static final String REG_PROF_SUPP = "RegisteredProfilesSupported"; - - /** - * Gets the URL of the directory from which this advertisement was received - * - * @return The directory URL - */ - public abstract String getDirectory(); - - /** - * Returns the concrete service type. E.g. for the SLP advertised service - * service:wbem:https this method would return - * https. - * - * @return The concrete service type - */ - public abstract String getConcreteServiceType(); - - /** - * Returns the interop namespaces - * - * @return The interop namespaces - */ - public abstract String[] getInteropNamespaces(); - - /** - * Returns the service url, e.g. http://9.155.62.79:5988 - * - * @return The service url - */ - public abstract String getServiceUrl(); - - /** - * Return the attribute value for a given attribute name - * - * @param pAttributeName - * The attribute name - * @return The value - */ - public abstract String getAttribute(String pAttributeName); - - /** - * Return the set of attributes of this advertisement - * - * @return A Set<Map.Entry<String, String>> containing the name - * value pairs of the attributes. - */ - public abstract Set> getAttributes(); - - /** - * Returns the service id - * - * @return The service id - */ - public abstract String getServiceId(); - - /** - * Returns the expiration state of the advertisement. - * - * @return true when advertisement is expired. - */ - public abstract boolean isExpired(); - - /** - * Sets the expirations state of the advertisement. Might be used by the - * application to mark an advertisement as expired, e.g. when it's no longer - * reported by the corresponding directory. Used for this purpose by - * AdvertisementCatalog. - * - * @param pExpired - * The new value - */ - public abstract void setExpired(boolean pExpired); - - /** - * Creates a fully-initialized WBEMClient instance connected to the service - * that is subject of this advertisement. On every call to this method a new - * client will be created. The client is not stored or cached anywhere in - * this class. - * - * @param pSubject - * The credential for authenticating with the service - * @param pLocales - * An array of locales ordered by preference - * @return The WBEM client - * @throws Exception - * @pattern Factory Methods - */ - public abstract WBEMClient createClient(Subject pSubject, Locale[] pLocales) throws Exception; -} +/* + (C) Copyright IBM Corp. 2007, 2012 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Alexander Wolf-Reber, IBM, a.wolf-reber@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1678915 2007-03-12 lupusalex Integrated WBEM service discovery via SLP + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 3469427 2012-01-04 blaschke-oss Fix broken HTML links + */ + +package org.metricshub.wbem.sblim.cimclient.discovery; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.Locale; +import java.util.Set; +import java.util.Map.Entry; + +import javax.security.auth.Subject; + +import org.metricshub.wbem.javax.wbem.client.WBEMClient; + +/** + * Interface WBEMServiceAdvertisement is encapsulates the information collected + * about a service during discovery. The DMTF specifies a set a attributes that + * each service must advertise. These attributes are found as string constants + * in this interface and the method getAttribute() is offered to get an + * attribute by name. This design was chosen because the set of attributes might + * be extended by DMTF and vendor implementations. It's also unclear if upcoming + * new discovery protocols will have the same set of attributes as SLP. + * + * Immutable + * This class is thread-safe + * @since 2.0.2 + */ +public interface WBEMServiceAdvertisement { + + /** + * template-type (string): The scheme name of the service scheme. The scheme + * name consists of the service type name and an optional naming authority + * name, separated from the service type name by a period. See RFC 2609 + * section 3.2.2 for the conventions governing service type names. + */ + public static final String TEMPLATE_TYPE = "template-type"; + + /** + * template-version (string): The version number of the service type + * specification. + */ + public static final String TEMPLATE_VERSION = "template-version"; + + /** + * template-description (string): A description of the service suitable for + * inclusion in text read by people. + */ + public static final String TEMPLATE_DESCRIPTION = "template-description"; + + /** + * template-url-syntax (string): The template-url-syntax MUST be the WBEM + * URI Mapping of the location of one service access point offered by the + * WBEM Server over TCP transport. This attribute must provide sufficient + * addressing information so that the WBEM Server can be addressed directly + * using the URL. The WBEM URI Mapping is defined in the WBEM URI Mapping + * Specification 1.0.0 (DSP0207).
      + *
      + * Example: (template-url-syntax=https://localhost:5989) + */ + public static final String TEMPLATE_URL_SYNTAX = "template-url-syntax"; + + /** + * service-hi-name (string, optional): This string is used as a name of the + * CIM service for human interfaces. This attribute MUST be the + * CIM_ObjectManager.ElementName property value. + */ + public static final String SERVICE_HI_NAME = "service-hi-name"; + + /** + * service-hi-description (string, optional): This string is used as a + * description of the CIM service for human interfaces.This attribute MUST + * be the CIM_ObjectManager.Description property value. + */ + public static final String SERVICE_HI_DESC = "service-hi-description"; + + /** + * service-id (string, literal): The ID of this WBEM Server. The value MUST + * be the CIM_ObjectManager.Name property value. + */ + public static final String SERVICE_ID = "service-id"; + + /** + * CommunicationMechanism (string, literal): The communication mechanism + * (protocol) used by the CIM Object Manager for this service-location-tcp + * defined in this advertisement. This information MUST be the + * CIM_ObjectManagerCommunicationMechanism.CommunicationMechanism property + * value. CIM-XML is defined in the CIM Operations over HTTP specification + * which can be found at http://www.dmtf.org/
      + *
      + * Values: "Unknown", "Other", "cim-xml" + */ + public static final String COMM_MECHANISM = "CommunicationMechanism"; + + /** + * OtherCommunicationMechanismDescription (string, literal, optional): The + * other communication mechanism defined for the CIM Server in the case the + * "Other" value is set in the CommunicationMechanism string. This attribute + * MUST be the + * CIM_ObjectManagerCommunicationMechanism.OtherCommunicationMechanism + * property value. This attribute is optional because it is only required if + * the "other" value is set in CommunicationMechansim. The value returned is + * a free-form string. + */ + public static final String OTHER_COMM_MECHN_DESC = "OtherCommunicationMechanismDescription"; + + /** + * InteropSchemaNamespace (string, literal, multiple): Namespace within the + * target WBEM Server where the CIM Interop Schema can be accessed. Multiple + * namespaces may be provided. Each namespace provided MUST contain the same + * information. + */ + public static final String INTEROP_NS = "InteropSchemaNamespace"; + + /** + * ProtocolVersion (string, literal, optional): The version of the protocol. + * It MUST be the CIM_ObjectManagerCommunicationMechanism.Version property + * value. + */ + public static final String PROTOCOL_VERSION = "ProtocolVersion"; + + /** + * FunctionalProfilesSupported (string, literal, multiple): + * ProfilesSupported defines the CIM Operation profiles supported by the CIM + * Object Manager. This attribute MUST be the + * CIM_ObjectManagerCommunicationMechansim.FunctionalProfilesSupported + * property value.
      + *
      + * Values: + "Unknown", "Other", "Basic Read", "Basic Write", + "Schema Manipulation", "Instance Manipulation", + "Association Traversal", "Query Execution", + "Qualifier Declaration", "Indications" + */ + public static final String FUNCTIONAL_PROF_SUPP = "FunctionalProfilesSupported"; + + /** + * FunctionalProfileDescriptions (string, literal, multiple, optional): + * Other profile description if the "other" value is set in the + * ProfilesSupported attribute. This attribute is optional because it is + * returned only if the "other" value is set in the ProfilesSupported + * attribute. If provided it MUST be equal to the + * CIM_ObjectManagerCommunicationMechanism.FunctionalProfileDescriptions + * property value. + */ + public static final String FUNCTIONAL_PROF_DESC = "FunctionalProfileDescriptions"; + + /** + * MultipleOperationsSupported (boolean): Defines whether the CIM Object + * Manager supports batch operations. This attribute MUST be the + * CIM_ObjectManagerCommunicationMechanism.MultipleOperationsSupported + * property value. + */ + public static final String MULT_OPERATIONS_SUPP = "MultipleOperationsSupported"; + + /** + * AuthenticationMechanismsSupported (string, literal, multiple): Defines + * the authentication mechanism supported by the CIM Object Manager. This + * attributed MUST be the CIM_ObjectManagerCommunicationMechanism. + * AuthenticationMechanismsSupported property value.
      + *
      + * Values: "Unknown", "None", "Other", "Basic", "Digest" + */ + public static final String AUTH_MECH_SUPP = "AuthenticationMechanismsSupported"; + + /** + * AuthenticationMechansimDescriptions (string, literal, multiple, + * optional): Defines other Authentication mechanisms supported by the CIM + * Object Manager in the case where the "Other" value is set in any of the + * AuthenticationMechanismSupported attribute values. If provided, this + * attribute MUST be the CIM_ObjectManagerCommunicationMechanism. + * AuthenticationMechansimDescriptions property value. + */ + public static final String AUTH_MECH_DESC = "AuthenticationMechansimDescriptions"; + + /** + * Namespace (string, literal, multiple, optional): Namespace(s) supported + * on the CIM Object Manager. This attribute MUST be the CIM_Namespace.name + * property value for each instance of CIM_Namespace that exists. This + * attribute is optional. NOTE: This value is literal (L) because the + * namespace names MUST not be translated into other languages. + */ + public static final String NAMESPACE = "Namespace"; + + /** + * Classinfo (string, multiple, optional): This attributes is optional but + * if used, the values MUST be the CIM_Namespace.Classinfo property value. + * The values represent the classinfo (CIM Schema version, etc.) for the + * namespaces defined in the corresponding namespace listed in the Namespace + * attribute. Each entry in this attribute MUST correspond to the namespace + * defined in the same position of the namespace attribute. There must be + * one entry in this attribute for each entry in the namespace attribute. + */ + public static final String CLASSINFO = "Classinfo"; + + /** + * RegisteredProfilesSupported (string, literal, multiple): + * RegisteredProfilesSupported defines the Profiles that this WBEM Server + * has support for. Each entry in this attribute MUST be in the form of + * Organization:Profile Name{:Subprofile Name}
      + *
      + * Examples:
      + *
      + * + * DMTF:CIM Server
      + * DMTF:CIM Server:Protocol Adapter
      + * DMTF:CIM Server:Provider Registration
      + *

      + * The Organization MUST be the CIM_RegisteredProfile.RegisteredOrganization + * property value. The Profile Name MUST be the + * CIM_RegisteredProfile.RegisteredName property value. The subprofile Name + * MUST be the CIM_RegisteredProfile.RegisteredName property value when it + * is used as a Dependent in the CIM_SubProfileRequiresProfile association + * for the specified Profile Name (used as the antecedent). + * + */ + public static final String REG_PROF_SUPP = "RegisteredProfilesSupported"; + + /** + * Gets the URL of the directory from which this advertisement was received + * + * @return The directory URL + */ + public abstract String getDirectory(); + + /** + * Returns the concrete service type. E.g. for the SLP advertised service + * service:wbem:https this method would return + * https. + * + * @return The concrete service type + */ + public abstract String getConcreteServiceType(); + + /** + * Returns the interop namespaces + * + * @return The interop namespaces + */ + public abstract String[] getInteropNamespaces(); + + /** + * Returns the service url, e.g. http://9.155.62.79:5988 + * + * @return The service url + */ + public abstract String getServiceUrl(); + + /** + * Return the attribute value for a given attribute name + * + * @param pAttributeName + * The attribute name + * @return The value + */ + public abstract String getAttribute(String pAttributeName); + + /** + * Return the set of attributes of this advertisement + * + * @return A Set<Map.Entry<String, String>> containing the name + * value pairs of the attributes. + */ + public abstract Set> getAttributes(); + + /** + * Returns the service id + * + * @return The service id + */ + public abstract String getServiceId(); + + /** + * Returns the expiration state of the advertisement. + * + * @return true when advertisement is expired. + */ + public abstract boolean isExpired(); + + /** + * Sets the expirations state of the advertisement. Might be used by the + * application to mark an advertisement as expired, e.g. when it's no longer + * reported by the corresponding directory. Used for this purpose by + * AdvertisementCatalog. + * + * @param pExpired + * The new value + */ + public abstract void setExpired(boolean pExpired); + + /** + * Creates a fully-initialized WBEMClient instance connected to the service + * that is subject of this advertisement. On every call to this method a new + * client will be created. The client is not stored or cached anywhere in + * this class. + * + * @param pSubject + * The credential for authenticating with the service + * @param pLocales + * An array of locales ordered by preference + * @return The WBEM client + * @throws Exception + * @pattern Factory Methods + */ + public abstract WBEMClient createClient(Subject pSubject, Locale[] pLocales) throws Exception; +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/discovery/package.html b/src/main/java/org/metricshub/wbem/sblim/cimclient/discovery/package.html similarity index 100% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/discovery/package.html rename to src/main/java/org/metricshub/wbem/sblim/cimclient/discovery/package.html diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/doc-files/bestpractise.html b/src/main/java/org/metricshub/wbem/sblim/cimclient/doc-files/bestpractise.html similarity index 100% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/doc-files/bestpractise.html rename to src/main/java/org/metricshub/wbem/sblim/cimclient/doc-files/bestpractise.html diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/doc-files/configuration.html b/src/main/java/org/metricshub/wbem/sblim/cimclient/doc-files/configuration.html similarity index 100% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/doc-files/configuration.html rename to src/main/java/org/metricshub/wbem/sblim/cimclient/doc-files/configuration.html diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/doc-files/development.html b/src/main/java/org/metricshub/wbem/sblim/cimclient/doc-files/development.html similarity index 100% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/doc-files/development.html rename to src/main/java/org/metricshub/wbem/sblim/cimclient/doc-files/development.html diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/doc-files/discovery.html b/src/main/java/org/metricshub/wbem/sblim/cimclient/doc-files/discovery.html similarity index 100% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/doc-files/discovery.html rename to src/main/java/org/metricshub/wbem/sblim/cimclient/doc-files/discovery.html diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/doc-files/embedded.html b/src/main/java/org/metricshub/wbem/sblim/cimclient/doc-files/embedded.html similarity index 100% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/doc-files/embedded.html rename to src/main/java/org/metricshub/wbem/sblim/cimclient/doc-files/embedded.html diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/doc-files/firststeps.html b/src/main/java/org/metricshub/wbem/sblim/cimclient/doc-files/firststeps.html similarity index 100% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/doc-files/firststeps.html rename to src/main/java/org/metricshub/wbem/sblim/cimclient/doc-files/firststeps.html diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/doc-files/history.html b/src/main/java/org/metricshub/wbem/sblim/cimclient/doc-files/history.html similarity index 100% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/doc-files/history.html rename to src/main/java/org/metricshub/wbem/sblim/cimclient/doc-files/history.html diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/doc-files/indication_threading.png b/src/main/java/org/metricshub/wbem/sblim/cimclient/doc-files/indication_threading.png similarity index 100% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/doc-files/indication_threading.png rename to src/main/java/org/metricshub/wbem/sblim/cimclient/doc-files/indication_threading.png diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/doc-files/indications.html b/src/main/java/org/metricshub/wbem/sblim/cimclient/doc-files/indications.html similarity index 100% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/doc-files/indications.html rename to src/main/java/org/metricshub/wbem/sblim/cimclient/doc-files/indications.html diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/doc-files/logging.html b/src/main/java/org/metricshub/wbem/sblim/cimclient/doc-files/logging.html similarity index 100% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/doc-files/logging.html rename to src/main/java/org/metricshub/wbem/sblim/cimclient/doc-files/logging.html diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/doc-files/secure.html b/src/main/java/org/metricshub/wbem/sblim/cimclient/doc-files/secure.html similarity index 100% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/doc-files/secure.html rename to src/main/java/org/metricshub/wbem/sblim/cimclient/doc-files/secure.html diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/doc-files/secure_indications.html b/src/main/java/org/metricshub/wbem/sblim/cimclient/doc-files/secure_indications.html similarity index 100% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/doc-files/secure_indications.html rename to src/main/java/org/metricshub/wbem/sblim/cimclient/doc-files/secure_indications.html diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/doc-files/terminology.html b/src/main/java/org/metricshub/wbem/sblim/cimclient/doc-files/terminology.html similarity index 100% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/doc-files/terminology.html rename to src/main/java/org/metricshub/wbem/sblim/cimclient/doc-files/terminology.html diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/doc-files/unittest.html b/src/main/java/org/metricshub/wbem/sblim/cimclient/doc-files/unittest.html similarity index 100% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/doc-files/unittest.html rename to src/main/java/org/metricshub/wbem/sblim/cimclient/doc-files/unittest.html diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cim/CIMElementSorter.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cim/CIMElementSorter.java similarity index 78% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cim/CIMElementSorter.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cim/CIMElementSorter.java index 8a2882d..29a43e9 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cim/CIMElementSorter.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cim/CIMElementSorter.java @@ -1,123 +1,121 @@ -/* - (C) Copyright IBM Corp. 2006, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-10-10 ebak Make SBLIM client JSR48 compliant - * 1660756 2007-02-22 ebak Embedded object support - * 1737141 2007-06-18 ebak Sync up with JSR48 evolution - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cim; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.Arrays; -import java.util.Comparator; - -import org.sentrysoftware.wbem.javax.cim.CIMElement; - -/** - * Class CIMElementSorter can sort CIMElement arrays and can do binary search by - * name in them. - */ -public class CIMElementSorter implements Comparator { - - private static final Comparator COMPARATOR = new CIMElementSorter(); - - /** - * Sorts the passed CIMElement array, the passed array is not copied. - * - * @param pArray - * the array which will be sorted if it's not null - * @return pArray - */ - public static CIMElement[] sort(CIMElement[] pArray) { - if (pArray == null || pArray.length == 0) return null; - synchronized (pArray) { - Arrays.sort(pArray /* , COMPARATOR */); - } - return pArray; - } - - /** - * Finds CIMElement, named pName, in pArray which must be a sorted array of - * CIMElements. - * - * @param pArray - * @param pName - * @return the CIMElement if found, otherwise null - */ - public static CIMElement find(CIMElement[] pArray, String pName) { - if (pArray == null) return null; - int idx; - synchronized (pArray) { - idx = Arrays.binarySearch(pArray, pName, COMPARATOR); - } - if (idx < 0) return null; - return pArray[idx]; - } - - /** - * Finds the index of CIMElement, named pName, in pArray which must be a - * sorted array of CIMElements. - * - * @param pArray - * @param pName - * @return the index, just like in case of Arrays.binarySearch() - * @see java.util.Arrays#binarySearch(Object[], Object, Comparator) - */ - public static int findIdx(CIMElement[] pArray, String pName) { - if (pArray == null) return -1; - synchronized (pArray) { - return Arrays.binarySearch(pArray, pName, COMPARATOR); - } - } - - /** - * @see java.util.Comparator#compare(Object, Object) - */ - public int compare(Object pObj0, Object pObj1) { - // ebak: handling null objects - if (pObj0 == null) return pObj1 == null ? 0 : 1; - if (pObj1 == null) return -1; - String name0 = pObj0 instanceof CIMElement ? ((CIMElement) pObj0).getName() - : (String) pObj0; - String name1 = pObj1 instanceof CIMElement ? ((CIMElement) pObj1).getName() - : (String) pObj1; - return name0.compareToIgnoreCase(name1); - } - -} +/* + (C) Copyright IBM Corp. 2006, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-10-10 ebak Make SBLIM client JSR48 compliant + * 1660756 2007-02-22 ebak Embedded object support + * 1737141 2007-06-18 ebak Sync up with JSR48 evolution + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cim; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.Arrays; +import java.util.Comparator; + +import org.metricshub.wbem.javax.cim.CIMElement; + +/** + * Class CIMElementSorter can sort CIMElement arrays and can do binary search by + * name in them. + */ +public class CIMElementSorter implements Comparator { + + private static final Comparator COMPARATOR = new CIMElementSorter(); + + /** + * Sorts the passed CIMElement array, the passed array is not copied. + * + * @param pArray + * the array which will be sorted if it's not null + * @return pArray + */ + public static CIMElement[] sort(CIMElement[] pArray) { + if (pArray == null || pArray.length == 0) return null; + synchronized (pArray) { + Arrays.sort(pArray /* , COMPARATOR */); + } + return pArray; + } + + /** + * Finds CIMElement, named pName, in pArray which must be a sorted array of + * CIMElements. + * + * @param pArray + * @param pName + * @return the CIMElement if found, otherwise null + */ + public static CIMElement find(CIMElement[] pArray, String pName) { + if (pArray == null) return null; + int idx; + synchronized (pArray) { + idx = Arrays.binarySearch(pArray, pName, COMPARATOR); + } + if (idx < 0) return null; + return pArray[idx]; + } + + /** + * Finds the index of CIMElement, named pName, in pArray which must be a + * sorted array of CIMElements. + * + * @param pArray + * @param pName + * @return the index, just like in case of Arrays.binarySearch() + * @see java.util.Arrays#binarySearch(Object[], Object, Comparator) + */ + public static int findIdx(CIMElement[] pArray, String pName) { + if (pArray == null) return -1; + synchronized (pArray) { + return Arrays.binarySearch(pArray, pName, COMPARATOR); + } + } + + /** + * @see java.util.Comparator#compare(Object, Object) + */ + public int compare(Object pObj0, Object pObj1) { + // ebak: handling null objects + if (pObj0 == null) return pObj1 == null ? 0 : 1; + if (pObj1 == null) return -1; + String name0 = pObj0 instanceof CIMElement ? ((CIMElement) pObj0).getName() + : (String) pObj0; + String name1 = pObj1 instanceof CIMElement ? ((CIMElement) pObj1).getName() + : (String) pObj1; + return name0.compareToIgnoreCase(name1); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cim/CIMHelper.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cim/CIMHelper.java similarity index 86% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cim/CIMHelper.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cim/CIMHelper.java index 1ce9442..e048802 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cim/CIMHelper.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cim/CIMHelper.java @@ -1,349 +1,346 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Alexander Wolf-Reber, IBM, a.wolf-reber@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1565892 2006-12-06 lupusalex Make SBLIM client JSR48 compliant - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2964463 2010-03-08 blaschke-oss WBEMClient.initialize() throws wrong exception - * 2942520 2010-03-08 blaschke-oss IPv6 link local address with scope_id including a dot not supported - * 3513353 2012-03-30 blaschke-oss TCK: CIMDataType arrays must have length >= 1 - * 3513349 2012-03-31 blaschke-oss TCK: CIMDataType must not accept null string - * 3598613 2013-01-11 blaschke-oss different data type in cim instance and cim object path - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cim; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.math.BigInteger; -import java.net.URI; -import java.net.URISyntaxException; - -import org.sentrysoftware.wbem.javax.cim.CIMDataType; -import org.sentrysoftware.wbem.javax.cim.CIMInstance; -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; -import org.sentrysoftware.wbem.javax.cim.CIMProperty; -import org.sentrysoftware.wbem.javax.cim.UnsignedInteger16; -import org.sentrysoftware.wbem.javax.cim.UnsignedInteger32; -import org.sentrysoftware.wbem.javax.cim.UnsignedInteger64; -import org.sentrysoftware.wbem.javax.cim.UnsignedInteger8; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.util.WBEMConstants; - -/** - * Class CIMHelper provides convenience methods that are missing from the - * official JSR48 API - * - */ -public abstract class CIMHelper { - - private CIMHelper() { - // no instances - } - - /** - * Creates a URI of a CIMOM from a given CIM object path, adding default - * port if port not parsable. - * - * @param pPath - * The CIM object path. - * @return The URI. - * @throws URISyntaxException - */ - public static URI createCimomUri(CIMObjectPath pPath) throws URISyntaxException { - String scheme = pPath.getScheme(); - String host = pPath.getHost(); - int port = WBEMConstants.DEFAULT_WBEM_PORT; - try { - port = Integer.parseInt(pPath.getPort()); - } catch (NumberFormatException e) { - // stuck with default port - } - return new URI(scheme, null, host, port, WBEMConstants.CIMOM_PATH, null, null); - } - - /** - * Creates a URI of a CIMOM from a given URI, adding default port if port - * not specified. - * - * @param pUri - * The URI. - * @return The URI. - * @throws URISyntaxException - */ - public static URI createCimomUri(URI pUri) throws URISyntaxException { - String scheme = pUri.getScheme(); - String host = pUri.getHost(); - int port = pUri.getPort(); - if (port == -1) { - // stuck with default port - port = WBEMConstants.DEFAULT_WBEM_PORT; - } - return new URI(scheme, null, host, port, WBEMConstants.CIMOM_PATH, null, null); - } - - private static CIMDataType CIMScalarDataTypes[] = { - /* 00 */CIMDataType.UINT8_T, - /* 01 */CIMDataType.SINT8_T, - /* 02 */CIMDataType.UINT16_T, - /* 03 */CIMDataType.SINT16_T, - /* 04 */CIMDataType.UINT32_T, - /* 05 */CIMDataType.SINT32_T, - /* 06 */CIMDataType.UINT64_T, - /* 07 */CIMDataType.SINT64_T, - /* 08 */CIMDataType.STRING_T, - /* 09 */CIMDataType.BOOLEAN_T, - /* 10 */CIMDataType.REAL32_T, - /* 11 */CIMDataType.REAL64_T, - /* 12 */CIMDataType.DATETIME_T, - /* 13 */CIMDataType.CHAR16_T, - /* 14 */new CIMDataType(""), - /* 15 */CIMDataType.OBJECT_T, - /* 16 */null, - /* 17 */CIMDataType.CLASS_T }; - - /** - * Returns the CIMDataType of a scalar of the specified data type. This - * should be used in lieu of "new CIMDataType(pType)" which is not supported - * by the JSR48 standard. - * - * @param pType - * Data type. - * @return CIMDataType corresponding to data type. - */ - public static CIMDataType ScalarDataType(int pType) { - if (pType < 0 || pType >= CIMScalarDataTypes.length) return null; - return CIMScalarDataTypes[pType]; - } - - private static CIMDataType CIMArrayDataTypes[] = { - /* 00 */CIMDataType.UINT8_ARRAY_T, - /* 01 */CIMDataType.SINT8_ARRAY_T, - /* 02 */CIMDataType.UINT16_ARRAY_T, - /* 03 */CIMDataType.SINT16_ARRAY_T, - /* 04 */CIMDataType.UINT32_ARRAY_T, - /* 05 */CIMDataType.SINT32_ARRAY_T, - /* 06 */CIMDataType.UINT64_ARRAY_T, - /* 07 */CIMDataType.SINT64_ARRAY_T, - /* 08 */CIMDataType.STRING_ARRAY_T, - /* 09 */CIMDataType.BOOLEAN_ARRAY_T, - /* 10 */CIMDataType.REAL32_ARRAY_T, - /* 11 */CIMDataType.REAL64_ARRAY_T, - /* 12 */CIMDataType.DATETIME_ARRAY_T, - /* 13 */CIMDataType.CHAR16_ARRAY_T, - /* 14 */new CIMDataType("", 0), - /* 15 */CIMDataType.OBJECT_ARRAY_T, - /* 16 */null, - /* 17 */CIMDataType.CLASS_ARRAY_T }; - - /** - * Returns the CIMDataType of an unbounded array of the specified data type. - * This should be used in lieu of "new CIMDataType(pType,0)" which is not - * supported by the JSR48 standard. - * - * @param pType - * Data type. - * @return CIMDataType corresponding to data type. - */ - public static CIMDataType UnboundedArrayDataType(int pType) { - if (pType < 0 || pType >= CIMArrayDataTypes.length) return null; - return CIMArrayDataTypes[pType]; - } - - /** - * CIMInstanceWithSynchonizedNumericKeyDataTypes returns a - * CIMInstance where the data types of all numeric keys in the - * CIMObjectPath match those of the corresponding keys within - * the CIMProperty[]. - * - * The need for this conversion mechanism arises from a deficiency in the - * CIM-XML specs, where the TYPE (sint8, uint8, etc.) is required for - * PROPERTY but not for KEYVALUE. If a CIMOM sends a KEYVALUE of - * VALUETYPE="numeric" without TYPE, the Java CIM Client assumes a type of - * sint64, uint64 or real64. This can cause problems (i.e. - * ClassCastException) down the line if the TYPE of the corresponding - * PROPERTY is different. - * - * @param pObjectPath - * Instance object path. - * @param pProps - * Instance properties. - * @return CIMInstance with numeric key data types synchronized. - */ - public static CIMInstance CIMInstanceWithSynchonizedNumericKeyDataTypes( - CIMObjectPath pObjectPath, CIMProperty[] pProps) { - CIMInstance inst = new CIMInstance(pObjectPath, pProps); - CIMProperty[] oldKeys = inst.getKeys(); - CIMProperty[] newKeys = new CIMProperty[oldKeys.length]; - boolean update = false; - - for (int i = 0; i < oldKeys.length; i++) { - CIMDataType oldType = oldKeys[i].getDataType(); - CIMProperty prop = inst.getProperty(oldKeys[i].getName()); - if (oldType != null && prop != null && prop.getDataType() != null - && !prop.getDataType().equals(oldType) && isNumericObject(oldType) - && isNumericObject(prop.getDataType())) { - update = true; - newKeys[i] = new CIMProperty(oldKeys[i].getName(), prop.getDataType(), - translateNumericObject(oldKeys[i].getValue(), oldType, prop.getDataType()), - oldKeys[i].isKey(), oldKeys[i].isPropagated(), oldKeys[i].getOriginClass()); - } else { - newKeys[i] = oldKeys[i]; - } - } - - return (update ? inst.deriveInstance(new CIMObjectPath(pObjectPath.getScheme(), pObjectPath - .getHost(), pObjectPath.getPort(), pObjectPath.getNamespace(), pObjectPath - .getObjectName(), newKeys)) : inst); - } - - private static boolean isNumericObject(CIMDataType type) { - switch (type.getType()) { - case CIMDataType.SINT8: - case CIMDataType.SINT16: - case CIMDataType.SINT32: - case CIMDataType.SINT64: - case CIMDataType.UINT8: - case CIMDataType.UINT16: - case CIMDataType.UINT32: - case CIMDataType.UINT64: - case CIMDataType.REAL32: - case CIMDataType.REAL64: - return true; - } - return false; - } - - private static Object translateNumericObject(Object oldValue, CIMDataType oldType, - CIMDataType newType) { - if (oldValue == null) return null; - - int from = oldType.getType(), to = newType.getType(); - long newInt = 0; - double newDec = 0; - Object o = null; - boolean useInt = true; - - switch (from) { - case CIMDataType.SINT8: - Byte b = (Byte) oldValue; - newInt = b.longValue(); - break; - case CIMDataType.SINT16: - Short s = (Short) oldValue; - newInt = s.longValue(); - break; - case CIMDataType.SINT32: - Integer i = (Integer) oldValue; - newInt = i.longValue(); - break; - case CIMDataType.SINT64: - Long l = (Long) oldValue; - newInt = l.longValue(); - break; - case CIMDataType.UINT8: - UnsignedInteger8 u8 = (UnsignedInteger8) oldValue; - newInt = u8.longValue(); - break; - case CIMDataType.UINT16: - UnsignedInteger16 u16 = (UnsignedInteger16) oldValue; - newInt = u16.longValue(); - break; - case CIMDataType.UINT32: - UnsignedInteger32 u32 = (UnsignedInteger32) oldValue; - newInt = u32.longValue(); - break; - case CIMDataType.UINT64: - UnsignedInteger64 u64 = (UnsignedInteger64) oldValue; - newInt = u64.longValue(); - break; - case CIMDataType.REAL32: - Float f = (Float) oldValue; - newDec = f.doubleValue(); - useInt = false; - break; - case CIMDataType.REAL64: - Double d = (Double) oldValue; - newDec = d.doubleValue(); - useInt = false; - break; - } - - switch (to) { - case CIMDataType.SINT8: - byte b = (byte) (useInt ? newInt : newDec); - o = new Byte(b); - break; - case CIMDataType.SINT16: - short s = (short) (useInt ? newInt : newDec); - o = new Short(s); - break; - case CIMDataType.SINT32: - int i = (int) (useInt ? newInt : newDec); - o = new Integer(i); - break; - case CIMDataType.SINT64: - long l = (long) (useInt ? newInt : newDec); - o = new Long(l); - break; - case CIMDataType.UINT8: - byte u8 = (byte) (useInt ? newInt : newDec); - o = new UnsignedInteger8(u8); - break; - case CIMDataType.UINT16: - short u16 = (short) (useInt ? newInt : newDec); - o = new UnsignedInteger16(u16); - break; - case CIMDataType.UINT32: - int u32 = (int) (useInt ? newInt : newDec); - o = new UnsignedInteger32(u32); - break; - case CIMDataType.UINT64: - long u64 = (long) (useInt ? newInt : newDec); - o = new UnsignedInteger64(BigInteger.valueOf(u64)); - break; - case CIMDataType.REAL32: - float f = (float) (useInt ? newInt : newDec); - o = new Float(f); - break; - case CIMDataType.REAL64: - double d = useInt ? (double) newInt : newDec; - o = new Double(d); - break; - } - - return o; - } -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Alexander Wolf-Reber, IBM, a.wolf-reber@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1565892 2006-12-06 lupusalex Make SBLIM client JSR48 compliant + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2964463 2010-03-08 blaschke-oss WBEMClient.initialize() throws wrong exception + * 2942520 2010-03-08 blaschke-oss IPv6 link local address with scope_id including a dot not supported + * 3513353 2012-03-30 blaschke-oss TCK: CIMDataType arrays must have length >= 1 + * 3513349 2012-03-31 blaschke-oss TCK: CIMDataType must not accept null string + * 3598613 2013-01-11 blaschke-oss different data type in cim instance and cim object path + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cim; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.math.BigInteger; +import java.net.URI; +import java.net.URISyntaxException; + +import org.metricshub.wbem.javax.cim.CIMDataType; +import org.metricshub.wbem.javax.cim.CIMInstance; +import org.metricshub.wbem.javax.cim.CIMObjectPath; +import org.metricshub.wbem.sblim.cimclient.internal.util.WBEMConstants; +import org.metricshub.wbem.javax.cim.CIMProperty; +import org.metricshub.wbem.javax.cim.UnsignedInteger16; +import org.metricshub.wbem.javax.cim.UnsignedInteger32; +import org.metricshub.wbem.javax.cim.UnsignedInteger64; +import org.metricshub.wbem.javax.cim.UnsignedInteger8; + +/** + * Class CIMHelper provides convenience methods that are missing from the + * official JSR48 API + * + */ +public abstract class CIMHelper { + + private CIMHelper() { + // no instances + } + + /** + * Creates a URI of a CIMOM from a given CIM object path, adding default + * port if port not parsable. + * + * @param pPath + * The CIM object path. + * @return The URI. + * @throws URISyntaxException + */ + public static URI createCimomUri(CIMObjectPath pPath) throws URISyntaxException { + String scheme = pPath.getScheme(); + String host = pPath.getHost(); + int port = WBEMConstants.DEFAULT_WBEM_PORT; + try { + port = Integer.parseInt(pPath.getPort()); + } catch (NumberFormatException e) { + // stuck with default port + } + return new URI(scheme, null, host, port, WBEMConstants.CIMOM_PATH, null, null); + } + + /** + * Creates a URI of a CIMOM from a given URI, adding default port if port + * not specified. + * + * @param pUri + * The URI. + * @return The URI. + * @throws URISyntaxException + */ + public static URI createCimomUri(URI pUri) throws URISyntaxException { + String scheme = pUri.getScheme(); + String host = pUri.getHost(); + int port = pUri.getPort(); + if (port == -1) { + // stuck with default port + port = WBEMConstants.DEFAULT_WBEM_PORT; + } + return new URI(scheme, null, host, port, WBEMConstants.CIMOM_PATH, null, null); + } + + private static CIMDataType CIMScalarDataTypes[] = { + /* 00 */CIMDataType.UINT8_T, + /* 01 */CIMDataType.SINT8_T, + /* 02 */CIMDataType.UINT16_T, + /* 03 */CIMDataType.SINT16_T, + /* 04 */CIMDataType.UINT32_T, + /* 05 */CIMDataType.SINT32_T, + /* 06 */CIMDataType.UINT64_T, + /* 07 */CIMDataType.SINT64_T, + /* 08 */CIMDataType.STRING_T, + /* 09 */CIMDataType.BOOLEAN_T, + /* 10 */CIMDataType.REAL32_T, + /* 11 */CIMDataType.REAL64_T, + /* 12 */CIMDataType.DATETIME_T, + /* 13 */CIMDataType.CHAR16_T, + /* 14 */new CIMDataType(""), + /* 15 */CIMDataType.OBJECT_T, + /* 16 */null, + /* 17 */CIMDataType.CLASS_T }; + + /** + * Returns the CIMDataType of a scalar of the specified data type. This + * should be used in lieu of "new CIMDataType(pType)" which is not supported + * by the JSR48 standard. + * + * @param pType + * Data type. + * @return CIMDataType corresponding to data type. + */ + public static CIMDataType ScalarDataType(int pType) { + if (pType < 0 || pType >= CIMScalarDataTypes.length) return null; + return CIMScalarDataTypes[pType]; + } + + private static CIMDataType CIMArrayDataTypes[] = { + /* 00 */CIMDataType.UINT8_ARRAY_T, + /* 01 */CIMDataType.SINT8_ARRAY_T, + /* 02 */CIMDataType.UINT16_ARRAY_T, + /* 03 */CIMDataType.SINT16_ARRAY_T, + /* 04 */CIMDataType.UINT32_ARRAY_T, + /* 05 */CIMDataType.SINT32_ARRAY_T, + /* 06 */CIMDataType.UINT64_ARRAY_T, + /* 07 */CIMDataType.SINT64_ARRAY_T, + /* 08 */CIMDataType.STRING_ARRAY_T, + /* 09 */CIMDataType.BOOLEAN_ARRAY_T, + /* 10 */CIMDataType.REAL32_ARRAY_T, + /* 11 */CIMDataType.REAL64_ARRAY_T, + /* 12 */CIMDataType.DATETIME_ARRAY_T, + /* 13 */CIMDataType.CHAR16_ARRAY_T, + /* 14 */new CIMDataType("", 0), + /* 15 */CIMDataType.OBJECT_ARRAY_T, + /* 16 */null, + /* 17 */CIMDataType.CLASS_ARRAY_T }; + + /** + * Returns the CIMDataType of an unbounded array of the specified data type. + * This should be used in lieu of "new CIMDataType(pType,0)" which is not + * supported by the JSR48 standard. + * + * @param pType + * Data type. + * @return CIMDataType corresponding to data type. + */ + public static CIMDataType UnboundedArrayDataType(int pType) { + if (pType < 0 || pType >= CIMArrayDataTypes.length) return null; + return CIMArrayDataTypes[pType]; + } + + /** + * CIMInstanceWithSynchonizedNumericKeyDataTypes returns a + * CIMInstance where the data types of all numeric keys in the + * CIMObjectPath match those of the corresponding keys within + * the CIMProperty[]. + * + * The need for this conversion mechanism arises from a deficiency in the + * CIM-XML specs, where the TYPE (sint8, uint8, etc.) is required for + * PROPERTY but not for KEYVALUE. If a CIMOM sends a KEYVALUE of + * VALUETYPE="numeric" without TYPE, the Java CIM Client assumes a type of + * sint64, uint64 or real64. This can cause problems (i.e. + * ClassCastException) down the line if the TYPE of the corresponding + * PROPERTY is different. + * + * @param pObjectPath + * Instance object path. + * @param pProps + * Instance properties. + * @return CIMInstance with numeric key data types synchronized. + */ + public static CIMInstance CIMInstanceWithSynchonizedNumericKeyDataTypes( + CIMObjectPath pObjectPath, CIMProperty[] pProps) { + CIMInstance inst = new CIMInstance(pObjectPath, pProps); + CIMProperty[] oldKeys = inst.getKeys(); + CIMProperty[] newKeys = new CIMProperty[oldKeys.length]; + boolean update = false; + + for (int i = 0; i < oldKeys.length; i++) { + CIMDataType oldType = oldKeys[i].getDataType(); + CIMProperty prop = inst.getProperty(oldKeys[i].getName()); + if (oldType != null && prop != null && prop.getDataType() != null + && !prop.getDataType().equals(oldType) && isNumericObject(oldType) + && isNumericObject(prop.getDataType())) { + update = true; + newKeys[i] = new CIMProperty(oldKeys[i].getName(), prop.getDataType(), + translateNumericObject(oldKeys[i].getValue(), oldType, prop.getDataType()), + oldKeys[i].isKey(), oldKeys[i].isPropagated(), oldKeys[i].getOriginClass()); + } else { + newKeys[i] = oldKeys[i]; + } + } + + return (update ? inst.deriveInstance(new CIMObjectPath(pObjectPath.getScheme(), pObjectPath + .getHost(), pObjectPath.getPort(), pObjectPath.getNamespace(), pObjectPath + .getObjectName(), newKeys)) : inst); + } + + private static boolean isNumericObject(CIMDataType type) { + switch (type.getType()) { + case CIMDataType.SINT8: + case CIMDataType.SINT16: + case CIMDataType.SINT32: + case CIMDataType.SINT64: + case CIMDataType.UINT8: + case CIMDataType.UINT16: + case CIMDataType.UINT32: + case CIMDataType.UINT64: + case CIMDataType.REAL32: + case CIMDataType.REAL64: + return true; + } + return false; + } + + private static Object translateNumericObject(Object oldValue, CIMDataType oldType, + CIMDataType newType) { + if (oldValue == null) return null; + + int from = oldType.getType(), to = newType.getType(); + long newInt = 0; + double newDec = 0; + Object o = null; + boolean useInt = true; + + switch (from) { + case CIMDataType.SINT8: + Byte b = (Byte) oldValue; + newInt = b.longValue(); + break; + case CIMDataType.SINT16: + Short s = (Short) oldValue; + newInt = s.longValue(); + break; + case CIMDataType.SINT32: + Integer i = (Integer) oldValue; + newInt = i.longValue(); + break; + case CIMDataType.SINT64: + Long l = (Long) oldValue; + newInt = l.longValue(); + break; + case CIMDataType.UINT8: + UnsignedInteger8 u8 = (UnsignedInteger8) oldValue; + newInt = u8.longValue(); + break; + case CIMDataType.UINT16: + UnsignedInteger16 u16 = (UnsignedInteger16) oldValue; + newInt = u16.longValue(); + break; + case CIMDataType.UINT32: + UnsignedInteger32 u32 = (UnsignedInteger32) oldValue; + newInt = u32.longValue(); + break; + case CIMDataType.UINT64: + UnsignedInteger64 u64 = (UnsignedInteger64) oldValue; + newInt = u64.longValue(); + break; + case CIMDataType.REAL32: + Float f = (Float) oldValue; + newDec = f.doubleValue(); + useInt = false; + break; + case CIMDataType.REAL64: + Double d = (Double) oldValue; + newDec = d.doubleValue(); + useInt = false; + break; + } + + switch (to) { + case CIMDataType.SINT8: + byte b = (byte) (useInt ? newInt : newDec); + o = new Byte(b); + break; + case CIMDataType.SINT16: + short s = (short) (useInt ? newInt : newDec); + o = new Short(s); + break; + case CIMDataType.SINT32: + int i = (int) (useInt ? newInt : newDec); + o = new Integer(i); + break; + case CIMDataType.SINT64: + long l = (long) (useInt ? newInt : newDec); + o = new Long(l); + break; + case CIMDataType.UINT8: + byte u8 = (byte) (useInt ? newInt : newDec); + o = new UnsignedInteger8(u8); + break; + case CIMDataType.UINT16: + short u16 = (short) (useInt ? newInt : newDec); + o = new UnsignedInteger16(u16); + break; + case CIMDataType.UINT32: + int u32 = (int) (useInt ? newInt : newDec); + o = new UnsignedInteger32(u32); + break; + case CIMDataType.UINT64: + long u64 = (long) (useInt ? newInt : newDec); + o = new UnsignedInteger64(BigInteger.valueOf(u64)); + break; + case CIMDataType.REAL32: + float f = (float) (useInt ? newInt : newDec); + o = new Float(f); + break; + case CIMDataType.REAL64: + double d = useInt ? (double) newInt : newDec; + o = new Double(d); + break; + } + + return o; + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cim/CIMInstanceBuilder.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cim/CIMInstanceBuilder.java similarity index 83% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cim/CIMInstanceBuilder.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cim/CIMInstanceBuilder.java index 5885655..4413836 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cim/CIMInstanceBuilder.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cim/CIMInstanceBuilder.java @@ -1,156 +1,154 @@ -/* - (C) Copyright IBM Corp. 2006, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-11-30 ebak Make SBLIM client JSR48 compliant - * 1669961 2006-04-16 lupusalex CIMTypedElement.getType() =>getDataType() - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors - * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cim; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.ArrayList; -import java.util.List; - -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; -import org.sentrysoftware.wbem.javax.cim.CIMProperty; - -/** - * Class CIMInstanceBuilder provides help for CIMInstance(CIMObjectPath, - * CIMProperty[]) constructor.
      - *
      - * CIMObjectPath param has to contain the key properties only.
      - * ( VALUE.NAMEDINSTANCE->INSTANCENAME->KEYBINDING )
      - * CIMProperty[] param has to contain all properties, including key properties.
      - * ( VALUE.NAMEDINSTANCE->INSTANCE->PROPERTY* )
      - * The implementation merges the properties from both params.
      - * From CIMObjectPath's keys only the type and value information is considered.
      - * - */ -public class CIMInstanceBuilder { - - private CIMProperty[] iProperties; - - private static final Object[] EMPTY_RPOP_A = new CIMProperty[0]; - - /** - * Ctor. - * - * @param pPath - * @param pProps - * @throws IllegalArgumentException - */ - public CIMInstanceBuilder(CIMObjectPath pPath, CIMProperty[] pProps) - throws IllegalArgumentException { - this.iProperties = pProps != null ? pProps : new CIMProperty[0]; - CIMElementSorter.sort(this.iProperties); - addPathKeys(pPath); - } - - /** - * Extends the keys of the passed CIMObjectPath. - * - * @param pPath - * @return the new CIMObjectPath - */ - public CIMObjectPath setKeys(CIMObjectPath pPath) { - List> keys = new ArrayList>(); - for (int i = 0; i < this.iProperties.length; ++i) { - CIMProperty prop = this.iProperties[i]; - if (prop.isKey()) keys.add(prop); - } - - /* - * CIMObjectPath( String scheme, String host, String port, String - * namespace, String objectName, CIMProperty[] keys ) - */ - return new CIMObjectPath(pPath.getScheme(), pPath.getHost(), pPath.getPort(), pPath - .getNamespace(), pPath.getObjectName(), (CIMProperty[]) keys.toArray(EMPTY_RPOP_A)); - } - - /** - * getAllPropertis - * - * @return all properties in an ordered way - */ - public CIMProperty[] getAllPropertis() { - return this.iProperties; - } - - private void addPathKeys(CIMObjectPath pPath) throws IllegalArgumentException { - CIMProperty[] keys = pPath.getKeys(); - for (int i = 0; i < keys.length; i++) { - CIMProperty key = keys[i]; - int pos = CIMElementSorter.findIdx(this.iProperties, key.getName()); - if (pos < 0) { - pos = -pos - 1; - CIMProperty[] newArray = new CIMProperty[this.iProperties.length + 1]; - System.arraycopy(this.iProperties, 0, newArray, 0, pos); - newArray[pos] = key; - System.arraycopy(this.iProperties, pos, newArray, pos + 1, this.iProperties.length - - pos); - this.iProperties = newArray; - } else { - CIMProperty prop = this.iProperties[pos]; - // typeAndValueCheck(key, prop); - if (!prop.isKey()) this.iProperties[pos] = mkKey(prop); - } - } - } - - private static CIMProperty mkKey(CIMProperty pProp) { - return new CIMProperty(pProp.getName(), pProp.getDataType(), pProp.getValue(), - true, pProp.isPropagated(), pProp.getOriginClass()); - } - - /* - * private static void typeAndValueCheck(CIMProperty pPathProp, CIMProperty - * pArrayProp) throws IllegalArgumentException { CIMDataType pType = - * pPathProp.getDataType(), aType = pArrayProp.getDataType(); if (pType == - * null ? aType != null : pType.getType() != aType.getType()) throw new - * IllegalArgumentException( pPathProp.getName() + " property presents in - * CIMObjectPath param and CIMProperty[] param " + "with different types!"); - * Object pValue = pPathProp.getValue(), aValue = pArrayProp.getValue(); if - * (pValue == null ? aValue != null : !pValue.equals(aValue)) throw new - * IllegalArgumentException( pPathProp.getName() + " property conatins - * different values in CIMObjectPath and " + "CIMProperty params!"); } - */ - -} +/* + (C) Copyright IBM Corp. 2006, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-11-30 ebak Make SBLIM client JSR48 compliant + * 1669961 2006-04-16 lupusalex CIMTypedElement.getType() =>getDataType() + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors + * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cim; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.ArrayList; +import java.util.List; + +import org.metricshub.wbem.javax.cim.CIMObjectPath; +import org.metricshub.wbem.javax.cim.CIMProperty; + +/** + * Class CIMInstanceBuilder provides help for CIMInstance(CIMObjectPath, + * CIMProperty[]) constructor.
      + *
      + * CIMObjectPath param has to contain the key properties only.
      + * ( VALUE.NAMEDINSTANCE->INSTANCENAME->KEYBINDING )
      + * CIMProperty[] param has to contain all properties, including key properties.
      + * ( VALUE.NAMEDINSTANCE->INSTANCE->PROPERTY* )
      + * The implementation merges the properties from both params.
      + * From CIMObjectPath's keys only the type and value information is considered.
      + * + */ +public class CIMInstanceBuilder { + + private CIMProperty[] iProperties; + + private static final Object[] EMPTY_RPOP_A = new CIMProperty[0]; + + /** + * Ctor. + * + * @param pPath + * @param pProps + * @throws IllegalArgumentException + */ + public CIMInstanceBuilder(CIMObjectPath pPath, CIMProperty[] pProps) + throws IllegalArgumentException { + this.iProperties = pProps != null ? pProps : new CIMProperty[0]; + CIMElementSorter.sort(this.iProperties); + addPathKeys(pPath); + } + + /** + * Extends the keys of the passed CIMObjectPath. + * + * @param pPath + * @return the new CIMObjectPath + */ + public CIMObjectPath setKeys(CIMObjectPath pPath) { + List> keys = new ArrayList>(); + for (int i = 0; i < this.iProperties.length; ++i) { + CIMProperty prop = this.iProperties[i]; + if (prop.isKey()) keys.add(prop); + } + + /* + * CIMObjectPath( String scheme, String host, String port, String + * namespace, String objectName, CIMProperty[] keys ) + */ + return new CIMObjectPath(pPath.getScheme(), pPath.getHost(), pPath.getPort(), pPath + .getNamespace(), pPath.getObjectName(), (CIMProperty[]) keys.toArray(EMPTY_RPOP_A)); + } + + /** + * getAllPropertis + * + * @return all properties in an ordered way + */ + public CIMProperty[] getAllPropertis() { + return this.iProperties; + } + + private void addPathKeys(CIMObjectPath pPath) throws IllegalArgumentException { + CIMProperty[] keys = pPath.getKeys(); + for (int i = 0; i < keys.length; i++) { + CIMProperty key = keys[i]; + int pos = CIMElementSorter.findIdx(this.iProperties, key.getName()); + if (pos < 0) { + pos = -pos - 1; + CIMProperty[] newArray = new CIMProperty[this.iProperties.length + 1]; + System.arraycopy(this.iProperties, 0, newArray, 0, pos); + newArray[pos] = key; + System.arraycopy(this.iProperties, pos, newArray, pos + 1, this.iProperties.length + - pos); + this.iProperties = newArray; + } else { + CIMProperty prop = this.iProperties[pos]; + // typeAndValueCheck(key, prop); + if (!prop.isKey()) this.iProperties[pos] = mkKey(prop); + } + } + } + + private static CIMProperty mkKey(CIMProperty pProp) { + return new CIMProperty(pProp.getName(), pProp.getDataType(), pProp.getValue(), + true, pProp.isPropagated(), pProp.getOriginClass()); + } + + /* + * private static void typeAndValueCheck(CIMProperty pPathProp, CIMProperty + * pArrayProp) throws IllegalArgumentException { CIMDataType pType = + * pPathProp.getDataType(), aType = pArrayProp.getDataType(); if (pType == + * null ? aType != null : pType.getType() != aType.getType()) throw new + * IllegalArgumentException( pPathProp.getName() + " property presents in + * CIMObjectPath param and CIMProperty[] param " + "with different types!"); + * Object pValue = pPathProp.getValue(), aValue = pArrayProp.getValue(); if + * (pValue == null ? aValue != null : !pValue.equals(aValue)) throw new + * IllegalArgumentException( pPathProp.getName() + " property conatins + * different values in CIMObjectPath and " + "CIMProperty params!"); } + */ + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cim/CIMOctetString.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cim/CIMOctetString.java similarity index 91% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cim/CIMOctetString.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cim/CIMOctetString.java index 0cca4a0..f75d9a3 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cim/CIMOctetString.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cim/CIMOctetString.java @@ -1,484 +1,482 @@ -/* - (C) Copyright IBM Corp. 2011 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Dave Blaschke, IBM, blaschke@us.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 3397922 2011-08-30 blaschke-oss support OctetString - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cim; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.UnsignedInteger8; - -/** - * This class represents a CIM octet string, or length-prefixed string, where - * the length is four octets (32 bits) AND includes the four octets it occupies. - * In other words, the length of the octet string is the number of characters in - * the string plus four. There are three possible representations:
      - *
      - * 1) Byte array - This is an array of UnsignedInteger8 (unit8) objects. The - * first four bytes contain the length, so the ASCII string "DEB" would be - * represented as { 0x00, 0x00, 0x00, 0x07, 0x44, 0x45, 0x42 }
      - *
      - * 2) Hexadecimal string - This is a string of hexadecimal digits. The four - * bytes after the initial "0x" contain the length, so the ASCII string "DEB" - * would be represented as "0x00000007444542".
      - *
      - * 3) ASCII string
      - *
      - * One of these representations is passed into a constructor. The other - * representations are created on demand when a get() method is invoked or when - * the equals() method is invoked and the two octet strings have no - * representations in common. - */ -public class CIMOctetString { - - private UnsignedInteger8 iBytes[]; - - private String iASCIIString; - - private char iReplacementChar; // 0xFF indicates ASCII constructor used - - private String iHexString; - - private int iLength; - - /** - * Constructs a CIMOctetString from the given byte array. - * - * @param pBytes - * Byte array representation of octet string. - * @throws IllegalArgumentException - */ - public CIMOctetString(UnsignedInteger8 pBytes[]) throws IllegalArgumentException { - // Minimum (empty) byte array is { 0x00 0x00 0x00 0x04 } - if (pBytes == null || pBytes.length < 4) throw new IllegalArgumentException( - "Array of bytes must contain at least four bytes"); - - // Verify there are no null entries in byte array - for (int i = pBytes.length - 1; i >= 0; i--) - if (pBytes[i] == null) throw new IllegalArgumentException( - "Array of bytes must not contain any null bytes"); - - // Calculate length - this.iLength = pBytes[3].byteValue() + (pBytes[2].byteValue() * 0x100) - + (pBytes[1].byteValue() * 0x10000) + (pBytes[0].byteValue() * 0x1000000); - - // Verify calculated length matches actual length - if (this.iLength != pBytes.length) throw new IllegalArgumentException( - "Array of bytes contains invalid length: found " + this.iLength + ", expected " - + pBytes.length); - - // Save byte array in new object - this.iBytes = new UnsignedInteger8[this.iLength]; - for (int i = this.iLength - 1; i >= 0; i--) - this.iBytes[i] = pBytes[i]; - } - - /** - * Constructs a CIMOctetString from the given string. - * - * @param pString - * String representation of octet string. - * @param pIsHex - * true if string is hexadecimal string, - * false if string is ASCII string. - * - * @throws IllegalArgumentException - */ - public CIMOctetString(String pString, boolean pIsHex) throws IllegalArgumentException { - if (pString == null) throw new IllegalArgumentException("String cannot be null"); - - if (pIsHex) { - // Minimum (empty) hexadecimal string is "0x00000004" - if (pString.length() < 10) throw new IllegalArgumentException( - "Hexadecimal string must contain \"0x\" and at least four pairs of hex digits"); - - // Verify hexadecimal string starts with "0x" - if (pString.charAt(0) != '0' || pString.charAt(1) != 'x') throw new IllegalArgumentException( - "Hexadecimal string must begin with \"0x\""); - - // Calculate length - try { - this.iLength = Integer.parseInt(pString.substring(2, 10), 16); - } catch (NumberFormatException e) { - throw new IllegalArgumentException( - "Hexadecimal string length could not be parsed: " + e.toString()); - } - - // Verify calculated length matches actual length - if ((this.iLength * 2) + 2 != pString.length()) throw new IllegalArgumentException( - "Hexadecimal string contains invalid length: found " + this.iLength - + ", expected " + ((pString.length() - 2 / 2))); - - // Verify remainder of hexadecimal string contains only hexadecimal - // digits - for (int i = pString.length() - 1; i >= 10; i--) { - char ch = pString.charAt(i); - if (!((ch >= '0' && ch <= '9') || (ch >= 'a' && ch <= 'f') || (ch >= 'A' && ch <= 'F'))) throw new IllegalArgumentException( - "Hexadecimal string could not be parsed, invalid character \'" + ch - + "\' at index " + i); - } - - // Save hexadecimal string in new object - this.iHexString = new String(pString); - } else { - // Calculate length - this.iLength = pString.length() + 4; - - // Save ASCII string in new object and indicate constructor used - this.iASCIIString = new String(pString); - this.iReplacementChar = 0xFF; - } - } - - /** - * Takes a CIM octet string and returns true if it is equal to - * this CIM octet string. Otherwise, it returns false. Two - * octet strings are considered equal if all of their common representations - * are equal. If the octet strings have no representations in common, this - * method will build the missing one, starting with byte array and then - * hexadecmial string. - * - * NOTE: The ASCII string representation is only considered if both octet - * strings were constructed with an ASCII string. - * - * @param pObj - * The object to be compared a CIM element. - * @return true if the specified CIM octet string equals this - * CIM octet string, false otherwise. - */ - @Override - public synchronized boolean equals(Object pObj) { - // Verify parameter is CIMOctetString instance - if (!(pObj instanceof CIMOctetString)) return false; - - CIMOctetString that = (CIMOctetString) pObj; - int numCompares = 0; - - // Verify lengths are same - if (this.iLength != that.iLength) return false; - - // Verify byte arrays match if both non-null - if (this.iBytes != null && that.iBytes != null) { - for (int i = this.iLength - 1; i >= 0; i--) - if (this.iBytes[i].byteValue() != that.iBytes[i].byteValue()) return false; - numCompares++; - } - - // Verify hexadecimal strings match if both non-null - if (this.iHexString != null && that.iHexString != null) { - if (!this.iHexString.equalsIgnoreCase(that.iHexString)) return false; - numCompares++; - } - - // Verify ASCII strings match if both non-null - if (this.iASCIIString != null && that.iASCIIString != null - && this.iReplacementChar == that.iReplacementChar) { - if (!this.iASCIIString.equalsIgnoreCase(that.iASCIIString)) return false; - numCompares++; - } - - // Octet strings equal if at least one representation equal - if (numCompares > 0) return true; - - // At this point, the two CIMOctetString instances have no - // representations in common - time to make one - - if (this.iBytes != null && that.iBytes == null) { - that.getBytes(); - if (this.iBytes != null && that.iBytes != null) { - for (int i = this.iLength - 1; i >= 0; i--) - if (this.iBytes[i].byteValue() != that.iBytes[i].byteValue()) return false; - numCompares++; - } - } - - // Octet strings equal if byte arrays equal - if (numCompares > 0) return true; - - if (this.iBytes == null && that.iBytes != null) { - getBytes(); - if (this.iBytes != null && that.iBytes != null) { - for (int i = this.iLength - 1; i >= 0; i--) - if (this.iBytes[i].byteValue() != that.iBytes[i].byteValue()) return false; - numCompares++; - } - } - - // Octet strings equal if byte arrays equal - if (numCompares > 0) return true; - - if (this.iHexString != null && that.iHexString == null) { - that.getHexString(); - if (this.iHexString != null && that.iHexString != null) { - if (!this.iHexString.equalsIgnoreCase(that.iHexString)) return false; - numCompares++; - } - } - - // Octet strings equal if byte arrays equal - if (numCompares > 0) return true; - - if (this.iHexString == null && that.iHexString != null) { - getHexString(); - if (this.iHexString != null && that.iHexString != null) { - if (!this.iHexString.equalsIgnoreCase(that.iHexString)) return false; - numCompares++; - } - } - - // Octet strings equal if byte arrays equal - if (numCompares > 0) return true; - - return false; - } - - /** - * Returns ASCII string representation of octet string with non-printable - * characters replaced by pReplacementChar. If the ASCII string - * has not yet been created, it is created from the byte array or - * hexadecimal string. - * - * @param pReplacementChar - * Replacement character for non-printable characters which must - * be between 0x20 and 0x7E, inclusive. - * @return ASCII string representation of octet string. - */ - public synchronized String getASCIIString(char pReplacementChar) { - // If ASCII string constructor used, return original string - if (this.iASCIIString != null && this.iReplacementChar == 0xFF) return this.iASCIIString; - - // Verify replacement character is printable - if (pReplacementChar <= 0x1F || pReplacementChar >= 0x7F) throw new IllegalArgumentException( - "Replacement character not printable"); - - // If we already did this once, return previous string - if (this.iASCIIString != null && this.iReplacementChar == pReplacementChar) return this.iASCIIString; - - // Construct new ASCII string - StringBuilder str = new StringBuilder(""); - if (this.iBytes != null) { - for (int i = 4; i < this.iBytes.length; i++) { - char ch = (char) this.iBytes[i].byteValue(); - if (ch <= 0x1F || ch >= 0x7F) str.append(pReplacementChar); - else str.append(ch); - } - } else /* (this.iHexString != null) */{ - for (int i = 10; i < this.iHexString.length(); i += 2) { - char ch = (char) Integer.parseInt(this.iHexString.substring(i, i + 2), 16); - if (ch <= 0x1F || ch >= 0x7F) str.append(pReplacementChar); - else str.append(ch); - } - } - - // Save ASCII string in new object and indicate which replacement - // character used - this.iASCIIString = new String(str); - this.iReplacementChar = pReplacementChar; - - return this.iASCIIString; - } - - /** - * Returns byte array representation of octet string. If the byte array has - * not yet been created, it is created from the hexadecimal string or ASCII - * string. - * - * @return Byte array representation of octet string. - */ - public synchronized UnsignedInteger8[] getBytes() { - if (this.iBytes != null) return this.iBytes; - - if (this.iHexString != null) { - convertHexStringToBytes(); - } else /* if (this.iASCIIString != null) */{ - convertASCIIStringToBytes(); - } - - return this.iBytes; - } - - /** - * Returns hexadecimal string representation of octet string. If the - * hexadecimal string has not yet been created, it is created from the byte - * array or ASCII string. - * - * @return Hexadecimal string representation of octet string. - */ - public synchronized String getHexString() { - if (this.iHexString != null) return this.iHexString; - - if (this.iBytes != null) { - convertBytesToHexString(); - } else /* if (this.iASCIIString != null) */{ - convertASCIIStringToHexString(); - } - - return this.iHexString; - } - - /** - * Returns hash code value for octet string. - * - * @return Hash code value for octet string. - */ - @Override - public int hashCode() { - return toString().toLowerCase().hashCode(); - } - - /** - * Returns length of octet string, where length is number of octets plus - * four. - * - * @return Length of octet string. - */ - public int length() { - return this.iLength; - } - - /** - * Returns string representation of octet string. - * - * @return String representation of octet string. - */ - @Override - public String toString() { - return getHexString(); - } - - private void convertBytesToHexString() { - // Start with "0x" - StringBuilder str = new StringBuilder("0x"); - - // Append length - String len = Integer.toHexString(this.iLength); - for (int i = 8 - len.length(); i > 0; i--) - str.append('0'); - str.append(len); - - // Append string - for (int i = 4; i < this.iLength; i++) { - String octet = Integer.toHexString(this.iBytes[i].intValue()); - if (octet.length() == 1) str.append('0'); - str.append(octet); - } - - // Save hexadecimal string in new object - this.iHexString = new String(str); - - // debug("convertBytesToHexString: from {" + toBytesString() + "} to \"" - // + this.iHexString + "\""); - } - - private void convertHexStringToBytes() { - // Save byte array in new object - this.iBytes = new UnsignedInteger8[this.iLength]; - - // Convert each octet in hexadecimal string to byte - for (int idxByte = 0, idxStr = 2, len = this.iHexString.length(); idxStr < len; idxByte++, idxStr += 2) { - short s; - try { - s = Short.parseShort(this.iHexString.substring(idxStr, idxStr + 2), 16); - } catch (NumberFormatException e) { - throw new IllegalArgumentException("Hex string length could not be parsed: " - + e.toString()); - } - this.iBytes[idxByte] = new UnsignedInteger8(s); - } - - // debug("convertHexStringToBytes: from \"" + this.iHexString + - // "\" to {" + toBytesString() + "}"); - } - - private void convertASCIIStringToBytes() { - // Save byte array in new object - this.iBytes = new UnsignedInteger8[this.iLength]; - - // Convert length - this.iBytes[0] = new UnsignedInteger8((short) ((this.iLength >> 24) & 0xFF)); - this.iBytes[1] = new UnsignedInteger8((short) ((this.iLength >> 16) & 0xFF)); - this.iBytes[2] = new UnsignedInteger8((short) ((this.iLength >> 8) & 0xFF)); - this.iBytes[3] = new UnsignedInteger8((short) (this.iLength & 0xFF)); - - // Convert each character in ASCII string to byte - for (int idxStr = 0, idxByte = 4; idxStr < this.iASCIIString.length(); idxStr++, idxByte++) - this.iBytes[idxByte] = new UnsignedInteger8((short) (this.iASCIIString.charAt(idxStr))); - - // debug("convertASCIIStringToBytes: from \"" + this.iASCIIString + - // "\" to {" + toBytesString() + "}"); - } - - private void convertASCIIStringToHexString() { - // Start with "0x" - StringBuilder str = new StringBuilder("0x"); - - // Append length - String len = Integer.toHexString(this.iLength); - for (int i = 8 - len.length(); i > 0; i--) - str.append('0'); - str.append(len); - - // Append string - for (int idxAsc = 0, idxHex = 10; idxAsc < this.iASCIIString.length(); idxAsc++, idxHex++) { - String octet = Integer.toHexString((this.iASCIIString.charAt(idxAsc))); - if (octet.length() == 1) str.append('0'); - str.append(octet); - } - - // Save hexadecimal string in new object - this.iHexString = new String(str); - - // debug("convertASCIIStringToHexString: from \"" + this.iASCIIString + - // "\" to \"" + this.iHexString + "\""); - } - - // private String toBytesString() { - // StringBuilder str = new StringBuilder(); - // - // for (int i = 0; i < this.iLength; i++) { - // String octet = Integer.toHexString((this.iBytes[i].intValue())); - // if (i > 0) str.append(' '); - // if (octet.length() == 1) str.append('0'); - // str.append(octet); - // } - // return new String(str); - // } - - // private void debug(String str) { - // System.out.println(str); - // } -} +/* + (C) Copyright IBM Corp. 2011 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Dave Blaschke, IBM, blaschke@us.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 3397922 2011-08-30 blaschke-oss support OctetString + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cim; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.UnsignedInteger8; + +/** + * This class represents a CIM octet string, or length-prefixed string, where + * the length is four octets (32 bits) AND includes the four octets it occupies. + * In other words, the length of the octet string is the number of characters in + * the string plus four. There are three possible representations:
      + *
      + * 1) Byte array - This is an array of UnsignedInteger8 (unit8) objects. The + * first four bytes contain the length, so the ASCII string "DEB" would be + * represented as { 0x00, 0x00, 0x00, 0x07, 0x44, 0x45, 0x42 }
      + *
      + * 2) Hexadecimal string - This is a string of hexadecimal digits. The four + * bytes after the initial "0x" contain the length, so the ASCII string "DEB" + * would be represented as "0x00000007444542".
      + *
      + * 3) ASCII string
      + *
      + * One of these representations is passed into a constructor. The other + * representations are created on demand when a get() method is invoked or when + * the equals() method is invoked and the two octet strings have no + * representations in common. + */ +public class CIMOctetString { + + private UnsignedInteger8 iBytes[]; + + private String iASCIIString; + + private char iReplacementChar; // 0xFF indicates ASCII constructor used + + private String iHexString; + + private int iLength; + + /** + * Constructs a CIMOctetString from the given byte array. + * + * @param pBytes + * Byte array representation of octet string. + * @throws IllegalArgumentException + */ + public CIMOctetString(UnsignedInteger8 pBytes[]) throws IllegalArgumentException { + // Minimum (empty) byte array is { 0x00 0x00 0x00 0x04 } + if (pBytes == null || pBytes.length < 4) throw new IllegalArgumentException( + "Array of bytes must contain at least four bytes"); + + // Verify there are no null entries in byte array + for (int i = pBytes.length - 1; i >= 0; i--) + if (pBytes[i] == null) throw new IllegalArgumentException( + "Array of bytes must not contain any null bytes"); + + // Calculate length + this.iLength = pBytes[3].byteValue() + (pBytes[2].byteValue() * 0x100) + + (pBytes[1].byteValue() * 0x10000) + (pBytes[0].byteValue() * 0x1000000); + + // Verify calculated length matches actual length + if (this.iLength != pBytes.length) throw new IllegalArgumentException( + "Array of bytes contains invalid length: found " + this.iLength + ", expected " + + pBytes.length); + + // Save byte array in new object + this.iBytes = new UnsignedInteger8[this.iLength]; + for (int i = this.iLength - 1; i >= 0; i--) + this.iBytes[i] = pBytes[i]; + } + + /** + * Constructs a CIMOctetString from the given string. + * + * @param pString + * String representation of octet string. + * @param pIsHex + * true if string is hexadecimal string, + * false if string is ASCII string. + * + * @throws IllegalArgumentException + */ + public CIMOctetString(String pString, boolean pIsHex) throws IllegalArgumentException { + if (pString == null) throw new IllegalArgumentException("String cannot be null"); + + if (pIsHex) { + // Minimum (empty) hexadecimal string is "0x00000004" + if (pString.length() < 10) throw new IllegalArgumentException( + "Hexadecimal string must contain \"0x\" and at least four pairs of hex digits"); + + // Verify hexadecimal string starts with "0x" + if (pString.charAt(0) != '0' || pString.charAt(1) != 'x') throw new IllegalArgumentException( + "Hexadecimal string must begin with \"0x\""); + + // Calculate length + try { + this.iLength = Integer.parseInt(pString.substring(2, 10), 16); + } catch (NumberFormatException e) { + throw new IllegalArgumentException( + "Hexadecimal string length could not be parsed: " + e.toString()); + } + + // Verify calculated length matches actual length + if ((this.iLength * 2) + 2 != pString.length()) throw new IllegalArgumentException( + "Hexadecimal string contains invalid length: found " + this.iLength + + ", expected " + ((pString.length() - 2 / 2))); + + // Verify remainder of hexadecimal string contains only hexadecimal + // digits + for (int i = pString.length() - 1; i >= 10; i--) { + char ch = pString.charAt(i); + if (!((ch >= '0' && ch <= '9') || (ch >= 'a' && ch <= 'f') || (ch >= 'A' && ch <= 'F'))) throw new IllegalArgumentException( + "Hexadecimal string could not be parsed, invalid character \'" + ch + + "\' at index " + i); + } + + // Save hexadecimal string in new object + this.iHexString = new String(pString); + } else { + // Calculate length + this.iLength = pString.length() + 4; + + // Save ASCII string in new object and indicate constructor used + this.iASCIIString = new String(pString); + this.iReplacementChar = 0xFF; + } + } + + /** + * Takes a CIM octet string and returns true if it is equal to + * this CIM octet string. Otherwise, it returns false. Two + * octet strings are considered equal if all of their common representations + * are equal. If the octet strings have no representations in common, this + * method will build the missing one, starting with byte array and then + * hexadecmial string. + * + * NOTE: The ASCII string representation is only considered if both octet + * strings were constructed with an ASCII string. + * + * @param pObj + * The object to be compared a CIM element. + * @return true if the specified CIM octet string equals this + * CIM octet string, false otherwise. + */ + @Override + public synchronized boolean equals(Object pObj) { + // Verify parameter is CIMOctetString instance + if (!(pObj instanceof CIMOctetString)) return false; + + CIMOctetString that = (CIMOctetString) pObj; + int numCompares = 0; + + // Verify lengths are same + if (this.iLength != that.iLength) return false; + + // Verify byte arrays match if both non-null + if (this.iBytes != null && that.iBytes != null) { + for (int i = this.iLength - 1; i >= 0; i--) + if (this.iBytes[i].byteValue() != that.iBytes[i].byteValue()) return false; + numCompares++; + } + + // Verify hexadecimal strings match if both non-null + if (this.iHexString != null && that.iHexString != null) { + if (!this.iHexString.equalsIgnoreCase(that.iHexString)) return false; + numCompares++; + } + + // Verify ASCII strings match if both non-null + if (this.iASCIIString != null && that.iASCIIString != null + && this.iReplacementChar == that.iReplacementChar) { + if (!this.iASCIIString.equalsIgnoreCase(that.iASCIIString)) return false; + numCompares++; + } + + // Octet strings equal if at least one representation equal + if (numCompares > 0) return true; + + // At this point, the two CIMOctetString instances have no + // representations in common - time to make one + + if (this.iBytes != null && that.iBytes == null) { + that.getBytes(); + if (this.iBytes != null && that.iBytes != null) { + for (int i = this.iLength - 1; i >= 0; i--) + if (this.iBytes[i].byteValue() != that.iBytes[i].byteValue()) return false; + numCompares++; + } + } + + // Octet strings equal if byte arrays equal + if (numCompares > 0) return true; + + if (this.iBytes == null && that.iBytes != null) { + getBytes(); + if (this.iBytes != null && that.iBytes != null) { + for (int i = this.iLength - 1; i >= 0; i--) + if (this.iBytes[i].byteValue() != that.iBytes[i].byteValue()) return false; + numCompares++; + } + } + + // Octet strings equal if byte arrays equal + if (numCompares > 0) return true; + + if (this.iHexString != null && that.iHexString == null) { + that.getHexString(); + if (this.iHexString != null && that.iHexString != null) { + if (!this.iHexString.equalsIgnoreCase(that.iHexString)) return false; + numCompares++; + } + } + + // Octet strings equal if byte arrays equal + if (numCompares > 0) return true; + + if (this.iHexString == null && that.iHexString != null) { + getHexString(); + if (this.iHexString != null && that.iHexString != null) { + if (!this.iHexString.equalsIgnoreCase(that.iHexString)) return false; + numCompares++; + } + } + + // Octet strings equal if byte arrays equal + if (numCompares > 0) return true; + + return false; + } + + /** + * Returns ASCII string representation of octet string with non-printable + * characters replaced by pReplacementChar. If the ASCII string + * has not yet been created, it is created from the byte array or + * hexadecimal string. + * + * @param pReplacementChar + * Replacement character for non-printable characters which must + * be between 0x20 and 0x7E, inclusive. + * @return ASCII string representation of octet string. + */ + public synchronized String getASCIIString(char pReplacementChar) { + // If ASCII string constructor used, return original string + if (this.iASCIIString != null && this.iReplacementChar == 0xFF) return this.iASCIIString; + + // Verify replacement character is printable + if (pReplacementChar <= 0x1F || pReplacementChar >= 0x7F) throw new IllegalArgumentException( + "Replacement character not printable"); + + // If we already did this once, return previous string + if (this.iASCIIString != null && this.iReplacementChar == pReplacementChar) return this.iASCIIString; + + // Construct new ASCII string + StringBuilder str = new StringBuilder(""); + if (this.iBytes != null) { + for (int i = 4; i < this.iBytes.length; i++) { + char ch = (char) this.iBytes[i].byteValue(); + if (ch <= 0x1F || ch >= 0x7F) str.append(pReplacementChar); + else str.append(ch); + } + } else /* (this.iHexString != null) */{ + for (int i = 10; i < this.iHexString.length(); i += 2) { + char ch = (char) Integer.parseInt(this.iHexString.substring(i, i + 2), 16); + if (ch <= 0x1F || ch >= 0x7F) str.append(pReplacementChar); + else str.append(ch); + } + } + + // Save ASCII string in new object and indicate which replacement + // character used + this.iASCIIString = new String(str); + this.iReplacementChar = pReplacementChar; + + return this.iASCIIString; + } + + /** + * Returns byte array representation of octet string. If the byte array has + * not yet been created, it is created from the hexadecimal string or ASCII + * string. + * + * @return Byte array representation of octet string. + */ + public synchronized UnsignedInteger8[] getBytes() { + if (this.iBytes != null) return this.iBytes; + + if (this.iHexString != null) { + convertHexStringToBytes(); + } else /* if (this.iASCIIString != null) */{ + convertASCIIStringToBytes(); + } + + return this.iBytes; + } + + /** + * Returns hexadecimal string representation of octet string. If the + * hexadecimal string has not yet been created, it is created from the byte + * array or ASCII string. + * + * @return Hexadecimal string representation of octet string. + */ + public synchronized String getHexString() { + if (this.iHexString != null) return this.iHexString; + + if (this.iBytes != null) { + convertBytesToHexString(); + } else /* if (this.iASCIIString != null) */{ + convertASCIIStringToHexString(); + } + + return this.iHexString; + } + + /** + * Returns hash code value for octet string. + * + * @return Hash code value for octet string. + */ + @Override + public int hashCode() { + return toString().toLowerCase().hashCode(); + } + + /** + * Returns length of octet string, where length is number of octets plus + * four. + * + * @return Length of octet string. + */ + public int length() { + return this.iLength; + } + + /** + * Returns string representation of octet string. + * + * @return String representation of octet string. + */ + @Override + public String toString() { + return getHexString(); + } + + private void convertBytesToHexString() { + // Start with "0x" + StringBuilder str = new StringBuilder("0x"); + + // Append length + String len = Integer.toHexString(this.iLength); + for (int i = 8 - len.length(); i > 0; i--) + str.append('0'); + str.append(len); + + // Append string + for (int i = 4; i < this.iLength; i++) { + String octet = Integer.toHexString(this.iBytes[i].intValue()); + if (octet.length() == 1) str.append('0'); + str.append(octet); + } + + // Save hexadecimal string in new object + this.iHexString = new String(str); + + // debug("convertBytesToHexString: from {" + toBytesString() + "} to \"" + // + this.iHexString + "\""); + } + + private void convertHexStringToBytes() { + // Save byte array in new object + this.iBytes = new UnsignedInteger8[this.iLength]; + + // Convert each octet in hexadecimal string to byte + for (int idxByte = 0, idxStr = 2, len = this.iHexString.length(); idxStr < len; idxByte++, idxStr += 2) { + short s; + try { + s = Short.parseShort(this.iHexString.substring(idxStr, idxStr + 2), 16); + } catch (NumberFormatException e) { + throw new IllegalArgumentException("Hex string length could not be parsed: " + + e.toString()); + } + this.iBytes[idxByte] = new UnsignedInteger8(s); + } + + // debug("convertHexStringToBytes: from \"" + this.iHexString + + // "\" to {" + toBytesString() + "}"); + } + + private void convertASCIIStringToBytes() { + // Save byte array in new object + this.iBytes = new UnsignedInteger8[this.iLength]; + + // Convert length + this.iBytes[0] = new UnsignedInteger8((short) ((this.iLength >> 24) & 0xFF)); + this.iBytes[1] = new UnsignedInteger8((short) ((this.iLength >> 16) & 0xFF)); + this.iBytes[2] = new UnsignedInteger8((short) ((this.iLength >> 8) & 0xFF)); + this.iBytes[3] = new UnsignedInteger8((short) (this.iLength & 0xFF)); + + // Convert each character in ASCII string to byte + for (int idxStr = 0, idxByte = 4; idxStr < this.iASCIIString.length(); idxStr++, idxByte++) + this.iBytes[idxByte] = new UnsignedInteger8((short) (this.iASCIIString.charAt(idxStr))); + + // debug("convertASCIIStringToBytes: from \"" + this.iASCIIString + + // "\" to {" + toBytesString() + "}"); + } + + private void convertASCIIStringToHexString() { + // Start with "0x" + StringBuilder str = new StringBuilder("0x"); + + // Append length + String len = Integer.toHexString(this.iLength); + for (int i = 8 - len.length(); i > 0; i--) + str.append('0'); + str.append(len); + + // Append string + for (int idxAsc = 0; idxAsc < this.iASCIIString.length(); idxAsc++) { + String octet = Integer.toHexString((this.iASCIIString.charAt(idxAsc))); + if (octet.length() == 1) str.append('0'); + str.append(octet); + } + + // Save hexadecimal string in new object + this.iHexString = new String(str); + + // debug("convertASCIIStringToHexString: from \"" + this.iASCIIString + + // "\" to \"" + this.iHexString + "\""); + } + + // private String toBytesString() { + // StringBuilder str = new StringBuilder(); + // + // for (int i = 0; i < this.iLength; i++) { + // String octet = Integer.toHexString((this.iBytes[i].intValue())); + // if (i > 0) str.append(' '); + // if (octet.length() == 1) str.append('0'); + // str.append(octet); + // } + // return new String(str); + // } + + // private void debug(String str) { + // System.out.println(str); + // } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cim/CIMQualifiedElementInterfaceImpl.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cim/CIMQualifiedElementInterfaceImpl.java similarity index 82% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cim/CIMQualifiedElementInterfaceImpl.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cim/CIMQualifiedElementInterfaceImpl.java index 399fd23..eefe45c 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cim/CIMQualifiedElementInterfaceImpl.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cim/CIMQualifiedElementInterfaceImpl.java @@ -1,329 +1,327 @@ -/* - (C) Copyright IBM Corp. 2006, 2011 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-10-09 ebak Make SBLIM client JSR48 compliant - * 1660756 2007-02-22 ebak Embedded object support - * 1737141 2007-06-18 ebak Sync up with JSR48 evolution - * 1783288 2007-09-10 ebak CIMClass.isAssociation() not working for retrieved classes. - * 1796339 2007-10-01 ebak Serializable interface missing from internal componentry - * 1963102 2008-06-26 rgummada NullPointerException when getting qualifiers - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2620505 2009-02-24 rgummada EmbeddedObject qualifier is missing from CIMClass - * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics - * 2823494 2009-08-03 rgummada Change Boolean constructor to static - * 2975885 2010-03-24 blaschke-oss TCK: CIMXXX.hasQualifierValue(null,null) returns true - * 3001680 2010-05-18 blaschke-oss CIMQualifierElementInterfaceImpl changes qualifiers - * 3023095 2010-07-01 blaschke-oss CIMQualifiedElementInterfaceImpl equals/hashCode issue - * 3154232 2011-01-13 blaschke-oss EmbeddedObject misspelled in javadoc - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cim; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Arrays; - -import org.sentrysoftware.wbem.javax.cim.CIMDataType; -import org.sentrysoftware.wbem.javax.cim.CIMFlavor; -import org.sentrysoftware.wbem.javax.cim.CIMQualifiedElementInterface; -import org.sentrysoftware.wbem.javax.cim.CIMQualifier; - -/** - * Class CIMQualifiedElementInterfaceImpl is responsible for implementing the - * functionality of javax.cim.CIMQualifiedElementInterface - */ -public class CIMQualifiedElementInterfaceImpl implements CIMQualifiedElementInterface, Serializable { - - /** - * serialVersionUID - */ - private static final long serialVersionUID = 4533301297060752510L; - - private CIMQualifier[] iQualis; - - private CIMQualifier[] iLocalOnlyQualis; - - private boolean iEmbeddedObject; - - private static final CIMQualifier KEY = new CIMQualifier("Key", - CIMDataType.BOOLEAN_T, Boolean.TRUE, CIMFlavor.DISABLEOVERRIDE); - - private static final CIMQualifier ASSOCIATION = new CIMQualifier( - "Association", CIMDataType.BOOLEAN_T, Boolean.TRUE, CIMFlavor.DISABLEOVERRIDE); - - private static final CIMQualifier[] EMPTY_QA = new CIMQualifier[0]; - - /** - * Ctor. This constructor doesn't modify the passed qualifier list. - * - * @param pQualifiers - */ - public CIMQualifiedElementInterfaceImpl(CIMQualifier[] pQualifiers) { - setQualis(pQualifiers); - } - - /** - * Ctor. This constructor modifies the qualifier list according to the - * pIsKeyed flag. - * - * @param pQualifiers - * @param pIsKeyed - */ - public CIMQualifiedElementInterfaceImpl(CIMQualifier[] pQualifiers, boolean pIsKeyed) { - this(pQualifiers, pIsKeyed, false); - } - - /** - * Ctor. This constructor is able to not remove the EmbeddedObject - * qualifier. It is useful for the XML parser to parse EmbeddedObject - * qualified elements without values. - * - * @param pQualifiers - * @param pIsKeyed - * @param pKeepEmbObj - */ - public CIMQualifiedElementInterfaceImpl(CIMQualifier[] pQualifiers, boolean pIsKeyed, - boolean pKeepEmbObj) { - this(pQualifiers, pIsKeyed, pKeepEmbObj, false); - } - - /** - * Ctor. This constructor is able to not remove the EmbeddedObject - * qualifier. It is useful for the XML parser to parse EmbeddedObject - * qualified elements without values. It also adds or removes the - * Association qualifier depending on the value of pIsAssociation. - * - * @param pQualifiers - * @param pIsKeyed - * @param pKeepEmbObj - * @param pIsAssociation - */ - public CIMQualifiedElementInterfaceImpl(CIMQualifier[] pQualifiers, boolean pIsKeyed, - boolean pKeepEmbObj, boolean pIsAssociation) { - if (pKeepEmbObj) { - this.iQualis = (CIMQualifier[]) CIMElementSorter.sort(pQualifiers); - this.iEmbeddedObject = CIMElementSorter.findIdx(this.iQualis, "EmbeddedObject") >= 0; - } else { - setQualis(pQualifiers); - } - setBoolQualifier(KEY, pIsKeyed); - setBoolQualifier(ASSOCIATION, pIsAssociation); - } - - /** - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals(Object pObj) { - if (!(pObj instanceof CIMQualifiedElementInterfaceImpl)) return false; - CIMQualifiedElementInterfaceImpl that = (CIMQualifiedElementInterfaceImpl) pObj; - return Arrays.equals(getQualifiers(), that.getQualifiers()); - } - - /** - * @see java.lang.Object#hashCode() - */ - @Override - public int hashCode() { - return Arrays.hashCode(getQualifiers()); - } - - /** - * Sets the Qualifiers. If there is an EmbeddedObject qualifier, - * corresponding flag is set. - * - * @param pQualiA - */ - private void setQualis(CIMQualifier[] pQualiA) { - pQualiA = (CIMQualifier[]) CIMElementSorter.sort(pQualiA); - int rmIdx = CIMElementSorter.findIdx(pQualiA, "EmbeddedObject"); - if (rmIdx < 0) { - this.iQualis = pQualiA; - return; - } - this.iEmbeddedObject = true; - this.iQualis = pQualiA; - } - - /** - * if pValue is false and boolean qualifier exists it is removed.
      - * if pValue is true and boolean qualifier exists, it's value is changed to - * true, if boolean qualifier doesn't exist it is added. - * - * @param pQuali - * @param pValue - */ - private void setBoolQualifier(CIMQualifier pQuali, boolean pValue) { - int idx = CIMElementSorter.findIdx(this.iQualis, pQuali.getName()); - if (pValue) { - if (idx < 0) { - // insert the qualifier - // idx=-insertIdx-1 - // insertIdx=-idx-1; - insertQuali(pQuali, -idx - 1); - } else if (!pQuali.getValue().equals(this.iQualis[idx].getValue())) { - // change the qualifier if value different - this.iQualis[idx] = pQuali; - } - } else { - if (idx > 0) { - // remove the existing qualifier - removeQuali(idx); - } - } - } - - private void insertQuali(CIMQualifier pQuali, int idx) { - int origLength = this.iQualis == null ? 0 : this.iQualis.length; - CIMQualifier[] qualis = new CIMQualifier[origLength + 1]; - int srcIdx = 0, dstIdx = 0; - while (srcIdx < idx) - qualis[dstIdx++] = this.iQualis[srcIdx++]; - qualis[dstIdx++] = pQuali; - while (srcIdx < origLength) - qualis[dstIdx++] = this.iQualis[srcIdx++]; - this.iQualis = qualis; - } - - private void removeQuali(int idx) { - CIMQualifier[] qualis = new CIMQualifier[this.iQualis.length - 1]; - int srcIdx = 0, dstIdx = 0; - while (srcIdx < idx) - qualis[dstIdx++] = this.iQualis[srcIdx++]; - ++srcIdx; - while (srcIdx < this.iQualis.length) - qualis[dstIdx++] = this.iQualis[srcIdx++]; - this.iQualis = qualis; - } - - /* - * CIMQualifier( "Key", CIMDataType.BOOLEAN_T, new Boolean(true), - * CIMFlavor.DISABLEOVERRIDE ); - */ - - /** - * Returns true if the "key" Qualifier with true value presents. - * - * @return true/false - */ - public boolean isKeyed() { - return hasQualifierValue("key", Boolean.TRUE); - } - - /** - * Returns true if the "EmbeddedObject" qualifier with true value presents. - * - * @return true/false - */ - public boolean isEmbeddedObject() { - return this.iEmbeddedObject; - } - - /** - * @see org.sentrysoftware.wbem.javax.cim.CIMQualifiedElementInterface#getQualifier(int) - */ - public CIMQualifier getQualifier(int pIndex) { - return this.iQualis[pIndex]; - } - - /** - * @see org.sentrysoftware.wbem.javax.cim.CIMQualifiedElementInterface#getQualifier(java.lang.String) - */ - public CIMQualifier getQualifier(String pName) { - return (CIMQualifier) CIMElementSorter.find(this.iQualis, pName); - } - - /** - * @see org.sentrysoftware.wbem.javax.cim.CIMQualifiedElementInterface#getQualifierCount() - */ - public int getQualifierCount() { - return this.iQualis == null ? 0 : this.iQualis.length; - } - - /** - * @see org.sentrysoftware.wbem.javax.cim.CIMQualifiedElementInterface#getQualifierValue(java.lang.String) - */ - public Object getQualifierValue(String pName) { - CIMQualifier quali = getQualifier(pName); - if (quali == null) return null; - return quali.getValue(); - } - - /** - * @see org.sentrysoftware.wbem.javax.cim.CIMQualifiedElementInterface#getQualifiers() - */ - public CIMQualifier[] getQualifiers() { - return getQualifiers(false); - } - - /** - * getQualifiers - helps filtering based on the propagated flag. - * - * @param pLocalOnly - * @return CIMQualifier[] - */ - public CIMQualifier[] getQualifiers(boolean pLocalOnly) { - if (this.iQualis == null) return EMPTY_QA; - if (!pLocalOnly) return this.iQualis; - if (this.iLocalOnlyQualis == null) { - ArrayList> qualiL = new ArrayList>(this.iQualis.length); - for (int i = 0; i < this.iQualis.length; i++) - if (!this.iQualis[i].isPropagated()) qualiL.add(this.iQualis[i]); - this.iLocalOnlyQualis = qualiL.toArray(new CIMQualifier[qualiL.size()]); - } - return this.iLocalOnlyQualis; - } - - /** - * @see org.sentrysoftware.wbem.javax.cim.CIMQualifiedElementInterface#hasQualifier(java.lang.String) - */ - public boolean hasQualifier(String pName) { - return getQualifier(pName) != null; - } - - /** - * @see org.sentrysoftware.wbem.javax.cim.CIMQualifiedElementInterface#hasQualifierValue(java.lang.String, - * java.lang.Object) - */ - public boolean hasQualifierValue(String pName, Object pValue) { - if (!hasQualifier(pName)) return false; - Object value = getQualifierValue(pName); - return value == null ? pValue == null : value.equals(pValue); - } - -} +/* + (C) Copyright IBM Corp. 2006, 2011 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-10-09 ebak Make SBLIM client JSR48 compliant + * 1660756 2007-02-22 ebak Embedded object support + * 1737141 2007-06-18 ebak Sync up with JSR48 evolution + * 1783288 2007-09-10 ebak CIMClass.isAssociation() not working for retrieved classes. + * 1796339 2007-10-01 ebak Serializable interface missing from internal componentry + * 1963102 2008-06-26 rgummada NullPointerException when getting qualifiers + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2620505 2009-02-24 rgummada EmbeddedObject qualifier is missing from CIMClass + * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics + * 2823494 2009-08-03 rgummada Change Boolean constructor to static + * 2975885 2010-03-24 blaschke-oss TCK: CIMXXX.hasQualifierValue(null,null) returns true + * 3001680 2010-05-18 blaschke-oss CIMQualifierElementInterfaceImpl changes qualifiers + * 3023095 2010-07-01 blaschke-oss CIMQualifiedElementInterfaceImpl equals/hashCode issue + * 3154232 2011-01-13 blaschke-oss EmbeddedObject misspelled in javadoc + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cim; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Arrays; + +import org.metricshub.wbem.javax.cim.CIMDataType; +import org.metricshub.wbem.javax.cim.CIMQualifier; +import org.metricshub.wbem.javax.cim.CIMFlavor; +import org.metricshub.wbem.javax.cim.CIMQualifiedElementInterface; + +/** + * Class CIMQualifiedElementInterfaceImpl is responsible for implementing the + * functionality of javax.cim.CIMQualifiedElementInterface + */ +public class CIMQualifiedElementInterfaceImpl implements CIMQualifiedElementInterface, Serializable { + + /** + * serialVersionUID + */ + private static final long serialVersionUID = 4533301297060752510L; + + private CIMQualifier[] iQualis; + + private CIMQualifier[] iLocalOnlyQualis; + + private boolean iEmbeddedObject; + + private static final CIMQualifier KEY = new CIMQualifier("Key", + CIMDataType.BOOLEAN_T, Boolean.TRUE, CIMFlavor.DISABLEOVERRIDE); + + private static final CIMQualifier ASSOCIATION = new CIMQualifier( + "Association", CIMDataType.BOOLEAN_T, Boolean.TRUE, CIMFlavor.DISABLEOVERRIDE); + + private static final CIMQualifier[] EMPTY_QA = new CIMQualifier[0]; + + /** + * Ctor. This constructor doesn't modify the passed qualifier list. + * + * @param pQualifiers + */ + public CIMQualifiedElementInterfaceImpl(CIMQualifier[] pQualifiers) { + setQualis(pQualifiers); + } + + /** + * Ctor. This constructor modifies the qualifier list according to the + * pIsKeyed flag. + * + * @param pQualifiers + * @param pIsKeyed + */ + public CIMQualifiedElementInterfaceImpl(CIMQualifier[] pQualifiers, boolean pIsKeyed) { + this(pQualifiers, pIsKeyed, false); + } + + /** + * Ctor. This constructor is able to not remove the EmbeddedObject + * qualifier. It is useful for the XML parser to parse EmbeddedObject + * qualified elements without values. + * + * @param pQualifiers + * @param pIsKeyed + * @param pKeepEmbObj + */ + public CIMQualifiedElementInterfaceImpl(CIMQualifier[] pQualifiers, boolean pIsKeyed, + boolean pKeepEmbObj) { + this(pQualifiers, pIsKeyed, pKeepEmbObj, false); + } + + /** + * Ctor. This constructor is able to not remove the EmbeddedObject + * qualifier. It is useful for the XML parser to parse EmbeddedObject + * qualified elements without values. It also adds or removes the + * Association qualifier depending on the value of pIsAssociation. + * + * @param pQualifiers + * @param pIsKeyed + * @param pKeepEmbObj + * @param pIsAssociation + */ + public CIMQualifiedElementInterfaceImpl(CIMQualifier[] pQualifiers, boolean pIsKeyed, + boolean pKeepEmbObj, boolean pIsAssociation) { + if (pKeepEmbObj) { + this.iQualis = (CIMQualifier[]) CIMElementSorter.sort(pQualifiers); + this.iEmbeddedObject = CIMElementSorter.findIdx(this.iQualis, "EmbeddedObject") >= 0; + } else { + setQualis(pQualifiers); + } + setBoolQualifier(KEY, pIsKeyed); + setBoolQualifier(ASSOCIATION, pIsAssociation); + } + + /** + * @see java.lang.Object#equals(java.lang.Object) + */ + @Override + public boolean equals(Object pObj) { + if (!(pObj instanceof CIMQualifiedElementInterfaceImpl)) return false; + CIMQualifiedElementInterfaceImpl that = (CIMQualifiedElementInterfaceImpl) pObj; + return Arrays.equals(getQualifiers(), that.getQualifiers()); + } + + /** + * @see java.lang.Object#hashCode() + */ + @Override + public int hashCode() { + return Arrays.hashCode(getQualifiers()); + } + + /** + * Sets the Qualifiers. If there is an EmbeddedObject qualifier, + * corresponding flag is set. + * + * @param pQualiA + */ + private void setQualis(CIMQualifier[] pQualiA) { + pQualiA = (CIMQualifier[]) CIMElementSorter.sort(pQualiA); + int rmIdx = CIMElementSorter.findIdx(pQualiA, "EmbeddedObject"); + if (rmIdx < 0) { + this.iQualis = pQualiA; + return; + } + this.iEmbeddedObject = true; + this.iQualis = pQualiA; + } + + /** + * if pValue is false and boolean qualifier exists it is removed.
      + * if pValue is true and boolean qualifier exists, it's value is changed to + * true, if boolean qualifier doesn't exist it is added. + * + * @param pQuali + * @param pValue + */ + private void setBoolQualifier(CIMQualifier pQuali, boolean pValue) { + int idx = CIMElementSorter.findIdx(this.iQualis, pQuali.getName()); + if (pValue) { + if (idx < 0) { + // insert the qualifier + // idx=-insertIdx-1 + // insertIdx=-idx-1; + insertQuali(pQuali, -idx - 1); + } else if (!pQuali.getValue().equals(this.iQualis[idx].getValue())) { + // change the qualifier if value different + this.iQualis[idx] = pQuali; + } + } else { + if (idx > 0) { + // remove the existing qualifier + removeQuali(idx); + } + } + } + + private void insertQuali(CIMQualifier pQuali, int idx) { + int origLength = this.iQualis == null ? 0 : this.iQualis.length; + CIMQualifier[] qualis = new CIMQualifier[origLength + 1]; + int srcIdx = 0, dstIdx = 0; + while (srcIdx < idx) + qualis[dstIdx++] = this.iQualis[srcIdx++]; + qualis[dstIdx++] = pQuali; + while (srcIdx < origLength) + qualis[dstIdx++] = this.iQualis[srcIdx++]; + this.iQualis = qualis; + } + + private void removeQuali(int idx) { + CIMQualifier[] qualis = new CIMQualifier[this.iQualis.length - 1]; + int srcIdx = 0, dstIdx = 0; + while (srcIdx < idx) + qualis[dstIdx++] = this.iQualis[srcIdx++]; + ++srcIdx; + while (srcIdx < this.iQualis.length) + qualis[dstIdx++] = this.iQualis[srcIdx++]; + this.iQualis = qualis; + } + + /* + * CIMQualifier( "Key", CIMDataType.BOOLEAN_T, new Boolean(true), + * CIMFlavor.DISABLEOVERRIDE ); + */ + + /** + * Returns true if the "key" Qualifier with true value presents. + * + * @return true/false + */ + public boolean isKeyed() { + return hasQualifierValue("key", Boolean.TRUE); + } + + /** + * Returns true if the "EmbeddedObject" qualifier with true value presents. + * + * @return true/false + */ + public boolean isEmbeddedObject() { + return this.iEmbeddedObject; + } + + /** + * @see org.metricshub.wbem.javax.cim.CIMQualifiedElementInterface#getQualifier(int) + */ + public CIMQualifier getQualifier(int pIndex) { + return this.iQualis[pIndex]; + } + + /** + * @see org.metricshub.wbem.javax.cim.CIMQualifiedElementInterface#getQualifier(java.lang.String) + */ + public CIMQualifier getQualifier(String pName) { + return (CIMQualifier) CIMElementSorter.find(this.iQualis, pName); + } + + /** + * @see org.metricshub.wbem.javax.cim.CIMQualifiedElementInterface#getQualifierCount() + */ + public int getQualifierCount() { + return this.iQualis == null ? 0 : this.iQualis.length; + } + + /** + * @see org.metricshub.wbem.javax.cim.CIMQualifiedElementInterface#getQualifierValue(java.lang.String) + */ + public Object getQualifierValue(String pName) { + CIMQualifier quali = getQualifier(pName); + if (quali == null) return null; + return quali.getValue(); + } + + /** + * @see org.metricshub.wbem.javax.cim.CIMQualifiedElementInterface#getQualifiers() + */ + public CIMQualifier[] getQualifiers() { + return getQualifiers(false); + } + + /** + * getQualifiers - helps filtering based on the propagated flag. + * + * @param pLocalOnly + * @return CIMQualifier[] + */ + public CIMQualifier[] getQualifiers(boolean pLocalOnly) { + if (this.iQualis == null) return EMPTY_QA; + if (!pLocalOnly) return this.iQualis; + if (this.iLocalOnlyQualis == null) { + ArrayList> qualiL = new ArrayList>(this.iQualis.length); + for (int i = 0; i < this.iQualis.length; i++) + if (!this.iQualis[i].isPropagated()) qualiL.add(this.iQualis[i]); + this.iLocalOnlyQualis = qualiL.toArray(new CIMQualifier[qualiL.size()]); + } + return this.iLocalOnlyQualis; + } + + /** + * @see org.metricshub.wbem.javax.cim.CIMQualifiedElementInterface#hasQualifier(java.lang.String) + */ + public boolean hasQualifier(String pName) { + return getQualifier(pName) != null; + } + + /** + * @see org.metricshub.wbem.javax.cim.CIMQualifiedElementInterface#hasQualifierValue(java.lang.String, + * java.lang.Object) + */ + public boolean hasQualifierValue(String pName, Object pValue) { + if (!hasQualifier(pName)) return false; + Object value = getQualifierValue(pName); + return value == null ? pValue == null : value.equals(pValue); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cim/CIMVersion.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cim/CIMVersion.java similarity index 77% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cim/CIMVersion.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cim/CIMVersion.java index f8acb6a..bbd8836 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cim/CIMVersion.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cim/CIMVersion.java @@ -1,158 +1,156 @@ -/* - CIMVersion.java - - (C) Copyright IBM Corp. 2005, 2010 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM ,chungtan@us.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 2807325 2009-06-22 blaschke-oss Change licensing from CPL to EPL - * 2834838 2009-08-11 blaschke-oss Add interface to retrieve version number and product name - * 3027618 2010-07-14 blaschke-oss Close files/readers in finally blocks - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cim; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.util.Properties; - -/** - * Class CIMVersion is responsible for providing the exact version number, - * product name, etc. of the Java CIM Client - */ -public class CIMVersion { - - private static String PRODUCT_NAME = "n/a"; - - private static String VERSION = "n/a"; - - private static String COPYRIGHT = "n/a"; - - private static String BUILDDATE = "n/a"; - - private static String BUILDTIME = "n/a"; - - static { - Properties properties = new Properties(); - InputStream versionIS = null; - try { - versionIS = CIMVersion.class.getClassLoader().getResourceAsStream("com/sentrysoftware/sblim/cimclient/version.txt"); - properties.load(versionIS); - PRODUCT_NAME = properties.getProperty("PRODUCTNAME"); - VERSION = properties.getProperty("VERSION"); - COPYRIGHT = properties.getProperty("COPYRIGHT"); - BUILDDATE = properties.getProperty("BUILDDATE"); - BUILDTIME = properties.getProperty("BUILDTIME"); - } catch (FileNotFoundException e) { - System.out.println("Error: Could not open version.txt"); - } catch (IOException e) { - System.out.println("Error while reading version.txt"); - } finally { - if (versionIS != null) { - try { - versionIS.close(); - } catch (IOException e) { - /* Ignore exception on close */ - } - } - } - } - - /** - * Gets the build date - * - * @return The build date - */ - public static String getBuildDate() { - return BUILDDATE; - } - - /** - * Gets the build time - * - * @return The build time - */ - public static String getBuildTime() { - return BUILDTIME; - } - - /** - * Gets the copyright statement - * - * @return THe copyright - */ - public static String getCopyright() { - return COPYRIGHT; - } - - /** - * Gets the product name - * - * @return The product name - */ - public static String getProductName() { - return PRODUCT_NAME; - } - - /** - * Gets the version - * - * @return The version - */ - public static String getVersion() { - return VERSION; - } - - /** - * toString - * - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return (PRODUCT_NAME + "\n" + VERSION + "\n" + COPYRIGHT + "\n" + BUILDDATE + "\n" + BUILDTIME); - } - - /** - * main - * - * @param args - */ - public static void main(String[] args) { - System.out.println(new CIMVersion()); - } -} +/* + CIMVersion.java + + (C) Copyright IBM Corp. 2005, 2010 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM ,chungtan@us.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 2807325 2009-06-22 blaschke-oss Change licensing from CPL to EPL + * 2834838 2009-08-11 blaschke-oss Add interface to retrieve version number and product name + * 3027618 2010-07-14 blaschke-oss Close files/readers in finally blocks + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cim; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.util.Properties; + +/** + * Class CIMVersion is responsible for providing the exact version number, + * product name, etc. of the Java CIM Client + */ +public class CIMVersion { + + private static String PRODUCT_NAME = "n/a"; + + private static String VERSION = "n/a"; + + private static String COPYRIGHT = "n/a"; + + private static String BUILDDATE = "n/a"; + + private static String BUILDTIME = "n/a"; + + static { + Properties properties = new Properties(); + InputStream versionIS = null; + try { + versionIS = CIMVersion.class.getClassLoader().getResourceAsStream("org/sblim/cimclient/version.txt"); + properties.load(versionIS); + PRODUCT_NAME = properties.getProperty("PRODUCTNAME"); + VERSION = properties.getProperty("VERSION"); + COPYRIGHT = properties.getProperty("COPYRIGHT"); + BUILDDATE = properties.getProperty("BUILDDATE"); + BUILDTIME = properties.getProperty("BUILDTIME"); + } catch (FileNotFoundException e) { + System.out.println("Error: Could not open version.txt"); + } catch (IOException e) { + System.out.println("Error while reading version.txt"); + } finally { + if (versionIS != null) { + try { + versionIS.close(); + } catch (IOException e) { + /* Ignore exception on close */ + } + } + } + } + + /** + * Gets the build date + * + * @return The build date + */ + public static String getBuildDate() { + return BUILDDATE; + } + + /** + * Gets the build time + * + * @return The build time + */ + public static String getBuildTime() { + return BUILDTIME; + } + + /** + * Gets the copyright statement + * + * @return THe copyright + */ + public static String getCopyright() { + return COPYRIGHT; + } + + /** + * Gets the product name + * + * @return The product name + */ + public static String getProductName() { + return PRODUCT_NAME; + } + + /** + * Gets the version + * + * @return The version + */ + public static String getVersion() { + return VERSION; + } + + /** + * toString + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return (PRODUCT_NAME + "\n" + VERSION + "\n" + COPYRIGHT + "\n" + BUILDDATE + "\n" + BUILDTIME); + } + + /** + * main + * + * @param args + */ + public static void main(String[] args) { + System.out.println(new CIMVersion()); + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cim/DTStringReader.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cim/DTStringReader.java similarity index 84% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cim/DTStringReader.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cim/DTStringReader.java index 4fc3f3e..bd669b0 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cim/DTStringReader.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cim/DTStringReader.java @@ -1,208 +1,206 @@ -/* - (C) Copyright IBM Corp. 2006, 2012 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-10-12 ebak Make SBLIM client JSR48 compliant - * 1678807 2007-03-12 ebak Minor CIMDateTime suggestions - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors - * 3526675 2012-05-14 blaschke-oss Unit test fails on Java 7 - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cim; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.IOException; -import java.io.StringReader; - -/** - * Class DTString helps parsing CIMDateTime Strings. - * - */ -public class DTStringReader { - - private String iDateTimeStr; - - private StringReader iReader; - - private int iPos = 0; - - private boolean iUnsignificant; - - /** - * Ctor. - * - * @param pDateTimeStr - */ - public DTStringReader(String pDateTimeStr) { - this.iDateTimeStr = pDateTimeStr; - this.iReader = new StringReader(pDateTimeStr); - } - - /** - * read - * - * @param pLen - * - number of characters to be read from the string - * @param pFieldName - * - the name of the field which is to be read (e.g. year, month, - * day ...) - * @param pAllowUnsignificant - * @return int - * @throws IllegalArgumentException - */ - public int read(int pLen, String pFieldName, boolean pAllowUnsignificant) - throws IllegalArgumentException { - char[] buf = new char[pLen]; - int read; - try { - read = this.iReader.read(buf); - this.iPos += pLen; - } catch (IOException e) { - String msg = "Failed to read " + pFieldName + " field from " + this.iDateTimeStr + '!'; - throw new IllegalArgumentException(msg); - } - if (read != pLen) { - String msg = "Length of " + pFieldName + " field should be " + pLen + " but only" - + read + " characters could be read!"; - throw new IllegalArgumentException(msg); - } - // Not significant check - if (pAllowUnsignificant) { - int cnt = 0; - for (int i = 0; i < buf.length; i++) - if (buf[i] == '*') ++cnt; - if (cnt == buf.length) { - this.iUnsignificant = true; - return -1; - } - } - this.iUnsignificant = false; - String field = new String(buf); - int res; - try { - res = Integer.parseInt(field); - } catch (NumberFormatException e) { - String msg = "Illegal " + pFieldName + " field \"" + field + "\" in \"" - + this.iDateTimeStr + "\"!"; - throw new IllegalArgumentException(msg); - } - if (res < 0) throw new IllegalArgumentException("Negative value is not allowed for " - + pFieldName + " in " + this.iDateTimeStr + "!"); - // Java 7 parseInt began allowing plus sign - if (field.indexOf('+') != -1) throw new IllegalArgumentException( - "Plus sign is not allowed for " + pFieldName + " in " + this.iDateTimeStr + "!"); - return res; - } - - /** - * readAndCheck - * - * @param pLen - * - number of digits to read - * @param pFieldName - * - the name of the field which is to be read (e.g. year, month, - * day...) - * @param pMin - * - the allowed minimum value (-1 is always allowed as not - * significant) - * @param pMax - * - the allowed maximum value - * @param pAllowUnsignificant - * @return int - * @throws IllegalArgumentException - */ - public int readAndCheck(int pLen, String pFieldName, int pMin, int pMax, - boolean pAllowUnsignificant) throws IllegalArgumentException { - int val = read(pLen, pFieldName, pAllowUnsignificant); - if (pAllowUnsignificant && val == -1) return val; - if (val < pMin || val > pMax) throw new IllegalArgumentException(pFieldName - + " must be between " + pMin + " and " + pMax + ", but " + val + " was read from " - + this.iDateTimeStr + " !"); - return val; - } - - /** - * read - * - * @return a char, 0 if failed - */ - public char read() { - try { - int i = this.iReader.read(); - if (i > 0) { - ++this.iPos; - return (char) i; - } - return 0; - } catch (IOException e) { - return 0; - } - } - - /** - * read - Throws an IllegalArgumentException if the read character is not c. - * - * @param c - * - contains the character which should be read from the String. - * @throws IllegalArgumentException - */ - public void read(char c) throws IllegalArgumentException { - if (read() != c) { - String msg = "'" + c + "' expected at position " + getPos() + " in " - + this.iDateTimeStr + "!"; - throw new IllegalArgumentException(msg); - } - } - - /** - * getPos - * - * @return the position in the reader - */ - public int getPos() { - return this.iPos; - } - - /** - * isUnsignificant - * - * @return boolean - */ - public boolean isUnsignificant() { - return this.iUnsignificant; - } - -} +/* + (C) Copyright IBM Corp. 2006, 2012 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-10-12 ebak Make SBLIM client JSR48 compliant + * 1678807 2007-03-12 ebak Minor CIMDateTime suggestions + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors + * 3526675 2012-05-14 blaschke-oss Unit test fails on Java 7 + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cim; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.IOException; +import java.io.StringReader; + +/** + * Class DTString helps parsing CIMDateTime Strings. + * + */ +public class DTStringReader { + + private String iDateTimeStr; + + private StringReader iReader; + + private int iPos = 0; + + private boolean iUnsignificant; + + /** + * Ctor. + * + * @param pDateTimeStr + */ + public DTStringReader(String pDateTimeStr) { + this.iDateTimeStr = pDateTimeStr; + this.iReader = new StringReader(pDateTimeStr); + } + + /** + * read + * + * @param pLen + * - number of characters to be read from the string + * @param pFieldName + * - the name of the field which is to be read (e.g. year, month, + * day ...) + * @param pAllowUnsignificant + * @return int + * @throws IllegalArgumentException + */ + public int read(int pLen, String pFieldName, boolean pAllowUnsignificant) + throws IllegalArgumentException { + char[] buf = new char[pLen]; + int read; + try { + read = this.iReader.read(buf); + this.iPos += pLen; + } catch (IOException e) { + String msg = "Failed to read " + pFieldName + " field from " + this.iDateTimeStr + '!'; + throw new IllegalArgumentException(msg); + } + if (read != pLen) { + String msg = "Length of " + pFieldName + " field should be " + pLen + " but only" + + read + " characters could be read!"; + throw new IllegalArgumentException(msg); + } + // Not significant check + if (pAllowUnsignificant) { + int cnt = 0; + for (int i = 0; i < buf.length; i++) + if (buf[i] == '*') ++cnt; + if (cnt == buf.length) { + this.iUnsignificant = true; + return -1; + } + } + this.iUnsignificant = false; + String field = new String(buf); + int res; + try { + res = Integer.parseInt(field); + } catch (NumberFormatException e) { + String msg = "Illegal " + pFieldName + " field \"" + field + "\" in \"" + + this.iDateTimeStr + "\"!"; + throw new IllegalArgumentException(msg); + } + if (res < 0) throw new IllegalArgumentException("Negative value is not allowed for " + + pFieldName + " in " + this.iDateTimeStr + "!"); + // Java 7 parseInt began allowing plus sign + if (field.indexOf('+') != -1) throw new IllegalArgumentException( + "Plus sign is not allowed for " + pFieldName + " in " + this.iDateTimeStr + "!"); + return res; + } + + /** + * readAndCheck + * + * @param pLen + * - number of digits to read + * @param pFieldName + * - the name of the field which is to be read (e.g. year, month, + * day...) + * @param pMin + * - the allowed minimum value (-1 is always allowed as not + * significant) + * @param pMax + * - the allowed maximum value + * @param pAllowUnsignificant + * @return int + * @throws IllegalArgumentException + */ + public int readAndCheck(int pLen, String pFieldName, int pMin, int pMax, + boolean pAllowUnsignificant) throws IllegalArgumentException { + int val = read(pLen, pFieldName, pAllowUnsignificant); + if (pAllowUnsignificant && val == -1) return val; + if (val < pMin || val > pMax) throw new IllegalArgumentException(pFieldName + + " must be between " + pMin + " and " + pMax + ", but " + val + " was read from " + + this.iDateTimeStr + " !"); + return val; + } + + /** + * read + * + * @return a char, 0 if failed + */ + public char read() { + try { + int i = this.iReader.read(); + if (i > 0) { + ++this.iPos; + return (char) i; + } + return 0; + } catch (IOException e) { + return 0; + } + } + + /** + * read - Throws an IllegalArgumentException if the read character is not c. + * + * @param c + * - contains the character which should be read from the String. + * @throws IllegalArgumentException + */ + public void read(char c) throws IllegalArgumentException { + if (read() != c) { + String msg = "'" + c + "' expected at position " + getPos() + " in " + + this.iDateTimeStr + "!"; + throw new IllegalArgumentException(msg); + } + } + + /** + * getPos + * + * @return the position in the reader + */ + public int getPos() { + return this.iPos; + } + + /** + * isUnsignificant + * + * @return boolean + */ + public boolean isUnsignificant() { + return this.iUnsignificant; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cim/DTStringWriter.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cim/DTStringWriter.java similarity index 76% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cim/DTStringWriter.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cim/DTStringWriter.java index 1bb1dfe..095d3bc 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cim/DTStringWriter.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cim/DTStringWriter.java @@ -1,134 +1,132 @@ -/* - (C) Copyright IBM Corp. 2006, 2010 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-10-12 ebak Make SBLIM client JSR48 compliant - * 1678807 2007-03-12 ebak Minor CIMDateTime suggestions - * 1849235 2008-02-11 blaschke-oss DTStringWriter.writeSigned parameter pDigits is not used - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2989367 2010-04-29 blaschke-oss CIMDateTimeInterval(long) constructor range wrong - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cim; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.Arrays; - -/** - * Class DTStringWriter helps making CIMDateTime Strings. - */ -public class DTStringWriter { - - private StringBuffer iBuf = new StringBuffer(); - - /** - * writeInt - writes an integer, the upper digits are filled with zeros - * - * @param pNum - * -1 means that asterisks have to be printed - * @param pDigits - */ - public void write(int pDigits, int pNum) { - if (pDigits <= 0) return; - if (pNum == -1) { - char[] cA = new char[pDigits]; - Arrays.fill(cA, '*'); - this.iBuf.append(cA); - return; - } - String str = Integer.toString(pNum); - int paddingDigits = pDigits - str.length(); - if (paddingDigits > 0) { - char[] cA = new char[paddingDigits]; - Arrays.fill(cA, '0'); - this.iBuf.append(cA).append(str); - } else this.iBuf.append(str); - } - - /** - * writeSignedInt - used for utc writing - * - * @param pNum - * @param pDigits - */ - public void writeSigned(int pDigits, int pNum) { - char sign; - if (pNum < 0) { - sign = '-'; - pNum = -pNum; - } else sign = '+'; - write(sign); - write(pDigits, pNum); - } - - /** - * writeUSec - * - * @param pUSec - * @param pUnsignificantDigits - */ - public void writeUSec(int pUSec, int pUnsignificantDigits) { - int digits = 6 - pUnsignificantDigits; - write(digits, pUSec); - for (int i = 0; i < pUnsignificantDigits; i++) - write('*'); - } - - /** - * writeChar - * - * @param pChar - */ - public void write(char pChar) { - this.iBuf.append(pChar); - } - - /** - * write - * - * @param pStr - */ - public void write(String pStr) { - this.iBuf.append(pStr); - } - - /** - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return this.iBuf.toString(); - } -} +/* + (C) Copyright IBM Corp. 2006, 2010 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-10-12 ebak Make SBLIM client JSR48 compliant + * 1678807 2007-03-12 ebak Minor CIMDateTime suggestions + * 1849235 2008-02-11 blaschke-oss DTStringWriter.writeSigned parameter pDigits is not used + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2989367 2010-04-29 blaschke-oss CIMDateTimeInterval(long) constructor range wrong + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cim; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.Arrays; + +/** + * Class DTStringWriter helps making CIMDateTime Strings. + */ +public class DTStringWriter { + + private StringBuffer iBuf = new StringBuffer(); + + /** + * writeInt - writes an integer, the upper digits are filled with zeros + * + * @param pNum + * -1 means that asterisks have to be printed + * @param pDigits + */ + public void write(int pDigits, int pNum) { + if (pDigits <= 0) return; + if (pNum == -1) { + char[] cA = new char[pDigits]; + Arrays.fill(cA, '*'); + this.iBuf.append(cA); + return; + } + String str = Integer.toString(pNum); + int paddingDigits = pDigits - str.length(); + if (paddingDigits > 0) { + char[] cA = new char[paddingDigits]; + Arrays.fill(cA, '0'); + this.iBuf.append(cA).append(str); + } else this.iBuf.append(str); + } + + /** + * writeSignedInt - used for utc writing + * + * @param pNum + * @param pDigits + */ + public void writeSigned(int pDigits, int pNum) { + char sign; + if (pNum < 0) { + sign = '-'; + pNum = -pNum; + } else sign = '+'; + write(sign); + write(pDigits, pNum); + } + + /** + * writeUSec + * + * @param pUSec + * @param pUnsignificantDigits + */ + public void writeUSec(int pUSec, int pUnsignificantDigits) { + int digits = 6 - pUnsignificantDigits; + write(digits, pUSec); + for (int i = 0; i < pUnsignificantDigits; i++) + write('*'); + } + + /** + * writeChar + * + * @param pChar + */ + public void write(char pChar) { + this.iBuf.append(pChar); + } + + /** + * write + * + * @param pStr + */ + public void write(String pStr) { + this.iBuf.append(pStr); + } + + /** + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return this.iBuf.toString(); + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cim/package.html b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cim/package.html similarity index 100% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cim/package.html rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cim/package.html diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/CIMClientXML_HelperImpl.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/CIMClientXML_HelperImpl.java similarity index 93% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/CIMClientXML_HelperImpl.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/CIMClientXML_HelperImpl.java index 326bd35..d9ea7ad 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/CIMClientXML_HelperImpl.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/CIMClientXML_HelperImpl.java @@ -1,2635 +1,2634 @@ -/* - (C) Copyright IBM Corp. 2005, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 13521 2004-11-26 thschaef XML Request Composition for static method call is wrong - * 18075 2005-08-11 pineiro5 Can not use method CIMClient.invokeMethod - * 1535756 2006-08-07 lupusalex Make code warning free - * 1365086 2006-10-25 ebak Possible bug in createQualifier - * 1565892 2006-11-16 lupusalex Make SBLIM client JSR48 compliant - * 1610046 2006-12-18 lupusalex Does not escape trailing spaces - * 1610046 2007-01-10 lupusalex Rework: Does not escape trailing spaces - * 1649611 2007-01-31 lupusalex Interop issue: Quotes not escaped by client - * 1671502 2007-02-28 lupusalex Remove dependency from Xerces - * 1660756 2007-03-02 ebak Embedded object support - * 1689085 2007-04-10 ebak Embedded object enhancements for Pegasus - * 1669961 2006-04-16 lupusalex CIMTypedElement.getType() =>getDataType() - * 1715027 2007-05-08 lupusalex Make message id random - * 1719991 2007-05-16 ebak FVT: regression ClassCastException in EmbObjHandler - * 1734888 2007-06-11 ebak Wrong reference building in METHODCALL request - * 1827728 2007-11-12 ebak embeddedInstances: attribute EmbeddedObject not set - * 1827728 2007-11-20 ebak rework: embeddedInstances: attribute EmbeddedObject not set - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors - * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics - * 2845211 2009-08-27 raman_arora Pull Enumeration Feature (SAX Parser) - * 2865222 2009-09-29 raman_arora enumerateQualifierTypes shouldn't require a class name - * 2858933 2009-10-12 raman_arora JSR48 new APIs: associatorClasses & associatorInstances - * 2886829 2009-11-18 raman_arora JSR48 new APIs: referenceClasses & referenceInstances - * 2944219 2010-02-05 blaschke-oss Problem with pull operations using client against EMC CIMOM - * 3027479 2010-07-09 blaschke-oss Dead store to local variable - * 3062747 2010-09-21 blaschke-oss SblimCIMClient does not log all CIM-XML responces. - * 3514537 2012-04-03 blaschke-oss TCK: execQueryInstances requires boolean, not Boolean - * 3521119 2012-04-24 blaschke-oss JSR48 1.0.0: remove CIMObjectPath 2/3/4-parm ctors - * 3527580 2012-05-17 blaschke-oss WBEMClient should not throw IllegalArgumentException - * 3601894 2013-01-23 blaschke-oss Enhance HTTP and CIM-XML tracing - * 2616 2013-02-23 blaschke-oss Add new API WBEMClientSBLIM.sendIndication() - * 2689 2013-10-10 blaschke-oss createMETHODCALL should not add PARAMTYPE attribute - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.IOException; -import java.io.OutputStream; -import java.util.Iterator; -import java.util.Random; -import java.util.Vector; - -import org.sentrysoftware.wbem.javax.cim.CIMArgument; -import org.sentrysoftware.wbem.javax.cim.CIMClass; -import org.sentrysoftware.wbem.javax.cim.CIMDataType; -import org.sentrysoftware.wbem.javax.cim.CIMInstance; -import org.sentrysoftware.wbem.javax.cim.CIMNamedElementInterface; -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; -import org.sentrysoftware.wbem.javax.cim.CIMProperty; -import org.sentrysoftware.wbem.javax.cim.CIMQualifierType; -import org.sentrysoftware.wbem.javax.cim.CIMValuedElement; -import org.sentrysoftware.wbem.javax.cim.UnsignedInteger32; -import org.sentrysoftware.wbem.javax.wbem.WBEMException; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.logging.TimeStamp; -import org.sentrysoftware.wbem.sblim.cimclient.internal.util.MOF; -import org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.CIMError; -import org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.operations.CIMAssociatorNamesOp; -import org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.operations.CIMAssociatorsOp; -import org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.operations.CIMCreateClassOp; -import org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.operations.CIMCreateInstanceOp; -import org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.operations.CIMCreateNameSpaceOp; -import org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.operations.CIMCreateQualifierTypeOp; -import org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.operations.CIMDeleteClassOp; -import org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.operations.CIMDeleteInstanceOp; -import org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.operations.CIMDeleteQualifierTypeOp; -import org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.operations.CIMEnumClassNamesOp; -import org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.operations.CIMEnumClassesOp; -import org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.operations.CIMEnumInstanceNamesOp; -import org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.operations.CIMEnumInstancesOp; -import org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.operations.CIMEnumNameSpaceOp; -import org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.operations.CIMEnumQualifierTypesOp; -import org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.operations.CIMExecQueryOp; -import org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.operations.CIMGetClassOp; -import org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.operations.CIMGetInstanceOp; -import org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.operations.CIMGetPropertyOp; -import org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.operations.CIMGetQualifierTypeOp; -import org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.operations.CIMInvokeMethodOp; -import org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.operations.CIMOperation; -import org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.operations.CIMReferenceNamesOp; -import org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.operations.CIMReferencesOp; -import org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.operations.CIMSetClassOp; -import org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.operations.CIMSetInstanceOp; -import org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.operations.CIMSetPropertyOp; -import org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.operations.CIMSetQualifierTypeOp; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; - -/** - * Class CIMClientXML_HelperImpl is responsible for building CIM-XML requests - * and responses. - */ -public class CIMClientXML_HelperImpl { - - private static class Counter { - - private int iCounter; - - protected Counter(int pCounter) { - this.iCounter = pCounter; - } - - protected int incrementAndGet() { - return ++this.iCounter; - } - } - - private static final String VERSION = "1.0"; - - private static final String ASSOCIATOR_NAMES = "AssociatorNames"; - - // Pull Enumeration variables - private static final String ASSOC_CLASS = "AssocClass"; - - private static final String CLASS_NAME = "ClassName"; - - private static final String CONTINUE_ON_ERROR = "ContinueOnError"; - - private static final String DEEP_INHERITANCE = "DeepInheritance"; - - private static final String ENUMERATION_CONTEXT = "EnumerationContext"; - - private static final String FILTER_QUERY_LANGUAGE = "FilterQueryLanguage"; - - private static final String FILTER_QUERY = "FilterQuery"; - - private static final String INCLUDE_CLASS_ORIGIN = "IncludeClassOrigin"; - - private static final String INSTANCE_NAME = "InstanceName"; - - private static final String MAX_OBJECT_COUNT = "MaxObjectCount"; - - private static final String PROPERTY_LIST = "PropertyList"; - - private static final String OPERATION_TIMEOUT = "OperationTimeout"; - - private static final String RESULT_CLASS = "ResultClass"; - - private static final String RETURN_QUERY_RESULT_CLASS = "ReturnQueryResultClass"; - - private static final String QUERY_RESULT_CLASS = "QueryResultClass"; - - private static final String ROLE = "Role"; - - private static final String RESULT_ROLE = "ResultRole"; - - private static final Random RANDOM = new Random(); - - private static final int MAX_ID = 1 << 20; - - private final ThreadLocal iCurrentId = new ThreadLocal(); - - private final DocumentBuilder iBuilder; - - private static String valueStr(CIMValuedElement pE) { - Object o = pE.getValue(); - return o == null ? MOF.NULL : o.toString(); - } - - /** - * Ctor. - * - * @throws ParserConfigurationException - */ - public CIMClientXML_HelperImpl() throws ParserConfigurationException { - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - this.iBuilder = factory.newDocumentBuilder(); - } - - /** - * getDocumentBuilder - * - * @return DocumentBuilder - */ - public DocumentBuilder getDocumentBuilder() { - return this.iBuilder; - } - - /** - * newDocument - * - * @return Document - */ - public Document newDocument() { - return this.iBuilder.newDocument(); - } - - /** - * parse - * - * @param pIS - * @return Document - * @throws IOException - * @throws SAXException - */ - public Document parse(InputSource pIS) throws IOException, SAXException { - if (pIS == null) throw new IllegalArgumentException("null input stream argument"); - return this.iBuilder.parse(pIS); - } - - /** - * Serializes a given DOM document as (CIM-)XML to a given output stream - * - * @param pOS - * The output stream - * @param pDoc - * The documents - * @throws IOException - * Whenever something goes wrong - */ - public static void serialize(OutputStream pOS, Document pDoc) throws IOException { - CimXmlSerializer.serialize(pOS, pDoc, false); - } - - /** - * Serializes a given DOM document as (CIM-)XML to a given output stream. - * The document is pretty wrapped and indented and surrounded with markers - * for the begin and end. - * - * @param pOS - * The output stream - * @param pDoc - * The documents - * @throws IOException - */ - public static void dumpDocument(OutputStream pOS, Document pDoc) throws IOException { - dumpDocument(pOS, pDoc, null); - } - - /** - * Serializes a given DOM document as (CIM-)XML to a given output stream. - * The document is pretty wrapped and indented and surrounded with markers - * for the begin and end. - * - * @param pOS - * The output stream - * @param pDoc - * The documents - * @param pOrigin - * The origin of the output stream (request, indication response, - * etc.) - * @throws IOException - */ - public static void dumpDocument(OutputStream pOS, Document pDoc, String pOrigin) - throws IOException { - // debug - if (pOS == null) { return; } - if (pOrigin == null) pOrigin = "unknown"; - pOS.write("<--- ".getBytes()); - pOS.write(pOrigin.getBytes()); - pOS.write(" begin ".getBytes()); - pOS.write(TimeStamp.formatWithMillis(System.currentTimeMillis()).getBytes()); - pOS.write(" -----\n".getBytes()); - CimXmlSerializer.serialize(pOS, pDoc, true); - pOS.write("\n---- ".getBytes()); - pOS.write(pOrigin.getBytes()); - pOS.write(" end ------>\n".getBytes()); - } - - /** - * createCIMMessage - * - * @param pDoc - * @param pRequestE - * @return Element - */ - public Element createCIMMessage(Document pDoc, Element pRequestE) { - Element cimE = CIMXMLBuilderImpl.createCIM(pDoc); - Element messageE = CIMXMLBuilderImpl.createMESSAGE(pDoc, cimE, String.valueOf(getNextId()), - VERSION); - if (pRequestE != null) { - messageE.appendChild(pRequestE); - } - return messageE; - } - - /** - * createMultiReq - * - * @param pDoc - * @return Element - */ - public Element createMultiReq(Document pDoc) { - Element multireqE = CIMXMLBuilderImpl.createMULTIREQ(pDoc); - return multireqE; - } - - /** - * associatorNames_request - * - * @param pDoc - * @param pObjectName - * @param pAssocClass - * @param pResultClass - * @param pRole - * @param pResultRole - * @return Element - * @throws WBEMException - */ - public Element associatorNames_request(Document pDoc, CIMObjectPath pObjectName, - String pAssocClass, String pResultClass, String pRole, String pResultRole) - throws WBEMException { - - // obtain data - String className = pObjectName.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); - CIMProperty[] keysA = pObjectName.getKeys(); - - Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, - ASSOCIATOR_NAMES); - CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pObjectName); - - Element iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, "ObjectName"); - Element instancenameE = CIMXMLBuilderImpl.createINSTANCENAME(pDoc, iparamvalueE, className); - for (int i = 0; i < keysA.length; i++) { - CIMProperty prop = keysA[i]; - String propName = prop.getName(); - // TODO: check that CIMDataType.toString() satisfies this - String propTypeStr = prop.getDataType().toString(); - String propValueStr = valueStr(prop); - Element keybindingE = CIMXMLBuilderImpl.createKEYBINDING(pDoc, instancenameE, propName); - CIMXMLBuilderImpl.createKEYVALUE(pDoc, keybindingE, propTypeStr, propValueStr); - } - if (pAssocClass != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "AssocClass"); - CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, pAssocClass); - } - if (pResultClass != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ResultClass"); - CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, pResultClass); - } - if (pRole != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "Role"); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pRole); - } - if (pResultRole != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ResultRole"); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pResultRole); - } - - return simplereqE; - } - - /** - * associatorNames_response - * - * @param pDoc - * @param pPathA - * @return Element - */ - public static Element associatorNames_response(Document pDoc, CIMObjectPath[] pPathA) { - Element simpRspE = CIMXMLBuilderImpl.createSIMPLERSP(pDoc, null); - Element iMethRspE = CIMXMLBuilderImpl.createIMETHODRESPONSE(pDoc, simpRspE, - "associatorNames"); - Element iRetValE = CIMXMLBuilderImpl.createIRETURNVALUE(pDoc, iMethRspE); - try { - for (int i = 0; i < pPathA.length; i++) { - CIMXMLBuilderImpl.createOBJECTPATH(pDoc, iRetValE, pPathA[i]); - } - } catch (WBEMException e) { - throw new RuntimeException(e); - } - return simpRspE; - } - - /** - * associatorInstances_request - * - * @param pDoc - * @param pObjectName - * @param pAssocClass - * @param pResultClass - * @param pRole - * @param pResultRole - * @param pIncludeClassOrigin - * @param pPropertyList - * @return Element - * @throws WBEMException - */ - public Element associatorInstances_request(Document pDoc, CIMObjectPath pObjectName, - String pAssocClass, String pResultClass, String pRole, String pResultRole, - boolean pIncludeClassOrigin, String[] pPropertyList) throws WBEMException { - - String className = pObjectName.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); - CIMProperty[] keysA = pObjectName.getKeys(); - - // Make sure keys are populated - if (keysA.length == 0) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "associatorInstances requires keys for the instance to be populated"); - - Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "Associators"); - CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pObjectName); - Element iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, "ObjectName"); - Element instancenameE = CIMXMLBuilderImpl.createINSTANCENAME(pDoc, iparamvalueE, className); - for (int i = 0; i < keysA.length; i++) { - CIMProperty prop = keysA[i]; - String propName = prop.getName(); - String propTypeStr = prop.getDataType().toString(); - String propValueStr = valueStr(prop); - - Element keybindingE = CIMXMLBuilderImpl.createKEYBINDING(pDoc, instancenameE, propName); - CIMXMLBuilderImpl.createKEYVALUE(pDoc, keybindingE, propTypeStr, propValueStr); - } - if (pAssocClass != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "AssocClass"); - CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, pAssocClass); - } - if (pResultClass != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ResultClass"); - CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, pResultClass); - } - if (pRole != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "Role"); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pRole); - } - if (pResultRole != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ResultRole"); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pResultRole); - } - - iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, "IncludeClassOrigin"); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeClassOrigin); - - if (pPropertyList != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "PropertyList"); - Element valuearrayE = CIMXMLBuilderImpl.createVALUEARRAY(pDoc, iparamvalueE); - for (int i = 0; i < pPropertyList.length; i++) { - CIMXMLBuilderImpl.createVALUE(pDoc, valuearrayE, pPropertyList[i]); - } - } - - return simplereqE; - } - - /** - * associatorClasses_request - * - * @param pDoc - * @param pObjectName - * @param pAssocClass - * @param pResultClass - * @param pRole - * @param pResultRole - * @param pIncludeQualifiers - * @param pIncludeClassOrigin - * @param pPropertyList - * @return Element - * @throws WBEMException - */ - public Element associatorClasses_request(Document pDoc, CIMObjectPath pObjectName, - String pAssocClass, String pResultClass, String pRole, String pResultRole, - boolean pIncludeQualifiers, boolean pIncludeClassOrigin, String[] pPropertyList) - throws WBEMException { - - String className = pObjectName.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); - - // Make sure keys are not populated - if (pObjectName.getKeys().length != 0) throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, - "Keys should not be populated for associatorClasses"); - - Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "Associators"); - CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pObjectName); - Element iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, "ObjectName"); - - CIMXMLBuilderImpl.createINSTANCENAME(pDoc, iparamvalueE, className); - - if (pAssocClass != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "AssocClass"); - CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, pAssocClass); - } - if (pResultClass != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ResultClass"); - CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, pResultClass); - } - if (pRole != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "Role"); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pRole); - } - if (pResultRole != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ResultRole"); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pResultRole); - } - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "IncludeQualifiers"); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeQualifiers); - - iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, "IncludeClassOrigin"); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeClassOrigin); - - if (pPropertyList != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "PropertyList"); - Element valuearrayE = CIMXMLBuilderImpl.createVALUEARRAY(pDoc, iparamvalueE); - for (int i = 0; i < pPropertyList.length; i++) { - CIMXMLBuilderImpl.createVALUE(pDoc, valuearrayE, pPropertyList[i]); - } - } - - return simplereqE; - } - - /** - * associators_request - * - * @param pDoc - * @param pObjectName - * @param pAssocClass - * @param pResultClass - * @param pRole - * @param pResultRole - * @param pIncludeQualifiers - * @param pIncludeClassOrigin - * @param pPropertyList - * @return Element - * @throws WBEMException - */ - public Element associators_request(Document pDoc, CIMObjectPath pObjectName, - String pAssocClass, String pResultClass, String pRole, String pResultRole, - boolean pIncludeQualifiers, boolean pIncludeClassOrigin, String[] pPropertyList) - throws WBEMException { - - // obtain data - String className = pObjectName.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); - CIMProperty[] keysA = pObjectName.getKeys(); - - Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "Associators"); - CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pObjectName); - Element iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, "ObjectName"); - Element instancenameE = CIMXMLBuilderImpl.createINSTANCENAME(pDoc, iparamvalueE, className); - for (int i = 0; i < keysA.length; i++) { - CIMProperty prop = keysA[i]; - String propName = prop.getName(); - // TODO: check that CIMDataType.toString() satisfies this - String propTypeStr = prop.getDataType().toString(); - // CIMXMLBuilderImpl.getTypeStr(pValue.getType()); - String propValueStr = valueStr(prop); - - Element keybindingE = CIMXMLBuilderImpl.createKEYBINDING(pDoc, instancenameE, propName); - CIMXMLBuilderImpl.createKEYVALUE(pDoc, keybindingE, propTypeStr, propValueStr); - } - if (pAssocClass != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "AssocClass"); - CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, pAssocClass); - } - if (pResultClass != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ResultClass"); - CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, pResultClass); - } - if (pRole != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "Role"); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pRole); - } - if (pResultRole != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ResultRole"); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pResultRole); - } - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "IncludeQualifiers"); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeQualifiers); - - iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, "IncludeClassOrigin"); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeClassOrigin); - - if (pPropertyList != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "PropertyList"); // BB - // fixed - Element valuearrayE = CIMXMLBuilderImpl.createVALUEARRAY(pDoc, iparamvalueE); - for (int i = 0; i < pPropertyList.length; i++) { - CIMXMLBuilderImpl.createVALUE(pDoc, valuearrayE, pPropertyList[i]); - } - } - - return simplereqE; - } - - /** - * associators_response - * - * @param pDoc - * @param pNamedElementA - * @return Element - */ - public static Element associators_response(Document pDoc, - CIMNamedElementInterface[] pNamedElementA) { - Element simpRspE = CIMXMLBuilderImpl.createSIMPLERSP(pDoc, null); - Element iMethRspE = CIMXMLBuilderImpl.createIMETHODRESPONSE(pDoc, simpRspE, "associators"); - Element iRetValE = CIMXMLBuilderImpl.createIRETURNVALUE(pDoc, iMethRspE); - try { - for (int i = 0; i < pNamedElementA.length; i++) { - CIMNamedElementInterface namedElement = pNamedElementA[i]; - CIMObjectPath op = namedElement.getObjectPath(); - String nameSpace = op == null ? null : op.getNamespace(); - CIMXMLBuilderImpl - .createVALUEOBJECTWITHPATH(pDoc, iRetValE, namedElement, nameSpace); - /* - * CIMXMLBuilderImpl.createCLASSPATH( pDoc, iRetValE, - * pClassA[i].getObjectPath() ); - * CIMXMLBuilderImpl.createCLASS(pDoc, iRetValE, pClassA[i]); - */ - - } - } catch (WBEMException e) { - throw new RuntimeException(e); - } - return simpRspE; - } - - /** - * enumerateInstanceNames_request - * - * @param pDoc - * @param pPath - * @return Element - * @throws WBEMException - */ - public Element enumerateInstanceNames_request(Document pDoc, CIMObjectPath pPath) - throws WBEMException { - // obtain data - String className = pPath.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); - - Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, - "EnumerateInstanceNames"); - CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); - - Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ClassName"); - CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, className); - - return simplereqE; - } - - /** - * enumerateInstances_request - * - * @param pDoc - * @param pPath - * @param pDeepInheritance - * @param pLocalOnly - * @param pIncludeQualifiers - * @param pIncludeClassOrigin - * @param pPropertyList - * @return Element - * @throws WBEMException - */ - public Element enumerateInstances_request(Document pDoc, CIMObjectPath pPath, - boolean pDeepInheritance, boolean pLocalOnly, boolean pIncludeQualifiers, - boolean pIncludeClassOrigin, String[] pPropertyList) throws WBEMException { - - // obtain data - String className = pPath.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); - - Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, - "EnumerateInstances"); - CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); - - Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ClassName"); - CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, className); - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "LocalOnly"); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pLocalOnly); - - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "DeepInheritance"); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pDeepInheritance); - - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "IncludeQualifiers"); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeQualifiers); - - iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, "IncludeClassOrigin"); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeClassOrigin); - - if (pPropertyList != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "PropertyList"); - Element valuearrayE = CIMXMLBuilderImpl.createVALUEARRAY(pDoc, iparamvalueE); - for (int i = 0; i < pPropertyList.length; i++) { - CIMXMLBuilderImpl.createVALUE(pDoc, valuearrayE, pPropertyList[i]); - } - } - return simplereqE; - } - - /** - * getInstance_request - * - * @param pDoc - * @param pName - * @param pLocalOnly - * @param pIncludeQualifiers - * @param pIncludeClassOrigin - * @param pPropertyList - * @return Element - * @throws WBEMException - */ - public Element getInstance_request(Document pDoc, CIMObjectPath pName, boolean pLocalOnly, - boolean pIncludeQualifiers, boolean pIncludeClassOrigin, String[] pPropertyList) - throws WBEMException { - // obtain data - String className = pName.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); - - Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "GetInstance"); - CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pName); - - Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - "InstanceName"); - CIMXMLBuilderImpl.createINSTANCENAME(pDoc, iparamvalueE, pName); - - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "LocalOnly"); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pLocalOnly); - - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "IncludeQualifiers"); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeQualifiers); - - iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, "IncludeClassOrigin"); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeClassOrigin); - - if (pPropertyList != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "PropertyList"); - Element valuearrayE = CIMXMLBuilderImpl.createVALUEARRAY(pDoc, iparamvalueE); - for (int i = 0; i < pPropertyList.length; i++) { - CIMXMLBuilderImpl.createVALUE(pDoc, valuearrayE, pPropertyList[i]); - } - } - - return simplereqE; - } - - /** - * deleteInstance_request - * - * @param pDoc - * @param pName - * @return Element - * @throws WBEMException - */ - public Element deleteInstance_request(Document pDoc, CIMObjectPath pName) throws WBEMException { - - // obtain data - String className = pName.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); - - Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, - "DeleteInstance"); - CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pName); - - Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - "InstanceName"); - CIMXMLBuilderImpl.createINSTANCENAME(pDoc, iparamvalueE, pName); - - return simplereqE; - } - - /** - * getClass_request - * - * @param pDoc - * @param pName - * @param pLocalOnly - * @param pIncludeQualifiers - * @param pIncludeClassOrigin - * @param pPropertyList - * @return Element - * @throws WBEMException - */ - public Element getClass_request(Document pDoc, CIMObjectPath pName, boolean pLocalOnly, - boolean pIncludeQualifiers, boolean pIncludeClassOrigin, String[] pPropertyList) - throws WBEMException { - - // obtain data - String className = pName.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); - - Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "GetClass"); - CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pName); - - Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ClassName"); - CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, className); - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "LocalOnly"); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pLocalOnly); - - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "IncludeQualifiers"); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeQualifiers); - - iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, "IncludeClassOrigin"); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeClassOrigin); - - if (pPropertyList != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "PropertyList"); - Element valuearrayE = CIMXMLBuilderImpl.createVALUEARRAY(pDoc, iparamvalueE); - for (int i = 0; i < pPropertyList.length; i++) { - CIMXMLBuilderImpl.createVALUE(pDoc, valuearrayE, pPropertyList[i]); - } - } - - return simplereqE; - } - - /** - * createInstance_request - * - * @param pDoc - * @param pName - * @param pInstance - * @return Element - * @throws WBEMException - */ - public Element createInstance_request(Document pDoc, CIMObjectPath pName, CIMInstance pInstance) - throws WBEMException { - - String className = pInstance.getObjectPath().getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); - - Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, - "CreateInstance"); - CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pName); - Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - "NewInstance"); - - CIMXMLBuilderImpl.createINSTANCE(pDoc, iparamvalueE, pInstance); - - return simplereqE; - } - - /** - * invokeMethod_request - * - * @param pDoc - * @param pLocalPath - * @param pMethodName - * @param pInArgs - * @return Element - * @throws WBEMException - */ - public Element invokeMethod_request(Document pDoc, CIMObjectPath pLocalPath, - String pMethodName, CIMArgument[] pInArgs) throws WBEMException { - - // obtain data - String className = pLocalPath.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); - CIMProperty[] keysA = pLocalPath.getKeys(); - - Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element methodcallE = CIMXMLBuilderImpl.createMETHODCALL(pDoc, simplereqE, pMethodName); - - // 13521 - if (keysA.length > 0) { - Element localpathE = CIMXMLBuilderImpl.createLOCALINSTANCEPATH(pDoc, methodcallE); - CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, localpathE, pLocalPath); // 13521 - CIMXMLBuilderImpl.createINSTANCENAME(pDoc, localpathE, pLocalPath); // 13521 - } else { - CIMXMLBuilderImpl.createLOCALCLASSPATH(pDoc, methodcallE, pLocalPath); - } - - buildParamValues(pDoc, methodcallE, pLocalPath, pInArgs); - - return simplereqE; - } - - /** - * invokeMethod_response - * - * @param pDoc - * @param pMethodName - * @param pLocalPath - * @param pRetVal - * @param pOutArgA - * @return Element - * @throws WBEMException - */ - public static Element invokeMethod_response(Document pDoc, String pMethodName, - CIMObjectPath pLocalPath, Object pRetVal, CIMArgument[] pOutArgA) - throws WBEMException { - if (pMethodName == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null method name"); - Element simpleRspE = CIMXMLBuilderImpl.createSIMPLERSP(pDoc, null); - Element methodRspE = CIMXMLBuilderImpl.createMETHODRESPONSE(pDoc, simpleRspE, pMethodName); - - CIMXMLBuilderImpl.createRETURNVALUE(pDoc, methodRspE, pRetVal); - - buildParamValues(pDoc, methodRspE, pLocalPath, pOutArgA); - return simpleRspE; - } - - /** - * @param pLocalPath - */ - private static void buildParamValues(Document pDoc, Element pParentE, CIMObjectPath pLocalPath, - CIMArgument[] pArgA) throws WBEMException { - if (pArgA == null) return; - for (int i = 0; i < pArgA.length; i++) { - CIMArgument arg = pArgA[i]; - if (arg == null) continue; - CIMXMLBuilderImpl.createPARAMVALUE(pDoc, pParentE, arg); - } - } - - // public CIMResponse createIndication_request(Document doc) throws - // CIMXMLParseException, CIMException { - // Element rootE = doc.getDocumentElement(); - // CIMResponse response = (CIMResponse)xmlParser.parseCIM(rootE); - // response.checkError(); - // return response; - // // Vector v = (Vector)response.getFirstReturnValue(); - // // - // // //TODO: Should we return the whole list of instances or just the first - // instance? - // // //TODO: return the whole vector of indications - // // if (v.size() > 0) - // // return (CIMInstance)v.elementAt(0); - // // else - // // return null; - // } - - /** - * createIndication_response - * - * @param error - * @return Document - */ - public Document createIndication_response(CIMError error) { - - // CIMXMLBuilderImpl.create XML - Document doc = this.iBuilder.newDocument(); - Element cimE = CIMXMLBuilderImpl.createCIM(doc); - Element messageE = CIMXMLBuilderImpl.createMESSAGE(doc, cimE, String.valueOf(getNextId()), - "1.0"); - Element simpleexprspE = CIMXMLBuilderImpl.createSIMPLEEXPRSP(doc, messageE); - Element expmethodresponseE = CIMXMLBuilderImpl.createEXPMETHODRESPONSE(doc, simpleexprspE, - "ExportIndication"); - if (error == null) { - CIMXMLBuilderImpl.createIRETURNVALUE(doc, expmethodresponseE); - } else { - CIMXMLBuilderImpl.createERROR(doc, expmethodresponseE, error); - } - // Element - return doc; - } - - /** - * createClass_request - * - * @param pDoc - * @param pPath - * @param pClass - * @return Element - * @throws WBEMException - */ - public Element createClass_request(Document pDoc, CIMObjectPath pPath, CIMClass pClass) - throws WBEMException { - String className = pPath.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); - - Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "CreateClass"); - CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); - - Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "NewClass"); - - CIMXMLBuilderImpl.createCLASS(pDoc, iparamvalueE, pClass); - - return simplereqE; - } - - /** - * getQualifier_request - * - * @param pDoc - * @param pPath - * @param pQt - * @return Element - * @throws WBEMException - */ - public Element getQualifier_request(Document pDoc, CIMObjectPath pPath, String pQt) - throws WBEMException { - // obtain data - String className = pPath.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); - - Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl - .createIMETHODCALL(pDoc, simplereqE, "GetQualifier"); - CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); - - Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - "QualifierName"); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pPath.getObjectName()); - - return simplereqE; - } - - /** - * createQualifierType_request : This has been replaced by - * setQualifierType_request - * - * @param pDoc - * @param pPath - * @param pQt - * @return Element - * @throws WBEMException - */ - public Element createQualifierType_request(Document pDoc, CIMObjectPath pPath, - CIMQualifierType pQt) throws WBEMException { - String className = pPath.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); - - Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl - .createIMETHODCALL(pDoc, simplereqE, "SetQualifier"); - CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); - - Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - "QualifierDeclaration"); - CIMXMLBuilderImpl.createQUALIFIER_DECLARATION(pDoc, iparamvalueE, pQt); - - return simplereqE; - } - - /** - * deleteClass_request - * - * @param pDoc - * @param pPath - * @return Element - * @throws WBEMException - */ - public Element deleteClass_request(Document pDoc, CIMObjectPath pPath) throws WBEMException { - String className = pPath.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); - - Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "DeleteClass"); - CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); - - Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ClassName"); - - CIMXMLBuilderImpl.createOBJECTNAME(pDoc, iparamvalueE, pPath); - - return simplereqE; - } - - /** - * deleteQualifierType_request - * - * @param pDoc - * @param pPath - * @return Element - * @throws WBEMException - */ - public Element deleteQualifierType_request(Document pDoc, CIMObjectPath pPath) - throws WBEMException { - // obtain data - String className = pPath.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); - - Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, - "DeleteQualifier"); - CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); - - Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - "QualifierName"); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pPath.getObjectName()); - return simplereqE; - } - - /** - * enumerateClasses_request - * - * @param pDoc - * @param pPath - * @param pDeepInheritance - * @param pLocalOnly - * @param pIncludeQualifiers - * @param pIncludeClassOrigin - * @return Element - */ - public Element enumerateClasses_request(Document pDoc, CIMObjectPath pPath, - boolean pDeepInheritance, boolean pLocalOnly, boolean pIncludeQualifiers, - boolean pIncludeClassOrigin) { - - Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, - "EnumerateClasses"); - CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); - - Element iparamvalueE; - if (pPath != null && pPath.getObjectName() != null - && pPath.getObjectName().trim().length() != 0) { - String className = pPath.getObjectName(); - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ClassName"); - CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, className); - } - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "LocalOnly"); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pLocalOnly); - - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "DeepInheritance"); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pDeepInheritance); - - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "IncludeQualifiers"); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeQualifiers); - - iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, "IncludeClassOrigin"); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeClassOrigin); - return simplereqE; - } - - /** - * enumerateClasses_response - * - * @param pDoc - * @param pClA - * @return Element - */ - public static Element enumerateClasses_response(Document pDoc, CIMClass[] pClA) { - Element simpRspE = CIMXMLBuilderImpl.createSIMPLERSP(pDoc, null); - Element iMethRspE = CIMXMLBuilderImpl.createIMETHODRESPONSE(pDoc, simpRspE, - "enumerateClasses"); - Element iRetValE = CIMXMLBuilderImpl.createIRETURNVALUE(pDoc, iMethRspE); - try { - for (int i = 0; i < pClA.length; i++) { - CIMXMLBuilderImpl.createCLASS(pDoc, iRetValE, pClA[i]); - } - } catch (WBEMException e) { - throw new RuntimeException(e); - } - return simpRspE; - } - - /** - * enumerateInstances_response - * - * @param pDoc - * @param pInstA - * @return Element - */ - public static Element enumerateInstances_response(Document pDoc, CIMInstance[] pInstA) { - Element simpRspE = CIMXMLBuilderImpl.createSIMPLERSP(pDoc, null); - Element iMethRspE = CIMXMLBuilderImpl.createIMETHODRESPONSE(pDoc, simpRspE, - "enumerateInstances"); - Element iRetValE = CIMXMLBuilderImpl.createIRETURNVALUE(pDoc, iMethRspE); - try { - for (int i = 0; i < pInstA.length; i++) { - CIMXMLBuilderImpl.createINSTANCE(pDoc, iRetValE, pInstA[i]); - } - } catch (WBEMException e) { - throw new RuntimeException(e); - } - return simpRspE; - } - - /** - * enumerateClassNames_request - * - * @param pDoc - * @param pPath - * @param pDeepInheritance - * @return Element - */ - public Element enumerateClassNames_request(Document pDoc, CIMObjectPath pPath, - boolean pDeepInheritance) { - - Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, - "EnumerateClassNames"); - CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); - - Element iparamvalueE; - - if (pPath != null && pPath.getObjectName() != null - && pPath.getObjectName().trim().length() != 0) { - String className = pPath.getObjectName(); - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ClassName"); - CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, className); - } - - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "DeepInheritance"); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pDeepInheritance); - - return simplereqE; - } - - /** - * getProperty_request - * - * @param pDoc - * @param pPath - * @param pPropertyName - * @return Element - * @throws WBEMException - */ - public Element getProperty_request(Document pDoc, CIMObjectPath pPath, String pPropertyName) - throws WBEMException { - // obtain data - String className = pPath.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); - - Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "GetProperty"); - CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); - - Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - "InstanceName"); - CIMXMLBuilderImpl.createINSTANCENAME(pDoc, iparamvalueE, pPath); - - if (pPropertyName != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "PropertyName"); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pPropertyName); - } - - return simplereqE; - } - - /** - * referenceNames_request - * - * @param pDoc - * @param pPath - * @param pResultClass - * @param pRole - * @return Element - * @throws WBEMException - */ - public Element referenceNames_request(Document pDoc, CIMObjectPath pPath, String pResultClass, - String pRole) throws WBEMException { - String className = pPath.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); - - Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, - "ReferenceNames"); - CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); - - Element iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, "ObjectName"); - CIMXMLBuilderImpl.createOBJECTNAME(pDoc, iparamvalueE, pPath); - - if (pResultClass != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ResultClass"); - CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, pResultClass); - } - if (pRole != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "Role"); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pRole); - } - - return simplereqE; - } - - /** - * referenceClasses_request - * - * @param pDoc - * @param pPath - * @param pResultClass - * @param pRole - * @param pIncludeQualifiers - * @param pIncludeClassOrigin - * @param pPropertyList - * @return Element - * @throws WBEMException - */ - public Element referenceClasses_request(Document pDoc, CIMObjectPath pPath, - String pResultClass, String pRole, boolean pIncludeQualifiers, - boolean pIncludeClassOrigin, String[] pPropertyList) throws WBEMException { - - String className = pPath.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); - - // Make sure keys are not populated - if (pPath.getKeys().length != 0) throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, - "Keys should not be populated for referenceClasses"); - - Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "References"); - CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); - - Element iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, "ObjectName"); - // createOBJECTNAME will internally call createINSTANCENAME but as there - // are no keys Element containing keys will not be populated - CIMXMLBuilderImpl.createOBJECTNAME(pDoc, iparamvalueE, pPath); - - if (pResultClass != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ResultClass"); - CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, pResultClass); - } - if (pRole != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "Role"); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pRole); - } - - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "IncludeQualifiers"); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeQualifiers); - - iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, "IncludeClassOrigin"); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeClassOrigin); - - if (pPropertyList != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "PropertyList"); - Element valuearrayE = CIMXMLBuilderImpl.createVALUEARRAY(pDoc, iparamvalueE); - for (int i = 0; i < pPropertyList.length; i++) { - CIMXMLBuilderImpl.createVALUE(pDoc, valuearrayE, pPropertyList[i]); - } - } - return simplereqE; - } - - /** - * referenceInstances_request - * - * @param pDoc - * @param pPath - * @param pResultClass - * @param pRole - * @param pIncludeClassOrigin - * @param pPropertyList - * @return Element - * @throws WBEMException - */ - public Element referenceInstances_request(Document pDoc, CIMObjectPath pPath, - String pResultClass, String pRole, boolean pIncludeClassOrigin, String[] pPropertyList) - throws WBEMException { - - String className = pPath.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); - - // keys are required for CIMInstance - if (pPath.getKeys().length == 0) throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, - "refrenceInstances requires keys for the instance to be populated"); - - Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "References"); - CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); - - Element iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, "ObjectName"); - // createOBJECTNAME will internally call createINSTANCENAME to populate - // Element containing keys - CIMXMLBuilderImpl.createOBJECTNAME(pDoc, iparamvalueE, pPath); - - if (pResultClass != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ResultClass"); - CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, pResultClass); - } - if (pRole != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "Role"); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pRole); - } - - iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, "IncludeClassOrigin"); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeClassOrigin); - - if (pPropertyList != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "PropertyList"); - Element valuearrayE = CIMXMLBuilderImpl.createVALUEARRAY(pDoc, iparamvalueE); - for (int i = 0; i < pPropertyList.length; i++) { - CIMXMLBuilderImpl.createVALUE(pDoc, valuearrayE, pPropertyList[i]); - } - } - return simplereqE; - } - - /** - * references_request - * - * @param pDoc - * @param pPath - * @param pResultClass - * @param pRole - * @param pIncludeQualifiers - * @param pIncludeClassOrigin - * @param pPropertyList - * @return Element - * @throws WBEMException - */ - public Element references_request(Document pDoc, CIMObjectPath pPath, String pResultClass, - String pRole, boolean pIncludeQualifiers, boolean pIncludeClassOrigin, - String[] pPropertyList) throws WBEMException { - String className = pPath.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); - - Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "References"); - CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); - - Element iparamvalueE; - - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ObjectName"); - CIMXMLBuilderImpl.createOBJECTNAME(pDoc, iparamvalueE, pPath); - - if (pResultClass != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ResultClass"); - CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, pResultClass); - } - if (pRole != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "Role"); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pRole); - } - - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "IncludeQualifiers"); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeQualifiers); - - iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, "IncludeClassOrigin"); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeClassOrigin); - - if (pPropertyList != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "PropertyList"); - Element valuearrayE = CIMXMLBuilderImpl.createVALUEARRAY(pDoc, iparamvalueE); - for (int i = 0; i < pPropertyList.length; i++) { - CIMXMLBuilderImpl.createVALUE(pDoc, valuearrayE, pPropertyList[i]); - } - } - - return simplereqE; - } - - /** - * setClass_request - * - * @param pDoc - * @param pPath - * @param pClass - * @return Element - * @throws WBEMException - */ - public Element setClass_request(Document pDoc, CIMObjectPath pPath, CIMClass pClass) - throws WBEMException { - String className = pPath.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); - - Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "ModifyClass"); - CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); - - Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - "ModifiedClass"); - CIMXMLBuilderImpl.createCLASS(pDoc, iparamvalueE, pClass); - - return simplereqE; - } - - /** - * setInstance_request - * - * @param pDoc - * @param pPath - * @param pInstance - * @param pIncludeQualifiers - * @param pPropertyList - * @return Element - * @throws WBEMException - */ - public Element setInstance_request(Document pDoc, CIMObjectPath pPath, CIMInstance pInstance, - boolean pIncludeQualifiers, String[] pPropertyList) throws WBEMException { - String className = pPath.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); - - Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, - "ModifyInstance"); - CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); - - Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - "ModifiedInstance"); - CIMXMLBuilderImpl.createVALUENAMEDINSTANCE(pDoc, iparamvalueE, pPath, pInstance); - - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "IncludeQualifiers"); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeQualifiers); - - if (pPropertyList != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "PropertyList"); - Element valuearrayE = CIMXMLBuilderImpl.createVALUEARRAY(pDoc, iparamvalueE); - for (int i = 0; i < pPropertyList.length; i++) { - CIMXMLBuilderImpl.createVALUE(pDoc, valuearrayE, pPropertyList[i]); - } - } - - return simplereqE; - } - - /** - * setProperty_request - * - * @param pDoc - * @param pPath - * @param pPropertyName - * @param pNewValue - * @return Element - * @throws WBEMException - */ - public Element setProperty_request(Document pDoc, CIMObjectPath pPath, String pPropertyName, - Object pNewValue) throws WBEMException { - String className = pPath.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); - - Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "SetProperty"); - CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); - - Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - "InstanceName"); - CIMXMLBuilderImpl.createINSTANCENAME(pDoc, iparamvalueE, pPath); - - if (pPropertyName != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "PropertyName"); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pPropertyName); - } - - if (pNewValue != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "NewValue"); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pNewValue); - } - - return simplereqE; - } - - /** - * setQualifierType_request - * - * @param pDoc - * @param pPath - * @param pQt - * @return Element - * @throws WBEMException - */ - public Element setQualifierType_request(Document pDoc, CIMObjectPath pPath, - CIMQualifierType pQt) throws WBEMException { - // Make sure class name exists, it is required to uniquely identify - // qualifier in namespace - String className = pPath.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); - - Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl - .createIMETHODCALL(pDoc, simplereqE, "SetQualifier"); - CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); - - Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - "QualifierDeclaration"); - CIMXMLBuilderImpl.createQUALIFIER_DECLARATION(pDoc, iparamvalueE, pQt); - - return simplereqE; - } - - /** - * enumQualifierTypes_request - * - * @param pDoc - * @param pPath - * @return Element - * @throws WBEMException - */ - public Element enumQualifierTypes_request(Document pDoc, CIMObjectPath pPath) - throws WBEMException { - - Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, - "EnumerateQualifiers"); - CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); - - return simplereqE; - } - - /** - * enumQualifierTypes_response - * - * @param pDoc - * @param pQualiTypeA - * @return Element - * @throws WBEMException - */ - public static Element enumQualifierTypes_response(Document pDoc, - CIMQualifierType[] pQualiTypeA) throws WBEMException { - Element simpRspE = CIMXMLBuilderImpl.createSIMPLERSP(pDoc, null); - Element iMethRspE = CIMXMLBuilderImpl.createIMETHODRESPONSE(pDoc, simpRspE, - "associatorNames"); - Element iRetValE = CIMXMLBuilderImpl.createIRETURNVALUE(pDoc, iMethRspE); - for (int i = 0; i < pQualiTypeA.length; i++) { - CIMXMLBuilderImpl.createQUALIFIER_DECLARATION(pDoc, iRetValE, pQualiTypeA[i]); - } - return simpRspE; - } - - /** - * execQuery_request - * - * @param pDoc - * @param pPath - * @param pQuery - * @param pQueryLanguage - * @return Element - */ - public Element execQuery_request(Document pDoc, CIMObjectPath pPath, String pQuery, - String pQueryLanguage) { - Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "ExecQuery"); - CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); - - Element querylanguageE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - "QueryLanguage"); - CIMXMLBuilderImpl.createVALUE(pDoc, querylanguageE, pQueryLanguage); - - Element queryE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "Query"); - CIMXMLBuilderImpl.createVALUE(pDoc, queryE, pQuery); - - return simplereqE; - } - - /** - * performBatchOperation_request - * - * @param pDoc - * @param pOperations - * @return Element - * @throws WBEMException - */ - public Element performBatchOperation_request(Document pDoc, Vector pOperations) - throws WBEMException { - - Element messageE = createCIMMessage(pDoc, null); - if (pOperations.size() > 1) { - Element multireqE = createMultiReq(pDoc); - messageE.appendChild(multireqE); - messageE = multireqE; - } - int i = 0; - Iterator iter = pOperations.iterator(); - while (iter.hasNext()) { - CIMOperation op = iter.next(); - try { - Element requestE = null; - - if (op instanceof CIMAssociatorsOp) { - CIMAssociatorsOp associatorsOp = (CIMAssociatorsOp) op; - requestE = associators_request(pDoc, associatorsOp.getObjectName(), - associatorsOp.getAssocClass(), associatorsOp.getResultClass(), - associatorsOp.getRole(), associatorsOp.getResultRole(), associatorsOp - .isIncludeQualifiers(), associatorsOp.isIncludeClassOrigin(), - associatorsOp.getPropertyList()); - } else if (op instanceof CIMAssociatorNamesOp) { - CIMAssociatorNamesOp associatorNamesOp = (CIMAssociatorNamesOp) op; - requestE = associatorNames_request(pDoc, associatorNamesOp.getObjectName(), - associatorNamesOp.getAssocClass(), associatorNamesOp.getResultClass(), - associatorNamesOp.getRole(), associatorNamesOp.getResultRole()); - } else if (op instanceof CIMCreateClassOp) { - CIMCreateClassOp createClassOp = (CIMCreateClassOp) op; - requestE = createClass_request(pDoc, createClassOp.getObjectName(), - createClassOp.getCimClass()); - } else if (op instanceof CIMCreateInstanceOp) { - CIMCreateInstanceOp createInstanceOp = (CIMCreateInstanceOp) op; - requestE = createInstance_request(pDoc, createInstanceOp.getObjectName(), - createInstanceOp.getInstance()); - } else if (op instanceof CIMCreateNameSpaceOp) { - CIMCreateNameSpaceOp createNameSpaceOp = (CIMCreateNameSpaceOp) op; - - String namespace = createNameSpaceOp.getNameSpace(); - int j = namespace.lastIndexOf('/'); - - if (j < 0) throw new WBEMException(WBEMException.CIM_ERR_NOT_FOUND, - "Invalid namespace. Must contain at least /"); - String parentNs = namespace.substring(0, j); - namespace = namespace.substring(j + 1); - - /* - * CIMInstance inst = new CIMInstance(); - * inst.setClassName("CIM_NameSpace"); CIMProperty prop = - * new CIMProperty("NameSpace"); prop.setValue(new - * CIMValue(namespace, CIMDataType - * .getPredefinedType(CIMDataType.STRING))); Vector v = new - * Vector(); v.add(prop); inst.setProperties(v); - */ - - CIMInstance inst = new CIMInstance(new CIMObjectPath(null, null, null, null, - "CIM_NameSpace", null), new CIMProperty[] { new CIMProperty( - "NameSpace", CIMDataType.STRING_T, namespace, true, false, null) }); - CIMObjectPath object = new CIMObjectPath(null, null, null, parentNs, null, null); - - requestE = createInstance_request(pDoc, object, inst); - } else if (op instanceof CIMCreateQualifierTypeOp) { - CIMCreateQualifierTypeOp createQualifierTypeOp = (CIMCreateQualifierTypeOp) op; - requestE = createQualifierType_request(pDoc, createQualifierTypeOp - .getObjectName(), createQualifierTypeOp.getQualifierType()); - } else if (op instanceof CIMDeleteClassOp) { - CIMDeleteClassOp deleteClassOp = (CIMDeleteClassOp) op; - requestE = deleteClass_request(pDoc, deleteClassOp.getObjectName()); - } else if (op instanceof CIMDeleteInstanceOp) { - CIMDeleteInstanceOp deleteInstanceOp = (CIMDeleteInstanceOp) op; - requestE = deleteClass_request(pDoc, deleteInstanceOp.getObjectName()); - } else if (op instanceof CIMDeleteQualifierTypeOp) { - CIMDeleteQualifierTypeOp deleteQualifierTypeOp = (CIMDeleteQualifierTypeOp) op; - requestE = deleteClass_request(pDoc, deleteQualifierTypeOp.getObjectName()); - } else if (op instanceof CIMEnumClassesOp) { - CIMEnumClassesOp enumClassesOp = (CIMEnumClassesOp) op; - requestE = enumerateClasses_request(pDoc, enumClassesOp.getObjectName(), - enumClassesOp.isDeep(), enumClassesOp.isLocalOnly(), enumClassesOp - .isIncludeQualifiers(), enumClassesOp.isIncludeClassOrigin()); - } else if (op instanceof CIMEnumClassNamesOp) { - CIMEnumClassNamesOp enumClassNamesOp = (CIMEnumClassNamesOp) op; - requestE = enumerateClassNames_request(pDoc, enumClassNamesOp.getObjectName(), - enumClassNamesOp.isDeep()); - } else if (op instanceof CIMEnumInstanceNamesOp) { - CIMEnumInstanceNamesOp enumInstanceNamesOp = (CIMEnumInstanceNamesOp) op; - requestE = enumerateInstanceNames_request(pDoc, enumInstanceNamesOp - .getObjectName()); - } else if (op instanceof CIMEnumInstancesOp) { - CIMEnumInstancesOp enumInstancesOp = (CIMEnumInstancesOp) op; - requestE = enumerateInstances_request(pDoc, enumInstancesOp.getObjectName(), - enumInstancesOp.isDeep(), enumInstancesOp.isLocalOnly(), - enumInstancesOp.isIncludeQualifiers(), enumInstancesOp - .isIncludeClassOrigin(), enumInstancesOp.getPropertyList()); - } else if (op instanceof CIMEnumNameSpaceOp) { - CIMEnumNameSpaceOp enumNameSpaceOp = (CIMEnumNameSpaceOp) op; - // ebak: here we have to set CIMObjectPath's objectname - // enumNameSpaceOp.getObjectName().setObjectName("CIM_NameSpace"); - CIMObjectPath objPath = enumNameSpaceOp.getObjectName(); - objPath = new CIMObjectPath(objPath.getScheme(), objPath.getHost(), objPath - .getPort(), objPath.getNamespace(), "CIM_NameSpace", objPath.getKeys()); - requestE = enumerateInstanceNames_request(pDoc, enumNameSpaceOp.getObjectName()); - } else if (op instanceof CIMEnumQualifierTypesOp) { - CIMEnumQualifierTypesOp enumQualifierTypesOp = (CIMEnumQualifierTypesOp) op; - requestE = enumQualifierTypes_request(pDoc, enumQualifierTypesOp - .getObjectName()); - } else if (op instanceof CIMExecQueryOp) { - CIMExecQueryOp execQueryOp = (CIMExecQueryOp) op; - requestE = execQuery_request(pDoc, execQueryOp.getObjectName(), execQueryOp - .getQuery(), execQueryOp.getQueryLanguage()); - } else if (op instanceof CIMGetPropertyOp) { - CIMGetPropertyOp getPropertyOp = (CIMGetPropertyOp) op; - requestE = getInstance_request(pDoc, getPropertyOp.getObjectName(), false, - false, false, new String[] { getPropertyOp.getPropertyName() }); - - } else if (op instanceof CIMGetClassOp) { - CIMGetClassOp getClassOp = (CIMGetClassOp) op; - requestE = getClass_request(pDoc, getClassOp.getObjectName(), getClassOp - .isLocalOnly(), getClassOp.isIncludeQualifiers(), getClassOp - .isIncludeClassOrigin(), getClassOp.getPropertyList()); - } else if (op instanceof CIMGetInstanceOp) { - CIMGetInstanceOp getInstanceOp = (CIMGetInstanceOp) op; - requestE = getInstance_request(pDoc, getInstanceOp.getObjectName(), - getInstanceOp.isLocalOnly(), getInstanceOp.isIncludeQualifiers(), - getInstanceOp.isIncludeClassOrigin(), getInstanceOp.getPropertyList()); - } else if (op instanceof CIMGetQualifierTypeOp) { - CIMGetQualifierTypeOp getQualifierTypeOp = (CIMGetQualifierTypeOp) op; - requestE = getQualifier_request(pDoc, getQualifierTypeOp.getObjectName(), - getQualifierTypeOp.getQualifierType()); - } else if (op instanceof CIMInvokeMethodOp) { - CIMInvokeMethodOp invokeMethodOp = (CIMInvokeMethodOp) op; - requestE = invokeMethod_request(pDoc, invokeMethodOp.getObjectName(), - invokeMethodOp.getMethodCall(), invokeMethodOp.getInParams()); - } else if (op instanceof CIMReferenceNamesOp) { - CIMReferenceNamesOp referenceNamesOp = (CIMReferenceNamesOp) op; - requestE = referenceNames_request(pDoc, referenceNamesOp.getObjectName(), - referenceNamesOp.getResultClass(), referenceNamesOp.getResultRole()); - } else if (op instanceof CIMReferencesOp) { - CIMReferencesOp referencesOp = (CIMReferencesOp) op; - requestE = references_request(pDoc, referencesOp.getObjectName(), referencesOp - .getResultClass(), referencesOp.getRole(), referencesOp - .isIncludeQualifiers(), referencesOp.isIncludeClassOrigin(), - referencesOp.getPropertyList()); - } else if (op instanceof CIMSetClassOp) { - CIMSetClassOp setClassOp = (CIMSetClassOp) op; - requestE = setClass_request(pDoc, setClassOp.getObjectName(), setClassOp - .getCimClass()); - } else if (op instanceof CIMSetInstanceOp) { - CIMSetInstanceOp setInstanceOp = (CIMSetInstanceOp) op; - requestE = setInstance_request(pDoc, setInstanceOp.getObjectName(), - setInstanceOp.getInstance(), setInstanceOp.isIncludeQualifiers(), - setInstanceOp.getPropertyList()); - } else if (op instanceof CIMSetPropertyOp) { - CIMSetPropertyOp setPropertyOp = (CIMSetPropertyOp) op; - requestE = setProperty_request(pDoc, setPropertyOp.getObjectName(), - setPropertyOp.getPropertyName(), setPropertyOp.getCimValue()); - } else if (op instanceof CIMSetQualifierTypeOp) { - CIMSetQualifierTypeOp setQualifierTypeOp = (CIMSetQualifierTypeOp) op; - requestE = setQualifierType_request(pDoc, setQualifierTypeOp.getObjectName(), - setQualifierTypeOp.getQualifierType()); - } - if (requestE == null) throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, "Illegal batch operation number (" - + i + ") " + op.getClass()); - messageE.appendChild(requestE); - } catch (WBEMException e) { - throw e; - } catch (Exception e) { - throw new WBEMException(WBEMException.CIM_ERR_FAILED, "At batch operation (" + i - + ')', null, e); - } - i++; - } - return messageE; - } - - /** - * Sets the message id counter to a given value. For use in units tests - * only. - * - * @param pId - * The new value - */ - public void setId(int pId) { - this.iCurrentId.set(new Counter(pId - 1)); - } - - /** - * Get the next message id. If this method is called for the first time by - * the current thread it will choose a start value randomly. Afterwards the - * id is incremented by 1. Be aware that different threads will have - * distinct id counters. - * - * @return The next message id - */ - private int getNextId() { - if (this.iCurrentId.get() == null) { - this.iCurrentId.set(new Counter(RANDOM.nextInt(MAX_ID))); - } - return this.iCurrentId.get().incrementAndGet(); - } - - /** - * pAssociatorPaths_request - * - * @param pDoc - * @param pPath - * @param pAssocClass - * @param pResultClass - * @param pRole - * @param pResultRole - * @param pFilterQueryLanguage - * @param pFilterQuery - * @param pOperationTimeout - * @param pContinueOnError - * @param pMaxObjectCount - * @return Element - * @throws WBEMException - */ - public Element OpenAssociatorInstancePaths_request(Document pDoc, CIMObjectPath pPath, - String pAssocClass, String pResultClass, String pRole, String pResultRole, - String pFilterQueryLanguage, String pFilterQuery, UnsignedInteger32 pOperationTimeout, - boolean pContinueOnError, UnsignedInteger32 pMaxObjectCount) throws WBEMException { - - String className = pPath.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); - - Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, - "OpenAssociatorInstancePaths"); - CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); - - Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - INSTANCE_NAME); - CIMXMLBuilderImpl.createINSTANCENAME(pDoc, iparamvalueE, pPath); - - if (pAssocClass != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, ASSOC_CLASS); - CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, pAssocClass); - } - if (pResultClass != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, RESULT_CLASS); - CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, pResultClass); - } - if (pRole != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, ROLE); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pRole); - } - if (pResultRole != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, RESULT_ROLE); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pResultRole); - } - if (pFilterQueryLanguage != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - FILTER_QUERY_LANGUAGE); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pFilterQueryLanguage); - } - if (pFilterQuery != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, FILTER_QUERY); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pFilterQuery); - } - if (pOperationTimeout != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - OPERATION_TIMEOUT); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pOperationTimeout); - } - - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, CONTINUE_ON_ERROR); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pContinueOnError); - - if (pMaxObjectCount != null) { - iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, MAX_OBJECT_COUNT); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pMaxObjectCount); - } - - return simplereqE; - } - - /** - * OpenAssociatorInstances_request - * - * @param pDoc - * @param pPath - * @param pAssocClass - * @param pResultClass - * @param pRole - * @param pResultRole - * @param pIncludeClassOrigin - * @param pPropertyList - * @param pFilterQueryLanguage - * @param pFilterQuery - * @param pOperationTimeout - * @param pContinueOnError - * @param pMaxObjectCount - * @return Element OpenAssociatorInstances_request - * @throws WBEMException - */ - public Element OpenAssociatorInstances_request(Document pDoc, CIMObjectPath pPath, - String pAssocClass, String pResultClass, String pRole, String pResultRole, - boolean pIncludeClassOrigin, String[] pPropertyList, String pFilterQueryLanguage, - String pFilterQuery, UnsignedInteger32 pOperationTimeout, boolean pContinueOnError, - UnsignedInteger32 pMaxObjectCount) throws WBEMException { - - String className = pPath.getObjectName(); - - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); - - Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, - "OpenAssociatorInstances"); - CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); - - Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - INSTANCE_NAME); - // createINSTANCENAME will take care of keyBindings - CIMXMLBuilderImpl.createINSTANCENAME(pDoc, iparamvalueE, pPath); - - if (pAssocClass != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, ASSOC_CLASS); - CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, pAssocClass); - } - if (pResultClass != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, RESULT_CLASS); - CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, pResultClass); - } - if (pRole != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, ROLE); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pRole); - } - if (pResultRole != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, RESULT_ROLE); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pResultRole); - } - iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, INCLUDE_CLASS_ORIGIN); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeClassOrigin); - - if (pPropertyList != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, PROPERTY_LIST); - Element valuearrayE = CIMXMLBuilderImpl.createVALUEARRAY(pDoc, iparamvalueE); - for (int i = 0; i < pPropertyList.length; i++) - CIMXMLBuilderImpl.createVALUE(pDoc, valuearrayE, pPropertyList[i]); - } - if (pFilterQueryLanguage != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - FILTER_QUERY_LANGUAGE); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pFilterQueryLanguage); - } - if (pFilterQuery != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, FILTER_QUERY); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pFilterQuery); - } - if (pOperationTimeout != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - OPERATION_TIMEOUT); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pOperationTimeout); - } - - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, CONTINUE_ON_ERROR); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pContinueOnError); - - if (pMaxObjectCount != null) { - iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, MAX_OBJECT_COUNT); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pMaxObjectCount); - } - - return simplereqE; - } - - /** - * OpenEnumerateInstancePaths_request - * - * @param pDoc - * @param pPath - * @param pFilterQueryLanguage - * @param pFilterQuery - * @param pOperationTimeout - * @param pContinueOnError - * @param pMaxObjectCount - * @return Element - * @throws WBEMException - */ - public Element OpenEnumerateInstancePaths_request(Document pDoc, CIMObjectPath pPath, - String pFilterQueryLanguage, String pFilterQuery, UnsignedInteger32 pOperationTimeout, - boolean pContinueOnError, UnsignedInteger32 pMaxObjectCount) throws WBEMException { - - String className = pPath.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); - - Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, - "OpenEnumerateInstancePaths"); - CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); - - Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, CLASS_NAME); - CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, className); - - if (pFilterQueryLanguage != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - FILTER_QUERY_LANGUAGE); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pFilterQueryLanguage); - } - if (pFilterQuery != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, FILTER_QUERY); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pFilterQuery); - } - if (pOperationTimeout != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - OPERATION_TIMEOUT); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pOperationTimeout); - } - - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, CONTINUE_ON_ERROR); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pContinueOnError); - - if (pMaxObjectCount != null) { - iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, MAX_OBJECT_COUNT); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pMaxObjectCount); - } - - return simplereqE; - } - - /** - * OpenEnumerateInstances_request - * - * @param pDoc - * @param pPath - * @param pPropertyList - * @param pIncludeClassOrigin - * @param pDeepInheritance - * @param pFilterQueryLanguage - * @param pFilterQuery - * @param pOperationTimeout - * @param pContinueOnError - * @param pMaxObjectCount - * @return Element - * @throws WBEMException - */ - public Element OpenEnumerateInstances_request(Document pDoc, CIMObjectPath pPath, - boolean pDeepInheritance, boolean pIncludeClassOrigin, String[] pPropertyList, - String pFilterQueryLanguage, String pFilterQuery, UnsignedInteger32 pOperationTimeout, - boolean pContinueOnError, UnsignedInteger32 pMaxObjectCount) throws WBEMException { - - String className = pPath.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); - - Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, - "OpenEnumerateInstances"); - CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); - - Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, CLASS_NAME); - CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, className); - - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, DEEP_INHERITANCE); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pDeepInheritance); - - iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, INCLUDE_CLASS_ORIGIN); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeClassOrigin); - - if (pPropertyList != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, PROPERTY_LIST); - Element valuearrayE = CIMXMLBuilderImpl.createVALUEARRAY(pDoc, iparamvalueE); - for (int i = 0; i < pPropertyList.length; i++) - CIMXMLBuilderImpl.createVALUE(pDoc, valuearrayE, pPropertyList[i]); - } - - if (pFilterQueryLanguage != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - FILTER_QUERY_LANGUAGE); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pFilterQueryLanguage); - } - if (pFilterQuery != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, FILTER_QUERY); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pFilterQuery); - } - if (pOperationTimeout != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - OPERATION_TIMEOUT); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pOperationTimeout); - } - - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, CONTINUE_ON_ERROR); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pContinueOnError); - - if (pMaxObjectCount != null) { - iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, MAX_OBJECT_COUNT); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pMaxObjectCount); - } - - return simplereqE; - } - - /** - * EnumerationCount_request - * - * @param pDoc - * @param pPath - * @param pEnumerationContext - * @return Element - * @throws WBEMException - */ - public Element EnumerationCount_request(Document pDoc, CIMObjectPath pPath, - String pEnumerationContext) throws WBEMException { - - String className = pPath.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); - - Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, - "EnumerationCount"); - CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); - - if (pEnumerationContext != null) { - Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - ENUMERATION_CONTEXT); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pEnumerationContext); - } - - return simplereqE; - - } - - /** - * CloseEnumeration_request - * - * @param pDoc - * @param pPath - * @param pEnumerationContext - * @return Element - * @throws WBEMException - */ - public Element CloseEnumeration_request(Document pDoc, CIMObjectPath pPath, - String pEnumerationContext) throws WBEMException { - - String className = pPath.getObjectName(); - - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); - - Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, - "CloseEnumeration"); - CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); - - if (pEnumerationContext != null) { - Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - ENUMERATION_CONTEXT); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pEnumerationContext); - } - return simplereqE; - } - - /** - * referencePaths_request - * - * @param pDoc - * @param pPath - * @param pResultClass - * @param pRole - * @param pFilterQueryLanguage - * @param pFilterQuery - * @param pOperationTimeout - * @param pContinueOnError - * @param pMaxObjectCount - * @return Element referencePaths_request - * @throws WBEMException - */ - public Element OpenReferenceInstancePaths_request(Document pDoc, CIMObjectPath pPath, - String pResultClass, String pRole, String pFilterQueryLanguage, String pFilterQuery, - UnsignedInteger32 pOperationTimeout, boolean pContinueOnError, - UnsignedInteger32 pMaxObjectCount) throws WBEMException { - - String className = pPath.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); - - Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, - "OpenReferenceInstancePaths"); - CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); - - Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - INSTANCE_NAME); - CIMXMLBuilderImpl.createINSTANCENAME(pDoc, iparamvalueE, pPath); - - if (pResultClass != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, RESULT_CLASS); - CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, pResultClass); - } - if (pRole != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, ROLE); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pRole); - } - if (pFilterQueryLanguage != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - FILTER_QUERY_LANGUAGE); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pFilterQueryLanguage); - } - if (pFilterQuery != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, FILTER_QUERY); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pFilterQuery); - } - if (pOperationTimeout != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - OPERATION_TIMEOUT); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pOperationTimeout); - } - - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, CONTINUE_ON_ERROR); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pContinueOnError); - - if (pMaxObjectCount != null) { - iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, MAX_OBJECT_COUNT); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pMaxObjectCount); - } - - return simplereqE; - - } - - /** - * references_request - * - * @param pDoc - * @param pPath - * @param pResultClass - * @param pRole - * @param pIncludeClassOrigin - * @param pPropertyList - * @param pFilterQueryLanguage - * @param pFilterQuery - * @param pOperationTimeout - * @param pContinueOnError - * @param pMaxObjectCount - * @return Element references_request - * @throws WBEMException - */ - public Element OpenReferenceInstances_request(Document pDoc, CIMObjectPath pPath, - String pResultClass, String pRole, boolean pIncludeClassOrigin, String[] pPropertyList, - String pFilterQueryLanguage, String pFilterQuery, UnsignedInteger32 pOperationTimeout, - boolean pContinueOnError, UnsignedInteger32 pMaxObjectCount) throws WBEMException { - - String className = pPath.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); - - Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, - "OpenReferenceInstances"); - CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); - - Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - INSTANCE_NAME); - CIMXMLBuilderImpl.createINSTANCENAME(pDoc, iparamvalueE, pPath); - - if (pResultClass != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, RESULT_CLASS); - CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, pResultClass); - } - if (pRole != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, ROLE); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pRole); - } - - iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, INCLUDE_CLASS_ORIGIN); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeClassOrigin); - - if (pPropertyList != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, PROPERTY_LIST); - Element valuearrayE = CIMXMLBuilderImpl.createVALUEARRAY(pDoc, iparamvalueE); - for (int i = 0; i < pPropertyList.length; i++) - CIMXMLBuilderImpl.createVALUE(pDoc, valuearrayE, pPropertyList[i]); - } - - if (pFilterQueryLanguage != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - FILTER_QUERY_LANGUAGE); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pFilterQueryLanguage); - } - if (pFilterQuery != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, FILTER_QUERY); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pFilterQuery); - } - if (pOperationTimeout != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - OPERATION_TIMEOUT); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pOperationTimeout); - } - - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, CONTINUE_ON_ERROR); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pContinueOnError); - - if (pMaxObjectCount != null) { - iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, MAX_OBJECT_COUNT); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pMaxObjectCount); - } - - return simplereqE; - } - - /** - * OpenQueryInstances_request - * - * @param pDoc - * @param pPath - * @param pFilterQuery - * @param pFilterQueryLanguage - * @param pReturnQueryResultClass - * @param pOperationTimeout - * @param pContinueOnError - * @param pMaxObjectCount - * @param pQueryResultClass - * @return Element OpenQueryInstances_request - * @throws WBEMException - */ - public Element OpenQueryInstances_request(Document pDoc, CIMObjectPath pPath, - String pFilterQuery, String pFilterQueryLanguage, boolean pReturnQueryResultClass, - UnsignedInteger32 pOperationTimeout, boolean pContinueOnError, - UnsignedInteger32 pMaxObjectCount, CIMClass pQueryResultClass) throws WBEMException { - - String className = pPath.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); - - Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, - "OpenQueryInstances"); - CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); - - Element iparamvalueE; - - if (pFilterQuery != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, FILTER_QUERY); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pFilterQuery); - } - if (pFilterQueryLanguage != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - FILTER_QUERY_LANGUAGE); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pFilterQueryLanguage); - } - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - RETURN_QUERY_RESULT_CLASS); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pReturnQueryResultClass); - - if (pOperationTimeout != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - OPERATION_TIMEOUT); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pOperationTimeout); - } - - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, CONTINUE_ON_ERROR); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pContinueOnError); - - if (pMaxObjectCount != null) { - iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, MAX_OBJECT_COUNT); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pMaxObjectCount); - } - if (pQueryResultClass != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - QUERY_RESULT_CLASS); - CIMXMLBuilderImpl.createCLASS(pDoc, iparamvalueE, pQueryResultClass); - } - return simplereqE; - } - - /** - * PullInstancesWithPath_request - * - * @param pDoc - * @param pPath - * @param pContext - * @param pMaxObjectCount - * @return Element PullInstancesWithPath_request - * @throws WBEMException - */ - public Element PullInstancesWithPath_request(Document pDoc, CIMObjectPath pPath, - String pContext, UnsignedInteger32 pMaxObjectCount) throws WBEMException { - - String className = pPath.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); - - Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, - "PullInstancesWithPath"); - CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); - - Element iparamvalueE; - - if (pContext != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - ENUMERATION_CONTEXT); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pContext); - } - - if (pMaxObjectCount != null) { - iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, MAX_OBJECT_COUNT); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pMaxObjectCount); - } - - return simplereqE; - } - - /** - * PullInstancePaths_request - * - * @param pDoc - * @param pPath - * @param pContext - * @param pMaxObjectCount - * @return Element PullInstancePaths - * @throws WBEMException - */ - public Element PullInstancePaths_request(Document pDoc, CIMObjectPath pPath, String pContext, - UnsignedInteger32 pMaxObjectCount) throws WBEMException { - - String className = pPath.getObjectName(); - - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); - - Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, - "PullInstancePaths"); - CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); - - Element iparamvalueE; - - if (pContext != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - ENUMERATION_CONTEXT); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pContext); - } - - if (pMaxObjectCount != null) { - iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, MAX_OBJECT_COUNT); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pMaxObjectCount); - } - - return simplereqE; - } - - /** - * PullInstances_request - * - * @param pDoc - * @param pPath - * @param pContext - * @param pMaxObjectCount - * @return Element PullInstances_request - * @throws WBEMException - */ - public Element PullInstances_request(Document pDoc, CIMObjectPath pPath, String pContext, - UnsignedInteger32 pMaxObjectCount) throws WBEMException { - String className = pPath.getObjectName(); - - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); - - Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, - "PullInstances"); - CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); - - Element iparamvalueE; - - if (pContext != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - ENUMERATION_CONTEXT); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pContext); - } - - if (pMaxObjectCount != null) { - iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, MAX_OBJECT_COUNT); - CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pMaxObjectCount); - } - - return simplereqE; - } - - /** - * sendIndication_request - * - * @param pDoc - * @param pIndication - * @return Element sendIndication_request - * @throws WBEMException - */ - public Element sendIndication_request(Document pDoc, CIMInstance pIndication) - throws WBEMException { - Element simpleexpreqE = CIMXMLBuilderImpl.createSIMPLEEXPREQ(pDoc); - Element expmethodcallE = CIMXMLBuilderImpl.createEXPMETHODCALL(pDoc, simpleexpreqE, - "ExportIndication"); - Element expparamvalueE = CIMXMLBuilderImpl.createEXPPARAMVALUE(pDoc, expmethodcallE, - "NewIndication"); - - CIMXMLBuilderImpl.createINSTANCE(pDoc, expparamvalueE, pIndication); - - return simpleexpreqE; - } -} +/* + (C) Copyright IBM Corp. 2005, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 13521 2004-11-26 thschaef XML Request Composition for static method call is wrong + * 18075 2005-08-11 pineiro5 Can not use method CIMClient.invokeMethod + * 1535756 2006-08-07 lupusalex Make code warning free + * 1365086 2006-10-25 ebak Possible bug in createQualifier + * 1565892 2006-11-16 lupusalex Make SBLIM client JSR48 compliant + * 1610046 2006-12-18 lupusalex Does not escape trailing spaces + * 1610046 2007-01-10 lupusalex Rework: Does not escape trailing spaces + * 1649611 2007-01-31 lupusalex Interop issue: Quotes not escaped by client + * 1671502 2007-02-28 lupusalex Remove dependency from Xerces + * 1660756 2007-03-02 ebak Embedded object support + * 1689085 2007-04-10 ebak Embedded object enhancements for Pegasus + * 1669961 2006-04-16 lupusalex CIMTypedElement.getType() =>getDataType() + * 1715027 2007-05-08 lupusalex Make message id random + * 1719991 2007-05-16 ebak FVT: regression ClassCastException in EmbObjHandler + * 1734888 2007-06-11 ebak Wrong reference building in METHODCALL request + * 1827728 2007-11-12 ebak embeddedInstances: attribute EmbeddedObject not set + * 1827728 2007-11-20 ebak rework: embeddedInstances: attribute EmbeddedObject not set + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors + * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics + * 2845211 2009-08-27 raman_arora Pull Enumeration Feature (SAX Parser) + * 2865222 2009-09-29 raman_arora enumerateQualifierTypes shouldn't require a class name + * 2858933 2009-10-12 raman_arora JSR48 new APIs: associatorClasses & associatorInstances + * 2886829 2009-11-18 raman_arora JSR48 new APIs: referenceClasses & referenceInstances + * 2944219 2010-02-05 blaschke-oss Problem with pull operations using client against EMC CIMOM + * 3027479 2010-07-09 blaschke-oss Dead store to local variable + * 3062747 2010-09-21 blaschke-oss SblimCIMClient does not log all CIM-XML responces. + * 3514537 2012-04-03 blaschke-oss TCK: execQueryInstances requires boolean, not Boolean + * 3521119 2012-04-24 blaschke-oss JSR48 1.0.0: remove CIMObjectPath 2/3/4-parm ctors + * 3527580 2012-05-17 blaschke-oss WBEMClient should not throw IllegalArgumentException + * 3601894 2013-01-23 blaschke-oss Enhance HTTP and CIM-XML tracing + * 2616 2013-02-23 blaschke-oss Add new API WBEMClientSBLIM.sendIndication() + * 2689 2013-10-10 blaschke-oss createMETHODCALL should not add PARAMTYPE attribute + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.IOException; +import java.io.OutputStream; +import java.util.Iterator; +import java.util.Random; +import java.util.Vector; + +import org.metricshub.wbem.javax.cim.CIMArgument; +import org.metricshub.wbem.javax.cim.CIMClass; +import org.metricshub.wbem.javax.cim.CIMDataType; +import org.metricshub.wbem.javax.cim.CIMInstance; +import org.metricshub.wbem.javax.cim.CIMObjectPath; +import org.metricshub.wbem.javax.cim.CIMQualifierType; +import org.metricshub.wbem.javax.cim.CIMValuedElement; +import org.metricshub.wbem.javax.wbem.WBEMException; +import org.metricshub.wbem.sblim.cimclient.internal.logging.TimeStamp; +import org.metricshub.wbem.sblim.cimclient.internal.util.MOF; +import org.metricshub.wbem.sblim.cimclient.internal.wbem.CIMError; +import org.metricshub.wbem.sblim.cimclient.internal.wbem.operations.CIMAssociatorNamesOp; +import org.metricshub.wbem.sblim.cimclient.internal.wbem.operations.CIMAssociatorsOp; +import org.metricshub.wbem.sblim.cimclient.internal.wbem.operations.CIMCreateClassOp; +import org.metricshub.wbem.sblim.cimclient.internal.wbem.operations.CIMCreateInstanceOp; +import org.metricshub.wbem.sblim.cimclient.internal.wbem.operations.CIMCreateNameSpaceOp; +import org.metricshub.wbem.sblim.cimclient.internal.wbem.operations.CIMCreateQualifierTypeOp; +import org.metricshub.wbem.sblim.cimclient.internal.wbem.operations.CIMDeleteClassOp; +import org.metricshub.wbem.sblim.cimclient.internal.wbem.operations.CIMDeleteInstanceOp; +import org.metricshub.wbem.sblim.cimclient.internal.wbem.operations.CIMDeleteQualifierTypeOp; +import org.metricshub.wbem.sblim.cimclient.internal.wbem.operations.CIMEnumClassNamesOp; +import org.metricshub.wbem.sblim.cimclient.internal.wbem.operations.CIMEnumClassesOp; +import org.metricshub.wbem.sblim.cimclient.internal.wbem.operations.CIMEnumInstanceNamesOp; +import org.metricshub.wbem.sblim.cimclient.internal.wbem.operations.CIMEnumInstancesOp; +import org.metricshub.wbem.sblim.cimclient.internal.wbem.operations.CIMEnumNameSpaceOp; +import org.metricshub.wbem.sblim.cimclient.internal.wbem.operations.CIMEnumQualifierTypesOp; +import org.metricshub.wbem.sblim.cimclient.internal.wbem.operations.CIMExecQueryOp; +import org.metricshub.wbem.sblim.cimclient.internal.wbem.operations.CIMGetClassOp; +import org.metricshub.wbem.sblim.cimclient.internal.wbem.operations.CIMGetInstanceOp; +import org.metricshub.wbem.sblim.cimclient.internal.wbem.operations.CIMGetPropertyOp; +import org.metricshub.wbem.sblim.cimclient.internal.wbem.operations.CIMGetQualifierTypeOp; +import org.metricshub.wbem.sblim.cimclient.internal.wbem.operations.CIMInvokeMethodOp; +import org.metricshub.wbem.sblim.cimclient.internal.wbem.operations.CIMOperation; +import org.metricshub.wbem.sblim.cimclient.internal.wbem.operations.CIMReferenceNamesOp; +import org.metricshub.wbem.sblim.cimclient.internal.wbem.operations.CIMReferencesOp; +import org.metricshub.wbem.sblim.cimclient.internal.wbem.operations.CIMSetClassOp; +import org.metricshub.wbem.sblim.cimclient.internal.wbem.operations.CIMSetInstanceOp; +import org.metricshub.wbem.sblim.cimclient.internal.wbem.operations.CIMSetPropertyOp; +import org.metricshub.wbem.sblim.cimclient.internal.wbem.operations.CIMSetQualifierTypeOp; +import org.metricshub.wbem.javax.cim.CIMNamedElementInterface; +import org.metricshub.wbem.javax.cim.CIMProperty; +import org.metricshub.wbem.javax.cim.UnsignedInteger32; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; + +/** + * Class CIMClientXML_HelperImpl is responsible for building CIM-XML requests + * and responses. + */ +public class CIMClientXML_HelperImpl { + + private static class Counter { + + private int iCounter; + + protected Counter(int pCounter) { + this.iCounter = pCounter; + } + + protected int incrementAndGet() { + return ++this.iCounter; + } + } + + private static final String VERSION = "1.0"; + + private static final String ASSOCIATOR_NAMES = "AssociatorNames"; + + // Pull Enumeration variables + private static final String ASSOC_CLASS = "AssocClass"; + + private static final String CLASS_NAME = "ClassName"; + + private static final String CONTINUE_ON_ERROR = "ContinueOnError"; + + private static final String DEEP_INHERITANCE = "DeepInheritance"; + + private static final String ENUMERATION_CONTEXT = "EnumerationContext"; + + private static final String FILTER_QUERY_LANGUAGE = "FilterQueryLanguage"; + + private static final String FILTER_QUERY = "FilterQuery"; + + private static final String INCLUDE_CLASS_ORIGIN = "IncludeClassOrigin"; + + private static final String INSTANCE_NAME = "InstanceName"; + + private static final String MAX_OBJECT_COUNT = "MaxObjectCount"; + + private static final String PROPERTY_LIST = "PropertyList"; + + private static final String OPERATION_TIMEOUT = "OperationTimeout"; + + private static final String RESULT_CLASS = "ResultClass"; + + private static final String RETURN_QUERY_RESULT_CLASS = "ReturnQueryResultClass"; + + private static final String QUERY_RESULT_CLASS = "QueryResultClass"; + + private static final String ROLE = "Role"; + + private static final String RESULT_ROLE = "ResultRole"; + + private static final Random RANDOM = new Random(); + + private static final int MAX_ID = 1 << 20; + + private final ThreadLocal iCurrentId = new ThreadLocal(); + + private final DocumentBuilder iBuilder; + + private static String valueStr(CIMValuedElement pE) { + Object o = pE.getValue(); + return o == null ? MOF.NULL : o.toString(); + } + + /** + * Ctor. + * + * @throws ParserConfigurationException + */ + public CIMClientXML_HelperImpl() throws ParserConfigurationException { + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + this.iBuilder = factory.newDocumentBuilder(); + } + + /** + * getDocumentBuilder + * + * @return DocumentBuilder + */ + public DocumentBuilder getDocumentBuilder() { + return this.iBuilder; + } + + /** + * newDocument + * + * @return Document + */ + public Document newDocument() { + return this.iBuilder.newDocument(); + } + + /** + * parse + * + * @param pIS + * @return Document + * @throws IOException + * @throws SAXException + */ + public Document parse(InputSource pIS) throws IOException, SAXException { + if (pIS == null) throw new IllegalArgumentException("null input stream argument"); + return this.iBuilder.parse(pIS); + } + + /** + * Serializes a given DOM document as (CIM-)XML to a given output stream + * + * @param pOS + * The output stream + * @param pDoc + * The documents + * @throws IOException + * Whenever something goes wrong + */ + public static void serialize(OutputStream pOS, Document pDoc) throws IOException { + CimXmlSerializer.serialize(pOS, pDoc, false); + } + + /** + * Serializes a given DOM document as (CIM-)XML to a given output stream. + * The document is pretty wrapped and indented and surrounded with markers + * for the begin and end. + * + * @param pOS + * The output stream + * @param pDoc + * The documents + * @throws IOException + */ + public static void dumpDocument(OutputStream pOS, Document pDoc) throws IOException { + dumpDocument(pOS, pDoc, null); + } + + /** + * Serializes a given DOM document as (CIM-)XML to a given output stream. + * The document is pretty wrapped and indented and surrounded with markers + * for the begin and end. + * + * @param pOS + * The output stream + * @param pDoc + * The documents + * @param pOrigin + * The origin of the output stream (request, indication response, + * etc.) + * @throws IOException + */ + public static void dumpDocument(OutputStream pOS, Document pDoc, String pOrigin) + throws IOException { + // debug + if (pOS == null) { return; } + if (pOrigin == null) pOrigin = "unknown"; + pOS.write("<--- ".getBytes()); + pOS.write(pOrigin.getBytes()); + pOS.write(" begin ".getBytes()); + pOS.write(TimeStamp.formatWithMillis(System.currentTimeMillis()).getBytes()); + pOS.write(" -----\n".getBytes()); + CimXmlSerializer.serialize(pOS, pDoc, true); + pOS.write("\n---- ".getBytes()); + pOS.write(pOrigin.getBytes()); + pOS.write(" end ------>\n".getBytes()); + } + + /** + * createCIMMessage + * + * @param pDoc + * @param pRequestE + * @return Element + */ + public Element createCIMMessage(Document pDoc, Element pRequestE) { + Element cimE = CIMXMLBuilderImpl.createCIM(pDoc); + Element messageE = CIMXMLBuilderImpl.createMESSAGE(pDoc, cimE, String.valueOf(getNextId()), + VERSION); + if (pRequestE != null) { + messageE.appendChild(pRequestE); + } + return messageE; + } + + /** + * createMultiReq + * + * @param pDoc + * @return Element + */ + public Element createMultiReq(Document pDoc) { + Element multireqE = CIMXMLBuilderImpl.createMULTIREQ(pDoc); + return multireqE; + } + + /** + * associatorNames_request + * + * @param pDoc + * @param pObjectName + * @param pAssocClass + * @param pResultClass + * @param pRole + * @param pResultRole + * @return Element + * @throws WBEMException + */ + public Element associatorNames_request(Document pDoc, CIMObjectPath pObjectName, + String pAssocClass, String pResultClass, String pRole, String pResultRole) + throws WBEMException { + + // obtain data + String className = pObjectName.getObjectName(); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, + "null class name"); + CIMProperty[] keysA = pObjectName.getKeys(); + + Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, + ASSOCIATOR_NAMES); + CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pObjectName); + + Element iparamvalueE = CIMXMLBuilderImpl + .createIPARAMVALUE(pDoc, imethodcallE, "ObjectName"); + Element instancenameE = CIMXMLBuilderImpl.createINSTANCENAME(pDoc, iparamvalueE, className); + for (int i = 0; i < keysA.length; i++) { + CIMProperty prop = keysA[i]; + String propName = prop.getName(); + // TODO: check that CIMDataType.toString() satisfies this + String propTypeStr = prop.getDataType().toString(); + String propValueStr = valueStr(prop); + Element keybindingE = CIMXMLBuilderImpl.createKEYBINDING(pDoc, instancenameE, propName); + CIMXMLBuilderImpl.createKEYVALUE(pDoc, keybindingE, propTypeStr, propValueStr); + } + if (pAssocClass != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "AssocClass"); + CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, pAssocClass); + } + if (pResultClass != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ResultClass"); + CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, pResultClass); + } + if (pRole != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "Role"); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pRole); + } + if (pResultRole != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ResultRole"); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pResultRole); + } + + return simplereqE; + } + + /** + * associatorNames_response + * + * @param pDoc + * @param pPathA + * @return Element + */ + public static Element associatorNames_response(Document pDoc, CIMObjectPath[] pPathA) { + Element simpRspE = CIMXMLBuilderImpl.createSIMPLERSP(pDoc, null); + Element iMethRspE = CIMXMLBuilderImpl.createIMETHODRESPONSE(pDoc, simpRspE, + "associatorNames"); + Element iRetValE = CIMXMLBuilderImpl.createIRETURNVALUE(pDoc, iMethRspE); + try { + for (int i = 0; i < pPathA.length; i++) { + CIMXMLBuilderImpl.createOBJECTPATH(pDoc, iRetValE, pPathA[i]); + } + } catch (WBEMException e) { + throw new RuntimeException(e); + } + return simpRspE; + } + + /** + * associatorInstances_request + * + * @param pDoc + * @param pObjectName + * @param pAssocClass + * @param pResultClass + * @param pRole + * @param pResultRole + * @param pIncludeClassOrigin + * @param pPropertyList + * @return Element + * @throws WBEMException + */ + public Element associatorInstances_request(Document pDoc, CIMObjectPath pObjectName, + String pAssocClass, String pResultClass, String pRole, String pResultRole, + boolean pIncludeClassOrigin, String[] pPropertyList) throws WBEMException { + + String className = pObjectName.getObjectName(); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, + "null class name"); + CIMProperty[] keysA = pObjectName.getKeys(); + + // Make sure keys are populated + if (keysA.length == 0) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, + "associatorInstances requires keys for the instance to be populated"); + + Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "Associators"); + CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pObjectName); + Element iparamvalueE = CIMXMLBuilderImpl + .createIPARAMVALUE(pDoc, imethodcallE, "ObjectName"); + Element instancenameE = CIMXMLBuilderImpl.createINSTANCENAME(pDoc, iparamvalueE, className); + for (int i = 0; i < keysA.length; i++) { + CIMProperty prop = keysA[i]; + String propName = prop.getName(); + String propTypeStr = prop.getDataType().toString(); + String propValueStr = valueStr(prop); + + Element keybindingE = CIMXMLBuilderImpl.createKEYBINDING(pDoc, instancenameE, propName); + CIMXMLBuilderImpl.createKEYVALUE(pDoc, keybindingE, propTypeStr, propValueStr); + } + if (pAssocClass != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "AssocClass"); + CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, pAssocClass); + } + if (pResultClass != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ResultClass"); + CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, pResultClass); + } + if (pRole != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "Role"); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pRole); + } + if (pResultRole != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ResultRole"); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pResultRole); + } + + iparamvalueE = CIMXMLBuilderImpl + .createIPARAMVALUE(pDoc, imethodcallE, "IncludeClassOrigin"); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeClassOrigin); + + if (pPropertyList != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "PropertyList"); + Element valuearrayE = CIMXMLBuilderImpl.createVALUEARRAY(pDoc, iparamvalueE); + for (int i = 0; i < pPropertyList.length; i++) { + CIMXMLBuilderImpl.createVALUE(pDoc, valuearrayE, pPropertyList[i]); + } + } + + return simplereqE; + } + + /** + * associatorClasses_request + * + * @param pDoc + * @param pObjectName + * @param pAssocClass + * @param pResultClass + * @param pRole + * @param pResultRole + * @param pIncludeQualifiers + * @param pIncludeClassOrigin + * @param pPropertyList + * @return Element + * @throws WBEMException + */ + public Element associatorClasses_request(Document pDoc, CIMObjectPath pObjectName, + String pAssocClass, String pResultClass, String pRole, String pResultRole, + boolean pIncludeQualifiers, boolean pIncludeClassOrigin, String[] pPropertyList) + throws WBEMException { + + String className = pObjectName.getObjectName(); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, + "null class name"); + + // Make sure keys are not populated + if (pObjectName.getKeys().length != 0) throw new WBEMException( + WBEMException.CIM_ERR_INVALID_PARAMETER, + "Keys should not be populated for associatorClasses"); + + Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "Associators"); + CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pObjectName); + Element iparamvalueE = CIMXMLBuilderImpl + .createIPARAMVALUE(pDoc, imethodcallE, "ObjectName"); + + CIMXMLBuilderImpl.createINSTANCENAME(pDoc, iparamvalueE, className); + + if (pAssocClass != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "AssocClass"); + CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, pAssocClass); + } + if (pResultClass != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ResultClass"); + CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, pResultClass); + } + if (pRole != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "Role"); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pRole); + } + if (pResultRole != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ResultRole"); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pResultRole); + } + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "IncludeQualifiers"); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeQualifiers); + + iparamvalueE = CIMXMLBuilderImpl + .createIPARAMVALUE(pDoc, imethodcallE, "IncludeClassOrigin"); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeClassOrigin); + + if (pPropertyList != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "PropertyList"); + Element valuearrayE = CIMXMLBuilderImpl.createVALUEARRAY(pDoc, iparamvalueE); + for (int i = 0; i < pPropertyList.length; i++) { + CIMXMLBuilderImpl.createVALUE(pDoc, valuearrayE, pPropertyList[i]); + } + } + + return simplereqE; + } + + /** + * associators_request + * + * @param pDoc + * @param pObjectName + * @param pAssocClass + * @param pResultClass + * @param pRole + * @param pResultRole + * @param pIncludeQualifiers + * @param pIncludeClassOrigin + * @param pPropertyList + * @return Element + * @throws WBEMException + */ + public Element associators_request(Document pDoc, CIMObjectPath pObjectName, + String pAssocClass, String pResultClass, String pRole, String pResultRole, + boolean pIncludeQualifiers, boolean pIncludeClassOrigin, String[] pPropertyList) + throws WBEMException { + + // obtain data + String className = pObjectName.getObjectName(); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, + "null class name"); + CIMProperty[] keysA = pObjectName.getKeys(); + + Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "Associators"); + CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pObjectName); + Element iparamvalueE = CIMXMLBuilderImpl + .createIPARAMVALUE(pDoc, imethodcallE, "ObjectName"); + Element instancenameE = CIMXMLBuilderImpl.createINSTANCENAME(pDoc, iparamvalueE, className); + for (int i = 0; i < keysA.length; i++) { + CIMProperty prop = keysA[i]; + String propName = prop.getName(); + // TODO: check that CIMDataType.toString() satisfies this + String propTypeStr = prop.getDataType().toString(); + // CIMXMLBuilderImpl.getTypeStr(pValue.getType()); + String propValueStr = valueStr(prop); + + Element keybindingE = CIMXMLBuilderImpl.createKEYBINDING(pDoc, instancenameE, propName); + CIMXMLBuilderImpl.createKEYVALUE(pDoc, keybindingE, propTypeStr, propValueStr); + } + if (pAssocClass != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "AssocClass"); + CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, pAssocClass); + } + if (pResultClass != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ResultClass"); + CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, pResultClass); + } + if (pRole != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "Role"); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pRole); + } + if (pResultRole != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ResultRole"); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pResultRole); + } + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "IncludeQualifiers"); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeQualifiers); + + iparamvalueE = CIMXMLBuilderImpl + .createIPARAMVALUE(pDoc, imethodcallE, "IncludeClassOrigin"); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeClassOrigin); + + if (pPropertyList != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "PropertyList"); // BB + // fixed + Element valuearrayE = CIMXMLBuilderImpl.createVALUEARRAY(pDoc, iparamvalueE); + for (int i = 0; i < pPropertyList.length; i++) { + CIMXMLBuilderImpl.createVALUE(pDoc, valuearrayE, pPropertyList[i]); + } + } + + return simplereqE; + } + + /** + * associators_response + * + * @param pDoc + * @param pNamedElementA + * @return Element + */ + public static Element associators_response(Document pDoc, + CIMNamedElementInterface[] pNamedElementA) { + Element simpRspE = CIMXMLBuilderImpl.createSIMPLERSP(pDoc, null); + Element iMethRspE = CIMXMLBuilderImpl.createIMETHODRESPONSE(pDoc, simpRspE, "associators"); + Element iRetValE = CIMXMLBuilderImpl.createIRETURNVALUE(pDoc, iMethRspE); + try { + for (int i = 0; i < pNamedElementA.length; i++) { + CIMNamedElementInterface namedElement = pNamedElementA[i]; + CIMObjectPath op = namedElement.getObjectPath(); + String nameSpace = op == null ? null : op.getNamespace(); + CIMXMLBuilderImpl + .createVALUEOBJECTWITHPATH(pDoc, iRetValE, namedElement, nameSpace); + /* + * CIMXMLBuilderImpl.createCLASSPATH( pDoc, iRetValE, + * pClassA[i].getObjectPath() ); + * CIMXMLBuilderImpl.createCLASS(pDoc, iRetValE, pClassA[i]); + */ + + } + } catch (WBEMException e) { + throw new RuntimeException(e); + } + return simpRspE; + } + + /** + * enumerateInstanceNames_request + * + * @param pDoc + * @param pPath + * @return Element + * @throws WBEMException + */ + public Element enumerateInstanceNames_request(Document pDoc, CIMObjectPath pPath) + throws WBEMException { + // obtain data + String className = pPath.getObjectName(); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, + "null class name"); + + Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, + "EnumerateInstanceNames"); + CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); + + Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ClassName"); + CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, className); + + return simplereqE; + } + + /** + * enumerateInstances_request + * + * @param pDoc + * @param pPath + * @param pDeepInheritance + * @param pLocalOnly + * @param pIncludeQualifiers + * @param pIncludeClassOrigin + * @param pPropertyList + * @return Element + * @throws WBEMException + */ + public Element enumerateInstances_request(Document pDoc, CIMObjectPath pPath, + boolean pDeepInheritance, boolean pLocalOnly, boolean pIncludeQualifiers, + boolean pIncludeClassOrigin, String[] pPropertyList) throws WBEMException { + + // obtain data + String className = pPath.getObjectName(); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, + "null class name"); + + Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, + "EnumerateInstances"); + CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); + + Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ClassName"); + CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, className); + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "LocalOnly"); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pLocalOnly); + + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "DeepInheritance"); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pDeepInheritance); + + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "IncludeQualifiers"); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeQualifiers); + + iparamvalueE = CIMXMLBuilderImpl + .createIPARAMVALUE(pDoc, imethodcallE, "IncludeClassOrigin"); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeClassOrigin); + + if (pPropertyList != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "PropertyList"); + Element valuearrayE = CIMXMLBuilderImpl.createVALUEARRAY(pDoc, iparamvalueE); + for (int i = 0; i < pPropertyList.length; i++) { + CIMXMLBuilderImpl.createVALUE(pDoc, valuearrayE, pPropertyList[i]); + } + } + return simplereqE; + } + + /** + * getInstance_request + * + * @param pDoc + * @param pName + * @param pLocalOnly + * @param pIncludeQualifiers + * @param pIncludeClassOrigin + * @param pPropertyList + * @return Element + * @throws WBEMException + */ + public Element getInstance_request(Document pDoc, CIMObjectPath pName, boolean pLocalOnly, + boolean pIncludeQualifiers, boolean pIncludeClassOrigin, String[] pPropertyList) + throws WBEMException { + // obtain data + String className = pName.getObjectName(); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, + "null class name"); + + Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "GetInstance"); + CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pName); + + Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, + "InstanceName"); + CIMXMLBuilderImpl.createINSTANCENAME(pDoc, iparamvalueE, pName); + + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "LocalOnly"); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pLocalOnly); + + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "IncludeQualifiers"); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeQualifiers); + + iparamvalueE = CIMXMLBuilderImpl + .createIPARAMVALUE(pDoc, imethodcallE, "IncludeClassOrigin"); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeClassOrigin); + + if (pPropertyList != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "PropertyList"); + Element valuearrayE = CIMXMLBuilderImpl.createVALUEARRAY(pDoc, iparamvalueE); + for (int i = 0; i < pPropertyList.length; i++) { + CIMXMLBuilderImpl.createVALUE(pDoc, valuearrayE, pPropertyList[i]); + } + } + + return simplereqE; + } + + /** + * deleteInstance_request + * + * @param pDoc + * @param pName + * @return Element + * @throws WBEMException + */ + public Element deleteInstance_request(Document pDoc, CIMObjectPath pName) throws WBEMException { + + // obtain data + String className = pName.getObjectName(); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, + "null class name"); + + Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, + "DeleteInstance"); + CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pName); + + Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, + "InstanceName"); + CIMXMLBuilderImpl.createINSTANCENAME(pDoc, iparamvalueE, pName); + + return simplereqE; + } + + /** + * getClass_request + * + * @param pDoc + * @param pName + * @param pLocalOnly + * @param pIncludeQualifiers + * @param pIncludeClassOrigin + * @param pPropertyList + * @return Element + * @throws WBEMException + */ + public Element getClass_request(Document pDoc, CIMObjectPath pName, boolean pLocalOnly, + boolean pIncludeQualifiers, boolean pIncludeClassOrigin, String[] pPropertyList) + throws WBEMException { + + // obtain data + String className = pName.getObjectName(); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, + "null class name"); + + Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "GetClass"); + CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pName); + + Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ClassName"); + CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, className); + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "LocalOnly"); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pLocalOnly); + + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "IncludeQualifiers"); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeQualifiers); + + iparamvalueE = CIMXMLBuilderImpl + .createIPARAMVALUE(pDoc, imethodcallE, "IncludeClassOrigin"); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeClassOrigin); + + if (pPropertyList != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "PropertyList"); + Element valuearrayE = CIMXMLBuilderImpl.createVALUEARRAY(pDoc, iparamvalueE); + for (int i = 0; i < pPropertyList.length; i++) { + CIMXMLBuilderImpl.createVALUE(pDoc, valuearrayE, pPropertyList[i]); + } + } + + return simplereqE; + } + + /** + * createInstance_request + * + * @param pDoc + * @param pName + * @param pInstance + * @return Element + * @throws WBEMException + */ + public Element createInstance_request(Document pDoc, CIMObjectPath pName, CIMInstance pInstance) + throws WBEMException { + + String className = pInstance.getObjectPath().getObjectName(); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, + "null class name"); + + Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, + "CreateInstance"); + CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pName); + Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, + "NewInstance"); + + CIMXMLBuilderImpl.createINSTANCE(pDoc, iparamvalueE, pInstance); + + return simplereqE; + } + + /** + * invokeMethod_request + * + * @param pDoc + * @param pLocalPath + * @param pMethodName + * @param pInArgs + * @return Element + * @throws WBEMException + */ + public Element invokeMethod_request(Document pDoc, CIMObjectPath pLocalPath, + String pMethodName, CIMArgument[] pInArgs) throws WBEMException { + + // obtain data + String className = pLocalPath.getObjectName(); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, + "null class name"); + CIMProperty[] keysA = pLocalPath.getKeys(); + + Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); + Element methodcallE = CIMXMLBuilderImpl.createMETHODCALL(pDoc, simplereqE, pMethodName); + + // 13521 + if (keysA.length > 0) { + Element localpathE = CIMXMLBuilderImpl.createLOCALINSTANCEPATH(pDoc, methodcallE); + CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, localpathE, pLocalPath); // 13521 + CIMXMLBuilderImpl.createINSTANCENAME(pDoc, localpathE, pLocalPath); // 13521 + } else { + CIMXMLBuilderImpl.createLOCALCLASSPATH(pDoc, methodcallE, pLocalPath); + } + + buildParamValues(pDoc, methodcallE, pLocalPath, pInArgs); + + return simplereqE; + } + + /** + * invokeMethod_response + * + * @param pDoc + * @param pMethodName + * @param pLocalPath + * @param pRetVal + * @param pOutArgA + * @return Element + * @throws WBEMException + */ + public static Element invokeMethod_response(Document pDoc, String pMethodName, + CIMObjectPath pLocalPath, Object pRetVal, CIMArgument[] pOutArgA) + throws WBEMException { + if (pMethodName == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, + "null method name"); + Element simpleRspE = CIMXMLBuilderImpl.createSIMPLERSP(pDoc, null); + Element methodRspE = CIMXMLBuilderImpl.createMETHODRESPONSE(pDoc, simpleRspE, pMethodName); + + CIMXMLBuilderImpl.createRETURNVALUE(pDoc, methodRspE, pRetVal); + + buildParamValues(pDoc, methodRspE, pLocalPath, pOutArgA); + return simpleRspE; + } + + /** + * @param pLocalPath + */ + private static void buildParamValues(Document pDoc, Element pParentE, CIMObjectPath pLocalPath, + CIMArgument[] pArgA) throws WBEMException { + if (pArgA == null) return; + for (int i = 0; i < pArgA.length; i++) { + CIMArgument arg = pArgA[i]; + if (arg == null) continue; + CIMXMLBuilderImpl.createPARAMVALUE(pDoc, pParentE, arg); + } + } + + // public CIMResponse createIndication_request(Document doc) throws + // CIMXMLParseException, CIMException { + // Element rootE = doc.getDocumentElement(); + // CIMResponse response = (CIMResponse)xmlParser.parseCIM(rootE); + // response.checkError(); + // return response; + // // Vector v = (Vector)response.getFirstReturnValue(); + // // + // // //TODO: Should we return the whole list of instances or just the first + // instance? + // // //TODO: return the whole vector of indications + // // if (v.size() > 0) + // // return (CIMInstance)v.elementAt(0); + // // else + // // return null; + // } + + /** + * createIndication_response + * + * @param error + * @return Document + */ + public Document createIndication_response(CIMError error) { + + // CIMXMLBuilderImpl.create XML + Document doc = this.iBuilder.newDocument(); + Element cimE = CIMXMLBuilderImpl.createCIM(doc); + Element messageE = CIMXMLBuilderImpl.createMESSAGE(doc, cimE, String.valueOf(getNextId()), + "1.0"); + Element simpleexprspE = CIMXMLBuilderImpl.createSIMPLEEXPRSP(doc, messageE); + Element expmethodresponseE = CIMXMLBuilderImpl.createEXPMETHODRESPONSE(doc, simpleexprspE, + "ExportIndication"); + if (error == null) { + CIMXMLBuilderImpl.createIRETURNVALUE(doc, expmethodresponseE); + } else { + CIMXMLBuilderImpl.createERROR(doc, expmethodresponseE, error); + } + // Element + return doc; + } + + /** + * createClass_request + * + * @param pDoc + * @param pPath + * @param pClass + * @return Element + * @throws WBEMException + */ + public Element createClass_request(Document pDoc, CIMObjectPath pPath, CIMClass pClass) + throws WBEMException { + String className = pPath.getObjectName(); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, + "null class name"); + + Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "CreateClass"); + CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); + + Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "NewClass"); + + CIMXMLBuilderImpl.createCLASS(pDoc, iparamvalueE, pClass); + + return simplereqE; + } + + /** + * getQualifier_request + * + * @param pDoc + * @param pPath + * @param pQt + * @return Element + * @throws WBEMException + */ + public Element getQualifier_request(Document pDoc, CIMObjectPath pPath, String pQt) + throws WBEMException { + // obtain data + String className = pPath.getObjectName(); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, + "null class name"); + + Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); + Element imethodcallE = CIMXMLBuilderImpl + .createIMETHODCALL(pDoc, simplereqE, "GetQualifier"); + CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); + + Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, + "QualifierName"); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pPath.getObjectName()); + + return simplereqE; + } + + /** + * createQualifierType_request : This has been replaced by + * setQualifierType_request + * + * @param pDoc + * @param pPath + * @param pQt + * @return Element + * @throws WBEMException + */ + public Element createQualifierType_request(Document pDoc, CIMObjectPath pPath, + CIMQualifierType pQt) throws WBEMException { + String className = pPath.getObjectName(); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, + "null class name"); + + Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); + Element imethodcallE = CIMXMLBuilderImpl + .createIMETHODCALL(pDoc, simplereqE, "SetQualifier"); + CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); + + Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, + "QualifierDeclaration"); + CIMXMLBuilderImpl.createQUALIFIER_DECLARATION(pDoc, iparamvalueE, pQt); + + return simplereqE; + } + + /** + * deleteClass_request + * + * @param pDoc + * @param pPath + * @return Element + * @throws WBEMException + */ + public Element deleteClass_request(Document pDoc, CIMObjectPath pPath) throws WBEMException { + String className = pPath.getObjectName(); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, + "null class name"); + + Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "DeleteClass"); + CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); + + Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ClassName"); + + CIMXMLBuilderImpl.createOBJECTNAME(pDoc, iparamvalueE, pPath); + + return simplereqE; + } + + /** + * deleteQualifierType_request + * + * @param pDoc + * @param pPath + * @return Element + * @throws WBEMException + */ + public Element deleteQualifierType_request(Document pDoc, CIMObjectPath pPath) + throws WBEMException { + // obtain data + String className = pPath.getObjectName(); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, + "null class name"); + + Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, + "DeleteQualifier"); + CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); + + Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, + "QualifierName"); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pPath.getObjectName()); + return simplereqE; + } + + /** + * enumerateClasses_request + * + * @param pDoc + * @param pPath + * @param pDeepInheritance + * @param pLocalOnly + * @param pIncludeQualifiers + * @param pIncludeClassOrigin + * @return Element + */ + public Element enumerateClasses_request(Document pDoc, CIMObjectPath pPath, + boolean pDeepInheritance, boolean pLocalOnly, boolean pIncludeQualifiers, + boolean pIncludeClassOrigin) { + + Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, + "EnumerateClasses"); + CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); + + Element iparamvalueE; + if (pPath != null && pPath.getObjectName() != null + && pPath.getObjectName().trim().length() != 0) { + String className = pPath.getObjectName(); + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ClassName"); + CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, className); + } + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "LocalOnly"); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pLocalOnly); + + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "DeepInheritance"); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pDeepInheritance); + + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "IncludeQualifiers"); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeQualifiers); + + iparamvalueE = CIMXMLBuilderImpl + .createIPARAMVALUE(pDoc, imethodcallE, "IncludeClassOrigin"); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeClassOrigin); + return simplereqE; + } + + /** + * enumerateClasses_response + * + * @param pDoc + * @param pClA + * @return Element + */ + public static Element enumerateClasses_response(Document pDoc, CIMClass[] pClA) { + Element simpRspE = CIMXMLBuilderImpl.createSIMPLERSP(pDoc, null); + Element iMethRspE = CIMXMLBuilderImpl.createIMETHODRESPONSE(pDoc, simpRspE, + "enumerateClasses"); + Element iRetValE = CIMXMLBuilderImpl.createIRETURNVALUE(pDoc, iMethRspE); + try { + for (int i = 0; i < pClA.length; i++) { + CIMXMLBuilderImpl.createCLASS(pDoc, iRetValE, pClA[i]); + } + } catch (WBEMException e) { + throw new RuntimeException(e); + } + return simpRspE; + } + + /** + * enumerateInstances_response + * + * @param pDoc + * @param pInstA + * @return Element + */ + public static Element enumerateInstances_response(Document pDoc, CIMInstance[] pInstA) { + Element simpRspE = CIMXMLBuilderImpl.createSIMPLERSP(pDoc, null); + Element iMethRspE = CIMXMLBuilderImpl.createIMETHODRESPONSE(pDoc, simpRspE, + "enumerateInstances"); + Element iRetValE = CIMXMLBuilderImpl.createIRETURNVALUE(pDoc, iMethRspE); + try { + for (int i = 0; i < pInstA.length; i++) { + CIMXMLBuilderImpl.createINSTANCE(pDoc, iRetValE, pInstA[i]); + } + } catch (WBEMException e) { + throw new RuntimeException(e); + } + return simpRspE; + } + + /** + * enumerateClassNames_request + * + * @param pDoc + * @param pPath + * @param pDeepInheritance + * @return Element + */ + public Element enumerateClassNames_request(Document pDoc, CIMObjectPath pPath, + boolean pDeepInheritance) { + + Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, + "EnumerateClassNames"); + CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); + + Element iparamvalueE; + + if (pPath != null && pPath.getObjectName() != null + && pPath.getObjectName().trim().length() != 0) { + String className = pPath.getObjectName(); + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ClassName"); + CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, className); + } + + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "DeepInheritance"); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pDeepInheritance); + + return simplereqE; + } + + /** + * getProperty_request + * + * @param pDoc + * @param pPath + * @param pPropertyName + * @return Element + * @throws WBEMException + */ + public Element getProperty_request(Document pDoc, CIMObjectPath pPath, String pPropertyName) + throws WBEMException { + // obtain data + String className = pPath.getObjectName(); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, + "null class name"); + + Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "GetProperty"); + CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); + + Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, + "InstanceName"); + CIMXMLBuilderImpl.createINSTANCENAME(pDoc, iparamvalueE, pPath); + + if (pPropertyName != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "PropertyName"); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pPropertyName); + } + + return simplereqE; + } + + /** + * referenceNames_request + * + * @param pDoc + * @param pPath + * @param pResultClass + * @param pRole + * @return Element + * @throws WBEMException + */ + public Element referenceNames_request(Document pDoc, CIMObjectPath pPath, String pResultClass, + String pRole) throws WBEMException { + String className = pPath.getObjectName(); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, + "null class name"); + + Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, + "ReferenceNames"); + CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); + + Element iparamvalueE = CIMXMLBuilderImpl + .createIPARAMVALUE(pDoc, imethodcallE, "ObjectName"); + CIMXMLBuilderImpl.createOBJECTNAME(pDoc, iparamvalueE, pPath); + + if (pResultClass != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ResultClass"); + CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, pResultClass); + } + if (pRole != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "Role"); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pRole); + } + + return simplereqE; + } + + /** + * referenceClasses_request + * + * @param pDoc + * @param pPath + * @param pResultClass + * @param pRole + * @param pIncludeQualifiers + * @param pIncludeClassOrigin + * @param pPropertyList + * @return Element + * @throws WBEMException + */ + public Element referenceClasses_request(Document pDoc, CIMObjectPath pPath, + String pResultClass, String pRole, boolean pIncludeQualifiers, + boolean pIncludeClassOrigin, String[] pPropertyList) throws WBEMException { + + String className = pPath.getObjectName(); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, + "null class name"); + + // Make sure keys are not populated + if (pPath.getKeys().length != 0) throw new WBEMException( + WBEMException.CIM_ERR_INVALID_PARAMETER, + "Keys should not be populated for referenceClasses"); + + Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "References"); + CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); + + Element iparamvalueE = CIMXMLBuilderImpl + .createIPARAMVALUE(pDoc, imethodcallE, "ObjectName"); + // createOBJECTNAME will internally call createINSTANCENAME but as there + // are no keys Element containing keys will not be populated + CIMXMLBuilderImpl.createOBJECTNAME(pDoc, iparamvalueE, pPath); + + if (pResultClass != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ResultClass"); + CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, pResultClass); + } + if (pRole != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "Role"); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pRole); + } + + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "IncludeQualifiers"); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeQualifiers); + + iparamvalueE = CIMXMLBuilderImpl + .createIPARAMVALUE(pDoc, imethodcallE, "IncludeClassOrigin"); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeClassOrigin); + + if (pPropertyList != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "PropertyList"); + Element valuearrayE = CIMXMLBuilderImpl.createVALUEARRAY(pDoc, iparamvalueE); + for (int i = 0; i < pPropertyList.length; i++) { + CIMXMLBuilderImpl.createVALUE(pDoc, valuearrayE, pPropertyList[i]); + } + } + return simplereqE; + } + + /** + * referenceInstances_request + * + * @param pDoc + * @param pPath + * @param pResultClass + * @param pRole + * @param pIncludeClassOrigin + * @param pPropertyList + * @return Element + * @throws WBEMException + */ + public Element referenceInstances_request(Document pDoc, CIMObjectPath pPath, + String pResultClass, String pRole, boolean pIncludeClassOrigin, String[] pPropertyList) + throws WBEMException { + + String className = pPath.getObjectName(); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, + "null class name"); + + // keys are required for CIMInstance + if (pPath.getKeys().length == 0) throw new WBEMException( + WBEMException.CIM_ERR_INVALID_PARAMETER, + "refrenceInstances requires keys for the instance to be populated"); + + Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "References"); + CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); + + Element iparamvalueE = CIMXMLBuilderImpl + .createIPARAMVALUE(pDoc, imethodcallE, "ObjectName"); + // createOBJECTNAME will internally call createINSTANCENAME to populate + // Element containing keys + CIMXMLBuilderImpl.createOBJECTNAME(pDoc, iparamvalueE, pPath); + + if (pResultClass != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ResultClass"); + CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, pResultClass); + } + if (pRole != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "Role"); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pRole); + } + + iparamvalueE = CIMXMLBuilderImpl + .createIPARAMVALUE(pDoc, imethodcallE, "IncludeClassOrigin"); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeClassOrigin); + + if (pPropertyList != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "PropertyList"); + Element valuearrayE = CIMXMLBuilderImpl.createVALUEARRAY(pDoc, iparamvalueE); + for (int i = 0; i < pPropertyList.length; i++) { + CIMXMLBuilderImpl.createVALUE(pDoc, valuearrayE, pPropertyList[i]); + } + } + return simplereqE; + } + + /** + * references_request + * + * @param pDoc + * @param pPath + * @param pResultClass + * @param pRole + * @param pIncludeQualifiers + * @param pIncludeClassOrigin + * @param pPropertyList + * @return Element + * @throws WBEMException + */ + public Element references_request(Document pDoc, CIMObjectPath pPath, String pResultClass, + String pRole, boolean pIncludeQualifiers, boolean pIncludeClassOrigin, + String[] pPropertyList) throws WBEMException { + String className = pPath.getObjectName(); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, + "null class name"); + + Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "References"); + CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); + + Element iparamvalueE; + + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ObjectName"); + CIMXMLBuilderImpl.createOBJECTNAME(pDoc, iparamvalueE, pPath); + + if (pResultClass != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ResultClass"); + CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, pResultClass); + } + if (pRole != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "Role"); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pRole); + } + + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "IncludeQualifiers"); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeQualifiers); + + iparamvalueE = CIMXMLBuilderImpl + .createIPARAMVALUE(pDoc, imethodcallE, "IncludeClassOrigin"); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeClassOrigin); + + if (pPropertyList != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "PropertyList"); + Element valuearrayE = CIMXMLBuilderImpl.createVALUEARRAY(pDoc, iparamvalueE); + for (int i = 0; i < pPropertyList.length; i++) { + CIMXMLBuilderImpl.createVALUE(pDoc, valuearrayE, pPropertyList[i]); + } + } + + return simplereqE; + } + + /** + * setClass_request + * + * @param pDoc + * @param pPath + * @param pClass + * @return Element + * @throws WBEMException + */ + public Element setClass_request(Document pDoc, CIMObjectPath pPath, CIMClass pClass) + throws WBEMException { + String className = pPath.getObjectName(); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, + "null class name"); + + Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "ModifyClass"); + CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); + + Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, + "ModifiedClass"); + CIMXMLBuilderImpl.createCLASS(pDoc, iparamvalueE, pClass); + + return simplereqE; + } + + /** + * setInstance_request + * + * @param pDoc + * @param pPath + * @param pInstance + * @param pIncludeQualifiers + * @param pPropertyList + * @return Element + * @throws WBEMException + */ + public Element setInstance_request(Document pDoc, CIMObjectPath pPath, CIMInstance pInstance, + boolean pIncludeQualifiers, String[] pPropertyList) throws WBEMException { + String className = pPath.getObjectName(); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, + "null class name"); + + Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, + "ModifyInstance"); + CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); + + Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, + "ModifiedInstance"); + CIMXMLBuilderImpl.createVALUENAMEDINSTANCE(pDoc, iparamvalueE, pPath, pInstance); + + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "IncludeQualifiers"); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeQualifiers); + + if (pPropertyList != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "PropertyList"); + Element valuearrayE = CIMXMLBuilderImpl.createVALUEARRAY(pDoc, iparamvalueE); + for (int i = 0; i < pPropertyList.length; i++) { + CIMXMLBuilderImpl.createVALUE(pDoc, valuearrayE, pPropertyList[i]); + } + } + + return simplereqE; + } + + /** + * setProperty_request + * + * @param pDoc + * @param pPath + * @param pPropertyName + * @param pNewValue + * @return Element + * @throws WBEMException + */ + public Element setProperty_request(Document pDoc, CIMObjectPath pPath, String pPropertyName, + Object pNewValue) throws WBEMException { + String className = pPath.getObjectName(); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, + "null class name"); + + Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "SetProperty"); + CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); + + Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, + "InstanceName"); + CIMXMLBuilderImpl.createINSTANCENAME(pDoc, iparamvalueE, pPath); + + if (pPropertyName != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "PropertyName"); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pPropertyName); + } + + if (pNewValue != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "NewValue"); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pNewValue); + } + + return simplereqE; + } + + /** + * setQualifierType_request + * + * @param pDoc + * @param pPath + * @param pQt + * @return Element + * @throws WBEMException + */ + public Element setQualifierType_request(Document pDoc, CIMObjectPath pPath, + CIMQualifierType pQt) throws WBEMException { + // Make sure class name exists, it is required to uniquely identify + // qualifier in namespace + String className = pPath.getObjectName(); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, + "null class name"); + + Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); + Element imethodcallE = CIMXMLBuilderImpl + .createIMETHODCALL(pDoc, simplereqE, "SetQualifier"); + CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); + + Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, + "QualifierDeclaration"); + CIMXMLBuilderImpl.createQUALIFIER_DECLARATION(pDoc, iparamvalueE, pQt); + + return simplereqE; + } + + /** + * enumQualifierTypes_request + * + * @param pDoc + * @param pPath + * @return Element + * @throws WBEMException + */ + public Element enumQualifierTypes_request(Document pDoc, CIMObjectPath pPath) + throws WBEMException { + + Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, + "EnumerateQualifiers"); + CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); + + return simplereqE; + } + + /** + * enumQualifierTypes_response + * + * @param pDoc + * @param pQualiTypeA + * @return Element + * @throws WBEMException + */ + public static Element enumQualifierTypes_response(Document pDoc, + CIMQualifierType[] pQualiTypeA) throws WBEMException { + Element simpRspE = CIMXMLBuilderImpl.createSIMPLERSP(pDoc, null); + Element iMethRspE = CIMXMLBuilderImpl.createIMETHODRESPONSE(pDoc, simpRspE, + "associatorNames"); + Element iRetValE = CIMXMLBuilderImpl.createIRETURNVALUE(pDoc, iMethRspE); + for (int i = 0; i < pQualiTypeA.length; i++) { + CIMXMLBuilderImpl.createQUALIFIER_DECLARATION(pDoc, iRetValE, pQualiTypeA[i]); + } + return simpRspE; + } + + /** + * execQuery_request + * + * @param pDoc + * @param pPath + * @param pQuery + * @param pQueryLanguage + * @return Element + */ + public Element execQuery_request(Document pDoc, CIMObjectPath pPath, String pQuery, + String pQueryLanguage) { + Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "ExecQuery"); + CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); + + Element querylanguageE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, + "QueryLanguage"); + CIMXMLBuilderImpl.createVALUE(pDoc, querylanguageE, pQueryLanguage); + + Element queryE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "Query"); + CIMXMLBuilderImpl.createVALUE(pDoc, queryE, pQuery); + + return simplereqE; + } + + /** + * performBatchOperation_request + * + * @param pDoc + * @param pOperations + * @return Element + * @throws WBEMException + */ + public Element performBatchOperation_request(Document pDoc, Vector pOperations) + throws WBEMException { + + Element messageE = createCIMMessage(pDoc, null); + if (pOperations.size() > 1) { + Element multireqE = createMultiReq(pDoc); + messageE.appendChild(multireqE); + messageE = multireqE; + } + int i = 0; + Iterator iter = pOperations.iterator(); + while (iter.hasNext()) { + CIMOperation op = iter.next(); + try { + Element requestE = null; + + if (op instanceof CIMAssociatorsOp) { + CIMAssociatorsOp associatorsOp = (CIMAssociatorsOp) op; + requestE = associators_request(pDoc, associatorsOp.getObjectName(), + associatorsOp.getAssocClass(), associatorsOp.getResultClass(), + associatorsOp.getRole(), associatorsOp.getResultRole(), associatorsOp + .isIncludeQualifiers(), associatorsOp.isIncludeClassOrigin(), + associatorsOp.getPropertyList()); + } else if (op instanceof CIMAssociatorNamesOp) { + CIMAssociatorNamesOp associatorNamesOp = (CIMAssociatorNamesOp) op; + requestE = associatorNames_request(pDoc, associatorNamesOp.getObjectName(), + associatorNamesOp.getAssocClass(), associatorNamesOp.getResultClass(), + associatorNamesOp.getRole(), associatorNamesOp.getResultRole()); + } else if (op instanceof CIMCreateClassOp) { + CIMCreateClassOp createClassOp = (CIMCreateClassOp) op; + requestE = createClass_request(pDoc, createClassOp.getObjectName(), + createClassOp.getCimClass()); + } else if (op instanceof CIMCreateInstanceOp) { + CIMCreateInstanceOp createInstanceOp = (CIMCreateInstanceOp) op; + requestE = createInstance_request(pDoc, createInstanceOp.getObjectName(), + createInstanceOp.getInstance()); + } else if (op instanceof CIMCreateNameSpaceOp) { + CIMCreateNameSpaceOp createNameSpaceOp = (CIMCreateNameSpaceOp) op; + + String namespace = createNameSpaceOp.getNameSpace(); + int j = namespace.lastIndexOf('/'); + + if (j < 0) throw new WBEMException(WBEMException.CIM_ERR_NOT_FOUND, + "Invalid namespace. Must contain at least /"); + String parentNs = namespace.substring(0, j); + namespace = namespace.substring(j + 1); + + /* + * CIMInstance inst = new CIMInstance(); + * inst.setClassName("CIM_NameSpace"); CIMProperty prop = + * new CIMProperty("NameSpace"); prop.setValue(new + * CIMValue(namespace, CIMDataType + * .getPredefinedType(CIMDataType.STRING))); Vector v = new + * Vector(); v.add(prop); inst.setProperties(v); + */ + + CIMInstance inst = new CIMInstance(new CIMObjectPath(null, null, null, null, + "CIM_NameSpace", null), new CIMProperty[] { new CIMProperty( + "NameSpace", CIMDataType.STRING_T, namespace, true, false, null) }); + CIMObjectPath object = new CIMObjectPath(null, null, null, parentNs, null, null); + + requestE = createInstance_request(pDoc, object, inst); + } else if (op instanceof CIMCreateQualifierTypeOp) { + CIMCreateQualifierTypeOp createQualifierTypeOp = (CIMCreateQualifierTypeOp) op; + requestE = createQualifierType_request(pDoc, createQualifierTypeOp + .getObjectName(), createQualifierTypeOp.getQualifierType()); + } else if (op instanceof CIMDeleteClassOp) { + CIMDeleteClassOp deleteClassOp = (CIMDeleteClassOp) op; + requestE = deleteClass_request(pDoc, deleteClassOp.getObjectName()); + } else if (op instanceof CIMDeleteInstanceOp) { + CIMDeleteInstanceOp deleteInstanceOp = (CIMDeleteInstanceOp) op; + requestE = deleteClass_request(pDoc, deleteInstanceOp.getObjectName()); + } else if (op instanceof CIMDeleteQualifierTypeOp) { + CIMDeleteQualifierTypeOp deleteQualifierTypeOp = (CIMDeleteQualifierTypeOp) op; + requestE = deleteClass_request(pDoc, deleteQualifierTypeOp.getObjectName()); + } else if (op instanceof CIMEnumClassesOp) { + CIMEnumClassesOp enumClassesOp = (CIMEnumClassesOp) op; + requestE = enumerateClasses_request(pDoc, enumClassesOp.getObjectName(), + enumClassesOp.isDeep(), enumClassesOp.isLocalOnly(), enumClassesOp + .isIncludeQualifiers(), enumClassesOp.isIncludeClassOrigin()); + } else if (op instanceof CIMEnumClassNamesOp) { + CIMEnumClassNamesOp enumClassNamesOp = (CIMEnumClassNamesOp) op; + requestE = enumerateClassNames_request(pDoc, enumClassNamesOp.getObjectName(), + enumClassNamesOp.isDeep()); + } else if (op instanceof CIMEnumInstanceNamesOp) { + CIMEnumInstanceNamesOp enumInstanceNamesOp = (CIMEnumInstanceNamesOp) op; + requestE = enumerateInstanceNames_request(pDoc, enumInstanceNamesOp + .getObjectName()); + } else if (op instanceof CIMEnumInstancesOp) { + CIMEnumInstancesOp enumInstancesOp = (CIMEnumInstancesOp) op; + requestE = enumerateInstances_request(pDoc, enumInstancesOp.getObjectName(), + enumInstancesOp.isDeep(), enumInstancesOp.isLocalOnly(), + enumInstancesOp.isIncludeQualifiers(), enumInstancesOp + .isIncludeClassOrigin(), enumInstancesOp.getPropertyList()); + } else if (op instanceof CIMEnumNameSpaceOp) { + CIMEnumNameSpaceOp enumNameSpaceOp = (CIMEnumNameSpaceOp) op; + // ebak: here we have to set CIMObjectPath's objectname + // enumNameSpaceOp.getObjectName().setObjectName("CIM_NameSpace"); + CIMObjectPath objPath = enumNameSpaceOp.getObjectName(); + objPath = new CIMObjectPath(objPath.getScheme(), objPath.getHost(), objPath + .getPort(), objPath.getNamespace(), "CIM_NameSpace", objPath.getKeys()); + requestE = enumerateInstanceNames_request(pDoc, enumNameSpaceOp.getObjectName()); + } else if (op instanceof CIMEnumQualifierTypesOp) { + CIMEnumQualifierTypesOp enumQualifierTypesOp = (CIMEnumQualifierTypesOp) op; + requestE = enumQualifierTypes_request(pDoc, enumQualifierTypesOp + .getObjectName()); + } else if (op instanceof CIMExecQueryOp) { + CIMExecQueryOp execQueryOp = (CIMExecQueryOp) op; + requestE = execQuery_request(pDoc, execQueryOp.getObjectName(), execQueryOp + .getQuery(), execQueryOp.getQueryLanguage()); + } else if (op instanceof CIMGetPropertyOp) { + CIMGetPropertyOp getPropertyOp = (CIMGetPropertyOp) op; + requestE = getInstance_request(pDoc, getPropertyOp.getObjectName(), false, + false, false, new String[] { getPropertyOp.getPropertyName() }); + + } else if (op instanceof CIMGetClassOp) { + CIMGetClassOp getClassOp = (CIMGetClassOp) op; + requestE = getClass_request(pDoc, getClassOp.getObjectName(), getClassOp + .isLocalOnly(), getClassOp.isIncludeQualifiers(), getClassOp + .isIncludeClassOrigin(), getClassOp.getPropertyList()); + } else if (op instanceof CIMGetInstanceOp) { + CIMGetInstanceOp getInstanceOp = (CIMGetInstanceOp) op; + requestE = getInstance_request(pDoc, getInstanceOp.getObjectName(), + getInstanceOp.isLocalOnly(), getInstanceOp.isIncludeQualifiers(), + getInstanceOp.isIncludeClassOrigin(), getInstanceOp.getPropertyList()); + } else if (op instanceof CIMGetQualifierTypeOp) { + CIMGetQualifierTypeOp getQualifierTypeOp = (CIMGetQualifierTypeOp) op; + requestE = getQualifier_request(pDoc, getQualifierTypeOp.getObjectName(), + getQualifierTypeOp.getQualifierType()); + } else if (op instanceof CIMInvokeMethodOp) { + CIMInvokeMethodOp invokeMethodOp = (CIMInvokeMethodOp) op; + requestE = invokeMethod_request(pDoc, invokeMethodOp.getObjectName(), + invokeMethodOp.getMethodCall(), invokeMethodOp.getInParams()); + } else if (op instanceof CIMReferenceNamesOp) { + CIMReferenceNamesOp referenceNamesOp = (CIMReferenceNamesOp) op; + requestE = referenceNames_request(pDoc, referenceNamesOp.getObjectName(), + referenceNamesOp.getResultClass(), referenceNamesOp.getResultRole()); + } else if (op instanceof CIMReferencesOp) { + CIMReferencesOp referencesOp = (CIMReferencesOp) op; + requestE = references_request(pDoc, referencesOp.getObjectName(), referencesOp + .getResultClass(), referencesOp.getRole(), referencesOp + .isIncludeQualifiers(), referencesOp.isIncludeClassOrigin(), + referencesOp.getPropertyList()); + } else if (op instanceof CIMSetClassOp) { + CIMSetClassOp setClassOp = (CIMSetClassOp) op; + requestE = setClass_request(pDoc, setClassOp.getObjectName(), setClassOp + .getCimClass()); + } else if (op instanceof CIMSetInstanceOp) { + CIMSetInstanceOp setInstanceOp = (CIMSetInstanceOp) op; + requestE = setInstance_request(pDoc, setInstanceOp.getObjectName(), + setInstanceOp.getInstance(), setInstanceOp.isIncludeQualifiers(), + setInstanceOp.getPropertyList()); + } else if (op instanceof CIMSetPropertyOp) { + CIMSetPropertyOp setPropertyOp = (CIMSetPropertyOp) op; + requestE = setProperty_request(pDoc, setPropertyOp.getObjectName(), + setPropertyOp.getPropertyName(), setPropertyOp.getCimValue()); + } else if (op instanceof CIMSetQualifierTypeOp) { + CIMSetQualifierTypeOp setQualifierTypeOp = (CIMSetQualifierTypeOp) op; + requestE = setQualifierType_request(pDoc, setQualifierTypeOp.getObjectName(), + setQualifierTypeOp.getQualifierType()); + } + if (requestE == null) throw new WBEMException( + WBEMException.CIM_ERR_INVALID_PARAMETER, "Illegal batch operation number (" + + i + ") " + op.getClass()); + messageE.appendChild(requestE); + } catch (WBEMException e) { + throw e; + } catch (Exception e) { + throw new WBEMException(WBEMException.CIM_ERR_FAILED, "At batch operation (" + i + + ')', null, e); + } + i++; + } + return messageE; + } + + /** + * Sets the message id counter to a given value. For use in units tests + * only. + * + * @param pId + * The new value + */ + public void setId(int pId) { + this.iCurrentId.set(new Counter(pId - 1)); + } + + /** + * Get the next message id. If this method is called for the first time by + * the current thread it will choose a start value randomly. Afterwards the + * id is incremented by 1. Be aware that different threads will have + * distinct id counters. + * + * @return The next message id + */ + private int getNextId() { + if (this.iCurrentId.get() == null) { + this.iCurrentId.set(new Counter(RANDOM.nextInt(MAX_ID))); + } + return this.iCurrentId.get().incrementAndGet(); + } + + /** + * pAssociatorPaths_request + * + * @param pDoc + * @param pPath + * @param pAssocClass + * @param pResultClass + * @param pRole + * @param pResultRole + * @param pFilterQueryLanguage + * @param pFilterQuery + * @param pOperationTimeout + * @param pContinueOnError + * @param pMaxObjectCount + * @return Element + * @throws WBEMException + */ + public Element OpenAssociatorInstancePaths_request(Document pDoc, CIMObjectPath pPath, + String pAssocClass, String pResultClass, String pRole, String pResultRole, + String pFilterQueryLanguage, String pFilterQuery, UnsignedInteger32 pOperationTimeout, + boolean pContinueOnError, UnsignedInteger32 pMaxObjectCount) throws WBEMException { + + String className = pPath.getObjectName(); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, + "null class name"); + + Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, + "OpenAssociatorInstancePaths"); + CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); + + Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, + INSTANCE_NAME); + CIMXMLBuilderImpl.createINSTANCENAME(pDoc, iparamvalueE, pPath); + + if (pAssocClass != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, ASSOC_CLASS); + CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, pAssocClass); + } + if (pResultClass != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, RESULT_CLASS); + CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, pResultClass); + } + if (pRole != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, ROLE); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pRole); + } + if (pResultRole != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, RESULT_ROLE); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pResultRole); + } + if (pFilterQueryLanguage != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, + FILTER_QUERY_LANGUAGE); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pFilterQueryLanguage); + } + if (pFilterQuery != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, FILTER_QUERY); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pFilterQuery); + } + if (pOperationTimeout != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, + OPERATION_TIMEOUT); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pOperationTimeout); + } + + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, CONTINUE_ON_ERROR); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pContinueOnError); + + if (pMaxObjectCount != null) { + iparamvalueE = CIMXMLBuilderImpl + .createIPARAMVALUE(pDoc, imethodcallE, MAX_OBJECT_COUNT); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pMaxObjectCount); + } + + return simplereqE; + } + + /** + * OpenAssociatorInstances_request + * + * @param pDoc + * @param pPath + * @param pAssocClass + * @param pResultClass + * @param pRole + * @param pResultRole + * @param pIncludeClassOrigin + * @param pPropertyList + * @param pFilterQueryLanguage + * @param pFilterQuery + * @param pOperationTimeout + * @param pContinueOnError + * @param pMaxObjectCount + * @return Element OpenAssociatorInstances_request + * @throws WBEMException + */ + public Element OpenAssociatorInstances_request(Document pDoc, CIMObjectPath pPath, + String pAssocClass, String pResultClass, String pRole, String pResultRole, + boolean pIncludeClassOrigin, String[] pPropertyList, String pFilterQueryLanguage, + String pFilterQuery, UnsignedInteger32 pOperationTimeout, boolean pContinueOnError, + UnsignedInteger32 pMaxObjectCount) throws WBEMException { + + String className = pPath.getObjectName(); + + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, + "null class name"); + + Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, + "OpenAssociatorInstances"); + CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); + + Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, + INSTANCE_NAME); + // createINSTANCENAME will take care of keyBindings + CIMXMLBuilderImpl.createINSTANCENAME(pDoc, iparamvalueE, pPath); + + if (pAssocClass != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, ASSOC_CLASS); + CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, pAssocClass); + } + if (pResultClass != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, RESULT_CLASS); + CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, pResultClass); + } + if (pRole != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, ROLE); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pRole); + } + if (pResultRole != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, RESULT_ROLE); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pResultRole); + } + iparamvalueE = CIMXMLBuilderImpl + .createIPARAMVALUE(pDoc, imethodcallE, INCLUDE_CLASS_ORIGIN); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeClassOrigin); + + if (pPropertyList != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, PROPERTY_LIST); + Element valuearrayE = CIMXMLBuilderImpl.createVALUEARRAY(pDoc, iparamvalueE); + for (int i = 0; i < pPropertyList.length; i++) + CIMXMLBuilderImpl.createVALUE(pDoc, valuearrayE, pPropertyList[i]); + } + if (pFilterQueryLanguage != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, + FILTER_QUERY_LANGUAGE); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pFilterQueryLanguage); + } + if (pFilterQuery != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, FILTER_QUERY); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pFilterQuery); + } + if (pOperationTimeout != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, + OPERATION_TIMEOUT); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pOperationTimeout); + } + + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, CONTINUE_ON_ERROR); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pContinueOnError); + + if (pMaxObjectCount != null) { + iparamvalueE = CIMXMLBuilderImpl + .createIPARAMVALUE(pDoc, imethodcallE, MAX_OBJECT_COUNT); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pMaxObjectCount); + } + + return simplereqE; + } + + /** + * OpenEnumerateInstancePaths_request + * + * @param pDoc + * @param pPath + * @param pFilterQueryLanguage + * @param pFilterQuery + * @param pOperationTimeout + * @param pContinueOnError + * @param pMaxObjectCount + * @return Element + * @throws WBEMException + */ + public Element OpenEnumerateInstancePaths_request(Document pDoc, CIMObjectPath pPath, + String pFilterQueryLanguage, String pFilterQuery, UnsignedInteger32 pOperationTimeout, + boolean pContinueOnError, UnsignedInteger32 pMaxObjectCount) throws WBEMException { + + String className = pPath.getObjectName(); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, + "null class name"); + + Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, + "OpenEnumerateInstancePaths"); + CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); + + Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, CLASS_NAME); + CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, className); + + if (pFilterQueryLanguage != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, + FILTER_QUERY_LANGUAGE); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pFilterQueryLanguage); + } + if (pFilterQuery != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, FILTER_QUERY); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pFilterQuery); + } + if (pOperationTimeout != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, + OPERATION_TIMEOUT); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pOperationTimeout); + } + + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, CONTINUE_ON_ERROR); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pContinueOnError); + + if (pMaxObjectCount != null) { + iparamvalueE = CIMXMLBuilderImpl + .createIPARAMVALUE(pDoc, imethodcallE, MAX_OBJECT_COUNT); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pMaxObjectCount); + } + + return simplereqE; + } + + /** + * OpenEnumerateInstances_request + * + * @param pDoc + * @param pPath + * @param pPropertyList + * @param pIncludeClassOrigin + * @param pDeepInheritance + * @param pFilterQueryLanguage + * @param pFilterQuery + * @param pOperationTimeout + * @param pContinueOnError + * @param pMaxObjectCount + * @return Element + * @throws WBEMException + */ + public Element OpenEnumerateInstances_request(Document pDoc, CIMObjectPath pPath, + boolean pDeepInheritance, boolean pIncludeClassOrigin, String[] pPropertyList, + String pFilterQueryLanguage, String pFilterQuery, UnsignedInteger32 pOperationTimeout, + boolean pContinueOnError, UnsignedInteger32 pMaxObjectCount) throws WBEMException { + + String className = pPath.getObjectName(); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, + "null class name"); + + Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, + "OpenEnumerateInstances"); + CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); + + Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, CLASS_NAME); + CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, className); + + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, DEEP_INHERITANCE); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pDeepInheritance); + + iparamvalueE = CIMXMLBuilderImpl + .createIPARAMVALUE(pDoc, imethodcallE, INCLUDE_CLASS_ORIGIN); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeClassOrigin); + + if (pPropertyList != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, PROPERTY_LIST); + Element valuearrayE = CIMXMLBuilderImpl.createVALUEARRAY(pDoc, iparamvalueE); + for (int i = 0; i < pPropertyList.length; i++) + CIMXMLBuilderImpl.createVALUE(pDoc, valuearrayE, pPropertyList[i]); + } + + if (pFilterQueryLanguage != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, + FILTER_QUERY_LANGUAGE); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pFilterQueryLanguage); + } + if (pFilterQuery != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, FILTER_QUERY); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pFilterQuery); + } + if (pOperationTimeout != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, + OPERATION_TIMEOUT); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pOperationTimeout); + } + + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, CONTINUE_ON_ERROR); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pContinueOnError); + + if (pMaxObjectCount != null) { + iparamvalueE = CIMXMLBuilderImpl + .createIPARAMVALUE(pDoc, imethodcallE, MAX_OBJECT_COUNT); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pMaxObjectCount); + } + + return simplereqE; + } + + /** + * EnumerationCount_request + * + * @param pDoc + * @param pPath + * @param pEnumerationContext + * @return Element + * @throws WBEMException + */ + public Element EnumerationCount_request(Document pDoc, CIMObjectPath pPath, + String pEnumerationContext) throws WBEMException { + + String className = pPath.getObjectName(); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, + "null class name"); + + Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, + "EnumerationCount"); + CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); + + if (pEnumerationContext != null) { + Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, + ENUMERATION_CONTEXT); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pEnumerationContext); + } + + return simplereqE; + + } + + /** + * CloseEnumeration_request + * + * @param pDoc + * @param pPath + * @param pEnumerationContext + * @return Element + * @throws WBEMException + */ + public Element CloseEnumeration_request(Document pDoc, CIMObjectPath pPath, + String pEnumerationContext) throws WBEMException { + + String className = pPath.getObjectName(); + + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, + "null class name"); + + Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, + "CloseEnumeration"); + CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); + + if (pEnumerationContext != null) { + Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, + ENUMERATION_CONTEXT); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pEnumerationContext); + } + return simplereqE; + } + + /** + * referencePaths_request + * + * @param pDoc + * @param pPath + * @param pResultClass + * @param pRole + * @param pFilterQueryLanguage + * @param pFilterQuery + * @param pOperationTimeout + * @param pContinueOnError + * @param pMaxObjectCount + * @return Element referencePaths_request + * @throws WBEMException + */ + public Element OpenReferenceInstancePaths_request(Document pDoc, CIMObjectPath pPath, + String pResultClass, String pRole, String pFilterQueryLanguage, String pFilterQuery, + UnsignedInteger32 pOperationTimeout, boolean pContinueOnError, + UnsignedInteger32 pMaxObjectCount) throws WBEMException { + + String className = pPath.getObjectName(); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, + "null class name"); + + Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, + "OpenReferenceInstancePaths"); + CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); + + Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, + INSTANCE_NAME); + CIMXMLBuilderImpl.createINSTANCENAME(pDoc, iparamvalueE, pPath); + + if (pResultClass != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, RESULT_CLASS); + CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, pResultClass); + } + if (pRole != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, ROLE); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pRole); + } + if (pFilterQueryLanguage != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, + FILTER_QUERY_LANGUAGE); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pFilterQueryLanguage); + } + if (pFilterQuery != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, FILTER_QUERY); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pFilterQuery); + } + if (pOperationTimeout != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, + OPERATION_TIMEOUT); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pOperationTimeout); + } + + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, CONTINUE_ON_ERROR); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pContinueOnError); + + if (pMaxObjectCount != null) { + iparamvalueE = CIMXMLBuilderImpl + .createIPARAMVALUE(pDoc, imethodcallE, MAX_OBJECT_COUNT); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pMaxObjectCount); + } + + return simplereqE; + + } + + /** + * references_request + * + * @param pDoc + * @param pPath + * @param pResultClass + * @param pRole + * @param pIncludeClassOrigin + * @param pPropertyList + * @param pFilterQueryLanguage + * @param pFilterQuery + * @param pOperationTimeout + * @param pContinueOnError + * @param pMaxObjectCount + * @return Element references_request + * @throws WBEMException + */ + public Element OpenReferenceInstances_request(Document pDoc, CIMObjectPath pPath, + String pResultClass, String pRole, boolean pIncludeClassOrigin, String[] pPropertyList, + String pFilterQueryLanguage, String pFilterQuery, UnsignedInteger32 pOperationTimeout, + boolean pContinueOnError, UnsignedInteger32 pMaxObjectCount) throws WBEMException { + + String className = pPath.getObjectName(); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, + "null class name"); + + Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, + "OpenReferenceInstances"); + CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); + + Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, + INSTANCE_NAME); + CIMXMLBuilderImpl.createINSTANCENAME(pDoc, iparamvalueE, pPath); + + if (pResultClass != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, RESULT_CLASS); + CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, pResultClass); + } + if (pRole != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, ROLE); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pRole); + } + + iparamvalueE = CIMXMLBuilderImpl + .createIPARAMVALUE(pDoc, imethodcallE, INCLUDE_CLASS_ORIGIN); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeClassOrigin); + + if (pPropertyList != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, PROPERTY_LIST); + Element valuearrayE = CIMXMLBuilderImpl.createVALUEARRAY(pDoc, iparamvalueE); + for (int i = 0; i < pPropertyList.length; i++) + CIMXMLBuilderImpl.createVALUE(pDoc, valuearrayE, pPropertyList[i]); + } + + if (pFilterQueryLanguage != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, + FILTER_QUERY_LANGUAGE); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pFilterQueryLanguage); + } + if (pFilterQuery != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, FILTER_QUERY); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pFilterQuery); + } + if (pOperationTimeout != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, + OPERATION_TIMEOUT); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pOperationTimeout); + } + + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, CONTINUE_ON_ERROR); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pContinueOnError); + + if (pMaxObjectCount != null) { + iparamvalueE = CIMXMLBuilderImpl + .createIPARAMVALUE(pDoc, imethodcallE, MAX_OBJECT_COUNT); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pMaxObjectCount); + } + + return simplereqE; + } + + /** + * OpenQueryInstances_request + * + * @param pDoc + * @param pPath + * @param pFilterQuery + * @param pFilterQueryLanguage + * @param pReturnQueryResultClass + * @param pOperationTimeout + * @param pContinueOnError + * @param pMaxObjectCount + * @param pQueryResultClass + * @return Element OpenQueryInstances_request + * @throws WBEMException + */ + public Element OpenQueryInstances_request(Document pDoc, CIMObjectPath pPath, + String pFilterQuery, String pFilterQueryLanguage, boolean pReturnQueryResultClass, + UnsignedInteger32 pOperationTimeout, boolean pContinueOnError, + UnsignedInteger32 pMaxObjectCount, CIMClass pQueryResultClass) throws WBEMException { + + String className = pPath.getObjectName(); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, + "null class name"); + + Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, + "OpenQueryInstances"); + CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); + + Element iparamvalueE; + + if (pFilterQuery != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, FILTER_QUERY); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pFilterQuery); + } + if (pFilterQueryLanguage != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, + FILTER_QUERY_LANGUAGE); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pFilterQueryLanguage); + } + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, + RETURN_QUERY_RESULT_CLASS); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pReturnQueryResultClass); + + if (pOperationTimeout != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, + OPERATION_TIMEOUT); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pOperationTimeout); + } + + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, CONTINUE_ON_ERROR); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pContinueOnError); + + if (pMaxObjectCount != null) { + iparamvalueE = CIMXMLBuilderImpl + .createIPARAMVALUE(pDoc, imethodcallE, MAX_OBJECT_COUNT); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pMaxObjectCount); + } + if (pQueryResultClass != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, + QUERY_RESULT_CLASS); + CIMXMLBuilderImpl.createCLASS(pDoc, iparamvalueE, pQueryResultClass); + } + return simplereqE; + } + + /** + * PullInstancesWithPath_request + * + * @param pDoc + * @param pPath + * @param pContext + * @param pMaxObjectCount + * @return Element PullInstancesWithPath_request + * @throws WBEMException + */ + public Element PullInstancesWithPath_request(Document pDoc, CIMObjectPath pPath, + String pContext, UnsignedInteger32 pMaxObjectCount) throws WBEMException { + + String className = pPath.getObjectName(); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, + "null class name"); + + Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, + "PullInstancesWithPath"); + CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); + + Element iparamvalueE; + + if (pContext != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, + ENUMERATION_CONTEXT); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pContext); + } + + if (pMaxObjectCount != null) { + iparamvalueE = CIMXMLBuilderImpl + .createIPARAMVALUE(pDoc, imethodcallE, MAX_OBJECT_COUNT); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pMaxObjectCount); + } + + return simplereqE; + } + + /** + * PullInstancePaths_request + * + * @param pDoc + * @param pPath + * @param pContext + * @param pMaxObjectCount + * @return Element PullInstancePaths + * @throws WBEMException + */ + public Element PullInstancePaths_request(Document pDoc, CIMObjectPath pPath, String pContext, + UnsignedInteger32 pMaxObjectCount) throws WBEMException { + + String className = pPath.getObjectName(); + + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, + "null class name"); + + Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, + "PullInstancePaths"); + CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); + + Element iparamvalueE; + + if (pContext != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, + ENUMERATION_CONTEXT); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pContext); + } + + if (pMaxObjectCount != null) { + iparamvalueE = CIMXMLBuilderImpl + .createIPARAMVALUE(pDoc, imethodcallE, MAX_OBJECT_COUNT); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pMaxObjectCount); + } + + return simplereqE; + } + + /** + * PullInstances_request + * + * @param pDoc + * @param pPath + * @param pContext + * @param pMaxObjectCount + * @return Element PullInstances_request + * @throws WBEMException + */ + public Element PullInstances_request(Document pDoc, CIMObjectPath pPath, String pContext, + UnsignedInteger32 pMaxObjectCount) throws WBEMException { + String className = pPath.getObjectName(); + + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, + "null class name"); + + Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, + "PullInstances"); + CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); + + Element iparamvalueE; + + if (pContext != null) { + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, + ENUMERATION_CONTEXT); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pContext); + } + + if (pMaxObjectCount != null) { + iparamvalueE = CIMXMLBuilderImpl + .createIPARAMVALUE(pDoc, imethodcallE, MAX_OBJECT_COUNT); + CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pMaxObjectCount); + } + + return simplereqE; + } + + /** + * sendIndication_request + * + * @param pDoc + * @param pIndication + * @return Element sendIndication_request + * @throws WBEMException + */ + public Element sendIndication_request(Document pDoc, CIMInstance pIndication) + throws WBEMException { + Element simpleexpreqE = CIMXMLBuilderImpl.createSIMPLEEXPREQ(pDoc); + Element expmethodcallE = CIMXMLBuilderImpl.createEXPMETHODCALL(pDoc, simpleexpreqE, + "ExportIndication"); + Element expparamvalueE = CIMXMLBuilderImpl.createEXPPARAMVALUE(pDoc, expmethodcallE, + "NewIndication"); + + CIMXMLBuilderImpl.createINSTANCE(pDoc, expparamvalueE, pIndication); + + return simpleexpreqE; + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/CIMMessage.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/CIMMessage.java similarity index 78% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/CIMMessage.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/CIMMessage.java index b290726..b064249 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/CIMMessage.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/CIMMessage.java @@ -1,199 +1,197 @@ -/* - CIMMessage.java - - (C) Copyright IBM Corp. 2005, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1535756 2006-08-07 lupusalex Make code warning free - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.Hashtable; - -import org.w3c.dom.Document; - -/** - * Class CIMMessage is used by the CIM-XML DOM parser. - */ -public class CIMMessage { - - protected Document iDoc; - - protected Hashtable iElements; - - protected String iCimVersion; - - protected String iDtdVersion; - - protected String iId; - - protected String iProtocolVersion; - - protected String iMethod; - - protected boolean iIsCIMExport = false; - - protected boolean iIsSimple = false; - - protected boolean iIsRequest = false; - - protected CIMMessage() { /**/} - - /** - * Ctor. - * - * @param pCimVersion - * @param pDtdVersion - * @param pId - * @param pMethod - */ - public CIMMessage(String pCimVersion, String pDtdVersion, String pId, String pMethod) { - this.iCimVersion = pCimVersion; - this.iDtdVersion = pDtdVersion; - this.iId = pId; - this.iMethod = pMethod; - } - - /** - * getCIMVersion - * - * @return String - */ - public String getCIMVersion() { - return this.iCimVersion; - } - - /** - * getDTDVersion - * - * @return String - */ - public String getDTDVersion() { - return this.iDtdVersion; - } - - /** - * isCIMOperation - * - * @return String - */ - public boolean isCIMOperation() { - return !this.iIsCIMExport; - } - - /** - * isCIMExport - * - * @return String - */ - public boolean isCIMExport() { - return this.iIsCIMExport; - } - - /** - * setId - * - * @param pId - */ - public void setId(String pId) { - this.iId = pId; - } - - /** - * setMethod - * - * @param pMethod - */ - public void setMethod(String pMethod) { - - this.iMethod = pMethod; - this.iIsCIMExport = (pMethod.toUpperCase().endsWith("EXPREQ") || pMethod.toUpperCase() - .endsWith("EXPRSP")); - this.iIsRequest = (pMethod.toUpperCase().endsWith("REQ")); - this.iIsSimple = pMethod.toUpperCase().startsWith("SIMPLE"); - } - - /** - * setCIMVersion - * - * @param pCimVersion - */ - public void setCIMVersion(String pCimVersion) { - this.iCimVersion = pCimVersion; - } - - /** - * setDTDVersion - * - * @param pDtdVersion - */ - public void setDTDVersion(String pDtdVersion) { - this.iDtdVersion = pDtdVersion; - } - - /** - * setIsRequest - * - * @param pValue - */ - public void setIsRequest(boolean pValue) { - this.iIsRequest = pValue; - } - - /** - * getId - * - * @return String - */ - public String getId() { - return this.iId; - } - - /** - * getProtocolVersion - * - * @return String - */ - public String getProtocolVersion() { - return this.iProtocolVersion; - } -} +/* + CIMMessage.java + + (C) Copyright IBM Corp. 2005, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1535756 2006-08-07 lupusalex Make code warning free + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.Hashtable; + +import org.w3c.dom.Document; + +/** + * Class CIMMessage is used by the CIM-XML DOM parser. + */ +public class CIMMessage { + + protected Document iDoc; + + protected Hashtable iElements; + + protected String iCimVersion; + + protected String iDtdVersion; + + protected String iId; + + protected String iProtocolVersion; + + protected String iMethod; + + protected boolean iIsCIMExport = false; + + protected boolean iIsSimple = false; + + protected boolean iIsRequest = false; + + protected CIMMessage() { /**/} + + /** + * Ctor. + * + * @param pCimVersion + * @param pDtdVersion + * @param pId + * @param pMethod + */ + public CIMMessage(String pCimVersion, String pDtdVersion, String pId, String pMethod) { + this.iCimVersion = pCimVersion; + this.iDtdVersion = pDtdVersion; + this.iId = pId; + this.iMethod = pMethod; + } + + /** + * getCIMVersion + * + * @return String + */ + public String getCIMVersion() { + return this.iCimVersion; + } + + /** + * getDTDVersion + * + * @return String + */ + public String getDTDVersion() { + return this.iDtdVersion; + } + + /** + * isCIMOperation + * + * @return String + */ + public boolean isCIMOperation() { + return !this.iIsCIMExport; + } + + /** + * isCIMExport + * + * @return String + */ + public boolean isCIMExport() { + return this.iIsCIMExport; + } + + /** + * setId + * + * @param pId + */ + public void setId(String pId) { + this.iId = pId; + } + + /** + * setMethod + * + * @param pMethod + */ + public void setMethod(String pMethod) { + + this.iMethod = pMethod; + this.iIsCIMExport = (pMethod.toUpperCase().endsWith("EXPREQ") || pMethod.toUpperCase() + .endsWith("EXPRSP")); + this.iIsRequest = (pMethod.toUpperCase().endsWith("REQ")); + this.iIsSimple = pMethod.toUpperCase().startsWith("SIMPLE"); + } + + /** + * setCIMVersion + * + * @param pCimVersion + */ + public void setCIMVersion(String pCimVersion) { + this.iCimVersion = pCimVersion; + } + + /** + * setDTDVersion + * + * @param pDtdVersion + */ + public void setDTDVersion(String pDtdVersion) { + this.iDtdVersion = pDtdVersion; + } + + /** + * setIsRequest + * + * @param pValue + */ + public void setIsRequest(boolean pValue) { + this.iIsRequest = pValue; + } + + /** + * getId + * + * @return String + */ + public String getId() { + return this.iId; + } + + /** + * getProtocolVersion + * + * @return String + */ + public String getProtocolVersion() { + return this.iProtocolVersion; + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/CIMRequest.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/CIMRequest.java similarity index 75% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/CIMRequest.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/CIMRequest.java index d7af6b1..a87d204 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/CIMRequest.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/CIMRequest.java @@ -1,168 +1,166 @@ -/* - CIMRequest.java - - (C) Copyright IBM Corp. 2005, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1535756 2006-08-07 lupusalex Make code warning free - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.Vector; - -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; - -/** - * Class CIMRequest is used by the CIM-XML DOM parser. - * - */ -public class CIMRequest extends CIMMessage { - - protected Vector iRequests = new Vector(0); - - protected Vector iParamValue = new Vector(0); - - protected String iMethodName; - - protected CIMObjectPath iPath; - - protected String iNamespace; - - /** - * Ctor. - */ - public CIMRequest() { /**/} - - /** - * Ctor. - * - * @param pCimVersion - * @param pDtdVersion - * @param pId - * @param pMethod - */ - public CIMRequest(String pCimVersion, String pDtdVersion, String pId, String pMethod) { - super(pCimVersion, pDtdVersion, pId, pMethod); - } - - /** - * addParamValue - * - * @param v - */ - public void addParamValue(Object v) { - if (v instanceof Vector) this.iParamValue.addAll((Vector) v); - else this.iParamValue.add(v); - } - - /** - * addRequest - * - * @param request - */ - public void addRequest(CIMRequest request) { - this.iRequests.add(request); - } - - /** - * getMethodName - * - * @return String - */ - public String getMethodName() { - return this.iMethodName; - } - - /** - * getNameSpace - * - * @return String - */ - public String getNameSpace() { - return this.iNamespace; - } - - /** - * getObjectPath - * - * @return String - */ - public CIMObjectPath getObjectPath() { - return this.iPath; - } - - /** - * getParamValue - * - * @return String - */ - public Vector getParamValue() { - return this.iParamValue; - } - - /** - * setMethodName - * - * @param methodName - */ - public void setMethodName(String methodName) { - this.iMethodName = methodName; - } - - /** - * setNameSpace - * - * @param namespace - */ - public void setNameSpace(String namespace) { - this.iNamespace = namespace; - } - - /** - * setObjectPath - * - * @param path - */ - public void setObjectPath(CIMObjectPath path) { - this.iPath = path; - } -} +/* + CIMRequest.java + + (C) Copyright IBM Corp. 2005, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1535756 2006-08-07 lupusalex Make code warning free + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.Vector; + +import org.metricshub.wbem.javax.cim.CIMObjectPath; + +/** + * Class CIMRequest is used by the CIM-XML DOM parser. + * + */ +public class CIMRequest extends CIMMessage { + + protected Vector iRequests = new Vector(0); + + protected Vector iParamValue = new Vector(0); + + protected String iMethodName; + + protected CIMObjectPath iPath; + + protected String iNamespace; + + /** + * Ctor. + */ + public CIMRequest() { /**/} + + /** + * Ctor. + * + * @param pCimVersion + * @param pDtdVersion + * @param pId + * @param pMethod + */ + public CIMRequest(String pCimVersion, String pDtdVersion, String pId, String pMethod) { + super(pCimVersion, pDtdVersion, pId, pMethod); + } + + /** + * addParamValue + * + * @param v + */ + public void addParamValue(Object v) { + if (v instanceof Vector) this.iParamValue.addAll((Vector) v); + else this.iParamValue.add(v); + } + + /** + * addRequest + * + * @param request + */ + public void addRequest(CIMRequest request) { + this.iRequests.add(request); + } + + /** + * getMethodName + * + * @return String + */ + public String getMethodName() { + return this.iMethodName; + } + + /** + * getNameSpace + * + * @return String + */ + public String getNameSpace() { + return this.iNamespace; + } + + /** + * getObjectPath + * + * @return String + */ + public CIMObjectPath getObjectPath() { + return this.iPath; + } + + /** + * getParamValue + * + * @return String + */ + public Vector getParamValue() { + return this.iParamValue; + } + + /** + * setMethodName + * + * @param methodName + */ + public void setMethodName(String methodName) { + this.iMethodName = methodName; + } + + /** + * setNameSpace + * + * @param namespace + */ + public void setNameSpace(String namespace) { + this.iNamespace = namespace; + } + + /** + * setObjectPath + * + * @param path + */ + public void setObjectPath(CIMObjectPath path) { + this.iPath = path; + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/CIMResponse.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/CIMResponse.java similarity index 80% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/CIMResponse.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/CIMResponse.java index 154a94b..22cab16 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/CIMResponse.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/CIMResponse.java @@ -1,229 +1,227 @@ -/* - CIMResponse.java - - (C) Copyright IBM Corp. 2005, 2012 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1535756 2006-08-07 lupusalex Make code warning free - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors - * 3525135 2012-05-09 blaschke-oss Remove CIMResponse.isSuccessul - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.List; -import java.util.Vector; - -import org.sentrysoftware.wbem.javax.wbem.WBEMException; - -/** - * Represent a CIMReponse message. - */ -public class CIMResponse extends CIMMessage { - - protected Vector iResponses = new Vector(0); - - protected WBEMException iError = null; - - protected Vector iReturnValue = new Vector(); - - protected Vector iParamValue = new Vector(0); - - /** - * Constructs a CIMResponse object. - * - */ - public CIMResponse() { /**/} - - /** - * Constructs a CIMResponse object with the specified CIMVersion, DTDVersion - * and method. - * - * @param pCimVersion - * @param pDtdVersion - * @param pId - * @param pMethod - */ - public CIMResponse(String pCimVersion, String pDtdVersion, String pId, String pMethod) { - super(pCimVersion, pDtdVersion, pId, pMethod); - } - - /** - * Constructs a CIM Response message from a given CIM Request. - * - * @param request - */ - public CIMResponse(CIMRequest request) { - super(); - this.iCimVersion = request.getCIMVersion(); - this.iDtdVersion = request.getDTDVersion(); - } - - /** - * addParamValue - * - * @param o - */ - public void addParamValue(Object o) { - this.iParamValue.add(o); - } - - /** - * addParamValue - * - * @param v - */ - public void addParamValue(Vector v) { - this.iParamValue.addAll(v); - } - - /** - * addResponse - * - * @param response - */ - public void addResponse(CIMResponse response) { - this.iResponses.add(response); - } - - /** - * addReturnValue - * - * @param o - */ - public void addReturnValue(Object o) { - this.iReturnValue.add(o); - } - - /** - * Verify the status code for this CIMResponse. - * - * @throws WBEMException - * if the status code is other than success. - */ - public void checkError() throws WBEMException { - if (this.iError != null) throw this.iError; - } - - /** - * getAllResponses - * - * @return List - */ - public List getAllResponses() { - return this.iResponses; - } - - /** - * getException - * - * @return WBEMException - */ - public WBEMException getException() { - return this.iError; - } - - /** - * isSuccessful - * - * @return boolean - */ - public boolean isSuccessful() { - return this.iError == null; - } - - /** - * getFirstResponse - * - * @return CIMResponse - */ - public CIMResponse getFirstResponse() { - if (this.iResponses != null && this.iResponses.size() > 0) return this.iResponses - .elementAt(0); - return null; - } - - /** - * getParamValues - * - * @return List - */ - public List getParamValues() { - return this.iParamValue; - } - - /** - * getFirstReturnValue - * - * @return List - */ - public List getFirstReturnValue() { - return this.iReturnValue; - } - - /** - * setError - * - * @param error - */ - public void setError(WBEMException error) { - this.iError = error; - } - - /** - * setParamValue - * - * @param paramValue - */ - public void setParamValue(Vector paramValue) { - this.iParamValue = paramValue; - } - - /** - * setReturnValue - * - * @param returnValue - */ - public void setReturnValue(Vector returnValue) { - this.iReturnValue = returnValue; - } - -} +/* + CIMResponse.java + + (C) Copyright IBM Corp. 2005, 2012 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1535756 2006-08-07 lupusalex Make code warning free + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors + * 3525135 2012-05-09 blaschke-oss Remove CIMResponse.isSuccessul + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.List; +import java.util.Vector; + +import org.metricshub.wbem.javax.wbem.WBEMException; + +/** + * Represent a CIMReponse message. + */ +public class CIMResponse extends CIMMessage { + + protected Vector iResponses = new Vector(0); + + protected WBEMException iError = null; + + protected Vector iReturnValue = new Vector(); + + protected Vector iParamValue = new Vector(0); + + /** + * Constructs a CIMResponse object. + * + */ + public CIMResponse() { /**/} + + /** + * Constructs a CIMResponse object with the specified CIMVersion, DTDVersion + * and method. + * + * @param pCimVersion + * @param pDtdVersion + * @param pId + * @param pMethod + */ + public CIMResponse(String pCimVersion, String pDtdVersion, String pId, String pMethod) { + super(pCimVersion, pDtdVersion, pId, pMethod); + } + + /** + * Constructs a CIM Response message from a given CIM Request. + * + * @param request + */ + public CIMResponse(CIMRequest request) { + super(); + this.iCimVersion = request.getCIMVersion(); + this.iDtdVersion = request.getDTDVersion(); + } + + /** + * addParamValue + * + * @param o + */ + public void addParamValue(Object o) { + this.iParamValue.add(o); + } + + /** + * addParamValue + * + * @param v + */ + public void addParamValue(Vector v) { + this.iParamValue.addAll(v); + } + + /** + * addResponse + * + * @param response + */ + public void addResponse(CIMResponse response) { + this.iResponses.add(response); + } + + /** + * addReturnValue + * + * @param o + */ + public void addReturnValue(Object o) { + this.iReturnValue.add(o); + } + + /** + * Verify the status code for this CIMResponse. + * + * @throws WBEMException + * if the status code is other than success. + */ + public void checkError() throws WBEMException { + if (this.iError != null) throw this.iError; + } + + /** + * getAllResponses + * + * @return List + */ + public List getAllResponses() { + return this.iResponses; + } + + /** + * getException + * + * @return WBEMException + */ + public WBEMException getException() { + return this.iError; + } + + /** + * isSuccessful + * + * @return boolean + */ + public boolean isSuccessful() { + return this.iError == null; + } + + /** + * getFirstResponse + * + * @return CIMResponse + */ + public CIMResponse getFirstResponse() { + if (this.iResponses != null && this.iResponses.size() > 0) return this.iResponses + .elementAt(0); + return null; + } + + /** + * getParamValues + * + * @return List + */ + public List getParamValues() { + return this.iParamValue; + } + + /** + * getFirstReturnValue + * + * @return List + */ + public List getFirstReturnValue() { + return this.iReturnValue; + } + + /** + * setError + * + * @param error + */ + public void setError(WBEMException error) { + this.iError = error; + } + + /** + * setParamValue + * + * @param paramValue + */ + public void setParamValue(Vector paramValue) { + this.iParamValue = paramValue; + } + + /** + * setReturnValue + * + * @param returnValue + */ + public void setReturnValue(Vector returnValue) { + this.iReturnValue = returnValue; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/CIMXMLBuilderImpl.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/CIMXMLBuilderImpl.java similarity index 93% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/CIMXMLBuilderImpl.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/CIMXMLBuilderImpl.java index f96fc44..89e1dc7 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/CIMXMLBuilderImpl.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/CIMXMLBuilderImpl.java @@ -1,2300 +1,2299 @@ -/* - CIMXMLBuilderImpl.java - - (C) Copyright IBM Corp. 2005, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------ - * 16627 2005-04-01 thschaef Correct instantiation for Uint64 - * 17459 2005-06-24 thschaef catch null within createMethod method - * 17459 2005-06-27 thschaef further improvement to createMethod() - * 1535756 2006-08-07 lupusalex Make code warning free - * 1610046 2006-07-12 ebak Does not escape trailing spaces KEYVALUE - * 1631407 2007-01-11 lupusalex VALUE.REFERENCE doesn't handle references without namespace - * 1656285 2007-02-12 ebak IndicationHandler does not accept non-Integer message ID - * 1671505 2007-02-28 lupusalex Wrong escaping of spaces in XML (Undo 1610046) - * 1660756 2007-03-02 ebak Embedded object support - * 1689085 2007-04-10 ebak Embedded object enhancements for Pegasus - * 1669961 2006-04-16 lupusalex CIMTypedElement.getType() =>getDataType() - * 1719991 2007-05-16 ebak FVT: regression ClassCastException in EmbObjHandler - * 1737141 2007-06-18 ebak Sync up with JSR48 evolution - * 1820763 2007-10-29 ebak Supporting the EmbeddedInstance qualifier - * 1827728 2007-11-12 ebak embeddedInstances: attribute EmbeddedObject not set - * 1827728 2007-11-20 ebak rework: embeddedInstances: attribute EmbeddedObject not set - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2087969 2008-09-03 blaschke-oss VALUE.ARRAY used in request for array of references - * 2093708 2008-09-10 rgummada HTTP 400 - Bad Request, CIMError: request-not-valid - * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings - * 2210455 2008-10-30 blaschke-oss Enhance javadoc, fix potential null pointers - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors - * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics - * 2823494 2009-08-03 rgummada Change Boolean constructor to static - * 2849970 2009-09-03 blaschke-oss createVALUEARRAY fails to create reference array - * 2912490 2010-01-05 rgummada NullPointerException when invoking getInstance - * 2957387 2010-03-03 blaschke-oss EmbededObject XML attribute must not be all uppercases - * 2970881 2010-03-15 blaschke-oss Add property to control EmbeddedObject case - * 3001333 2010-05-19 blaschke-oss CIMMethod class ignores propagated parameter - * 3304058 2011-05-20 blaschke-oss Use same date format in change history - * 3588558 2012-11-26 blaschke-oss An enhancement on Java CIM Client logging - * 2616 2013-02-23 blaschke-oss Add new API WBEMClientSBLIM.sendIndication() - * 2638 2013-05-09 blaschke-oss Do not build empty REFERENCECLASS - * 2689 2013-10-10 blaschke-oss createMETHODCALL should not add PARAMTYPE attribute - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.sentrysoftware.wbem.javax.cim.CIMArgument; -import org.sentrysoftware.wbem.javax.cim.CIMClass; -import org.sentrysoftware.wbem.javax.cim.CIMClassProperty; -import org.sentrysoftware.wbem.javax.cim.CIMDataType; -import org.sentrysoftware.wbem.javax.cim.CIMFlavor; -import org.sentrysoftware.wbem.javax.cim.CIMInstance; -import org.sentrysoftware.wbem.javax.cim.CIMMethod; -import org.sentrysoftware.wbem.javax.cim.CIMNamedElementInterface; -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; -import org.sentrysoftware.wbem.javax.cim.CIMParameter; -import org.sentrysoftware.wbem.javax.cim.CIMProperty; -import org.sentrysoftware.wbem.javax.cim.CIMQualifiedElementInterface; -import org.sentrysoftware.wbem.javax.cim.CIMQualifier; -import org.sentrysoftware.wbem.javax.cim.CIMQualifierType; -import org.sentrysoftware.wbem.javax.cim.CIMScope; -import org.sentrysoftware.wbem.javax.cim.CIMTypedElement; -import org.sentrysoftware.wbem.javax.cim.CIMValuedElement; -import org.sentrysoftware.wbem.javax.wbem.WBEMException; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cim.CIMQualifiedElementInterfaceImpl; -import org.sentrysoftware.wbem.sblim.cimclient.internal.util.MOF; -import org.sentrysoftware.wbem.sblim.cimclient.internal.util.WBEMConfiguration; -import org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.CIMError; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Text; - -/** - * Class CIMXMLBuilderImpl is the core class for building CIM-XML documents. - */ -public class CIMXMLBuilderImpl { - - private static final int MAJOR_CIM_VERSION = 2; - - private static final int MINOR_CIM_VERSION = 0; - - private static final int MAJOR_DTD_VERSION = 2; - - private static final int MINOR_DTD_VERSION = 0; - - /** - * createCIM - * - * @param pDoc - * @return Element - */ - public static Element createCIM(Document pDoc) { - // - // - Element e = pDoc.createElement("CIM"); - e.setAttribute("CIMVERSION", MAJOR_CIM_VERSION + "." + MINOR_CIM_VERSION); - // required - e.setAttribute("DTDVERSION", MAJOR_DTD_VERSION + "." + MINOR_DTD_VERSION); - // required - pDoc.appendChild(e); // root element - return e; - } - - // //////////////////////////////////////////////////////////////////////////////////////// - // Value Elements - // //////////////////////////////////////////////////////////////////////////////////////// - - /** - * createVALUE - * - * @param pDoc - * @param pParentE - * @return Element - */ - public static Element createVALUE(Document pDoc, Element pParentE) { - // - Element e = pDoc.createElement("VALUE"); - pParentE.appendChild(e); - - return e; - } - - /** - * createVALUE - * - * @param pDoc - * @param pParentE - * @param pValue - * @return Element - */ - public static Element createVALUE(Document pDoc, Element pParentE, String pValue) { - // - Element e = pDoc.createElement("VALUE"); - pParentE.appendChild(e); - - Text textE = pDoc.createTextNode(pValue); - e.appendChild(textE); - return e; - } - - /** - * createVALUE - * - * @param pDoc - * @param pParentE - * @param pValue - * @return Element - */ - public static Element createVALUE(Document pDoc, Element pParentE, boolean pValue) { - return createVALUE(pDoc, pParentE, pValue ? MOF.TRUE : MOF.FALSE); - } - - /** - * createVALUEARRAY - * - * @param pDoc - * @param pParentE - * @return Element - */ - public static Element createVALUEARRAY(Document pDoc, Element pParentE) { - // - Element e = pDoc.createElement("VALUE.ARRAY"); - pParentE.appendChild(e); - return e; - } - - /** - * createVALUEREFERENCE - * - * @param pDoc - * @param pParentE - * @return Element - */ - public static Element createVALUEREFERENCE(Document pDoc, Element pParentE) { - // - Element e = pDoc.createElement("VALUE.REFERENCE"); - pParentE.appendChild(e); - return e; - } - - /** - * createVALUEREFARRAY - * - * @param pDoc - * @param pParentE - * @return Element - */ - public static Element createVALUEREFARRAY(Document pDoc, Element pParentE) { - // - Element e = pDoc.createElement("VALUE.REFARRAY"); - pParentE.appendChild(e); - return e; - } - - // //////////////////////////////////////////////////////////////////////////////////////// - // Properties elements - // //////////////////////////////////////////////////////////////////////////////////////// - /** - * createPROPERTY - * - * @param pDoc - * @param pParentE - * @param pName - * @param pType - * @return Element - */ - public static Element createPROPERTY(Document pDoc, Element pParentE, String pName, String pType) { - // - // - - Element e = pDoc.createElement("PROPERTY"); - if (pName != null) e.setAttribute("NAME", pName); - if (pType != null) e.setAttribute("TYPE", pType); - // TODO: ClassOrigin, Propagated - pParentE.appendChild(e); - return e; - } - - /** - * createPROPERTYARRAY - * - * @param pDoc - * @param pParentE - * @param pName - * @param pType - * @return Element - */ - public static Element createPROPERTYARRAY(Document pDoc, Element pParentE, String pName, - String pType) { - // - // - - Element e = pDoc.createElement("PROPERTY.ARRAY"); - if (pName != null) e.setAttribute("NAME", pName); - if (pType != null) e.setAttribute("TYPE", pType); - // TODO: ClassOrigin, Propagated - pParentE.appendChild(e); - return e; - } - - /** - * createPROPERTYREFERENCE - * - * @param pDoc - * @param pParentE - * @param pName - * @param pReferenceclass - * @return Element - */ - public static Element createPROPERTYREFERENCE(Document pDoc, Element pParentE, String pName, - String pReferenceclass) { - // - // - - Element e = pDoc.createElement("PROPERTY.REFERENCE"); - if (pName != null) e.setAttribute("NAME", pName); - if (pReferenceclass != null && pReferenceclass.length() > 0) e.setAttribute( - "REFERENCECLASS", pReferenceclass); - pParentE.appendChild(e); - return e; - } - - // //////////////////////////////////////////////////////////////////////////////////////// - // Naming and Location elements - // //////////////////////////////////////////////////////////////////////////////////////// - - /** - * createNAMESPACE - * - * @param pDoc - * @param pParentE - * @param pName - * @return Element - */ - public static Element createNAMESPACE(Document pDoc, Element pParentE, String pName) { - // - // - Element e = pDoc.createElement("NAMESPACE"); - if (pName != null) { - e.setAttribute("NAME", pName); - } - pParentE.appendChild(e); - return e; - } - - /** - * createLOCALINSTANCEPATH - * - * @param pDoc - * @param pParentE - * @return Element - */ - public static Element createLOCALINSTANCEPATH(Document pDoc, Element pParentE) { - // - Element e = pDoc.createElement("LOCALINSTANCEPATH"); - pParentE.appendChild(e); - return e; - } - - /** - * createCLASSNAME - * - * @param pDoc - * @param pParentE - * @param pName - * @return Element - */ - public static Element createCLASSNAME(Document pDoc, Element pParentE, String pName) { - // - // - Element e = pDoc.createElement("CLASSNAME"); - if (pName != null) { - e.setAttribute("NAME", pName); - - pParentE.appendChild(e); - } - return e; - } - - /** - * createCLASS - * - * @param pDoc - * @param pParentE - * @param pName - * @param pSuperClass - * @return Element - */ - public static Element createCLASS(Document pDoc, Element pParentE, String pName, - String pSuperClass) { - // - // - Element e = pDoc.createElement("CLASS"); - if (pName != null) { - e.setAttribute("NAME", pName); - - } - if (pSuperClass != null && pSuperClass.length() > 0) { - e.setAttribute("SUPERCLASS", pSuperClass); - - } - if (pParentE != null) pParentE.appendChild(e); - return e; - } - - /** - * createINSTANCENAME - * - * @param pDoc - * @param pParentE - * @param pClassName - * @return Element - */ - public static Element createINSTANCENAME(Document pDoc, Element pParentE, String pClassName) { - // - // - Element e = pDoc.createElement("INSTANCENAME"); - if (pClassName != null) { - e.setAttribute("CLASSNAME", pClassName); - } - pParentE.appendChild(e); - return e; - } - - /** - * createKEYBINDING - * - * @param pDoc - * @param pParentE - * @param pName - * @return Element - */ - public static Element createKEYBINDING(Document pDoc, Element pParentE, String pName) { - // - // - Element e = pDoc.createElement("KEYBINDING"); - if (pName != null) { - e.setAttribute("NAME", pName); - } - pParentE.appendChild(e); - return e; - } - - private static final Pattern NUM_PAT = Pattern.compile("^[su]int(8|16|32|64)$", - Pattern.CASE_INSENSITIVE); - - /** - * - * getValueTypeStr - * - * @param pTypeStr - * @return String - */ - private static String getValueTypeStr(String pTypeStr) { - - if (pTypeStr == null || MOF.DT_STR.equalsIgnoreCase(pTypeStr)) return MOF.DT_STR; - if (MOF.DT_BOOL.equalsIgnoreCase(pTypeStr)) return MOF.DT_BOOL; - Matcher m = NUM_PAT.matcher(pTypeStr); - if (m.matches()) return "numeric"; - return MOF.DT_STR; - } - - /** - * createKEYVALUE - * - * @param pDoc - * @param pParentE - * @param pValueType - * @param pValue - * @return KEYVALUE - */ - public static Element createKEYVALUE(Document pDoc, Element pParentE, String pValueType, - String pValue) { - /* - * - */ - if (pValueType == null) pValueType = "string"; - Element e = pDoc.createElement("KEYVALUE"); - // FIXME: ebak: TYPE attrib is more exact, easier to handle - e.setAttribute("TYPE", pValueType); - // ebak: maybe old CIMOMs won't understand the TYPE attrib - e.setAttribute("VALUETYPE", getValueTypeStr(pValueType)); - pParentE.appendChild(e); - Text valueE = pDoc.createTextNode(pValue); - e.appendChild(valueE); - return e; - } - - // //////////////////////////////////////////////////////////////////////////////////////// - // Object Definition Elements - // //////////////////////////////////////////////////////////////////////////////////////// - - /** - * createINSTANCE - * - * @param pDoc - * @param pParentE - * @param pClassName - * @return Element - */ - public static Element createINSTANCE(Document pDoc, Element pParentE, String pClassName) { - // - // - - Element e = pDoc.createElement("INSTANCE"); - if (pClassName != null) { - e.setAttribute("CLASSNAME", pClassName); - } - if (pParentE != null) pParentE.appendChild(e); - return e; - } - - /** - * createQUALIFIER - * - * @param pDoc - * @param pParentE - * @param pName - * @param pType - * @return Element - */ - public static Element createQUALIFIER(Document pDoc, Element pParentE, String pName, - String pType) { - // - // - - Element e = pDoc.createElement("QUALIFIER"); - if (pName != null) { - e.setAttribute("NAME", pName); - // TODO: add additional attributes "propagated", "qualifierFlavod" - } - if (pType != null) e.setAttribute("TYPE", pType); - pParentE.appendChild(e); - return e; - } - - // /////////////////////////////////////////////////////////////////////////////////////////// - // Message Elements - // /////////////////////////////////////////////////////////////////////////////////////////// - - /** - * createMESSAGE - * - * @param pDoc - * @param pParentE - * @param pId - * @param pProtocolVersion - * @return Element - */ - public static Element createMESSAGE(Document pDoc, Element pParentE, String pId, - String pProtocolVersion) { - // - // - Element e = pDoc.createElement("MESSAGE"); - e.setAttribute("ID", pId); // required - e.setAttribute("PROTOCOLVERSION", pProtocolVersion); // required - pParentE.appendChild(e); - return e; - } - - /** - * createSIMPLEREQ - * - * @param pDoc - * @param pParentE - * @return Element - */ - public static Element createSIMPLEREQ(Document pDoc, Element pParentE) { - // - Element e = pDoc.createElement("SIMPLEREQ"); - pParentE.appendChild(e); - return e; - } - - /** - * createSIMPLEREQ - * - * @param pDoc - * @return Element - */ - public static Element createSIMPLEREQ(Document pDoc) { - // - Element e = pDoc.createElement("SIMPLEREQ"); - return e; - } - - /** - * createMULTIREQ - * - * @param pDoc - * @return Element - */ - public static Element createMULTIREQ(Document pDoc) { - // - Element e = pDoc.createElement("MULTIREQ"); - return e; - } - - /** - * createMETHODCALL - * - * @param pDoc - * @param pParentE - * @param pName - * @return Element - */ - public static Element createMETHODCALL(Document pDoc, Element pParentE, String pName) { - // - // - Element e = pDoc.createElement("METHODCALL"); - if (pName != null) { - e.setAttribute("NAME", pName); - } - pParentE.appendChild(e); - return e; - } - - /** - * createPARAMVALUE - * - * @param pDoc - * @param pParentE - * @param pArg - * @return Element - * @throws WBEMException - */ - public static Element createPARAMVALUE(Document pDoc, Element pParentE, CIMArgument pArg) - throws WBEMException { - // ) - // - if (pArg == null) return null; - Element e = pDoc.createElement("PARAMVALUE"); - EmbObjBuilder embObjBuilder = new EmbObjBuilder(pDoc, pArg); - if (pArg.getName() != null) { - e.setAttribute("NAME", pArg.getName()); - } - e.setAttribute("PARAMTYPE", embObjBuilder.getTypeStr()); - embObjBuilder.addSign(e); - embObjBuilder.addValue(e); - pParentE.appendChild(e); - return e; - } - - /** - * createSIMPLERSP - * - * @param pDoc - * @param pParentE - * @return Element - */ - public static Element createSIMPLERSP(Document pDoc, Element pParentE) { - // - Element e = pDoc.createElement("SIMPLERSP"); - - if (pParentE != null) pParentE.appendChild(e); - return e; - } - - /** - * createSIMPLEEXPRSP - * - * @param pDoc - * @param pParentE - * @return Element - */ - public static Element createSIMPLEEXPRSP(Document pDoc, Element pParentE) { - // - Element e = pDoc.createElement("SIMPLEEXPRSP"); - - pParentE.appendChild(e); - return e; - } - - /** - * createMETHODRESPONSE - * - * @param pDoc - * @param pParentE - * @param pName - * @return Element - */ - public static Element createMETHODRESPONSE(Document pDoc, Element pParentE, String pName) { - // - // - - // %CIMName;> - Element e = pDoc.createElement("METHODRESPONSE"); - if (pName != null) { - e.setAttribute("NAME", pName); - } - pParentE.appendChild(e); - return e; - } - - /** - * createIMETHODRESPONSE - * - * @param pDoc - * @param pParentE - * @param pName - * @return Element - */ - public static Element createIMETHODRESPONSE(Document pDoc, Element pParentE, String pName) { - // - // - // %CIMName;> - Element e = pDoc.createElement("IMETHODRESPONSE"); - if (pName != null) { - e.setAttribute("NAME", pName); - } - pParentE.appendChild(e); - return e; - } - - /** - * createEXPMETHODRESPONSE - * - * @param pDoc - * @param pParentE - * @param pName - * @return Element - */ - public static Element createEXPMETHODRESPONSE(Document pDoc, Element pParentE, String pName) { - // - // - Element e = pDoc.createElement("EXPMETHODRESPONSE"); - if (pName != null) { - e.setAttribute("NAME", pName); - } - pParentE.appendChild(e); - return e; - } - - /** - * createIRETURNVALUE - * - * @param pDoc - * @param pParentE - * @return Element - */ - public static Element createIRETURNVALUE(Document pDoc, Element pParentE) { - // - Element e = pDoc.createElement("IRETURNVALUE"); - pParentE.appendChild(e); - return e; - } - - /** - *
      -	 * !ELEMENT RETURNVALUE (VALUE | VALUE.REFERENCE)
      -	 * !ATTLIST RETURNVALUE
      -	 * %ParamType;       #IMPLIED
      -	 * 
      - * - * createRETURNVALUE - * - * @param pDoc - * @param pParentE - * @param pValue - * @return Element - * @throws WBEMException - */ - public static Element createRETURNVALUE(Document pDoc, Element pParentE, Object pValue) - throws WBEMException { - Element retValE = pDoc.createElement("RETURNVALUE"); - CIMDataType type = CIMDataType.getDataType(pValue); - retValE.setAttribute("PARAMTYPE", getTypeStr(type)); - createVALUE(pDoc, retValE, pValue); - pParentE.appendChild(retValE); - return retValE; - } - - /** - * createIMETHODCALL - * - * @param pDoc - * @param pParentE - * @param pName - * @return Element - */ - public static Element createIMETHODCALL(Document pDoc, Element pParentE, String pName) { - // - // - Element e = pDoc.createElement("IMETHODCALL"); - if (pName != null) { - e.setAttribute("NAME", pName); - } - pParentE.appendChild(e); - return e; - } - - /** - * createIPARAMVALUE - * - * @param pDoc - * @param pParentE - * @param pName - * @return Element - */ - public static Element createIPARAMVALUE(Document pDoc, Element pParentE, String pName) { - // ) - // - Element e = pDoc.createElement("IPARAMVALUE"); - if (pName != null) { - e.setAttribute("NAME", pName); - } - pParentE.appendChild(e); - return e; - } - - /** - * createERROR - * - * @param doc - * @param parentE - * @param error - * @return Element - */ - public static Element createERROR(Document doc, Element parentE, CIMError error) { - // - // - Element e = doc.createElement("ERROR"); - int code; - if ((code = error.getCode()) > 0) { - e.setAttribute("CODE", Integer.toString(code)); - } - String description = error.getDescription(); - if (description != null) { - e.setAttribute("DESCRIPTION", description); - } - - parentE.appendChild(e); - return e; - } - - /** - * ENTITY % QualifierFlavor "OVERRIDABLE (true|false) 'true' TOSUBCLASS - * (true|false) 'true' TOINSTANCE (true|false) 'false' TRANSLATABLE - * (true|false) 'false'" - * - * @param pElement - * @param pFlavors - */ - private static void setFlavors(Element pElement, int pFlavors) { - if ((pFlavors & CIMFlavor.TRANSLATE) > 0) { - pElement.setAttribute("TRANSLATABLE", MOF.TRUE); - } - if ((pFlavors & CIMFlavor.DISABLEOVERRIDE) > 0) { - pElement.setAttribute("OVERRIDABLE", MOF.FALSE); - } - if ((pFlavors & CIMFlavor.RESTRICTED) > 0) { - pElement.setAttribute("TOSUBCLASS", MOF.FALSE); - } - /* - * if ((pFlavors & CIMFlavor.RESTRICTED)>0) { - * pElement.setAttribute("TOSUBCLASS", "true"); } - */ - } - - /** - * createQUALIFIER_DECLARATION - * - * @param pDoc - * @param pParentE - * @param pQualifierType - * @return Element - * @throws WBEMException - */ - public static Element createQUALIFIER_DECLARATION(Document pDoc, Element pParentE, - CIMQualifierType pQualifierType) throws WBEMException { - // - // - - String pValueTypeStr = getTypeStr(pQualifierType.getDataType()); - Element qualifierdeclarationE = pDoc.createElement("QUALIFIER.DECLARATION"); - qualifierdeclarationE.setAttribute("NAME", pQualifierType.getName()); - qualifierdeclarationE.setAttribute("TYPE", pValueTypeStr); - qualifierdeclarationE.setAttribute("ISARRAY", - pQualifierType.getDataType().isArray() ? MOF.TRUE : MOF.FALSE); - - setFlavors(qualifierdeclarationE, pQualifierType.getFlavor()); - - int scopes = pQualifierType.getScope(); - if (scopes > 0) { - Element scopeE = pDoc.createElement("SCOPE"); - if ((scopes & CIMScope.CLASS) > 0) scopeE.setAttribute("CLASS", MOF.TRUE); - if ((scopes & CIMScope.ASSOCIATION) > 0) scopeE.setAttribute("ASSOCIATION", MOF.TRUE); - if ((scopes & CIMScope.REFERENCE) > 0) scopeE.setAttribute("REFERENCE", MOF.TRUE); - if ((scopes & CIMScope.PROPERTY) > 0) scopeE.setAttribute("PROPERTY", MOF.TRUE); - if ((scopes & CIMScope.METHOD) > 0) scopeE.setAttribute("METHOD", MOF.TRUE); - if ((scopes & CIMScope.PARAMETER) > 0) scopeE.setAttribute("PARAMETER", MOF.TRUE); - if ((scopes & CIMScope.INDICATION) > 0) scopeE.setAttribute("INDICATION", MOF.TRUE); - qualifierdeclarationE.appendChild(scopeE); - } - - createVALUE(pDoc, qualifierdeclarationE, pQualifierType.getValue()); - - pParentE.appendChild(qualifierdeclarationE); - return qualifierdeclarationE; - } - - /** - * createQUALIFIER - * - * @param pDoc - * @param pParentE - * @param pQualifier - * @return Element - * @throws WBEMException - */ - public static Element createQUALIFIER(Document pDoc, Element pParentE, - CIMQualifier pQualifier) throws WBEMException { - // - // - - Object value = pQualifier.getValue(); - if (value == null) return null; - - Element qualifierE = createQUALIFIER(pDoc, pParentE, pQualifier.getName(), - getTypeStr(pQualifier.getDataType())); - - if (pQualifier.isPropagated()) { - qualifierE.setAttribute("PROPAGATED", "true"); - } - setFlavors(qualifierE, pQualifier.getFlavor()); - - createVALUE(pDoc, qualifierE, value); - - pParentE.appendChild(qualifierE); - return qualifierE; - } - - /** - * createQUALIFIERS - * - * @param pDoc - * @param pParentE - * @param pQualifiersA - * @throws WBEMException - */ - public static void createQUALIFIERS(Document pDoc, Element pParentE, - CIMQualifier[] pQualifiersA) throws WBEMException { - if (pQualifiersA == null) return; - for (int i = 0; i < pQualifiersA.length; i++) { - createQUALIFIER(pDoc, pParentE, pQualifiersA[i]); - } - } - - /** - * createPROPERTIES - * - * @param pDoc - * @param pParentE - * @param pProperties - * @throws WBEMException - */ - public static void createPROPERTIES(Document pDoc, Element pParentE, - CIMProperty[] pProperties) throws WBEMException { - if (pProperties == null) return; - for (int i = 0; i < pProperties.length; i++) { - createPROPERTY(pDoc, pParentE, pProperties[i]); - } - } - - private static final CIMQualifiedElementInterfaceImpl KEYQUALIFIERS_IMPL = new CIMQualifiedElementInterfaceImpl( - null, true); - - static final CIMQualifier EMB_OBJ_QUALI = new CIMQualifier("EmbeddedObject", - CIMDataType.BOOLEAN_T, Boolean.TRUE, CIMFlavor.DISABLEOVERRIDE); - - // ebak: embedded object: CLASS_T or INSTANCE_T? - - /** - * isCIMObject - * - * @param typeCode - * @return boolean - */ - public static boolean isCIMObject(int typeCode) { - return typeCode == CIMDataType.CLASS || typeCode == CIMDataType.OBJECT; - } - - /** - * isCIMObject - * - * @param pType - * @return boolean - */ - public static boolean isCIMObject(CIMDataType pType) { - return pType == null ? false : isCIMObject(pType.getType()); - } - - /** - * getEmbObjTypeStr - * - * @param pType - * @return String - */ - public static String getEmbObjTypeStr(CIMDataType pType) { - return isCIMObject(pType) ? MOF.DT_STR : getTypeStr(pType); - } - - private static Document getDoc() { - try { - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - DocumentBuilder docBuilder = factory.newDocumentBuilder(); - return docBuilder.newDocument(); - } catch (ParserConfigurationException e) { - throw new RuntimeException(e); - } - } - - /** - * cimObjectToXMLString - for embedded object support - * - * @param pObj - * @return String - * @throws WBEMException - */ - public static String cimObjectToXMLString(Object pObj) throws WBEMException { - if (pObj == null) return null; - Document doc; - Element e; - if (pObj instanceof CIMClass) { - doc = getDoc(); - e = createCLASS(doc, null, (CIMClass) pObj); - } else if (pObj instanceof CIMInstance) { - doc = getDoc(); - e = createINSTANCE(doc, null, (CIMInstance) pObj); - } else { - throw new WBEMException(WBEMException.CIM_ERR_FAILED, pObj.getClass().getName() - + " parameter is not suitable for this method!"); - } - doc.appendChild(e); - ByteArrayOutputStream os = new ByteArrayOutputStream(); - try { - CimXmlSerializer.serialize(os, doc.getDocumentElement(), false); - } catch (IOException ex) { - throw new WBEMException(WBEMException.CIM_ERR_FAILED, - "XML serialization failed with IOException!", null, ex); - } - return os.toString(); - } - - /** - * cimObjectArrayToXMLString - for embedded object support - * - * @param pObj - * @return String[] - * @throws WBEMException - */ - public static String[] cimObjectArrayToXMLString(Object pObj) throws WBEMException { - if (pObj == null) return null; - if (!(pObj instanceof Object[])) throw new WBEMException(WBEMException.CIM_ERR_FAILED, - "Object[] parameter is required for this method!"); - Object[] objA = (Object[]) pObj; - String[] strA = new String[objA.length]; - // here we don't deal with the consistency check of the Object[] - for (int i = 0; i < objA.length; i++) - strA[i] = cimObjectToXMLString(objA[i]); - return strA; - } - - static boolean embObjQualified(CIMQualifiedElementInterface pQualid) { - return pQualid.hasQualifier("EmbeddedObject") || pQualid.hasQualifier("EmbeddedInstance"); - } - - static class EmbObjBuilder { - - private static final int ATTRIB_ONLY = 0, EO_QUALI = 1, EO_AND_EI_QUALI = 2; - - private int iSignMethod; - - private Document iDoc; - - private CIMTypedElement iTypedE; - - private boolean iXMLQualified; - - private static final boolean iUpperCaseEmbObjEntities = WBEMConfiguration - .getGlobalConfiguration().upperCaseEmbObjEntities(); - - /** - * Ctor. - * - * @param pDoc - * @param pTypedE - */ - public EmbObjBuilder(Document pDoc, CIMTypedElement pTypedE) { - this(pDoc, pTypedE, false); - } - - /** - * Ctor. - * - * @param pDoc - * @param pTypedE - * @param pXMLQualified - * - e.g. CIMProperty is not qualified in JSR48, but - * qualified in CIM-XML - */ - public EmbObjBuilder(Document pDoc, CIMTypedElement pTypedE, boolean pXMLQualified) { - this.iDoc = pDoc; - this.iTypedE = pTypedE; - this.iXMLQualified = pXMLQualified; - String builderCfg = WBEMConfiguration.getGlobalConfiguration().getCimXmlEmbObjBuilder(); - if ("EmbObjQuali".equalsIgnoreCase(builderCfg)) { - this.iSignMethod = EO_QUALI; - } else if ("EmbObjAndEmbInstQuali".equalsIgnoreCase(builderCfg)) { - this.iSignMethod = EO_AND_EI_QUALI; - } else { - this.iSignMethod = ATTRIB_ONLY; - } - } - - /** - * getTypeStr - * - * @return String - */ - public String getTypeStr() { - return getEmbObjTypeStr(this.iTypedE.getDataType()); - } - - /** - * isArray - * - * @return String - */ - public boolean isArray() { - return this.iTypedE.getDataType().isArray(); - } - - private Object getValue() { - if (!(this.iTypedE instanceof CIMValuedElement)) return null; - return ((CIMValuedElement) this.iTypedE).getValue(); - - } - - /** - * addSign - * - * @param pElement - * @throws WBEMException - */ - public void addSign(Element pElement) throws WBEMException { - if (!isCIMObject(this.iTypedE.getDataType())) return; - CIMQualifiedElementInterface qualified; - if (this.iTypedE instanceof CIMQualifiedElementInterface) { - qualified = (CIMQualifiedElementInterface) this.iTypedE; - if (embObjQualified(qualified)) return; - } else { - qualified = null; - } - if (this.iSignMethod == ATTRIB_ONLY || (qualified == null && !this.iXMLQualified)) { - pElement.setAttribute(iUpperCaseEmbObjEntities ? "EMBEDDEDOBJECT" - : "EmbeddedObject", - this.iTypedE.getDataType().getType() == CIMDataType.OBJECT ? "instance" - : "object"); - } else { - if (this.iSignMethod == EO_AND_EI_QUALI) { - addEmbObjOrEmbInstQuali(pElement); - } else { // EO_QUALI - createQUALIFIER(this.iDoc, pElement, EMB_OBJ_QUALI); - } - } - } - - private void addEmbObjOrEmbInstQuali(Element pElement) throws WBEMException { - CIMQualifier signQuali; - if (this.iTypedE.getDataType().getType() == CIMDataType.OBJECT) { - CIMInstance inst; - if (isArray()) { - CIMInstance[] instA = (CIMInstance[]) getValue(); - inst = instA == null ? null : instA[0]; - } else { - inst = (CIMInstance) getValue(); - } - String className = inst == null ? "" : inst.getClassName(); - signQuali = new CIMQualifier("EmbeddedInstance", CIMDataType.STRING_T, - className, CIMFlavor.DISABLEOVERRIDE); - } else { // class - signQuali = EMB_OBJ_QUALI; - } - createQUALIFIER(this.iDoc, pElement, signQuali); - } - - /** - * addValue - * - * @param pElement - * @throws WBEMException - */ - public void addValue(Element pElement) throws WBEMException { - Object value = getValue(); - if (value == null) return; - if (isCIMObject(this.iTypedE.getDataType())) { - if (isArray()) { - value = cimObjectArrayToXMLString(value); - } else { - value = cimObjectToXMLString(value); - } - } - createVALUE(this.iDoc, pElement, value); - } - - } - - /** - * createPROPERTY - * - * @param pDoc - * @param pParentE - * @param pProperty - * @return Element - * @throws WBEMException - */ - public static Element createPROPERTY(Document pDoc, Element pParentE, CIMProperty pProperty) - throws WBEMException { - CIMDataType propType = pProperty.getDataType(); - Element propertyE; - EmbObjBuilder embObjBuilder = new EmbObjBuilder(pDoc, pProperty, true); - String typeStr = embObjBuilder.getTypeStr(); - if (propType.isArray()) { - propertyE = createPROPERTYARRAY(pDoc, pParentE, pProperty.getName(), typeStr); - } else if (propType.getType() == CIMDataType.REFERENCE) { - propertyE = createPROPERTYREFERENCE(pDoc, pParentE, pProperty.getName(), propType - .getRefClassName()); - } else { - propertyE = createPROPERTY(pDoc, pParentE, pProperty.getName(), typeStr); - } - - String classorigin = pProperty.getOriginClass(); - if (classorigin != null && classorigin.length() > 0) propertyE.setAttribute("CLASSORIGIN", - classorigin); - - if (pProperty.isPropagated()) propertyE.setAttribute("PROPAGATED", MOF.TRUE); - // FIXME: here key qualifier should be added if the property is a key - embObjBuilder.addSign(propertyE); - if (pProperty instanceof CIMClassProperty) { - createQUALIFIERS(pDoc, propertyE, ((CIMClassProperty) pProperty).getQualifiers()); - } else { // CIMProperty - if (pProperty.isKey()) createQUALIFIERS(pDoc, propertyE, KEYQUALIFIERS_IMPL - .getQualifiers()); - } - embObjBuilder.addValue(propertyE); - return propertyE; - } - - /** - * createVALUEARRAY - * - * @param pDoc - * @param pParentE - * @param pValA - * @return Element - * @throws WBEMException - */ - public static Element createVALUEARRAY(Document pDoc, Element pParentE, Object[] pValA) - throws WBEMException { - Element valuearrayE = (pValA != null && pValA.length > 0 && (pValA[0] instanceof CIMObjectPath || pValA[0] instanceof CIMInstance)) ? createVALUEREFARRAY( - pDoc, pParentE) - : createVALUEARRAY(pDoc, pParentE); - - if (pValA != null) for (int i = 0; i < pValA.length; i++) { - createVALUE(pDoc, valuearrayE, pValA[i]); - } - pParentE.appendChild(valuearrayE); - return valuearrayE; - } - - /** - * createVALUE - * - * @param pDoc - * @param pParentE - * @param pArgValue - * @return Element - * @throws WBEMException - */ - public static Element createVALUE(Document pDoc, Element pParentE, Object pArgValue) - throws WBEMException { - if (pArgValue == null) return null; - - Element valueE = null; - if (pArgValue instanceof Object[]) { - valueE = createVALUEARRAY(pDoc, pParentE, (Object[]) pArgValue); - } else { - CIMDataType type = CIMDataType.getDataType(pArgValue); - if (type != null && type.getType() == CIMDataType.REFERENCE) { - valueE = createVALUEREFERENCE(pDoc, pParentE); - - CIMObjectPath op = (CIMObjectPath) pArgValue; - CIMProperty[] keys = op.getKeys(); - if (op.getHost() == null || "".equals(op.getHost())) { - if (op.getNamespace() == null || "".equals(op.getNamespace())) { - if (keys.length > 0) { - createINSTANCENAME(pDoc, valueE, op); - } else { - createCLASSNAME(pDoc, valueE, op.getObjectName()); - } - } else { - if (keys.length > 0) { - createLOCALINSTANCEPATH(pDoc, valueE, op); - } else { - createLOCALCLASSPATH(pDoc, valueE, op); - } - } - } else { - if (keys.length > 0) { - createINSTANCEPATH(pDoc, valueE, op); - } else { - createCLASSPATH(pDoc, valueE, op); - } - } - // createOBJECTPATH(doc, valueE, (CIMObjectPath) obj); - } else { - if (pArgValue instanceof CIMInstance) { - valueE = createVALUEREFERENCE(pDoc, pParentE); - CIMObjectPath cop = ((CIMInstance) pArgValue).getObjectPath(); - createINSTANCENAME(pDoc, valueE, cop); - } else if (pArgValue instanceof CIMClass) { - valueE = createVALUE(pDoc, pParentE); - createCLASS(pDoc, valueE, (CIMClass) pArgValue); - } else { - createVALUE(pDoc, pParentE, pArgValue.toString()); - } - } - } - - return valueE; - } - - /** - * createINSTANCE - * - * @param pDoc - * @param pParentE - * @param pInstance - * @return Element - * @throws WBEMException - */ - public static Element createINSTANCE(Document pDoc, Element pParentE, CIMInstance pInstance) - throws WBEMException { - // - // - - String className = pInstance.getObjectPath().getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_FAILED, - "null class name"); - - Element instanceE = createINSTANCE(pDoc, pParentE, className); - - // FIXME: in JSR48 CIMInstance doesn't have qualifiers - // createQUALIFIERS(pDoc, instanceE, pInstance.getQualifiers()); - createPROPERTIES(pDoc, instanceE, pInstance.getProperties()); - - if (pParentE != null) pParentE.appendChild(instanceE); - - return instanceE; - } - - /** - * createOBJECTPATH - * - * @param pDoc - * @param pParentE - * @param pPath - * @return Element - * @throws WBEMException - */ - public static Element createOBJECTPATH(Document pDoc, Element pParentE, CIMObjectPath pPath) - throws WBEMException { - Element objectpathE = pDoc.createElement("OBJECTPATH"); - - CIMProperty[] keys = pPath.getKeys(); - if (keys.length > 0) { - createINSTANCEPATH(pDoc, objectpathE, pPath); - } else { - createCLASSPATH(pDoc, objectpathE, pPath); - } - - pParentE.appendChild(objectpathE); - return objectpathE; - } - - /** - * createOBJECTNAME - * - * @param pDoc - * @param pParentE - * @param pPath - * @return Element - * @throws WBEMException - */ - public static Element createOBJECTNAME(Document pDoc, Element pParentE, CIMObjectPath pPath) - throws WBEMException { - - CIMProperty[] keys = pPath.getKeys(); - if (keys.length > 0) { return createINSTANCENAME(pDoc, pParentE, pPath); } - if (pPath.getObjectName() == null) throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name"); - return createCLASSNAME(pDoc, pParentE, pPath.getObjectName()); - } - - /** - * createLOCALINSTANCEPATH - * - * @param pDoc - * @param pParentE - * @param pPath - * @return Element - * @throws WBEMException - */ - public static Element createLOCALINSTANCEPATH(Document pDoc, Element pParentE, - CIMObjectPath pPath) throws WBEMException { - Element localinstancepathE = pDoc.createElement("LOCALINSTANCEPATH"); - - createLOCALNAMESPACEPATH(pDoc, localinstancepathE, pPath); - createINSTANCENAME(pDoc, localinstancepathE, pPath); - - pParentE.appendChild(localinstancepathE); - return localinstancepathE; - } - - /** - * createLOCALCLASSPATH - * - * @param pDoc - * @param pParentE - * @param pPath - * @return Element - * @throws WBEMException - */ - public static Element createLOCALCLASSPATH(Document pDoc, Element pParentE, CIMObjectPath pPath) - throws WBEMException { - Element localinstancepathE = pDoc.createElement("LOCALCLASSPATH"); - - createLOCALNAMESPACEPATH(pDoc, localinstancepathE, pPath); - - if (pPath.getObjectName() == null) throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name"); - createCLASSNAME(pDoc, localinstancepathE, pPath.getObjectName()); - - pParentE.appendChild(localinstancepathE); - return localinstancepathE; - } - - /** - * createLOCALOBJECTPATH - * - * @param pDoc - * @param pParentE - * @param pPath - * @return Element - * @throws WBEMException - */ - public static Element createLOCALOBJECTPATH(Document pDoc, Element pParentE, CIMObjectPath pPath) - throws WBEMException { - - CIMProperty[] keys = pPath.getKeys(); - if (keys.length > 0) { return createLOCALINSTANCEPATH(pDoc, pParentE, pPath); } - return createLOCALCLASSPATH(pDoc, pParentE, pPath); - } - - /** - * createVALUEREFERENCE - * - * @param pDoc - * @param pParentE - * @param pPath - * @return Element - * @throws WBEMException - */ - public static Element createVALUEREFERENCE(Document pDoc, Element pParentE, CIMObjectPath pPath) - throws WBEMException { - Element objectpathE = pDoc.createElement("VALUE.REFERENCE"); - - String ns = pPath.getNamespace(); - if (pPath.getHost() == null || "".equals(pPath.getHost())) { - if (pPath.getNamespace() == null || "".equals(ns)) { - createINSTANCENAME(pDoc, objectpathE, pPath); - } else { - createLOCALOBJECTPATH(pDoc, objectpathE, pPath); - } - } else { - CIMProperty[] keys = pPath.getKeys(); - if (keys.length > 0) { - createINSTANCEPATH(pDoc, objectpathE, pPath); - } else { - createCLASSPATH(pDoc, objectpathE, pPath); - } - } - - pParentE.appendChild(objectpathE); - return objectpathE; - } - - /** - * createINSTANCENAME - * - * @param doc - * @param parentE - * @param instanceOP - * @return Element - * @throws WBEMException - */ - public static Element createINSTANCENAME(Document doc, Element parentE, CIMObjectPath instanceOP) - throws WBEMException { - - Element instancenameE = doc.createElement("INSTANCENAME"); - String classname = instanceOP.getObjectName(); - if (classname != null) { - instancenameE.setAttribute("CLASSNAME", classname); - } - - CIMProperty[] keysA = instanceOP.getKeys(); - for (int ii = 0; ii < keysA.length; ii++) { - CIMProperty prop = keysA[ii]; - String propName = prop.getName(); - CIMDataType propType = prop.getDataType(); - Object propValue = prop.getValue(); - // if (_pValue == null) TODO what happened when a KeyBinding has a - // null property value? - /* - * ebak: test support for #1666336 EnumInstance has attributes - * filled from others Handling direct KEYVALUE and - * VALUE.REFERENCE children is difficult, KEYBINDING can wrap them - * -> dropping out KEYVALUE? | VALUE.REFERENCE?. - * - * - * - * - non - * reference values can be null - * - * - reference - * value shouldn't be null - */ - if (propType == null) { throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, - "Type of property or key cannot be a null! " + propName + " in ObjectPath " - + instanceOP.toString() + " has null type."); } - - if (propValue == null) { - if (propType.getType() == CIMDataType.REFERENCE) { throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, - "Value of reference cannot be null! " + propName + " in ObjectPath " - + instanceOP.toString() + " has null value."); } - } - - Element keybindingE = createKEYBINDING(doc, instancenameE, propName); - if (propType.getType() == CIMDataType.REFERENCE) { - CIMObjectPath refOP = (CIMObjectPath) propValue; - - createVALUEREFERENCE(doc, keybindingE, refOP); - } else { - String valueStr = propValue == null ? null : propValue.toString(); - String valueTypeStr = getTypeStr(propType); - createKEYVALUE(doc, keybindingE, valueTypeStr, valueStr); - } - } - - parentE.appendChild(instancenameE); - return instancenameE; - } - - /** - * createCLASSPATH - * - * @param pDoc - * @param pParentE - * @param pPath - * @return Element - */ - public static Element createCLASSPATH(Document pDoc, Element pParentE, CIMObjectPath pPath) { - Element classpathE = pDoc.createElement("CLASSPATH"); - - // ebak: NAMESPACEPATH is necessary - createNAMESPACEPATH(pDoc, classpathE, pPath); - createCLASSNAME(pDoc, classpathE, pPath.getObjectName()); - - pParentE.appendChild(classpathE); - return classpathE; - } - - /** - * createPARAMETERS - * - * @param pDoc - * @param pParentE - * @param pParameters - * @throws WBEMException - */ - public static void createPARAMETERS(Document pDoc, Element pParentE, - CIMParameter[] pParameters) throws WBEMException { - if (pParameters == null) return; - for (int i = 0; i < pParameters.length; i++) { - createPARAMETER(pDoc, pParentE, pParameters[i]); - } - } - - /** - * createPARAMETER - * - * @param pDoc - * @param pParentE - * @param pParameter - * @return Element - * @throws WBEMException - */ - public static Element createPARAMETER(Document pDoc, Element pParentE, - CIMParameter pParameter) throws WBEMException { - Element parameterE; - CIMDataType type = pParameter.getDataType(); - int typeCode = type.getType(); - EmbObjBuilder embObjBuilder = new EmbObjBuilder(pDoc, pParameter); - String typeStr = embObjBuilder.getTypeStr(); - if (type.isArray()) { - if (typeCode == CIMDataType.REFERENCE) { - parameterE = pDoc.createElement("PARAMETER.REFARRAY"); - String refclass = type.getRefClassName(); - if (refclass != null && refclass.length() > 0) parameterE.setAttribute( - "REFERENCECLASS", type.getRefClassName()); - } else { - parameterE = pDoc.createElement("PARAMETER.ARRAY"); - parameterE.setAttribute("TYPE", typeStr); - } - } else { - if (typeCode == CIMDataType.REFERENCE) { - parameterE = pDoc.createElement("PARAMETER.REFERENCE"); - String refclass = type.getRefClassName(); - if (refclass != null && refclass.length() > 0) parameterE.setAttribute( - "REFERENCECLASS", type.getRefClassName()); - } else { - parameterE = pDoc.createElement("PARAMETER"); - parameterE.setAttribute("TYPE", typeStr); - } - } - parameterE.setAttribute("NAME", pParameter.getName()); - embObjBuilder.addSign(parameterE); - createQUALIFIERS(pDoc, parameterE, pParameter.getQualifiers()); - - pParentE.appendChild(parameterE); - return parameterE; - } - - /** - * createMETHODS - * - * @param pDoc - * @param pParentE - * @param pMethods - * @param pClassName - * @throws WBEMException - */ - public static void createMETHODS(Document pDoc, Element pParentE, CIMMethod[] pMethods, - String pClassName) throws WBEMException { - for (int i = 0; i < pMethods.length; i++) { - createMETHOD(pDoc, pParentE, pMethods[i], pClassName); - } - } - - /** - * createMETHOD - * - * @param pDoc - * @param pParentE - * @param pMethod - * @param pClassName - * @return Element - * @throws WBEMException - */ - public static Element createMETHOD(Document pDoc, Element pParentE, CIMMethod pMethod, - String pClassName) throws WBEMException { - Element methodE = pDoc.createElement("METHOD"); - - methodE.setAttribute("NAME", pMethod.getName()); - EmbObjBuilder embObjBuilder = new EmbObjBuilder(pDoc, pMethod); - String typeStr = embObjBuilder.getTypeStr(); - methodE.setAttribute("TYPE", typeStr); - String classorigin = pMethod.getOriginClass(); - - if (classorigin != null && classorigin.length() != 0) methodE.setAttribute("CLASSORIGIN", - classorigin); - - // 17459 - if (pMethod.isPropagated()) { - methodE.setAttribute("PROPAGATED", MOF.TRUE); - } else { - methodE.setAttribute("PROPAGATED", MOF.FALSE); - } - // ebak: embedded object support - embObjBuilder.addSign(methodE); - - createQUALIFIERS(pDoc, methodE, pMethod.getQualifiers()); - createPARAMETERS(pDoc, methodE, pMethod.getParameters()); - - pParentE.appendChild(methodE); - return methodE; - } - - /* - * private static String elementStr(Element pE) { try { - * ByteArrayOutputStream os = new ByteArrayOutputStream(); - * CimXmlSerializer.serialize(os, pE, true); return new - * String(os.toByteArray()); } catch (RuntimeException e) { throw e; } catch - * (Exception e) { throw new RuntimeException(e); } } - */ - - /** - * createCLASS - * - * @param pDoc - * @param pParentE - * @param pClass - * @return Element - * @throws WBEMException - */ - public static Element createCLASS(Document pDoc, Element pParentE, CIMClass pClass) - throws WBEMException { - - Element classE = createCLASS(pDoc, pParentE, pClass.getName(), pClass.getSuperClassName()); - - createQUALIFIERS(pDoc, classE, pClass.getQualifiers()); - createPROPERTIES(pDoc, classE, pClass.getProperties()); - createMETHODS(pDoc, classE, pClass.getMethods(), pClass.getName()); - - // parentE.appendChild(classE); - return classE; - } - - /** - * createHOST - * - * @param pDoc - * @param pParentE - * @param pHost - * @return Element - */ - public static Element createHOST(Document pDoc, Element pParentE, String pHost) { - Element hostE = pDoc.createElement("HOST"); - - Text hostT = pDoc.createTextNode(pHost); - hostE.appendChild(hostT); - - pParentE.appendChild(hostE); - return hostE; - } - - /** - * createNAMESPACEPATH - * - * @param pDoc - * @param pParentE - * @param pPath - * @return Element - */ - public static Element createNAMESPACEPATH(Document pDoc, Element pParentE, CIMObjectPath pPath) { - Element namespacepathE = pDoc.createElement("NAMESPACEPATH"); - - String host = pPath.getHost(); - if (host == null) { - // try { - // host = InetAddress.getLocalHost().getHostAddress(); - // } catch (Exception e) { - // throw new CIMXMLBuilderException("Error while resolving - // hostname"); - // } - host = "unassigned-hostname"; - } - createHOST(pDoc, namespacepathE, host); - createLOCALNAMESPACEPATH(pDoc, namespacepathE, pPath); - - pParentE.appendChild(namespacepathE); - return namespacepathE; - } - - /** - * createINSTANCEPATH - * - * @param pDoc - * @param pParentE - * @param pPath - * @return Element - * @throws WBEMException - */ - public static Element createINSTANCEPATH(Document pDoc, Element pParentE, CIMObjectPath pPath) - throws WBEMException { - Element instancepathE = pDoc.createElement("INSTANCEPATH"); - - createNAMESPACEPATH(pDoc, instancepathE, pPath); - createINSTANCENAME(pDoc, instancepathE, pPath); - pParentE.appendChild(instancepathE); - return instancepathE; - } - - /** - * createVALUENAMEDINSTANCE - * - * @param pDoc - * @param pParentE - * @param pPath - * @param pInst - * @return Element - * @throws WBEMException - */ - public static Element createVALUENAMEDINSTANCE(Document pDoc, Element pParentE, - CIMObjectPath pPath, CIMInstance pInst) throws WBEMException { - Element valuenamedinstanceE = pDoc.createElement("VALUE.NAMEDINSTANCE"); - createINSTANCENAME(pDoc, valuenamedinstanceE, pPath); - createINSTANCE(pDoc, valuenamedinstanceE, pInst); - - pParentE.appendChild(valuenamedinstanceE); - return valuenamedinstanceE; - } - - /** - * createVALUENAMEDINSTANCE - * - * @param pDoc - * @param pParentE - * @param pInst - * @return Element - * @throws WBEMException - */ - public static Element createVALUENAMEDINSTANCE(Document pDoc, Element pParentE, - CIMInstance pInst) throws WBEMException { - Element valuenamedinstanceE = pDoc.createElement("VALUE.NAMEDINSTANCE"); - createINSTANCENAME(pDoc, valuenamedinstanceE, pInst.getObjectPath()); - createINSTANCE(pDoc, valuenamedinstanceE, pInst); - - pParentE.appendChild(valuenamedinstanceE); - return valuenamedinstanceE; - } - - private static CIMObjectPath changeNameSpace(CIMNamedElementInterface pNamedElement, - String pNameSpace) { - CIMObjectPath path = pNamedElement.getObjectPath(); - return new CIMObjectPath(path.getScheme(), path.getHost(), path.getPort(), pNameSpace, path - .getObjectName(), path.getKeys()); - } - - private static CIMClass changeClassNameSpace(CIMClass pClass, String pNameSpace) { - CIMObjectPath newOp = changeNameSpace(pClass, pNameSpace); - return new CIMClass(newOp, pClass.getSuperClassName(), pClass.getQualifiers(), pClass - .getProperties(), pClass.getMethods(), pClass.isAssociation(), pClass.isKeyed()); - } - - private static CIMInstance changeInstanceNameSpace(CIMInstance pInst, String pNameSpace) { - CIMObjectPath newOp = changeNameSpace(pInst, pNameSpace); - return new CIMInstance(newOp, pInst.getProperties()); - } - - /** - * createVALUEOBJECTWITHPATH - * - * @param pDoc - * @param pParentE - * @param pObj - * @param pNameSpace - * @return Element - * @throws WBEMException - */ - public static Element createVALUEOBJECTWITHPATH(Document pDoc, Element pParentE, Object pObj, - String pNameSpace) throws WBEMException { - Element valueobjectwithpathE = pDoc.createElement("VALUE.OBJECTWITHPATH"); - if (pObj instanceof CIMClass) { - CIMClass clazz = (CIMClass) pObj; - - if (clazz.getObjectPath().getNamespace() == null - || clazz.getObjectPath().getNamespace().length() == 0) { - // ebak: changing the namespace in clazz's objectPath - // clazz.getObjectPath().setNameSpace(pNameSpace); - clazz = changeClassNameSpace(clazz, pNameSpace); - } - - createCLASSPATH(pDoc, valueobjectwithpathE, clazz.getObjectPath()); - createCLASS(pDoc, valueobjectwithpathE, clazz); - } else if (pObj instanceof CIMInstance) { - CIMInstance inst = (CIMInstance) pObj; - if (inst.getObjectPath().getNamespace() == null - || inst.getObjectPath().getNamespace().length() == 0) { - // ebak: changing the namespace ins inst's objectPath - // inst.getObjectPath().setNameSpace(pNameSpace); - inst = changeInstanceNameSpace(inst, pNameSpace); - } - createINSTANCEPATH(pDoc, valueobjectwithpathE, inst.getObjectPath()); - createINSTANCE(pDoc, valueobjectwithpathE, inst); - } - - pParentE.appendChild(valueobjectwithpathE); - return valueobjectwithpathE; - } - - /** - * createVALUEOBJECTWITHLOCALPATH - * - * @param pDoc - * @param pParentE - * @param pObj - * @param pNameSpace - * @return Element - * @throws WBEMException - */ - public static Element createVALUEOBJECTWITHLOCALPATH(Document pDoc, Element pParentE, - Object pObj, String pNameSpace) throws WBEMException { - Element valueobjectwithpathE = pDoc.createElement("VALUE.OBJECTWITHLOCALPATH"); - if (pObj instanceof CIMClass) { - CIMClass clazz = (CIMClass) pObj; - - if (clazz.getObjectPath().getNamespace() == null - || clazz.getObjectPath().getNamespace().length() == 0) { - // ebak: changing clazz's objectPath - // clazz.getObjectPath().setNameSpace(pNameSpace); - clazz = changeClassNameSpace(clazz, pNameSpace); - } - createLOCALCLASSPATH(pDoc, valueobjectwithpathE, clazz.getObjectPath()); - createCLASS(pDoc, valueobjectwithpathE, clazz); - } else if (pObj instanceof CIMInstance) { - CIMInstance inst = (CIMInstance) pObj; - if (inst.getObjectPath().getNamespace() == null - || inst.getObjectPath().getNamespace().length() == 0) { - // inst.getObjectPath().setNameSpace(pNameSpace); - inst = changeInstanceNameSpace(inst, pNameSpace); - } - createLOCALINSTANCEPATH(pDoc, valueobjectwithpathE, inst.getObjectPath()); - createINSTANCE(pDoc, valueobjectwithpathE, inst); - } - - pParentE.appendChild(valueobjectwithpathE); - return valueobjectwithpathE; - } - - /** - * createIRETURNVALUE_ERROR - * - * @param doc - * @param parentE - * @param error - * @return Element - */ - public static Element createIRETURNVALUE_ERROR(Document doc, Element parentE, CIMError error) { - Element ireturnvalueE = doc.createElement("IRETURNVALUE"); - - parentE.appendChild(ireturnvalueE); - return ireturnvalueE; - } - - /** - * createIRETURNVALUE_GETINSTANCE - * - * @param pDoc - * @param pParentE - * @param pInst - * @return Element - * @throws WBEMException - */ - public static Element createIRETURNVALUE_GETINSTANCE(Document pDoc, Element pParentE, - CIMInstance pInst) throws WBEMException { - Element ireturnvalueE = pDoc.createElement("IRETURNVALUE"); - createINSTANCENAME(pDoc, ireturnvalueE, pInst.getObjectPath()); - - return ireturnvalueE; - } - - /** - * createIRETURNVALUE_ASSOCIATORS_NAMES - * - * @param pDoc - * @param pParentE - * @param pResultSet - * @return Element - * @throws Exception - */ - public static Element createIRETURNVALUE_ASSOCIATORS_NAMES(Document pDoc, Element pParentE, - CIMObjectPath[] pResultSet) throws Exception { - Element ireturnvalueE = pDoc.createElement("IRETURNVALUE"); - - if (pResultSet != null) { - for (int i = 0; i < pResultSet.length; i++) { - CIMObjectPath path = pResultSet[i]; - - if (path.getHost() == null || "".equals(path.getHost())) createLOCALOBJECTPATH( - pDoc, ireturnvalueE, path); - else createOBJECTPATH(pDoc, ireturnvalueE, path); - } - } - pParentE.appendChild(ireturnvalueE); - return ireturnvalueE; - } - - /** - * createIRETURNVALUE_ASSOCIATORS - * - * @param pDoc - * @param pParentE - * @param pResultSet - * @param pNameSpace - * @return Element - * @throws Exception - */ - public static Element createIRETURNVALUE_ASSOCIATORS(Document pDoc, Element pParentE, - Object[] pResultSet, String pNameSpace) throws Exception { - Element ireturnvalueE = pDoc.createElement("IRETURNVALUE"); - if (pResultSet != null) { - for (int i = 0; i < pResultSet.length; i++) { - Object obj = pResultSet[i]; - CIMObjectPath op = null; - if (obj instanceof CIMClass) { - op = ((CIMClass) obj).getObjectPath(); - } else if (obj instanceof CIMInstance) { - op = ((CIMInstance) obj).getObjectPath(); - } else { - throw new WBEMException(WBEMException.CIM_ERR_FAILED, - "object in result set neither class nor instance!"); - } - if (op.getHost() == null || "".equals(op.getHost())) { - createVALUEOBJECTWITHLOCALPATH(pDoc, ireturnvalueE, obj, pNameSpace); - } else { - createVALUEOBJECTWITHPATH(pDoc, ireturnvalueE, obj, pNameSpace); - } - } - } - pParentE.appendChild(ireturnvalueE); - return ireturnvalueE; - } - - /** - * createIRETURNVALUE_ENUMERATE_INSTANCENAME - * - * @param pDoc - * @param pParentE - * @param pResultSet - * @param pNameSpace - * @return Element - * @throws Exception - */ - public static Element createIRETURNVALUE_ENUMERATE_INSTANCENAME(Document pDoc, - Element pParentE, Object[] pResultSet, String pNameSpace) throws Exception { - Element ireturnvalueE = pDoc.createElement("IRETURNVALUE"); - if (pResultSet != null) { - for (int i = 0; i < pResultSet.length; i++) { - Object obj = pResultSet[i]; - CIMObjectPath op = null; - if (obj instanceof CIMClass) { - op = ((CIMClass) obj).getObjectPath(); - } else if (obj instanceof CIMInstance) { - op = ((CIMInstance) obj).getObjectPath(); - } else { - throw new WBEMException(WBEMException.CIM_ERR_FAILED, - "object in result set neither class nor instance!"); - } - if (op.getHost() == null || "".equals(op.getHost())) { - createVALUEOBJECTWITHLOCALPATH(pDoc, ireturnvalueE, obj, pNameSpace); - } else { - createVALUEOBJECTWITHPATH(pDoc, ireturnvalueE, obj, pNameSpace); - } - } - } - pParentE.appendChild(ireturnvalueE); - return ireturnvalueE; - } - - /** - * createIRETURNVALUE - * - * @param pDoc - * @param pParentE - * @param pResultSet - * @return Element - * @throws WBEMException - */ - public static Element createIRETURNVALUE(Document pDoc, Element pParentE, Object[] pResultSet) - throws WBEMException { - Element ireturnvalueE = pDoc.createElement("IRETURNVALUE"); - if (pResultSet != null && pResultSet.length > 0) { - Object obj = pResultSet[0]; - if (obj instanceof CIMClass) { - for (int i = 0; i < pResultSet.length; i++) { - CIMClass clazz = (CIMClass) pResultSet[i]; - Element classnameE = pDoc.createElement("CLASSNAME"); - ireturnvalueE.appendChild(classnameE); - if (clazz.getName() != null) classnameE.setAttribute("NAME", clazz.getName()); - } - } else if (obj instanceof CIMInstance) { - for (int i = 0; i < pResultSet.length; i++) { - CIMInstance inst = (CIMInstance) pResultSet[i]; - createVALUENAMEDINSTANCE(pDoc, ireturnvalueE, inst); - } - } - } - pParentE.appendChild(ireturnvalueE); - return ireturnvalueE; - } - - /** - * createIRETURNVALUE_ENUMERATE_CLASSNAME - * - * @param pDoc - * @param pParentE - * @param pResultSet - * @return Element - */ - public static Element createIRETURNVALUE_ENUMERATE_CLASSNAME(Document pDoc, Element pParentE, - CIMClass[] pResultSet) { - Element ireturnvalueE = pDoc.createElement("IRETURNVALUE"); - if (pResultSet != null && pResultSet.length > 0) { - for (int i = 0; i < pResultSet.length; i++) { - CIMClass clazz = pResultSet[i]; - - Element classnameE = pDoc.createElement("CLASSNAME"); - ireturnvalueE.appendChild(classnameE); - if (clazz.getName() != null) classnameE.setAttribute("NAME", clazz.getName()); - } - } - pParentE.appendChild(ireturnvalueE); - return ireturnvalueE; - } - - /** - * createIndication_response - * - * @param doc - * @param ID - * @param error - * @return Element - */ - // ebak: [ 1656285 ] IndicationHandler does not accept non-Integer message - // ID - public static Element createIndication_response(Document doc, String ID, CIMError error) { - - // xmlBuilder.create XML - Element cimE = createCIM(doc); - Element messageE = createMESSAGE(doc, cimE, ID, "1.0"); - Element simpleexprspE = createSIMPLEEXPRSP(doc, messageE); - Element expmethodresponseE = createEXPMETHODRESPONSE(doc, simpleexprspE, "ExportIndication"); - if (error == null) { - createIRETURNVALUE(doc, expmethodresponseE); - } else { - createERROR(doc, expmethodresponseE, error); - } - // Element - return cimE; - } - - /** - * createIRETURNVALUE_ENUMERATE_INSTANCE - * - * @param pDoc - * @param pParentE - * @param pResultSet - * @return Element - * @throws WBEMException - */ - public static Element createIRETURNVALUE_ENUMERATE_INSTANCE(Document pDoc, Element pParentE, - CIMInstance[] pResultSet) throws WBEMException { - Element ireturnvalueE = pDoc.createElement("IRETURNVALUE"); - if (pResultSet != null && pResultSet.length > 0) { - for (int i = 0; i < pResultSet.length; i++) { - createVALUENAMEDINSTANCE(pDoc, ireturnvalueE, pResultSet[i]); - } - } - pParentE.appendChild(ireturnvalueE); - return ireturnvalueE; - } - - /** - * getTypeStr - * - * @param pType - * @return String - */ - public static String getTypeStr(CIMDataType pType) { - if (pType == null) return "string"; - if (pType.getType() == CIMDataType.REFERENCE) return MOF.REFERENCE; - return MOF.dataType(pType); - } - - /** - * getOpTypeStr - * - * @param pType - * @return String - */ - public static String getOpTypeStr(CIMDataType pType) { - return getTypeStr(pType); - } - - private static final Pattern NAMESPACE_SPLIT_PATTERN = Pattern.compile("/+"); - - /** - * createLOCALNAMESPACEPATH - * - * @param pDoc - * @param pParentE - * @param pName - * @return Element - */ - public static Element createLOCALNAMESPACEPATH(Document pDoc, Element pParentE, - CIMObjectPath pName) { - if (pName == null) return null; - // TODO: name(ObjectPath) should not be null, should an exception be - // thrown? - // This assumes that the NameSpace does not consist exclusively of - // empties like "////" - Element localnamespacepathE = pDoc.createElement("LOCALNAMESPACEPATH"); - String nameSpace = pName.getNamespace(); - if (nameSpace != null) { - String[] nsA = NAMESPACE_SPLIT_PATTERN.split(nameSpace); - for (int i = 0; i < nsA.length; i++) - if (nsA[i] != null && nsA[i].length() > 0) createNAMESPACE(pDoc, - localnamespacepathE, nsA[i]); - } - pParentE.appendChild(localnamespacepathE); - - return localnamespacepathE; - } - - /** - * createSIMPLEEXPREQ - * - * @param pDoc - * @return Element - */ - public static Element createSIMPLEEXPREQ(Document pDoc) { - // - Element e = pDoc.createElement("SIMPLEEXPREQ"); - return e; - } - - /** - * createEXPMETHODCALL - * - * @param pDoc - * @param pParentE - * @param pName - * @return Element - */ - public static Element createEXPMETHODCALL(Document pDoc, Element pParentE, String pName) { - // - // - Element e = pDoc.createElement("EXPMETHODCALL"); - if (pName != null) { - e.setAttribute("NAME", pName); - } - pParentE.appendChild(e); - return e; - } - - /** - * createEXPPARAMVALUE - * - * @param pDoc - * @param pParentE - * @param pName - * @return Element - */ - public static Element createEXPPARAMVALUE(Document pDoc, Element pParentE, String pName) { - // - // - Element e = pDoc.createElement("EXPPARAMVALUE"); - if (pName != null) { - e.setAttribute("NAME", pName); - } - pParentE.appendChild(e); - return e; - } -} +/* + CIMXMLBuilderImpl.java + + (C) Copyright IBM Corp. 2005, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------ + * 16627 2005-04-01 thschaef Correct instantiation for Uint64 + * 17459 2005-06-24 thschaef catch null within createMethod method + * 17459 2005-06-27 thschaef further improvement to createMethod() + * 1535756 2006-08-07 lupusalex Make code warning free + * 1610046 2006-07-12 ebak Does not escape trailing spaces KEYVALUE + * 1631407 2007-01-11 lupusalex VALUE.REFERENCE doesn't handle references without namespace + * 1656285 2007-02-12 ebak IndicationHandler does not accept non-Integer message ID + * 1671505 2007-02-28 lupusalex Wrong escaping of spaces in XML (Undo 1610046) + * 1660756 2007-03-02 ebak Embedded object support + * 1689085 2007-04-10 ebak Embedded object enhancements for Pegasus + * 1669961 2006-04-16 lupusalex CIMTypedElement.getType() =>getDataType() + * 1719991 2007-05-16 ebak FVT: regression ClassCastException in EmbObjHandler + * 1737141 2007-06-18 ebak Sync up with JSR48 evolution + * 1820763 2007-10-29 ebak Supporting the EmbeddedInstance qualifier + * 1827728 2007-11-12 ebak embeddedInstances: attribute EmbeddedObject not set + * 1827728 2007-11-20 ebak rework: embeddedInstances: attribute EmbeddedObject not set + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2087969 2008-09-03 blaschke-oss VALUE.ARRAY used in request for array of references + * 2093708 2008-09-10 rgummada HTTP 400 - Bad Request, CIMError: request-not-valid + * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings + * 2210455 2008-10-30 blaschke-oss Enhance javadoc, fix potential null pointers + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors + * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics + * 2823494 2009-08-03 rgummada Change Boolean constructor to static + * 2849970 2009-09-03 blaschke-oss createVALUEARRAY fails to create reference array + * 2912490 2010-01-05 rgummada NullPointerException when invoking getInstance + * 2957387 2010-03-03 blaschke-oss EmbededObject XML attribute must not be all uppercases + * 2970881 2010-03-15 blaschke-oss Add property to control EmbeddedObject case + * 3001333 2010-05-19 blaschke-oss CIMMethod class ignores propagated parameter + * 3304058 2011-05-20 blaschke-oss Use same date format in change history + * 3588558 2012-11-26 blaschke-oss An enhancement on Java CIM Client logging + * 2616 2013-02-23 blaschke-oss Add new API WBEMClientSBLIM.sendIndication() + * 2638 2013-05-09 blaschke-oss Do not build empty REFERENCECLASS + * 2689 2013-10-10 blaschke-oss createMETHODCALL should not add PARAMTYPE attribute + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.metricshub.wbem.javax.cim.CIMArgument; +import org.metricshub.wbem.javax.cim.CIMClass; +import org.metricshub.wbem.javax.cim.CIMClassProperty; +import org.metricshub.wbem.javax.cim.CIMDataType; +import org.metricshub.wbem.javax.cim.CIMInstance; +import org.metricshub.wbem.javax.cim.CIMMethod; +import org.metricshub.wbem.javax.cim.CIMObjectPath; +import org.metricshub.wbem.javax.cim.CIMParameter; +import org.metricshub.wbem.javax.cim.CIMQualifier; +import org.metricshub.wbem.javax.cim.CIMQualifierType; +import org.metricshub.wbem.javax.cim.CIMTypedElement; +import org.metricshub.wbem.javax.cim.CIMValuedElement; +import org.metricshub.wbem.javax.wbem.WBEMException; +import org.metricshub.wbem.sblim.cimclient.internal.cim.CIMQualifiedElementInterfaceImpl; +import org.metricshub.wbem.sblim.cimclient.internal.util.MOF; +import org.metricshub.wbem.sblim.cimclient.internal.util.WBEMConfiguration; +import org.metricshub.wbem.sblim.cimclient.internal.wbem.CIMError; +import org.metricshub.wbem.javax.cim.CIMFlavor; +import org.metricshub.wbem.javax.cim.CIMNamedElementInterface; +import org.metricshub.wbem.javax.cim.CIMProperty; +import org.metricshub.wbem.javax.cim.CIMQualifiedElementInterface; +import org.metricshub.wbem.javax.cim.CIMScope; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Text; + +/** + * Class CIMXMLBuilderImpl is the core class for building CIM-XML documents. + */ +public class CIMXMLBuilderImpl { + + private static final int MAJOR_CIM_VERSION = 2; + + private static final int MINOR_CIM_VERSION = 0; + + private static final int MAJOR_DTD_VERSION = 2; + + private static final int MINOR_DTD_VERSION = 0; + + /** + * createCIM + * + * @param pDoc + * @return Element + */ + public static Element createCIM(Document pDoc) { + // + // + Element e = pDoc.createElement("CIM"); + e.setAttribute("CIMVERSION", MAJOR_CIM_VERSION + "." + MINOR_CIM_VERSION); + // required + e.setAttribute("DTDVERSION", MAJOR_DTD_VERSION + "." + MINOR_DTD_VERSION); + // required + pDoc.appendChild(e); // root element + return e; + } + + // //////////////////////////////////////////////////////////////////////////////////////// + // Value Elements + // //////////////////////////////////////////////////////////////////////////////////////// + + /** + * createVALUE + * + * @param pDoc + * @param pParentE + * @return Element + */ + public static Element createVALUE(Document pDoc, Element pParentE) { + // + Element e = pDoc.createElement("VALUE"); + pParentE.appendChild(e); + + return e; + } + + /** + * createVALUE + * + * @param pDoc + * @param pParentE + * @param pValue + * @return Element + */ + public static Element createVALUE(Document pDoc, Element pParentE, String pValue) { + // + Element e = pDoc.createElement("VALUE"); + pParentE.appendChild(e); + + Text textE = pDoc.createTextNode(pValue); + e.appendChild(textE); + return e; + } + + /** + * createVALUE + * + * @param pDoc + * @param pParentE + * @param pValue + * @return Element + */ + public static Element createVALUE(Document pDoc, Element pParentE, boolean pValue) { + return createVALUE(pDoc, pParentE, pValue ? MOF.TRUE : MOF.FALSE); + } + + /** + * createVALUEARRAY + * + * @param pDoc + * @param pParentE + * @return Element + */ + public static Element createVALUEARRAY(Document pDoc, Element pParentE) { + // + Element e = pDoc.createElement("VALUE.ARRAY"); + pParentE.appendChild(e); + return e; + } + + /** + * createVALUEREFERENCE + * + * @param pDoc + * @param pParentE + * @return Element + */ + public static Element createVALUEREFERENCE(Document pDoc, Element pParentE) { + // + Element e = pDoc.createElement("VALUE.REFERENCE"); + pParentE.appendChild(e); + return e; + } + + /** + * createVALUEREFARRAY + * + * @param pDoc + * @param pParentE + * @return Element + */ + public static Element createVALUEREFARRAY(Document pDoc, Element pParentE) { + // + Element e = pDoc.createElement("VALUE.REFARRAY"); + pParentE.appendChild(e); + return e; + } + + // //////////////////////////////////////////////////////////////////////////////////////// + // Properties elements + // //////////////////////////////////////////////////////////////////////////////////////// + /** + * createPROPERTY + * + * @param pDoc + * @param pParentE + * @param pName + * @param pType + * @return Element + */ + public static Element createPROPERTY(Document pDoc, Element pParentE, String pName, String pType) { + // + // + + Element e = pDoc.createElement("PROPERTY"); + if (pName != null) e.setAttribute("NAME", pName); + if (pType != null) e.setAttribute("TYPE", pType); + // TODO: ClassOrigin, Propagated + pParentE.appendChild(e); + return e; + } + + /** + * createPROPERTYARRAY + * + * @param pDoc + * @param pParentE + * @param pName + * @param pType + * @return Element + */ + public static Element createPROPERTYARRAY(Document pDoc, Element pParentE, String pName, + String pType) { + // + // + + Element e = pDoc.createElement("PROPERTY.ARRAY"); + if (pName != null) e.setAttribute("NAME", pName); + if (pType != null) e.setAttribute("TYPE", pType); + // TODO: ClassOrigin, Propagated + pParentE.appendChild(e); + return e; + } + + /** + * createPROPERTYREFERENCE + * + * @param pDoc + * @param pParentE + * @param pName + * @param pReferenceclass + * @return Element + */ + public static Element createPROPERTYREFERENCE(Document pDoc, Element pParentE, String pName, + String pReferenceclass) { + // + // + + Element e = pDoc.createElement("PROPERTY.REFERENCE"); + if (pName != null) e.setAttribute("NAME", pName); + if (pReferenceclass != null && pReferenceclass.length() > 0) e.setAttribute( + "REFERENCECLASS", pReferenceclass); + pParentE.appendChild(e); + return e; + } + + // //////////////////////////////////////////////////////////////////////////////////////// + // Naming and Location elements + // //////////////////////////////////////////////////////////////////////////////////////// + + /** + * createNAMESPACE + * + * @param pDoc + * @param pParentE + * @param pName + * @return Element + */ + public static Element createNAMESPACE(Document pDoc, Element pParentE, String pName) { + // + // + Element e = pDoc.createElement("NAMESPACE"); + if (pName != null) { + e.setAttribute("NAME", pName); + } + pParentE.appendChild(e); + return e; + } + + /** + * createLOCALINSTANCEPATH + * + * @param pDoc + * @param pParentE + * @return Element + */ + public static Element createLOCALINSTANCEPATH(Document pDoc, Element pParentE) { + // + Element e = pDoc.createElement("LOCALINSTANCEPATH"); + pParentE.appendChild(e); + return e; + } + + /** + * createCLASSNAME + * + * @param pDoc + * @param pParentE + * @param pName + * @return Element + */ + public static Element createCLASSNAME(Document pDoc, Element pParentE, String pName) { + // + // + Element e = pDoc.createElement("CLASSNAME"); + if (pName != null) { + e.setAttribute("NAME", pName); + + pParentE.appendChild(e); + } + return e; + } + + /** + * createCLASS + * + * @param pDoc + * @param pParentE + * @param pName + * @param pSuperClass + * @return Element + */ + public static Element createCLASS(Document pDoc, Element pParentE, String pName, + String pSuperClass) { + // + // + Element e = pDoc.createElement("CLASS"); + if (pName != null) { + e.setAttribute("NAME", pName); + + } + if (pSuperClass != null && pSuperClass.length() > 0) { + e.setAttribute("SUPERCLASS", pSuperClass); + + } + if (pParentE != null) pParentE.appendChild(e); + return e; + } + + /** + * createINSTANCENAME + * + * @param pDoc + * @param pParentE + * @param pClassName + * @return Element + */ + public static Element createINSTANCENAME(Document pDoc, Element pParentE, String pClassName) { + // + // + Element e = pDoc.createElement("INSTANCENAME"); + if (pClassName != null) { + e.setAttribute("CLASSNAME", pClassName); + } + pParentE.appendChild(e); + return e; + } + + /** + * createKEYBINDING + * + * @param pDoc + * @param pParentE + * @param pName + * @return Element + */ + public static Element createKEYBINDING(Document pDoc, Element pParentE, String pName) { + // + // + Element e = pDoc.createElement("KEYBINDING"); + if (pName != null) { + e.setAttribute("NAME", pName); + } + pParentE.appendChild(e); + return e; + } + + private static final Pattern NUM_PAT = Pattern.compile("^[su]int(8|16|32|64)$", + Pattern.CASE_INSENSITIVE); + + /** + * + * getValueTypeStr + * + * @param pTypeStr + * @return String + */ + private static String getValueTypeStr(String pTypeStr) { + + if (pTypeStr == null || MOF.DT_STR.equalsIgnoreCase(pTypeStr)) return MOF.DT_STR; + if (MOF.DT_BOOL.equalsIgnoreCase(pTypeStr)) return MOF.DT_BOOL; + Matcher m = NUM_PAT.matcher(pTypeStr); + if (m.matches()) return "numeric"; + return MOF.DT_STR; + } + + /** + * createKEYVALUE + * + * @param pDoc + * @param pParentE + * @param pValueType + * @param pValue + * @return KEYVALUE + */ + public static Element createKEYVALUE(Document pDoc, Element pParentE, String pValueType, + String pValue) { + /* + * + */ + if (pValueType == null) pValueType = "string"; + Element e = pDoc.createElement("KEYVALUE"); + // FIXME: ebak: TYPE attrib is more exact, easier to handle + e.setAttribute("TYPE", pValueType); + // ebak: maybe old CIMOMs won't understand the TYPE attrib + e.setAttribute("VALUETYPE", getValueTypeStr(pValueType)); + pParentE.appendChild(e); + Text valueE = pDoc.createTextNode(pValue); + e.appendChild(valueE); + return e; + } + + // //////////////////////////////////////////////////////////////////////////////////////// + // Object Definition Elements + // //////////////////////////////////////////////////////////////////////////////////////// + + /** + * createINSTANCE + * + * @param pDoc + * @param pParentE + * @param pClassName + * @return Element + */ + public static Element createINSTANCE(Document pDoc, Element pParentE, String pClassName) { + // + // + + Element e = pDoc.createElement("INSTANCE"); + if (pClassName != null) { + e.setAttribute("CLASSNAME", pClassName); + } + if (pParentE != null) pParentE.appendChild(e); + return e; + } + + /** + * createQUALIFIER + * + * @param pDoc + * @param pParentE + * @param pName + * @param pType + * @return Element + */ + public static Element createQUALIFIER(Document pDoc, Element pParentE, String pName, + String pType) { + // + // + + Element e = pDoc.createElement("QUALIFIER"); + if (pName != null) { + e.setAttribute("NAME", pName); + // TODO: add additional attributes "propagated", "qualifierFlavod" + } + if (pType != null) e.setAttribute("TYPE", pType); + pParentE.appendChild(e); + return e; + } + + // /////////////////////////////////////////////////////////////////////////////////////////// + // Message Elements + // /////////////////////////////////////////////////////////////////////////////////////////// + + /** + * createMESSAGE + * + * @param pDoc + * @param pParentE + * @param pId + * @param pProtocolVersion + * @return Element + */ + public static Element createMESSAGE(Document pDoc, Element pParentE, String pId, + String pProtocolVersion) { + // + // + Element e = pDoc.createElement("MESSAGE"); + e.setAttribute("ID", pId); // required + e.setAttribute("PROTOCOLVERSION", pProtocolVersion); // required + pParentE.appendChild(e); + return e; + } + + /** + * createSIMPLEREQ + * + * @param pDoc + * @param pParentE + * @return Element + */ + public static Element createSIMPLEREQ(Document pDoc, Element pParentE) { + // + Element e = pDoc.createElement("SIMPLEREQ"); + pParentE.appendChild(e); + return e; + } + + /** + * createSIMPLEREQ + * + * @param pDoc + * @return Element + */ + public static Element createSIMPLEREQ(Document pDoc) { + // + Element e = pDoc.createElement("SIMPLEREQ"); + return e; + } + + /** + * createMULTIREQ + * + * @param pDoc + * @return Element + */ + public static Element createMULTIREQ(Document pDoc) { + // + Element e = pDoc.createElement("MULTIREQ"); + return e; + } + + /** + * createMETHODCALL + * + * @param pDoc + * @param pParentE + * @param pName + * @return Element + */ + public static Element createMETHODCALL(Document pDoc, Element pParentE, String pName) { + // + // + Element e = pDoc.createElement("METHODCALL"); + if (pName != null) { + e.setAttribute("NAME", pName); + } + pParentE.appendChild(e); + return e; + } + + /** + * createPARAMVALUE + * + * @param pDoc + * @param pParentE + * @param pArg + * @return Element + * @throws WBEMException + */ + public static Element createPARAMVALUE(Document pDoc, Element pParentE, CIMArgument pArg) + throws WBEMException { + // ) + // + if (pArg == null) return null; + Element e = pDoc.createElement("PARAMVALUE"); + EmbObjBuilder embObjBuilder = new EmbObjBuilder(pDoc, pArg); + if (pArg.getName() != null) { + e.setAttribute("NAME", pArg.getName()); + } + e.setAttribute("PARAMTYPE", embObjBuilder.getTypeStr()); + embObjBuilder.addSign(e); + embObjBuilder.addValue(e); + pParentE.appendChild(e); + return e; + } + + /** + * createSIMPLERSP + * + * @param pDoc + * @param pParentE + * @return Element + */ + public static Element createSIMPLERSP(Document pDoc, Element pParentE) { + // + Element e = pDoc.createElement("SIMPLERSP"); + + if (pParentE != null) pParentE.appendChild(e); + return e; + } + + /** + * createSIMPLEEXPRSP + * + * @param pDoc + * @param pParentE + * @return Element + */ + public static Element createSIMPLEEXPRSP(Document pDoc, Element pParentE) { + // + Element e = pDoc.createElement("SIMPLEEXPRSP"); + + pParentE.appendChild(e); + return e; + } + + /** + * createMETHODRESPONSE + * + * @param pDoc + * @param pParentE + * @param pName + * @return Element + */ + public static Element createMETHODRESPONSE(Document pDoc, Element pParentE, String pName) { + // + // + + // %CIMName;> + Element e = pDoc.createElement("METHODRESPONSE"); + if (pName != null) { + e.setAttribute("NAME", pName); + } + pParentE.appendChild(e); + return e; + } + + /** + * createIMETHODRESPONSE + * + * @param pDoc + * @param pParentE + * @param pName + * @return Element + */ + public static Element createIMETHODRESPONSE(Document pDoc, Element pParentE, String pName) { + // + // + // %CIMName;> + Element e = pDoc.createElement("IMETHODRESPONSE"); + if (pName != null) { + e.setAttribute("NAME", pName); + } + pParentE.appendChild(e); + return e; + } + + /** + * createEXPMETHODRESPONSE + * + * @param pDoc + * @param pParentE + * @param pName + * @return Element + */ + public static Element createEXPMETHODRESPONSE(Document pDoc, Element pParentE, String pName) { + // + // + Element e = pDoc.createElement("EXPMETHODRESPONSE"); + if (pName != null) { + e.setAttribute("NAME", pName); + } + pParentE.appendChild(e); + return e; + } + + /** + * createIRETURNVALUE + * + * @param pDoc + * @param pParentE + * @return Element + */ + public static Element createIRETURNVALUE(Document pDoc, Element pParentE) { + // + Element e = pDoc.createElement("IRETURNVALUE"); + pParentE.appendChild(e); + return e; + } + + /** + *
      +	 * !ELEMENT RETURNVALUE (VALUE | VALUE.REFERENCE)
      +	 * !ATTLIST RETURNVALUE
      +	 * %ParamType;       #IMPLIED
      +	 * 
      + * + * createRETURNVALUE + * + * @param pDoc + * @param pParentE + * @param pValue + * @return Element + * @throws WBEMException + */ + public static Element createRETURNVALUE(Document pDoc, Element pParentE, Object pValue) + throws WBEMException { + Element retValE = pDoc.createElement("RETURNVALUE"); + CIMDataType type = CIMDataType.getDataType(pValue); + retValE.setAttribute("PARAMTYPE", getTypeStr(type)); + createVALUE(pDoc, retValE, pValue); + pParentE.appendChild(retValE); + return retValE; + } + + /** + * createIMETHODCALL + * + * @param pDoc + * @param pParentE + * @param pName + * @return Element + */ + public static Element createIMETHODCALL(Document pDoc, Element pParentE, String pName) { + // + // + Element e = pDoc.createElement("IMETHODCALL"); + if (pName != null) { + e.setAttribute("NAME", pName); + } + pParentE.appendChild(e); + return e; + } + + /** + * createIPARAMVALUE + * + * @param pDoc + * @param pParentE + * @param pName + * @return Element + */ + public static Element createIPARAMVALUE(Document pDoc, Element pParentE, String pName) { + // ) + // + Element e = pDoc.createElement("IPARAMVALUE"); + if (pName != null) { + e.setAttribute("NAME", pName); + } + pParentE.appendChild(e); + return e; + } + + /** + * createERROR + * + * @param doc + * @param parentE + * @param error + * @return Element + */ + public static Element createERROR(Document doc, Element parentE, CIMError error) { + // + // + Element e = doc.createElement("ERROR"); + int code; + if ((code = error.getCode()) > 0) { + e.setAttribute("CODE", Integer.toString(code)); + } + String description = error.getDescription(); + if (description != null) { + e.setAttribute("DESCRIPTION", description); + } + + parentE.appendChild(e); + return e; + } + + /** + * ENTITY % QualifierFlavor "OVERRIDABLE (true|false) 'true' TOSUBCLASS + * (true|false) 'true' TOINSTANCE (true|false) 'false' TRANSLATABLE + * (true|false) 'false'" + * + * @param pElement + * @param pFlavors + */ + private static void setFlavors(Element pElement, int pFlavors) { + if ((pFlavors & CIMFlavor.TRANSLATE) > 0) { + pElement.setAttribute("TRANSLATABLE", MOF.TRUE); + } + if ((pFlavors & CIMFlavor.DISABLEOVERRIDE) > 0) { + pElement.setAttribute("OVERRIDABLE", MOF.FALSE); + } + if ((pFlavors & CIMFlavor.RESTRICTED) > 0) { + pElement.setAttribute("TOSUBCLASS", MOF.FALSE); + } + /* + * if ((pFlavors & CIMFlavor.RESTRICTED)>0) { + * pElement.setAttribute("TOSUBCLASS", "true"); } + */ + } + + /** + * createQUALIFIER_DECLARATION + * + * @param pDoc + * @param pParentE + * @param pQualifierType + * @return Element + * @throws WBEMException + */ + public static Element createQUALIFIER_DECLARATION(Document pDoc, Element pParentE, + CIMQualifierType pQualifierType) throws WBEMException { + // + // + + String pValueTypeStr = getTypeStr(pQualifierType.getDataType()); + Element qualifierdeclarationE = pDoc.createElement("QUALIFIER.DECLARATION"); + qualifierdeclarationE.setAttribute("NAME", pQualifierType.getName()); + qualifierdeclarationE.setAttribute("TYPE", pValueTypeStr); + qualifierdeclarationE.setAttribute("ISARRAY", + pQualifierType.getDataType().isArray() ? MOF.TRUE : MOF.FALSE); + + setFlavors(qualifierdeclarationE, pQualifierType.getFlavor()); + + int scopes = pQualifierType.getScope(); + if (scopes > 0) { + Element scopeE = pDoc.createElement("SCOPE"); + if ((scopes & CIMScope.CLASS) > 0) scopeE.setAttribute("CLASS", MOF.TRUE); + if ((scopes & CIMScope.ASSOCIATION) > 0) scopeE.setAttribute("ASSOCIATION", MOF.TRUE); + if ((scopes & CIMScope.REFERENCE) > 0) scopeE.setAttribute("REFERENCE", MOF.TRUE); + if ((scopes & CIMScope.PROPERTY) > 0) scopeE.setAttribute("PROPERTY", MOF.TRUE); + if ((scopes & CIMScope.METHOD) > 0) scopeE.setAttribute("METHOD", MOF.TRUE); + if ((scopes & CIMScope.PARAMETER) > 0) scopeE.setAttribute("PARAMETER", MOF.TRUE); + if ((scopes & CIMScope.INDICATION) > 0) scopeE.setAttribute("INDICATION", MOF.TRUE); + qualifierdeclarationE.appendChild(scopeE); + } + + createVALUE(pDoc, qualifierdeclarationE, pQualifierType.getValue()); + + pParentE.appendChild(qualifierdeclarationE); + return qualifierdeclarationE; + } + + /** + * createQUALIFIER + * + * @param pDoc + * @param pParentE + * @param pQualifier + * @return Element + * @throws WBEMException + */ + public static Element createQUALIFIER(Document pDoc, Element pParentE, + CIMQualifier pQualifier) throws WBEMException { + // + // + + Object value = pQualifier.getValue(); + if (value == null) return null; + + Element qualifierE = createQUALIFIER(pDoc, pParentE, pQualifier.getName(), + getTypeStr(pQualifier.getDataType())); + + if (pQualifier.isPropagated()) { + qualifierE.setAttribute("PROPAGATED", "true"); + } + setFlavors(qualifierE, pQualifier.getFlavor()); + + createVALUE(pDoc, qualifierE, value); + + pParentE.appendChild(qualifierE); + return qualifierE; + } + + /** + * createQUALIFIERS + * + * @param pDoc + * @param pParentE + * @param pQualifiersA + * @throws WBEMException + */ + public static void createQUALIFIERS(Document pDoc, Element pParentE, + CIMQualifier[] pQualifiersA) throws WBEMException { + if (pQualifiersA == null) return; + for (int i = 0; i < pQualifiersA.length; i++) { + createQUALIFIER(pDoc, pParentE, pQualifiersA[i]); + } + } + + /** + * createPROPERTIES + * + * @param pDoc + * @param pParentE + * @param pProperties + * @throws WBEMException + */ + public static void createPROPERTIES(Document pDoc, Element pParentE, + CIMProperty[] pProperties) throws WBEMException { + if (pProperties == null) return; + for (int i = 0; i < pProperties.length; i++) { + createPROPERTY(pDoc, pParentE, pProperties[i]); + } + } + + private static final CIMQualifiedElementInterfaceImpl KEYQUALIFIERS_IMPL = new CIMQualifiedElementInterfaceImpl( + null, true); + + static final CIMQualifier EMB_OBJ_QUALI = new CIMQualifier("EmbeddedObject", + CIMDataType.BOOLEAN_T, Boolean.TRUE, CIMFlavor.DISABLEOVERRIDE); + + // ebak: embedded object: CLASS_T or INSTANCE_T? + + /** + * isCIMObject + * + * @param typeCode + * @return boolean + */ + public static boolean isCIMObject(int typeCode) { + return typeCode == CIMDataType.CLASS || typeCode == CIMDataType.OBJECT; + } + + /** + * isCIMObject + * + * @param pType + * @return boolean + */ + public static boolean isCIMObject(CIMDataType pType) { + return pType == null ? false : isCIMObject(pType.getType()); + } + + /** + * getEmbObjTypeStr + * + * @param pType + * @return String + */ + public static String getEmbObjTypeStr(CIMDataType pType) { + return isCIMObject(pType) ? MOF.DT_STR : getTypeStr(pType); + } + + private static Document getDoc() { + try { + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + DocumentBuilder docBuilder = factory.newDocumentBuilder(); + return docBuilder.newDocument(); + } catch (ParserConfigurationException e) { + throw new RuntimeException(e); + } + } + + /** + * cimObjectToXMLString - for embedded object support + * + * @param pObj + * @return String + * @throws WBEMException + */ + public static String cimObjectToXMLString(Object pObj) throws WBEMException { + if (pObj == null) return null; + Document doc; + Element e; + if (pObj instanceof CIMClass) { + doc = getDoc(); + e = createCLASS(doc, null, (CIMClass) pObj); + } else if (pObj instanceof CIMInstance) { + doc = getDoc(); + e = createINSTANCE(doc, null, (CIMInstance) pObj); + } else { + throw new WBEMException(WBEMException.CIM_ERR_FAILED, pObj.getClass().getName() + + " parameter is not suitable for this method!"); + } + doc.appendChild(e); + ByteArrayOutputStream os = new ByteArrayOutputStream(); + try { + CimXmlSerializer.serialize(os, doc.getDocumentElement(), false); + } catch (IOException ex) { + throw new WBEMException(WBEMException.CIM_ERR_FAILED, + "XML serialization failed with IOException!", null, ex); + } + return os.toString(); + } + + /** + * cimObjectArrayToXMLString - for embedded object support + * + * @param pObj + * @return String[] + * @throws WBEMException + */ + public static String[] cimObjectArrayToXMLString(Object pObj) throws WBEMException { + if (pObj == null) return null; + if (!(pObj instanceof Object[])) throw new WBEMException(WBEMException.CIM_ERR_FAILED, + "Object[] parameter is required for this method!"); + Object[] objA = (Object[]) pObj; + String[] strA = new String[objA.length]; + // here we don't deal with the consistency check of the Object[] + for (int i = 0; i < objA.length; i++) + strA[i] = cimObjectToXMLString(objA[i]); + return strA; + } + + static boolean embObjQualified(CIMQualifiedElementInterface pQualid) { + return pQualid.hasQualifier("EmbeddedObject") || pQualid.hasQualifier("EmbeddedInstance"); + } + + static class EmbObjBuilder { + + private static final int ATTRIB_ONLY = 0, EO_QUALI = 1, EO_AND_EI_QUALI = 2; + + private int iSignMethod; + + private Document iDoc; + + private CIMTypedElement iTypedE; + + private boolean iXMLQualified; + + private static final boolean iUpperCaseEmbObjEntities = WBEMConfiguration + .getGlobalConfiguration().upperCaseEmbObjEntities(); + + /** + * Ctor. + * + * @param pDoc + * @param pTypedE + */ + public EmbObjBuilder(Document pDoc, CIMTypedElement pTypedE) { + this(pDoc, pTypedE, false); + } + + /** + * Ctor. + * + * @param pDoc + * @param pTypedE + * @param pXMLQualified + * - e.g. CIMProperty is not qualified in JSR48, but + * qualified in CIM-XML + */ + public EmbObjBuilder(Document pDoc, CIMTypedElement pTypedE, boolean pXMLQualified) { + this.iDoc = pDoc; + this.iTypedE = pTypedE; + this.iXMLQualified = pXMLQualified; + String builderCfg = WBEMConfiguration.getGlobalConfiguration().getCimXmlEmbObjBuilder(); + if ("EmbObjQuali".equalsIgnoreCase(builderCfg)) { + this.iSignMethod = EO_QUALI; + } else if ("EmbObjAndEmbInstQuali".equalsIgnoreCase(builderCfg)) { + this.iSignMethod = EO_AND_EI_QUALI; + } else { + this.iSignMethod = ATTRIB_ONLY; + } + } + + /** + * getTypeStr + * + * @return String + */ + public String getTypeStr() { + return getEmbObjTypeStr(this.iTypedE.getDataType()); + } + + /** + * isArray + * + * @return String + */ + public boolean isArray() { + return this.iTypedE.getDataType().isArray(); + } + + private Object getValue() { + if (!(this.iTypedE instanceof CIMValuedElement)) return null; + return ((CIMValuedElement) this.iTypedE).getValue(); + + } + + /** + * addSign + * + * @param pElement + * @throws WBEMException + */ + public void addSign(Element pElement) throws WBEMException { + if (!isCIMObject(this.iTypedE.getDataType())) return; + CIMQualifiedElementInterface qualified; + if (this.iTypedE instanceof CIMQualifiedElementInterface) { + qualified = (CIMQualifiedElementInterface) this.iTypedE; + if (embObjQualified(qualified)) return; + } else { + qualified = null; + } + if (this.iSignMethod == ATTRIB_ONLY || (qualified == null && !this.iXMLQualified)) { + pElement.setAttribute(iUpperCaseEmbObjEntities ? "EMBEDDEDOBJECT" + : "EmbeddedObject", + this.iTypedE.getDataType().getType() == CIMDataType.OBJECT ? "instance" + : "object"); + } else { + if (this.iSignMethod == EO_AND_EI_QUALI) { + addEmbObjOrEmbInstQuali(pElement); + } else { // EO_QUALI + createQUALIFIER(this.iDoc, pElement, EMB_OBJ_QUALI); + } + } + } + + private void addEmbObjOrEmbInstQuali(Element pElement) throws WBEMException { + CIMQualifier signQuali; + if (this.iTypedE.getDataType().getType() == CIMDataType.OBJECT) { + CIMInstance inst; + if (isArray()) { + CIMInstance[] instA = (CIMInstance[]) getValue(); + inst = instA == null ? null : instA[0]; + } else { + inst = (CIMInstance) getValue(); + } + String className = inst == null ? "" : inst.getClassName(); + signQuali = new CIMQualifier("EmbeddedInstance", CIMDataType.STRING_T, + className, CIMFlavor.DISABLEOVERRIDE); + } else { // class + signQuali = EMB_OBJ_QUALI; + } + createQUALIFIER(this.iDoc, pElement, signQuali); + } + + /** + * addValue + * + * @param pElement + * @throws WBEMException + */ + public void addValue(Element pElement) throws WBEMException { + Object value = getValue(); + if (value == null) return; + if (isCIMObject(this.iTypedE.getDataType())) { + if (isArray()) { + value = cimObjectArrayToXMLString(value); + } else { + value = cimObjectToXMLString(value); + } + } + createVALUE(this.iDoc, pElement, value); + } + + } + + /** + * createPROPERTY + * + * @param pDoc + * @param pParentE + * @param pProperty + * @return Element + * @throws WBEMException + */ + public static Element createPROPERTY(Document pDoc, Element pParentE, CIMProperty pProperty) + throws WBEMException { + CIMDataType propType = pProperty.getDataType(); + Element propertyE; + EmbObjBuilder embObjBuilder = new EmbObjBuilder(pDoc, pProperty, true); + String typeStr = embObjBuilder.getTypeStr(); + if (propType.isArray()) { + propertyE = createPROPERTYARRAY(pDoc, pParentE, pProperty.getName(), typeStr); + } else if (propType.getType() == CIMDataType.REFERENCE) { + propertyE = createPROPERTYREFERENCE(pDoc, pParentE, pProperty.getName(), propType + .getRefClassName()); + } else { + propertyE = createPROPERTY(pDoc, pParentE, pProperty.getName(), typeStr); + } + + String classorigin = pProperty.getOriginClass(); + if (classorigin != null && classorigin.length() > 0) propertyE.setAttribute("CLASSORIGIN", + classorigin); + + if (pProperty.isPropagated()) propertyE.setAttribute("PROPAGATED", MOF.TRUE); + // FIXME: here key qualifier should be added if the property is a key + embObjBuilder.addSign(propertyE); + if (pProperty instanceof CIMClassProperty) { + createQUALIFIERS(pDoc, propertyE, ((CIMClassProperty) pProperty).getQualifiers()); + } else { // CIMProperty + if (pProperty.isKey()) createQUALIFIERS(pDoc, propertyE, KEYQUALIFIERS_IMPL + .getQualifiers()); + } + embObjBuilder.addValue(propertyE); + return propertyE; + } + + /** + * createVALUEARRAY + * + * @param pDoc + * @param pParentE + * @param pValA + * @return Element + * @throws WBEMException + */ + public static Element createVALUEARRAY(Document pDoc, Element pParentE, Object[] pValA) + throws WBEMException { + Element valuearrayE = (pValA != null && pValA.length > 0 && (pValA[0] instanceof CIMObjectPath || pValA[0] instanceof CIMInstance)) ? createVALUEREFARRAY( + pDoc, pParentE) + : createVALUEARRAY(pDoc, pParentE); + + if (pValA != null) for (int i = 0; i < pValA.length; i++) { + createVALUE(pDoc, valuearrayE, pValA[i]); + } + pParentE.appendChild(valuearrayE); + return valuearrayE; + } + + /** + * createVALUE + * + * @param pDoc + * @param pParentE + * @param pArgValue + * @return Element + * @throws WBEMException + */ + public static Element createVALUE(Document pDoc, Element pParentE, Object pArgValue) + throws WBEMException { + if (pArgValue == null) return null; + + Element valueE = null; + if (pArgValue instanceof Object[]) { + valueE = createVALUEARRAY(pDoc, pParentE, (Object[]) pArgValue); + } else { + CIMDataType type = CIMDataType.getDataType(pArgValue); + if (type != null && type.getType() == CIMDataType.REFERENCE) { + valueE = createVALUEREFERENCE(pDoc, pParentE); + + CIMObjectPath op = (CIMObjectPath) pArgValue; + CIMProperty[] keys = op.getKeys(); + if (op.getHost() == null || "".equals(op.getHost())) { + if (op.getNamespace() == null || "".equals(op.getNamespace())) { + if (keys.length > 0) { + createINSTANCENAME(pDoc, valueE, op); + } else { + createCLASSNAME(pDoc, valueE, op.getObjectName()); + } + } else { + if (keys.length > 0) { + createLOCALINSTANCEPATH(pDoc, valueE, op); + } else { + createLOCALCLASSPATH(pDoc, valueE, op); + } + } + } else { + if (keys.length > 0) { + createINSTANCEPATH(pDoc, valueE, op); + } else { + createCLASSPATH(pDoc, valueE, op); + } + } + // createOBJECTPATH(doc, valueE, (CIMObjectPath) obj); + } else { + if (pArgValue instanceof CIMInstance) { + valueE = createVALUEREFERENCE(pDoc, pParentE); + CIMObjectPath cop = ((CIMInstance) pArgValue).getObjectPath(); + createINSTANCENAME(pDoc, valueE, cop); + } else if (pArgValue instanceof CIMClass) { + valueE = createVALUE(pDoc, pParentE); + createCLASS(pDoc, valueE, (CIMClass) pArgValue); + } else { + createVALUE(pDoc, pParentE, pArgValue.toString()); + } + } + } + + return valueE; + } + + /** + * createINSTANCE + * + * @param pDoc + * @param pParentE + * @param pInstance + * @return Element + * @throws WBEMException + */ + public static Element createINSTANCE(Document pDoc, Element pParentE, CIMInstance pInstance) + throws WBEMException { + // + // + + String className = pInstance.getObjectPath().getObjectName(); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_FAILED, + "null class name"); + + Element instanceE = createINSTANCE(pDoc, pParentE, className); + + // FIXME: in JSR48 CIMInstance doesn't have qualifiers + // createQUALIFIERS(pDoc, instanceE, pInstance.getQualifiers()); + createPROPERTIES(pDoc, instanceE, pInstance.getProperties()); + + if (pParentE != null) pParentE.appendChild(instanceE); + + return instanceE; + } + + /** + * createOBJECTPATH + * + * @param pDoc + * @param pParentE + * @param pPath + * @return Element + * @throws WBEMException + */ + public static Element createOBJECTPATH(Document pDoc, Element pParentE, CIMObjectPath pPath) + throws WBEMException { + Element objectpathE = pDoc.createElement("OBJECTPATH"); + + CIMProperty[] keys = pPath.getKeys(); + if (keys.length > 0) { + createINSTANCEPATH(pDoc, objectpathE, pPath); + } else { + createCLASSPATH(pDoc, objectpathE, pPath); + } + + pParentE.appendChild(objectpathE); + return objectpathE; + } + + /** + * createOBJECTNAME + * + * @param pDoc + * @param pParentE + * @param pPath + * @return Element + * @throws WBEMException + */ + public static Element createOBJECTNAME(Document pDoc, Element pParentE, CIMObjectPath pPath) + throws WBEMException { + + CIMProperty[] keys = pPath.getKeys(); + if (keys.length > 0) { return createINSTANCENAME(pDoc, pParentE, pPath); } + if (pPath.getObjectName() == null) throw new WBEMException( + WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name"); + return createCLASSNAME(pDoc, pParentE, pPath.getObjectName()); + } + + /** + * createLOCALINSTANCEPATH + * + * @param pDoc + * @param pParentE + * @param pPath + * @return Element + * @throws WBEMException + */ + public static Element createLOCALINSTANCEPATH(Document pDoc, Element pParentE, + CIMObjectPath pPath) throws WBEMException { + Element localinstancepathE = pDoc.createElement("LOCALINSTANCEPATH"); + + createLOCALNAMESPACEPATH(pDoc, localinstancepathE, pPath); + createINSTANCENAME(pDoc, localinstancepathE, pPath); + + pParentE.appendChild(localinstancepathE); + return localinstancepathE; + } + + /** + * createLOCALCLASSPATH + * + * @param pDoc + * @param pParentE + * @param pPath + * @return Element + * @throws WBEMException + */ + public static Element createLOCALCLASSPATH(Document pDoc, Element pParentE, CIMObjectPath pPath) + throws WBEMException { + Element localinstancepathE = pDoc.createElement("LOCALCLASSPATH"); + + createLOCALNAMESPACEPATH(pDoc, localinstancepathE, pPath); + + if (pPath.getObjectName() == null) throw new WBEMException( + WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name"); + createCLASSNAME(pDoc, localinstancepathE, pPath.getObjectName()); + + pParentE.appendChild(localinstancepathE); + return localinstancepathE; + } + + /** + * createLOCALOBJECTPATH + * + * @param pDoc + * @param pParentE + * @param pPath + * @return Element + * @throws WBEMException + */ + public static Element createLOCALOBJECTPATH(Document pDoc, Element pParentE, CIMObjectPath pPath) + throws WBEMException { + + CIMProperty[] keys = pPath.getKeys(); + if (keys.length > 0) { return createLOCALINSTANCEPATH(pDoc, pParentE, pPath); } + return createLOCALCLASSPATH(pDoc, pParentE, pPath); + } + + /** + * createVALUEREFERENCE + * + * @param pDoc + * @param pParentE + * @param pPath + * @return Element + * @throws WBEMException + */ + public static Element createVALUEREFERENCE(Document pDoc, Element pParentE, CIMObjectPath pPath) + throws WBEMException { + Element objectpathE = pDoc.createElement("VALUE.REFERENCE"); + + String ns = pPath.getNamespace(); + if (pPath.getHost() == null || "".equals(pPath.getHost())) { + if (pPath.getNamespace() == null || "".equals(ns)) { + createINSTANCENAME(pDoc, objectpathE, pPath); + } else { + createLOCALOBJECTPATH(pDoc, objectpathE, pPath); + } + } else { + CIMProperty[] keys = pPath.getKeys(); + if (keys.length > 0) { + createINSTANCEPATH(pDoc, objectpathE, pPath); + } else { + createCLASSPATH(pDoc, objectpathE, pPath); + } + } + + pParentE.appendChild(objectpathE); + return objectpathE; + } + + /** + * createINSTANCENAME + * + * @param doc + * @param parentE + * @param instanceOP + * @return Element + * @throws WBEMException + */ + public static Element createINSTANCENAME(Document doc, Element parentE, CIMObjectPath instanceOP) + throws WBEMException { + + Element instancenameE = doc.createElement("INSTANCENAME"); + String classname = instanceOP.getObjectName(); + if (classname != null) { + instancenameE.setAttribute("CLASSNAME", classname); + } + + CIMProperty[] keysA = instanceOP.getKeys(); + for (int ii = 0; ii < keysA.length; ii++) { + CIMProperty prop = keysA[ii]; + String propName = prop.getName(); + CIMDataType propType = prop.getDataType(); + Object propValue = prop.getValue(); + // if (_pValue == null) TODO what happened when a KeyBinding has a + // null property value? + /* + * ebak: test support for #1666336 EnumInstance has attributes + * filled from others Handling direct KEYVALUE and + * VALUE.REFERENCE children is difficult, KEYBINDING can wrap them + * -> dropping out KEYVALUE? | VALUE.REFERENCE?. + * + * + * + * - non + * reference values can be null + * + * - reference + * value shouldn't be null + */ + if (propType == null) { throw new WBEMException( + WBEMException.CIM_ERR_INVALID_PARAMETER, + "Type of property or key cannot be a null! " + propName + " in ObjectPath " + + instanceOP.toString() + " has null type."); } + + if (propValue == null) { + if (propType.getType() == CIMDataType.REFERENCE) { throw new WBEMException( + WBEMException.CIM_ERR_INVALID_PARAMETER, + "Value of reference cannot be null! " + propName + " in ObjectPath " + + instanceOP.toString() + " has null value."); } + } + + Element keybindingE = createKEYBINDING(doc, instancenameE, propName); + if (propType.getType() == CIMDataType.REFERENCE) { + CIMObjectPath refOP = (CIMObjectPath) propValue; + + createVALUEREFERENCE(doc, keybindingE, refOP); + } else { + String valueStr = propValue == null ? null : propValue.toString(); + String valueTypeStr = getTypeStr(propType); + createKEYVALUE(doc, keybindingE, valueTypeStr, valueStr); + } + } + + parentE.appendChild(instancenameE); + return instancenameE; + } + + /** + * createCLASSPATH + * + * @param pDoc + * @param pParentE + * @param pPath + * @return Element + */ + public static Element createCLASSPATH(Document pDoc, Element pParentE, CIMObjectPath pPath) { + Element classpathE = pDoc.createElement("CLASSPATH"); + + // ebak: NAMESPACEPATH is necessary + createNAMESPACEPATH(pDoc, classpathE, pPath); + createCLASSNAME(pDoc, classpathE, pPath.getObjectName()); + + pParentE.appendChild(classpathE); + return classpathE; + } + + /** + * createPARAMETERS + * + * @param pDoc + * @param pParentE + * @param pParameters + * @throws WBEMException + */ + public static void createPARAMETERS(Document pDoc, Element pParentE, + CIMParameter[] pParameters) throws WBEMException { + if (pParameters == null) return; + for (int i = 0; i < pParameters.length; i++) { + createPARAMETER(pDoc, pParentE, pParameters[i]); + } + } + + /** + * createPARAMETER + * + * @param pDoc + * @param pParentE + * @param pParameter + * @return Element + * @throws WBEMException + */ + public static Element createPARAMETER(Document pDoc, Element pParentE, + CIMParameter pParameter) throws WBEMException { + Element parameterE; + CIMDataType type = pParameter.getDataType(); + int typeCode = type.getType(); + EmbObjBuilder embObjBuilder = new EmbObjBuilder(pDoc, pParameter); + String typeStr = embObjBuilder.getTypeStr(); + if (type.isArray()) { + if (typeCode == CIMDataType.REFERENCE) { + parameterE = pDoc.createElement("PARAMETER.REFARRAY"); + String refclass = type.getRefClassName(); + if (refclass != null && refclass.length() > 0) parameterE.setAttribute( + "REFERENCECLASS", type.getRefClassName()); + } else { + parameterE = pDoc.createElement("PARAMETER.ARRAY"); + parameterE.setAttribute("TYPE", typeStr); + } + } else { + if (typeCode == CIMDataType.REFERENCE) { + parameterE = pDoc.createElement("PARAMETER.REFERENCE"); + String refclass = type.getRefClassName(); + if (refclass != null && refclass.length() > 0) parameterE.setAttribute( + "REFERENCECLASS", type.getRefClassName()); + } else { + parameterE = pDoc.createElement("PARAMETER"); + parameterE.setAttribute("TYPE", typeStr); + } + } + parameterE.setAttribute("NAME", pParameter.getName()); + embObjBuilder.addSign(parameterE); + createQUALIFIERS(pDoc, parameterE, pParameter.getQualifiers()); + + pParentE.appendChild(parameterE); + return parameterE; + } + + /** + * createMETHODS + * + * @param pDoc + * @param pParentE + * @param pMethods + * @param pClassName + * @throws WBEMException + */ + public static void createMETHODS(Document pDoc, Element pParentE, CIMMethod[] pMethods, + String pClassName) throws WBEMException { + for (int i = 0; i < pMethods.length; i++) { + createMETHOD(pDoc, pParentE, pMethods[i], pClassName); + } + } + + /** + * createMETHOD + * + * @param pDoc + * @param pParentE + * @param pMethod + * @param pClassName + * @return Element + * @throws WBEMException + */ + public static Element createMETHOD(Document pDoc, Element pParentE, CIMMethod pMethod, + String pClassName) throws WBEMException { + Element methodE = pDoc.createElement("METHOD"); + + methodE.setAttribute("NAME", pMethod.getName()); + EmbObjBuilder embObjBuilder = new EmbObjBuilder(pDoc, pMethod); + String typeStr = embObjBuilder.getTypeStr(); + methodE.setAttribute("TYPE", typeStr); + String classorigin = pMethod.getOriginClass(); + + if (classorigin != null && classorigin.length() != 0) methodE.setAttribute("CLASSORIGIN", + classorigin); + + // 17459 + if (pMethod.isPropagated()) { + methodE.setAttribute("PROPAGATED", MOF.TRUE); + } else { + methodE.setAttribute("PROPAGATED", MOF.FALSE); + } + // ebak: embedded object support + embObjBuilder.addSign(methodE); + + createQUALIFIERS(pDoc, methodE, pMethod.getQualifiers()); + createPARAMETERS(pDoc, methodE, pMethod.getParameters()); + + pParentE.appendChild(methodE); + return methodE; + } + + /* + * private static String elementStr(Element pE) { try { + * ByteArrayOutputStream os = new ByteArrayOutputStream(); + * CimXmlSerializer.serialize(os, pE, true); return new + * String(os.toByteArray()); } catch (RuntimeException e) { throw e; } catch + * (Exception e) { throw new RuntimeException(e); } } + */ + + /** + * createCLASS + * + * @param pDoc + * @param pParentE + * @param pClass + * @return Element + * @throws WBEMException + */ + public static Element createCLASS(Document pDoc, Element pParentE, CIMClass pClass) + throws WBEMException { + + Element classE = createCLASS(pDoc, pParentE, pClass.getName(), pClass.getSuperClassName()); + + createQUALIFIERS(pDoc, classE, pClass.getQualifiers()); + createPROPERTIES(pDoc, classE, pClass.getProperties()); + createMETHODS(pDoc, classE, pClass.getMethods(), pClass.getName()); + + // parentE.appendChild(classE); + return classE; + } + + /** + * createHOST + * + * @param pDoc + * @param pParentE + * @param pHost + * @return Element + */ + public static Element createHOST(Document pDoc, Element pParentE, String pHost) { + Element hostE = pDoc.createElement("HOST"); + + Text hostT = pDoc.createTextNode(pHost); + hostE.appendChild(hostT); + + pParentE.appendChild(hostE); + return hostE; + } + + /** + * createNAMESPACEPATH + * + * @param pDoc + * @param pParentE + * @param pPath + * @return Element + */ + public static Element createNAMESPACEPATH(Document pDoc, Element pParentE, CIMObjectPath pPath) { + Element namespacepathE = pDoc.createElement("NAMESPACEPATH"); + + String host = pPath.getHost(); + if (host == null) { + // try { + // host = InetAddress.getLocalHost().getHostAddress(); + // } catch (Exception e) { + // throw new CIMXMLBuilderException("Error while resolving + // hostname"); + // } + host = "unassigned-hostname"; + } + createHOST(pDoc, namespacepathE, host); + createLOCALNAMESPACEPATH(pDoc, namespacepathE, pPath); + + pParentE.appendChild(namespacepathE); + return namespacepathE; + } + + /** + * createINSTANCEPATH + * + * @param pDoc + * @param pParentE + * @param pPath + * @return Element + * @throws WBEMException + */ + public static Element createINSTANCEPATH(Document pDoc, Element pParentE, CIMObjectPath pPath) + throws WBEMException { + Element instancepathE = pDoc.createElement("INSTANCEPATH"); + + createNAMESPACEPATH(pDoc, instancepathE, pPath); + createINSTANCENAME(pDoc, instancepathE, pPath); + pParentE.appendChild(instancepathE); + return instancepathE; + } + + /** + * createVALUENAMEDINSTANCE + * + * @param pDoc + * @param pParentE + * @param pPath + * @param pInst + * @return Element + * @throws WBEMException + */ + public static Element createVALUENAMEDINSTANCE(Document pDoc, Element pParentE, + CIMObjectPath pPath, CIMInstance pInst) throws WBEMException { + Element valuenamedinstanceE = pDoc.createElement("VALUE.NAMEDINSTANCE"); + createINSTANCENAME(pDoc, valuenamedinstanceE, pPath); + createINSTANCE(pDoc, valuenamedinstanceE, pInst); + + pParentE.appendChild(valuenamedinstanceE); + return valuenamedinstanceE; + } + + /** + * createVALUENAMEDINSTANCE + * + * @param pDoc + * @param pParentE + * @param pInst + * @return Element + * @throws WBEMException + */ + public static Element createVALUENAMEDINSTANCE(Document pDoc, Element pParentE, + CIMInstance pInst) throws WBEMException { + Element valuenamedinstanceE = pDoc.createElement("VALUE.NAMEDINSTANCE"); + createINSTANCENAME(pDoc, valuenamedinstanceE, pInst.getObjectPath()); + createINSTANCE(pDoc, valuenamedinstanceE, pInst); + + pParentE.appendChild(valuenamedinstanceE); + return valuenamedinstanceE; + } + + private static CIMObjectPath changeNameSpace(CIMNamedElementInterface pNamedElement, + String pNameSpace) { + CIMObjectPath path = pNamedElement.getObjectPath(); + return new CIMObjectPath(path.getScheme(), path.getHost(), path.getPort(), pNameSpace, path + .getObjectName(), path.getKeys()); + } + + private static CIMClass changeClassNameSpace(CIMClass pClass, String pNameSpace) { + CIMObjectPath newOp = changeNameSpace(pClass, pNameSpace); + return new CIMClass(newOp, pClass.getSuperClassName(), pClass.getQualifiers(), pClass + .getProperties(), pClass.getMethods(), pClass.isAssociation(), pClass.isKeyed()); + } + + private static CIMInstance changeInstanceNameSpace(CIMInstance pInst, String pNameSpace) { + CIMObjectPath newOp = changeNameSpace(pInst, pNameSpace); + return new CIMInstance(newOp, pInst.getProperties()); + } + + /** + * createVALUEOBJECTWITHPATH + * + * @param pDoc + * @param pParentE + * @param pObj + * @param pNameSpace + * @return Element + * @throws WBEMException + */ + public static Element createVALUEOBJECTWITHPATH(Document pDoc, Element pParentE, Object pObj, + String pNameSpace) throws WBEMException { + Element valueobjectwithpathE = pDoc.createElement("VALUE.OBJECTWITHPATH"); + if (pObj instanceof CIMClass) { + CIMClass clazz = (CIMClass) pObj; + + if (clazz.getObjectPath().getNamespace() == null + || clazz.getObjectPath().getNamespace().length() == 0) { + // ebak: changing the namespace in clazz's objectPath + // clazz.getObjectPath().setNameSpace(pNameSpace); + clazz = changeClassNameSpace(clazz, pNameSpace); + } + + createCLASSPATH(pDoc, valueobjectwithpathE, clazz.getObjectPath()); + createCLASS(pDoc, valueobjectwithpathE, clazz); + } else if (pObj instanceof CIMInstance) { + CIMInstance inst = (CIMInstance) pObj; + if (inst.getObjectPath().getNamespace() == null + || inst.getObjectPath().getNamespace().length() == 0) { + // ebak: changing the namespace ins inst's objectPath + // inst.getObjectPath().setNameSpace(pNameSpace); + inst = changeInstanceNameSpace(inst, pNameSpace); + } + createINSTANCEPATH(pDoc, valueobjectwithpathE, inst.getObjectPath()); + createINSTANCE(pDoc, valueobjectwithpathE, inst); + } + + pParentE.appendChild(valueobjectwithpathE); + return valueobjectwithpathE; + } + + /** + * createVALUEOBJECTWITHLOCALPATH + * + * @param pDoc + * @param pParentE + * @param pObj + * @param pNameSpace + * @return Element + * @throws WBEMException + */ + public static Element createVALUEOBJECTWITHLOCALPATH(Document pDoc, Element pParentE, + Object pObj, String pNameSpace) throws WBEMException { + Element valueobjectwithpathE = pDoc.createElement("VALUE.OBJECTWITHLOCALPATH"); + if (pObj instanceof CIMClass) { + CIMClass clazz = (CIMClass) pObj; + + if (clazz.getObjectPath().getNamespace() == null + || clazz.getObjectPath().getNamespace().length() == 0) { + // ebak: changing clazz's objectPath + // clazz.getObjectPath().setNameSpace(pNameSpace); + clazz = changeClassNameSpace(clazz, pNameSpace); + } + createLOCALCLASSPATH(pDoc, valueobjectwithpathE, clazz.getObjectPath()); + createCLASS(pDoc, valueobjectwithpathE, clazz); + } else if (pObj instanceof CIMInstance) { + CIMInstance inst = (CIMInstance) pObj; + if (inst.getObjectPath().getNamespace() == null + || inst.getObjectPath().getNamespace().length() == 0) { + // inst.getObjectPath().setNameSpace(pNameSpace); + inst = changeInstanceNameSpace(inst, pNameSpace); + } + createLOCALINSTANCEPATH(pDoc, valueobjectwithpathE, inst.getObjectPath()); + createINSTANCE(pDoc, valueobjectwithpathE, inst); + } + + pParentE.appendChild(valueobjectwithpathE); + return valueobjectwithpathE; + } + + /** + * createIRETURNVALUE_ERROR + * + * @param doc + * @param parentE + * @param error + * @return Element + */ + public static Element createIRETURNVALUE_ERROR(Document doc, Element parentE, CIMError error) { + Element ireturnvalueE = doc.createElement("IRETURNVALUE"); + + parentE.appendChild(ireturnvalueE); + return ireturnvalueE; + } + + /** + * createIRETURNVALUE_GETINSTANCE + * + * @param pDoc + * @param pParentE + * @param pInst + * @return Element + * @throws WBEMException + */ + public static Element createIRETURNVALUE_GETINSTANCE(Document pDoc, Element pParentE, + CIMInstance pInst) throws WBEMException { + Element ireturnvalueE = pDoc.createElement("IRETURNVALUE"); + createINSTANCENAME(pDoc, ireturnvalueE, pInst.getObjectPath()); + + return ireturnvalueE; + } + + /** + * createIRETURNVALUE_ASSOCIATORS_NAMES + * + * @param pDoc + * @param pParentE + * @param pResultSet + * @return Element + * @throws Exception + */ + public static Element createIRETURNVALUE_ASSOCIATORS_NAMES(Document pDoc, Element pParentE, + CIMObjectPath[] pResultSet) throws Exception { + Element ireturnvalueE = pDoc.createElement("IRETURNVALUE"); + + if (pResultSet != null) { + for (int i = 0; i < pResultSet.length; i++) { + CIMObjectPath path = pResultSet[i]; + + if (path.getHost() == null || "".equals(path.getHost())) createLOCALOBJECTPATH( + pDoc, ireturnvalueE, path); + else createOBJECTPATH(pDoc, ireturnvalueE, path); + } + } + pParentE.appendChild(ireturnvalueE); + return ireturnvalueE; + } + + /** + * createIRETURNVALUE_ASSOCIATORS + * + * @param pDoc + * @param pParentE + * @param pResultSet + * @param pNameSpace + * @return Element + * @throws Exception + */ + public static Element createIRETURNVALUE_ASSOCIATORS(Document pDoc, Element pParentE, + Object[] pResultSet, String pNameSpace) throws Exception { + Element ireturnvalueE = pDoc.createElement("IRETURNVALUE"); + if (pResultSet != null) { + for (int i = 0; i < pResultSet.length; i++) { + Object obj = pResultSet[i]; + CIMObjectPath op = null; + if (obj instanceof CIMClass) { + op = ((CIMClass) obj).getObjectPath(); + } else if (obj instanceof CIMInstance) { + op = ((CIMInstance) obj).getObjectPath(); + } else { + throw new WBEMException(WBEMException.CIM_ERR_FAILED, + "object in result set neither class nor instance!"); + } + if (op.getHost() == null || "".equals(op.getHost())) { + createVALUEOBJECTWITHLOCALPATH(pDoc, ireturnvalueE, obj, pNameSpace); + } else { + createVALUEOBJECTWITHPATH(pDoc, ireturnvalueE, obj, pNameSpace); + } + } + } + pParentE.appendChild(ireturnvalueE); + return ireturnvalueE; + } + + /** + * createIRETURNVALUE_ENUMERATE_INSTANCENAME + * + * @param pDoc + * @param pParentE + * @param pResultSet + * @param pNameSpace + * @return Element + * @throws Exception + */ + public static Element createIRETURNVALUE_ENUMERATE_INSTANCENAME(Document pDoc, + Element pParentE, Object[] pResultSet, String pNameSpace) throws Exception { + Element ireturnvalueE = pDoc.createElement("IRETURNVALUE"); + if (pResultSet != null) { + for (int i = 0; i < pResultSet.length; i++) { + Object obj = pResultSet[i]; + CIMObjectPath op = null; + if (obj instanceof CIMClass) { + op = ((CIMClass) obj).getObjectPath(); + } else if (obj instanceof CIMInstance) { + op = ((CIMInstance) obj).getObjectPath(); + } else { + throw new WBEMException(WBEMException.CIM_ERR_FAILED, + "object in result set neither class nor instance!"); + } + if (op.getHost() == null || "".equals(op.getHost())) { + createVALUEOBJECTWITHLOCALPATH(pDoc, ireturnvalueE, obj, pNameSpace); + } else { + createVALUEOBJECTWITHPATH(pDoc, ireturnvalueE, obj, pNameSpace); + } + } + } + pParentE.appendChild(ireturnvalueE); + return ireturnvalueE; + } + + /** + * createIRETURNVALUE + * + * @param pDoc + * @param pParentE + * @param pResultSet + * @return Element + * @throws WBEMException + */ + public static Element createIRETURNVALUE(Document pDoc, Element pParentE, Object[] pResultSet) + throws WBEMException { + Element ireturnvalueE = pDoc.createElement("IRETURNVALUE"); + if (pResultSet != null && pResultSet.length > 0) { + Object obj = pResultSet[0]; + if (obj instanceof CIMClass) { + for (int i = 0; i < pResultSet.length; i++) { + CIMClass clazz = (CIMClass) pResultSet[i]; + Element classnameE = pDoc.createElement("CLASSNAME"); + ireturnvalueE.appendChild(classnameE); + if (clazz.getName() != null) classnameE.setAttribute("NAME", clazz.getName()); + } + } else if (obj instanceof CIMInstance) { + for (int i = 0; i < pResultSet.length; i++) { + CIMInstance inst = (CIMInstance) pResultSet[i]; + createVALUENAMEDINSTANCE(pDoc, ireturnvalueE, inst); + } + } + } + pParentE.appendChild(ireturnvalueE); + return ireturnvalueE; + } + + /** + * createIRETURNVALUE_ENUMERATE_CLASSNAME + * + * @param pDoc + * @param pParentE + * @param pResultSet + * @return Element + */ + public static Element createIRETURNVALUE_ENUMERATE_CLASSNAME(Document pDoc, Element pParentE, + CIMClass[] pResultSet) { + Element ireturnvalueE = pDoc.createElement("IRETURNVALUE"); + if (pResultSet != null && pResultSet.length > 0) { + for (int i = 0; i < pResultSet.length; i++) { + CIMClass clazz = pResultSet[i]; + + Element classnameE = pDoc.createElement("CLASSNAME"); + ireturnvalueE.appendChild(classnameE); + if (clazz.getName() != null) classnameE.setAttribute("NAME", clazz.getName()); + } + } + pParentE.appendChild(ireturnvalueE); + return ireturnvalueE; + } + + /** + * createIndication_response + * + * @param doc + * @param ID + * @param error + * @return Element + */ + // ebak: [ 1656285 ] IndicationHandler does not accept non-Integer message + // ID + public static Element createIndication_response(Document doc, String ID, CIMError error) { + + // xmlBuilder.create XML + Element cimE = createCIM(doc); + Element messageE = createMESSAGE(doc, cimE, ID, "1.0"); + Element simpleexprspE = createSIMPLEEXPRSP(doc, messageE); + Element expmethodresponseE = createEXPMETHODRESPONSE(doc, simpleexprspE, "ExportIndication"); + if (error == null) { + createIRETURNVALUE(doc, expmethodresponseE); + } else { + createERROR(doc, expmethodresponseE, error); + } + // Element + return cimE; + } + + /** + * createIRETURNVALUE_ENUMERATE_INSTANCE + * + * @param pDoc + * @param pParentE + * @param pResultSet + * @return Element + * @throws WBEMException + */ + public static Element createIRETURNVALUE_ENUMERATE_INSTANCE(Document pDoc, Element pParentE, + CIMInstance[] pResultSet) throws WBEMException { + Element ireturnvalueE = pDoc.createElement("IRETURNVALUE"); + if (pResultSet != null && pResultSet.length > 0) { + for (int i = 0; i < pResultSet.length; i++) { + createVALUENAMEDINSTANCE(pDoc, ireturnvalueE, pResultSet[i]); + } + } + pParentE.appendChild(ireturnvalueE); + return ireturnvalueE; + } + + /** + * getTypeStr + * + * @param pType + * @return String + */ + public static String getTypeStr(CIMDataType pType) { + if (pType == null) return "string"; + if (pType.getType() == CIMDataType.REFERENCE) return MOF.REFERENCE; + return MOF.dataType(pType); + } + + /** + * getOpTypeStr + * + * @param pType + * @return String + */ + public static String getOpTypeStr(CIMDataType pType) { + return getTypeStr(pType); + } + + private static final Pattern NAMESPACE_SPLIT_PATTERN = Pattern.compile("/+"); + + /** + * createLOCALNAMESPACEPATH + * + * @param pDoc + * @param pParentE + * @param pName + * @return Element + */ + public static Element createLOCALNAMESPACEPATH(Document pDoc, Element pParentE, + CIMObjectPath pName) { + if (pName == null) return null; + // TODO: name(ObjectPath) should not be null, should an exception be + // thrown? + // This assumes that the NameSpace does not consist exclusively of + // empties like "////" + Element localnamespacepathE = pDoc.createElement("LOCALNAMESPACEPATH"); + String nameSpace = pName.getNamespace(); + if (nameSpace != null) { + String[] nsA = NAMESPACE_SPLIT_PATTERN.split(nameSpace); + for (int i = 0; i < nsA.length; i++) + if (nsA[i] != null && nsA[i].length() > 0) createNAMESPACE(pDoc, + localnamespacepathE, nsA[i]); + } + pParentE.appendChild(localnamespacepathE); + + return localnamespacepathE; + } + + /** + * createSIMPLEEXPREQ + * + * @param pDoc + * @return Element + */ + public static Element createSIMPLEEXPREQ(Document pDoc) { + // + Element e = pDoc.createElement("SIMPLEEXPREQ"); + return e; + } + + /** + * createEXPMETHODCALL + * + * @param pDoc + * @param pParentE + * @param pName + * @return Element + */ + public static Element createEXPMETHODCALL(Document pDoc, Element pParentE, String pName) { + // + // + Element e = pDoc.createElement("EXPMETHODCALL"); + if (pName != null) { + e.setAttribute("NAME", pName); + } + pParentE.appendChild(e); + return e; + } + + /** + * createEXPPARAMVALUE + * + * @param pDoc + * @param pParentE + * @param pName + * @return Element + */ + public static Element createEXPPARAMVALUE(Document pDoc, Element pParentE, String pName) { + // + // + Element e = pDoc.createElement("EXPPARAMVALUE"); + if (pName != null) { + e.setAttribute("NAME", pName); + } + pParentE.appendChild(e); + return e; + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/CIMXMLParseException.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/CIMXMLParseException.java similarity index 65% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/CIMXMLParseException.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/CIMXMLParseException.java index 94e3e02..72424de 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/CIMXMLParseException.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/CIMXMLParseException.java @@ -1,74 +1,72 @@ -/* - CIMXMLParseException.java - - (C) Copyright IBM Corp. 2005, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1535756 2006-08-07 lupusalex Make code warning free - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.IOException; - -/** - * Class CIMXMLParseException is used by the CIM-XML DOM parser. - * - */ -public class CIMXMLParseException extends IOException { - - private static final long serialVersionUID = 1237082621297618586L; - - /** - * Ctor. - */ - public CIMXMLParseException() { - super(); - } - - /** - * Ctor. - * - * @param reason - */ - public CIMXMLParseException(String reason) { - super(reason); - } -} +/* + CIMXMLParseException.java + + (C) Copyright IBM Corp. 2005, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1535756 2006-08-07 lupusalex Make code warning free + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.IOException; + +/** + * Class CIMXMLParseException is used by the CIM-XML DOM parser. + * + */ +public class CIMXMLParseException extends IOException { + + private static final long serialVersionUID = 1237082621297618586L; + + /** + * Ctor. + */ + public CIMXMLParseException() { + super(); + } + + /** + * Ctor. + * + * @param reason + */ + public CIMXMLParseException(String reason) { + super(reason); + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/CIMXMLParserImpl.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/CIMXMLParserImpl.java similarity index 95% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/CIMXMLParserImpl.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/CIMXMLParserImpl.java index 712c74c..e97b6bf 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/CIMXMLParserImpl.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/CIMXMLParserImpl.java @@ -1,3884 +1,3881 @@ -/* - CIMXMLParserImpl.java - - (C) Copyright IBM Corp. 2005, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1464860 2006-05-15 lupusalex No default value for VALUETYPE assumed - * 1535756 2006-08-07 lupusalex Make code warning free - * 1547910 2006-09-05 ebak parseIMETHODCALL() CIMObjectPath parsing problem - * 1547908 2006-09-05 ebak parseKEYBINDING() creates incorrect reference type - * 1545915 2006-09-05 ebak Wrong parsing of IMETHODCALL request - * 1660756 2007-03-02 ebak Embedded object support - * 1689085 2007-04-10 ebak Embedded object enhancements for Pegasus - * 1669961 2006-04-16 lupusalex CIMTypedElement.getType() =>getDataType() - * 1712656 2007-05-04 ebak Correct type identification for SVC CIMOM - * 1714878 2007-05-08 ebak Empty string property values are parsed as nulls - * 1737141 2007-06-18 ebak Sync up with JSR48 evolution - * 1769504 2007-08-15 ebak Type identification for VALUETYPE="numeric" - * 1783288 2007-09-10 ebak CIMClass.isAssociation() not working for retrieved classes. - * 1820763 2007-10-29 ebak Supporting the EmbeddedInstance qualifier - * 1827728 2007-11-20 ebak rework: embeddedInstances: attribute EmbeddedObject not set - * 1848607 2007-12-11 ebak Strict EmbeddedObject types - * 1944875 2008-05-29 blaschke-oss Indications with embedded objects are not accepted - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2210455 2008-10-30 blaschke-oss Enhance javadoc, fix potential null pointers - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2714989 2009-03-26 blaschke-oss Code cleanup from redundant null check et al - * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors - * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics - * 2823494 2009-08-03 rgummada Change Boolean constructor to static - * 2860081 2009-09-17 raman_arora Pull Enumeration Feature (DOM Parser) - * 2957387 2010-03-03 blaschke-oss EmbededObject XML attribute must not be all uppercases - * 3023143 2010-07-01 blaschke-oss CIMXMLParserImpl uses # constructor instead of valueOf - * 3027479 2010-07-09 blaschke-oss Dead store to local variable - * 3027615 2010-07-12 blaschke-oss Use CLASS_ARRAY_T instead of new CIMDataType(CLASS,0) - * 3293248 2011-05-03 blaschke-oss Support for CIM_ERROR instances within ERROR - * 3297028 2011-05-03 blaschke-oss Instances contain CIMClassProperty with DOM parser - * 3411944 2011-09-20 blaschke-oss createJavaObject exception with hex uint - * 3513353 2012-03-30 blaschke-oss TCK: CIMDataType arrays must have length >= 1 - * 3513349 2012-03-31 blaschke-oss TCK: CIMDataType must not accept null string - * 3466280 2012-04-23 blaschke-oss get instance failure for CIM_IndicationSubscription - * 3521119 2012-04-24 blaschke-oss JSR48 1.0.0: remove CIMObjectPath 2/3/4-parm ctors - * 3526679 2012-05-14 blaschke-oss DOM parser ignores ERROR node CODE - * 3572993 2012-10-01 blaschke-oss parseDouble("2.2250738585072012e-308") DoS vulnerability - * 3598613 2013-01-11 blaschke-oss different data type in cim instance and cim object path - * 2616 2013-02-23 blaschke-oss Add new API WBEMClientSBLIM.sendIndication() - * 2636 2013-05-08 blaschke-oss Nested embedded instances cause CIMXMLParseException - * 2640 2013-05-11 blaschke-oss Multiple CDATA parsing broken in DOM parser - * 2668 2013-09-24 blaschke-oss Potential null pointer exception in parseCIM - * 2669 2013-09-24 blaschke-oss Potential null pointer exception in parseMESSAGE - * 2670 2013-09-25 blaschke-oss NAME attribute not required by DOM parser - * 2671 2013-09-25 blaschke-oss Potential null pointer exception in parseERROR - * 2675 2013-09-27 blaschke-oss CIMXMLParseException messages should contain element name - * 2676 2013-09-27 blaschke-oss parseMULTI(EXP)REQ looking for wrong child elements - * 2678 2013-09-30 blaschke-oss parseMULTI___ allows one SIMPLE___ child element - * 2679 2013-10-01 blaschke-oss parseIMETHODCALL requires one IPARAMVALUE child element - * 2680 2013-10-02 blaschke-oss IPARAMVALUE parsing broken on DOM/SAX - * 2681 2013-10-02 blaschke-oss parseQUALIFIERDECLARATION does not require TYPE attribute - * 2683 2013-10-07 blaschke-oss KEYVALUE VALUETYPE optional, "string" default - * 2684 2013-10-07 blaschke-oss parseEXPMETHODRESPONSE has several issues - * 2685 2013-10-07 blaschke-oss Element.getAttribute returns empty string if no attribute - * 2686 2013-10-10 blaschke-oss parseEXPPARAMVALUE allows 2+ children, prohibits 0 - * 2688 2013-10-10 blaschke-oss parseMETHODCALL looks for CIMName attribute instead of NAME - * 2537 2013-10-17 blaschke-oss Add new data types for PARAMVALUE - * 2691 2013-10-18 blaschke-oss RETURNVALUE should not require PARAMTYPE attribute - * 2694 2013-10-25 blaschke-oss NAME attribute not required by DOM parser (part 2) - * 2695 2013-10-25 blaschke-oss parseMETHODCALL allows LOCALCLASSPATH and LOCALINSTANCEPATH - * 2696 2013-10-29 blaschke-oss parseIRETURNVALUE ignores VALUE and VALUE.ARRAY - * 2699 2013-11-05 blaschke-oss parseQUALIFIER does not require TYPE attribute - * 2700 2013-11-07 blaschke-oss PROPERTY does not require TYPE attribute - * 2701 2013-11-07 blaschke-oss PROPERTY.ARRAY does not require TYPE attribute - * 2702 2013-11-07 blaschke-oss Bad PROPERTY.ARRAY ARRAYSIZE generates NumberFormatException - * 2703 2013-11-08 blaschke-oss MethodNode should not require TYPE attribute - * 2704 2013-11-11 blaschke-oss PARAMETER does not require TYPE attribute - * 2705 2013-11-11 blaschke-oss PARAMETER.ARRAY does not require TYPE attribute - * 2706 2013-11-11 blaschke-oss Bad PARAMETER.REFARRAY ARRAYSIZE generates NumberFormatException - * 2707 2013-11-12 blaschke-oss INSTANCENAME ignores KEYVALUE and VALUE.REFERENCE children - * 2710 2013-11-13 blaschke-oss parseVALUEOBJECTWITH(LOCAL)PATH ignores (LOCAL)CLASSPATH child - * 2711 2013-11-13 blaschke-oss LOCALNAMESPACEPATH allows 0 NAMESPACE children - * 2713 2013-11-22 blaschke-oss Enforce loose validation of CIM-XML documents - * 2715 2013-11-26 blaschke-oss Add VALUE.NULL support - * 2538 2013-11-28 blaschke-oss CR14: Support new CORRELATOR element - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.StringReader; -import java.math.BigInteger; -import java.util.Comparator; -import java.util.HashMap; -import java.util.TreeMap; -import java.util.Vector; -import java.util.logging.Level; - -import org.sentrysoftware.wbem.javax.cim.CIMArgument; -import org.sentrysoftware.wbem.javax.cim.CIMClass; -import org.sentrysoftware.wbem.javax.cim.CIMClassProperty; -import org.sentrysoftware.wbem.javax.cim.CIMDataType; -import org.sentrysoftware.wbem.javax.cim.CIMDateTime; -import org.sentrysoftware.wbem.javax.cim.CIMDateTimeAbsolute; -import org.sentrysoftware.wbem.javax.cim.CIMDateTimeInterval; -import org.sentrysoftware.wbem.javax.cim.CIMFlavor; -import org.sentrysoftware.wbem.javax.cim.CIMInstance; -import org.sentrysoftware.wbem.javax.cim.CIMMethod; -import org.sentrysoftware.wbem.javax.cim.CIMNamedElementInterface; -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; -import org.sentrysoftware.wbem.javax.cim.CIMParameter; -import org.sentrysoftware.wbem.javax.cim.CIMProperty; -import org.sentrysoftware.wbem.javax.cim.CIMQualifier; -import org.sentrysoftware.wbem.javax.cim.CIMQualifierType; -import org.sentrysoftware.wbem.javax.cim.CIMScope; -import org.sentrysoftware.wbem.javax.cim.UnsignedInteger16; -import org.sentrysoftware.wbem.javax.cim.UnsignedInteger32; -import org.sentrysoftware.wbem.javax.cim.UnsignedInteger64; -import org.sentrysoftware.wbem.javax.cim.UnsignedInteger8; -import org.sentrysoftware.wbem.javax.wbem.WBEMException; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cim.CIMHelper; -import org.sentrysoftware.wbem.sblim.cimclient.internal.cim.CIMQualifiedElementInterfaceImpl; -import org.sentrysoftware.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; -import org.sentrysoftware.wbem.sblim.cimclient.internal.util.MOF; -import org.sentrysoftware.wbem.sblim.cimclient.internal.util.Util; -import org.sentrysoftware.wbem.sblim.cimclient.internal.util.WBEMConfiguration; -import org.sentrysoftware.wbem.sblim.cimclient.internal.util.XMLHostStr; -import org.w3c.dom.Attr; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.w3c.dom.Text; -import org.xml.sax.InputSource; - -/** - * Class CIMXMLParserImpl is the main class of CIM-XML DOM parser. - * - */ -public class CIMXMLParserImpl { - - /* - * ebak: local object path - should be used by parseLOCALCLASSPATH(), - * parseLOCALINSTANCEPATH(), parseCLASSNAME(), parseINSTANCENAME(), - * parseCLASS() and parseINSTANCE() - */ - private static LocalPathBuilder cLocalPathBuilder = new LocalPathBuilder(null); - - /** - * setLocalObjectPath - * - * @param pLocalOp - * - empty fields of parsed objectpaths will be substituted by - * fields coming from this parameter - */ - public static void setLocalObjectPath(CIMObjectPath pLocalOp) { - cLocalPathBuilder = new LocalPathBuilder(pLocalOp); - } - - /* - * / local object path - */ - - /** - * parseCIM - * - * @param pCimE - * @return CIMMessage - * @throws CIMXMLParseException - */ - public static CIMMessage parseCIM(Element pCimE) throws CIMXMLParseException { - // - // - Attr cim_cimversionA = (Attr) searchAttribute(pCimE, "CIMVERSION"); - if (cim_cimversionA == null) throw new CIMXMLParseException( - "CIM element missing CIMVERSION attribute!"); - String cimversion = cim_cimversionA.getNodeValue(); - - Attr cim_dtdversionA = (Attr) searchAttribute(pCimE, "DTDVERSION"); - if (cim_dtdversionA == null) throw new CIMXMLParseException( - "CIM element missing DTDVERSION attribute!"); - String dtdversion = cim_dtdversionA.getNodeValue(); - - // MESSAGE - Element messageA[] = searchNodes(pCimE, "MESSAGE", 0, 1, false); - if (messageA != null) { - CIMMessage message = parseMESSAGE(cimversion, dtdversion, messageA[0]); - message.setCIMVersion(cimversion); - message.setDTDVersion(dtdversion); - return message; - } - - // DECLARATION - if (searchNodes(pCimE, "DECLARATION", 0, 1, false) != null) throw new CIMXMLParseException( - "DECLARATION element not supported!"); - - throw new CIMXMLParseException("CIM element missing required child element!"); - } - - // //////////////////////////////////////////////////////////////////////////////////////// - // Value Elements - // //////////////////////////////////////////////////////////////////////////////////////// - - /** - * parseVALUE - supports the non-standard TYPE attribute - * - * @param pValueE - * @return TypedValue, type is null if no TYPE attribute was found, the - * value is always String, the caller method have to convert it. - * @throws CIMXMLParseException - */ - public static TypedValue parseVALUE(Element pValueE) throws CIMXMLParseException { - // - - String typeStr = attribute(pValueE, "TYPE"); - CIMDataType type = typeStr == null ? null : parseScalarTypeStr(typeStr); - // ebak: empty VALUE element is parsed as empty String - NodeList list = pValueE.getChildNodes(); - StringBuilder valueStr = new StringBuilder(); - for (int i = 0; i < list.getLength(); i++) { - Text t = (Text) list.item(i); - if (t != null) { - String nodeValue = t.getNodeValue(); - if (nodeValue != null) valueStr.append(nodeValue); - } - } - return new TypedValue(type, valueStr.toString()); - } - - /** - * parseVALUEARRAY - supports the non-standard TYPE attribute - * - * @param pValueArrayE - * @return TypedValue, type is null if no TYPE attribute was found, the - * value is always String[], the caller method have to convert it. - * @throws CIMXMLParseException - */ - public static TypedValue parseVALUEARRAY(Element pValueArrayE) throws CIMXMLParseException { - // - String typeStr = attribute(pValueArrayE, "TYPE"); - CIMDataType type = typeStr == null ? null : parseArrayTypeStr(typeStr); - - // Process node list here, order of VALUE/VALUE.NULL IS important - NodeList nl = pValueArrayE.getChildNodes(); - if (nl == null || nl.getLength() == 0) return new TypedValue(type, new String[0]); - Vector resStringV = new Vector(); - for (int i = 0; i < nl.getLength(); i++) { - Node n = nl.item(i); - if (n instanceof Text && "".equalsIgnoreCase(n.getNodeValue().trim())) continue; - String name = n.getNodeName(); - if (name.equals("VALUE")) { - resStringV.add((String) parseVALUE((Element) n).getValue()); - } else if (name.equals("VALUE.NULL")) { - resStringV.add(null); - } else if (NODENAME_HASH.containsKey(name)) { throw new CIMXMLParseException( - "VALUE.ARRAY element contains invalid child element " + name + "!"); } - } - return new TypedValue(type, resStringV.toArray(new String[0])); - } - - /** - * parseVALUEREFERENCE - * - * @param pValuereferenceE - * @return CIMObjectPath - * @throws CIMXMLParseException - */ - public static CIMObjectPath parseVALUEREFERENCE(Element pValuereferenceE) - throws CIMXMLParseException { - // - - // CLASSPATH - Element classpathA[] = searchNodes(pValuereferenceE, "CLASSPATH", 0, 1, false); - if (classpathA != null) { - CIMObjectPath op = parseCLASSPATH(classpathA[0]); - return op; - } - - // LOCALCLASSPATH - Element localclasspathA[] = searchNodes(pValuereferenceE, "LOCALCLASSPATH", 0, 1, false); - if (localclasspathA != null) { - CIMObjectPath op = parseLOCALCLASSPATH(localclasspathA[0]); - return op; - } - - // CLASSNAME - Element classnameA[] = searchNodes(pValuereferenceE, "CLASSNAME", 0, 1, false); - if (classnameA != null) { - CIMObjectPath op = parseCLASSNAME(classnameA[0]); - if (op != null && op.getNamespace() != null) { - // LocalPathBuilder includes default namespace in CLASSNAME - // elements, needs to be stripped - op = new CIMObjectPath(op.getScheme(), op.getHost(), op.getPort(), null, op - .getObjectName(), op.getKeys(), op.getXmlSchemaName()); - } - return op; - } - - // INSTANCEPATH - Element instancepathA[] = searchNodes(pValuereferenceE, "INSTANCEPATH", 0, 1, false); - if (instancepathA != null) { - CIMObjectPath op = parseINSTANCEPATH(instancepathA[0]); - return op; - } - - // LOCALINSTANCEPATH - Element localinstancepathA[] = searchNodes(pValuereferenceE, "LOCALINSTANCEPATH", 0, 1, - false); - if (localinstancepathA != null) { - CIMObjectPath op = parseLOCALINSTANCEPATH(localinstancepathA[0]); - return op; - } - - // INSTANCENAME - Element instancenameA[] = searchNodes(pValuereferenceE, "INSTANCENAME", 0, 1, false); - if (instancenameA != null) { - CIMObjectPath op = parseINSTANCENAME(instancenameA[0]); - if (op != null && op.getNamespace() != null) { - // LocalPathBuilder includes default namespace in INSTANCENAME - // elements, needs to be stripped - op = new CIMObjectPath(op.getScheme(), op.getHost(), op.getPort(), null, op - .getObjectName(), op.getKeys(), op.getXmlSchemaName()); - } - return op; - } - - throw new CIMXMLParseException("VALUE.REFERENCE element missing required child element!"); - } - - /** - * parseVALUEREFARRAY - * - * @param pValueRefArrayE - * @return CIMObjectPath[] - * @throws CIMXMLParseException - */ - public static CIMObjectPath[] parseVALUEREFARRAY(Element pValueRefArrayE) - throws CIMXMLParseException { - // - - // Process node list here, order of VALUE.REFERENCE/VALUE.NULL IS - // important - NodeList nl = pValueRefArrayE.getChildNodes(); - if (nl == null || nl.getLength() == 0) return new CIMObjectPath[0]; - Vector resObjectPathV = new Vector(); - for (int i = 0; i < nl.getLength(); i++) { - Node n = nl.item(i); - if (n instanceof Text && "".equalsIgnoreCase(n.getNodeValue().trim())) continue; - String name = n.getNodeName(); - if (name.equals("VALUE.REFERENCE")) { - resObjectPathV.add(parseVALUEREFERENCE((Element) n)); - } else if (name.equals("VALUE.NULL")) { - resObjectPathV.add(null); - } else if (NODENAME_HASH.containsKey(name)) { throw new CIMXMLParseException( - "VALUE.REFARRAY element contains invalid child element " + name + "!"); } - } - return resObjectPathV.toArray(new CIMObjectPath[0]); - } - - /** - * parseVALUEOBJECT - * - * @param pValueObjectE - * @return CIMNamedElementInterface (CIMClass|CIMInstance) - * @throws CIMXMLParseException - */ - public static CIMNamedElementInterface parseVALUEOBJECT(Element pValueObjectE) - throws CIMXMLParseException { - // - - // CLASS - Element classA[] = searchNodes(pValueObjectE, "CLASS", 0, 1, false); - if (classA != null) { - CIMClass obj = parseCLASS(classA[0]); - return obj; - } - - // INSTANCE - Element instanceA[] = searchNodes(pValueObjectE, "INSTANCE", 0, 1, false); - if (instanceA != null) { - CIMInstance obj = parseINSTANCE(instanceA[0]); - return obj; - } - - throw new CIMXMLParseException("VALUE.OBJECT element missing required child element!"); - } - - private static final String nodesVALUENAMEDINSTANCE[] = { "INSTANCENAME", "INSTANCE" }; - - /** - * parseVALUENAMEDINSTANCE - * - * @param pValueNamedInstanceE - * @return CIMInstance - * @throws CIMXMLParseException - */ - public static CIMInstance parseVALUENAMEDINSTANCE(Element pValueNamedInstanceE) - throws CIMXMLParseException { - // - - // INSTANCENAME - Element instancenameA[] = searchNodes(pValueNamedInstanceE, "INSTANCENAME", 1, 1, true); - if (instancenameA == null) { throw new CIMXMLParseException( - "VALUE.NAMEDINSTANCE element missing INSTANCENAME child element!"); } - CIMObjectPath op = parseINSTANCENAME(instancenameA[0]); - - // INSTANCE - Element instanceA[] = searchNodes(pValueNamedInstanceE, "INSTANCE", 1, 1, true); - if (instanceA == null) { throw new CIMXMLParseException( - "VALUE.NAMEDINSTANCE element missing INSTANCE child element!"); } - CIMInstance inst = parseINSTANCE(instanceA[0], op); // BB mod - checkOtherNodes(pValueNamedInstanceE, nodesVALUENAMEDINSTANCE); - return inst; - } - - private static final String nodesVALUEINSTANCEWITHPATH[] = { "INSTANCEPATH", "INSTANCE" }; - - /** - * parseVALUEINSTANCEWITHPATH - * - * @param pValueNamedInstanceE - * @return CIMInstance - * @throws CIMXMLParseException - */ - public static CIMInstance parseVALUEINSTANCEWITHPATH(Element pValueNamedInstanceE) - throws CIMXMLParseException { - // - - // INSTANCEPATH - Element instancepathA[] = searchNodes(pValueNamedInstanceE, "INSTANCEPATH", 1, 1, true); - if (instancepathA == null) { throw new CIMXMLParseException( - "VALUE.INSTANCEWITHPATH element missing INSTANCEPATH child element!"); } - CIMObjectPath op = parseINSTANCEPATH(instancepathA[0]); - - // INSTANCE - Element instanceA[] = searchNodes(pValueNamedInstanceE, "INSTANCE", 1, 1, true); - if (instanceA == null) { throw new CIMXMLParseException( - "VALUE.INSTANCEWITHPATH element missing INSTANCE child element!"); } - CIMInstance inst = parseINSTANCE(instanceA[0], op); // BB mod - checkOtherNodes(pValueNamedInstanceE, nodesVALUEINSTANCEWITHPATH); - return inst; - } - - private static final String nodesVALUENAMEDOBJECTi[] = { "INSTANCENAME", "INSTANCE" }; - - /** - * parseVALUENAMEDOBJECT - * - * @param pValueNamedObjectE - * @return CIMNamedElementInterface - * @throws CIMXMLParseException - */ - public static CIMNamedElementInterface parseVALUENAMEDOBJECT(Element pValueNamedObjectE) - throws CIMXMLParseException { - // - - // CLASS - Element classA[] = searchNodes(pValueNamedObjectE, "CLASS", 0, 1, false); - if (classA != null) { - CIMClass obj = parseCLASS(classA[0]); - // checkOtherNodes(pValueNamedObjectE, nodesVALUENAMEDOBJECTc); - return obj; - } - - // INSTANCENAME - Element instancenameA[] = searchNodes(pValueNamedObjectE, "INSTANCENAME", 0, 1, true); - if (instancenameA != null) { - CIMObjectPath op = parseINSTANCENAME(instancenameA[0]); - - // INSTANCE - Element instanceA[] = searchNodes(pValueNamedObjectE, "INSTANCE", 0, 1, true); - if (instanceA == null) { throw new CIMXMLParseException( - "VALUE.NAMEDOBJECT element missing INSTANCE child element!"); } - CIMInstance inst = parseINSTANCE(instanceA[0], op); // BB mod - checkOtherNodes(pValueNamedObjectE, nodesVALUENAMEDOBJECTi); - return inst; - } - - throw new CIMXMLParseException("VALUE.NAMEDOBJECT element missing required child element!"); - } - - private static final String nodesVALUEOBJECTWITHPATHcls[] = { "CLASSPATH", "CLASS" }; - - private static final String nodesVALUEOBJECTWITHPATHins[] = { "INSTANCEPATH", "INSTANCE" }; - - /** - * parseVALUEOBJECTWITHPATH - * - * @param pValueObjectWithPathE - * @return CIMNamedElementInterface - * @throws CIMXMLParseException - */ - public static CIMNamedElementInterface parseVALUEOBJECTWITHPATH(Element pValueObjectWithPathE) - throws CIMXMLParseException { - // - - // CLASSPATH - Element classpathA[] = searchNodes(pValueObjectWithPathE, "CLASSPATH", 0, 1, true); - if (classpathA != null) { - CIMObjectPath op = parseCLASSPATH(classpathA[0]); - - // CLASS - Element classA[] = searchNodes(pValueObjectWithPathE, "CLASS", 0, 1, true); - if (classA == null) { throw new CIMXMLParseException( - "VALUE.OBJECTWITHPATH element missing CLASS child element!"); } - - CIMClass obj = parseCLASS(classA[0], op); - checkOtherNodes(pValueObjectWithPathE, nodesVALUEOBJECTWITHPATHcls); - return obj; - } - - // INSTANCEPATH - Element instancepathA[] = searchNodes(pValueObjectWithPathE, "INSTANCEPATH", 0, 1, true); - if (instancepathA != null) { - CIMObjectPath op = parseINSTANCEPATH(instancepathA[0]); - - // INSTANCE - Element instanceA[] = searchNodes(pValueObjectWithPathE, "INSTANCE", 0, 1, true); - if (instanceA == null) { throw new CIMXMLParseException( - "VALUE.OBJECTWITHPATH element missing INSTANCE child element!"); } - CIMInstance inst = parseINSTANCE(instanceA[0], op); // BB mod - checkOtherNodes(pValueObjectWithPathE, nodesVALUEOBJECTWITHPATHins); - return inst; - } - - throw new CIMXMLParseException( - "VALUE.OBJECTWITHPATH element missing required child element!"); - } - - private static final String nodesVALUEOBJECTWITHLOCALPATHcls[] = { "LOCALCLASSPATH", "CLASS" }; - - private static final String nodesVALUEOBJECTWITHLOCALPATHins[] = { "LOCALINSTANCEPATH", - "INSTANCE" }; - - /** - * parseVALUEOBJECTWITHLOCALPATH - * - * @param pValueObjectWithLocalPathE - * @return CIMNamedElementInterface - * @throws CIMXMLParseException - */ - public static CIMNamedElementInterface parseVALUEOBJECTWITHLOCALPATH( - Element pValueObjectWithLocalPathE) throws CIMXMLParseException { - // - - // LOCALCLASSPATH - Element localclasspathA[] = searchNodes(pValueObjectWithLocalPathE, "LOCALCLASSPATH", 0, 1, - true); - if (localclasspathA != null) { - CIMObjectPath op = parseLOCALCLASSPATH(localclasspathA[0]); - - // CLASS - Element classA[] = searchNodes(pValueObjectWithLocalPathE, "CLASS", 0, 1, true); - if (classA == null) { throw new CIMXMLParseException( - "VALUE.OBJECTWITHLOCALPATH element missing CLASS child element!"); } - - CIMClass obj = parseCLASS(classA[0], op); - checkOtherNodes(pValueObjectWithLocalPathE, nodesVALUEOBJECTWITHLOCALPATHcls); - return obj; - } - - // LOCALINSTANCEPATH - Element localinstancepathA[] = searchNodes(pValueObjectWithLocalPathE, "LOCALINSTANCEPATH", - 0, 1, true); - if (localinstancepathA != null) { - CIMObjectPath op = parseLOCALINSTANCEPATH(localinstancepathA[0]); - - // INSTANCE - Element instanceA[] = searchNodes(pValueObjectWithLocalPathE, "INSTANCE", 0, 1, true); - if (instanceA == null) { throw new CIMXMLParseException( - "VALUE.OBJECTWITHLOCALPATH element missing INSTANCE child element!"); } - CIMInstance inst = parseINSTANCE(instanceA[0], op); // BB mod - checkOtherNodes(pValueObjectWithLocalPathE, nodesVALUEOBJECTWITHLOCALPATHins); - return inst; - } - - throw new CIMXMLParseException( - "VALUE.OBJECTWITHLOCALPATH element missing required child element!"); - } - - // //////////////////////////////////////////////////////////////////////////////////////// - // Naming and Location elements - // //////////////////////////////////////////////////////////////////////////////////////// - - private static final String nodesNAMESPACEPATH[] = { "HOST", "LOCALNAMESPACEPATH" }; - - /** - * parseNAMESPACEPATH - * - * @param pNameSpacePathE - * @return CIMObjectPath - * @throws CIMXMLParseException - */ - public static CIMObjectPath parseNAMESPACEPATH(Element pNameSpacePathE) - throws CIMXMLParseException { - // - // HOST - Element hostA[] = searchNodes(pNameSpacePathE, "HOST", 1, 1, true); - if (hostA == null) { throw new CIMXMLParseException( - "NAMESPACEPATH element missing HOST child element!"); } - XMLHostStr xmlHostStr = new XMLHostStr(parseHOST(hostA[0])); - // LOCALNAMESPACE - Element localnamespacepathA[] = searchNodes(pNameSpacePathE, "LOCALNAMESPACEPATH", 1, 1, - true); - if (localnamespacepathA == null) { throw new CIMXMLParseException( - "NAMESPACEPATH element missing LOCALNAMESPACEPATH child element!"); } - String nameSpace = parseLOCALNAMESPACEPATH(localnamespacepathA[0]); - /* - * CIMObjectPath( String scheme, String host, String port, String - * namespace, String objectName, CIMProperty[] keys ) - */ - checkOtherNodes(pNameSpacePathE, nodesNAMESPACEPATH); - return new CIMObjectPath(xmlHostStr.getProtocol(), xmlHostStr.getHost(), xmlHostStr - .getPort(), nameSpace, null, null); - } - - /** - * parseLOCALNAMESPACEPATH - * - * @param pLocalNameSpaceE - * @return String - * @throws CIMXMLParseException - */ - public static String parseLOCALNAMESPACEPATH(Element pLocalNameSpaceE) - throws CIMXMLParseException { - // - - Element[] nameSpaceElementA = searchNodes(pLocalNameSpaceE, "NAMESPACE", 1, - Integer.MAX_VALUE, false); - if (nameSpaceElementA == null) { - if (WBEMConfiguration.getGlobalConfiguration().allowEmptyLocalNameSpacePath() - && cLocalPathBuilder != null) return cLocalPathBuilder.getBasePath() - .getNamespace(); - throw new CIMXMLParseException( - "LOCALNAMESPACEPATH element missing NAMESPACE child element!"); - } - StringBuffer sb = new StringBuffer(); - for (int i = 0; i < nameSpaceElementA.length; i++) { - Element namespaceE = nameSpaceElementA[i]; - String s = parseNAMESPACE(namespaceE); - if (i > 0) sb.append("/" + s); - else sb.append(s); - } - return sb.toString(); - } - - /** - * parseHOST - * - * @param pHostE - * @return String - */ - public static String parseHOST(Element pHostE) { - // - - Text valueT = (Text) searchFirstChild(pHostE); - String host = valueT.getNodeValue(); - return host; - } - - private static final String nodesNAMESPACE[] = {}; - - /** - * parseNAMESPACE - * - * @param pNameSpaceE - * @return String - * @throws CIMXMLParseException - */ - public static String parseNAMESPACE(Element pNameSpaceE) throws CIMXMLParseException { - // - // - - Attr namespace_nameA = (Attr) searchAttribute(pNameSpaceE, "NAME"); - if (namespace_nameA == null) throw new CIMXMLParseException( - "NAMESPACE element missing NAME attribute!"); - String n = namespace_nameA.getValue(); - checkOtherNodes(pNameSpaceE, nodesNAMESPACE); - return n; - } - - private static final String nodesCLASSPATH[] = { "NAMESPACEPATH", "CLASSNAME" }; - - /** - * parseCLASSPATH - * - * @param pClassPathE - * @return CIMObjectPath - * @throws CIMXMLParseException - */ - public static CIMObjectPath parseCLASSPATH(Element pClassPathE) throws CIMXMLParseException { - // - - // NAMESPACEPATH - Element namespacepathA[] = searchNodes(pClassPathE, "NAMESPACEPATH", 1, 1, true); - if (namespacepathA == null) { throw new CIMXMLParseException( - "CLASSPATH element missing NAMESPACEPATH child element!"); } - CIMObjectPath nsPath = parseNAMESPACEPATH(namespacepathA[0]); - // CLASSNAME - Element classnameA[] = searchNodes(pClassPathE, "CLASSNAME", 1, 1, true); - if (classnameA == null) { throw new CIMXMLParseException( - "CLASSPATH element missing CLASSNAME child element!"); } - String className = parseClassName(classnameA[0]); - /* - * CIMObjectPath( String scheme, String host, String port, String - * namespace, String objectName, CIMProperty[] keys ) - */ - checkOtherNodes(pClassPathE, nodesCLASSPATH); - return new CIMObjectPath(nsPath.getScheme(), nsPath.getHost(), nsPath.getPort(), nsPath - .getNamespace(), className, null); - } - - private static final String nodesLOCALCLASSPATH[] = { "LOCALNAMESPACEPATH", "CLASSNAME" }; - - /** - * parseLOCALCLASSPATH - * - * @param pClassPathE - * @return CIMObjectPath - * @throws CIMXMLParseException - */ - public static CIMObjectPath parseLOCALCLASSPATH(Element pClassPathE) - throws CIMXMLParseException { - // - - // NAMESPACEPATH - Element localnamespacepathA[] = searchNodes(pClassPathE, "LOCALNAMESPACEPATH", 1, 1, true); - if (localnamespacepathA == null) { throw new CIMXMLParseException( - "LOCALCLASSPATH element missing LOCALNAMESPACEPATH child element!"); } - String nameSpace = parseLOCALNAMESPACEPATH(localnamespacepathA[0]); - - // CLASSNAME - Element classnameA[] = searchNodes(pClassPathE, "CLASSNAME", 1, 1, true); - if (classnameA == null) { throw new CIMXMLParseException( - "LOCALCLASSPATH element missing CLASSNAME child element!"); } - CIMObjectPath op = parseCLASSNAME(classnameA[0]); - checkOtherNodes(pClassPathE, nodesLOCALCLASSPATH); - return cLocalPathBuilder.build(op.getObjectName(), nameSpace); - } - - private static final String nodesCLASSNAME[] = {}; - - /** - * parseClassName - * - * @param pClassNameE - * @return String - * @throws CIMXMLParseException - */ - public static String parseClassName(Element pClassNameE) throws CIMXMLParseException { - // - // - Attr classname_nameA = (Attr) searchAttribute(pClassNameE, "NAME"); - if (classname_nameA == null) throw new CIMXMLParseException( - "CLASSNAME element missing NAME attribute!"); - checkOtherNodes(pClassNameE, nodesCLASSNAME); - return classname_nameA.getNodeValue(); - } - - /** - * parseCLASSNAME - * - * @param pClassNameE - * @return CIMObjectPath - * @throws CIMXMLParseException - */ - public static CIMObjectPath parseCLASSNAME(Element pClassNameE) throws CIMXMLParseException { - return cLocalPathBuilder.build(parseClassName(pClassNameE), null); - } - - private static final String nodesINSTANCEPATH[] = { "NAMESPACEPATH", "INSTANCENAME" }; - - /** - * parseINSTANCEPATH - * - * @param pInstancePathE - * @return CIMObjectPath - * @throws CIMXMLParseException - */ - public static CIMObjectPath parseINSTANCEPATH(Element pInstancePathE) - throws CIMXMLParseException { - // - - // NAMESPACEPATH - Element namespacepathA[] = searchNodes(pInstancePathE, "NAMESPACEPATH", 1, 1, true); - if (namespacepathA == null) { throw new CIMXMLParseException( - "INSTANCEPATH element missing NAMESPACEPATH child element!"); } - CIMObjectPath nsPath = parseNAMESPACEPATH(namespacepathA[0]); - // INSTANCENAME - Element instancenameA[] = searchNodes(pInstancePathE, "INSTANCENAME", 1, 1, true); - if (instancenameA == null) { throw new CIMXMLParseException( - "INSTANCEPATH element missing INSTANCENAME child element!"); } - CIMObjectPath op = parseINSTANCENAME(instancenameA[0]); - // ebak: change host and namespace - checkOtherNodes(pInstancePathE, nodesINSTANCEPATH); - return new CIMObjectPath(nsPath.getScheme(), nsPath.getHost(), nsPath.getPort(), nsPath - .getNamespace(), op.getObjectName(), op.getKeys()); - } - - private static final String nodesLOCALINSTANCEPATH[] = { "LOCALNAMESPACEPATH", "INSTANCENAME" }; - - /** - * parseLOCALINSTANCEPATH - * - * @param pLocalInstancePathE - * @return CIMObjectPath - * @throws CIMXMLParseException - */ - public static CIMObjectPath parseLOCALINSTANCEPATH(Element pLocalInstancePathE) - throws CIMXMLParseException { - // - - // LOCALNAMESPACEPATH - Element localnamespacepathA[] = searchNodes(pLocalInstancePathE, "LOCALNAMESPACEPATH", 1, - 1, true); - if (localnamespacepathA == null) { throw new CIMXMLParseException( - "LOCALINSTANCEPATH element missing LOCALNAMESPACEPATH child element!"); } - String nameSpace = parseLOCALNAMESPACEPATH(localnamespacepathA[0]); - - // INSTANCENAME - Element instancenameA[] = searchNodes(pLocalInstancePathE, "INSTANCENAME", 1, 1, true); - if (instancenameA == null) { throw new CIMXMLParseException( - "LOCALINSTANCEPATH element missing INSTANCENAME child element!"); } - CIMObjectPath op = parseINSTANCENAME(instancenameA[0]); - /* - * CIMObjectPath(String objectName, String namespace, CIMProperty[] - * keys) - */ - checkOtherNodes(pLocalInstancePathE, nodesLOCALINSTANCEPATH); - return cLocalPathBuilder.build(op.getObjectName(), nameSpace, op.getKeys()); - } - - private static final String nodesINSTANCENAME[] = { "KEYBINDING", "KEYVALUE", "VALUE.REFERENCE" }; - - /** - * parseINSTANCENAME - * - * @param pInstanceNameE - * @return CIMObjectPath - * @throws CIMXMLParseException - */ - public static CIMObjectPath parseINSTANCENAME(Element pInstanceNameE) - throws CIMXMLParseException { - // - // - Attr instance_classnameA = (Attr) searchAttribute(pInstanceNameE, "CLASSNAME"); - if (instance_classnameA == null) throw new CIMXMLParseException( - "INSTANCENAME element missing CLASSNAME attribute!"); - String opClassName = instance_classnameA.getNodeValue(); - - // KEYBINDING - Element[] keyBindingElementA = searchNodes(pInstanceNameE, "KEYBINDING", 0, - Integer.MAX_VALUE, false); - if (keyBindingElementA != null) { - CIMProperty[] keys = new CIMProperty[keyBindingElementA.length]; - for (int i = 0; i < keyBindingElementA.length; i++) { - Element keybindingE = keyBindingElementA[i]; - keys[i] = parseKEYBINDING(keybindingE); - } - return cLocalPathBuilder.build(opClassName, null, keys); - } - - // KEYVALUE - Element keyvalueA[] = searchNodes(pInstanceNameE, "KEYVALUE", 0, 1, false); - if (keyvalueA != null) { - CIMProperty[] keys = new CIMProperty[1]; - TypedValue propTypedVal = parseKEYVALUE(keyvalueA[0]); - keys[0] = new CIMProperty("", propTypedVal.getType(), propTypedVal.getValue(), - true, false, null); - return cLocalPathBuilder.build(opClassName, null, keys); - } - - // VALUE.REFERENCE - Element valuereferenceA[] = searchNodes(pInstanceNameE, "VALUE.REFERENCE", 0, 1, false); - if (valuereferenceA != null) { - CIMProperty[] keys = new CIMProperty[1]; - CIMObjectPath op = parseVALUEREFERENCE(valuereferenceA[0]); - keys[0] = new CIMProperty("", new CIMDataType(op.getObjectName()), op, - true, false, null); - return cLocalPathBuilder.build(opClassName, null, keys); - } - - checkOtherNodes(pInstanceNameE, nodesINSTANCENAME); - - return new CIMObjectPath(null, null, null, null, opClassName, null); - } - - /** - * parseOBJECTPATH - * - * @param pObjectPathE - * @return CIMObjectPath - * @throws CIMXMLParseException - */ - public static CIMObjectPath parseOBJECTPATH(Element pObjectPathE) throws CIMXMLParseException { - // - - // INSTANCEPATH - Element instancepathA[] = searchNodes(pObjectPathE, "INSTANCEPATH", 0, 1, false); - if (instancepathA != null) { - CIMObjectPath op = parseINSTANCEPATH(instancepathA[0]); - return op; - } - - // CLASSPATH - Element classpathA[] = searchNodes(pObjectPathE, "CLASSPATH", 0, 1, false); - if (classpathA != null) { - CIMObjectPath op = parseCLASSPATH(classpathA[0]); - return op; - } - - throw new CIMXMLParseException("OBJECTPATH element missing required child element!"); - } - - /** - * parseKEYBINDING - * - * @param pKeyBindingE - * @return CIMProperty - * @throws CIMXMLParseException - */ - public static CIMProperty parseKEYBINDING(Element pKeyBindingE) throws CIMXMLParseException { - // - // - - Attr keybinding_nameA = (Attr) searchAttribute(pKeyBindingE, "NAME"); - if (keybinding_nameA == null) throw new CIMXMLParseException( - "KEYBINDING element missing NAME attribute!"); - String propName = keybinding_nameA.getValue(); - - // KEYVALUE - Element keyvalueA[] = searchNodes(pKeyBindingE, "KEYVALUE", 0, 1, false); - if (keyvalueA != null) { - TypedValue propTypedVal = parseKEYVALUE(keyvalueA[0]); - return new CIMProperty(propName, propTypedVal.getType(), propTypedVal - .getValue(), true, false, null); - } - - // VALUE.REFERENCE - Element valuereferenceA[] = searchNodes(pKeyBindingE, "VALUE.REFERENCE", 0, 1, false); - if (valuereferenceA != null) { - CIMObjectPath op = parseVALUEREFERENCE(valuereferenceA[0]); - return new CIMProperty(propName, new CIMDataType(op.getObjectName()), - op, true, false, null); - } - - throw new CIMXMLParseException("KEYBINDING element missing required child element!"); - } - - private static final TreeMap TYPESTR_MAP = new TreeMap( - new Comparator() { - - public int compare(Object pO1, Object pO2) { - return ((String) pO1).compareToIgnoreCase((String) pO2); - } - - }); - - static { - TYPESTR_MAP.put(MOF.DT_UINT8, CIMDataType.UINT8_T); - TYPESTR_MAP.put(MOF.DT_UINT16, CIMDataType.UINT16_T); - TYPESTR_MAP.put(MOF.DT_UINT32, CIMDataType.UINT32_T); - TYPESTR_MAP.put(MOF.DT_UINT64, CIMDataType.UINT64_T); - TYPESTR_MAP.put(MOF.DT_SINT8, CIMDataType.SINT8_T); - TYPESTR_MAP.put(MOF.DT_SINT16, CIMDataType.SINT16_T); - TYPESTR_MAP.put(MOF.DT_SINT32, CIMDataType.SINT32_T); - TYPESTR_MAP.put(MOF.DT_SINT64, CIMDataType.SINT64_T); - TYPESTR_MAP.put(MOF.DT_REAL32, CIMDataType.REAL32_T); - TYPESTR_MAP.put(MOF.DT_REAL64, CIMDataType.REAL64_T); - TYPESTR_MAP.put(MOF.DT_CHAR16, CIMDataType.CHAR16_T); - TYPESTR_MAP.put(MOF.DT_STR, CIMDataType.STRING_T); - TYPESTR_MAP.put(MOF.DT_BOOL, CIMDataType.BOOLEAN_T); - TYPESTR_MAP.put(MOF.DT_DATETIME, CIMDataType.DATETIME_T); - // FIXME: ebak: What to do with those types which are not specified by - // MOF's BNF? - TYPESTR_MAP.put(MOF.INVALID, CIMDataType.INVALID_T); - // FIXME: ebak: What is the string representation of OBJECT? - TYPESTR_MAP.put("object", CIMDataType.OBJECT_T); - TYPESTR_MAP.put(MOF.CLASS, CIMDataType.CLASS_T); - TYPESTR_MAP.put(MOF.REFERENCE, new CIMDataType("")); - } - - /** - * parseScalarTypeStr - * - * @param pTypeStr - * @return CIMDataType - * @throws CIMXMLParseException - */ - public static CIMDataType parseScalarTypeStr(String pTypeStr) throws CIMXMLParseException { - return parseTypeStr(pTypeStr, false); - } - - /** - * parseArrayTypeStr - * - * @param pTypeStr - * @return CIMDataType - * @throws CIMXMLParseException - */ - public static CIMDataType parseArrayTypeStr(String pTypeStr) throws CIMXMLParseException { - return parseTypeStr(pTypeStr, true); - } - - /** - * parseTypeStr - * - * @param pTypeStr - * @param pArray - * @return CIMDataType - * @throws CIMXMLParseException - */ - public static CIMDataType parseTypeStr(String pTypeStr, boolean pArray) - throws CIMXMLParseException { - if (pTypeStr == null) return pArray ? CIMDataType.STRING_ARRAY_T : CIMDataType.STRING_T; - CIMDataType type = TYPESTR_MAP.get(pTypeStr); - if (type == null) throw new CIMXMLParseException("Unknown TYPE string:" + pTypeStr); - if (pArray) { - if (type.getType() == CIMDataType.REFERENCE) return new CIMDataType(type - .getRefClassName(), 0); - return CIMHelper.UnboundedArrayDataType(type.getType()); - } - return type; - } - - /** - * parseKEYVALUE - * - * @param pKeyValueE - * @return TypedValue - * @throws CIMXMLParseException - */ - public static TypedValue parseKEYVALUE(Element pKeyValueE) throws CIMXMLParseException { - /* - * - */ - // ebak: if TYPE attribute is included there is no need to deal with - // VALUETYPE attribute - String typeStr = attribute(pKeyValueE, "TYPE"); - - Text valueT = (Text) searchFirstChild(pKeyValueE); - String valueStr = valueT == null ? null : valueT.getNodeValue(); - - if (typeStr == null) { - String valueTypeStr = attribute(pKeyValueE, "VALUETYPE"); - if (valueTypeStr == null) valueTypeStr = "string"; - ValueTypeHandler vtHandler = new ValueTypeHandler(valueTypeStr, valueStr); - return new TypedValue(vtHandler.getType(), vtHandler.getValue()); - } - Object value = valueStr == null ? "" : createJavaObject(typeStr, valueStr); - return new TypedValue(parseScalarTypeStr(typeStr), value); - } - - /** - * Class ValueTypeHandler determines the value and type of a KEYVALUE XML - * element, when the VALUETYPE attribute is provided instead of the exact - * TYPE attribute. There is a very similar code section in the PULL and SAX - * parser, but that section wasn't made common since in ideal case the DOM - * parser will be removed. - */ - private static class ValueTypeHandler { - - private CIMDataType iType; - - private Object iValue; - - /** - * - * Ctor. - * - * @param pValueTypeStr - * @param pValueStr - * @throws CIMXMLParseException - */ - public ValueTypeHandler(String pValueTypeStr, String pValueStr) throws CIMXMLParseException { - - if (pValueTypeStr == null) throw new CIMXMLParseException( - "KEYVALUE element missing VALUETYPE attribute!"); - - if (pValueTypeStr.equals("numeric")) { - if (!setUInt64(pValueStr) && !setSInt64(pValueStr) && !setReal64(pValueStr)) throw new CIMXMLParseException( - "Unparseable \"number\" value: " + pValueStr + " !"); - } else if (pValueTypeStr.equals(MOF.DT_STR)) { - if (!setDTAbsolute(pValueStr) && !setDTInterval(pValueStr)) { - this.iValue = pValueStr; - this.iType = CIMDataType.STRING_T; - } - } else if (pValueTypeStr.equals(MOF.DT_BOOL)) { - if (!setBoolean(pValueStr)) throw new CIMXMLParseException( - "Unparseable \"boolean\" value: " + pValueStr + " !"); - } else { - throw new CIMXMLParseException("KEYVALUE element's VALUETYPE attribute must be " - + MOF.DT_STR + ", " + MOF.DT_BOOL + " or numeric! " + pValueStr - + " is not allowed!"); - } - } - - /** - * - * getType - * - * @return CIMDataType - */ - public CIMDataType getType() { - return this.iType; - } - - /** - * - * getValue - * - * @return Object - */ - public Object getValue() { - return this.iValue; - } - - private boolean setUInt64(String pValue) { - try { - this.iValue = new UnsignedInteger64(pValue); - } catch (NumberFormatException e) { - return false; - } - this.iType = CIMDataType.UINT64_T; - return true; - } - - private boolean setSInt64(String pValue) { - try { - this.iValue = new Long(pValue); - } catch (NumberFormatException e) { - return false; - } - this.iType = CIMDataType.SINT64_T; - return true; - } - - private boolean setReal64(String pValue) { - try { - if (WBEMConfiguration.getGlobalConfiguration().verifyJavaLangDoubleStrings()) { - if (Util.isBadDoubleString(pValue)) return false; - } - this.iValue = new Double(pValue); - } catch (NumberFormatException e) { - return false; - } - this.iType = CIMDataType.REAL64_T; - return true; - } - - private boolean setBoolean(String pValue) { - this.iValue = Boolean.valueOf(pValue); - this.iType = CIMDataType.BOOLEAN_T; - return true; - } - - private boolean setDTAbsolute(String pValue) { - try { - this.iValue = new CIMDateTimeAbsolute(pValue); - } catch (IllegalArgumentException e) { - return false; - } - this.iType = CIMDataType.DATETIME_T; - return true; - } - - private boolean setDTInterval(String pValue) { - try { - this.iValue = new CIMDateTimeInterval(pValue); - } catch (IllegalArgumentException e) { - return false; - } - this.iType = CIMDataType.DATETIME_T; - return true; - } - } - - // //////////////////////////////////////////////////////////////////////////////////////// - // Object Definition Elements - // //////////////////////////////////////////////////////////////////////////////////////// - - private static String attribute(Element pElement, String pName) { - String attrib = pElement.getAttribute(pName); - if (attrib == null || attrib.length() == 0) return null; - return attrib; - } - - private static final String[] nodesCLASS = { "QUALIFIER", "PROPERTY", "PROPERTY.ARRAY", - "PROPERTY.REFERENCE", "METHOD" }; - - /** - * parseCLASS - * - * @param pClassE - * @return CIMClass - * @throws CIMXMLParseException - */ - public static CIMClass parseCLASS(Element pClassE) throws CIMXMLParseException { - return parseCLASS(pClassE, null); - } - - /** - * parseCLASS - * - * @param pClassE - * @param pObjectPath - * @return CIMClass - * @throws CIMXMLParseException - */ - public static CIMClass parseCLASS(Element pClassE, CIMObjectPath pObjectPath) - throws CIMXMLParseException { - // - // - - Attr class_nameA = (Attr) searchAttribute(pClassE, "NAME"); - if (class_nameA == null) throw new CIMXMLParseException( - "CLASS element missing NAME attribute!"); - String name = class_nameA.getNodeValue(); - - // Attr superclass_nameA = (Attr)searchAttribute(classE, "SUPERCLASS"); - // String supername = superclass_nameA.getNodeValue(); - - String superClass = attribute(pClassE, "SUPERCLASS"); - - // QUALIFIER - CIMQualifier[] qualis = parseQUALIFIERS(pClassE); - - // PROPERTY - CIMClassProperty[] props = parseCLASSPROPERTIES(pClassE); - - // METHOD - Element[] methodElementA = searchNodes(pClassE, "METHOD", 0, Integer.MAX_VALUE, true); - CIMMethod[] methods; - if (methodElementA != null) { - methods = new CIMMethod[methodElementA.length]; - for (int i = 0; i < methodElementA.length; i++) { - Element methodE = methodElementA[i]; - methods[i] = parseMETHOD(methodE); - } - } else { - methods = null; - } - - /* - * CIMClass( String name, String superclass, CIMQualifier[] qualifiers, - * CIMClassProperty[] props, CIMMethod[] methods ) - * - * return new CIMClass( name, superClass, qualis, props, methods ); - * - * This constructor can provide localPath info. CIMClass( CIMObjectPath - * path, String superclass, CIMQualifier[] qualifiers, - * CIMClassProperty[] props, CIMMethod[] pMethods, boolean - * pIsAssociation, boolean pIsKeyed ) - */ - checkOtherNodes(pClassE, nodesCLASS); - - return new CIMClass( - pObjectPath == null ? cLocalPathBuilder.build(name, null) : pObjectPath, - superClass, qualis, props, methods, hasAssocQuali(qualis), hasKeyProp(props)); - } - - private static boolean hasAssocQuali(CIMQualifier[] pQualis) { - if (pQualis == null) return false; - for (int i = 0; i < pQualis.length; i++) { - CIMQualifier quali = pQualis[i]; - if ("ASSOCIATION".equalsIgnoreCase(quali.getName()) - && Boolean.TRUE.equals(quali.getValue())) return true; - } - return false; - } - - private static boolean hasKeyProp(CIMProperty[] pProps) { - if (pProps == null) return false; - for (int i = 0; i < pProps.length; i++) - if (pProps[i].isKey()) return true; - return false; - } - - private static CIMParameter[] parseParameters(Element pMethodE) throws CIMXMLParseException { - // PARAMETER - Vector> paramV = new Vector>(); - Element[] paramElementA = searchNodes(pMethodE, "PARAMETER"); - if (paramElementA != null) { - for (int i = 0; i < paramElementA.length; i++) { - Element parameterE = paramElementA[i]; - CIMParameter p = parsePARAMETER(parameterE); - paramV.add(p); - } - } - - Element[] paramRefElementA = searchNodes(pMethodE, "PARAMETER.REFERENCE"); - if (paramRefElementA != null) { - for (int i = 0; i < paramRefElementA.length; i++) { - Element parameterE = paramRefElementA[i]; - CIMParameter p = parsePARAMETERREFERENCE(parameterE); - paramV.add(p); - } - } - - Element[] paramArrayElementA = searchNodes(pMethodE, "PARAMETER.ARRAY"); - if (paramArrayElementA != null) { - for (int i = 0; i < paramArrayElementA.length; i++) { - Element parameterE = paramArrayElementA[i]; - CIMParameter p = parsePARAMETERARRAY(parameterE); - paramV.add(p); - } - } - - Element[] paramRefArrayElementA = searchNodes(pMethodE, "PARAMETER.REFARRAY"); - if (paramRefArrayElementA != null) { - for (int i = 0; i < paramRefArrayElementA.length; i++) { - Element parameterE = paramRefArrayElementA[i]; - CIMParameter p = parsePARAMETERREFARRAY(parameterE); - paramV.add(p); - } - } - - return paramV.toArray(new CIMParameter[0]); - } - - private static final String nodesMETHOD[] = { "QUALIFIER", "PARAMETER", "PARAMETER.REFERENCE", - "PARAMETER.ARRAY", "PARAMETER.REFARRAY" }; - - /** - * parseMETHOD - * - * @param pMethodE - * @return CIMMethod - * @throws CIMXMLParseException - */ - public static CIMMethod parseMETHOD(Element pMethodE) throws CIMXMLParseException { - // - // - - String name = attribute(pMethodE, "NAME"); - if (name == null) throw new CIMXMLParseException("METHOD element missing NAME attribute!"); - EmbObjHandler embObjHandler = new EmbObjHandler(pMethodE); - CIMDataType type = embObjHandler.getType(); - if (type != null && type.isArray()) throw new CIMXMLParseException( - "Method's type cannot be Array!"); - String classOrigin = attribute(pMethodE, "CLASSORIGIN"); - String propagatedStr = pMethodE.getAttribute("PROPAGATED"); - boolean propagated = "true".equalsIgnoreCase(propagatedStr); - - checkOtherNodes(pMethodE, nodesMETHOD); - - // PARAMETERS - CIMParameter[] params = parseParameters(pMethodE); - // CIMMethod(String name, CIMDataType type, CIMQualifier[] qualifiers, - // CIMParameter[] parameters, boolean propagated, String originClass) - return new CIMMethod(name, type, embObjHandler.getQualifiers(), params, propagated, - classOrigin); - } - - private static final String nodesPARAMETER[] = { "QUALIFIER" }; - - /** - * parsePARAMETER - * - * @param pParamE - * @return CIMParameter - * @throws CIMXMLParseException - */ - public static CIMParameter parsePARAMETER(Element pParamE) throws CIMXMLParseException { - String name = attribute(pParamE, "NAME"); - if (name == null) throw new CIMXMLParseException( - "PARAMETER element missing NAME attribute!"); - if (attribute(pParamE, "TYPE") == null) throw new CIMXMLParseException( - "PARAMETER element missing TYPE attribute!"); - checkOtherNodes(pParamE, nodesPARAMETER); - EmbObjHandler iEmbObjHandler = new EmbObjHandler(pParamE); - // CIMParameter(String name, CIMDataType type, CIMQualifier[] - // qualifiers) - return new CIMParameter(name, iEmbObjHandler.getType(), iEmbObjHandler - .getQualifiers()); - } - - private static final String nodesPARAMETERREFERENCE[] = { "QUALIFIER" }; - - /** - * parsePARAMETERREFERENCE - * - * @param pParamE - * @return CIMParameter - * @throws CIMXMLParseException - */ - public static CIMParameter parsePARAMETERREFERENCE(Element pParamE) - throws CIMXMLParseException { - String name = attribute(pParamE, "NAME"); - if (name == null) throw new CIMXMLParseException( - "PARAMETER.REFERENCE element missing NAME attribute!"); - String referenceClass = attribute(pParamE, "REFERENCECLASS"); - CIMDataType type = new CIMDataType(referenceClass != null ? referenceClass : ""); - checkOtherNodes(pParamE, nodesPARAMETERREFERENCE); - // QUALIFIER - CIMQualifier[] qualis = parseQUALIFIERS(pParamE); - return new CIMParameter(name, type, qualis); - } - - private static final String nodesPARAMETERARRAY[] = { "QUALIFIER" }; - - /** - * parsePARAMETERARRAY - * - * @param pParamE - * @return CIMParameter - * @throws CIMXMLParseException - */ - public static CIMParameter parsePARAMETERARRAY(Element pParamE) - throws CIMXMLParseException { - String name = attribute(pParamE, "NAME"); - if (name == null) throw new CIMXMLParseException( - "PARAMETER.ARRAY element missing NAME attribute!"); - if (attribute(pParamE, "TYPE") == null) throw new CIMXMLParseException( - "PARAMETER.ARRAY element missing TYPE attribute!"); - String arraySizeStr = pParamE.getAttribute("ARRAYSIZE"); - try { - if (arraySizeStr.length() > 0) Integer.parseInt(arraySizeStr); - } catch (NumberFormatException e) { - throw new CIMXMLParseException(arraySizeStr - + " is not a valid ARRAYSIZE attribute for PARAMETER.ARRAY!"); - } - checkOtherNodes(pParamE, nodesPARAMETERARRAY); - EmbObjHandler iEmbObjHandler = new EmbObjHandler(pParamE); - return new CIMParameter(name, iEmbObjHandler.getArrayType(), iEmbObjHandler - .getQualifiers()); - } - - private static final String nodesPARAMETERREFARRAY[] = { "QUALIFIER" }; - - /** - * parsePARAMETERREFARRAY - * - * @param pParamE - * @return CIMParameter - * @throws CIMXMLParseException - */ - public static CIMParameter parsePARAMETERREFARRAY(Element pParamE) - throws CIMXMLParseException { - String name = attribute(pParamE, "NAME"); - if (name == null) throw new CIMXMLParseException( - "PARAMETER.REFARRAY element missing NAME attribute!"); - - String referenceClass = attribute(pParamE, "REFERENCECLASS"); - - int arraySize = 0; // unlimited - String arraySizeStr = pParamE.getAttribute("ARRAYSIZE"); - try { - if (arraySizeStr.length() > 0) arraySize = Integer.parseInt(arraySizeStr); - } catch (NumberFormatException e) { - throw new CIMXMLParseException(arraySizeStr - + " is not a valid ARRAYSIZE attribute for PARAMETER.REFARRAY!"); - } - - CIMDataType type = new CIMDataType((referenceClass != null) ? referenceClass : "", - arraySize); - - // QUALIFIER - checkOtherNodes(pParamE, nodesPARAMETERREFARRAY); - CIMQualifier[] qualis = parseQUALIFIERS(pParamE); - return new CIMParameter(name, type, qualis); - } - - /** - * parseINSTANCE - * - * @param pInstanceE - * @return CIMInstance - * @throws CIMXMLParseException - */ - public static CIMInstance parseINSTANCE(Element pInstanceE) throws CIMXMLParseException { - return parseINSTANCE(pInstanceE, null); - } - - private static final String[] nodesINSTANCE = { "QUALIFIER", "PROPERTY", "PROPERTY.ARRAY", - "PROPERTY.REFERENCE" }; - - /** - * parseINSTANCE - * - * @param pInstanceE - * @param pObjPath - * @return CIMInstance - * @throws CIMXMLParseException - */ - public static CIMInstance parseINSTANCE(Element pInstanceE, CIMObjectPath pObjPath) - throws CIMXMLParseException { - // - // - - // BB mod CIMInstance inst = new CIMInstance(); - String className = attribute(pInstanceE, "CLASSNAME"); - if (className == null) throw new CIMXMLParseException( - "INSTANCE element missing CLASSNAME attribute!"); - // QUALIFIER - // FIXME: in JSR48 CIMInstance doesn't have qualifiers - // CIMQualifier[] qualis = parseQUALIFIERS(pInstanceE); - // PROPERTY - CIMProperty[] props = parsePROPERTIES(pInstanceE); - - checkOtherNodes(pInstanceE, nodesINSTANCE); - - if (pObjPath == null) return new CIMInstance(cLocalPathBuilder.build(className, null), - props); - if (WBEMConfiguration.getGlobalConfiguration().synchronizeNumericKeyDataTypes()) return CIMHelper - .CIMInstanceWithSynchonizedNumericKeyDataTypes(pObjPath, props); - return new CIMInstance(pObjPath, props); - } - - /** - * ebak: Access to enclosing method parseQUALIFIERS(Element) from the type - * CIMXMLParserImpl is emulated by a synthetic accessor method. Increasing - * its visibility will improve your performance - * - * @param pElement - * @return CIMQualifier[] - * @throws CIMXMLParseException - */ - public static CIMQualifier[] parseQUALIFIERS(Element pElement) throws CIMXMLParseException { - Element[] qualiElementA = searchNodes(pElement, "QUALIFIER"); - CIMQualifier[] qualis; - if (qualiElementA != null) { - qualis = new CIMQualifier[qualiElementA.length]; - for (int i = 0; i < qualiElementA.length; i++) { - Element qualifierE = qualiElementA[i]; - qualis[i] = parseQUALIFIER(qualifierE); - } - } else qualis = null; - return qualis; - } - - /** - *
      -	 *  ENTITY % QualifierFlavor "
      -	 *  OVERRIDABLE    (true|false)  'true'
      -	 *  TOSUBCLASS     (true|false)  'true'
      -	 *  TOINSTANCE     (true|false)  'false'
      -	 *  TRANSLATABLE   (true|false)  'false'"
      -	 * 
      - * - * @param pElement - * @return int - CIMFlavor bit mixture - */ - private static int parseFLAVORS(Element pElement) { - int flavors = 0; - if (!getBoolAttribute(pElement, "OVERRIDABLE", true)) flavors |= CIMFlavor.DISABLEOVERRIDE; - if (!getBoolAttribute(pElement, "TOSUBCLASS", true)) flavors |= CIMFlavor.RESTRICTED; - if (getBoolAttribute(pElement, "TRANSLATABLE", false)) flavors |= CIMFlavor.TRANSLATE; - return flavors; - } - - private static TypedValue parseSingleValue(Element pElement) throws CIMXMLParseException { - return parseSingleValue(pElement, VALUE | VALUEA); - } - - private static final int VALUE = 1, VALUEA = 2, VALUEREF = 4, VALUEREFA = 8; - - private static TypedValue parseSingleValue(Element pElement, int pMask) - throws CIMXMLParseException { - boolean foundSingleValue = false; - String typeStr = attribute(pElement, "TYPE"); - // ebak: there was an ESS fix in the base implementation - if (typeStr == null) typeStr = attribute(pElement, "PARAMTYPE"); - CIMDataType type = null; - Object value = null; - if ((pMask & VALUE) > 0) { - Element valueE = (Element) searchFirstNode(pElement, "VALUE"); - if (valueE != null) { - TypedValue tVal = parseVALUE(valueE); - String valueStr = (String) tVal.getValue(); - type = typeStr == null ? tVal.getType() : parseScalarTypeStr(typeStr); - value = createJavaObject(type == null ? null : type.toString(), valueStr); - foundSingleValue = true; - } - } - if (!foundSingleValue && (pMask & VALUEREF) > 0) { - // VALUE.REFERENCE - Element valuereferenceE = (Element) searchFirstNode(pElement, "VALUE.REFERENCE"); - if (valuereferenceE != null) { - CIMObjectPath op = parseVALUEREFERENCE(valuereferenceE); - value = op; - type = new CIMDataType(op.getObjectName()); - foundSingleValue = true; - } - } - if (!foundSingleValue && (pMask & VALUEA) > 0) { - // VALUE.ARRAY - Element valuearrayE = (Element) searchFirstNode(pElement, "VALUE.ARRAY"); - if (valuearrayE != null) { - TypedValue tValA = parseVALUEARRAY(valuearrayE); - type = typeStr == null ? tValA.getType() : parseArrayTypeStr(typeStr); - String[] valStrA = (String[]) tValA.getValue(); - if (valStrA != null) { - Object[] values = new Object[valStrA.length]; - for (int i = 0; i < valStrA.length; i++) { - values[i] = createJavaObject(type == null ? null : type.toString(), - valStrA[i]); - } - value = values; - } - foundSingleValue = true; - } - } - if (!foundSingleValue && (pMask & VALUEREFA) > 0) { - // VALUE.REFARRAY - Element valueRefArrayE = (Element) searchFirstNode(pElement, "VALUE.REFARRAY"); - if (valueRefArrayE != null) { - type = new CIMDataType("", 0); - CIMObjectPath[] opA = parseVALUEREFARRAY(valueRefArrayE); - value = opA; - foundSingleValue = true; - } - } - if (!foundSingleValue) { - if (value instanceof Object[]) type = CIMDataType.STRING_ARRAY_T; - else if (value != null) type = CIMDataType.STRING_T; - else type = CIMDataType.STRING_T; // /throw new - // CIMXMLParseException("null - // type with null value!"); - } - return new TypedValue(type, value); - } - - private static final String nodesQUALIFIER[] = { "VALUE", "VALUE.ARRAY" }; - - /** - * parseQUALIFIER - * - * @param pQualifierE - * @return CIMQualifier - * @throws CIMXMLParseException - */ - public static CIMQualifier parseQUALIFIER(Element pQualifierE) throws CIMXMLParseException { - // - // - - String name = attribute(pQualifierE, "NAME"); - if (name == null) throw new CIMXMLParseException( - "QUALIFIER element missing NAME attribute!"); - String typeStr = attribute(pQualifierE, "TYPE"); - if (typeStr == null && !hasTypeAttrsInNodes(pQualifierE)) throw new CIMXMLParseException( - "QUALIFIER element missing TYPE attribute!"); - boolean propagated = MOF.TRUE.equalsIgnoreCase(pQualifierE.getAttribute("PROPAGATED")); - // FLAVORS - int flavors = parseFLAVORS(pQualifierE); - // VALUE - if (searchNodes(pQualifierE, "VALUE", 0, 1, false) != null - || searchNodes(pQualifierE, "VALUE.ARRAY", 0, 1, false) != null) { - TypedValue typedValue = parseSingleValue(pQualifierE); - if (typedValue.getType() == null) throw new CIMXMLParseException( - "Qualifier's type is null!"); - // CIMQualifier(String pName, CIMDataType pType, Object pValue, int - // pFlavor) - return new CIMQualifier(name, typedValue.getType(), typedValue.getValue(), - flavors, propagated); - } - checkOtherNodes(pQualifierE, nodesQUALIFIER); - - CIMDataType type = parseScalarTypeStr(typeStr); - return new CIMQualifier(name, type != null ? type : CIMDataType.STRING_T, null, - flavors, propagated); - } - - /** - * parseQUALIFIERDECLARATION - * - * @param pQualifierTypeE - * @return CIMQualifierType - * @throws CIMXMLParseException - */ - public static CIMQualifierType parseQUALIFIERDECLARATION(Element pQualifierTypeE) - throws CIMXMLParseException { - // - // - - String name = attribute(pQualifierTypeE, "NAME"); - if (name == null) throw new CIMXMLParseException( - "QUALIFIER.DECLARATION element missing NAME attribute!"); - String type = attribute(pQualifierTypeE, "TYPE"); - if (type == null && !hasTypeAttrsInNodes(pQualifierTypeE)) throw new CIMXMLParseException( - "QUALIFIER.DECLARATION element missing TYPE attribute!"); - - // SCOPES - // ebak: there should be only 1 scope node - Element scopeElementA[] = searchNodes(pQualifierTypeE, "SCOPE", 0, 1, true); - int scopes = scopeElementA == null ? 0 : parseSCOPES(scopeElementA[0]); - // QUALIFIERS - // CIMQualifier[] qualis = parseQUALIFIERS(pQualifierTypeE); - - CIMDataType qdType; - Object qdValue; - - String nodes[] = null; - - if (searchNodes(pQualifierTypeE, "VALUE", 0, 1, true) != null) { - nodes = new String[] { "SCOPE", "VALUE" }; - } else if (searchNodes(pQualifierTypeE, "VALUE.ARRAY", 0, 1, true) != null) { - nodes = new String[] { "SCOPE", "VALUE.ARRAY" }; - } - - // VALUE - if (nodes != null) { - TypedValue typedValue = parseSingleValue(pQualifierTypeE); - qdType = typedValue.getType(); - qdValue = typedValue.getValue(); - boolean isArray = hasTrueAttribute(pQualifierTypeE, "ISARRAY"); - String arraySizeStr = attribute(pQualifierTypeE, "ARRAYSIZE"); - try { - int arraySize = (arraySizeStr == null ? (isArray ? 0 : -1) : Integer - .parseInt(arraySizeStr)); - if (isArray || arraySize >= 0) { - qdType = (arraySize > 0) ? new CIMDataType(qdType.getType(), arraySize) - : CIMHelper.UnboundedArrayDataType(qdType.getType()); - } - } catch (NumberFormatException e) { - throw new CIMXMLParseException(arraySizeStr - + " is not a valid ARRAYSIZE attribute for QUALIFIER.DECLARATION!"); - } - } else { - nodes = new String[] { "SCOPE" }; - qdType = parseScalarTypeStr(type); - if (qdType == null) qdType = CIMDataType.STRING_T; - qdValue = null; - } - checkOtherNodes(pQualifierTypeE, nodes); - - // FIXME: ebak: what about the flavors? - return new CIMQualifierType(new CIMObjectPath(null, null, null, null, name, null), - qdType, qdValue, scopes, 0); - } - - private static boolean hasTrueAttribute(Element pElement, String pName) { - String valueStr = pElement.getAttribute(pName); - return MOF.TRUE.equalsIgnoreCase(valueStr); - } - - private static boolean getBoolAttribute(Element pElement, String pName, boolean pDefVal) { - String val = pElement.getAttribute(pName); - if (MOF.TRUE.equalsIgnoreCase(val)) return true; - if (MOF.FALSE.equalsIgnoreCase(val)) return false; - return pDefVal; - } - - /** - * parseSCOPES - * - * @param pScopeE - * @return int - */ - public static int parseSCOPES(Element pScopeE) { - int scopes = 0; - if (hasTrueAttribute(pScopeE, "CLASS")) scopes |= CIMScope.CLASS; - if (hasTrueAttribute(pScopeE, "ASSOCIATION")) scopes |= CIMScope.ASSOCIATION; - if (hasTrueAttribute(pScopeE, "REFERENCE")) scopes |= CIMScope.REFERENCE; - if (hasTrueAttribute(pScopeE, "PROPERTY")) scopes |= CIMScope.PROPERTY; - if (hasTrueAttribute(pScopeE, "METHOD")) scopes |= CIMScope.METHOD; - if (hasTrueAttribute(pScopeE, "PARAMETER")) scopes |= CIMScope.PARAMETER; - if (hasTrueAttribute(pScopeE, "INDICATION")) scopes |= CIMScope.INDICATION; - return scopes; - } - - private static Vector> parseClassPropsToVec(Element pElement) - throws CIMXMLParseException { - Element[] propElementA = searchNodes(pElement, "PROPERTY"); - Vector> propVec = new Vector>(); - if (propElementA != null) { - for (int i = 0; i < propElementA.length; i++) { - Element propertyE = propElementA[i]; - propVec.add(parseCLASSPROPERTY(propertyE)); - - } - } - - // PROPERTY.ARRAY - Element[] propArrayElementA = searchNodes(pElement, "PROPERTY.ARRAY"); - if (propArrayElementA != null) { - for (int i = 0; i < propArrayElementA.length; i++) { - Element propertyarrayE = propArrayElementA[i]; - propVec.add(parseCLASSPROPERTYARRAY(propertyarrayE)); - } - } - - // PROPERTY.REFERENCE - Element[] propRefElementA = searchNodes(pElement, "PROPERTY.REFERENCE"); - if (propRefElementA != null) { - for (int i = 0; i < propRefElementA.length; i++) { - Element propertyreferenceE = propRefElementA[i]; - propVec.add(parseCLASSPROPERTYREFERENCE(propertyreferenceE)); - } - } - return propVec; - } - - /** - * parsePROPERTIES - * - * @param pElement - * @return CIMProperty[] - * @throws CIMXMLParseException - */ - public static CIMProperty[] parsePROPERTIES(Element pElement) throws CIMXMLParseException { - Vector> classPropVec = parseClassPropsToVec(pElement); - // The following does not convert Vector to - // CIMProperty[], it is still CIMClassProperty[]!!! You can treat it - // like a CIMProperty (property.getValue(), etc.) but (property - // instanceof CIMProperty) will return false! - // return classPropVec.toArray(new CIMProperty[0]); - - int arraySize = classPropVec.size(); - CIMProperty[] retA = new CIMProperty[arraySize]; - for (int i = 0; i < arraySize; i++) { - CIMClassProperty prop = classPropVec.get(i); - retA[i] = new CIMProperty(prop.getName(), prop.getDataType(), prop.getValue(), - prop.isKey(), prop.isPropagated(), prop.getOriginClass()); - } - return retA; - } - - /** - * parseCLASSPROPERTIES - * - * @param pElement - * @return CIMClassProperty[] - * @throws CIMXMLParseException - */ - public static CIMClassProperty[] parseCLASSPROPERTIES(Element pElement) - throws CIMXMLParseException { - Vector> classPropVec = parseClassPropsToVec(pElement); - return classPropVec.toArray(new CIMClassProperty[0]); - } - - /** - * parsePROPERTY - * - * @param pPropertyE - * @return CIMProperty - * @throws CIMXMLParseException - */ - public static CIMProperty parsePROPERTY(Element pPropertyE) throws CIMXMLParseException { - return parseCLASSPROPERTY(pPropertyE); - } - - private static class EmbObjHandler { - - private CIMQualifier[] iQualiA; - - private boolean iHasEmbObjAttr, iHasEmbInstAttr, iHasEmbObjQuali, iHasEmbInstQuali, iKeyed; - - private CIMDataType iRawType, iType; - - private Object iRawValue, iValue; - - private Element iElement; - - private boolean iStrictParsing = WBEMConfiguration.getGlobalConfiguration() - .strictEmbObjTypes(); - - /** - * Ctor. - * - * @param pElement - * @throws CIMXMLParseException - */ - public EmbObjHandler(Element pElement) throws CIMXMLParseException { - this.iElement = pElement; - handleQualis(); - handleAttribs(); - Element valueE = (Element) searchFirstNode(pElement, "VALUE"); - if (valueE != null) { - TypedValue tv = parseVALUE(valueE); - if (this.iRawType == null) this.iRawType = tv.getType(); - if (this.iRawType == null) this.iRawType = CIMDataType.STRING_T; - this.iRawValue = tv.getValue(); - } else { - valueE = (Element) searchFirstNode(pElement, "VALUE.ARRAY"); - if (valueE != null) { - TypedValue tv = parseVALUEARRAY(valueE); - if (this.iRawType == null) this.iRawType = tv.getType(); - if (this.iRawType == null) this.iRawType = CIMDataType.STRING_ARRAY_T; - this.iRawValue = tv.getValue(); - } - } - } - - private void handleQualis() throws CIMXMLParseException { - this.iQualiA = parseQUALIFIERS(this.iElement); - if (this.iQualiA != null) { - for (int idx = 0; idx < this.iQualiA.length; idx++) { - String qualiName = this.iQualiA[idx].getName(); - if ("EmbeddedObject".equalsIgnoreCase(qualiName)) { - this.iHasEmbObjQuali = true; - } else if ("EMBEDDEDINSTANCE".equalsIgnoreCase(qualiName)) { - this.iHasEmbInstQuali = true; - } else if ("KEY".equalsIgnoreCase(qualiName)) { - this.iKeyed = true; - } - if ((this.iHasEmbObjQuali || this.iHasEmbInstQuali) && this.iKeyed) return; - } - } - } - - private void handleAttribs() throws CIMXMLParseException { - String typeStr = this.iElement.getAttribute("TYPE"); - if (typeStr == null || typeStr.length() == 0) { - typeStr = this.iElement.getAttribute("PARAMTYPE"); - if (typeStr == null || typeStr.length() == 0) { - /* - * throw new CIMXMLParseException( iElement.getNodeName()+" - * must contain a TYPE or PARAMTYPE attribute!" ); - */ - /* - * ebak: Workaround for SVC's TYPE attribute in VALUE and - * VALUE.ARRAY element. - */ - typeStr = null; - } - } - // ebak: iRawType can be filled from contained VALUE or VALUE.ARRAY - // element (SVC) - if (typeStr != null) this.iRawType = parseScalarTypeStr(typeStr); - - // DSPs call for EmbeddedObject AND XML is case sensitive, BUT there - // are probably CIMOMs out there that still use EMBEDDEDOBJECT - String embObjAttrStr = this.iElement.getAttribute("EmbeddedObject"); - if (embObjAttrStr == null || embObjAttrStr.length() == 0) { - embObjAttrStr = this.iElement.getAttribute("EMBEDDEDOBJECT"); - } - if (embObjAttrStr == null || embObjAttrStr.length() == 0) { - this.iHasEmbObjAttr = this.iHasEmbInstAttr = false; - } else if ("object".equalsIgnoreCase(embObjAttrStr)) { - this.iHasEmbObjAttr = true; - this.iHasEmbInstAttr = false; - } else if ("instance".equalsIgnoreCase(embObjAttrStr)) { - this.iHasEmbObjAttr = false; - this.iHasEmbInstAttr = true; - } else throw new CIMXMLParseException("EmbeddedObject attribute cannot contain \"" - + embObjAttrStr + "\" value!"); - } - - /** - * getQualifiers - * - * @return CIMQualifier[] - * @throws CIMXMLParseException - */ - public CIMQualifier[] getQualifiers() throws CIMXMLParseException { - transform(); - CIMQualifiedElementInterfaceImpl qualiImpl = new CIMQualifiedElementInterfaceImpl( - this.iQualiA, isKeyed(), this.iType == null - || this.iType.getType() == CIMDataType.STRING); - return qualiImpl.getQualifiers(); - } - - /** - * isKeyed - * - * @return boolean - */ - public boolean isKeyed() { - return this.iKeyed; - } - - /** - * isEmbeddedObject - * - * @return boolean - */ - private boolean isEmbeddedObject() { - return this.iHasEmbObjAttr || this.iHasEmbInstAttr || this.iHasEmbObjQuali - || this.iHasEmbInstQuali; - } - - /** - * isEmbeddedClass - * - * @return boolean - */ - private boolean isEmbeddedClass() { - return this.iHasEmbObjAttr || this.iHasEmbObjQuali; - } - - /** - * isEmbeddedInstance - * - * @return boolean - */ - private boolean isEmbeddedInstance() { - return this.iHasEmbInstAttr || this.iHasEmbInstQuali; - } - - /** - * getType - * - * @return CIMDataType - * @throws CIMXMLParseException - */ - public CIMDataType getType() throws CIMXMLParseException { - transform(); - return this.iType; - } - - /** - * getArrayType - * - * @return CIMDataType - * @throws CIMXMLParseException - */ - public CIMDataType getArrayType() throws CIMXMLParseException { - transform(); - return this.iType.isArray() ? this.iType : CIMHelper.UnboundedArrayDataType(this.iType - .getType()); - } - - /** - * getValue - * - * @return Object - * @throws CIMXMLParseException - */ - public Object getValue() throws CIMXMLParseException { - transform(); - return this.iValue; - } - - private void transform() throws CIMXMLParseException { - if (this.iType != null) return; - if (this.iRawValue == null) { - if (isEmbeddedObject()) { - if (this.iRawType != CIMDataType.STRING_T) throw new CIMXMLParseException( - "Embedded Object CIM-XML element's type must be string. " - + this.iRawType + " is invalid!"); - if (this.iStrictParsing) { - /* - * In case of strict parsing Object means CIMClass, - * Instance means CIMInstance. Pegasus 2.7.0 seems to - * handle it this way. - */ - this.iType = isEmbeddedInstance() ? CIMDataType.OBJECT_T - : CIMDataType.CLASS_T; - } else { - /* - * for valueless EmbeddedObject="object" the type is - * undeterminable since Pegasus's CIMObject can contain - * both CIMClass and CIMInstance - */ - this.iType = isEmbeddedInstance() ? CIMDataType.OBJECT_T - : CIMDataType.STRING_T; - } - } else { - this.iType = this.iRawType; - } - this.iValue = null; - } else { - if (isEmbeddedObject()) { - transformEmbObj(); - } else { - transformNormObj(); - } - } - } - - private void transformEmbObj() throws CIMXMLParseException { - if (this.iRawValue instanceof String) { - this.iValue = parseXmlStr((String) this.iRawValue); - this.iType = getCIMObjType(this.iValue); - } else { - this.iValue = parseXmlStrA((String[]) this.iRawValue); - this.iType = getCIMObjAType((Object[]) this.iValue); - } - if (isEmbeddedInstance() && this.iType.getType() != CIMDataType.OBJECT) throw new CIMXMLParseException( - this.iElement.getNodeName() - + " element is an EmbeddedInstance with non INSTANCE value. " - + "It's not valid!"); - if (isEmbeddedClass() && this.iType.getType() != CIMDataType.CLASS - && this.iType.getType() != CIMDataType.OBJECT) throw new CIMXMLParseException( - this.iElement.getNodeName() - + " element is an EmbeddedObject with non CLASS/INSTANCE value. It's not valid!"); - } - - private void transformNormObj() throws CIMXMLParseException { - if (this.iRawValue instanceof String) { - this.iType = this.iRawType; - this.iValue = createJavaObject(this.iType == null ? null : this.iType.toString(), - (String) this.iRawValue); - } else { - String[] rawValueA = (String[]) this.iRawValue; - String typeStr = this.iRawType.toString(); - Object[] objA = new Object[rawValueA.length]; - for (int i = 0; i < objA.length; i++) - objA[i] = createJavaObject(typeStr, rawValueA[i]); - this.iType = CIMHelper.UnboundedArrayDataType(this.iRawType.getType()); - this.iValue = objA; - } - } - - /** - * parseXmlStr - * - * @param pXmlStr - * @return CIMClass or CIMInstance - * @throws CIMXMLParseException - */ - public static Object parseXmlStr(String pXmlStr) throws CIMXMLParseException { - // ebak: workaround for null array elements -> parse empty EmbObj - // string as null - if (pXmlStr == null || pXmlStr.length() == 0) return null; - try { - CIMClientXML_HelperImpl builder = new CIMClientXML_HelperImpl(); - Document doc = builder.parse(new InputSource(new StringReader(pXmlStr))); - return parseObject(doc.getDocumentElement()); - } catch (CIMXMLParseException e) { - throw e; - } catch (Exception e) { - throw new CIMXMLParseException(e.getMessage() + "\npXmlStr=" + pXmlStr); - } - } - - /** - * parseXmlStrA - * - * @param pXmlStrA - * @return Object[] - * @throws CIMXMLParseException - */ - public static Object[] parseXmlStrA(String[] pXmlStrA) throws CIMXMLParseException { - if (pXmlStrA == null || pXmlStrA.length == 0) return null; - Object[] objA = new Object[pXmlStrA.length]; - for (int i = 0; i < objA.length; i++) { - String xmlStr = pXmlStrA[i]; - objA[i] = xmlStr == null ? null : parseXmlStr(xmlStr); - } - return objA; - } - - /** - * getCIMObjType - * - * @param pCIMObj - * @return CIMDataType - * @throws CIMXMLParseException - */ - public static CIMDataType getCIMObjType(Object pCIMObj) throws CIMXMLParseException { - if (pCIMObj == null) throw new CIMXMLParseException( - "cannot have null CIM object! (CIMClass or CIMInstance)"); - if (pCIMObj instanceof CIMInstance) return CIMDataType.OBJECT_T; - if (pCIMObj instanceof CIMClass) return CIMDataType.CLASS_T; - throw new CIMXMLParseException(pCIMObj.getClass().getName() - + " is not a CIM object! (CIMClass or CIMInstance)"); - } - - /** - * getCIMObjAType - * - * @param pCIMObjA - * @return CIMDataType - * @throws CIMXMLParseException - */ - public static CIMDataType getCIMObjAType(Object[] pCIMObjA) throws CIMXMLParseException { - if (pCIMObjA == null || pCIMObjA.length == 0) return CIMDataType.STRING_ARRAY_T; - CIMDataType type = null; - for (int i = 0; i < pCIMObjA.length; i++) { - if (pCIMObjA[i] == null) continue; - CIMDataType currType = getCIMObjType(pCIMObjA[i]); - if (type == null) { - type = currType; - } else if (type != currType) { throw new CIMXMLParseException( - "Embedded Object arrays with different types are not supported"); } - } - if (type == CIMDataType.OBJECT_T) return CIMDataType.OBJECT_ARRAY_T; - if (type == CIMDataType.CLASS_T) return CIMDataType.CLASS_ARRAY_T; - return CIMDataType.STRING_ARRAY_T; - } - - } - - private static final String nodesPROPERTY[] = { "QUALIFIER", "VALUE" }; - - /** - * parseCLASSPROPERTY - * - * @param pPropertyE - * @return CIMClassProperty - * @throws CIMXMLParseException - */ - public static CIMClassProperty parseCLASSPROPERTY(Element pPropertyE) - throws CIMXMLParseException { - // - // - - Attr property_nameA = (Attr) searchAttribute(pPropertyE, "NAME"); - if (property_nameA == null) throw new CIMXMLParseException( - "PROPERTY element missing NAME attribute!"); - String name = property_nameA.getNodeValue(); - if (attribute(pPropertyE, "TYPE") == null && !hasTypeAttrsInNodes(pPropertyE)) throw new CIMXMLParseException( - "PROPERTY element missing TYPE attribute!"); - - String classOrigin = pPropertyE.getAttribute("CLASSORIGIN"); - if (classOrigin != null && classOrigin.length() == 0) classOrigin = null; - - String propagatedStr = pPropertyE.getAttribute("PROPAGATED"); - boolean propagated = MOF.TRUE.equalsIgnoreCase(propagatedStr); - - // only QUALIFIER(s) and 0/1 VALUE - searchNodes(pPropertyE, "VALUE", 0, 1, true); - checkOtherNodes(pPropertyE, nodesPROPERTY); - - // QUALIFIER - // ebak: EmbeddedObject support - EmbObjHandler embObjHandler = new EmbObjHandler(pPropertyE); - /* - * CIMClassProperty(String pName, CIMDataType pType, Object pValue, - * CIMQualifier[] pQualifiers, boolean pKey, boolean propagated, String - * originClass) - */ - return new CIMClassProperty(name, embObjHandler.getType(), - embObjHandler.getValue(), embObjHandler.getQualifiers(), embObjHandler.isKeyed(), - propagated, classOrigin); - } - - /** - * parsePROPERTYARRAY - * - * @param pPropertyArrayE - * @return CIMProperty - * @throws CIMXMLParseException - */ - public static CIMProperty parsePROPERTYARRAY(Element pPropertyArrayE) - throws CIMXMLParseException { - return parseCLASSPROPERTYARRAY(pPropertyArrayE); - } - - private static final String nodesPROPERTYARRAY[] = { "QUALIFIER", "VALUE.ARRAY" }; - - /** - * parseCLASSPROPERTYARRAY - * - * @param pPropArrayE - * @return CIMClassProperty - * @throws CIMXMLParseException - */ - public static CIMClassProperty parseCLASSPROPERTYARRAY(Element pPropArrayE) - throws CIMXMLParseException { - // - // - - String name = attribute(pPropArrayE, "NAME"); - if (name == null) throw new CIMXMLParseException( - "PROPERTY.ARRAY element missing NAME attribute!"); - if (attribute(pPropArrayE, "TYPE") == null && !hasTypeAttrsInNodes(pPropArrayE)) throw new CIMXMLParseException( - "PROPERTY.ARRAY element missing TYPE attribute!"); - - String valueArraysizeStr = pPropArrayE.getAttribute("ARRAYSIZE"); - try { - if (valueArraysizeStr.length() > 0) Integer.parseInt(valueArraysizeStr); - } catch (NumberFormatException e) { - throw new CIMXMLParseException(valueArraysizeStr - + " is not a valid ARRAYSIZE attribute for VALUE.ARRAY!"); - } - - String classOrigin = pPropArrayE.getAttribute("CLASSORIGIN"); - if (classOrigin != null && classOrigin.length() == 0) classOrigin = null; - - String valuePropagatedStr = pPropArrayE.getAttribute("PROPAGATED"); - boolean propagated = (valuePropagatedStr != null && valuePropagatedStr - .equalsIgnoreCase(MOF.TRUE)); - - // only QUALIFIER(s) and 0/1 VALUE.ARRAY - searchNodes(pPropArrayE, "VALUE.ARRAY", 0, 1, true); - checkOtherNodes(pPropArrayE, nodesPROPERTYARRAY); - - // QUALIFIER - // ebak: EmbeddedObject support - EmbObjHandler embObjHandler = new EmbObjHandler(pPropArrayE); - return new CIMClassProperty(name, embObjHandler.getArrayType(), embObjHandler - .getValue(), embObjHandler.getQualifiers(), embObjHandler.isKeyed(), propagated, - classOrigin); - } - - /** - * parsePROPERTYREFERENCE - * - * @param pPropRefE - * @return CIMProperty - * @throws CIMXMLParseException - */ - public static CIMProperty parsePROPERTYREFERENCE(Element pPropRefE) - throws CIMXMLParseException { - return parseCLASSPROPERTYREFERENCE(pPropRefE); - } - - private static final String nodesPROPERTYREFERENCE[] = { "QUALIFIER", "VALUE.REFERENCE" }; - - /** - * parseCLASSPROPERTYREFERENCE - * - * @param pPropRefE - * @return CIMClassProperty - * @throws CIMXMLParseException - */ - public static CIMClassProperty parseCLASSPROPERTYREFERENCE(Element pPropRefE) - throws CIMXMLParseException { - // - // - - String name = attribute(pPropRefE, "NAME"); - if (name == null) throw new CIMXMLParseException( - "PROPERTY.REFERENCE element missing NAME attribute!"); - - String classOrigin = pPropRefE.getAttribute("CLASSORIGIN"); - if (classOrigin != null && classOrigin.length() == 0) classOrigin = null; - - String referenceClass = pPropRefE.getAttribute("REFERENCECLASS"); - - String propagatedStr = pPropRefE.getAttribute("PROPAGATED"); - boolean propagated = MOF.TRUE.equalsIgnoreCase(propagatedStr); - - // QUALIFIER - CIMQualifier[] qualis = parseQUALIFIERS(pPropRefE); - - CIMDataType type = new CIMDataType(referenceClass != null ? referenceClass : ""); - // VALUE.REFERENCE - Element valueRefA[] = searchNodes(pPropRefE, "VALUE.REFERENCE", 0, 1, true); - Object value = valueRefA != null ? parseVALUEREFERENCE(valueRefA[0]) : null; - - // return a CIMProperty without a CIMValue - checkOtherNodes(pPropRefE, nodesPROPERTYREFERENCE); - CIMQualifiedElementInterfaceImpl qualiImpl = new CIMQualifiedElementInterfaceImpl(qualis); - return new CIMClassProperty(name, type, value, qualis, qualiImpl.isKeyed(), - propagated, classOrigin); - } - - /** - * parseMESSAGE - * - * @param pCimVersion - * @param pDtdVersion - * @param pMessageE - * @return CIMMessage - * @throws CIMXMLParseException - */ - public static CIMMessage parseMESSAGE(String pCimVersion, String pDtdVersion, Element pMessageE) - throws CIMXMLParseException { - // - // - - Attr idA = (Attr) searchAttribute(pMessageE, "ID"); - if (idA == null) throw new CIMXMLParseException("MESSAGE element missing ID attribute!"); - String id = idA.getNodeValue(); - - Attr protocolA = (Attr) searchAttribute(pMessageE, "PROTOCOLVERSION"); - if (protocolA == null) throw new CIMXMLParseException( - "MESSAGE element missing PROTOCOLVERSION attribute!"); - // TODO - if (pCimVersion.equals("2.0") && pDtdVersion.equals("2.0")) { - - // Attr message_idA = (Attr)searchAttribute(messageE, "ID"); - // String messadeID = message_idA.getNodeValue(); - - // Attr message_protocolversionA = (Attr)searchAttribute(messageE, - // "PROTOCOLVERSION"); - // String protocolversion = message_protocolversionA.getNodeValue(); - - // SIMPLERSP - Element simplerspA[] = searchNodes(pMessageE, "SIMPLERSP", 0, 1, false); - if (simplerspA != null) { - CIMResponse response = parseSIMPLERSP(simplerspA[0]); - response.setMethod("SIMPLERSP"); - response.setId(id); - return response; - } - Element multirspA[] = searchNodes(pMessageE, "MULTIRSP", 0, 1, false); - if (multirspA != null) { - CIMResponse response = parseMULTIRSP(multirspA[0]); - response.setMethod("MULTIRSP"); - response.setId(id); - return response; - } - // SIMPLEEXPREQ - Element simpleexpreqA[] = searchNodes(pMessageE, "SIMPLEEXPREQ", 0, 1, false); - if (simpleexpreqA != null) { - CIMRequest request = parseSIMPLEEXPREQ(simpleexpreqA[0]); - request.setMethod("SIMPLEEXPREQ"); - request.setId(id); - return request; - } - - // MULTIEXPREQ - Element multiexpreqA[] = searchNodes(pMessageE, "MULTIEXPREQ", 0, 1, false); - if (multiexpreqA != null) { - CIMRequest request = parseMULTIEXPREQ(multiexpreqA[0]); - request.setMethod("MULTIEXPREQ"); - request.setId(id); - return request; - } - // SIMPLEEXPRSP - Element simpleexprspA[] = searchNodes(pMessageE, "SIMPLEEXPRSP", 0, 1, false); - if (simpleexprspA != null) { - CIMResponse response = parseSIMPLEEXPRSP(simpleexprspA[0]); - response.setMethod("SIMPLEEXPRSP"); - response.setId(id); - return response; - } - // MULTIEXPRSP - Element multiexprspA[] = searchNodes(pMessageE, "MULTIEXPRSP", 0, 1, false); - if (multiexprspA != null) { - CIMResponse response = parseMULTIEXPRSP(multiexprspA[0]); - response.setMethod("MULTIEXPRSP"); - response.setId(id); - return response; - } - - // SIMPLEREQ - Element simplereqA[] = searchNodes(pMessageE, "SIMPLEREQ", 0, 1, false); - if (simplereqA != null) { - CIMRequest request = parseSIMPLEREQ(simplereqA[0]); - request.setMethod("SIMPLEREQ"); - request.setId(id); - return request; - } - - // MULTIREQ - Element multireqA[] = searchNodes(pMessageE, "MULTIREQ", 0, 1, false); - if (multireqA != null) { - CIMRequest request = parseMULTIREQ(multireqA[0]); - request.setMethod("MULTIREQ"); - request.setId(id); - return request; - } - throw new CIMXMLParseException("MESSAGE element missing required child element!"); - } - // TODO, look for the specific error message in the spec - throw new CIMXMLParseException("DTD not supported"); - } - - private static final String nodesPARAMVALUE[] = { "VALUE", "VALUE.REFERENCE", "VALUE.ARRAY", - "VALUE.REFARRAY", "CLASSNAME", "INSTANCENAME", "CLASS", "INSTANCE", - "VALUE.NAMEDINSTANCE" }; - - /** - * parsePARAMVALUE - * - * @param pParamValueE - * @return CIMArgument - * @throws CIMXMLParseException - */ - public static CIMArgument parsePARAMVALUE(Element pParamValueE) - throws CIMXMLParseException { - // ) - // - String name = attribute(pParamValueE, "NAME"); - if (name == null) throw new CIMXMLParseException( - "PARAMVALUE element missing NAME attribute!"); - // FIXME: ebak: The base implementation didn't contain VALUE.REFARRAY - // handling. Why? - // ebak: embedded object support, different parsing for VALUE and - // VALUE.ARRAY sub elements - if (searchNodes(pParamValueE, "VALUE.REFERENCE", 0, 1, false) != null - || searchNodes(pParamValueE, "VALUE.REFARRAY", 0, 1, false) != null) { - TypedValue typedValue = parseSingleValue(pParamValueE, VALUEREF | VALUEREFA); - CIMDataType type = typedValue.getType(); - Object value = typedValue.getValue(); - if (type == null) throw new CIMXMLParseException("PARAMVALUE element type is null!"); - return new CIMArgument(name, type, value); - } - if (searchNodes(pParamValueE, "VALUE", 0, 1, false) != null - || searchNodes(pParamValueE, "VALUE.ARRAY", 0, 1, false) != null - || !hasNodes(pParamValueE)) { - EmbObjHandler embObjHandler = new EmbObjHandler(pParamValueE); - return new CIMArgument(name, embObjHandler.getType(), embObjHandler.getValue()); - } - - // CLASSNAME - Element classNameA[] = searchNodes(pParamValueE, "CLASSNAME", 0, 1, false); - if (classNameA != null) { - CIMObjectPath op = parseCLASSNAME(classNameA[0]); - CIMDataType type = new CIMDataType(op.getObjectName()); - return new CIMArgument(name, type, op); - } - - // INSTANCENAME - Element instNameA[] = searchNodes(pParamValueE, "INSTANCENAME", 0, 1, false); - if (instNameA != null) { - CIMObjectPath op = parseINSTANCENAME(instNameA[0]); - CIMDataType type = new CIMDataType(op.getObjectName()); - return new CIMArgument(name, type, op); - } - - // CLASS - Element classA[] = searchNodes(pParamValueE, "CLASS", 0, 1, false); - if (classA != null) { - CIMClass cl = parseCLASS(classA[0]); - return new CIMArgument(name, CIMDataType.CLASS_T, cl); - } - - // INSTANCE - Element instanceA[] = searchNodes(pParamValueE, "INSTANCE", 0, 1, false); - if (instanceA != null) { - CIMInstance inst = parseINSTANCE(instanceA[0]); - return new CIMArgument(name, CIMDataType.OBJECT_T, inst); - } - - // VALUE.NAMEDINSTANCE - Element valuenamedisntanceA[] = searchNodes(pParamValueE, "VALUE.NAMEDINSTANCE", 0, 1, - false); - if (valuenamedisntanceA != null) { - CIMInstance inst = parseVALUENAMEDINSTANCE(valuenamedisntanceA[0]); - return new CIMArgument(name, CIMDataType.OBJECT_T, inst); - } - checkOtherNodes(pParamValueE, nodesPARAMVALUE); - return new CIMArgument(name, CIMDataType.STRING_T, null); - } - - private static final String nodesIPARAMVALUE[] = { "VALUE", "VALUE.ARRAY", "VALUE.REFERENCE", - "CLASSNAME", "INSTANCENAME", "QUALIFIER.DECLARATION", "CLASS", "INSTANCE", - "VALUE.NAMEDINSTANCE" }; - - /** - * parseIPARAMVALUE - * - * @param pParamValueE - * @return CIMArgument - * @throws CIMXMLParseException - */ - public static CIMArgument parseIPARAMVALUE(Element pParamValueE) - throws CIMXMLParseException { - // - // - - String name = attribute(pParamValueE, "NAME"); - if (name == null) throw new CIMXMLParseException( - "IPARAMVALUE element missing NAME attribute!"); - // this can parse VALUE, VALUE.ARRAY and VALUE.REFERENCE - if (searchNodes(pParamValueE, "VALUE", 0, 1, false) != null - || searchNodes(pParamValueE, "VALUE.ARRAY", 0, 1, false) != null - || searchNodes(pParamValueE, "VALUE.REFERENCE", 0, 1, false) != null) { - TypedValue typedValue = parseSingleValue(pParamValueE, VALUE | VALUEA | VALUEREF); - if (typedValue.getType() != null) { return new CIMArgument(name, typedValue - .getType(), typedValue.getValue()); } - } - // we can have different types too which cannot be handled by - // parseSingleValue() - - // INSTANCENAME - Element instNameA[] = searchNodes(pParamValueE, "INSTANCENAME", 0, 1, false); - if (instNameA != null) { - CIMObjectPath op = parseINSTANCENAME(instNameA[0]); - CIMDataType type = new CIMDataType(op.getObjectName()); - return new CIMArgument(name, type, op); - } - - // CLASSNAME - Element classNameA[] = searchNodes(pParamValueE, "CLASSNAME", 0, 1, false); - if (classNameA != null) { - CIMObjectPath op = parseCLASSNAME(classNameA[0]); - CIMDataType type = new CIMDataType(op.getObjectName()); - return new CIMArgument(name, type, op); - } - - // QUALIFIER.DECLARATION - Element qualiDeclarationA[] = searchNodes(pParamValueE, "QUALIFIER.DECLARATION", 0, 1, - false); - if (qualiDeclarationA != null) { - CIMQualifierType qualiType = parseQUALIFIERDECLARATION(qualiDeclarationA[0]); - // FIXME: ebak: Does it surely have to be mapped to type: - // REFERENCE???? - return new CIMArgument(name, new CIMDataType(qualiType.getName()), qualiType); - } - - // CLASS - Element classA[] = searchNodes(pParamValueE, "CLASS", 0, 1, false); - if (classA != null) { - CIMClass cl = parseCLASS(classA[0]); - return new CIMArgument(name, CIMDataType.CLASS_T, cl); - } - - // INSTANCE - Element instanceA[] = searchNodes(pParamValueE, "INSTANCE", 0, 1, false); - if (instanceA != null) { - CIMInstance inst = parseINSTANCE(instanceA[0]); - return new CIMArgument(name, CIMDataType.OBJECT_T, inst); - } - - // VALUE.NAMEDINSTANCE - Element valuenamedisntanceA[] = searchNodes(pParamValueE, "VALUE.NAMEDINSTANCE", 0, 1, - false); - if (valuenamedisntanceA != null) { - CIMInstance inst = parseVALUENAMEDINSTANCE(valuenamedisntanceA[0]); - return new CIMArgument(name, CIMDataType.OBJECT_T, inst); - } - - checkOtherNodes(pParamValueE, nodesIPARAMVALUE); - return new CIMArgument(name, CIMDataType.STRING_T, null); - } - - /** - * parseSIMPLERSP - * - * @param pSimpleRspE - * @return CIMResponse - * @throws CIMXMLParseException - */ - public static CIMResponse parseSIMPLERSP(Element pSimpleRspE) throws CIMXMLParseException { - // - - // METHODRESPONSE - Element methodresponseA[] = searchNodes(pSimpleRspE, "METHODRESPONSE", 0, 1, false); - if (methodresponseA != null) { - - return parseMETHODRESPONSE(methodresponseA[0]); } - - // IMETHODRESPONSE - Element imethodresponseA[] = searchNodes(pSimpleRspE, "IMETHODRESPONSE", 0, 1, false); - if (imethodresponseA != null) { return parseIMETHODRESPONSE(imethodresponseA[0]); } - - throw new CIMXMLParseException("SIMPLERSP element missing required child element!"); - } - - /** - * parseMULTIRSP - * - * @param pSimpleRspE - * @return CIMResponse - * @throws CIMXMLParseException - */ - public static CIMResponse parseMULTIRSP(Element pSimpleRspE) throws CIMXMLParseException { - // - - Element[] multiRespElementA = searchNodes(pSimpleRspE, "SIMPLERSP", 2, Integer.MAX_VALUE, - false); - if (multiRespElementA != null) { - CIMResponse multiRsp = new CIMResponse(); - for (int i = 0; i < multiRespElementA.length; i++) { - Element methodresponseE = multiRespElementA[i]; - CIMResponse rsp = parseSIMPLERSP(methodresponseE); - rsp.setMethod("SIMPLERSP"); - multiRsp.addResponse(rsp); - } - return multiRsp; - } - - throw new CIMXMLParseException("MULTIRSP element missing SIMPLERSP child element!"); - } - - private static final String nodesSIMPLEREQ[] = { "CORRELATOR", "METHODCALL", "IMETHODCALL" }; - - /** - * parseSIMPLEREQ - * - * @param pSimpleReqE - * @return CIMRequest - * @throws CIMXMLParseException - */ - public static CIMRequest parseSIMPLEREQ(Element pSimpleReqE) throws CIMXMLParseException { - // - CIMRequest request = null; - - // METHODCALL - Element methodcallA[] = searchNodes(pSimpleReqE, "METHODCALL", 0, 1, true); - if (methodcallA != null) { - request = parseMETHODCALL(methodcallA[0]); - } - - // IMETHODCALL - Element imethodcallA[] = searchNodes(pSimpleReqE, "IMETHODCALL", 0, 1, true); - if (imethodcallA != null) { - if (request != null) { throw new CIMXMLParseException( - "SIMPLEREQ element cannot have METHODCALL and IMETHODCALL child elements!"); } - request = parseIMETHODCALL(imethodcallA[0]); - } - - if (request == null) throw new CIMXMLParseException( - "SIMPLEREQ element missing required child element!"); - - // CORRELATOR - Element[] correlatorA = searchNodes(pSimpleReqE, "CORRELATOR", 0, Integer.MAX_VALUE, true); - if (correlatorA != null) { - for (int i = 0; i < correlatorA.length; i++) - // TODO: return to WBEMClient API if JSR48 changes - parseCORRELATOR(correlatorA[i]); - } - - checkOtherNodes(pSimpleReqE, nodesSIMPLEREQ); - return request; - } - - /** - * parseMULTIREQ - * - * @param pMultiReqE - * @return CIMRequest - * @throws CIMXMLParseException - */ - public static CIMRequest parseMULTIREQ(Element pMultiReqE) throws CIMXMLParseException { - // - - Element[] methodReqElementA = searchNodes(pMultiReqE, "SIMPLEREQ", 2, Integer.MAX_VALUE, - false); - if (methodReqElementA != null) { - CIMRequest multiReq = new CIMRequest(); - for (int i = 0; i < methodReqElementA.length; i++) { - Element methodrequestE = methodReqElementA[i]; - CIMRequest req = parseSIMPLEREQ(methodrequestE); - req.setMethod("SIMPLEREQ"); - - multiReq.addRequest(req); - } - return multiReq; - } - throw new CIMXMLParseException("MULTIREQ element missing SIMPLEREQ child element!"); - } - - private static final String nodesMETHODCALL[] = { "LOCALCLASSPATH", "LOCALINSTANCEPATH", - "PARAMVALUE" }; - - /** - * parseMETHODCALL - * - * @param pMethodCallE - * @return CIMRequest - * @throws CIMXMLParseException - */ - public static CIMRequest parseMETHODCALL(Element pMethodCallE) throws CIMXMLParseException { - // - // - - CIMRequest request = new CIMRequest(); - String methodname = attribute(pMethodCallE, "NAME"); - if (methodname == null) throw new CIMXMLParseException( - "METHODCALL element missing NAME attribute!"); - request.setMethodName(methodname); - - // EXPMETHODCALL - boolean localclasspathFound = false; - Element localclasspathA[] = searchNodes(pMethodCallE, "LOCALCLASSPATH", 0, 1, true); - if (localclasspathA != null) { - CIMObjectPath path = parseLOCALCLASSPATH(localclasspathA[0]); - - request.setObjectPath(path); - localclasspathFound = true; - } - - Element localinstancepathA[] = searchNodes(pMethodCallE, "LOCALINSTANCEPATH", 0, 1, true); - if (localinstancepathA != null) { - if (localclasspathFound) throw new CIMXMLParseException( - "METHODCALL element cannot have both LOCALCLASSPATH and LOCALINSTANCEPATH child elements!"); - - CIMObjectPath path = parseLOCALINSTANCEPATH(localinstancepathA[0]); - - request.setObjectPath(path); - } else { - if (!localclasspathFound) throw new CIMXMLParseException( - "METHODCALL element missing required child element!"); - } - - Element[] paramValueElementA = searchNodes(pMethodCallE, "PARAMVALUE", 0, - Integer.MAX_VALUE, true); - - if (paramValueElementA != null) { - CIMArgument[] argA = new CIMArgument[paramValueElementA.length]; - for (int i = 0; i < paramValueElementA.length; i++) { - Element paramvalueE = paramValueElementA[i]; - argA[i] = parsePARAMVALUE(paramvalueE); - } - request.addParamValue(argA); - } - - checkOtherNodes(pMethodCallE, nodesMETHODCALL); - return request; - } - - private static final String nodesIMETHODCALL[] = { "LOCALNAMESPACEPATH", "IPARAMVALUE" }; - - /** - * parseIMETHODCALL - * - * @param pIMethodCallE - * @return CIMRequest - * @throws CIMXMLParseException - */ - public static CIMRequest parseIMETHODCALL(Element pIMethodCallE) throws CIMXMLParseException { - // - // - - CIMRequest request = new CIMRequest(); - String methodname = attribute(pIMethodCallE, "NAME"); // ebak: - // CIMName->NAME - if (methodname == null) throw new CIMXMLParseException( - "IMETHODCALL element missing NAME attribute!"); - request.setMethodName(methodname); - - // METHODCALL - Element localnamespacepathA[] = searchNodes(pIMethodCallE, "LOCALNAMESPACEPATH", 1, 1, true); - if (localnamespacepathA != null) { - String nameSpace = parseLOCALNAMESPACEPATH(localnamespacepathA[0]); - request.setNameSpace(nameSpace); - } - - Element[] iParamValElementA = searchNodes(pIMethodCallE, "IPARAMVALUE", 0, - Integer.MAX_VALUE, true); // ebak: - // PARAMVALUE->IPARAMVALUE - - if (iParamValElementA != null) { - CIMArgument[] argA = new CIMArgument[iParamValElementA.length]; - for (int i = 0; i < iParamValElementA.length; i++) { - Element paramvalueE = iParamValElementA[i]; - CIMArgument arg = parseIPARAMVALUE(paramvalueE); - /* - * ebak: local nameSpacePath should be added to those reference - * arguments which don't contain namespace - */ - Object value = arg.getValue(); - if (value instanceof CIMObjectPath) { - CIMObjectPath op = (CIMObjectPath) value; - if (op.getNamespace() == null || op.getNamespace().length() == 0) { - arg = new CIMArgument(arg.getName(), arg.getDataType(), - // CIMObjectPath(String scheme, String host, String - // port, String namespace, String objectName, - // CIMProperty[] keys) - new CIMObjectPath(op.getScheme(), op.getHost(), op.getPort(), - request.getNameSpace(), op.getObjectName(), op.getKeys())); - } - } - argA[i] = arg; - } - request.addParamValue(argA); - } - - checkOtherNodes(pIMethodCallE, nodesIMETHODCALL); - return request; - } - - private static final String nodesSIMPLEEXPREQ[] = { "CORRELATOR", "EXPMETHODCALL" }; - - /** - * parseSIMPLEEXPREQ - * - * @param pSimpleExpReqE - * @return CIMRequest - * @throws CIMXMLParseException - */ - public static CIMRequest parseSIMPLEEXPREQ(Element pSimpleExpReqE) throws CIMXMLParseException { - // - CIMRequest request = null; - - // EXPMETHODCALL - Element[] expmethodcallA = searchNodes(pSimpleExpReqE, "EXPMETHODCALL", 1, 1, true); - if (expmethodcallA != null) { - request = parseEXPMETHODCALL(expmethodcallA[0]); - } else { - throw new CIMXMLParseException( - "SIMPLEEXPREQ element missing EXPMETHODCALL child element!"); - } - - // CORRELATOR - Element[] correlatorA = searchNodes(pSimpleExpReqE, "CORRELATOR", 0, Integer.MAX_VALUE, - true); - if (correlatorA != null) { - for (int i = 0; i < correlatorA.length; i++) - // TODO: return to WBEMClient API if JSR48 changes - parseCORRELATOR(correlatorA[i]); - } - - checkOtherNodes(pSimpleExpReqE, nodesSIMPLEEXPREQ); - return request; - } - - /** - * parseMULTIEXPREQ - * - * @param pMultiExpReqE - * @return CIMRequest - * @throws CIMXMLParseException - */ - public static CIMRequest parseMULTIEXPREQ(Element pMultiExpReqE) throws CIMXMLParseException { - // - - Element[] methodReqElementA = searchNodes(pMultiExpReqE, "SIMPLEEXPREQ", 2, - Integer.MAX_VALUE, false); - if (methodReqElementA != null) { - CIMRequest multiReq = new CIMRequest(); - for (int i = 0; i < methodReqElementA.length; i++) { - Element methodrequestE = methodReqElementA[i]; - CIMRequest req = parseSIMPLEEXPREQ(methodrequestE); - req.setMethod("SIMPLEEXPREQ"); - - multiReq.addRequest(req); - } - return multiReq; - } - throw new CIMXMLParseException("MULTIEXPREQ element missing SIMPLEEXPREQ child element!"); - } - - private static final String nodesEXPMETHODCALL[] = { "EXPPARAMVALUE" }; - - /** - * parseEXPMETHODCALL - * - * @param pExpMethodCallE - * @return CIMRequest - * @throws CIMXMLParseException - */ - public static CIMRequest parseEXPMETHODCALL(Element pExpMethodCallE) - throws CIMXMLParseException { - // - - // EXPMETHODCALL - CIMRequest request = new CIMRequest(); - String methodname = attribute(pExpMethodCallE, "NAME"); - if (methodname == null) throw new CIMXMLParseException( - "EXPMETHODCALL element missing NAME attribute!"); - request.setMethodName(methodname); - - Element[] paramValElementA = searchNodes(pExpMethodCallE, "EXPPARAMVALUE", 0, - Integer.MAX_VALUE, false); - Vector v = new Vector(); - if (paramValElementA != null) { - for (int i = 0; i < paramValElementA.length; i++) { - Element expparamvalueE = paramValElementA[i]; - CIMInstance inst = parseEXPPARAMVALUE(expparamvalueE); - v.add(inst); - } - } - request.addParamValue(v); - checkOtherNodes(pExpMethodCallE, nodesEXPMETHODCALL); - return request; - } - - private static final String nodesEXPPARAMVALUE[] = { "INSTANCE" }; - - /** - * parseEXPPARAMVALUE - * - * @param pExpParamValueE - * @return CIMInstance - * @throws CIMXMLParseException - */ - public static CIMInstance parseEXPPARAMVALUE(Element pExpParamValueE) - throws CIMXMLParseException { - // - // - // INSTANCE - if (attribute(pExpParamValueE, "NAME") == null) throw new CIMXMLParseException( - "EXPPARAMVALUE element missing NAME attribute!"); - - Element[] instanceA = searchNodes(pExpParamValueE, "INSTANCE", 0, 1, false); - if (instanceA != null) { - CIMInstance inst = parseINSTANCE(instanceA[0]); - return inst; - } - - checkOtherNodes(pExpParamValueE, nodesEXPPARAMVALUE); - - return null; - } - - private static final String nodesMETHODRESPONSE[] = { "ERROR", "RETURNVALUE", "PARAMVALUE" }; - - /** - * parseMETHODRESPONSE - * - * @param pMethodResponseE - * @return CIMResponse - * @throws CIMXMLParseException - */ - public static CIMResponse parseMETHODRESPONSE(Element pMethodResponseE) - throws CIMXMLParseException { - // - if (attribute(pMethodResponseE, "NAME") == null) throw new CIMXMLParseException( - "METHODRESPONSE element missing NAME attribute!"); - - CIMResponse response = new CIMResponse(); - - // ERROR - Element errorA[] = searchNodes(pMethodResponseE, "ERROR", 0, 1, false); - if (errorA != null) { - WBEMException exception = parseERROR(errorA[0]); - response.setError(exception); - return response; - } - - // RETURNVALUE - Element[] retValElementA = searchNodes(pMethodResponseE, "RETURNVALUE", 0, 1, true); - if (retValElementA != null) { - Vector v = new Vector(); - for (int i = 0; i < retValElementA.length; i++) { - Element returnvalueE = retValElementA[i]; - v.add(parseRETURNVALUE(returnvalueE)); - } - response.setReturnValue(v); - } - - // PARAMVALUE - Element[] paramValElementA = searchNodes(pMethodResponseE, "PARAMVALUE", 0, - Integer.MAX_VALUE, true); - if (paramValElementA != null) { - Vector v = new Vector(); - for (int i = 0; i < paramValElementA.length; i++) { - Element paramvalueE = paramValElementA[i]; - CIMArgument arg = parsePARAMVALUE(paramvalueE); - v.add(arg); - } - response.addParamValue(v); - } - - // PARAMVALUE (ESS fix) - if (retValElementA != null) { - for (int i = 0; i < retValElementA.length; i++) { - Element retValE = retValElementA[i]; - - paramValElementA = searchNodes(retValE, "PARAMVALUE"); - if (paramValElementA != null) { - Vector> v = new Vector>(); - for (int j = 0; j < paramValElementA.length; j++) { - Element paramvalueE = paramValElementA[j]; - CIMArgument arg = parsePARAMVALUE(paramvalueE); - v.add(arg); - } - response.addParamValue(v); - } - } - } - checkOtherNodes(pMethodResponseE, nodesMETHODRESPONSE); - - return response; - } - - private static final String nodesIMETHODRESPONSE[] = { "ERROR", "IRETURNVALUE", "PARAMVALUE" }; - - /** - * parseIMETHODRESPONSE - * - * @param pIMethodResponseE - * @return CIMResponse - * @throws CIMXMLParseException - */ - public static CIMResponse parseIMETHODRESPONSE(Element pIMethodResponseE) - throws CIMXMLParseException { - // - if (attribute(pIMethodResponseE, "NAME") == null) throw new CIMXMLParseException( - "IMETHODRESPONSE element missing NAME attribute!"); - - CIMResponse response = new CIMResponse(); - // ERROR - Element[] errorA = searchNodes(pIMethodResponseE, "ERROR", 0, 1, false); - if (errorA != null) { - WBEMException exception = parseERROR(errorA[0]); - response.setError(exception); - return response; - } - - // IRETURNVALUE - Element[] retValElementA = searchNodes(pIMethodResponseE, "IRETURNVALUE", 0, 1, true); - if (retValElementA != null) { - for (int i = 0; i < retValElementA.length; i++) { - Element ireturnvalueE = retValElementA[i]; - - Vector rtnV = parseIRETURNVALUE(ireturnvalueE); - response.setReturnValue(rtnV); - } - } - - // PARAMVALUE - Element[] paramValElementA = searchNodes(pIMethodResponseE, "PARAMVALUE", 0, - Integer.MAX_VALUE, true); - if (paramValElementA != null) { - Vector v = new Vector(); - for (int i = 0; i < paramValElementA.length; i++) { - Element paramvalueE = paramValElementA[i]; - CIMArgument arg = parsePARAMVALUE(paramvalueE); - v.add(arg); - } - response.addParamValue(v); - } - checkOtherNodes(pIMethodResponseE, nodesIMETHODRESPONSE); - - return response; - } - - private static final String nodesERROR[] = { "INSTANCE" }; - - /** - * parseERROR - * - * @param pErrorE - * @return WBEMException - * @throws CIMXMLParseException - */ - public static WBEMException parseERROR(Element pErrorE) throws CIMXMLParseException { - // - // - - Attr error_codeA = (Attr) searchAttribute(pErrorE, "CODE"); - if (error_codeA == null) throw new CIMXMLParseException( - "ERROR element missing CODE attribute!"); - String code = error_codeA.getNodeValue(); - int errorCode = 0; - try { - if (code.length() > 0) errorCode = Integer.parseInt(code); - } catch (Exception e) { - LogAndTraceBroker.getBroker().trace(Level.WARNING, - "exception while parsing error code from XML", e); - errorCode = WBEMException.CIM_ERR_FAILED; - } - Attr error_descriptionA = (Attr) searchAttribute(pErrorE, "DESCRIPTION"); - String description = ""; - if (error_descriptionA != null) { - description = error_descriptionA.getNodeValue(); - } - - Vector rtnV = new Vector(); - - // INSTANCE - Element[] instElementA = searchNodes(pErrorE, "INSTANCE", 0, Integer.MAX_VALUE, false); - if (instElementA != null) { - for (int i = 0; i < instElementA.length; i++) { - Element instanceE = instElementA[i]; - CIMInstance inst = parseINSTANCE(instanceE); - rtnV.add(inst); - } - } - checkOtherNodes(pErrorE, nodesERROR); - - // throw new CIMException(CIMException.getErrorName(errorCode), - // description.substring(description.indexOf(':')+1)); - if (!rtnV.isEmpty()) return new WBEMException(errorCode, "ErrorCode:" + errorCode - + " description:" + description, rtnV.toArray(new CIMInstance[0])); - return new WBEMException(errorCode, "ErrorCode:" + errorCode + " description:" - + description); - } - - private static final String nodesRETURNVALUE[] = { "VALUE", "VALUE.REFERENCE" }; - - /** - * parseRETURNVALUE - * - * @param pRetValE - * @return Object - * @throws CIMXMLParseException - */ - public static Object parseRETURNVALUE(Element pRetValE) throws CIMXMLParseException { - // - // - // ebak: embedded object support: different parsing of VALUE sub element - checkOtherNodes(pRetValE, nodesRETURNVALUE); - if (searchNodes(pRetValE, "VALUE", 0, 1, false) != null) { - EmbObjHandler embObjHandler = new EmbObjHandler(pRetValE); - return embObjHandler.getValue(); - } - if (searchNodes(pRetValE, "VALUE.REFERENCE", 0, 1, false) != null) { - TypedValue typedVal = parseSingleValue(pRetValE, VALUEREF); - Object value = typedVal.getValue(); - return value; - } - checkOtherNodes(pRetValE, nodesRETURNVALUE); - return null; - } - - private static final String nodesIRETURNVALUE[] = { "CLASSNAME", "INSTANCENAME", "VALUE", - "VALUE.OBJECTWITHPATH", "VALUE.OBJECTWITHLOCALPATH", "VALUE.OBJECT", "OBJECTPATH", - "QUALIFIER.DECLARATION", "VALUE.ARRAY", "VALUE.REFERENCE", "CLASS", "INSTANCE", - "INSTANCEPATH", "VALUE.NAMEDINSTANCE" }; - - /** - * parseIRETURNVALUE - * - * @param pIRetValE - * @return Vector - * @throws CIMXMLParseException - */ - public static Vector parseIRETURNVALUE(Element pIRetValE) throws CIMXMLParseException { - // - - Vector rtnV = new Vector(); - - // CLASS - Element[] classElementA = searchNodes(pIRetValE, "CLASS", 0, Integer.MAX_VALUE, false); - if (classElementA != null) { - for (int i = 0; i < classElementA.length; i++) { - Element classE = classElementA[i]; - CIMClass c = parseCLASS(classE); - rtnV.add(c); - } - return rtnV; - } - - // INSTANCE - Element[] instElementA = searchNodes(pIRetValE, "INSTANCE", 0, Integer.MAX_VALUE, false); - if (instElementA != null) { - for (int i = 0; i < instElementA.length; i++) { - Element instanceE = instElementA[i]; - CIMInstance inst = parseINSTANCE(instanceE); - rtnV.add(inst); - } - return rtnV; - } - - // CLASSNAME - Element[] classNameElementA = searchNodes(pIRetValE, "CLASSNAME", 0, Integer.MAX_VALUE, - false); - if (classNameElementA != null) { - for (int i = 0; i < classNameElementA.length; i++) { - Element classnameE = classNameElementA[i]; - CIMObjectPath op = parseCLASSNAME(classnameE); - rtnV.add(op); - } - return rtnV; - } - - // INSTANCENAME - Element[] instNameElementA = searchNodes(pIRetValE, "INSTANCENAME", 0, Integer.MAX_VALUE, - false); - if (instNameElementA != null) { - for (int i = 0; i < instNameElementA.length; i++) { - Element instancenameE = instNameElementA[i]; - CIMObjectPath op = parseINSTANCENAME(instancenameE); - rtnV.add(op); - } - return rtnV; - } - - // INSTANCEPATH - Element[] instpathElementA = searchNodes(pIRetValE, "INSTANCEPATH", 0, Integer.MAX_VALUE, - false); - if (instpathElementA != null) { - for (int i = 0; i < instpathElementA.length; i++) { - Element instancePathE = instpathElementA[i]; - CIMObjectPath op = parseINSTANCEPATH(instancePathE); - rtnV.add(op); - } - return rtnV; - } - - // OBJECTPATH - Element[] objPathElementA = searchNodes(pIRetValE, "OBJECTPATH", 0, Integer.MAX_VALUE, - false); - if (objPathElementA != null) { - for (int i = 0; i < objPathElementA.length; i++) { - Element objectpathE = objPathElementA[i]; - CIMObjectPath op = parseOBJECTPATH(objectpathE); - rtnV.add(op); - } - return rtnV; - } - - // VALUE - Element[] valueElementA = searchNodes(pIRetValE, "VALUE", 0, Integer.MAX_VALUE, false); - if (valueElementA != null) { - for (int i = 0; i < valueElementA.length; i++) { - Element valueE = valueElementA[i]; - TypedValue tv = parseVALUE(valueE); - rtnV.add(tv.getValue()); - } - return rtnV; - } - - // VALUE.ARRAY - Element[] valueArrayElementA = searchNodes(pIRetValE, "VALUE.ARRAY", 0, 1, false); - if (valueArrayElementA != null) { - Element valuearrayE = valueArrayElementA[0]; - TypedValue tv = parseVALUEARRAY(valuearrayE); - rtnV.add(tv.getValue()); - return rtnV; - } - - // VALUE.REFERENCE - Element[] valRefElementA = searchNodes(pIRetValE, "VALUE.REFERENCE", 0, 1, false); - if (valRefElementA != null) { - Element valuereferenceE = valRefElementA[0]; - CIMObjectPath op = parseVALUEREFERENCE(valuereferenceE); - rtnV.add(op); - return rtnV; - } - - // VALUE.OBJECT - Element[] valObjElementA = searchNodes(pIRetValE, "VALUE.OBJECT", 0, Integer.MAX_VALUE, - false); - if (valObjElementA != null) { - for (int i = 0; i < valObjElementA.length; i++) { - Element valueobjectE = valObjElementA[i]; - CIMNamedElementInterface obj = parseVALUEOBJECT(valueobjectE); - rtnV.add(obj); - } - return rtnV; - } - - // VALUE.NAMEDINSTANCE - Element[] valNamedInstElementA = searchNodes(pIRetValE, "VALUE.NAMEDINSTANCE", 0, - Integer.MAX_VALUE, false); - if (valNamedInstElementA != null) { - for (int i = 0; i < valNamedInstElementA.length; i++) { - Element valuenamedisntanceE = valNamedInstElementA[i]; - CIMInstance inst = parseVALUENAMEDINSTANCE(valuenamedisntanceE); - rtnV.add(inst); - } - return rtnV; - } - - // VALUE.INSTANCEWITHPATH - Element[] valInstWithPathElementA = searchNodes(pIRetValE, "VALUE.INSTANCEWITHPATH", 0, - Integer.MAX_VALUE, false); - if (valInstWithPathElementA != null) { - for (int i = 0; i < valInstWithPathElementA.length; i++) { - Element valueinstancewithpathE = valInstWithPathElementA[i]; - CIMInstance inst = parseVALUEINSTANCEWITHPATH(valueinstancewithpathE); - rtnV.add(inst); - } - return rtnV; - } - - // VALUE.OBJECTWITHPATH - Element[] valObjWithPathElementA = searchNodes(pIRetValE, "VALUE.OBJECTWITHPATH", 0, - Integer.MAX_VALUE, false); - if (valObjWithPathElementA != null) { - for (int i = 0; i < valObjWithPathElementA.length; i++) { - Element valueobjectwithpathE = valObjWithPathElementA[i]; - CIMNamedElementInterface namedIF = parseVALUEOBJECTWITHPATH(valueobjectwithpathE); - rtnV.add(namedIF); - } - return rtnV; - } - - // VALUE.OBJECTWITHLOCALPATH - Element[] valObjWithLocalPathElementA = searchNodes(pIRetValE, "VALUE.OBJECTWITHLOCALPATH", - 0, Integer.MAX_VALUE, false); - if (valObjWithLocalPathElementA != null) { - for (int i = 0; i < valObjWithLocalPathElementA.length; i++) { - Element valueobjectwithlocalpathE = valObjWithLocalPathElementA[i]; - CIMNamedElementInterface namedIF = parseVALUEOBJECTWITHLOCALPATH(valueobjectwithlocalpathE); - rtnV.add(namedIF); - } - return rtnV; - } - - // QUALIFIER.DECLARATION - Element[] qualiDeclElementA = searchNodes(pIRetValE, "QUALIFIER.DECLARATION", 0, - Integer.MAX_VALUE, false); - if (qualiDeclElementA != null) { - for (int i = 0; i < qualiDeclElementA.length; i++) { - Element qualifierdeclarationE = qualiDeclElementA[i]; - CIMQualifierType o = parseQUALIFIERDECLARATION(qualifierdeclarationE); - rtnV.add(o); - } - return rtnV; - } - checkOtherNodes(pIRetValE, nodesIRETURNVALUE); - return rtnV; - } - - /** - * parseObject - * - * @param pRootE - * @return Object - * @throws CIMXMLParseException - */ - public static Object parseObject(Element pRootE) throws CIMXMLParseException { - Object o = null; - String nodeName = pRootE.getNodeName(); - if (nodeName.equalsIgnoreCase("INSTANCE")) { - o = parseINSTANCE(pRootE); - } else if (nodeName.equalsIgnoreCase("VALUE.NAMEDINSTANCE")) { - o = parseVALUENAMEDINSTANCE(pRootE); - } else if (nodeName.equalsIgnoreCase("VALUE.NAMEDOBJECT")) { - o = parseVALUENAMEDOBJECT(pRootE); - } else if (nodeName.equalsIgnoreCase("VALUE.OBJECTWITHPATH")) { - o = parseVALUEOBJECTWITHPATH(pRootE); - } else if (nodeName.equalsIgnoreCase("VALUE.OBJECTWITHLOCALPATH")) { - o = parseVALUEOBJECTWITHLOCALPATH(pRootE); - } else if (nodeName.equalsIgnoreCase("CLASS")) { - o = parseCLASS(pRootE); - } else if (nodeName.equalsIgnoreCase("CLASSPATH")) { - o = parseCLASSPATH(pRootE); - } else if (nodeName.equalsIgnoreCase("LOCALCLASSPATH")) { - o = parseLOCALCLASSPATH(pRootE); - } else if (nodeName.equalsIgnoreCase("OBJECTPATH")) { - o = parseOBJECTPATH(pRootE); - } else if (nodeName.equalsIgnoreCase("CLASSNAME")) { - o = parseCLASSNAME(pRootE); - } else if (nodeName.equalsIgnoreCase("INSTANCEPATH")) { - o = parseINSTANCEPATH(pRootE); - } else if (nodeName.equalsIgnoreCase("LOCALINSTANCEPATH")) { - o = parseLOCALINSTANCEPATH(pRootE); - } else if (nodeName.equalsIgnoreCase("INSTANCENAME")) { - o = parseINSTANCENAME(pRootE); - } else if (nodeName.equalsIgnoreCase("QUALIFIER")) { - o = parseQUALIFIER(pRootE); - } else if (nodeName.equalsIgnoreCase("PROPERTY")) { - o = parsePROPERTY(pRootE); - } else if (nodeName.equalsIgnoreCase("PROPERTY.ARRAY")) { - o = parsePROPERTYARRAY(pRootE); - } else if (nodeName.equalsIgnoreCase("PROPERTY.REFERENCE")) { - o = parsePROPERTYREFERENCE(pRootE); - } else if (nodeName.equalsIgnoreCase("METHOD")) { - o = parseMETHOD(pRootE); - } else if (nodeName.equalsIgnoreCase("PARAMETER")) { - o = parsePARAMETER(pRootE); - } else if (nodeName.equalsIgnoreCase("PARAMETER.REFERENCE")) { - o = parsePARAMETERREFERENCE(pRootE); - } else if (nodeName.equalsIgnoreCase("PARAMETER.ARRAY")) { - o = parsePARAMETERARRAY(pRootE); - } else if (nodeName.equalsIgnoreCase("PARAMETER.REFARRAY")) { - o = parsePARAMETERREFARRAY(pRootE); - } - return o; - } - - // /////////////////////////////////////////////////////////////////////////////////////////// - - /** - * hasNodes - * - * @param pParentE - * @return boolean - */ - private static boolean hasNodes(Element pParentE) { - NodeList nl = pParentE.getChildNodes(); - if (nl == null || nl.getLength() == 0) return false; - for (int i = 0; i < nl.getLength(); i++) { - Node n = nl.item(i); - if (!(n instanceof Text) || !("".equalsIgnoreCase(n.getNodeValue().trim()))) return true; - } - return false; - } - - /** - * hasTypeAttrsInNodes - * - * SVC CIMOM sends typed CIM-XML elements in a non-standard way. The TYPE - * attribute is included in the VALUE or VALUE.ARRAY element not in the - * enclosing element as the standard says. - * - * @param pParentE - * @return boolean - */ - private static boolean hasTypeAttrsInNodes(Element pParentE) { - NodeList nl = pParentE.getChildNodes(); - if (nl == null || nl.getLength() == 0) return false; - for (int i = 0; i < nl.getLength(); i++) { - Node n = nl.item(i); - String name = n.getNodeName(); - if ("VALUE".equalsIgnoreCase(name) || "VALUE.ARRAY".equalsIgnoreCase(name)) { - NamedNodeMap nm = n.getAttributes(); - if (nm != null - && (nm.getNamedItem("TYPE") != null || nm.getNamedItem("PARAMTYPE") != null)) return true; - } - } - return false; - } - - private static final HashMap NODENAME_HASH = new HashMap(); - - private static void initNodeNameHash(String[] pEnumA) { - for (int i = 0; i < pEnumA.length; i++) - NODENAME_HASH.put(pEnumA[i], pEnumA[i]); - } - - static { - initNodeNameHash(new String[] { "CIM", "DECLARATION", "DECLGROUP", "DECLGROUP.WITHNAME", - "DECLGROUP.WITHPATH", "QUALIFIER.DECLARATION", "SCOPE", "VALUE", "VALUE.ARRAY", - "VALUE.REFERENCE", "VALUE.REFARRAY", "VALUE.OBJECT", "VALUE.NAMEDINSTANCE", - "VALUE.NAMEDOBJECT", "VALUE.OBJECTWITHLOCALPATH", "VALUE.OBJECTWITHPATH", - "VALUE.NULL", "VALUE.INSTANCEWITHPATH", "NAMESPACEPATH", "LOCALNAMESPACEPATH", - "HOST", "NAMESPACE", "CLASSPATH", "LOCALCLASSPATH", "CLASSNAME", "INSTANCEPATH", - "LOCALINSTANCEPATH", "INSTANCENAME", "OBJECTPATH", "KEYBINDING", "KEYVALUE", - "CLASS", "INSTANCE", "QUALIFIER", "PROPERTY", "PROPERTY.ARRAY", - "PROPERTY.REFERENCE", "METHOD", "PARAMETER", "PARAMETER.REFERENCE", - "PARAMETER.ARRAY", "PARAMETER.REFARRAY", "MESSAGE", "MULTIREQ", "MULTIEXPREQ", - "SIMPLEREQ", "SIMPLEEXPREQ", "IMETHODCALL", "METHODCALL", "EXPMETHODCALL", - "PARAMVALUE", "IPARAMVALUE", "EXPPARAMVALUE", "MULTIRSP", "MULTIEXPRSP", - "SIMPLERSP", "SIMPLEEXPRSP", "METHODRESPONSE", "EXPMETHODRESPONSE", - "IMETHODRESPONSE", "ERROR", "RETURNVALUE", "IRETURNVALUE", "CORRELATOR" }); - } - - /** - * checkOtherNodes - * - * @param pParentE - * @param pAllowedChildNodes - */ - private static void checkOtherNodes(Element pParentE, String[] pAllowedChildNodes) - throws CIMXMLParseException { - NodeList nl = pParentE.getChildNodes(); - if (nl == null || nl.getLength() == 0) return; - for (int i = 0; i < nl.getLength(); i++) { - Node n = nl.item(i); - if (n instanceof Text && "".equalsIgnoreCase(n.getNodeValue().trim())) continue; - boolean found = false; - String name = n.getNodeName().toUpperCase(); - for (int j = 0; j < pAllowedChildNodes.length; j++) { - if (pAllowedChildNodes[j].equalsIgnoreCase(name)) { - found = true; - break; - } - } - if (!found && NODENAME_HASH.containsKey(name)) throw new CIMXMLParseException(pParentE - .getNodeName() - + " element contains invalid child element " + name + "!"); - } - } - - /** - * searchNodes - * - * @param pParentE - * @param pTagName - * @return Element[] - */ - public static Element[] searchNodes(Element pParentE, String pTagName) { - // return all of child nodes immediately below the parent - // return null if not found - NodeList nl = pParentE.getChildNodes(); - if (nl == null || nl.getLength() == 0) return null; - Vector resElementV = new Vector(); - for (int i = 0; i < nl.getLength(); i++) { - Node n = nl.item(i); - if (n.getNodeName().equals(pTagName)) { - resElementV.add(n); - } - } - return resElementV.toArray(new Element[0]); - } - - /** - * searchNodes - * - * @param pParentE - * @param pTagName - * @param pMin - * @param pMax - * @param pAllowOtherNodes - * @return Element[] - * @throws CIMXMLParseException - */ - public static Element[] searchNodes(Element pParentE, String pTagName, int pMin, int pMax, - boolean pAllowOtherNodes) throws CIMXMLParseException { - // return all child nodes immediately below parent, null if none found - - NodeList nl = pParentE.getChildNodes(); - if (nl == null || nl.getLength() == 0) { - if (pMin > 0) throw new CIMXMLParseException(pParentE.getNodeName() - + " element must have at least " + pMin + " " + pTagName + " child element(s)!"); - return null; - } - - String otherNode = null; - Vector resElementV = new Vector(); - for (int i = 0; i < nl.getLength(); i++) { - Node n = nl.item(i); - String name = n.getNodeName().toUpperCase(); - if (name.equals(pTagName)) { - resElementV.add(n); - } else if (NODENAME_HASH.containsKey(name)) { - otherNode = name; - } - } - - if (resElementV.size() < pMin) throw new CIMXMLParseException(pParentE.getNodeName() - + " element must have at least " + pMin + " " + pTagName + " child element(s)!"); - if (resElementV.size() > pMax) throw new CIMXMLParseException(pParentE.getNodeName() - + " element can have no more than " + pMax + " " + pTagName + " child element(s)!"); - if (resElementV.size() > 0 && !pAllowOtherNodes && otherNode != null) throw new CIMXMLParseException( - pParentE.getNodeName() + " element cannot have " + otherNode - + " child element(s) when it already has " + pTagName + " element(s)!"); - if (resElementV.size() == 0) return null; - - return resElementV.toArray(new Element[0]); - } - - /** - * searchFirstNode - * - * @param pParentE - * @param pTagName - * @return Node - */ - public static Node searchFirstNode(Element pParentE, String pTagName) { - // return the first node which matches to the specific name - // return null if not found - NodeList nl = pParentE.getChildNodes(); - for (int i = 0; i < nl.getLength(); i++) { - Node n = nl.item(i); - if (n.getNodeName().equals(pTagName)) { return n; } - } - return null; - } - - /** - * searchAttribute - * - * @param pParentN - * @param pAttrName - * @return Node - */ - public static Node searchAttribute(Node pParentN, String pAttrName) { - // return the attribute node with the specific name - NamedNodeMap nnm = pParentN.getAttributes(); - return nnm.getNamedItem(pAttrName); - } - - /** - * searchFirstChild - * - * @param pParentE - * @return Node - */ - public static Node searchFirstChild(Element pParentE) { - // return the first node which matches to the specific name - // return null if not found - return pParentE.getFirstChild(); - } - - /** - * createJavaObject - * - * @param pTypeStr - * @param pValue - * @return Object - * @throws CIMXMLParseException - */ - public static Object createJavaObject(String pTypeStr, String pValue) - throws CIMXMLParseException { - // return a java object with the specific type - if (pTypeStr == null) pTypeStr = MOF.DT_STR; - if (MOF.NULL.equalsIgnoreCase(pTypeStr)) return null; - Object o = null; - CIMDataType cimType = parseTypeStr(pTypeStr, false); - int radix = 10; - - if (pTypeStr.toLowerCase().startsWith("sint") || pTypeStr.toLowerCase().startsWith("uint")) { - pValue = pValue.toLowerCase(); - if (pValue.startsWith("0x") || pValue.startsWith("+0x") || pValue.startsWith("-0x")) { - radix = 16; - if (pValue.startsWith("-")) pValue = "-" + pValue.substring(3); - else pValue = pValue.substring(pValue.indexOf('x') + 1); - } - } - - switch (cimType.getType()) { - case CIMDataType.UINT8: - o = new UnsignedInteger8(Short.parseShort(pValue, radix)); - break; - case CIMDataType.UINT16: - o = new UnsignedInteger16(Integer.parseInt(pValue, radix)); - break; - case CIMDataType.UINT32: - o = new UnsignedInteger32(Long.parseLong(pValue, radix)); - break; - case CIMDataType.UINT64: - o = new UnsignedInteger64(new BigInteger(pValue, radix)); - break; - case CIMDataType.SINT8: - o = Byte.valueOf(pValue, radix); - break; - case CIMDataType.SINT16: - o = Short.valueOf(pValue, radix); - break; - case CIMDataType.SINT32: - o = Integer.valueOf(pValue, radix); - break; - case CIMDataType.SINT64: - o = Long.valueOf(pValue, radix); - break; - case CIMDataType.STRING: - o = pValue; - break; - case CIMDataType.BOOLEAN: - o = Boolean.valueOf(pValue); - break; - case CIMDataType.REAL32: - o = new Float(pValue); - break; - case CIMDataType.REAL64: - if (WBEMConfiguration.getGlobalConfiguration().verifyJavaLangDoubleStrings()) { - if (Util.isBadDoubleString(pValue)) throw new IllegalArgumentException( - "Double value string hangs older JVMs!\n" + pValue); - } - o = new Double(pValue); - break; - case CIMDataType.DATETIME: - o = getDateTime(pValue); - break; - case CIMDataType.REFERENCE: - o = new CIMObjectPath(pValue); - break; - case CIMDataType.CHAR16: - o = Character.valueOf(pValue.charAt(0)); - break; - // case CIMDataType.OBJECT: o = new CIMInstance(); break; //TODO - // case CIMDataType.CLASS: o = new CIMClass(value); break; //TODO - } - return o; - } - - private static CIMDateTime getDateTime(String pValue) throws CIMXMLParseException { - try { - return new CIMDateTimeAbsolute(pValue); - } catch (IllegalArgumentException eAbs) { - try { - return new CIMDateTimeInterval(pValue); - } catch (IllegalArgumentException eInt) { - throw new CIMXMLParseException("Failed to parse dateTime string: " + pValue + "!\n" - + "CIMDateTimeAbsolute parsing error:\n" + eAbs.getMessage() + "\n" - + "CIMDateTimeInterval parsing error:\n" + eInt.getMessage()); - } - } - } - - /** - * parseSIMPLEEXPRSP - * - * @param pSimpleExpRspE - * @return CIMResponse - * @throws CIMXMLParseException - */ - public static CIMResponse parseSIMPLEEXPRSP(Element pSimpleExpRspE) throws CIMXMLParseException { - // - - // EXPMETHODRESPONSE - Element[] expmethodresponseA = searchNodes(pSimpleExpRspE, "EXPMETHODRESPONSE", 1, 1, false); - if (expmethodresponseA != null) return parseEXPMETHODRESPONSE(expmethodresponseA[0]); - - throw new CIMXMLParseException( - "SIMPLEEXPRSP element missing EXPMETHODRESPONSE child element!"); - } - - /** - * parseMULTIEXPRSP - * - * @param pMultiExpRspE - * @return CIMResponse - * @throws CIMXMLParseException - */ - public static CIMResponse parseMULTIEXPRSP(Element pMultiExpRspE) throws CIMXMLParseException { - // - - Element[] multiExpRespElementA = searchNodes(pMultiExpRspE, "SIMPLEEXPRSP", 2, - Integer.MAX_VALUE, false); - if (multiExpRespElementA != null) { - CIMResponse multiExpRsp = new CIMResponse(); - for (int i = 0; i < multiExpRespElementA.length; i++) { - Element methodresponseE = multiExpRespElementA[i]; - CIMResponse rsp = parseSIMPLEEXPRSP(methodresponseE); - rsp.setMethod("SIMPLEEXPRSP"); - multiExpRsp.addResponse(rsp); - } - return multiExpRsp; - } - - throw new CIMXMLParseException("MULTIEXPRSP element missing SIMPLEEXPRSP child element!"); - } - - private static final String[] nodesEXPMETHODRESPONSE = { "ERROR", "IRETURNVALUE" }; - - /** - * parseEXPMETHODRESPONSE - * - * @param pExpMethodResponseE - * @return CIMResponse - * @throws CIMXMLParseException - */ - public static CIMResponse parseEXPMETHODRESPONSE(Element pExpMethodResponseE) - throws CIMXMLParseException { - // - - CIMResponse response = new CIMResponse(); - - if (attribute(pExpMethodResponseE, "NAME") == null) throw new CIMXMLParseException( - "EXPMETHODRESPONSE element missing NAME attribute!"); - - // ERROR - Element[] errorA = searchNodes(pExpMethodResponseE, "ERROR", 0, 1, false); - if (errorA != null) { - WBEMException exception = parseERROR(errorA[0]); - response.setError(exception); - return response; - } - - // RETURNVALUE - Element[] retValElementA = searchNodes(pExpMethodResponseE, "IRETURNVALUE", 0, 1, false); - if (retValElementA != null) { - Vector v = new Vector(); - Element returnvalueE = retValElementA[0]; - v.add(parseIRETURNVALUE(returnvalueE)); - response.setReturnValue(v); - return response; - } - - checkOtherNodes(pExpMethodResponseE, nodesEXPMETHODRESPONSE); - - return response; - } - - private static final String nodesCORRELATOR[] = { "VALUE" }; - - /** - * parseCORRELATOR - * - * @param pCorrelatorE - * @throws CIMXMLParseException - * */ - public static void parseCORRELATOR(Element pCorrelatorE) throws CIMXMLParseException { - // - // - String name = attribute(pCorrelatorE, "NAME"); - if (name == null) throw new CIMXMLParseException( - "CORRELATOR element missing NAME attribute!"); - String type = attribute(pCorrelatorE, "TYPE"); - if (type == null) throw new CIMXMLParseException( - "CORRELATOR element missing TYPE attribute!"); - - // VALUE - Element[] valueA = searchNodes(pCorrelatorE, "VALUE", 1, 1, false); - if (valueA != null) { - // TypedValue tVal = parseVALUE(valueA[0]); - } - - checkOtherNodes(pCorrelatorE, nodesCORRELATOR); - } -} +/* + CIMXMLParserImpl.java + + (C) Copyright IBM Corp. 2005, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1464860 2006-05-15 lupusalex No default value for VALUETYPE assumed + * 1535756 2006-08-07 lupusalex Make code warning free + * 1547910 2006-09-05 ebak parseIMETHODCALL() CIMObjectPath parsing problem + * 1547908 2006-09-05 ebak parseKEYBINDING() creates incorrect reference type + * 1545915 2006-09-05 ebak Wrong parsing of IMETHODCALL request + * 1660756 2007-03-02 ebak Embedded object support + * 1689085 2007-04-10 ebak Embedded object enhancements for Pegasus + * 1669961 2006-04-16 lupusalex CIMTypedElement.getType() =>getDataType() + * 1712656 2007-05-04 ebak Correct type identification for SVC CIMOM + * 1714878 2007-05-08 ebak Empty string property values are parsed as nulls + * 1737141 2007-06-18 ebak Sync up with JSR48 evolution + * 1769504 2007-08-15 ebak Type identification for VALUETYPE="numeric" + * 1783288 2007-09-10 ebak CIMClass.isAssociation() not working for retrieved classes. + * 1820763 2007-10-29 ebak Supporting the EmbeddedInstance qualifier + * 1827728 2007-11-20 ebak rework: embeddedInstances: attribute EmbeddedObject not set + * 1848607 2007-12-11 ebak Strict EmbeddedObject types + * 1944875 2008-05-29 blaschke-oss Indications with embedded objects are not accepted + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2210455 2008-10-30 blaschke-oss Enhance javadoc, fix potential null pointers + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2714989 2009-03-26 blaschke-oss Code cleanup from redundant null check et al + * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors + * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics + * 2823494 2009-08-03 rgummada Change Boolean constructor to static + * 2860081 2009-09-17 raman_arora Pull Enumeration Feature (DOM Parser) + * 2957387 2010-03-03 blaschke-oss EmbededObject XML attribute must not be all uppercases + * 3023143 2010-07-01 blaschke-oss CIMXMLParserImpl uses # constructor instead of valueOf + * 3027479 2010-07-09 blaschke-oss Dead store to local variable + * 3027615 2010-07-12 blaschke-oss Use CLASS_ARRAY_T instead of new CIMDataType(CLASS,0) + * 3293248 2011-05-03 blaschke-oss Support for CIM_ERROR instances within ERROR + * 3297028 2011-05-03 blaschke-oss Instances contain CIMClassProperty with DOM parser + * 3411944 2011-09-20 blaschke-oss createJavaObject exception with hex uint + * 3513353 2012-03-30 blaschke-oss TCK: CIMDataType arrays must have length >= 1 + * 3513349 2012-03-31 blaschke-oss TCK: CIMDataType must not accept null string + * 3466280 2012-04-23 blaschke-oss get instance failure for CIM_IndicationSubscription + * 3521119 2012-04-24 blaschke-oss JSR48 1.0.0: remove CIMObjectPath 2/3/4-parm ctors + * 3526679 2012-05-14 blaschke-oss DOM parser ignores ERROR node CODE + * 3572993 2012-10-01 blaschke-oss parseDouble("2.2250738585072012e-308") DoS vulnerability + * 3598613 2013-01-11 blaschke-oss different data type in cim instance and cim object path + * 2616 2013-02-23 blaschke-oss Add new API WBEMClientSBLIM.sendIndication() + * 2636 2013-05-08 blaschke-oss Nested embedded instances cause CIMXMLParseException + * 2640 2013-05-11 blaschke-oss Multiple CDATA parsing broken in DOM parser + * 2668 2013-09-24 blaschke-oss Potential null pointer exception in parseCIM + * 2669 2013-09-24 blaschke-oss Potential null pointer exception in parseMESSAGE + * 2670 2013-09-25 blaschke-oss NAME attribute not required by DOM parser + * 2671 2013-09-25 blaschke-oss Potential null pointer exception in parseERROR + * 2675 2013-09-27 blaschke-oss CIMXMLParseException messages should contain element name + * 2676 2013-09-27 blaschke-oss parseMULTI(EXP)REQ looking for wrong child elements + * 2678 2013-09-30 blaschke-oss parseMULTI___ allows one SIMPLE___ child element + * 2679 2013-10-01 blaschke-oss parseIMETHODCALL requires one IPARAMVALUE child element + * 2680 2013-10-02 blaschke-oss IPARAMVALUE parsing broken on DOM/SAX + * 2681 2013-10-02 blaschke-oss parseQUALIFIERDECLARATION does not require TYPE attribute + * 2683 2013-10-07 blaschke-oss KEYVALUE VALUETYPE optional, "string" default + * 2684 2013-10-07 blaschke-oss parseEXPMETHODRESPONSE has several issues + * 2685 2013-10-07 blaschke-oss Element.getAttribute returns empty string if no attribute + * 2686 2013-10-10 blaschke-oss parseEXPPARAMVALUE allows 2+ children, prohibits 0 + * 2688 2013-10-10 blaschke-oss parseMETHODCALL looks for CIMName attribute instead of NAME + * 2537 2013-10-17 blaschke-oss Add new data types for PARAMVALUE + * 2691 2013-10-18 blaschke-oss RETURNVALUE should not require PARAMTYPE attribute + * 2694 2013-10-25 blaschke-oss NAME attribute not required by DOM parser (part 2) + * 2695 2013-10-25 blaschke-oss parseMETHODCALL allows LOCALCLASSPATH and LOCALINSTANCEPATH + * 2696 2013-10-29 blaschke-oss parseIRETURNVALUE ignores VALUE and VALUE.ARRAY + * 2699 2013-11-05 blaschke-oss parseQUALIFIER does not require TYPE attribute + * 2700 2013-11-07 blaschke-oss PROPERTY does not require TYPE attribute + * 2701 2013-11-07 blaschke-oss PROPERTY.ARRAY does not require TYPE attribute + * 2702 2013-11-07 blaschke-oss Bad PROPERTY.ARRAY ARRAYSIZE generates NumberFormatException + * 2703 2013-11-08 blaschke-oss MethodNode should not require TYPE attribute + * 2704 2013-11-11 blaschke-oss PARAMETER does not require TYPE attribute + * 2705 2013-11-11 blaschke-oss PARAMETER.ARRAY does not require TYPE attribute + * 2706 2013-11-11 blaschke-oss Bad PARAMETER.REFARRAY ARRAYSIZE generates NumberFormatException + * 2707 2013-11-12 blaschke-oss INSTANCENAME ignores KEYVALUE and VALUE.REFERENCE children + * 2710 2013-11-13 blaschke-oss parseVALUEOBJECTWITH(LOCAL)PATH ignores (LOCAL)CLASSPATH child + * 2711 2013-11-13 blaschke-oss LOCALNAMESPACEPATH allows 0 NAMESPACE children + * 2713 2013-11-22 blaschke-oss Enforce loose validation of CIM-XML documents + * 2715 2013-11-26 blaschke-oss Add VALUE.NULL support + * 2538 2013-11-28 blaschke-oss CR14: Support new CORRELATOR element + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.StringReader; +import java.math.BigInteger; +import java.util.Comparator; +import java.util.HashMap; +import java.util.TreeMap; +import java.util.Vector; +import java.util.logging.Level; + +import org.metricshub.wbem.javax.cim.CIMArgument; +import org.metricshub.wbem.javax.cim.CIMClass; +import org.metricshub.wbem.javax.cim.CIMClassProperty; +import org.metricshub.wbem.javax.cim.CIMDataType; +import org.metricshub.wbem.javax.cim.CIMDateTimeAbsolute; +import org.metricshub.wbem.javax.cim.CIMDateTimeInterval; +import org.metricshub.wbem.javax.cim.CIMInstance; +import org.metricshub.wbem.javax.cim.CIMMethod; +import org.metricshub.wbem.javax.cim.CIMObjectPath; +import org.metricshub.wbem.javax.cim.CIMParameter; +import org.metricshub.wbem.javax.cim.CIMQualifier; +import org.metricshub.wbem.javax.cim.CIMQualifierType; +import org.metricshub.wbem.javax.wbem.WBEMException; +import org.metricshub.wbem.sblim.cimclient.internal.cim.CIMHelper; +import org.metricshub.wbem.sblim.cimclient.internal.cim.CIMQualifiedElementInterfaceImpl; +import org.metricshub.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; +import org.metricshub.wbem.sblim.cimclient.internal.util.MOF; +import org.metricshub.wbem.sblim.cimclient.internal.util.Util; +import org.metricshub.wbem.sblim.cimclient.internal.util.WBEMConfiguration; +import org.metricshub.wbem.sblim.cimclient.internal.util.XMLHostStr; +import org.metricshub.wbem.javax.cim.CIMDateTime; +import org.metricshub.wbem.javax.cim.CIMFlavor; +import org.metricshub.wbem.javax.cim.CIMNamedElementInterface; +import org.metricshub.wbem.javax.cim.CIMProperty; +import org.metricshub.wbem.javax.cim.CIMScope; +import org.metricshub.wbem.javax.cim.UnsignedInteger16; +import org.metricshub.wbem.javax.cim.UnsignedInteger32; +import org.metricshub.wbem.javax.cim.UnsignedInteger64; +import org.metricshub.wbem.javax.cim.UnsignedInteger8; +import org.w3c.dom.Attr; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.w3c.dom.Text; +import org.xml.sax.InputSource; + +/** + * Class CIMXMLParserImpl is the main class of CIM-XML DOM parser. + * + */ +public class CIMXMLParserImpl { + + /* + * ebak: local object path - should be used by parseLOCALCLASSPATH(), + * parseLOCALINSTANCEPATH(), parseCLASSNAME(), parseINSTANCENAME(), + * parseCLASS() and parseINSTANCE() + */ + private static LocalPathBuilder cLocalPathBuilder = new LocalPathBuilder(null); + + /** + * setLocalObjectPath + * + * @param pLocalOp + * - empty fields of parsed objectpaths will be substituted by + * fields coming from this parameter + */ + public static void setLocalObjectPath(CIMObjectPath pLocalOp) { + cLocalPathBuilder = new LocalPathBuilder(pLocalOp); + } + + /* + * / local object path + */ + + /** + * parseCIM + * + * @param pCimE + * @return CIMMessage + * @throws CIMXMLParseException + */ + public static CIMMessage parseCIM(Element pCimE) throws CIMXMLParseException { + // + // + Attr cim_cimversionA = (Attr) searchAttribute(pCimE, "CIMVERSION"); + if (cim_cimversionA == null) throw new CIMXMLParseException( + "CIM element missing CIMVERSION attribute!"); + String cimversion = cim_cimversionA.getNodeValue(); + + Attr cim_dtdversionA = (Attr) searchAttribute(pCimE, "DTDVERSION"); + if (cim_dtdversionA == null) throw new CIMXMLParseException( + "CIM element missing DTDVERSION attribute!"); + String dtdversion = cim_dtdversionA.getNodeValue(); + + // MESSAGE + Element messageA[] = searchNodes(pCimE, "MESSAGE", 0, 1, false); + if (messageA != null) { + CIMMessage message = parseMESSAGE(cimversion, dtdversion, messageA[0]); + message.setCIMVersion(cimversion); + message.setDTDVersion(dtdversion); + return message; + } + + // DECLARATION + if (searchNodes(pCimE, "DECLARATION", 0, 1, false) != null) throw new CIMXMLParseException( + "DECLARATION element not supported!"); + + throw new CIMXMLParseException("CIM element missing required child element!"); + } + + // //////////////////////////////////////////////////////////////////////////////////////// + // Value Elements + // //////////////////////////////////////////////////////////////////////////////////////// + + /** + * parseVALUE - supports the non-standard TYPE attribute + * + * @param pValueE + * @return TypedValue, type is null if no TYPE attribute was found, the + * value is always String, the caller method have to convert it. + * @throws CIMXMLParseException + */ + public static TypedValue parseVALUE(Element pValueE) throws CIMXMLParseException { + // + + String typeStr = attribute(pValueE, "TYPE"); + CIMDataType type = typeStr == null ? null : parseScalarTypeStr(typeStr); + // ebak: empty VALUE element is parsed as empty String + NodeList list = pValueE.getChildNodes(); + StringBuilder valueStr = new StringBuilder(); + for (int i = 0; i < list.getLength(); i++) { + Text t = (Text) list.item(i); + if (t != null) { + String nodeValue = t.getNodeValue(); + if (nodeValue != null) valueStr.append(nodeValue); + } + } + return new TypedValue(type, valueStr.toString()); + } + + /** + * parseVALUEARRAY - supports the non-standard TYPE attribute + * + * @param pValueArrayE + * @return TypedValue, type is null if no TYPE attribute was found, the + * value is always String[], the caller method have to convert it. + * @throws CIMXMLParseException + */ + public static TypedValue parseVALUEARRAY(Element pValueArrayE) throws CIMXMLParseException { + // + String typeStr = attribute(pValueArrayE, "TYPE"); + CIMDataType type = typeStr == null ? null : parseArrayTypeStr(typeStr); + + // Process node list here, order of VALUE/VALUE.NULL IS important + NodeList nl = pValueArrayE.getChildNodes(); + if (nl == null || nl.getLength() == 0) return new TypedValue(type, new String[0]); + Vector resStringV = new Vector(); + for (int i = 0; i < nl.getLength(); i++) { + Node n = nl.item(i); + if (n instanceof Text && "".equalsIgnoreCase(n.getNodeValue().trim())) continue; + String name = n.getNodeName(); + if (name.equals("VALUE")) { + resStringV.add((String) parseVALUE((Element) n).getValue()); + } else if (name.equals("VALUE.NULL")) { + resStringV.add(null); + } else if (NODENAME_HASH.containsKey(name)) { throw new CIMXMLParseException( + "VALUE.ARRAY element contains invalid child element " + name + "!"); } + } + return new TypedValue(type, resStringV.toArray(new String[0])); + } + + /** + * parseVALUEREFERENCE + * + * @param pValuereferenceE + * @return CIMObjectPath + * @throws CIMXMLParseException + */ + public static CIMObjectPath parseVALUEREFERENCE(Element pValuereferenceE) + throws CIMXMLParseException { + // + + // CLASSPATH + Element classpathA[] = searchNodes(pValuereferenceE, "CLASSPATH", 0, 1, false); + if (classpathA != null) { + CIMObjectPath op = parseCLASSPATH(classpathA[0]); + return op; + } + + // LOCALCLASSPATH + Element localclasspathA[] = searchNodes(pValuereferenceE, "LOCALCLASSPATH", 0, 1, false); + if (localclasspathA != null) { + CIMObjectPath op = parseLOCALCLASSPATH(localclasspathA[0]); + return op; + } + + // CLASSNAME + Element classnameA[] = searchNodes(pValuereferenceE, "CLASSNAME", 0, 1, false); + if (classnameA != null) { + CIMObjectPath op = parseCLASSNAME(classnameA[0]); + if (op != null && op.getNamespace() != null) { + // LocalPathBuilder includes default namespace in CLASSNAME + // elements, needs to be stripped + op = new CIMObjectPath(op.getScheme(), op.getHost(), op.getPort(), null, op + .getObjectName(), op.getKeys(), op.getXmlSchemaName()); + } + return op; + } + + // INSTANCEPATH + Element instancepathA[] = searchNodes(pValuereferenceE, "INSTANCEPATH", 0, 1, false); + if (instancepathA != null) { + CIMObjectPath op = parseINSTANCEPATH(instancepathA[0]); + return op; + } + + // LOCALINSTANCEPATH + Element localinstancepathA[] = searchNodes(pValuereferenceE, "LOCALINSTANCEPATH", 0, 1, + false); + if (localinstancepathA != null) { + CIMObjectPath op = parseLOCALINSTANCEPATH(localinstancepathA[0]); + return op; + } + + // INSTANCENAME + Element instancenameA[] = searchNodes(pValuereferenceE, "INSTANCENAME", 0, 1, false); + if (instancenameA != null) { + CIMObjectPath op = parseINSTANCENAME(instancenameA[0]); + if (op != null && op.getNamespace() != null) { + // LocalPathBuilder includes default namespace in INSTANCENAME + // elements, needs to be stripped + op = new CIMObjectPath(op.getScheme(), op.getHost(), op.getPort(), null, op + .getObjectName(), op.getKeys(), op.getXmlSchemaName()); + } + return op; + } + + throw new CIMXMLParseException("VALUE.REFERENCE element missing required child element!"); + } + + /** + * parseVALUEREFARRAY + * + * @param pValueRefArrayE + * @return CIMObjectPath[] + * @throws CIMXMLParseException + */ + public static CIMObjectPath[] parseVALUEREFARRAY(Element pValueRefArrayE) + throws CIMXMLParseException { + // + + // Process node list here, order of VALUE.REFERENCE/VALUE.NULL IS + // important + NodeList nl = pValueRefArrayE.getChildNodes(); + if (nl == null || nl.getLength() == 0) return new CIMObjectPath[0]; + Vector resObjectPathV = new Vector(); + for (int i = 0; i < nl.getLength(); i++) { + Node n = nl.item(i); + if (n instanceof Text && "".equalsIgnoreCase(n.getNodeValue().trim())) continue; + String name = n.getNodeName(); + if (name.equals("VALUE.REFERENCE")) { + resObjectPathV.add(parseVALUEREFERENCE((Element) n)); + } else if (name.equals("VALUE.NULL")) { + resObjectPathV.add(null); + } else if (NODENAME_HASH.containsKey(name)) { throw new CIMXMLParseException( + "VALUE.REFARRAY element contains invalid child element " + name + "!"); } + } + return resObjectPathV.toArray(new CIMObjectPath[0]); + } + + /** + * parseVALUEOBJECT + * + * @param pValueObjectE + * @return CIMNamedElementInterface (CIMClass|CIMInstance) + * @throws CIMXMLParseException + */ + public static CIMNamedElementInterface parseVALUEOBJECT(Element pValueObjectE) + throws CIMXMLParseException { + // + + // CLASS + Element classA[] = searchNodes(pValueObjectE, "CLASS", 0, 1, false); + if (classA != null) { + CIMClass obj = parseCLASS(classA[0]); + return obj; + } + + // INSTANCE + Element instanceA[] = searchNodes(pValueObjectE, "INSTANCE", 0, 1, false); + if (instanceA != null) { + CIMInstance obj = parseINSTANCE(instanceA[0]); + return obj; + } + + throw new CIMXMLParseException("VALUE.OBJECT element missing required child element!"); + } + + private static final String nodesVALUENAMEDINSTANCE[] = { "INSTANCENAME", "INSTANCE" }; + + /** + * parseVALUENAMEDINSTANCE + * + * @param pValueNamedInstanceE + * @return CIMInstance + * @throws CIMXMLParseException + */ + public static CIMInstance parseVALUENAMEDINSTANCE(Element pValueNamedInstanceE) + throws CIMXMLParseException { + // + + // INSTANCENAME + Element instancenameA[] = searchNodes(pValueNamedInstanceE, "INSTANCENAME", 1, 1, true); + if (instancenameA == null) { throw new CIMXMLParseException( + "VALUE.NAMEDINSTANCE element missing INSTANCENAME child element!"); } + CIMObjectPath op = parseINSTANCENAME(instancenameA[0]); + + // INSTANCE + Element instanceA[] = searchNodes(pValueNamedInstanceE, "INSTANCE", 1, 1, true); + if (instanceA == null) { throw new CIMXMLParseException( + "VALUE.NAMEDINSTANCE element missing INSTANCE child element!"); } + CIMInstance inst = parseINSTANCE(instanceA[0], op); // BB mod + checkOtherNodes(pValueNamedInstanceE, nodesVALUENAMEDINSTANCE); + return inst; + } + + private static final String nodesVALUEINSTANCEWITHPATH[] = { "INSTANCEPATH", "INSTANCE" }; + + /** + * parseVALUEINSTANCEWITHPATH + * + * @param pValueNamedInstanceE + * @return CIMInstance + * @throws CIMXMLParseException + */ + public static CIMInstance parseVALUEINSTANCEWITHPATH(Element pValueNamedInstanceE) + throws CIMXMLParseException { + // + + // INSTANCEPATH + Element instancepathA[] = searchNodes(pValueNamedInstanceE, "INSTANCEPATH", 1, 1, true); + if (instancepathA == null) { throw new CIMXMLParseException( + "VALUE.INSTANCEWITHPATH element missing INSTANCEPATH child element!"); } + CIMObjectPath op = parseINSTANCEPATH(instancepathA[0]); + + // INSTANCE + Element instanceA[] = searchNodes(pValueNamedInstanceE, "INSTANCE", 1, 1, true); + if (instanceA == null) { throw new CIMXMLParseException( + "VALUE.INSTANCEWITHPATH element missing INSTANCE child element!"); } + CIMInstance inst = parseINSTANCE(instanceA[0], op); // BB mod + checkOtherNodes(pValueNamedInstanceE, nodesVALUEINSTANCEWITHPATH); + return inst; + } + + private static final String nodesVALUENAMEDOBJECTi[] = { "INSTANCENAME", "INSTANCE" }; + + /** + * parseVALUENAMEDOBJECT + * + * @param pValueNamedObjectE + * @return CIMNamedElementInterface + * @throws CIMXMLParseException + */ + public static CIMNamedElementInterface parseVALUENAMEDOBJECT(Element pValueNamedObjectE) + throws CIMXMLParseException { + // + + // CLASS + Element classA[] = searchNodes(pValueNamedObjectE, "CLASS", 0, 1, false); + if (classA != null) { + CIMClass obj = parseCLASS(classA[0]); + // checkOtherNodes(pValueNamedObjectE, nodesVALUENAMEDOBJECTc); + return obj; + } + + // INSTANCENAME + Element instancenameA[] = searchNodes(pValueNamedObjectE, "INSTANCENAME", 0, 1, true); + if (instancenameA != null) { + CIMObjectPath op = parseINSTANCENAME(instancenameA[0]); + + // INSTANCE + Element instanceA[] = searchNodes(pValueNamedObjectE, "INSTANCE", 0, 1, true); + if (instanceA == null) { throw new CIMXMLParseException( + "VALUE.NAMEDOBJECT element missing INSTANCE child element!"); } + CIMInstance inst = parseINSTANCE(instanceA[0], op); // BB mod + checkOtherNodes(pValueNamedObjectE, nodesVALUENAMEDOBJECTi); + return inst; + } + + throw new CIMXMLParseException("VALUE.NAMEDOBJECT element missing required child element!"); + } + + private static final String nodesVALUEOBJECTWITHPATHcls[] = { "CLASSPATH", "CLASS" }; + + private static final String nodesVALUEOBJECTWITHPATHins[] = { "INSTANCEPATH", "INSTANCE" }; + + /** + * parseVALUEOBJECTWITHPATH + * + * @param pValueObjectWithPathE + * @return CIMNamedElementInterface + * @throws CIMXMLParseException + */ + public static CIMNamedElementInterface parseVALUEOBJECTWITHPATH(Element pValueObjectWithPathE) + throws CIMXMLParseException { + // + + // CLASSPATH + Element classpathA[] = searchNodes(pValueObjectWithPathE, "CLASSPATH", 0, 1, true); + if (classpathA != null) { + CIMObjectPath op = parseCLASSPATH(classpathA[0]); + + // CLASS + Element classA[] = searchNodes(pValueObjectWithPathE, "CLASS", 0, 1, true); + if (classA == null) { throw new CIMXMLParseException( + "VALUE.OBJECTWITHPATH element missing CLASS child element!"); } + + CIMClass obj = parseCLASS(classA[0], op); + checkOtherNodes(pValueObjectWithPathE, nodesVALUEOBJECTWITHPATHcls); + return obj; + } + + // INSTANCEPATH + Element instancepathA[] = searchNodes(pValueObjectWithPathE, "INSTANCEPATH", 0, 1, true); + if (instancepathA != null) { + CIMObjectPath op = parseINSTANCEPATH(instancepathA[0]); + + // INSTANCE + Element instanceA[] = searchNodes(pValueObjectWithPathE, "INSTANCE", 0, 1, true); + if (instanceA == null) { throw new CIMXMLParseException( + "VALUE.OBJECTWITHPATH element missing INSTANCE child element!"); } + CIMInstance inst = parseINSTANCE(instanceA[0], op); // BB mod + checkOtherNodes(pValueObjectWithPathE, nodesVALUEOBJECTWITHPATHins); + return inst; + } + + throw new CIMXMLParseException( + "VALUE.OBJECTWITHPATH element missing required child element!"); + } + + private static final String nodesVALUEOBJECTWITHLOCALPATHcls[] = { "LOCALCLASSPATH", "CLASS" }; + + private static final String nodesVALUEOBJECTWITHLOCALPATHins[] = { "LOCALINSTANCEPATH", + "INSTANCE" }; + + /** + * parseVALUEOBJECTWITHLOCALPATH + * + * @param pValueObjectWithLocalPathE + * @return CIMNamedElementInterface + * @throws CIMXMLParseException + */ + public static CIMNamedElementInterface parseVALUEOBJECTWITHLOCALPATH( + Element pValueObjectWithLocalPathE) throws CIMXMLParseException { + // + + // LOCALCLASSPATH + Element localclasspathA[] = searchNodes(pValueObjectWithLocalPathE, "LOCALCLASSPATH", 0, 1, + true); + if (localclasspathA != null) { + CIMObjectPath op = parseLOCALCLASSPATH(localclasspathA[0]); + + // CLASS + Element classA[] = searchNodes(pValueObjectWithLocalPathE, "CLASS", 0, 1, true); + if (classA == null) { throw new CIMXMLParseException( + "VALUE.OBJECTWITHLOCALPATH element missing CLASS child element!"); } + + CIMClass obj = parseCLASS(classA[0], op); + checkOtherNodes(pValueObjectWithLocalPathE, nodesVALUEOBJECTWITHLOCALPATHcls); + return obj; + } + + // LOCALINSTANCEPATH + Element localinstancepathA[] = searchNodes(pValueObjectWithLocalPathE, "LOCALINSTANCEPATH", + 0, 1, true); + if (localinstancepathA != null) { + CIMObjectPath op = parseLOCALINSTANCEPATH(localinstancepathA[0]); + + // INSTANCE + Element instanceA[] = searchNodes(pValueObjectWithLocalPathE, "INSTANCE", 0, 1, true); + if (instanceA == null) { throw new CIMXMLParseException( + "VALUE.OBJECTWITHLOCALPATH element missing INSTANCE child element!"); } + CIMInstance inst = parseINSTANCE(instanceA[0], op); // BB mod + checkOtherNodes(pValueObjectWithLocalPathE, nodesVALUEOBJECTWITHLOCALPATHins); + return inst; + } + + throw new CIMXMLParseException( + "VALUE.OBJECTWITHLOCALPATH element missing required child element!"); + } + + // //////////////////////////////////////////////////////////////////////////////////////// + // Naming and Location elements + // //////////////////////////////////////////////////////////////////////////////////////// + + private static final String nodesNAMESPACEPATH[] = { "HOST", "LOCALNAMESPACEPATH" }; + + /** + * parseNAMESPACEPATH + * + * @param pNameSpacePathE + * @return CIMObjectPath + * @throws CIMXMLParseException + */ + public static CIMObjectPath parseNAMESPACEPATH(Element pNameSpacePathE) + throws CIMXMLParseException { + // + // HOST + Element hostA[] = searchNodes(pNameSpacePathE, "HOST", 1, 1, true); + if (hostA == null) { throw new CIMXMLParseException( + "NAMESPACEPATH element missing HOST child element!"); } + XMLHostStr xmlHostStr = new XMLHostStr(parseHOST(hostA[0])); + // LOCALNAMESPACE + Element localnamespacepathA[] = searchNodes(pNameSpacePathE, "LOCALNAMESPACEPATH", 1, 1, + true); + if (localnamespacepathA == null) { throw new CIMXMLParseException( + "NAMESPACEPATH element missing LOCALNAMESPACEPATH child element!"); } + String nameSpace = parseLOCALNAMESPACEPATH(localnamespacepathA[0]); + /* + * CIMObjectPath( String scheme, String host, String port, String + * namespace, String objectName, CIMProperty[] keys ) + */ + checkOtherNodes(pNameSpacePathE, nodesNAMESPACEPATH); + return new CIMObjectPath(xmlHostStr.getProtocol(), xmlHostStr.getHost(), xmlHostStr + .getPort(), nameSpace, null, null); + } + + /** + * parseLOCALNAMESPACEPATH + * + * @param pLocalNameSpaceE + * @return String + * @throws CIMXMLParseException + */ + public static String parseLOCALNAMESPACEPATH(Element pLocalNameSpaceE) + throws CIMXMLParseException { + // + + Element[] nameSpaceElementA = searchNodes(pLocalNameSpaceE, "NAMESPACE", 1, + Integer.MAX_VALUE, false); + if (nameSpaceElementA == null) { + if (WBEMConfiguration.getGlobalConfiguration().allowEmptyLocalNameSpacePath() + && cLocalPathBuilder != null) return cLocalPathBuilder.getBasePath() + .getNamespace(); + throw new CIMXMLParseException( + "LOCALNAMESPACEPATH element missing NAMESPACE child element!"); + } + StringBuffer sb = new StringBuffer(); + for (int i = 0; i < nameSpaceElementA.length; i++) { + Element namespaceE = nameSpaceElementA[i]; + String s = parseNAMESPACE(namespaceE); + if (i > 0) sb.append("/" + s); + else sb.append(s); + } + return sb.toString(); + } + + /** + * parseHOST + * + * @param pHostE + * @return String + */ + public static String parseHOST(Element pHostE) { + // + + Text valueT = (Text) searchFirstChild(pHostE); + String host = valueT.getNodeValue(); + return host; + } + + private static final String nodesNAMESPACE[] = {}; + + /** + * parseNAMESPACE + * + * @param pNameSpaceE + * @return String + * @throws CIMXMLParseException + */ + public static String parseNAMESPACE(Element pNameSpaceE) throws CIMXMLParseException { + // + // + + Attr namespace_nameA = (Attr) searchAttribute(pNameSpaceE, "NAME"); + if (namespace_nameA == null) throw new CIMXMLParseException( + "NAMESPACE element missing NAME attribute!"); + String n = namespace_nameA.getValue(); + checkOtherNodes(pNameSpaceE, nodesNAMESPACE); + return n; + } + + private static final String nodesCLASSPATH[] = { "NAMESPACEPATH", "CLASSNAME" }; + + /** + * parseCLASSPATH + * + * @param pClassPathE + * @return CIMObjectPath + * @throws CIMXMLParseException + */ + public static CIMObjectPath parseCLASSPATH(Element pClassPathE) throws CIMXMLParseException { + // + + // NAMESPACEPATH + Element namespacepathA[] = searchNodes(pClassPathE, "NAMESPACEPATH", 1, 1, true); + if (namespacepathA == null) { throw new CIMXMLParseException( + "CLASSPATH element missing NAMESPACEPATH child element!"); } + CIMObjectPath nsPath = parseNAMESPACEPATH(namespacepathA[0]); + // CLASSNAME + Element classnameA[] = searchNodes(pClassPathE, "CLASSNAME", 1, 1, true); + if (classnameA == null) { throw new CIMXMLParseException( + "CLASSPATH element missing CLASSNAME child element!"); } + String className = parseClassName(classnameA[0]); + /* + * CIMObjectPath( String scheme, String host, String port, String + * namespace, String objectName, CIMProperty[] keys ) + */ + checkOtherNodes(pClassPathE, nodesCLASSPATH); + return new CIMObjectPath(nsPath.getScheme(), nsPath.getHost(), nsPath.getPort(), nsPath + .getNamespace(), className, null); + } + + private static final String nodesLOCALCLASSPATH[] = { "LOCALNAMESPACEPATH", "CLASSNAME" }; + + /** + * parseLOCALCLASSPATH + * + * @param pClassPathE + * @return CIMObjectPath + * @throws CIMXMLParseException + */ + public static CIMObjectPath parseLOCALCLASSPATH(Element pClassPathE) + throws CIMXMLParseException { + // + + // NAMESPACEPATH + Element localnamespacepathA[] = searchNodes(pClassPathE, "LOCALNAMESPACEPATH", 1, 1, true); + if (localnamespacepathA == null) { throw new CIMXMLParseException( + "LOCALCLASSPATH element missing LOCALNAMESPACEPATH child element!"); } + String nameSpace = parseLOCALNAMESPACEPATH(localnamespacepathA[0]); + + // CLASSNAME + Element classnameA[] = searchNodes(pClassPathE, "CLASSNAME", 1, 1, true); + if (classnameA == null) { throw new CIMXMLParseException( + "LOCALCLASSPATH element missing CLASSNAME child element!"); } + CIMObjectPath op = parseCLASSNAME(classnameA[0]); + checkOtherNodes(pClassPathE, nodesLOCALCLASSPATH); + return cLocalPathBuilder.build(op.getObjectName(), nameSpace); + } + + private static final String nodesCLASSNAME[] = {}; + + /** + * parseClassName + * + * @param pClassNameE + * @return String + * @throws CIMXMLParseException + */ + public static String parseClassName(Element pClassNameE) throws CIMXMLParseException { + // + // + Attr classname_nameA = (Attr) searchAttribute(pClassNameE, "NAME"); + if (classname_nameA == null) throw new CIMXMLParseException( + "CLASSNAME element missing NAME attribute!"); + checkOtherNodes(pClassNameE, nodesCLASSNAME); + return classname_nameA.getNodeValue(); + } + + /** + * parseCLASSNAME + * + * @param pClassNameE + * @return CIMObjectPath + * @throws CIMXMLParseException + */ + public static CIMObjectPath parseCLASSNAME(Element pClassNameE) throws CIMXMLParseException { + return cLocalPathBuilder.build(parseClassName(pClassNameE), null); + } + + private static final String nodesINSTANCEPATH[] = { "NAMESPACEPATH", "INSTANCENAME" }; + + /** + * parseINSTANCEPATH + * + * @param pInstancePathE + * @return CIMObjectPath + * @throws CIMXMLParseException + */ + public static CIMObjectPath parseINSTANCEPATH(Element pInstancePathE) + throws CIMXMLParseException { + // + + // NAMESPACEPATH + Element namespacepathA[] = searchNodes(pInstancePathE, "NAMESPACEPATH", 1, 1, true); + if (namespacepathA == null) { throw new CIMXMLParseException( + "INSTANCEPATH element missing NAMESPACEPATH child element!"); } + CIMObjectPath nsPath = parseNAMESPACEPATH(namespacepathA[0]); + // INSTANCENAME + Element instancenameA[] = searchNodes(pInstancePathE, "INSTANCENAME", 1, 1, true); + if (instancenameA == null) { throw new CIMXMLParseException( + "INSTANCEPATH element missing INSTANCENAME child element!"); } + CIMObjectPath op = parseINSTANCENAME(instancenameA[0]); + // ebak: change host and namespace + checkOtherNodes(pInstancePathE, nodesINSTANCEPATH); + return new CIMObjectPath(nsPath.getScheme(), nsPath.getHost(), nsPath.getPort(), nsPath + .getNamespace(), op.getObjectName(), op.getKeys()); + } + + private static final String nodesLOCALINSTANCEPATH[] = { "LOCALNAMESPACEPATH", "INSTANCENAME" }; + + /** + * parseLOCALINSTANCEPATH + * + * @param pLocalInstancePathE + * @return CIMObjectPath + * @throws CIMXMLParseException + */ + public static CIMObjectPath parseLOCALINSTANCEPATH(Element pLocalInstancePathE) + throws CIMXMLParseException { + // + + // LOCALNAMESPACEPATH + Element localnamespacepathA[] = searchNodes(pLocalInstancePathE, "LOCALNAMESPACEPATH", 1, + 1, true); + if (localnamespacepathA == null) { throw new CIMXMLParseException( + "LOCALINSTANCEPATH element missing LOCALNAMESPACEPATH child element!"); } + String nameSpace = parseLOCALNAMESPACEPATH(localnamespacepathA[0]); + + // INSTANCENAME + Element instancenameA[] = searchNodes(pLocalInstancePathE, "INSTANCENAME", 1, 1, true); + if (instancenameA == null) { throw new CIMXMLParseException( + "LOCALINSTANCEPATH element missing INSTANCENAME child element!"); } + CIMObjectPath op = parseINSTANCENAME(instancenameA[0]); + /* + * CIMObjectPath(String objectName, String namespace, CIMProperty[] + * keys) + */ + checkOtherNodes(pLocalInstancePathE, nodesLOCALINSTANCEPATH); + return cLocalPathBuilder.build(op.getObjectName(), nameSpace, op.getKeys()); + } + + private static final String nodesINSTANCENAME[] = { "KEYBINDING", "KEYVALUE", "VALUE.REFERENCE" }; + + /** + * parseINSTANCENAME + * + * @param pInstanceNameE + * @return CIMObjectPath + * @throws CIMXMLParseException + */ + public static CIMObjectPath parseINSTANCENAME(Element pInstanceNameE) + throws CIMXMLParseException { + // + // + Attr instance_classnameA = (Attr) searchAttribute(pInstanceNameE, "CLASSNAME"); + if (instance_classnameA == null) throw new CIMXMLParseException( + "INSTANCENAME element missing CLASSNAME attribute!"); + String opClassName = instance_classnameA.getNodeValue(); + + // KEYBINDING + Element[] keyBindingElementA = searchNodes(pInstanceNameE, "KEYBINDING", 0, + Integer.MAX_VALUE, false); + if (keyBindingElementA != null) { + CIMProperty[] keys = new CIMProperty[keyBindingElementA.length]; + for (int i = 0; i < keyBindingElementA.length; i++) { + Element keybindingE = keyBindingElementA[i]; + keys[i] = parseKEYBINDING(keybindingE); + } + return cLocalPathBuilder.build(opClassName, null, keys); + } + + // KEYVALUE + Element keyvalueA[] = searchNodes(pInstanceNameE, "KEYVALUE", 0, 1, false); + if (keyvalueA != null) { + CIMProperty[] keys = new CIMProperty[1]; + TypedValue propTypedVal = parseKEYVALUE(keyvalueA[0]); + keys[0] = new CIMProperty("", propTypedVal.getType(), propTypedVal.getValue(), + true, false, null); + return cLocalPathBuilder.build(opClassName, null, keys); + } + + // VALUE.REFERENCE + Element valuereferenceA[] = searchNodes(pInstanceNameE, "VALUE.REFERENCE", 0, 1, false); + if (valuereferenceA != null) { + CIMProperty[] keys = new CIMProperty[1]; + CIMObjectPath op = parseVALUEREFERENCE(valuereferenceA[0]); + keys[0] = new CIMProperty("", new CIMDataType(op.getObjectName()), op, + true, false, null); + return cLocalPathBuilder.build(opClassName, null, keys); + } + + checkOtherNodes(pInstanceNameE, nodesINSTANCENAME); + + return new CIMObjectPath(null, null, null, null, opClassName, null); + } + + /** + * parseOBJECTPATH + * + * @param pObjectPathE + * @return CIMObjectPath + * @throws CIMXMLParseException + */ + public static CIMObjectPath parseOBJECTPATH(Element pObjectPathE) throws CIMXMLParseException { + // + + // INSTANCEPATH + Element instancepathA[] = searchNodes(pObjectPathE, "INSTANCEPATH", 0, 1, false); + if (instancepathA != null) { + CIMObjectPath op = parseINSTANCEPATH(instancepathA[0]); + return op; + } + + // CLASSPATH + Element classpathA[] = searchNodes(pObjectPathE, "CLASSPATH", 0, 1, false); + if (classpathA != null) { + CIMObjectPath op = parseCLASSPATH(classpathA[0]); + return op; + } + + throw new CIMXMLParseException("OBJECTPATH element missing required child element!"); + } + + /** + * parseKEYBINDING + * + * @param pKeyBindingE + * @return CIMProperty + * @throws CIMXMLParseException + */ + public static CIMProperty parseKEYBINDING(Element pKeyBindingE) throws CIMXMLParseException { + // + // + + Attr keybinding_nameA = (Attr) searchAttribute(pKeyBindingE, "NAME"); + if (keybinding_nameA == null) throw new CIMXMLParseException( + "KEYBINDING element missing NAME attribute!"); + String propName = keybinding_nameA.getValue(); + + // KEYVALUE + Element keyvalueA[] = searchNodes(pKeyBindingE, "KEYVALUE", 0, 1, false); + if (keyvalueA != null) { + TypedValue propTypedVal = parseKEYVALUE(keyvalueA[0]); + return new CIMProperty(propName, propTypedVal.getType(), propTypedVal + .getValue(), true, false, null); + } + + // VALUE.REFERENCE + Element valuereferenceA[] = searchNodes(pKeyBindingE, "VALUE.REFERENCE", 0, 1, false); + if (valuereferenceA != null) { + CIMObjectPath op = parseVALUEREFERENCE(valuereferenceA[0]); + return new CIMProperty(propName, new CIMDataType(op.getObjectName()), + op, true, false, null); + } + + throw new CIMXMLParseException("KEYBINDING element missing required child element!"); + } + + private static final TreeMap TYPESTR_MAP = new TreeMap( + new Comparator() { + + public int compare(Object pO1, Object pO2) { + return ((String) pO1).compareToIgnoreCase((String) pO2); + } + + }); + + static { + TYPESTR_MAP.put(MOF.DT_UINT8, CIMDataType.UINT8_T); + TYPESTR_MAP.put(MOF.DT_UINT16, CIMDataType.UINT16_T); + TYPESTR_MAP.put(MOF.DT_UINT32, CIMDataType.UINT32_T); + TYPESTR_MAP.put(MOF.DT_UINT64, CIMDataType.UINT64_T); + TYPESTR_MAP.put(MOF.DT_SINT8, CIMDataType.SINT8_T); + TYPESTR_MAP.put(MOF.DT_SINT16, CIMDataType.SINT16_T); + TYPESTR_MAP.put(MOF.DT_SINT32, CIMDataType.SINT32_T); + TYPESTR_MAP.put(MOF.DT_SINT64, CIMDataType.SINT64_T); + TYPESTR_MAP.put(MOF.DT_REAL32, CIMDataType.REAL32_T); + TYPESTR_MAP.put(MOF.DT_REAL64, CIMDataType.REAL64_T); + TYPESTR_MAP.put(MOF.DT_CHAR16, CIMDataType.CHAR16_T); + TYPESTR_MAP.put(MOF.DT_STR, CIMDataType.STRING_T); + TYPESTR_MAP.put(MOF.DT_BOOL, CIMDataType.BOOLEAN_T); + TYPESTR_MAP.put(MOF.DT_DATETIME, CIMDataType.DATETIME_T); + // FIXME: ebak: What to do with those types which are not specified by + // MOF's BNF? + TYPESTR_MAP.put(MOF.INVALID, CIMDataType.INVALID_T); + // FIXME: ebak: What is the string representation of OBJECT? + TYPESTR_MAP.put("object", CIMDataType.OBJECT_T); + TYPESTR_MAP.put(MOF.CLASS, CIMDataType.CLASS_T); + TYPESTR_MAP.put(MOF.REFERENCE, new CIMDataType("")); + } + + /** + * parseScalarTypeStr + * + * @param pTypeStr + * @return CIMDataType + * @throws CIMXMLParseException + */ + public static CIMDataType parseScalarTypeStr(String pTypeStr) throws CIMXMLParseException { + return parseTypeStr(pTypeStr, false); + } + + /** + * parseArrayTypeStr + * + * @param pTypeStr + * @return CIMDataType + * @throws CIMXMLParseException + */ + public static CIMDataType parseArrayTypeStr(String pTypeStr) throws CIMXMLParseException { + return parseTypeStr(pTypeStr, true); + } + + /** + * parseTypeStr + * + * @param pTypeStr + * @param pArray + * @return CIMDataType + * @throws CIMXMLParseException + */ + public static CIMDataType parseTypeStr(String pTypeStr, boolean pArray) + throws CIMXMLParseException { + if (pTypeStr == null) return pArray ? CIMDataType.STRING_ARRAY_T : CIMDataType.STRING_T; + CIMDataType type = TYPESTR_MAP.get(pTypeStr); + if (type == null) throw new CIMXMLParseException("Unknown TYPE string:" + pTypeStr); + if (pArray) { + if (type.getType() == CIMDataType.REFERENCE) return new CIMDataType(type + .getRefClassName(), 0); + return CIMHelper.UnboundedArrayDataType(type.getType()); + } + return type; + } + + /** + * parseKEYVALUE + * + * @param pKeyValueE + * @return TypedValue + * @throws CIMXMLParseException + */ + public static TypedValue parseKEYVALUE(Element pKeyValueE) throws CIMXMLParseException { + /* + * + */ + // ebak: if TYPE attribute is included there is no need to deal with + // VALUETYPE attribute + String typeStr = attribute(pKeyValueE, "TYPE"); + + Text valueT = (Text) searchFirstChild(pKeyValueE); + String valueStr = valueT == null ? null : valueT.getNodeValue(); + + if (typeStr == null) { + String valueTypeStr = attribute(pKeyValueE, "VALUETYPE"); + if (valueTypeStr == null) valueTypeStr = "string"; + ValueTypeHandler vtHandler = new ValueTypeHandler(valueTypeStr, valueStr); + return new TypedValue(vtHandler.getType(), vtHandler.getValue()); + } + Object value = valueStr == null ? "" : createJavaObject(typeStr, valueStr); + return new TypedValue(parseScalarTypeStr(typeStr), value); + } + + /** + * Class ValueTypeHandler determines the value and type of a KEYVALUE XML + * element, when the VALUETYPE attribute is provided instead of the exact + * TYPE attribute. There is a very similar code section in the PULL and SAX + * parser, but that section wasn't made common since in ideal case the DOM + * parser will be removed. + */ + private static class ValueTypeHandler { + + private CIMDataType iType; + + private Object iValue; + + /** + * + * Ctor. + * + * @param pValueTypeStr + * @param pValueStr + * @throws CIMXMLParseException + */ + public ValueTypeHandler(String pValueTypeStr, String pValueStr) throws CIMXMLParseException { + + if (pValueTypeStr == null) throw new CIMXMLParseException( + "KEYVALUE element missing VALUETYPE attribute!"); + + if (pValueTypeStr.equals("numeric")) { + if (!setUInt64(pValueStr) && !setSInt64(pValueStr) && !setReal64(pValueStr)) throw new CIMXMLParseException( + "Unparseable \"number\" value: " + pValueStr + " !"); + } else if (pValueTypeStr.equals(MOF.DT_STR)) { + if (!setDTAbsolute(pValueStr) && !setDTInterval(pValueStr)) { + this.iValue = pValueStr; + this.iType = CIMDataType.STRING_T; + } + } else if (pValueTypeStr.equals(MOF.DT_BOOL)) { + if (!setBoolean(pValueStr)) throw new CIMXMLParseException( + "Unparseable \"boolean\" value: " + pValueStr + " !"); + } else { + throw new CIMXMLParseException("KEYVALUE element's VALUETYPE attribute must be " + + MOF.DT_STR + ", " + MOF.DT_BOOL + " or numeric! " + pValueStr + + " is not allowed!"); + } + } + + /** + * + * getType + * + * @return CIMDataType + */ + public CIMDataType getType() { + return this.iType; + } + + /** + * + * getValue + * + * @return Object + */ + public Object getValue() { + return this.iValue; + } + + private boolean setUInt64(String pValue) { + try { + this.iValue = new UnsignedInteger64(pValue); + } catch (NumberFormatException e) { + return false; + } + this.iType = CIMDataType.UINT64_T; + return true; + } + + private boolean setSInt64(String pValue) { + try { + this.iValue = new Long(pValue); + } catch (NumberFormatException e) { + return false; + } + this.iType = CIMDataType.SINT64_T; + return true; + } + + private boolean setReal64(String pValue) { + try { + if (WBEMConfiguration.getGlobalConfiguration().verifyJavaLangDoubleStrings()) { + if (Util.isBadDoubleString(pValue)) return false; + } + this.iValue = new Double(pValue); + } catch (NumberFormatException e) { + return false; + } + this.iType = CIMDataType.REAL64_T; + return true; + } + + private boolean setBoolean(String pValue) { + this.iValue = Boolean.valueOf(pValue); + this.iType = CIMDataType.BOOLEAN_T; + return true; + } + + private boolean setDTAbsolute(String pValue) { + try { + this.iValue = new CIMDateTimeAbsolute(pValue); + } catch (IllegalArgumentException e) { + return false; + } + this.iType = CIMDataType.DATETIME_T; + return true; + } + + private boolean setDTInterval(String pValue) { + try { + this.iValue = new CIMDateTimeInterval(pValue); + } catch (IllegalArgumentException e) { + return false; + } + this.iType = CIMDataType.DATETIME_T; + return true; + } + } + + // //////////////////////////////////////////////////////////////////////////////////////// + // Object Definition Elements + // //////////////////////////////////////////////////////////////////////////////////////// + + private static String attribute(Element pElement, String pName) { + String attrib = pElement.getAttribute(pName); + if (attrib == null || attrib.length() == 0) return null; + return attrib; + } + + private static final String[] nodesCLASS = { "QUALIFIER", "PROPERTY", "PROPERTY.ARRAY", + "PROPERTY.REFERENCE", "METHOD" }; + + /** + * parseCLASS + * + * @param pClassE + * @return CIMClass + * @throws CIMXMLParseException + */ + public static CIMClass parseCLASS(Element pClassE) throws CIMXMLParseException { + return parseCLASS(pClassE, null); + } + + /** + * parseCLASS + * + * @param pClassE + * @param pObjectPath + * @return CIMClass + * @throws CIMXMLParseException + */ + public static CIMClass parseCLASS(Element pClassE, CIMObjectPath pObjectPath) + throws CIMXMLParseException { + // + // + + Attr class_nameA = (Attr) searchAttribute(pClassE, "NAME"); + if (class_nameA == null) throw new CIMXMLParseException( + "CLASS element missing NAME attribute!"); + String name = class_nameA.getNodeValue(); + + // Attr superclass_nameA = (Attr)searchAttribute(classE, "SUPERCLASS"); + // String supername = superclass_nameA.getNodeValue(); + + String superClass = attribute(pClassE, "SUPERCLASS"); + + // QUALIFIER + CIMQualifier[] qualis = parseQUALIFIERS(pClassE); + + // PROPERTY + CIMClassProperty[] props = parseCLASSPROPERTIES(pClassE); + + // METHOD + Element[] methodElementA = searchNodes(pClassE, "METHOD", 0, Integer.MAX_VALUE, true); + CIMMethod[] methods; + if (methodElementA != null) { + methods = new CIMMethod[methodElementA.length]; + for (int i = 0; i < methodElementA.length; i++) { + Element methodE = methodElementA[i]; + methods[i] = parseMETHOD(methodE); + } + } else { + methods = null; + } + + /* + * CIMClass( String name, String superclass, CIMQualifier[] qualifiers, + * CIMClassProperty[] props, CIMMethod[] methods ) + * + * return new CIMClass( name, superClass, qualis, props, methods ); + * + * This constructor can provide localPath info. CIMClass( CIMObjectPath + * path, String superclass, CIMQualifier[] qualifiers, + * CIMClassProperty[] props, CIMMethod[] pMethods, boolean + * pIsAssociation, boolean pIsKeyed ) + */ + checkOtherNodes(pClassE, nodesCLASS); + + return new CIMClass( + pObjectPath == null ? cLocalPathBuilder.build(name, null) : pObjectPath, + superClass, qualis, props, methods, hasAssocQuali(qualis), hasKeyProp(props)); + } + + private static boolean hasAssocQuali(CIMQualifier[] pQualis) { + if (pQualis == null) return false; + for (int i = 0; i < pQualis.length; i++) { + CIMQualifier quali = pQualis[i]; + if ("ASSOCIATION".equalsIgnoreCase(quali.getName()) + && Boolean.TRUE.equals(quali.getValue())) return true; + } + return false; + } + + private static boolean hasKeyProp(CIMProperty[] pProps) { + if (pProps == null) return false; + for (int i = 0; i < pProps.length; i++) + if (pProps[i].isKey()) return true; + return false; + } + + private static CIMParameter[] parseParameters(Element pMethodE) throws CIMXMLParseException { + // PARAMETER + Vector> paramV = new Vector>(); + Element[] paramElementA = searchNodes(pMethodE, "PARAMETER"); + if (paramElementA != null) { + for (int i = 0; i < paramElementA.length; i++) { + Element parameterE = paramElementA[i]; + CIMParameter p = parsePARAMETER(parameterE); + paramV.add(p); + } + } + + Element[] paramRefElementA = searchNodes(pMethodE, "PARAMETER.REFERENCE"); + if (paramRefElementA != null) { + for (int i = 0; i < paramRefElementA.length; i++) { + Element parameterE = paramRefElementA[i]; + CIMParameter p = parsePARAMETERREFERENCE(parameterE); + paramV.add(p); + } + } + + Element[] paramArrayElementA = searchNodes(pMethodE, "PARAMETER.ARRAY"); + if (paramArrayElementA != null) { + for (int i = 0; i < paramArrayElementA.length; i++) { + Element parameterE = paramArrayElementA[i]; + CIMParameter p = parsePARAMETERARRAY(parameterE); + paramV.add(p); + } + } + + Element[] paramRefArrayElementA = searchNodes(pMethodE, "PARAMETER.REFARRAY"); + if (paramRefArrayElementA != null) { + for (int i = 0; i < paramRefArrayElementA.length; i++) { + Element parameterE = paramRefArrayElementA[i]; + CIMParameter p = parsePARAMETERREFARRAY(parameterE); + paramV.add(p); + } + } + + return paramV.toArray(new CIMParameter[0]); + } + + private static final String nodesMETHOD[] = { "QUALIFIER", "PARAMETER", "PARAMETER.REFERENCE", + "PARAMETER.ARRAY", "PARAMETER.REFARRAY" }; + + /** + * parseMETHOD + * + * @param pMethodE + * @return CIMMethod + * @throws CIMXMLParseException + */ + public static CIMMethod parseMETHOD(Element pMethodE) throws CIMXMLParseException { + // + // + + String name = attribute(pMethodE, "NAME"); + if (name == null) throw new CIMXMLParseException("METHOD element missing NAME attribute!"); + EmbObjHandler embObjHandler = new EmbObjHandler(pMethodE); + CIMDataType type = embObjHandler.getType(); + if (type != null && type.isArray()) throw new CIMXMLParseException( + "Method's type cannot be Array!"); + String classOrigin = attribute(pMethodE, "CLASSORIGIN"); + String propagatedStr = pMethodE.getAttribute("PROPAGATED"); + boolean propagated = "true".equalsIgnoreCase(propagatedStr); + + checkOtherNodes(pMethodE, nodesMETHOD); + + // PARAMETERS + CIMParameter[] params = parseParameters(pMethodE); + // CIMMethod(String name, CIMDataType type, CIMQualifier[] qualifiers, + // CIMParameter[] parameters, boolean propagated, String originClass) + return new CIMMethod(name, type, embObjHandler.getQualifiers(), params, propagated, + classOrigin); + } + + private static final String nodesPARAMETER[] = { "QUALIFIER" }; + + /** + * parsePARAMETER + * + * @param pParamE + * @return CIMParameter + * @throws CIMXMLParseException + */ + public static CIMParameter parsePARAMETER(Element pParamE) throws CIMXMLParseException { + String name = attribute(pParamE, "NAME"); + if (name == null) throw new CIMXMLParseException( + "PARAMETER element missing NAME attribute!"); + if (attribute(pParamE, "TYPE") == null) throw new CIMXMLParseException( + "PARAMETER element missing TYPE attribute!"); + checkOtherNodes(pParamE, nodesPARAMETER); + EmbObjHandler iEmbObjHandler = new EmbObjHandler(pParamE); + // CIMParameter(String name, CIMDataType type, CIMQualifier[] + // qualifiers) + return new CIMParameter(name, iEmbObjHandler.getType(), iEmbObjHandler + .getQualifiers()); + } + + private static final String nodesPARAMETERREFERENCE[] = { "QUALIFIER" }; + + /** + * parsePARAMETERREFERENCE + * + * @param pParamE + * @return CIMParameter + * @throws CIMXMLParseException + */ + public static CIMParameter parsePARAMETERREFERENCE(Element pParamE) + throws CIMXMLParseException { + String name = attribute(pParamE, "NAME"); + if (name == null) throw new CIMXMLParseException( + "PARAMETER.REFERENCE element missing NAME attribute!"); + String referenceClass = attribute(pParamE, "REFERENCECLASS"); + CIMDataType type = new CIMDataType(referenceClass != null ? referenceClass : ""); + checkOtherNodes(pParamE, nodesPARAMETERREFERENCE); + // QUALIFIER + CIMQualifier[] qualis = parseQUALIFIERS(pParamE); + return new CIMParameter(name, type, qualis); + } + + private static final String nodesPARAMETERARRAY[] = { "QUALIFIER" }; + + /** + * parsePARAMETERARRAY + * + * @param pParamE + * @return CIMParameter + * @throws CIMXMLParseException + */ + public static CIMParameter parsePARAMETERARRAY(Element pParamE) + throws CIMXMLParseException { + String name = attribute(pParamE, "NAME"); + if (name == null) throw new CIMXMLParseException( + "PARAMETER.ARRAY element missing NAME attribute!"); + if (attribute(pParamE, "TYPE") == null) throw new CIMXMLParseException( + "PARAMETER.ARRAY element missing TYPE attribute!"); + String arraySizeStr = pParamE.getAttribute("ARRAYSIZE"); + try { + if (arraySizeStr.length() > 0) Integer.parseInt(arraySizeStr); + } catch (NumberFormatException e) { + throw new CIMXMLParseException(arraySizeStr + + " is not a valid ARRAYSIZE attribute for PARAMETER.ARRAY!"); + } + checkOtherNodes(pParamE, nodesPARAMETERARRAY); + EmbObjHandler iEmbObjHandler = new EmbObjHandler(pParamE); + return new CIMParameter(name, iEmbObjHandler.getArrayType(), iEmbObjHandler + .getQualifiers()); + } + + private static final String nodesPARAMETERREFARRAY[] = { "QUALIFIER" }; + + /** + * parsePARAMETERREFARRAY + * + * @param pParamE + * @return CIMParameter + * @throws CIMXMLParseException + */ + public static CIMParameter parsePARAMETERREFARRAY(Element pParamE) + throws CIMXMLParseException { + String name = attribute(pParamE, "NAME"); + if (name == null) throw new CIMXMLParseException( + "PARAMETER.REFARRAY element missing NAME attribute!"); + + String referenceClass = attribute(pParamE, "REFERENCECLASS"); + + int arraySize = 0; // unlimited + String arraySizeStr = pParamE.getAttribute("ARRAYSIZE"); + try { + if (arraySizeStr.length() > 0) arraySize = Integer.parseInt(arraySizeStr); + } catch (NumberFormatException e) { + throw new CIMXMLParseException(arraySizeStr + + " is not a valid ARRAYSIZE attribute for PARAMETER.REFARRAY!"); + } + + CIMDataType type = new CIMDataType((referenceClass != null) ? referenceClass : "", + arraySize); + + // QUALIFIER + checkOtherNodes(pParamE, nodesPARAMETERREFARRAY); + CIMQualifier[] qualis = parseQUALIFIERS(pParamE); + return new CIMParameter(name, type, qualis); + } + + /** + * parseINSTANCE + * + * @param pInstanceE + * @return CIMInstance + * @throws CIMXMLParseException + */ + public static CIMInstance parseINSTANCE(Element pInstanceE) throws CIMXMLParseException { + return parseINSTANCE(pInstanceE, null); + } + + private static final String[] nodesINSTANCE = { "QUALIFIER", "PROPERTY", "PROPERTY.ARRAY", + "PROPERTY.REFERENCE" }; + + /** + * parseINSTANCE + * + * @param pInstanceE + * @param pObjPath + * @return CIMInstance + * @throws CIMXMLParseException + */ + public static CIMInstance parseINSTANCE(Element pInstanceE, CIMObjectPath pObjPath) + throws CIMXMLParseException { + // + // + + // BB mod CIMInstance inst = new CIMInstance(); + String className = attribute(pInstanceE, "CLASSNAME"); + if (className == null) throw new CIMXMLParseException( + "INSTANCE element missing CLASSNAME attribute!"); + // QUALIFIER + // FIXME: in JSR48 CIMInstance doesn't have qualifiers + // CIMQualifier[] qualis = parseQUALIFIERS(pInstanceE); + // PROPERTY + CIMProperty[] props = parsePROPERTIES(pInstanceE); + + checkOtherNodes(pInstanceE, nodesINSTANCE); + + if (pObjPath == null) return new CIMInstance(cLocalPathBuilder.build(className, null), + props); + if (WBEMConfiguration.getGlobalConfiguration().synchronizeNumericKeyDataTypes()) return CIMHelper + .CIMInstanceWithSynchonizedNumericKeyDataTypes(pObjPath, props); + return new CIMInstance(pObjPath, props); + } + + /** + * ebak: Access to enclosing method parseQUALIFIERS(Element) from the type + * CIMXMLParserImpl is emulated by a synthetic accessor method. Increasing + * its visibility will improve your performance + * + * @param pElement + * @return CIMQualifier[] + * @throws CIMXMLParseException + */ + public static CIMQualifier[] parseQUALIFIERS(Element pElement) throws CIMXMLParseException { + Element[] qualiElementA = searchNodes(pElement, "QUALIFIER"); + CIMQualifier[] qualis; + if (qualiElementA != null) { + qualis = new CIMQualifier[qualiElementA.length]; + for (int i = 0; i < qualiElementA.length; i++) { + Element qualifierE = qualiElementA[i]; + qualis[i] = parseQUALIFIER(qualifierE); + } + } else qualis = null; + return qualis; + } + + /** + *
      +	 *  ENTITY % QualifierFlavor "
      +	 *  OVERRIDABLE    (true|false)  'true'
      +	 *  TOSUBCLASS     (true|false)  'true'
      +	 *  TOINSTANCE     (true|false)  'false'
      +	 *  TRANSLATABLE   (true|false)  'false'"
      +	 * 
      + * + * @param pElement + * @return int - CIMFlavor bit mixture + */ + private static int parseFLAVORS(Element pElement) { + int flavors = 0; + if (!getBoolAttribute(pElement, "OVERRIDABLE", true)) flavors |= CIMFlavor.DISABLEOVERRIDE; + if (!getBoolAttribute(pElement, "TOSUBCLASS", true)) flavors |= CIMFlavor.RESTRICTED; + if (getBoolAttribute(pElement, "TRANSLATABLE", false)) flavors |= CIMFlavor.TRANSLATE; + return flavors; + } + + private static TypedValue parseSingleValue(Element pElement) throws CIMXMLParseException { + return parseSingleValue(pElement, VALUE | VALUEA); + } + + private static final int VALUE = 1, VALUEA = 2, VALUEREF = 4, VALUEREFA = 8; + + private static TypedValue parseSingleValue(Element pElement, int pMask) + throws CIMXMLParseException { + boolean foundSingleValue = false; + String typeStr = attribute(pElement, "TYPE"); + // ebak: there was an ESS fix in the base implementation + if (typeStr == null) typeStr = attribute(pElement, "PARAMTYPE"); + CIMDataType type = null; + Object value = null; + if ((pMask & VALUE) > 0) { + Element valueE = (Element) searchFirstNode(pElement, "VALUE"); + if (valueE != null) { + TypedValue tVal = parseVALUE(valueE); + String valueStr = (String) tVal.getValue(); + type = typeStr == null ? tVal.getType() : parseScalarTypeStr(typeStr); + value = createJavaObject(type == null ? null : type.toString(), valueStr); + foundSingleValue = true; + } + } + if (!foundSingleValue && (pMask & VALUEREF) > 0) { + // VALUE.REFERENCE + Element valuereferenceE = (Element) searchFirstNode(pElement, "VALUE.REFERENCE"); + if (valuereferenceE != null) { + CIMObjectPath op = parseVALUEREFERENCE(valuereferenceE); + value = op; + type = new CIMDataType(op.getObjectName()); + foundSingleValue = true; + } + } + if (!foundSingleValue && (pMask & VALUEA) > 0) { + // VALUE.ARRAY + Element valuearrayE = (Element) searchFirstNode(pElement, "VALUE.ARRAY"); + if (valuearrayE != null) { + TypedValue tValA = parseVALUEARRAY(valuearrayE); + type = typeStr == null ? tValA.getType() : parseArrayTypeStr(typeStr); + String[] valStrA = (String[]) tValA.getValue(); + if (valStrA != null) { + Object[] values = new Object[valStrA.length]; + for (int i = 0; i < valStrA.length; i++) { + values[i] = createJavaObject(type == null ? null : type.toString(), + valStrA[i]); + } + value = values; + } + foundSingleValue = true; + } + } + if (!foundSingleValue && (pMask & VALUEREFA) > 0) { + // VALUE.REFARRAY + Element valueRefArrayE = (Element) searchFirstNode(pElement, "VALUE.REFARRAY"); + if (valueRefArrayE != null) { + type = new CIMDataType("", 0); + CIMObjectPath[] opA = parseVALUEREFARRAY(valueRefArrayE); + value = opA; + foundSingleValue = true; + } + } + if (!foundSingleValue) { + if (value instanceof Object[]) type = CIMDataType.STRING_ARRAY_T; + else if (value != null) type = CIMDataType.STRING_T; + else type = CIMDataType.STRING_T; // /throw new + // CIMXMLParseException("null + // type with null value!"); + } + return new TypedValue(type, value); + } + + private static final String nodesQUALIFIER[] = { "VALUE", "VALUE.ARRAY" }; + + /** + * parseQUALIFIER + * + * @param pQualifierE + * @return CIMQualifier + * @throws CIMXMLParseException + */ + public static CIMQualifier parseQUALIFIER(Element pQualifierE) throws CIMXMLParseException { + // + // + + String name = attribute(pQualifierE, "NAME"); + if (name == null) throw new CIMXMLParseException( + "QUALIFIER element missing NAME attribute!"); + String typeStr = attribute(pQualifierE, "TYPE"); + if (typeStr == null && !hasTypeAttrsInNodes(pQualifierE)) throw new CIMXMLParseException( + "QUALIFIER element missing TYPE attribute!"); + boolean propagated = MOF.TRUE.equalsIgnoreCase(pQualifierE.getAttribute("PROPAGATED")); + // FLAVORS + int flavors = parseFLAVORS(pQualifierE); + // VALUE + if (searchNodes(pQualifierE, "VALUE", 0, 1, false) != null + || searchNodes(pQualifierE, "VALUE.ARRAY", 0, 1, false) != null) { + TypedValue typedValue = parseSingleValue(pQualifierE); + if (typedValue.getType() == null) throw new CIMXMLParseException( + "Qualifier's type is null!"); + // CIMQualifier(String pName, CIMDataType pType, Object pValue, int + // pFlavor) + return new CIMQualifier(name, typedValue.getType(), typedValue.getValue(), + flavors, propagated); + } + checkOtherNodes(pQualifierE, nodesQUALIFIER); + + CIMDataType type = parseScalarTypeStr(typeStr); + return new CIMQualifier(name, type != null ? type : CIMDataType.STRING_T, null, + flavors, propagated); + } + + /** + * parseQUALIFIERDECLARATION + * + * @param pQualifierTypeE + * @return CIMQualifierType + * @throws CIMXMLParseException + */ + public static CIMQualifierType parseQUALIFIERDECLARATION(Element pQualifierTypeE) + throws CIMXMLParseException { + // + // + + String name = attribute(pQualifierTypeE, "NAME"); + if (name == null) throw new CIMXMLParseException( + "QUALIFIER.DECLARATION element missing NAME attribute!"); + String type = attribute(pQualifierTypeE, "TYPE"); + if (type == null && !hasTypeAttrsInNodes(pQualifierTypeE)) throw new CIMXMLParseException( + "QUALIFIER.DECLARATION element missing TYPE attribute!"); + + // SCOPES + // ebak: there should be only 1 scope node + Element scopeElementA[] = searchNodes(pQualifierTypeE, "SCOPE", 0, 1, true); + int scopes = scopeElementA == null ? 0 : parseSCOPES(scopeElementA[0]); + // QUALIFIERS + // CIMQualifier[] qualis = parseQUALIFIERS(pQualifierTypeE); + + CIMDataType qdType; + Object qdValue; + + String nodes[] = null; + + if (searchNodes(pQualifierTypeE, "VALUE", 0, 1, true) != null) { + nodes = new String[] { "SCOPE", "VALUE" }; + } else if (searchNodes(pQualifierTypeE, "VALUE.ARRAY", 0, 1, true) != null) { + nodes = new String[] { "SCOPE", "VALUE.ARRAY" }; + } + + // VALUE + if (nodes != null) { + TypedValue typedValue = parseSingleValue(pQualifierTypeE); + qdType = typedValue.getType(); + qdValue = typedValue.getValue(); + boolean isArray = hasTrueAttribute(pQualifierTypeE, "ISARRAY"); + String arraySizeStr = attribute(pQualifierTypeE, "ARRAYSIZE"); + try { + int arraySize = (arraySizeStr == null ? (isArray ? 0 : -1) : Integer + .parseInt(arraySizeStr)); + if (isArray || arraySize >= 0) { + qdType = (arraySize > 0) ? new CIMDataType(qdType.getType(), arraySize) + : CIMHelper.UnboundedArrayDataType(qdType.getType()); + } + } catch (NumberFormatException e) { + throw new CIMXMLParseException(arraySizeStr + + " is not a valid ARRAYSIZE attribute for QUALIFIER.DECLARATION!"); + } + } else { + nodes = new String[] { "SCOPE" }; + qdType = parseScalarTypeStr(type); + if (qdType == null) qdType = CIMDataType.STRING_T; + qdValue = null; + } + checkOtherNodes(pQualifierTypeE, nodes); + + // FIXME: ebak: what about the flavors? + return new CIMQualifierType(new CIMObjectPath(null, null, null, null, name, null), + qdType, qdValue, scopes, 0); + } + + private static boolean hasTrueAttribute(Element pElement, String pName) { + String valueStr = pElement.getAttribute(pName); + return MOF.TRUE.equalsIgnoreCase(valueStr); + } + + private static boolean getBoolAttribute(Element pElement, String pName, boolean pDefVal) { + String val = pElement.getAttribute(pName); + if (MOF.TRUE.equalsIgnoreCase(val)) return true; + if (MOF.FALSE.equalsIgnoreCase(val)) return false; + return pDefVal; + } + + /** + * parseSCOPES + * + * @param pScopeE + * @return int + */ + public static int parseSCOPES(Element pScopeE) { + int scopes = 0; + if (hasTrueAttribute(pScopeE, "CLASS")) scopes |= CIMScope.CLASS; + if (hasTrueAttribute(pScopeE, "ASSOCIATION")) scopes |= CIMScope.ASSOCIATION; + if (hasTrueAttribute(pScopeE, "REFERENCE")) scopes |= CIMScope.REFERENCE; + if (hasTrueAttribute(pScopeE, "PROPERTY")) scopes |= CIMScope.PROPERTY; + if (hasTrueAttribute(pScopeE, "METHOD")) scopes |= CIMScope.METHOD; + if (hasTrueAttribute(pScopeE, "PARAMETER")) scopes |= CIMScope.PARAMETER; + if (hasTrueAttribute(pScopeE, "INDICATION")) scopes |= CIMScope.INDICATION; + return scopes; + } + + private static Vector> parseClassPropsToVec(Element pElement) + throws CIMXMLParseException { + Element[] propElementA = searchNodes(pElement, "PROPERTY"); + Vector> propVec = new Vector>(); + if (propElementA != null) { + for (int i = 0; i < propElementA.length; i++) { + Element propertyE = propElementA[i]; + propVec.add(parseCLASSPROPERTY(propertyE)); + + } + } + + // PROPERTY.ARRAY + Element[] propArrayElementA = searchNodes(pElement, "PROPERTY.ARRAY"); + if (propArrayElementA != null) { + for (int i = 0; i < propArrayElementA.length; i++) { + Element propertyarrayE = propArrayElementA[i]; + propVec.add(parseCLASSPROPERTYARRAY(propertyarrayE)); + } + } + + // PROPERTY.REFERENCE + Element[] propRefElementA = searchNodes(pElement, "PROPERTY.REFERENCE"); + if (propRefElementA != null) { + for (int i = 0; i < propRefElementA.length; i++) { + Element propertyreferenceE = propRefElementA[i]; + propVec.add(parseCLASSPROPERTYREFERENCE(propertyreferenceE)); + } + } + return propVec; + } + + /** + * parsePROPERTIES + * + * @param pElement + * @return CIMProperty[] + * @throws CIMXMLParseException + */ + public static CIMProperty[] parsePROPERTIES(Element pElement) throws CIMXMLParseException { + Vector> classPropVec = parseClassPropsToVec(pElement); + // The following does not convert Vector to + // CIMProperty[], it is still CIMClassProperty[]!!! You can treat it + // like a CIMProperty (property.getValue(), etc.) but (property + // instanceof CIMProperty) will return false! + // return classPropVec.toArray(new CIMProperty[0]); + + int arraySize = classPropVec.size(); + CIMProperty[] retA = new CIMProperty[arraySize]; + for (int i = 0; i < arraySize; i++) { + CIMClassProperty prop = classPropVec.get(i); + retA[i] = new CIMProperty(prop.getName(), prop.getDataType(), prop.getValue(), + prop.isKey(), prop.isPropagated(), prop.getOriginClass()); + } + return retA; + } + + /** + * parseCLASSPROPERTIES + * + * @param pElement + * @return CIMClassProperty[] + * @throws CIMXMLParseException + */ + public static CIMClassProperty[] parseCLASSPROPERTIES(Element pElement) + throws CIMXMLParseException { + Vector> classPropVec = parseClassPropsToVec(pElement); + return classPropVec.toArray(new CIMClassProperty[0]); + } + + /** + * parsePROPERTY + * + * @param pPropertyE + * @return CIMProperty + * @throws CIMXMLParseException + */ + public static CIMProperty parsePROPERTY(Element pPropertyE) throws CIMXMLParseException { + return parseCLASSPROPERTY(pPropertyE); + } + + private static class EmbObjHandler { + + private CIMQualifier[] iQualiA; + + private boolean iHasEmbObjAttr, iHasEmbInstAttr, iHasEmbObjQuali, iHasEmbInstQuali, iKeyed; + + private CIMDataType iRawType, iType; + + private Object iRawValue, iValue; + + private Element iElement; + + private boolean iStrictParsing = WBEMConfiguration.getGlobalConfiguration() + .strictEmbObjTypes(); + + /** + * Ctor. + * + * @param pElement + * @throws CIMXMLParseException + */ + public EmbObjHandler(Element pElement) throws CIMXMLParseException { + this.iElement = pElement; + handleQualis(); + handleAttribs(); + Element valueE = (Element) searchFirstNode(pElement, "VALUE"); + if (valueE != null) { + TypedValue tv = parseVALUE(valueE); + if (this.iRawType == null) this.iRawType = tv.getType(); + if (this.iRawType == null) this.iRawType = CIMDataType.STRING_T; + this.iRawValue = tv.getValue(); + } else { + valueE = (Element) searchFirstNode(pElement, "VALUE.ARRAY"); + if (valueE != null) { + TypedValue tv = parseVALUEARRAY(valueE); + if (this.iRawType == null) this.iRawType = tv.getType(); + if (this.iRawType == null) this.iRawType = CIMDataType.STRING_ARRAY_T; + this.iRawValue = tv.getValue(); + } + } + } + + private void handleQualis() throws CIMXMLParseException { + this.iQualiA = parseQUALIFIERS(this.iElement); + if (this.iQualiA != null) { + for (int idx = 0; idx < this.iQualiA.length; idx++) { + String qualiName = this.iQualiA[idx].getName(); + if ("EmbeddedObject".equalsIgnoreCase(qualiName)) { + this.iHasEmbObjQuali = true; + } else if ("EMBEDDEDINSTANCE".equalsIgnoreCase(qualiName)) { + this.iHasEmbInstQuali = true; + } else if ("KEY".equalsIgnoreCase(qualiName)) { + this.iKeyed = true; + } + if ((this.iHasEmbObjQuali || this.iHasEmbInstQuali) && this.iKeyed) return; + } + } + } + + private void handleAttribs() throws CIMXMLParseException { + String typeStr = this.iElement.getAttribute("TYPE"); + if (typeStr == null || typeStr.length() == 0) { + typeStr = this.iElement.getAttribute("PARAMTYPE"); + if (typeStr == null || typeStr.length() == 0) { + /* + * throw new CIMXMLParseException( iElement.getNodeName()+" + * must contain a TYPE or PARAMTYPE attribute!" ); + */ + /* + * ebak: Workaround for SVC's TYPE attribute in VALUE and + * VALUE.ARRAY element. + */ + typeStr = null; + } + } + // ebak: iRawType can be filled from contained VALUE or VALUE.ARRAY + // element (SVC) + if (typeStr != null) this.iRawType = parseScalarTypeStr(typeStr); + + // DSPs call for EmbeddedObject AND XML is case sensitive, BUT there + // are probably CIMOMs out there that still use EMBEDDEDOBJECT + String embObjAttrStr = this.iElement.getAttribute("EmbeddedObject"); + if (embObjAttrStr == null || embObjAttrStr.length() == 0) { + embObjAttrStr = this.iElement.getAttribute("EMBEDDEDOBJECT"); + } + if (embObjAttrStr == null || embObjAttrStr.length() == 0) { + this.iHasEmbObjAttr = this.iHasEmbInstAttr = false; + } else if ("object".equalsIgnoreCase(embObjAttrStr)) { + this.iHasEmbObjAttr = true; + this.iHasEmbInstAttr = false; + } else if ("instance".equalsIgnoreCase(embObjAttrStr)) { + this.iHasEmbObjAttr = false; + this.iHasEmbInstAttr = true; + } else throw new CIMXMLParseException("EmbeddedObject attribute cannot contain \"" + + embObjAttrStr + "\" value!"); + } + + /** + * getQualifiers + * + * @return CIMQualifier[] + * @throws CIMXMLParseException + */ + public CIMQualifier[] getQualifiers() throws CIMXMLParseException { + transform(); + CIMQualifiedElementInterfaceImpl qualiImpl = new CIMQualifiedElementInterfaceImpl( + this.iQualiA, isKeyed(), this.iType == null + || this.iType.getType() == CIMDataType.STRING); + return qualiImpl.getQualifiers(); + } + + /** + * isKeyed + * + * @return boolean + */ + public boolean isKeyed() { + return this.iKeyed; + } + + /** + * isEmbeddedObject + * + * @return boolean + */ + private boolean isEmbeddedObject() { + return this.iHasEmbObjAttr || this.iHasEmbInstAttr || this.iHasEmbObjQuali + || this.iHasEmbInstQuali; + } + + /** + * isEmbeddedClass + * + * @return boolean + */ + private boolean isEmbeddedClass() { + return this.iHasEmbObjAttr || this.iHasEmbObjQuali; + } + + /** + * isEmbeddedInstance + * + * @return boolean + */ + private boolean isEmbeddedInstance() { + return this.iHasEmbInstAttr || this.iHasEmbInstQuali; + } + + /** + * getType + * + * @return CIMDataType + * @throws CIMXMLParseException + */ + public CIMDataType getType() throws CIMXMLParseException { + transform(); + return this.iType; + } + + /** + * getArrayType + * + * @return CIMDataType + * @throws CIMXMLParseException + */ + public CIMDataType getArrayType() throws CIMXMLParseException { + transform(); + return this.iType.isArray() ? this.iType : CIMHelper.UnboundedArrayDataType(this.iType + .getType()); + } + + /** + * getValue + * + * @return Object + * @throws CIMXMLParseException + */ + public Object getValue() throws CIMXMLParseException { + transform(); + return this.iValue; + } + + private void transform() throws CIMXMLParseException { + if (this.iType != null) return; + if (this.iRawValue == null) { + if (isEmbeddedObject()) { + if (this.iRawType != CIMDataType.STRING_T) throw new CIMXMLParseException( + "Embedded Object CIM-XML element's type must be string. " + + this.iRawType + " is invalid!"); + if (this.iStrictParsing) { + /* + * In case of strict parsing Object means CIMClass, + * Instance means CIMInstance. Pegasus 2.7.0 seems to + * handle it this way. + */ + this.iType = isEmbeddedInstance() ? CIMDataType.OBJECT_T + : CIMDataType.CLASS_T; + } else { + /* + * for valueless EmbeddedObject="object" the type is + * undeterminable since Pegasus's CIMObject can contain + * both CIMClass and CIMInstance + */ + this.iType = isEmbeddedInstance() ? CIMDataType.OBJECT_T + : CIMDataType.STRING_T; + } + } else { + this.iType = this.iRawType; + } + this.iValue = null; + } else { + if (isEmbeddedObject()) { + transformEmbObj(); + } else { + transformNormObj(); + } + } + } + + private void transformEmbObj() throws CIMXMLParseException { + if (this.iRawValue instanceof String) { + this.iValue = parseXmlStr((String) this.iRawValue); + this.iType = getCIMObjType(this.iValue); + } else { + this.iValue = parseXmlStrA((String[]) this.iRawValue); + this.iType = getCIMObjAType((Object[]) this.iValue); + } + if (isEmbeddedInstance() && this.iType.getType() != CIMDataType.OBJECT) throw new CIMXMLParseException( + this.iElement.getNodeName() + + " element is an EmbeddedInstance with non INSTANCE value. " + + "It's not valid!"); + if (isEmbeddedClass() && this.iType.getType() != CIMDataType.CLASS + && this.iType.getType() != CIMDataType.OBJECT) throw new CIMXMLParseException( + this.iElement.getNodeName() + + " element is an EmbeddedObject with non CLASS/INSTANCE value. It's not valid!"); + } + + private void transformNormObj() throws CIMXMLParseException { + if (this.iRawValue instanceof String) { + this.iType = this.iRawType; + this.iValue = createJavaObject(this.iType == null ? null : this.iType.toString(), + (String) this.iRawValue); + } else { + String[] rawValueA = (String[]) this.iRawValue; + String typeStr = this.iRawType.toString(); + Object[] objA = new Object[rawValueA.length]; + for (int i = 0; i < objA.length; i++) + objA[i] = createJavaObject(typeStr, rawValueA[i]); + this.iType = CIMHelper.UnboundedArrayDataType(this.iRawType.getType()); + this.iValue = objA; + } + } + + /** + * parseXmlStr + * + * @param pXmlStr + * @return CIMClass or CIMInstance + * @throws CIMXMLParseException + */ + public static Object parseXmlStr(String pXmlStr) throws CIMXMLParseException { + // ebak: workaround for null array elements -> parse empty EmbObj + // string as null + if (pXmlStr == null || pXmlStr.length() == 0) return null; + try { + CIMClientXML_HelperImpl builder = new CIMClientXML_HelperImpl(); + Document doc = builder.parse(new InputSource(new StringReader(pXmlStr))); + return parseObject(doc.getDocumentElement()); + } catch (CIMXMLParseException e) { + throw e; + } catch (Exception e) { + throw new CIMXMLParseException(e.getMessage() + "\npXmlStr=" + pXmlStr); + } + } + + /** + * parseXmlStrA + * + * @param pXmlStrA + * @return Object[] + * @throws CIMXMLParseException + */ + public static Object[] parseXmlStrA(String[] pXmlStrA) throws CIMXMLParseException { + if (pXmlStrA == null || pXmlStrA.length == 0) return null; + Object[] objA = new Object[pXmlStrA.length]; + for (int i = 0; i < objA.length; i++) { + String xmlStr = pXmlStrA[i]; + objA[i] = xmlStr == null ? null : parseXmlStr(xmlStr); + } + return objA; + } + + /** + * getCIMObjType + * + * @param pCIMObj + * @return CIMDataType + * @throws CIMXMLParseException + */ + public static CIMDataType getCIMObjType(Object pCIMObj) throws CIMXMLParseException { + if (pCIMObj == null) throw new CIMXMLParseException( + "cannot have null CIM object! (CIMClass or CIMInstance)"); + if (pCIMObj instanceof CIMInstance) return CIMDataType.OBJECT_T; + if (pCIMObj instanceof CIMClass) return CIMDataType.CLASS_T; + throw new CIMXMLParseException(pCIMObj.getClass().getName() + + " is not a CIM object! (CIMClass or CIMInstance)"); + } + + /** + * getCIMObjAType + * + * @param pCIMObjA + * @return CIMDataType + * @throws CIMXMLParseException + */ + public static CIMDataType getCIMObjAType(Object[] pCIMObjA) throws CIMXMLParseException { + if (pCIMObjA == null || pCIMObjA.length == 0) return CIMDataType.STRING_ARRAY_T; + CIMDataType type = null; + for (int i = 0; i < pCIMObjA.length; i++) { + if (pCIMObjA[i] == null) continue; + CIMDataType currType = getCIMObjType(pCIMObjA[i]); + if (type == null) { + type = currType; + } else if (type != currType) { throw new CIMXMLParseException( + "Embedded Object arrays with different types are not supported"); } + } + if (type == CIMDataType.OBJECT_T) return CIMDataType.OBJECT_ARRAY_T; + if (type == CIMDataType.CLASS_T) return CIMDataType.CLASS_ARRAY_T; + return CIMDataType.STRING_ARRAY_T; + } + + } + + private static final String nodesPROPERTY[] = { "QUALIFIER", "VALUE" }; + + /** + * parseCLASSPROPERTY + * + * @param pPropertyE + * @return CIMClassProperty + * @throws CIMXMLParseException + */ + public static CIMClassProperty parseCLASSPROPERTY(Element pPropertyE) + throws CIMXMLParseException { + // + // + + Attr property_nameA = (Attr) searchAttribute(pPropertyE, "NAME"); + if (property_nameA == null) throw new CIMXMLParseException( + "PROPERTY element missing NAME attribute!"); + String name = property_nameA.getNodeValue(); + if (attribute(pPropertyE, "TYPE") == null && !hasTypeAttrsInNodes(pPropertyE)) throw new CIMXMLParseException( + "PROPERTY element missing TYPE attribute!"); + + String classOrigin = pPropertyE.getAttribute("CLASSORIGIN"); + if (classOrigin != null && classOrigin.length() == 0) classOrigin = null; + + String propagatedStr = pPropertyE.getAttribute("PROPAGATED"); + boolean propagated = MOF.TRUE.equalsIgnoreCase(propagatedStr); + + // only QUALIFIER(s) and 0/1 VALUE + searchNodes(pPropertyE, "VALUE", 0, 1, true); + checkOtherNodes(pPropertyE, nodesPROPERTY); + + // QUALIFIER + // ebak: EmbeddedObject support + EmbObjHandler embObjHandler = new EmbObjHandler(pPropertyE); + /* + * CIMClassProperty(String pName, CIMDataType pType, Object pValue, + * CIMQualifier[] pQualifiers, boolean pKey, boolean propagated, String + * originClass) + */ + return new CIMClassProperty(name, embObjHandler.getType(), + embObjHandler.getValue(), embObjHandler.getQualifiers(), embObjHandler.isKeyed(), + propagated, classOrigin); + } + + /** + * parsePROPERTYARRAY + * + * @param pPropertyArrayE + * @return CIMProperty + * @throws CIMXMLParseException + */ + public static CIMProperty parsePROPERTYARRAY(Element pPropertyArrayE) + throws CIMXMLParseException { + return parseCLASSPROPERTYARRAY(pPropertyArrayE); + } + + private static final String nodesPROPERTYARRAY[] = { "QUALIFIER", "VALUE.ARRAY" }; + + /** + * parseCLASSPROPERTYARRAY + * + * @param pPropArrayE + * @return CIMClassProperty + * @throws CIMXMLParseException + */ + public static CIMClassProperty parseCLASSPROPERTYARRAY(Element pPropArrayE) + throws CIMXMLParseException { + // + // + + String name = attribute(pPropArrayE, "NAME"); + if (name == null) throw new CIMXMLParseException( + "PROPERTY.ARRAY element missing NAME attribute!"); + if (attribute(pPropArrayE, "TYPE") == null && !hasTypeAttrsInNodes(pPropArrayE)) throw new CIMXMLParseException( + "PROPERTY.ARRAY element missing TYPE attribute!"); + + String valueArraysizeStr = pPropArrayE.getAttribute("ARRAYSIZE"); + try { + if (valueArraysizeStr.length() > 0) Integer.parseInt(valueArraysizeStr); + } catch (NumberFormatException e) { + throw new CIMXMLParseException(valueArraysizeStr + + " is not a valid ARRAYSIZE attribute for VALUE.ARRAY!"); + } + + String classOrigin = pPropArrayE.getAttribute("CLASSORIGIN"); + if (classOrigin != null && classOrigin.length() == 0) classOrigin = null; + + String valuePropagatedStr = pPropArrayE.getAttribute("PROPAGATED"); + boolean propagated = (valuePropagatedStr != null && valuePropagatedStr + .equalsIgnoreCase(MOF.TRUE)); + + // only QUALIFIER(s) and 0/1 VALUE.ARRAY + searchNodes(pPropArrayE, "VALUE.ARRAY", 0, 1, true); + checkOtherNodes(pPropArrayE, nodesPROPERTYARRAY); + + // QUALIFIER + // ebak: EmbeddedObject support + EmbObjHandler embObjHandler = new EmbObjHandler(pPropArrayE); + return new CIMClassProperty(name, embObjHandler.getArrayType(), embObjHandler + .getValue(), embObjHandler.getQualifiers(), embObjHandler.isKeyed(), propagated, + classOrigin); + } + + /** + * parsePROPERTYREFERENCE + * + * @param pPropRefE + * @return CIMProperty + * @throws CIMXMLParseException + */ + public static CIMProperty parsePROPERTYREFERENCE(Element pPropRefE) + throws CIMXMLParseException { + return parseCLASSPROPERTYREFERENCE(pPropRefE); + } + + private static final String nodesPROPERTYREFERENCE[] = { "QUALIFIER", "VALUE.REFERENCE" }; + + /** + * parseCLASSPROPERTYREFERENCE + * + * @param pPropRefE + * @return CIMClassProperty + * @throws CIMXMLParseException + */ + public static CIMClassProperty parseCLASSPROPERTYREFERENCE(Element pPropRefE) + throws CIMXMLParseException { + // + // + + String name = attribute(pPropRefE, "NAME"); + if (name == null) throw new CIMXMLParseException( + "PROPERTY.REFERENCE element missing NAME attribute!"); + + String classOrigin = pPropRefE.getAttribute("CLASSORIGIN"); + if (classOrigin != null && classOrigin.length() == 0) classOrigin = null; + + String referenceClass = pPropRefE.getAttribute("REFERENCECLASS"); + + String propagatedStr = pPropRefE.getAttribute("PROPAGATED"); + boolean propagated = MOF.TRUE.equalsIgnoreCase(propagatedStr); + + // QUALIFIER + CIMQualifier[] qualis = parseQUALIFIERS(pPropRefE); + + CIMDataType type = new CIMDataType(referenceClass != null ? referenceClass : ""); + // VALUE.REFERENCE + Element valueRefA[] = searchNodes(pPropRefE, "VALUE.REFERENCE", 0, 1, true); + Object value = valueRefA != null ? parseVALUEREFERENCE(valueRefA[0]) : null; + + // return a CIMProperty without a CIMValue + checkOtherNodes(pPropRefE, nodesPROPERTYREFERENCE); + CIMQualifiedElementInterfaceImpl qualiImpl = new CIMQualifiedElementInterfaceImpl(qualis); + return new CIMClassProperty(name, type, value, qualis, qualiImpl.isKeyed(), + propagated, classOrigin); + } + + /** + * parseMESSAGE + * + * @param pCimVersion + * @param pDtdVersion + * @param pMessageE + * @return CIMMessage + * @throws CIMXMLParseException + */ + public static CIMMessage parseMESSAGE(String pCimVersion, String pDtdVersion, Element pMessageE) + throws CIMXMLParseException { + // + // + + Attr idA = (Attr) searchAttribute(pMessageE, "ID"); + if (idA == null) throw new CIMXMLParseException("MESSAGE element missing ID attribute!"); + String id = idA.getNodeValue(); + + Attr protocolA = (Attr) searchAttribute(pMessageE, "PROTOCOLVERSION"); + if (protocolA == null) throw new CIMXMLParseException( + "MESSAGE element missing PROTOCOLVERSION attribute!"); + // TODO + if (pCimVersion.equals("2.0") && pDtdVersion.equals("2.0")) { + + // Attr message_idA = (Attr)searchAttribute(messageE, "ID"); + // String messadeID = message_idA.getNodeValue(); + + // Attr message_protocolversionA = (Attr)searchAttribute(messageE, + // "PROTOCOLVERSION"); + // String protocolversion = message_protocolversionA.getNodeValue(); + + // SIMPLERSP + Element simplerspA[] = searchNodes(pMessageE, "SIMPLERSP", 0, 1, false); + if (simplerspA != null) { + CIMResponse response = parseSIMPLERSP(simplerspA[0]); + response.setMethod("SIMPLERSP"); + response.setId(id); + return response; + } + Element multirspA[] = searchNodes(pMessageE, "MULTIRSP", 0, 1, false); + if (multirspA != null) { + CIMResponse response = parseMULTIRSP(multirspA[0]); + response.setMethod("MULTIRSP"); + response.setId(id); + return response; + } + // SIMPLEEXPREQ + Element simpleexpreqA[] = searchNodes(pMessageE, "SIMPLEEXPREQ", 0, 1, false); + if (simpleexpreqA != null) { + CIMRequest request = parseSIMPLEEXPREQ(simpleexpreqA[0]); + request.setMethod("SIMPLEEXPREQ"); + request.setId(id); + return request; + } + + // MULTIEXPREQ + Element multiexpreqA[] = searchNodes(pMessageE, "MULTIEXPREQ", 0, 1, false); + if (multiexpreqA != null) { + CIMRequest request = parseMULTIEXPREQ(multiexpreqA[0]); + request.setMethod("MULTIEXPREQ"); + request.setId(id); + return request; + } + // SIMPLEEXPRSP + Element simpleexprspA[] = searchNodes(pMessageE, "SIMPLEEXPRSP", 0, 1, false); + if (simpleexprspA != null) { + CIMResponse response = parseSIMPLEEXPRSP(simpleexprspA[0]); + response.setMethod("SIMPLEEXPRSP"); + response.setId(id); + return response; + } + // MULTIEXPRSP + Element multiexprspA[] = searchNodes(pMessageE, "MULTIEXPRSP", 0, 1, false); + if (multiexprspA != null) { + CIMResponse response = parseMULTIEXPRSP(multiexprspA[0]); + response.setMethod("MULTIEXPRSP"); + response.setId(id); + return response; + } + + // SIMPLEREQ + Element simplereqA[] = searchNodes(pMessageE, "SIMPLEREQ", 0, 1, false); + if (simplereqA != null) { + CIMRequest request = parseSIMPLEREQ(simplereqA[0]); + request.setMethod("SIMPLEREQ"); + request.setId(id); + return request; + } + + // MULTIREQ + Element multireqA[] = searchNodes(pMessageE, "MULTIREQ", 0, 1, false); + if (multireqA != null) { + CIMRequest request = parseMULTIREQ(multireqA[0]); + request.setMethod("MULTIREQ"); + request.setId(id); + return request; + } + throw new CIMXMLParseException("MESSAGE element missing required child element!"); + } + // TODO, look for the specific error message in the spec + throw new CIMXMLParseException("DTD not supported"); + } + + private static final String nodesPARAMVALUE[] = { "VALUE", "VALUE.REFERENCE", "VALUE.ARRAY", + "VALUE.REFARRAY", "CLASSNAME", "INSTANCENAME", "CLASS", "INSTANCE", + "VALUE.NAMEDINSTANCE" }; + + /** + * parsePARAMVALUE + * + * @param pParamValueE + * @return CIMArgument + * @throws CIMXMLParseException + */ + public static CIMArgument parsePARAMVALUE(Element pParamValueE) + throws CIMXMLParseException { + // ) + // + String name = attribute(pParamValueE, "NAME"); + if (name == null) throw new CIMXMLParseException( + "PARAMVALUE element missing NAME attribute!"); + // FIXME: ebak: The base implementation didn't contain VALUE.REFARRAY + // handling. Why? + // ebak: embedded object support, different parsing for VALUE and + // VALUE.ARRAY sub elements + if (searchNodes(pParamValueE, "VALUE.REFERENCE", 0, 1, false) != null + || searchNodes(pParamValueE, "VALUE.REFARRAY", 0, 1, false) != null) { + TypedValue typedValue = parseSingleValue(pParamValueE, VALUEREF | VALUEREFA); + CIMDataType type = typedValue.getType(); + Object value = typedValue.getValue(); + if (type == null) throw new CIMXMLParseException("PARAMVALUE element type is null!"); + return new CIMArgument(name, type, value); + } + if (searchNodes(pParamValueE, "VALUE", 0, 1, false) != null + || searchNodes(pParamValueE, "VALUE.ARRAY", 0, 1, false) != null + || !hasNodes(pParamValueE)) { + EmbObjHandler embObjHandler = new EmbObjHandler(pParamValueE); + return new CIMArgument(name, embObjHandler.getType(), embObjHandler.getValue()); + } + + // CLASSNAME + Element classNameA[] = searchNodes(pParamValueE, "CLASSNAME", 0, 1, false); + if (classNameA != null) { + CIMObjectPath op = parseCLASSNAME(classNameA[0]); + CIMDataType type = new CIMDataType(op.getObjectName()); + return new CIMArgument(name, type, op); + } + + // INSTANCENAME + Element instNameA[] = searchNodes(pParamValueE, "INSTANCENAME", 0, 1, false); + if (instNameA != null) { + CIMObjectPath op = parseINSTANCENAME(instNameA[0]); + CIMDataType type = new CIMDataType(op.getObjectName()); + return new CIMArgument(name, type, op); + } + + // CLASS + Element classA[] = searchNodes(pParamValueE, "CLASS", 0, 1, false); + if (classA != null) { + CIMClass cl = parseCLASS(classA[0]); + return new CIMArgument(name, CIMDataType.CLASS_T, cl); + } + + // INSTANCE + Element instanceA[] = searchNodes(pParamValueE, "INSTANCE", 0, 1, false); + if (instanceA != null) { + CIMInstance inst = parseINSTANCE(instanceA[0]); + return new CIMArgument(name, CIMDataType.OBJECT_T, inst); + } + + // VALUE.NAMEDINSTANCE + Element valuenamedisntanceA[] = searchNodes(pParamValueE, "VALUE.NAMEDINSTANCE", 0, 1, + false); + if (valuenamedisntanceA != null) { + CIMInstance inst = parseVALUENAMEDINSTANCE(valuenamedisntanceA[0]); + return new CIMArgument(name, CIMDataType.OBJECT_T, inst); + } + checkOtherNodes(pParamValueE, nodesPARAMVALUE); + return new CIMArgument(name, CIMDataType.STRING_T, null); + } + + private static final String nodesIPARAMVALUE[] = { "VALUE", "VALUE.ARRAY", "VALUE.REFERENCE", + "CLASSNAME", "INSTANCENAME", "QUALIFIER.DECLARATION", "CLASS", "INSTANCE", + "VALUE.NAMEDINSTANCE" }; + + /** + * parseIPARAMVALUE + * + * @param pParamValueE + * @return CIMArgument + * @throws CIMXMLParseException + */ + public static CIMArgument parseIPARAMVALUE(Element pParamValueE) + throws CIMXMLParseException { + // + // + + String name = attribute(pParamValueE, "NAME"); + if (name == null) throw new CIMXMLParseException( + "IPARAMVALUE element missing NAME attribute!"); + // this can parse VALUE, VALUE.ARRAY and VALUE.REFERENCE + if (searchNodes(pParamValueE, "VALUE", 0, 1, false) != null + || searchNodes(pParamValueE, "VALUE.ARRAY", 0, 1, false) != null + || searchNodes(pParamValueE, "VALUE.REFERENCE", 0, 1, false) != null) { + TypedValue typedValue = parseSingleValue(pParamValueE, VALUE | VALUEA | VALUEREF); + if (typedValue.getType() != null) { return new CIMArgument(name, typedValue + .getType(), typedValue.getValue()); } + } + // we can have different types too which cannot be handled by + // parseSingleValue() + + // INSTANCENAME + Element instNameA[] = searchNodes(pParamValueE, "INSTANCENAME", 0, 1, false); + if (instNameA != null) { + CIMObjectPath op = parseINSTANCENAME(instNameA[0]); + CIMDataType type = new CIMDataType(op.getObjectName()); + return new CIMArgument(name, type, op); + } + + // CLASSNAME + Element classNameA[] = searchNodes(pParamValueE, "CLASSNAME", 0, 1, false); + if (classNameA != null) { + CIMObjectPath op = parseCLASSNAME(classNameA[0]); + CIMDataType type = new CIMDataType(op.getObjectName()); + return new CIMArgument(name, type, op); + } + + // QUALIFIER.DECLARATION + Element qualiDeclarationA[] = searchNodes(pParamValueE, "QUALIFIER.DECLARATION", 0, 1, + false); + if (qualiDeclarationA != null) { + CIMQualifierType qualiType = parseQUALIFIERDECLARATION(qualiDeclarationA[0]); + // FIXME: ebak: Does it surely have to be mapped to type: + // REFERENCE???? + return new CIMArgument(name, new CIMDataType(qualiType.getName()), qualiType); + } + + // CLASS + Element classA[] = searchNodes(pParamValueE, "CLASS", 0, 1, false); + if (classA != null) { + CIMClass cl = parseCLASS(classA[0]); + return new CIMArgument(name, CIMDataType.CLASS_T, cl); + } + + // INSTANCE + Element instanceA[] = searchNodes(pParamValueE, "INSTANCE", 0, 1, false); + if (instanceA != null) { + CIMInstance inst = parseINSTANCE(instanceA[0]); + return new CIMArgument(name, CIMDataType.OBJECT_T, inst); + } + + // VALUE.NAMEDINSTANCE + Element valuenamedisntanceA[] = searchNodes(pParamValueE, "VALUE.NAMEDINSTANCE", 0, 1, + false); + if (valuenamedisntanceA != null) { + CIMInstance inst = parseVALUENAMEDINSTANCE(valuenamedisntanceA[0]); + return new CIMArgument(name, CIMDataType.OBJECT_T, inst); + } + + checkOtherNodes(pParamValueE, nodesIPARAMVALUE); + return new CIMArgument(name, CIMDataType.STRING_T, null); + } + + /** + * parseSIMPLERSP + * + * @param pSimpleRspE + * @return CIMResponse + * @throws CIMXMLParseException + */ + public static CIMResponse parseSIMPLERSP(Element pSimpleRspE) throws CIMXMLParseException { + // + + // METHODRESPONSE + Element methodresponseA[] = searchNodes(pSimpleRspE, "METHODRESPONSE", 0, 1, false); + if (methodresponseA != null) { + + return parseMETHODRESPONSE(methodresponseA[0]); } + + // IMETHODRESPONSE + Element imethodresponseA[] = searchNodes(pSimpleRspE, "IMETHODRESPONSE", 0, 1, false); + if (imethodresponseA != null) { return parseIMETHODRESPONSE(imethodresponseA[0]); } + + throw new CIMXMLParseException("SIMPLERSP element missing required child element!"); + } + + /** + * parseMULTIRSP + * + * @param pSimpleRspE + * @return CIMResponse + * @throws CIMXMLParseException + */ + public static CIMResponse parseMULTIRSP(Element pSimpleRspE) throws CIMXMLParseException { + // + + Element[] multiRespElementA = searchNodes(pSimpleRspE, "SIMPLERSP", 2, Integer.MAX_VALUE, + false); + if (multiRespElementA != null) { + CIMResponse multiRsp = new CIMResponse(); + for (int i = 0; i < multiRespElementA.length; i++) { + Element methodresponseE = multiRespElementA[i]; + CIMResponse rsp = parseSIMPLERSP(methodresponseE); + rsp.setMethod("SIMPLERSP"); + multiRsp.addResponse(rsp); + } + return multiRsp; + } + + throw new CIMXMLParseException("MULTIRSP element missing SIMPLERSP child element!"); + } + + private static final String nodesSIMPLEREQ[] = { "CORRELATOR", "METHODCALL", "IMETHODCALL" }; + + /** + * parseSIMPLEREQ + * + * @param pSimpleReqE + * @return CIMRequest + * @throws CIMXMLParseException + */ + public static CIMRequest parseSIMPLEREQ(Element pSimpleReqE) throws CIMXMLParseException { + // + CIMRequest request = null; + + // METHODCALL + Element methodcallA[] = searchNodes(pSimpleReqE, "METHODCALL", 0, 1, true); + if (methodcallA != null) { + request = parseMETHODCALL(methodcallA[0]); + } + + // IMETHODCALL + Element imethodcallA[] = searchNodes(pSimpleReqE, "IMETHODCALL", 0, 1, true); + if (imethodcallA != null) { + if (request != null) { throw new CIMXMLParseException( + "SIMPLEREQ element cannot have METHODCALL and IMETHODCALL child elements!"); } + request = parseIMETHODCALL(imethodcallA[0]); + } + + if (request == null) throw new CIMXMLParseException( + "SIMPLEREQ element missing required child element!"); + + // CORRELATOR + Element[] correlatorA = searchNodes(pSimpleReqE, "CORRELATOR", 0, Integer.MAX_VALUE, true); + if (correlatorA != null) { + for (int i = 0; i < correlatorA.length; i++) + // TODO: return to WBEMClient API if JSR48 changes + parseCORRELATOR(correlatorA[i]); + } + + checkOtherNodes(pSimpleReqE, nodesSIMPLEREQ); + return request; + } + + /** + * parseMULTIREQ + * + * @param pMultiReqE + * @return CIMRequest + * @throws CIMXMLParseException + */ + public static CIMRequest parseMULTIREQ(Element pMultiReqE) throws CIMXMLParseException { + // + + Element[] methodReqElementA = searchNodes(pMultiReqE, "SIMPLEREQ", 2, Integer.MAX_VALUE, + false); + if (methodReqElementA != null) { + CIMRequest multiReq = new CIMRequest(); + for (int i = 0; i < methodReqElementA.length; i++) { + Element methodrequestE = methodReqElementA[i]; + CIMRequest req = parseSIMPLEREQ(methodrequestE); + req.setMethod("SIMPLEREQ"); + + multiReq.addRequest(req); + } + return multiReq; + } + throw new CIMXMLParseException("MULTIREQ element missing SIMPLEREQ child element!"); + } + + private static final String nodesMETHODCALL[] = { "LOCALCLASSPATH", "LOCALINSTANCEPATH", + "PARAMVALUE" }; + + /** + * parseMETHODCALL + * + * @param pMethodCallE + * @return CIMRequest + * @throws CIMXMLParseException + */ + public static CIMRequest parseMETHODCALL(Element pMethodCallE) throws CIMXMLParseException { + // + // + + CIMRequest request = new CIMRequest(); + String methodname = attribute(pMethodCallE, "NAME"); + if (methodname == null) throw new CIMXMLParseException( + "METHODCALL element missing NAME attribute!"); + request.setMethodName(methodname); + + // EXPMETHODCALL + boolean localclasspathFound = false; + Element localclasspathA[] = searchNodes(pMethodCallE, "LOCALCLASSPATH", 0, 1, true); + if (localclasspathA != null) { + CIMObjectPath path = parseLOCALCLASSPATH(localclasspathA[0]); + + request.setObjectPath(path); + localclasspathFound = true; + } + + Element localinstancepathA[] = searchNodes(pMethodCallE, "LOCALINSTANCEPATH", 0, 1, true); + if (localinstancepathA != null) { + if (localclasspathFound) throw new CIMXMLParseException( + "METHODCALL element cannot have both LOCALCLASSPATH and LOCALINSTANCEPATH child elements!"); + + CIMObjectPath path = parseLOCALINSTANCEPATH(localinstancepathA[0]); + + request.setObjectPath(path); + } else { + if (!localclasspathFound) throw new CIMXMLParseException( + "METHODCALL element missing required child element!"); + } + + Element[] paramValueElementA = searchNodes(pMethodCallE, "PARAMVALUE", 0, + Integer.MAX_VALUE, true); + + if (paramValueElementA != null) { + CIMArgument[] argA = new CIMArgument[paramValueElementA.length]; + for (int i = 0; i < paramValueElementA.length; i++) { + Element paramvalueE = paramValueElementA[i]; + argA[i] = parsePARAMVALUE(paramvalueE); + } + request.addParamValue(argA); + } + + checkOtherNodes(pMethodCallE, nodesMETHODCALL); + return request; + } + + private static final String nodesIMETHODCALL[] = { "LOCALNAMESPACEPATH", "IPARAMVALUE" }; + + /** + * parseIMETHODCALL + * + * @param pIMethodCallE + * @return CIMRequest + * @throws CIMXMLParseException + */ + public static CIMRequest parseIMETHODCALL(Element pIMethodCallE) throws CIMXMLParseException { + // + // + + CIMRequest request = new CIMRequest(); + String methodname = attribute(pIMethodCallE, "NAME"); // ebak: + // CIMName->NAME + if (methodname == null) throw new CIMXMLParseException( + "IMETHODCALL element missing NAME attribute!"); + request.setMethodName(methodname); + + // METHODCALL + Element localnamespacepathA[] = searchNodes(pIMethodCallE, "LOCALNAMESPACEPATH", 1, 1, true); + if (localnamespacepathA != null) { + String nameSpace = parseLOCALNAMESPACEPATH(localnamespacepathA[0]); + request.setNameSpace(nameSpace); + } + + Element[] iParamValElementA = searchNodes(pIMethodCallE, "IPARAMVALUE", 0, + Integer.MAX_VALUE, true); // ebak: + // PARAMVALUE->IPARAMVALUE + + if (iParamValElementA != null) { + CIMArgument[] argA = new CIMArgument[iParamValElementA.length]; + for (int i = 0; i < iParamValElementA.length; i++) { + Element paramvalueE = iParamValElementA[i]; + CIMArgument arg = parseIPARAMVALUE(paramvalueE); + /* + * ebak: local nameSpacePath should be added to those reference + * arguments which don't contain namespace + */ + Object value = arg.getValue(); + if (value instanceof CIMObjectPath) { + CIMObjectPath op = (CIMObjectPath) value; + if (op.getNamespace() == null || op.getNamespace().length() == 0) { + arg = new CIMArgument(arg.getName(), arg.getDataType(), + // CIMObjectPath(String scheme, String host, String + // port, String namespace, String objectName, + // CIMProperty[] keys) + new CIMObjectPath(op.getScheme(), op.getHost(), op.getPort(), + request.getNameSpace(), op.getObjectName(), op.getKeys())); + } + } + argA[i] = arg; + } + request.addParamValue(argA); + } + + checkOtherNodes(pIMethodCallE, nodesIMETHODCALL); + return request; + } + + private static final String nodesSIMPLEEXPREQ[] = { "CORRELATOR", "EXPMETHODCALL" }; + + /** + * parseSIMPLEEXPREQ + * + * @param pSimpleExpReqE + * @return CIMRequest + * @throws CIMXMLParseException + */ + public static CIMRequest parseSIMPLEEXPREQ(Element pSimpleExpReqE) throws CIMXMLParseException { + // + CIMRequest request = null; + + // EXPMETHODCALL + Element[] expmethodcallA = searchNodes(pSimpleExpReqE, "EXPMETHODCALL", 1, 1, true); + if (expmethodcallA != null) { + request = parseEXPMETHODCALL(expmethodcallA[0]); + } else { + throw new CIMXMLParseException( + "SIMPLEEXPREQ element missing EXPMETHODCALL child element!"); + } + + // CORRELATOR + Element[] correlatorA = searchNodes(pSimpleExpReqE, "CORRELATOR", 0, Integer.MAX_VALUE, + true); + if (correlatorA != null) { + for (int i = 0; i < correlatorA.length; i++) + // TODO: return to WBEMClient API if JSR48 changes + parseCORRELATOR(correlatorA[i]); + } + + checkOtherNodes(pSimpleExpReqE, nodesSIMPLEEXPREQ); + return request; + } + + /** + * parseMULTIEXPREQ + * + * @param pMultiExpReqE + * @return CIMRequest + * @throws CIMXMLParseException + */ + public static CIMRequest parseMULTIEXPREQ(Element pMultiExpReqE) throws CIMXMLParseException { + // + + Element[] methodReqElementA = searchNodes(pMultiExpReqE, "SIMPLEEXPREQ", 2, + Integer.MAX_VALUE, false); + if (methodReqElementA != null) { + CIMRequest multiReq = new CIMRequest(); + for (int i = 0; i < methodReqElementA.length; i++) { + Element methodrequestE = methodReqElementA[i]; + CIMRequest req = parseSIMPLEEXPREQ(methodrequestE); + req.setMethod("SIMPLEEXPREQ"); + + multiReq.addRequest(req); + } + return multiReq; + } + throw new CIMXMLParseException("MULTIEXPREQ element missing SIMPLEEXPREQ child element!"); + } + + private static final String nodesEXPMETHODCALL[] = { "EXPPARAMVALUE" }; + + /** + * parseEXPMETHODCALL + * + * @param pExpMethodCallE + * @return CIMRequest + * @throws CIMXMLParseException + */ + public static CIMRequest parseEXPMETHODCALL(Element pExpMethodCallE) + throws CIMXMLParseException { + // + + // EXPMETHODCALL + CIMRequest request = new CIMRequest(); + String methodname = attribute(pExpMethodCallE, "NAME"); + if (methodname == null) throw new CIMXMLParseException( + "EXPMETHODCALL element missing NAME attribute!"); + request.setMethodName(methodname); + + Element[] paramValElementA = searchNodes(pExpMethodCallE, "EXPPARAMVALUE", 0, + Integer.MAX_VALUE, false); + Vector v = new Vector(); + if (paramValElementA != null) { + for (int i = 0; i < paramValElementA.length; i++) { + Element expparamvalueE = paramValElementA[i]; + CIMInstance inst = parseEXPPARAMVALUE(expparamvalueE); + v.add(inst); + } + } + request.addParamValue(v); + checkOtherNodes(pExpMethodCallE, nodesEXPMETHODCALL); + return request; + } + + private static final String nodesEXPPARAMVALUE[] = { "INSTANCE" }; + + /** + * parseEXPPARAMVALUE + * + * @param pExpParamValueE + * @return CIMInstance + * @throws CIMXMLParseException + */ + public static CIMInstance parseEXPPARAMVALUE(Element pExpParamValueE) + throws CIMXMLParseException { + // + // + // INSTANCE + if (attribute(pExpParamValueE, "NAME") == null) throw new CIMXMLParseException( + "EXPPARAMVALUE element missing NAME attribute!"); + + Element[] instanceA = searchNodes(pExpParamValueE, "INSTANCE", 0, 1, false); + if (instanceA != null) { + CIMInstance inst = parseINSTANCE(instanceA[0]); + return inst; + } + + checkOtherNodes(pExpParamValueE, nodesEXPPARAMVALUE); + + return null; + } + + private static final String nodesMETHODRESPONSE[] = { "ERROR", "RETURNVALUE", "PARAMVALUE" }; + + /** + * parseMETHODRESPONSE + * + * @param pMethodResponseE + * @return CIMResponse + * @throws CIMXMLParseException + */ + public static CIMResponse parseMETHODRESPONSE(Element pMethodResponseE) + throws CIMXMLParseException { + // + if (attribute(pMethodResponseE, "NAME") == null) throw new CIMXMLParseException( + "METHODRESPONSE element missing NAME attribute!"); + + CIMResponse response = new CIMResponse(); + + // ERROR + Element errorA[] = searchNodes(pMethodResponseE, "ERROR", 0, 1, false); + if (errorA != null) { + WBEMException exception = parseERROR(errorA[0]); + response.setError(exception); + return response; + } + + // RETURNVALUE + Element[] retValElementA = searchNodes(pMethodResponseE, "RETURNVALUE", 0, 1, true); + if (retValElementA != null) { + Vector v = new Vector(); + for (int i = 0; i < retValElementA.length; i++) { + Element returnvalueE = retValElementA[i]; + v.add(parseRETURNVALUE(returnvalueE)); + } + response.setReturnValue(v); + } + + // PARAMVALUE + Element[] paramValElementA = searchNodes(pMethodResponseE, "PARAMVALUE", 0, + Integer.MAX_VALUE, true); + if (paramValElementA != null) { + Vector v = new Vector(); + for (int i = 0; i < paramValElementA.length; i++) { + Element paramvalueE = paramValElementA[i]; + CIMArgument arg = parsePARAMVALUE(paramvalueE); + v.add(arg); + } + response.addParamValue(v); + } + + // PARAMVALUE (ESS fix) + if (retValElementA != null) { + for (int i = 0; i < retValElementA.length; i++) { + Element retValE = retValElementA[i]; + + paramValElementA = searchNodes(retValE, "PARAMVALUE"); + if (paramValElementA != null) { + Vector> v = new Vector>(); + for (int j = 0; j < paramValElementA.length; j++) { + Element paramvalueE = paramValElementA[j]; + CIMArgument arg = parsePARAMVALUE(paramvalueE); + v.add(arg); + } + response.addParamValue(v); + } + } + } + checkOtherNodes(pMethodResponseE, nodesMETHODRESPONSE); + + return response; + } + + private static final String nodesIMETHODRESPONSE[] = { "ERROR", "IRETURNVALUE", "PARAMVALUE" }; + + /** + * parseIMETHODRESPONSE + * + * @param pIMethodResponseE + * @return CIMResponse + * @throws CIMXMLParseException + */ + public static CIMResponse parseIMETHODRESPONSE(Element pIMethodResponseE) + throws CIMXMLParseException { + // + if (attribute(pIMethodResponseE, "NAME") == null) throw new CIMXMLParseException( + "IMETHODRESPONSE element missing NAME attribute!"); + + CIMResponse response = new CIMResponse(); + // ERROR + Element[] errorA = searchNodes(pIMethodResponseE, "ERROR", 0, 1, false); + if (errorA != null) { + WBEMException exception = parseERROR(errorA[0]); + response.setError(exception); + return response; + } + + // IRETURNVALUE + Element[] retValElementA = searchNodes(pIMethodResponseE, "IRETURNVALUE", 0, 1, true); + if (retValElementA != null) { + for (int i = 0; i < retValElementA.length; i++) { + Element ireturnvalueE = retValElementA[i]; + + Vector rtnV = parseIRETURNVALUE(ireturnvalueE); + response.setReturnValue(rtnV); + } + } + + // PARAMVALUE + Element[] paramValElementA = searchNodes(pIMethodResponseE, "PARAMVALUE", 0, + Integer.MAX_VALUE, true); + if (paramValElementA != null) { + Vector v = new Vector(); + for (int i = 0; i < paramValElementA.length; i++) { + Element paramvalueE = paramValElementA[i]; + CIMArgument arg = parsePARAMVALUE(paramvalueE); + v.add(arg); + } + response.addParamValue(v); + } + checkOtherNodes(pIMethodResponseE, nodesIMETHODRESPONSE); + + return response; + } + + private static final String nodesERROR[] = { "INSTANCE" }; + + /** + * parseERROR + * + * @param pErrorE + * @return WBEMException + * @throws CIMXMLParseException + */ + public static WBEMException parseERROR(Element pErrorE) throws CIMXMLParseException { + // + // + + Attr error_codeA = (Attr) searchAttribute(pErrorE, "CODE"); + if (error_codeA == null) throw new CIMXMLParseException( + "ERROR element missing CODE attribute!"); + String code = error_codeA.getNodeValue(); + int errorCode = 0; + try { + if (code.length() > 0) errorCode = Integer.parseInt(code); + } catch (Exception e) { + LogAndTraceBroker.getBroker().trace(Level.WARNING, + "exception while parsing error code from XML", e); + errorCode = WBEMException.CIM_ERR_FAILED; + } + Attr error_descriptionA = (Attr) searchAttribute(pErrorE, "DESCRIPTION"); + String description = ""; + if (error_descriptionA != null) { + description = error_descriptionA.getNodeValue(); + } + + Vector rtnV = new Vector(); + + // INSTANCE + Element[] instElementA = searchNodes(pErrorE, "INSTANCE", 0, Integer.MAX_VALUE, false); + if (instElementA != null) { + for (int i = 0; i < instElementA.length; i++) { + Element instanceE = instElementA[i]; + CIMInstance inst = parseINSTANCE(instanceE); + rtnV.add(inst); + } + } + checkOtherNodes(pErrorE, nodesERROR); + + // throw new CIMException(CIMException.getErrorName(errorCode), + // description.substring(description.indexOf(':')+1)); + if (!rtnV.isEmpty()) return new WBEMException(errorCode, "ErrorCode:" + errorCode + + " description:" + description, rtnV.toArray(new CIMInstance[0])); + return new WBEMException(errorCode, "ErrorCode:" + errorCode + " description:" + + description); + } + + private static final String nodesRETURNVALUE[] = { "VALUE", "VALUE.REFERENCE" }; + + /** + * parseRETURNVALUE + * + * @param pRetValE + * @return Object + * @throws CIMXMLParseException + */ + public static Object parseRETURNVALUE(Element pRetValE) throws CIMXMLParseException { + // + // + // ebak: embedded object support: different parsing of VALUE sub element + checkOtherNodes(pRetValE, nodesRETURNVALUE); + if (searchNodes(pRetValE, "VALUE", 0, 1, false) != null) { + EmbObjHandler embObjHandler = new EmbObjHandler(pRetValE); + return embObjHandler.getValue(); + } + if (searchNodes(pRetValE, "VALUE.REFERENCE", 0, 1, false) != null) { + TypedValue typedVal = parseSingleValue(pRetValE, VALUEREF); + Object value = typedVal.getValue(); + return value; + } + checkOtherNodes(pRetValE, nodesRETURNVALUE); + return null; + } + + private static final String nodesIRETURNVALUE[] = { "CLASSNAME", "INSTANCENAME", "VALUE", + "VALUE.OBJECTWITHPATH", "VALUE.OBJECTWITHLOCALPATH", "VALUE.OBJECT", "OBJECTPATH", + "QUALIFIER.DECLARATION", "VALUE.ARRAY", "VALUE.REFERENCE", "CLASS", "INSTANCE", + "INSTANCEPATH", "VALUE.NAMEDINSTANCE" }; + + /** + * parseIRETURNVALUE + * + * @param pIRetValE + * @return Vector + * @throws CIMXMLParseException + */ + public static Vector parseIRETURNVALUE(Element pIRetValE) throws CIMXMLParseException { + // + + Vector rtnV = new Vector(); + + // CLASS + Element[] classElementA = searchNodes(pIRetValE, "CLASS", 0, Integer.MAX_VALUE, false); + if (classElementA != null) { + for (int i = 0; i < classElementA.length; i++) { + Element classE = classElementA[i]; + CIMClass c = parseCLASS(classE); + rtnV.add(c); + } + return rtnV; + } + + // INSTANCE + Element[] instElementA = searchNodes(pIRetValE, "INSTANCE", 0, Integer.MAX_VALUE, false); + if (instElementA != null) { + for (int i = 0; i < instElementA.length; i++) { + Element instanceE = instElementA[i]; + CIMInstance inst = parseINSTANCE(instanceE); + rtnV.add(inst); + } + return rtnV; + } + + // CLASSNAME + Element[] classNameElementA = searchNodes(pIRetValE, "CLASSNAME", 0, Integer.MAX_VALUE, + false); + if (classNameElementA != null) { + for (int i = 0; i < classNameElementA.length; i++) { + Element classnameE = classNameElementA[i]; + CIMObjectPath op = parseCLASSNAME(classnameE); + rtnV.add(op); + } + return rtnV; + } + + // INSTANCENAME + Element[] instNameElementA = searchNodes(pIRetValE, "INSTANCENAME", 0, Integer.MAX_VALUE, + false); + if (instNameElementA != null) { + for (int i = 0; i < instNameElementA.length; i++) { + Element instancenameE = instNameElementA[i]; + CIMObjectPath op = parseINSTANCENAME(instancenameE); + rtnV.add(op); + } + return rtnV; + } + + // INSTANCEPATH + Element[] instpathElementA = searchNodes(pIRetValE, "INSTANCEPATH", 0, Integer.MAX_VALUE, + false); + if (instpathElementA != null) { + for (int i = 0; i < instpathElementA.length; i++) { + Element instancePathE = instpathElementA[i]; + CIMObjectPath op = parseINSTANCEPATH(instancePathE); + rtnV.add(op); + } + return rtnV; + } + + // OBJECTPATH + Element[] objPathElementA = searchNodes(pIRetValE, "OBJECTPATH", 0, Integer.MAX_VALUE, + false); + if (objPathElementA != null) { + for (int i = 0; i < objPathElementA.length; i++) { + Element objectpathE = objPathElementA[i]; + CIMObjectPath op = parseOBJECTPATH(objectpathE); + rtnV.add(op); + } + return rtnV; + } + + // VALUE + Element[] valueElementA = searchNodes(pIRetValE, "VALUE", 0, Integer.MAX_VALUE, false); + if (valueElementA != null) { + for (int i = 0; i < valueElementA.length; i++) { + Element valueE = valueElementA[i]; + TypedValue tv = parseVALUE(valueE); + rtnV.add(tv.getValue()); + } + return rtnV; + } + + // VALUE.ARRAY + Element[] valueArrayElementA = searchNodes(pIRetValE, "VALUE.ARRAY", 0, 1, false); + if (valueArrayElementA != null) { + Element valuearrayE = valueArrayElementA[0]; + TypedValue tv = parseVALUEARRAY(valuearrayE); + rtnV.add(tv.getValue()); + return rtnV; + } + + // VALUE.REFERENCE + Element[] valRefElementA = searchNodes(pIRetValE, "VALUE.REFERENCE", 0, 1, false); + if (valRefElementA != null) { + Element valuereferenceE = valRefElementA[0]; + CIMObjectPath op = parseVALUEREFERENCE(valuereferenceE); + rtnV.add(op); + return rtnV; + } + + // VALUE.OBJECT + Element[] valObjElementA = searchNodes(pIRetValE, "VALUE.OBJECT", 0, Integer.MAX_VALUE, + false); + if (valObjElementA != null) { + for (int i = 0; i < valObjElementA.length; i++) { + Element valueobjectE = valObjElementA[i]; + CIMNamedElementInterface obj = parseVALUEOBJECT(valueobjectE); + rtnV.add(obj); + } + return rtnV; + } + + // VALUE.NAMEDINSTANCE + Element[] valNamedInstElementA = searchNodes(pIRetValE, "VALUE.NAMEDINSTANCE", 0, + Integer.MAX_VALUE, false); + if (valNamedInstElementA != null) { + for (int i = 0; i < valNamedInstElementA.length; i++) { + Element valuenamedisntanceE = valNamedInstElementA[i]; + CIMInstance inst = parseVALUENAMEDINSTANCE(valuenamedisntanceE); + rtnV.add(inst); + } + return rtnV; + } + + // VALUE.INSTANCEWITHPATH + Element[] valInstWithPathElementA = searchNodes(pIRetValE, "VALUE.INSTANCEWITHPATH", 0, + Integer.MAX_VALUE, false); + if (valInstWithPathElementA != null) { + for (int i = 0; i < valInstWithPathElementA.length; i++) { + Element valueinstancewithpathE = valInstWithPathElementA[i]; + CIMInstance inst = parseVALUEINSTANCEWITHPATH(valueinstancewithpathE); + rtnV.add(inst); + } + return rtnV; + } + + // VALUE.OBJECTWITHPATH + Element[] valObjWithPathElementA = searchNodes(pIRetValE, "VALUE.OBJECTWITHPATH", 0, + Integer.MAX_VALUE, false); + if (valObjWithPathElementA != null) { + for (int i = 0; i < valObjWithPathElementA.length; i++) { + Element valueobjectwithpathE = valObjWithPathElementA[i]; + CIMNamedElementInterface namedIF = parseVALUEOBJECTWITHPATH(valueobjectwithpathE); + rtnV.add(namedIF); + } + return rtnV; + } + + // VALUE.OBJECTWITHLOCALPATH + Element[] valObjWithLocalPathElementA = searchNodes(pIRetValE, "VALUE.OBJECTWITHLOCALPATH", + 0, Integer.MAX_VALUE, false); + if (valObjWithLocalPathElementA != null) { + for (int i = 0; i < valObjWithLocalPathElementA.length; i++) { + Element valueobjectwithlocalpathE = valObjWithLocalPathElementA[i]; + CIMNamedElementInterface namedIF = parseVALUEOBJECTWITHLOCALPATH(valueobjectwithlocalpathE); + rtnV.add(namedIF); + } + return rtnV; + } + + // QUALIFIER.DECLARATION + Element[] qualiDeclElementA = searchNodes(pIRetValE, "QUALIFIER.DECLARATION", 0, + Integer.MAX_VALUE, false); + if (qualiDeclElementA != null) { + for (int i = 0; i < qualiDeclElementA.length; i++) { + Element qualifierdeclarationE = qualiDeclElementA[i]; + CIMQualifierType o = parseQUALIFIERDECLARATION(qualifierdeclarationE); + rtnV.add(o); + } + return rtnV; + } + checkOtherNodes(pIRetValE, nodesIRETURNVALUE); + return rtnV; + } + + /** + * parseObject + * + * @param pRootE + * @return Object + * @throws CIMXMLParseException + */ + public static Object parseObject(Element pRootE) throws CIMXMLParseException { + Object o = null; + String nodeName = pRootE.getNodeName(); + if (nodeName.equalsIgnoreCase("INSTANCE")) { + o = parseINSTANCE(pRootE); + } else if (nodeName.equalsIgnoreCase("VALUE.NAMEDINSTANCE")) { + o = parseVALUENAMEDINSTANCE(pRootE); + } else if (nodeName.equalsIgnoreCase("VALUE.NAMEDOBJECT")) { + o = parseVALUENAMEDOBJECT(pRootE); + } else if (nodeName.equalsIgnoreCase("VALUE.OBJECTWITHPATH")) { + o = parseVALUEOBJECTWITHPATH(pRootE); + } else if (nodeName.equalsIgnoreCase("VALUE.OBJECTWITHLOCALPATH")) { + o = parseVALUEOBJECTWITHLOCALPATH(pRootE); + } else if (nodeName.equalsIgnoreCase("CLASS")) { + o = parseCLASS(pRootE); + } else if (nodeName.equalsIgnoreCase("CLASSPATH")) { + o = parseCLASSPATH(pRootE); + } else if (nodeName.equalsIgnoreCase("LOCALCLASSPATH")) { + o = parseLOCALCLASSPATH(pRootE); + } else if (nodeName.equalsIgnoreCase("OBJECTPATH")) { + o = parseOBJECTPATH(pRootE); + } else if (nodeName.equalsIgnoreCase("CLASSNAME")) { + o = parseCLASSNAME(pRootE); + } else if (nodeName.equalsIgnoreCase("INSTANCEPATH")) { + o = parseINSTANCEPATH(pRootE); + } else if (nodeName.equalsIgnoreCase("LOCALINSTANCEPATH")) { + o = parseLOCALINSTANCEPATH(pRootE); + } else if (nodeName.equalsIgnoreCase("INSTANCENAME")) { + o = parseINSTANCENAME(pRootE); + } else if (nodeName.equalsIgnoreCase("QUALIFIER")) { + o = parseQUALIFIER(pRootE); + } else if (nodeName.equalsIgnoreCase("PROPERTY")) { + o = parsePROPERTY(pRootE); + } else if (nodeName.equalsIgnoreCase("PROPERTY.ARRAY")) { + o = parsePROPERTYARRAY(pRootE); + } else if (nodeName.equalsIgnoreCase("PROPERTY.REFERENCE")) { + o = parsePROPERTYREFERENCE(pRootE); + } else if (nodeName.equalsIgnoreCase("METHOD")) { + o = parseMETHOD(pRootE); + } else if (nodeName.equalsIgnoreCase("PARAMETER")) { + o = parsePARAMETER(pRootE); + } else if (nodeName.equalsIgnoreCase("PARAMETER.REFERENCE")) { + o = parsePARAMETERREFERENCE(pRootE); + } else if (nodeName.equalsIgnoreCase("PARAMETER.ARRAY")) { + o = parsePARAMETERARRAY(pRootE); + } else if (nodeName.equalsIgnoreCase("PARAMETER.REFARRAY")) { + o = parsePARAMETERREFARRAY(pRootE); + } + return o; + } + + // /////////////////////////////////////////////////////////////////////////////////////////// + + /** + * hasNodes + * + * @param pParentE + * @return boolean + */ + private static boolean hasNodes(Element pParentE) { + NodeList nl = pParentE.getChildNodes(); + if (nl == null || nl.getLength() == 0) return false; + for (int i = 0; i < nl.getLength(); i++) { + Node n = nl.item(i); + if (!(n instanceof Text) || !("".equalsIgnoreCase(n.getNodeValue().trim()))) return true; + } + return false; + } + + /** + * hasTypeAttrsInNodes + * + * SVC CIMOM sends typed CIM-XML elements in a non-standard way. The TYPE + * attribute is included in the VALUE or VALUE.ARRAY element not in the + * enclosing element as the standard says. + * + * @param pParentE + * @return boolean + */ + private static boolean hasTypeAttrsInNodes(Element pParentE) { + NodeList nl = pParentE.getChildNodes(); + if (nl == null || nl.getLength() == 0) return false; + for (int i = 0; i < nl.getLength(); i++) { + Node n = nl.item(i); + String name = n.getNodeName(); + if ("VALUE".equalsIgnoreCase(name) || "VALUE.ARRAY".equalsIgnoreCase(name)) { + NamedNodeMap nm = n.getAttributes(); + if (nm != null + && (nm.getNamedItem("TYPE") != null || nm.getNamedItem("PARAMTYPE") != null)) return true; + } + } + return false; + } + + private static final HashMap NODENAME_HASH = new HashMap(); + + private static void initNodeNameHash(String[] pEnumA) { + for (int i = 0; i < pEnumA.length; i++) + NODENAME_HASH.put(pEnumA[i], pEnumA[i]); + } + + static { + initNodeNameHash(new String[] { "CIM", "DECLARATION", "DECLGROUP", "DECLGROUP.WITHNAME", + "DECLGROUP.WITHPATH", "QUALIFIER.DECLARATION", "SCOPE", "VALUE", "VALUE.ARRAY", + "VALUE.REFERENCE", "VALUE.REFARRAY", "VALUE.OBJECT", "VALUE.NAMEDINSTANCE", + "VALUE.NAMEDOBJECT", "VALUE.OBJECTWITHLOCALPATH", "VALUE.OBJECTWITHPATH", + "VALUE.NULL", "VALUE.INSTANCEWITHPATH", "NAMESPACEPATH", "LOCALNAMESPACEPATH", + "HOST", "NAMESPACE", "CLASSPATH", "LOCALCLASSPATH", "CLASSNAME", "INSTANCEPATH", + "LOCALINSTANCEPATH", "INSTANCENAME", "OBJECTPATH", "KEYBINDING", "KEYVALUE", + "CLASS", "INSTANCE", "QUALIFIER", "PROPERTY", "PROPERTY.ARRAY", + "PROPERTY.REFERENCE", "METHOD", "PARAMETER", "PARAMETER.REFERENCE", + "PARAMETER.ARRAY", "PARAMETER.REFARRAY", "MESSAGE", "MULTIREQ", "MULTIEXPREQ", + "SIMPLEREQ", "SIMPLEEXPREQ", "IMETHODCALL", "METHODCALL", "EXPMETHODCALL", + "PARAMVALUE", "IPARAMVALUE", "EXPPARAMVALUE", "MULTIRSP", "MULTIEXPRSP", + "SIMPLERSP", "SIMPLEEXPRSP", "METHODRESPONSE", "EXPMETHODRESPONSE", + "IMETHODRESPONSE", "ERROR", "RETURNVALUE", "IRETURNVALUE", "CORRELATOR" }); + } + + /** + * checkOtherNodes + * + * @param pParentE + * @param pAllowedChildNodes + */ + private static void checkOtherNodes(Element pParentE, String[] pAllowedChildNodes) + throws CIMXMLParseException { + NodeList nl = pParentE.getChildNodes(); + if (nl == null || nl.getLength() == 0) return; + for (int i = 0; i < nl.getLength(); i++) { + Node n = nl.item(i); + if (n instanceof Text && "".equalsIgnoreCase(n.getNodeValue().trim())) continue; + boolean found = false; + String name = n.getNodeName().toUpperCase(); + for (int j = 0; j < pAllowedChildNodes.length; j++) { + if (pAllowedChildNodes[j].equalsIgnoreCase(name)) { + found = true; + break; + } + } + if (!found && NODENAME_HASH.containsKey(name)) throw new CIMXMLParseException(pParentE + .getNodeName() + + " element contains invalid child element " + name + "!"); + } + } + + /** + * searchNodes + * + * @param pParentE + * @param pTagName + * @return Element[] + */ + public static Element[] searchNodes(Element pParentE, String pTagName) { + // return all of child nodes immediately below the parent + // return null if not found + NodeList nl = pParentE.getChildNodes(); + if (nl == null || nl.getLength() == 0) return null; + Vector resElementV = new Vector(); + for (int i = 0; i < nl.getLength(); i++) { + Node n = nl.item(i); + if (n.getNodeName().equals(pTagName)) { + resElementV.add(n); + } + } + return resElementV.toArray(new Element[0]); + } + + /** + * searchNodes + * + * @param pParentE + * @param pTagName + * @param pMin + * @param pMax + * @param pAllowOtherNodes + * @return Element[] + * @throws CIMXMLParseException + */ + public static Element[] searchNodes(Element pParentE, String pTagName, int pMin, int pMax, + boolean pAllowOtherNodes) throws CIMXMLParseException { + // return all child nodes immediately below parent, null if none found + + NodeList nl = pParentE.getChildNodes(); + if (nl == null || nl.getLength() == 0) { + if (pMin > 0) throw new CIMXMLParseException(pParentE.getNodeName() + + " element must have at least " + pMin + " " + pTagName + " child element(s)!"); + return null; + } + + String otherNode = null; + Vector resElementV = new Vector(); + for (int i = 0; i < nl.getLength(); i++) { + Node n = nl.item(i); + String name = n.getNodeName().toUpperCase(); + if (name.equals(pTagName)) { + resElementV.add(n); + } else if (NODENAME_HASH.containsKey(name)) { + otherNode = name; + } + } + + if (resElementV.size() < pMin) throw new CIMXMLParseException(pParentE.getNodeName() + + " element must have at least " + pMin + " " + pTagName + " child element(s)!"); + if (resElementV.size() > pMax) throw new CIMXMLParseException(pParentE.getNodeName() + + " element can have no more than " + pMax + " " + pTagName + " child element(s)!"); + if (resElementV.size() > 0 && !pAllowOtherNodes && otherNode != null) throw new CIMXMLParseException( + pParentE.getNodeName() + " element cannot have " + otherNode + + " child element(s) when it already has " + pTagName + " element(s)!"); + if (resElementV.size() == 0) return null; + + return resElementV.toArray(new Element[0]); + } + + /** + * searchFirstNode + * + * @param pParentE + * @param pTagName + * @return Node + */ + public static Node searchFirstNode(Element pParentE, String pTagName) { + // return the first node which matches to the specific name + // return null if not found + NodeList nl = pParentE.getChildNodes(); + for (int i = 0; i < nl.getLength(); i++) { + Node n = nl.item(i); + if (n.getNodeName().equals(pTagName)) { return n; } + } + return null; + } + + /** + * searchAttribute + * + * @param pParentN + * @param pAttrName + * @return Node + */ + public static Node searchAttribute(Node pParentN, String pAttrName) { + // return the attribute node with the specific name + NamedNodeMap nnm = pParentN.getAttributes(); + return nnm.getNamedItem(pAttrName); + } + + /** + * searchFirstChild + * + * @param pParentE + * @return Node + */ + public static Node searchFirstChild(Element pParentE) { + // return the first node which matches to the specific name + // return null if not found + return pParentE.getFirstChild(); + } + + /** + * createJavaObject + * + * @param pTypeStr + * @param pValue + * @return Object + * @throws CIMXMLParseException + */ + public static Object createJavaObject(String pTypeStr, String pValue) + throws CIMXMLParseException { + // return a java object with the specific type + if (pTypeStr == null) pTypeStr = MOF.DT_STR; + if (MOF.NULL.equalsIgnoreCase(pTypeStr)) return null; + Object o = null; + CIMDataType cimType = parseTypeStr(pTypeStr, false); + int radix = 10; + + if (pTypeStr.toLowerCase().startsWith("sint") || pTypeStr.toLowerCase().startsWith("uint")) { + pValue = pValue.toLowerCase(); + if (pValue.startsWith("0x") || pValue.startsWith("+0x") || pValue.startsWith("-0x")) { + radix = 16; + if (pValue.startsWith("-")) pValue = "-" + pValue.substring(3); + else pValue = pValue.substring(pValue.indexOf('x') + 1); + } + } + + switch (cimType.getType()) { + case CIMDataType.UINT8: + o = new UnsignedInteger8(Short.parseShort(pValue, radix)); + break; + case CIMDataType.UINT16: + o = new UnsignedInteger16(Integer.parseInt(pValue, radix)); + break; + case CIMDataType.UINT32: + o = new UnsignedInteger32(Long.parseLong(pValue, radix)); + break; + case CIMDataType.UINT64: + o = new UnsignedInteger64(new BigInteger(pValue, radix)); + break; + case CIMDataType.SINT8: + o = Byte.valueOf(pValue, radix); + break; + case CIMDataType.SINT16: + o = Short.valueOf(pValue, radix); + break; + case CIMDataType.SINT32: + o = Integer.valueOf(pValue, radix); + break; + case CIMDataType.SINT64: + o = Long.valueOf(pValue, radix); + break; + case CIMDataType.STRING: + o = pValue; + break; + case CIMDataType.BOOLEAN: + o = Boolean.valueOf(pValue); + break; + case CIMDataType.REAL32: + o = new Float(pValue); + break; + case CIMDataType.REAL64: + if (WBEMConfiguration.getGlobalConfiguration().verifyJavaLangDoubleStrings()) { + if (Util.isBadDoubleString(pValue)) throw new IllegalArgumentException( + "Double value string hangs older JVMs!\n" + pValue); + } + o = new Double(pValue); + break; + case CIMDataType.DATETIME: + o = getDateTime(pValue); + break; + case CIMDataType.REFERENCE: + o = new CIMObjectPath(pValue); + break; + case CIMDataType.CHAR16: + o = Character.valueOf(pValue.charAt(0)); + break; + // case CIMDataType.OBJECT: o = new CIMInstance(); break; //TODO + // case CIMDataType.CLASS: o = new CIMClass(value); break; //TODO + } + return o; + } + + private static CIMDateTime getDateTime(String pValue) throws CIMXMLParseException { + try { + return new CIMDateTimeAbsolute(pValue); + } catch (IllegalArgumentException eAbs) { + try { + return new CIMDateTimeInterval(pValue); + } catch (IllegalArgumentException eInt) { + throw new CIMXMLParseException("Failed to parse dateTime string: " + pValue + "!\n" + + "CIMDateTimeAbsolute parsing error:\n" + eAbs.getMessage() + "\n" + + "CIMDateTimeInterval parsing error:\n" + eInt.getMessage()); + } + } + } + + /** + * parseSIMPLEEXPRSP + * + * @param pSimpleExpRspE + * @return CIMResponse + * @throws CIMXMLParseException + */ + public static CIMResponse parseSIMPLEEXPRSP(Element pSimpleExpRspE) throws CIMXMLParseException { + // + + // EXPMETHODRESPONSE + Element[] expmethodresponseA = searchNodes(pSimpleExpRspE, "EXPMETHODRESPONSE", 1, 1, false); + if (expmethodresponseA != null) return parseEXPMETHODRESPONSE(expmethodresponseA[0]); + + throw new CIMXMLParseException( + "SIMPLEEXPRSP element missing EXPMETHODRESPONSE child element!"); + } + + /** + * parseMULTIEXPRSP + * + * @param pMultiExpRspE + * @return CIMResponse + * @throws CIMXMLParseException + */ + public static CIMResponse parseMULTIEXPRSP(Element pMultiExpRspE) throws CIMXMLParseException { + // + + Element[] multiExpRespElementA = searchNodes(pMultiExpRspE, "SIMPLEEXPRSP", 2, + Integer.MAX_VALUE, false); + if (multiExpRespElementA != null) { + CIMResponse multiExpRsp = new CIMResponse(); + for (int i = 0; i < multiExpRespElementA.length; i++) { + Element methodresponseE = multiExpRespElementA[i]; + CIMResponse rsp = parseSIMPLEEXPRSP(methodresponseE); + rsp.setMethod("SIMPLEEXPRSP"); + multiExpRsp.addResponse(rsp); + } + return multiExpRsp; + } + + throw new CIMXMLParseException("MULTIEXPRSP element missing SIMPLEEXPRSP child element!"); + } + + private static final String[] nodesEXPMETHODRESPONSE = { "ERROR", "IRETURNVALUE" }; + + /** + * parseEXPMETHODRESPONSE + * + * @param pExpMethodResponseE + * @return CIMResponse + * @throws CIMXMLParseException + */ + public static CIMResponse parseEXPMETHODRESPONSE(Element pExpMethodResponseE) + throws CIMXMLParseException { + // + + CIMResponse response = new CIMResponse(); + + if (attribute(pExpMethodResponseE, "NAME") == null) throw new CIMXMLParseException( + "EXPMETHODRESPONSE element missing NAME attribute!"); + + // ERROR + Element[] errorA = searchNodes(pExpMethodResponseE, "ERROR", 0, 1, false); + if (errorA != null) { + WBEMException exception = parseERROR(errorA[0]); + response.setError(exception); + return response; + } + + // RETURNVALUE + Element[] retValElementA = searchNodes(pExpMethodResponseE, "IRETURNVALUE", 0, 1, false); + if (retValElementA != null) { + Vector v = new Vector(); + Element returnvalueE = retValElementA[0]; + v.add(parseIRETURNVALUE(returnvalueE)); + response.setReturnValue(v); + return response; + } + + checkOtherNodes(pExpMethodResponseE, nodesEXPMETHODRESPONSE); + + return response; + } + + private static final String nodesCORRELATOR[] = { "VALUE" }; + + /** + * parseCORRELATOR + * + * @param pCorrelatorE + * @throws CIMXMLParseException + * */ + public static void parseCORRELATOR(Element pCorrelatorE) throws CIMXMLParseException { + // + // + String name = attribute(pCorrelatorE, "NAME"); + if (name == null) throw new CIMXMLParseException( + "CORRELATOR element missing NAME attribute!"); + String type = attribute(pCorrelatorE, "TYPE"); + if (type == null) throw new CIMXMLParseException( + "CORRELATOR element missing TYPE attribute!"); + + // VALUE + Element[] valueA = searchNodes(pCorrelatorE, "VALUE", 1, 1, false); + if (valueA != null) { + // TypedValue tVal = parseVALUE(valueA[0]); + } + + checkOtherNodes(pCorrelatorE, nodesCORRELATOR); + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/CimXmlSerializer.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/CimXmlSerializer.java similarity index 89% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/CimXmlSerializer.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/CimXmlSerializer.java index 9953896..3b34eb7 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/CimXmlSerializer.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/CimXmlSerializer.java @@ -1,393 +1,391 @@ -/* - (C) Copyright IBM Corp. 2007, 2012 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Alexander Wolf-Reber, IBM, a.wolf-reber@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1671502 2007-02-08 lupusalex Remove dependency from Xerces - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors - * 3510321 2012-03-23 blaschke-oss Handle CDATA in CimXmlSerializer - * 3513357 2012-04-01 blaschke-oss Handle multiple CDATAs in CimXmlSerializer - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.BufferedWriter; -import java.io.IOException; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.nio.charset.Charset; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.util.WBEMConstants; -import org.w3c.dom.Document; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; - -/** - * Class CimXmlSerializer implements a XML serializer for DOM documents that is - * specialized for CIM-XML. It might not be used as a general purpose serializer - * since it doesn't support any DOM or XML features not required by CIM-XML. - * - */ -public class CimXmlSerializer { - - /** - * Class XmlWriter implements a writer on an output stream that escapes XML - * values according to the CIM-XML requirements. - * - */ - private static class XmlWriter { - - private BufferedWriter iWriter; - - /** - * Ctor. - * - * @param pOut - * The output stream the serialized document is written to - * @param pCharsetName - * The encoding the use for the output stream - */ - public XmlWriter(OutputStream pOut, String pCharsetName) { - this.iWriter = new BufferedWriter(new OutputStreamWriter(pOut, Charset.forName( - pCharsetName).newEncoder())); - } - - /** - * Writes text to the stream - * - * @param pText - * The text - * @throws IOException - */ - public void write(String pText) throws IOException { - if (pText != null) this.iWriter.write(pText); - } - - /** - * Closes the stream - * - * @throws IOException - */ - public void close() throws IOException { - this.iWriter.close(); - } - - /** - * Flushes the buffer to the stream - * - * @throws IOException - */ - public void flush() throws IOException { - this.iWriter.flush(); - } - - /** - * Writes a XML value (either attribute or text node). The value is - * escaped as follows:
      - *
      - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
      charresult
      < space&#xnn;
      > ~unchanged (UTF-8)
      spaceunchanged or &#x20;
      - * (First leading, last trailing and every other space are escaped)
      <&lt;
      >&gt;
      &&amp;
      "&quot;
      '&apos;
      otherunchanged
      - * - * @param pText - * The text - * @throws IOException - */ - public void writeValue(final String pText) throws IOException { - if (pText == null) { return; } - boolean escapeSpace = true; - final int oneBeforeLast = pText.length() - 2; - for (int i = 0; i < pText.length(); ++i) { - - char currentChar = pText.charAt(i); - boolean isSpace = false; - - if (isHighSurrogate(currentChar)) { - if (i > oneBeforeLast || !isLowSurrogate(pText.charAt(i + 1))) { throw new IOException( - "Illegal Unicode character"); } - this.iWriter.write(pText, i++, 2); - } else if (currentChar < ' ') { - writeAsHex(currentChar); - } else if (currentChar > '~') { - this.iWriter.write(currentChar); - } else { - switch (currentChar) { - case ' ': - isSpace = true; - if (escapeSpace) { - writeAsHex(currentChar); - } else { - this.iWriter.write(currentChar); - } - break; - case '<': - this.iWriter.write("<"); - break; - case '>': - this.iWriter.write(">"); - break; - case '&': - this.iWriter.write("&"); - break; - case '"': - this.iWriter.write("""); - break; - case '\'': - this.iWriter.write("'"); - break; - default: - this.iWriter.write(currentChar); - } - } - escapeSpace = (isSpace && !escapeSpace) || (i == oneBeforeLast); - } - } - - private void writeAsHex(char pChar) throws IOException { - this.iWriter.write("&#x" + Integer.toHexString(pChar) + ";"); - } - - private boolean isHighSurrogate(char pChar) { - return pChar >= WBEMConstants.UTF16_MIN_HIGH_SURROGATE - && pChar <= WBEMConstants.UTF16_MAX_HIGH_SURROGATE; - } - - private boolean isLowSurrogate(char pChar) { - return pChar >= WBEMConstants.UTF16_MIN_LOW_SURROGATE - && pChar <= WBEMConstants.UTF16_MAX_LOW_SURROGATE; - } - - } - - private boolean iPretty; - - private int iIndent = 0; - - private boolean iLastClosed = false; - - private final String CDATA_START = ""; - - private CimXmlSerializer(boolean pPretty) { - this.iPretty = pPretty; - } - - /** - * Serializes a given DOM document as (CIM-)XML to a given output stream. - * The method writes first - * <?xml version="1.0" encoding="UTF-8"?> - * and then serializes the document node. If you want to suppress this - * header just call {@link #serialize(OutputStream, Node, boolean)} on the - * document node. - * - * @param pOS - * The output stream - * @param pDoc - * The document - * @param pPretty - * If true the XML is nicely wrapped and indented, - * otherwise it's all in one line - * @throws IOException - * Whenever something goes wrong - */ - public static void serialize(OutputStream pOS, Document pDoc, boolean pPretty) - throws IOException { - - try { - XmlWriter writer = new XmlWriter(pOS, WBEMConstants.UTF8); - writer.write("\n"); - new CimXmlSerializer(pPretty).serializeNode(writer, pDoc.getDocumentElement()); - writer.flush(); - } catch (IOException ioe) { - throw ioe; - } catch (Exception e) { - throw new IOException(e.getMessage()); - } - } - - /** - * Serializes a given DOM node as (CIM-)XML to a given output stream - * - * @param pOS - * The output stream - * @param pNode - * The node - * @param pPretty - * If true the XML is nicely wrapped and indented, - * otherwise it's all in one line - * @throws IOException - * Whenever something goes wrong - */ - public static void serialize(OutputStream pOS, Node pNode, boolean pPretty) throws IOException { - - try { - XmlWriter writer = new XmlWriter(pOS, WBEMConstants.UTF8); - new CimXmlSerializer(pPretty).serializeNode(writer, pNode); - writer.flush(); - } catch (IOException ioe) { - throw ioe; - } catch (Exception e) { - throw new IOException(e.getMessage()); - } - } - - private void serializeNode(XmlWriter pWriter, Node pNode) throws IOException { - switch (pNode.getNodeType()) { - case Node.ELEMENT_NODE: - pWriter.write(indent()); - pWriter.write("<"); - pWriter.write(pNode.getNodeName()); - NamedNodeMap attributes = pNode.getAttributes(); - if (attributes != null) { - for (int i = 0; i < attributes.getLength(); ++i) { - pWriter.write(" "); - serializeNode(pWriter, attributes.item(i)); - } - } - Node child = pNode.getFirstChild(); - if (child == null) { - pWriter.write("/>"); - this.iLastClosed = true; - break; - } - pWriter.write(">"); - ++this.iIndent; - this.iLastClosed = false; - while (child != null) { - serializeNode(pWriter, child); - child = child.getNextSibling(); - } - --this.iIndent; - if (this.iLastClosed) { - pWriter.write(indent()); - } - pWriter.write(""); - this.iLastClosed = true; - break; - case Node.ATTRIBUTE_NODE: - pWriter.write(pNode.getNodeName()); - pWriter.write("=\""); - pWriter.writeValue(pNode.getNodeValue()); - pWriter.write("\""); - break; - case Node.TEXT_NODE: - String value = pNode.getNodeValue(); - if (value != null) { - int idx = 0; - int len = value.length(); - - while (idx < len) { - int cdata = value.indexOf(this.CDATA_START, idx); - - // rest of string not CDATA, write all (escaped) - if (cdata == -1) { - pWriter.writeValue(value.substring(idx)); - break; - } - - // write characters before CDATA (escaped) - if (idx < cdata) { - pWriter.writeValue(value.substring(idx, cdata)); - idx = cdata; - } - - int end = value.indexOf(this.CDATA_END, idx); - - // invalid CDATA - if (end == -1) { throw new IOException("CDATA section not closed: " + value); } - - // write CDATA (not escaped) - pWriter.write(value.substring(idx, end + this.CDATA_END.length())); - idx = end + this.CDATA_END.length(); - } - } - } - } - - private String indent() { - if (!this.iPretty) { return ""; } - StringBuffer result = new StringBuffer(); - result.append('\n'); - for (int i = 0; i < this.iIndent; ++i) { - result.append(' '); - } - return result.toString(); - } -} +/* + (C) Copyright IBM Corp. 2007, 2012 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Alexander Wolf-Reber, IBM, a.wolf-reber@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1671502 2007-02-08 lupusalex Remove dependency from Xerces + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors + * 3510321 2012-03-23 blaschke-oss Handle CDATA in CimXmlSerializer + * 3513357 2012-04-01 blaschke-oss Handle multiple CDATAs in CimXmlSerializer + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.BufferedWriter; +import java.io.IOException; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.nio.charset.Charset; + +import org.metricshub.wbem.sblim.cimclient.internal.util.WBEMConstants; +import org.w3c.dom.Document; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Node; + +/** + * Class CimXmlSerializer implements a XML serializer for DOM documents that is + * specialized for CIM-XML. It might not be used as a general purpose serializer + * since it doesn't support any DOM or XML features not required by CIM-XML. + * + */ +public class CimXmlSerializer { + + /** + * Class XmlWriter implements a writer on an output stream that escapes XML + * values according to the CIM-XML requirements. + * + */ + private static class XmlWriter { + + private BufferedWriter iWriter; + + /** + * Ctor. + * + * @param pOut + * The output stream the serialized document is written to + * @param pCharsetName + * The encoding the use for the output stream + */ + public XmlWriter(OutputStream pOut, String pCharsetName) { + this.iWriter = new BufferedWriter(new OutputStreamWriter(pOut, Charset.forName( + pCharsetName).newEncoder())); + } + + /** + * Writes text to the stream + * + * @param pText + * The text + * @throws IOException + */ + public void write(String pText) throws IOException { + if (pText != null) this.iWriter.write(pText); + } + + /** + * Closes the stream + * + * @throws IOException + */ + public void close() throws IOException { + this.iWriter.close(); + } + + /** + * Flushes the buffer to the stream + * + * @throws IOException + */ + public void flush() throws IOException { + this.iWriter.flush(); + } + + /** + * Writes a XML value (either attribute or text node). The value is + * escaped as follows:
      + *
      + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
      charresult
      < space&#xnn;
      > ~unchanged (UTF-8)
      spaceunchanged or &#x20;
      + * (First leading, last trailing and every other space are escaped)
      <&lt;
      >&gt;
      &&amp;
      "&quot;
      '&apos;
      otherunchanged
      + * + * @param pText + * The text + * @throws IOException + */ + public void writeValue(final String pText) throws IOException { + if (pText == null) { return; } + boolean escapeSpace = true; + final int oneBeforeLast = pText.length() - 2; + for (int i = 0; i < pText.length(); ++i) { + + char currentChar = pText.charAt(i); + boolean isSpace = false; + + if (isHighSurrogate(currentChar)) { + if (i > oneBeforeLast || !isLowSurrogate(pText.charAt(i + 1))) { throw new IOException( + "Illegal Unicode character"); } + this.iWriter.write(pText, i++, 2); + } else if (currentChar < ' ') { + writeAsHex(currentChar); + } else if (currentChar > '~') { + this.iWriter.write(currentChar); + } else { + switch (currentChar) { + case ' ': + isSpace = true; + if (escapeSpace) { + writeAsHex(currentChar); + } else { + this.iWriter.write(currentChar); + } + break; + case '<': + this.iWriter.write("<"); + break; + case '>': + this.iWriter.write(">"); + break; + case '&': + this.iWriter.write("&"); + break; + case '"': + this.iWriter.write("""); + break; + case '\'': + this.iWriter.write("'"); + break; + default: + this.iWriter.write(currentChar); + } + } + escapeSpace = (isSpace && !escapeSpace) || (i == oneBeforeLast); + } + } + + private void writeAsHex(char pChar) throws IOException { + this.iWriter.write("&#x" + Integer.toHexString(pChar) + ";"); + } + + private boolean isHighSurrogate(char pChar) { + return pChar >= WBEMConstants.UTF16_MIN_HIGH_SURROGATE + && pChar <= WBEMConstants.UTF16_MAX_HIGH_SURROGATE; + } + + private boolean isLowSurrogate(char pChar) { + return pChar >= WBEMConstants.UTF16_MIN_LOW_SURROGATE + && pChar <= WBEMConstants.UTF16_MAX_LOW_SURROGATE; + } + + } + + private boolean iPretty; + + private int iIndent = 0; + + private boolean iLastClosed = false; + + private final String CDATA_START = ""; + + private CimXmlSerializer(boolean pPretty) { + this.iPretty = pPretty; + } + + /** + * Serializes a given DOM document as (CIM-)XML to a given output stream. + * The method writes first + * <?xml version="1.0" encoding="UTF-8"?> + * and then serializes the document node. If you want to suppress this + * header just call {@link #serialize(OutputStream, Node, boolean)} on the + * document node. + * + * @param pOS + * The output stream + * @param pDoc + * The document + * @param pPretty + * If true the XML is nicely wrapped and indented, + * otherwise it's all in one line + * @throws IOException + * Whenever something goes wrong + */ + public static void serialize(OutputStream pOS, Document pDoc, boolean pPretty) + throws IOException { + + try { + XmlWriter writer = new XmlWriter(pOS, WBEMConstants.UTF8); + writer.write("\n"); + new CimXmlSerializer(pPretty).serializeNode(writer, pDoc.getDocumentElement()); + writer.flush(); + } catch (IOException ioe) { + throw ioe; + } catch (Exception e) { + throw new IOException(e.getMessage()); + } + } + + /** + * Serializes a given DOM node as (CIM-)XML to a given output stream + * + * @param pOS + * The output stream + * @param pNode + * The node + * @param pPretty + * If true the XML is nicely wrapped and indented, + * otherwise it's all in one line + * @throws IOException + * Whenever something goes wrong + */ + public static void serialize(OutputStream pOS, Node pNode, boolean pPretty) throws IOException { + + try { + XmlWriter writer = new XmlWriter(pOS, WBEMConstants.UTF8); + new CimXmlSerializer(pPretty).serializeNode(writer, pNode); + writer.flush(); + } catch (IOException ioe) { + throw ioe; + } catch (Exception e) { + throw new IOException(e.getMessage()); + } + } + + private void serializeNode(XmlWriter pWriter, Node pNode) throws IOException { + switch (pNode.getNodeType()) { + case Node.ELEMENT_NODE: + pWriter.write(indent()); + pWriter.write("<"); + pWriter.write(pNode.getNodeName()); + NamedNodeMap attributes = pNode.getAttributes(); + if (attributes != null) { + for (int i = 0; i < attributes.getLength(); ++i) { + pWriter.write(" "); + serializeNode(pWriter, attributes.item(i)); + } + } + Node child = pNode.getFirstChild(); + if (child == null) { + pWriter.write("/>"); + this.iLastClosed = true; + break; + } + pWriter.write(">"); + ++this.iIndent; + this.iLastClosed = false; + while (child != null) { + serializeNode(pWriter, child); + child = child.getNextSibling(); + } + --this.iIndent; + if (this.iLastClosed) { + pWriter.write(indent()); + } + pWriter.write(""); + this.iLastClosed = true; + break; + case Node.ATTRIBUTE_NODE: + pWriter.write(pNode.getNodeName()); + pWriter.write("=\""); + pWriter.writeValue(pNode.getNodeValue()); + pWriter.write("\""); + break; + case Node.TEXT_NODE: + String value = pNode.getNodeValue(); + if (value != null) { + int idx = 0; + int len = value.length(); + + while (idx < len) { + int cdata = value.indexOf(this.CDATA_START, idx); + + // rest of string not CDATA, write all (escaped) + if (cdata == -1) { + pWriter.writeValue(value.substring(idx)); + break; + } + + // write characters before CDATA (escaped) + if (idx < cdata) { + pWriter.writeValue(value.substring(idx, cdata)); + idx = cdata; + } + + int end = value.indexOf(this.CDATA_END, idx); + + // invalid CDATA + if (end == -1) { throw new IOException("CDATA section not closed: " + value); } + + // write CDATA (not escaped) + pWriter.write(value.substring(idx, end + this.CDATA_END.length())); + idx = end + this.CDATA_END.length(); + } + } + } + } + + private String indent() { + if (!this.iPretty) { return ""; } + StringBuffer result = new StringBuffer(); + result.append('\n'); + for (int i = 0; i < this.iIndent; ++i) { + result.append(' '); + } + return result.toString(); + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/LocalPathBuilder.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/LocalPathBuilder.java similarity index 82% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/LocalPathBuilder.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/LocalPathBuilder.java index 47f2a01..9b16f2a 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/LocalPathBuilder.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/LocalPathBuilder.java @@ -1,214 +1,212 @@ -/* - (C) Copyright IBM Corp. 2006, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; -import org.sentrysoftware.wbem.javax.cim.CIMProperty; - -/** - * Class LocalPathBuilder helps CIM-XML parsers to build local CIMObjectPathes. - */ -public class LocalPathBuilder { - - private CIMObjectPath iBasePath; - - /** - * Ctor. - * - * @param pBasePath - */ - public LocalPathBuilder(CIMObjectPath pBasePath) { - this.iBasePath = pBasePath; - } - - /** - * getBasePath - * - * @return CIMObjectPath - */ - public CIMObjectPath getBasePath() { - return this.iBasePath; - } - - /** - * build - * - * @param pObjPathStr - * @return CIMObjectPath - */ - public CIMObjectPath build(String pObjPathStr) { - return build(this.iBasePath, pObjPathStr); - } - - /** - * build - * - * @param pObjName - * @param pNameSpace - * @return CIMObjectPath - */ - public CIMObjectPath build(String pObjName, String pNameSpace) { - return build(this.iBasePath, pObjName, pNameSpace); - } - - /** - * build - * - * @param pObjName - * @param pNameSpace - * @param pKeys - * @return CIMObjectPath - */ - public CIMObjectPath build(String pObjName, String pNameSpace, CIMProperty[] pKeys) { - return build(this.iBasePath, pObjName, pNameSpace, pKeys); - } - - /** - * build - * - * @param pHost - * @param pNameSpace - * @param pObjName - * @param pKeys - * @return CIMObjectPath - */ - public CIMObjectPath build(String pHost, String pNameSpace, String pObjName, - CIMProperty[] pKeys) { - return build(this.iBasePath, pHost, pNameSpace, pObjName, pKeys); - } - - /** - * build - * - * @param pScheme - * @param pHost - * @param pPort - * @param pNameSpace - * @param pObjName - * @param pKeys - * @return CIMObjectPath - */ - public CIMObjectPath build(String pScheme, String pHost, String pPort, String pNameSpace, - String pObjName, CIMProperty[] pKeys) { - return build(this.iBasePath, pScheme, pHost, pPort, pNameSpace, pObjName, pKeys); - } - - /** - * build - * - * @param pBasePath - * @param pObjPathStr - * @return CIMObjectPath - */ - public static CIMObjectPath build(CIMObjectPath pBasePath, String pObjPathStr) { - CIMObjectPath path = new CIMObjectPath(pObjPathStr); - return build(pBasePath, path.getScheme(), path.getHost(), path.getPort(), path - .getNamespace(), path.getObjectName(), path.getKeys()); - } - - /** - * build - * - * @param pBasePath - * @param pObjName - * @param pNameSpace - * @return CIMObjectPath - */ - public static CIMObjectPath build(CIMObjectPath pBasePath, String pObjName, String pNameSpace) { - return build(pBasePath, null, null, null, pNameSpace, pObjName, null); - } - - /** - * build - * - * @param pBasePath - * @param pObjName - * @param pNameSpace - * @param pKeys - * @return CIMObjectPath - */ - public static CIMObjectPath build(CIMObjectPath pBasePath, String pObjName, String pNameSpace, - CIMProperty[] pKeys) { - return build(pBasePath, null, null, null, pNameSpace, pObjName, pKeys); - } - - /** - * build - * - * @param pBasePath - * @param pHost - * @param pNameSpace - * @param pObjName - * @param pKeys - * @return CIMObjectPath - */ - public static CIMObjectPath build(CIMObjectPath pBasePath, String pHost, String pNameSpace, - String pObjName, CIMProperty[] pKeys) { - return build(pBasePath, null, pHost, null, pNameSpace, pObjName, pKeys); - } - - /** - * build - * - * @param pBasePath - * @param pScheme - * @param pHost - * @param pPort - * @param pNameSpace - * @param pObjName - * @param pKeys - * @return CIMObjectPath - */ - public static CIMObjectPath build(CIMObjectPath pBasePath, String pScheme, String pHost, - String pPort, String pNameSpace, String pObjName, CIMProperty[] pKeys) { - if (pBasePath == null) return new CIMObjectPath(pScheme, pHost, pPort, pNameSpace, - pObjName, pKeys); - return new CIMObjectPath(pScheme == null ? pBasePath.getScheme() : pScheme, - pHost == null ? pBasePath.getHost() : pHost, pPort == null ? pBasePath.getPort() - : pPort, pNameSpace == null ? pBasePath.getNamespace() : pNameSpace, - pObjName == null ? pBasePath.getObjectName() : pObjName, pKeys // local - // objectpath shouldn't contain keys - ); - } - -} +/* + (C) Copyright IBM Corp. 2006, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMObjectPath; +import org.metricshub.wbem.javax.cim.CIMProperty; + +/** + * Class LocalPathBuilder helps CIM-XML parsers to build local CIMObjectPathes. + */ +public class LocalPathBuilder { + + private CIMObjectPath iBasePath; + + /** + * Ctor. + * + * @param pBasePath + */ + public LocalPathBuilder(CIMObjectPath pBasePath) { + this.iBasePath = pBasePath; + } + + /** + * getBasePath + * + * @return CIMObjectPath + */ + public CIMObjectPath getBasePath() { + return this.iBasePath; + } + + /** + * build + * + * @param pObjPathStr + * @return CIMObjectPath + */ + public CIMObjectPath build(String pObjPathStr) { + return build(this.iBasePath, pObjPathStr); + } + + /** + * build + * + * @param pObjName + * @param pNameSpace + * @return CIMObjectPath + */ + public CIMObjectPath build(String pObjName, String pNameSpace) { + return build(this.iBasePath, pObjName, pNameSpace); + } + + /** + * build + * + * @param pObjName + * @param pNameSpace + * @param pKeys + * @return CIMObjectPath + */ + public CIMObjectPath build(String pObjName, String pNameSpace, CIMProperty[] pKeys) { + return build(this.iBasePath, pObjName, pNameSpace, pKeys); + } + + /** + * build + * + * @param pHost + * @param pNameSpace + * @param pObjName + * @param pKeys + * @return CIMObjectPath + */ + public CIMObjectPath build(String pHost, String pNameSpace, String pObjName, + CIMProperty[] pKeys) { + return build(this.iBasePath, pHost, pNameSpace, pObjName, pKeys); + } + + /** + * build + * + * @param pScheme + * @param pHost + * @param pPort + * @param pNameSpace + * @param pObjName + * @param pKeys + * @return CIMObjectPath + */ + public CIMObjectPath build(String pScheme, String pHost, String pPort, String pNameSpace, + String pObjName, CIMProperty[] pKeys) { + return build(this.iBasePath, pScheme, pHost, pPort, pNameSpace, pObjName, pKeys); + } + + /** + * build + * + * @param pBasePath + * @param pObjPathStr + * @return CIMObjectPath + */ + public static CIMObjectPath build(CIMObjectPath pBasePath, String pObjPathStr) { + CIMObjectPath path = new CIMObjectPath(pObjPathStr); + return build(pBasePath, path.getScheme(), path.getHost(), path.getPort(), path + .getNamespace(), path.getObjectName(), path.getKeys()); + } + + /** + * build + * + * @param pBasePath + * @param pObjName + * @param pNameSpace + * @return CIMObjectPath + */ + public static CIMObjectPath build(CIMObjectPath pBasePath, String pObjName, String pNameSpace) { + return build(pBasePath, null, null, null, pNameSpace, pObjName, null); + } + + /** + * build + * + * @param pBasePath + * @param pObjName + * @param pNameSpace + * @param pKeys + * @return CIMObjectPath + */ + public static CIMObjectPath build(CIMObjectPath pBasePath, String pObjName, String pNameSpace, + CIMProperty[] pKeys) { + return build(pBasePath, null, null, null, pNameSpace, pObjName, pKeys); + } + + /** + * build + * + * @param pBasePath + * @param pHost + * @param pNameSpace + * @param pObjName + * @param pKeys + * @return CIMObjectPath + */ + public static CIMObjectPath build(CIMObjectPath pBasePath, String pHost, String pNameSpace, + String pObjName, CIMProperty[] pKeys) { + return build(pBasePath, null, pHost, null, pNameSpace, pObjName, pKeys); + } + + /** + * build + * + * @param pBasePath + * @param pScheme + * @param pHost + * @param pPort + * @param pNameSpace + * @param pObjName + * @param pKeys + * @return CIMObjectPath + */ + public static CIMObjectPath build(CIMObjectPath pBasePath, String pScheme, String pHost, + String pPort, String pNameSpace, String pObjName, CIMProperty[] pKeys) { + if (pBasePath == null) return new CIMObjectPath(pScheme, pHost, pPort, pNameSpace, + pObjName, pKeys); + return new CIMObjectPath(pScheme == null ? pBasePath.getScheme() : pScheme, + pHost == null ? pBasePath.getHost() : pHost, pPort == null ? pBasePath.getPort() + : pPort, pNameSpace == null ? pBasePath.getNamespace() : pNameSpace, + pObjName == null ? pBasePath.getObjectName() : pObjName, pKeys // local + // objectpath shouldn't contain keys + ); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/TypedValue.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/TypedValue.java similarity index 63% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/TypedValue.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/TypedValue.java index a14c883..6a98cef 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/TypedValue.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/TypedValue.java @@ -1,85 +1,83 @@ -/* - (C) Copyright IBM Corp. 2006, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMDataType; - -/** - * Class TypedValue is required for the CIM-XML DOM parser. - * - */ -public class TypedValue { - - private CIMDataType iType; - - private Object iValue; - - /** - * Ctor. - * - * @param pType - * @param pValue - */ - public TypedValue(CIMDataType pType, Object pValue) { - this.iType = pType; - this.iValue = pValue; - } - - /** - * getType - * - * @return CIMDataType - */ - public CIMDataType getType() { - return this.iType; - } - - /** - * getValue - * - * @return Object - */ - public Object getValue() { - return this.iValue; - } - -} +/* + (C) Copyright IBM Corp. 2006, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMDataType; + +/** + * Class TypedValue is required for the CIM-XML DOM parser. + * + */ +public class TypedValue { + + private CIMDataType iType; + + private Object iValue; + + /** + * Ctor. + * + * @param pType + * @param pValue + */ + public TypedValue(CIMDataType pType, Object pValue) { + this.iType = pType; + this.iValue = pValue; + } + + /** + * getType + * + * @return CIMDataType + */ + public CIMDataType getType() { + return this.iType; + } + + /** + * getValue + * + * @return Object + */ + public Object getValue() { + return this.iValue; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/package.html b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/package.html similarity index 100% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/package.html rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/package.html diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/CIMObjectFactory.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/CIMObjectFactory.java similarity index 86% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/CIMObjectFactory.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/CIMObjectFactory.java index c83df7a..e3bc52a 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/CIMObjectFactory.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/CIMObjectFactory.java @@ -1,592 +1,590 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1660756 2007-02-22 ebak Embedded object support - * 1689085 2007-04-10 ebak Embedded object enhancements for Pegasus - * 1735693 2007-06-12 ebak Empty VALUE.ARRAY elements are parsed as nulls - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors - * 2823494 2009-08-03 rgummada Change Boolean constructor to static - * 3023340 2010-07-02 blaschke-oss CIMObjectFactory uses # constructor instead of valueOf - * 3027615 2010-07-12 blaschke-oss Use CLASS_ARRAY_T instead of new CIMDataType(CLASS,0) - * 3513349 2012-03-31 blaschke-oss TCK: CIMDataType must not accept null string - * 3572993 2012-10-01 blaschke-oss parseDouble("2.2250738585072012e-308") DoS vulnerability - * 2693 2013-10-21 blaschke-oss ReturnValueNode allows invalid PARAMTYPE attribute - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.ByteArrayInputStream; -import java.util.ArrayList; -import java.util.HashMap; - -import org.sentrysoftware.wbem.javax.cim.CIMClass; -import org.sentrysoftware.wbem.javax.cim.CIMDataType; -import org.sentrysoftware.wbem.javax.cim.CIMDateTime; -import org.sentrysoftware.wbem.javax.cim.CIMDateTimeAbsolute; -import org.sentrysoftware.wbem.javax.cim.CIMDateTimeInterval; -import org.sentrysoftware.wbem.javax.cim.CIMInstance; -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; -import org.sentrysoftware.wbem.javax.cim.UnsignedInteger16; -import org.sentrysoftware.wbem.javax.cim.UnsignedInteger32; -import org.sentrysoftware.wbem.javax.cim.UnsignedInteger64; -import org.sentrysoftware.wbem.javax.cim.UnsignedInteger8; -import javax.xml.parsers.SAXParser; -import javax.xml.parsers.SAXParserFactory; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node.ClassNode; -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node.InstanceNode; -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node.Node; -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node.ValueArrayNode; -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node.ValueNode; -import org.sentrysoftware.wbem.sblim.cimclient.internal.util.MOF; -import org.sentrysoftware.wbem.sblim.cimclient.internal.util.Util; -import org.sentrysoftware.wbem.sblim.cimclient.internal.util.WBEMConfiguration; -import org.xml.sax.SAXException; - -/** - * Class CIMObjectFactory is responsible for type String and value String - * parsing. - */ -public class CIMObjectFactory { - - /** - * getEmbbeddedObjectA - * - * @param pType - * @param pValueArrayNode - * @param pSession - * @return CIMInstance[], CIMClass[], String[] or null - * @throws SAXException - */ - public static Object[] getEmbeddedObjA(CIMDataType pType, ValueArrayNode pValueArrayNode, - SAXSession pSession) throws SAXException { - if (pValueArrayNode == null) return null; - return getEmbeddedObjA(pType, (String[]) pValueArrayNode.getValue(), pSession); - } - - /** - * getEmbeddedObjectA - * - * @param pType - * @param pValueStrA - * @param pSession - * @return CIMInstance[], CIMClass[], String[] or null - * @throws SAXException - */ - public static Object[] getEmbeddedObjA(CIMDataType pType, String[] pValueStrA, - SAXSession pSession) throws SAXException { - embeddedObjTypeCheck(pType); - if (pValueStrA == null || pValueStrA.length == 0) return null; - CIMDataType type = null; - ArrayList objAL = new ArrayList(pValueStrA.length); - for (int i = 0; i < pValueStrA.length; i++) { - Object obj = parseEmbeddedObj(pValueStrA[i], pSession); - if (type == null) { - type = getCIMObjScalarType(obj, false); - } else { - CIMDataType type2 = getCIMObjScalarType(obj, false); - if (type2 != null && type != type2) throw new SAXException( - "Embedded Object array contains both Instance and Class objects. " - + "This is not handled!"); - } - objAL.add(obj); - } - if (type == CIMDataType.OBJECT_T) { - return objAL.toArray(EMPTY_INST_A); - } else if (type == CIMDataType.CLASS_T) { return objAL.toArray(EMPTY_CLASS_A); } - return objAL.toArray(EMPTY_STR_A); - } - - /** - * getEmbeddedObject - * - * @param pType - * @param pValueStr - * @param pSession - * @return CIMInstance, CIMClass or null - * @throws SAXException - */ - public static Object getEmbeddedObj(CIMDataType pType, String pValueStr, SAXSession pSession) - throws SAXException { - embeddedObjTypeCheck(pType); - return parseEmbeddedObj(pValueStr, pSession); - } - - /** - * getEmbeddedObj - * - * @param pType - * @param pValObj - * @param pSession - * @return Object CIMClass, CIMInstance, String, CIMClass[], CIMInstance[], - * String[] or null - * @throws SAXException - */ - public static Object getEmbeddedObj(CIMDataType pType, Object pValObj, SAXSession pSession) - throws SAXException { - if (pValObj instanceof String) { return getEmbeddedObj(pType, (String) pValObj, pSession); } - return getEmbeddedObjA(pType, (String[]) pValObj, pSession); - } - - /** - * @param pType - * @param pAL - * @return Object[] - */ - public static Object[] getObjectArray(CIMDataType pType, ArrayList pAL) { - createValFactoryA(); - // if (pType==null) pType=CIMDataType.STRING_T; - ValueFactory factory = cValFactoryA[pType.getType()]; - return factory.make(pAL); - } - - /** - * getObject - * - * @param pType - * @param pValueStr - * @return Object - * @throws SAXException - */ - public static Object getObject(CIMDataType pType, String pValueStr) throws SAXException { - if (pValueStr == null) return null; - createValFactoryA(); - ValueFactory factory = cValFactoryA[pType.getType()]; - try { - return factory.make(pValueStr); - } catch (NumberFormatException e) { - throw new SAXException(e); - } - } - - /** - * getObject - * - * @param pType - * @param pValueNode - * @return Object - * @throws SAXException - */ - public static Object getObject(CIMDataType pType, ValueNode pValueNode) throws SAXException { - if (pValueNode == null) return null; - return getObject(pType, (String) pValueNode.getValue()); - } - - /** - * getObject - * - * @param pType - * @param pValueArrayNode - * @return Object - * @throws SAXException - */ - public static Object getObject(CIMDataType pType, ValueArrayNode pValueArrayNode) - throws SAXException { - if (pValueArrayNode == null) return null; - ArrayList objAL = new ArrayList(pValueArrayNode.size()); - for (int i = 0; i < pValueArrayNode.size(); i++) - objAL.add(getObject(pType, (String) pValueArrayNode.elementAt(i))); - return getObjectArray(pType, objAL); - } - - /** - * getCIMObjType - * - * @param pObj - * @param pNullToString - * @return CIMDataType OBJECT_T, CLASS_T, STRING_T - * @throws SAXException - */ - public static CIMDataType getCIMObjScalarType(Object pObj, boolean pNullToString) - throws SAXException { - if (pObj == null) return pNullToString ? CIMDataType.STRING_T : null; - if (pObj instanceof CIMInstance) { - return CIMDataType.OBJECT_T; - } else if (pObj instanceof CIMClass) { - return CIMDataType.CLASS_T; - } else if (pObj instanceof String) { return CIMDataType.STRING_T; } - throw new SAXException(pObj.getClass().getName() + " is not a CIMObject!"); - } - - /** - * getCIMObjType - * - * @param pObj - * @return CIMDataType OBJECT_T, OBJECT_ARRAY_T - * @throws SAXException - */ - public static CIMDataType getCIMObjScalarType(Object pObj) throws SAXException { - return getCIMObjScalarType(pObj, true); - } - - /** - * getCIMObjArrayType - * - * @param pObj - * @return CIMDataType: OBJECT_ARRAY_T, CLASS_T array, STRING_ARRAY_T - * @throws SAXException - */ - public static CIMDataType getCIMObjArrayType(Object pObj) throws SAXException { - return getCIMObjArrayType(pObj, true); - } - - /** - * getArrayCIMObjType - * - * @param pObj - * @param pNullToString - * @return CIMDataType: OBJECT_ARRAY_T, CLASS_T array, STRING_ARRAY_T or - * null - * @throws SAXException - */ - public static CIMDataType getCIMObjArrayType(Object pObj, boolean pNullToString) - throws SAXException { - if (pObj == null) return pNullToString ? CIMDataType.STRING_ARRAY_T : null; - if (pObj instanceof CIMInstance[]) { - return CIMDataType.OBJECT_ARRAY_T; - } else if (pObj instanceof CIMClass[]) { - return CIMDataType.CLASS_ARRAY_T; - } else if (pObj instanceof String[]) { return CIMDataType.STRING_ARRAY_T; } - throw new SAXException(pObj.getClass().getName() + " is not a CIMObject array!"); - } - - /** - * getType - * - * @param pTypeStr - * @return CIMDataType - * @throws SAXException - */ - public static CIMDataType getType(String pTypeStr) throws SAXException { - if (pTypeStr == null) return null; - createTypeStrMap(); - CIMDataType type = cTypeStrMap.get(pTypeStr); - if (type == null && !cTypeStrMap.containsKey(pTypeStr)) throw new SAXException(pTypeStr - + " is invalid PARAMTYPE!"); - return type; - } - - static final CIMInstance[] EMPTY_INST_A = new CIMInstance[0]; - - static final CIMClass[] EMPTY_CLASS_A = new CIMClass[0]; - - static final String[] EMPTY_STR_A = new String[0]; - - static final UnsignedInteger8[] EMPTY_UINT8_A = new UnsignedInteger8[0]; - - static final UnsignedInteger16[] EMPTY_UINT16_A = new UnsignedInteger16[0]; - - static final UnsignedInteger32[] EMPTY_UINT32_A = new UnsignedInteger32[0]; - - static final UnsignedInteger64[] EMPTY_UINT64_A = new UnsignedInteger64[0]; - - static final Byte[] EMPTY_BYTE_A = new Byte[0]; - - static final Short[] EMPTY_SHORT_A = new Short[0]; - - static final Integer[] EMPTY_INT_A = new Integer[0]; - - static final Long[] EMPTY_LONG_A = new Long[0]; - - static final Float[] EMPTY_FLOAT_A = new Float[0]; - - static final Double[] EMPTY_DOUBLE_A = new Double[0]; - - static final Character[] EMPTY_CHAR_A = new Character[0]; - - static final Boolean[] EMPTY_BOOL_A = new Boolean[0]; - - static final CIMDateTime[] EMPTY_DT_A = new CIMDateTime[0]; - - static final CIMObjectPath[] EMPTY_OP_A = new CIMObjectPath[0]; - - private static void embeddedObjTypeCheck(CIMDataType pType) throws SAXException { - if (pType.getType() != CIMDataType.STRING) throw new SAXException( - "TYPE attribute should be 'string' for EmbeddedObjects!"); - } - - private static Object parseEmbeddedObj(String pValueStr, SAXSession pSession) - throws SAXException { - if (pValueStr == null || pValueStr.length() == 0) return null; - XMLDefaultHandlerImpl ourHandler = new XMLDefaultHandlerImpl(pSession, true); - // XML String of embedded Object is parsed by the SAX parser - SAXParserFactory factory = SAXParserFactory.newInstance(); - try { - SAXParser saxParser = factory.newSAXParser(); - saxParser.parse(new ByteArrayInputStream(pValueStr.getBytes()), ourHandler); - } catch (SAXException se) { - throw se; - } catch (Exception e) { - throw new SAXException("Exception occurred during embedded object parsing!", e); - } - Node node = ourHandler.getRootNode(); - if (node instanceof InstanceNode) { return ((InstanceNode) node).getCIMInstance(); } - if (node instanceof ClassNode) { return ((ClassNode) node).getCIMClass(); } - throw new SAXException(node.getNodeName() - + " root element is unexpected for Embedded Object XML String!"); - } - - private static HashMap cTypeStrMap; - - private synchronized static void createTypeStrMap() { - if (cTypeStrMap != null) return; - cTypeStrMap = new HashMap(); - cTypeStrMap.put(MOF.DT_UINT8, CIMDataType.UINT8_T); - cTypeStrMap.put(MOF.DT_UINT16, CIMDataType.UINT16_T); - cTypeStrMap.put(MOF.DT_UINT32, CIMDataType.UINT32_T); - cTypeStrMap.put(MOF.DT_UINT64, CIMDataType.UINT64_T); - cTypeStrMap.put(MOF.DT_SINT8, CIMDataType.SINT8_T); - cTypeStrMap.put(MOF.DT_SINT16, CIMDataType.SINT16_T); - cTypeStrMap.put(MOF.DT_SINT32, CIMDataType.SINT32_T); - cTypeStrMap.put(MOF.DT_SINT64, CIMDataType.SINT64_T); - cTypeStrMap.put(MOF.DT_REAL32, CIMDataType.REAL32_T); - cTypeStrMap.put(MOF.DT_REAL64, CIMDataType.REAL64_T); - cTypeStrMap.put(MOF.DT_CHAR16, CIMDataType.CHAR16_T); - cTypeStrMap.put(MOF.DT_STR, CIMDataType.STRING_T); - cTypeStrMap.put(MOF.DT_BOOL, CIMDataType.BOOLEAN_T); - cTypeStrMap.put(MOF.DT_DATETIME, CIMDataType.DATETIME_T); - cTypeStrMap.put(MOF.REFERENCE, new CIMDataType("")); - } - - private interface ValueFactory { - - /** - * make - * - * @param pStr - * @return Object - */ - Object make(String pStr); - - /** - * make - * - * @param pAL - * @return Object[] - */ - Object[] make(ArrayList pAL); - } - - private static ValueFactory[] cValFactoryA; - - private static void putFactory(int pTypeCode, ValueFactory pFactory) { - cValFactoryA[pTypeCode] = pFactory; - } - - private synchronized static void createValFactoryA() { - if (cValFactoryA != null) return; - cValFactoryA = new ValueFactory[64]; - // unsigned integers - putFactory(CIMDataType.UINT8, new ValueFactory() { - - public Object make(String pStr) { - return new UnsignedInteger8(pStr); - } - - public Object[] make(ArrayList pAL) { - return pAL.toArray(EMPTY_UINT8_A); - } - }); - putFactory(CIMDataType.UINT16, new ValueFactory() { - - public Object make(String pStr) { - return new UnsignedInteger16(pStr); - } - - public Object[] make(ArrayList pAL) { - return pAL.toArray(EMPTY_UINT16_A); - } - }); - putFactory(CIMDataType.UINT32, new ValueFactory() { - - public Object make(String pStr) { - return new UnsignedInteger32(pStr); - } - - public Object[] make(ArrayList pAL) { - return pAL.toArray(EMPTY_UINT32_A); - } - }); - putFactory(CIMDataType.UINT64, new ValueFactory() { - - public Object make(String pStr) { - return new UnsignedInteger64(pStr); - } - - public Object[] make(ArrayList pAL) { - return pAL.toArray(EMPTY_UINT64_A); - } - }); - // signed integers - putFactory(CIMDataType.SINT8, new ValueFactory() { - - public Object make(String pStr) { - return new Byte(pStr); - } - - public Object[] make(ArrayList pAL) { - return pAL.toArray(EMPTY_BYTE_A); - } - }); - putFactory(CIMDataType.SINT16, new ValueFactory() { - - public Object make(String pStr) { - return new Short(pStr); - } - - public Object[] make(ArrayList pAL) { - return pAL.toArray(EMPTY_SHORT_A); - } - }); - putFactory(CIMDataType.SINT32, new ValueFactory() { - - public Object make(String pStr) { - return new Integer(pStr); - } - - public Object[] make(ArrayList pAL) { - return pAL.toArray(EMPTY_INT_A); - } - }); - putFactory(CIMDataType.SINT64, new ValueFactory() { - - public Object make(String pStr) { - return new Long(pStr); - } - - public Object[] make(ArrayList pAL) { - return pAL.toArray(EMPTY_LONG_A); - } - }); - // floats - putFactory(CIMDataType.REAL32, new ValueFactory() { - - public Object make(String pStr) { - return new Float(pStr); - } - - public Object[] make(ArrayList pAL) { - return pAL.toArray(EMPTY_FLOAT_A); - } - }); - putFactory(CIMDataType.REAL64, new ValueFactory() { - - public Object make(String pStr) { - if (WBEMConfiguration.getGlobalConfiguration().verifyJavaLangDoubleStrings()) { - if (Util.isBadDoubleString(pStr)) throw new IllegalArgumentException( - "Double value string hangs older JVMs!\n" + pStr); - } - return new Double(pStr); - } - - public Object[] make(ArrayList pAL) { - return pAL.toArray(EMPTY_DOUBLE_A); - } - }); - // char - putFactory(CIMDataType.CHAR16, new ValueFactory() { - - public Object make(String pStr) { - if (pStr == null || pStr.length() == 0) throw new IllegalArgumentException( - "Cannot make Character from empty String!"); - return Character.valueOf(pStr.charAt(0)); - } - - public Object[] make(ArrayList pAL) { - return pAL.toArray(EMPTY_CHAR_A); - } - }); - // string - putFactory(CIMDataType.STRING, new ValueFactory() { - - public Object make(String pStr) { - return pStr; - } - - public Object[] make(ArrayList pAL) { - return pAL.toArray(EMPTY_STR_A); - } - }); - // boolean - putFactory(CIMDataType.BOOLEAN, new ValueFactory() { - - public Object make(String pStr) { - return Boolean.valueOf(pStr); - } - - public Object[] make(ArrayList pAL) { - return pAL.toArray(EMPTY_BOOL_A); - } - }); - // datetime - putFactory(CIMDataType.DATETIME, new ValueFactory() { - - public Object make(String pStr) { - try { - return new CIMDateTimeAbsolute(pStr); - } catch (IllegalArgumentException eA) { - try { - return new CIMDateTimeInterval(pStr); - } catch (IllegalArgumentException eI) { - throw new IllegalArgumentException("CIMDataTimeAbsolute:" + eA.getMessage() - + "\nCIMDateTimeInterval:" + eI.getMessage()); - } - } - } - - public Object[] make(ArrayList pAL) { - return pAL.toArray(EMPTY_DT_A); - } - }); - // reference - putFactory(CIMDataType.REFERENCE, new ValueFactory() { - - public Object make(String pStr) { - return new CIMObjectPath(pStr); - } - - public Object[] make(ArrayList pAL) { - return pAL.toArray(EMPTY_OP_A); - } - }); - } - -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1660756 2007-02-22 ebak Embedded object support + * 1689085 2007-04-10 ebak Embedded object enhancements for Pegasus + * 1735693 2007-06-12 ebak Empty VALUE.ARRAY elements are parsed as nulls + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors + * 2823494 2009-08-03 rgummada Change Boolean constructor to static + * 3023340 2010-07-02 blaschke-oss CIMObjectFactory uses # constructor instead of valueOf + * 3027615 2010-07-12 blaschke-oss Use CLASS_ARRAY_T instead of new CIMDataType(CLASS,0) + * 3513349 2012-03-31 blaschke-oss TCK: CIMDataType must not accept null string + * 3572993 2012-10-01 blaschke-oss parseDouble("2.2250738585072012e-308") DoS vulnerability + * 2693 2013-10-21 blaschke-oss ReturnValueNode allows invalid PARAMTYPE attribute + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.ByteArrayInputStream; +import java.util.ArrayList; +import java.util.HashMap; + +import org.metricshub.wbem.javax.cim.CIMClass; +import org.metricshub.wbem.javax.cim.CIMDataType; +import org.metricshub.wbem.javax.cim.CIMDateTimeAbsolute; +import org.metricshub.wbem.javax.cim.CIMDateTimeInterval; +import org.metricshub.wbem.javax.cim.CIMInstance; +import org.metricshub.wbem.javax.cim.CIMObjectPath; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node.ClassNode; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node.InstanceNode; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node.Node; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node.ValueArrayNode; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node.ValueNode; +import org.metricshub.wbem.sblim.cimclient.internal.util.MOF; +import org.metricshub.wbem.sblim.cimclient.internal.util.Util; +import org.metricshub.wbem.sblim.cimclient.internal.util.WBEMConfiguration; +import org.metricshub.wbem.javax.cim.CIMDateTime; +import org.metricshub.wbem.javax.cim.UnsignedInteger16; +import org.metricshub.wbem.javax.cim.UnsignedInteger32; +import org.metricshub.wbem.javax.cim.UnsignedInteger64; +import org.metricshub.wbem.javax.cim.UnsignedInteger8; +import javax.xml.parsers.SAXParser; +import javax.xml.parsers.SAXParserFactory; + +import org.xml.sax.SAXException; + +/** + * Class CIMObjectFactory is responsible for type String and value String + * parsing. + */ +public class CIMObjectFactory { + + /** + * getEmbbeddedObjectA + * + * @param pType + * @param pValueArrayNode + * @param pSession + * @return CIMInstance[], CIMClass[], String[] or null + * @throws SAXException + */ + public static Object[] getEmbeddedObjA(CIMDataType pType, ValueArrayNode pValueArrayNode, + SAXSession pSession) throws SAXException { + if (pValueArrayNode == null) return null; + return getEmbeddedObjA(pType, (String[]) pValueArrayNode.getValue(), pSession); + } + + /** + * getEmbeddedObjectA + * + * @param pType + * @param pValueStrA + * @param pSession + * @return CIMInstance[], CIMClass[], String[] or null + * @throws SAXException + */ + public static Object[] getEmbeddedObjA(CIMDataType pType, String[] pValueStrA, + SAXSession pSession) throws SAXException { + embeddedObjTypeCheck(pType); + if (pValueStrA == null || pValueStrA.length == 0) return null; + CIMDataType type = null; + ArrayList objAL = new ArrayList(pValueStrA.length); + for (int i = 0; i < pValueStrA.length; i++) { + Object obj = parseEmbeddedObj(pValueStrA[i], pSession); + if (type == null) { + type = getCIMObjScalarType(obj, false); + } else { + CIMDataType type2 = getCIMObjScalarType(obj, false); + if (type2 != null && type != type2) throw new SAXException( + "Embedded Object array contains both Instance and Class objects. " + + "This is not handled!"); + } + objAL.add(obj); + } + if (type == CIMDataType.OBJECT_T) { + return objAL.toArray(EMPTY_INST_A); + } else if (type == CIMDataType.CLASS_T) { return objAL.toArray(EMPTY_CLASS_A); } + return objAL.toArray(EMPTY_STR_A); + } + + /** + * getEmbeddedObject + * + * @param pType + * @param pValueStr + * @param pSession + * @return CIMInstance, CIMClass or null + * @throws SAXException + */ + public static Object getEmbeddedObj(CIMDataType pType, String pValueStr, SAXSession pSession) + throws SAXException { + embeddedObjTypeCheck(pType); + return parseEmbeddedObj(pValueStr, pSession); + } + + /** + * getEmbeddedObj + * + * @param pType + * @param pValObj + * @param pSession + * @return Object CIMClass, CIMInstance, String, CIMClass[], CIMInstance[], + * String[] or null + * @throws SAXException + */ + public static Object getEmbeddedObj(CIMDataType pType, Object pValObj, SAXSession pSession) + throws SAXException { + if (pValObj instanceof String) { return getEmbeddedObj(pType, (String) pValObj, pSession); } + return getEmbeddedObjA(pType, (String[]) pValObj, pSession); + } + + /** + * @param pType + * @param pAL + * @return Object[] + */ + public static Object[] getObjectArray(CIMDataType pType, ArrayList pAL) { + createValFactoryA(); + // if (pType==null) pType=CIMDataType.STRING_T; + ValueFactory factory = cValFactoryA[pType.getType()]; + return factory.make(pAL); + } + + /** + * getObject + * + * @param pType + * @param pValueStr + * @return Object + * @throws SAXException + */ + public static Object getObject(CIMDataType pType, String pValueStr) throws SAXException { + if (pValueStr == null) return null; + createValFactoryA(); + ValueFactory factory = cValFactoryA[pType.getType()]; + try { + return factory.make(pValueStr); + } catch (NumberFormatException e) { + throw new SAXException(e); + } + } + + /** + * getObject + * + * @param pType + * @param pValueNode + * @return Object + * @throws SAXException + */ + public static Object getObject(CIMDataType pType, ValueNode pValueNode) throws SAXException { + if (pValueNode == null) return null; + return getObject(pType, (String) pValueNode.getValue()); + } + + /** + * getObject + * + * @param pType + * @param pValueArrayNode + * @return Object + * @throws SAXException + */ + public static Object getObject(CIMDataType pType, ValueArrayNode pValueArrayNode) + throws SAXException { + if (pValueArrayNode == null) return null; + ArrayList objAL = new ArrayList(pValueArrayNode.size()); + for (int i = 0; i < pValueArrayNode.size(); i++) + objAL.add(getObject(pType, (String) pValueArrayNode.elementAt(i))); + return getObjectArray(pType, objAL); + } + + /** + * getCIMObjType + * + * @param pObj + * @param pNullToString + * @return CIMDataType OBJECT_T, CLASS_T, STRING_T + * @throws SAXException + */ + public static CIMDataType getCIMObjScalarType(Object pObj, boolean pNullToString) + throws SAXException { + if (pObj == null) return pNullToString ? CIMDataType.STRING_T : null; + if (pObj instanceof CIMInstance) { + return CIMDataType.OBJECT_T; + } else if (pObj instanceof CIMClass) { + return CIMDataType.CLASS_T; + } else if (pObj instanceof String) { return CIMDataType.STRING_T; } + throw new SAXException(pObj.getClass().getName() + " is not a CIMObject!"); + } + + /** + * getCIMObjType + * + * @param pObj + * @return CIMDataType OBJECT_T, OBJECT_ARRAY_T + * @throws SAXException + */ + public static CIMDataType getCIMObjScalarType(Object pObj) throws SAXException { + return getCIMObjScalarType(pObj, true); + } + + /** + * getCIMObjArrayType + * + * @param pObj + * @return CIMDataType: OBJECT_ARRAY_T, CLASS_T array, STRING_ARRAY_T + * @throws SAXException + */ + public static CIMDataType getCIMObjArrayType(Object pObj) throws SAXException { + return getCIMObjArrayType(pObj, true); + } + + /** + * getArrayCIMObjType + * + * @param pObj + * @param pNullToString + * @return CIMDataType: OBJECT_ARRAY_T, CLASS_T array, STRING_ARRAY_T or + * null + * @throws SAXException + */ + public static CIMDataType getCIMObjArrayType(Object pObj, boolean pNullToString) + throws SAXException { + if (pObj == null) return pNullToString ? CIMDataType.STRING_ARRAY_T : null; + if (pObj instanceof CIMInstance[]) { + return CIMDataType.OBJECT_ARRAY_T; + } else if (pObj instanceof CIMClass[]) { + return CIMDataType.CLASS_ARRAY_T; + } else if (pObj instanceof String[]) { return CIMDataType.STRING_ARRAY_T; } + throw new SAXException(pObj.getClass().getName() + " is not a CIMObject array!"); + } + + /** + * getType + * + * @param pTypeStr + * @return CIMDataType + * @throws SAXException + */ + public static CIMDataType getType(String pTypeStr) throws SAXException { + if (pTypeStr == null) return null; + createTypeStrMap(); + CIMDataType type = cTypeStrMap.get(pTypeStr); + if (type == null && !cTypeStrMap.containsKey(pTypeStr)) throw new SAXException(pTypeStr + + " is invalid PARAMTYPE!"); + return type; + } + + static final CIMInstance[] EMPTY_INST_A = new CIMInstance[0]; + + static final CIMClass[] EMPTY_CLASS_A = new CIMClass[0]; + + static final String[] EMPTY_STR_A = new String[0]; + + static final UnsignedInteger8[] EMPTY_UINT8_A = new UnsignedInteger8[0]; + + static final UnsignedInteger16[] EMPTY_UINT16_A = new UnsignedInteger16[0]; + + static final UnsignedInteger32[] EMPTY_UINT32_A = new UnsignedInteger32[0]; + + static final UnsignedInteger64[] EMPTY_UINT64_A = new UnsignedInteger64[0]; + + static final Byte[] EMPTY_BYTE_A = new Byte[0]; + + static final Short[] EMPTY_SHORT_A = new Short[0]; + + static final Integer[] EMPTY_INT_A = new Integer[0]; + + static final Long[] EMPTY_LONG_A = new Long[0]; + + static final Float[] EMPTY_FLOAT_A = new Float[0]; + + static final Double[] EMPTY_DOUBLE_A = new Double[0]; + + static final Character[] EMPTY_CHAR_A = new Character[0]; + + static final Boolean[] EMPTY_BOOL_A = new Boolean[0]; + + static final CIMDateTime[] EMPTY_DT_A = new CIMDateTime[0]; + + static final CIMObjectPath[] EMPTY_OP_A = new CIMObjectPath[0]; + + private static void embeddedObjTypeCheck(CIMDataType pType) throws SAXException { + if (pType.getType() != CIMDataType.STRING) throw new SAXException( + "TYPE attribute should be 'string' for EmbeddedObjects!"); + } + + private static Object parseEmbeddedObj(String pValueStr, SAXSession pSession) + throws SAXException { + if (pValueStr == null || pValueStr.length() == 0) return null; + XMLDefaultHandlerImpl ourHandler = new XMLDefaultHandlerImpl(pSession, true); + // XML String of embedded Object is parsed by the SAX parser + SAXParserFactory factory = SAXParserFactory.newInstance(); + try { + SAXParser saxParser = factory.newSAXParser(); + saxParser.parse(new ByteArrayInputStream(pValueStr.getBytes()), ourHandler); + } catch (SAXException se) { + throw se; + } catch (Exception e) { + throw new SAXException("Exception occurred during embedded object parsing!", e); + } + Node node = ourHandler.getRootNode(); + if (node instanceof InstanceNode) { return ((InstanceNode) node).getCIMInstance(); } + if (node instanceof ClassNode) { return ((ClassNode) node).getCIMClass(); } + throw new SAXException(node.getNodeName() + + " root element is unexpected for Embedded Object XML String!"); + } + + private static HashMap cTypeStrMap; + + private synchronized static void createTypeStrMap() { + if (cTypeStrMap != null) return; + cTypeStrMap = new HashMap(); + cTypeStrMap.put(MOF.DT_UINT8, CIMDataType.UINT8_T); + cTypeStrMap.put(MOF.DT_UINT16, CIMDataType.UINT16_T); + cTypeStrMap.put(MOF.DT_UINT32, CIMDataType.UINT32_T); + cTypeStrMap.put(MOF.DT_UINT64, CIMDataType.UINT64_T); + cTypeStrMap.put(MOF.DT_SINT8, CIMDataType.SINT8_T); + cTypeStrMap.put(MOF.DT_SINT16, CIMDataType.SINT16_T); + cTypeStrMap.put(MOF.DT_SINT32, CIMDataType.SINT32_T); + cTypeStrMap.put(MOF.DT_SINT64, CIMDataType.SINT64_T); + cTypeStrMap.put(MOF.DT_REAL32, CIMDataType.REAL32_T); + cTypeStrMap.put(MOF.DT_REAL64, CIMDataType.REAL64_T); + cTypeStrMap.put(MOF.DT_CHAR16, CIMDataType.CHAR16_T); + cTypeStrMap.put(MOF.DT_STR, CIMDataType.STRING_T); + cTypeStrMap.put(MOF.DT_BOOL, CIMDataType.BOOLEAN_T); + cTypeStrMap.put(MOF.DT_DATETIME, CIMDataType.DATETIME_T); + cTypeStrMap.put(MOF.REFERENCE, new CIMDataType("")); + } + + private interface ValueFactory { + + /** + * make + * + * @param pStr + * @return Object + */ + Object make(String pStr); + + /** + * make + * + * @param pAL + * @return Object[] + */ + Object[] make(ArrayList pAL); + } + + private static ValueFactory[] cValFactoryA; + + private static void putFactory(int pTypeCode, ValueFactory pFactory) { + cValFactoryA[pTypeCode] = pFactory; + } + + private synchronized static void createValFactoryA() { + if (cValFactoryA != null) return; + cValFactoryA = new ValueFactory[64]; + // unsigned integers + putFactory(CIMDataType.UINT8, new ValueFactory() { + + public Object make(String pStr) { + return new UnsignedInteger8(pStr); + } + + public Object[] make(ArrayList pAL) { + return pAL.toArray(EMPTY_UINT8_A); + } + }); + putFactory(CIMDataType.UINT16, new ValueFactory() { + + public Object make(String pStr) { + return new UnsignedInteger16(pStr); + } + + public Object[] make(ArrayList pAL) { + return pAL.toArray(EMPTY_UINT16_A); + } + }); + putFactory(CIMDataType.UINT32, new ValueFactory() { + + public Object make(String pStr) { + return new UnsignedInteger32(pStr); + } + + public Object[] make(ArrayList pAL) { + return pAL.toArray(EMPTY_UINT32_A); + } + }); + putFactory(CIMDataType.UINT64, new ValueFactory() { + + public Object make(String pStr) { + return new UnsignedInteger64(pStr); + } + + public Object[] make(ArrayList pAL) { + return pAL.toArray(EMPTY_UINT64_A); + } + }); + // signed integers + putFactory(CIMDataType.SINT8, new ValueFactory() { + + public Object make(String pStr) { + return new Byte(pStr); + } + + public Object[] make(ArrayList pAL) { + return pAL.toArray(EMPTY_BYTE_A); + } + }); + putFactory(CIMDataType.SINT16, new ValueFactory() { + + public Object make(String pStr) { + return new Short(pStr); + } + + public Object[] make(ArrayList pAL) { + return pAL.toArray(EMPTY_SHORT_A); + } + }); + putFactory(CIMDataType.SINT32, new ValueFactory() { + + public Object make(String pStr) { + return new Integer(pStr); + } + + public Object[] make(ArrayList pAL) { + return pAL.toArray(EMPTY_INT_A); + } + }); + putFactory(CIMDataType.SINT64, new ValueFactory() { + + public Object make(String pStr) { + return new Long(pStr); + } + + public Object[] make(ArrayList pAL) { + return pAL.toArray(EMPTY_LONG_A); + } + }); + // floats + putFactory(CIMDataType.REAL32, new ValueFactory() { + + public Object make(String pStr) { + return new Float(pStr); + } + + public Object[] make(ArrayList pAL) { + return pAL.toArray(EMPTY_FLOAT_A); + } + }); + putFactory(CIMDataType.REAL64, new ValueFactory() { + + public Object make(String pStr) { + if (WBEMConfiguration.getGlobalConfiguration().verifyJavaLangDoubleStrings()) { + if (Util.isBadDoubleString(pStr)) throw new IllegalArgumentException( + "Double value string hangs older JVMs!\n" + pStr); + } + return new Double(pStr); + } + + public Object[] make(ArrayList pAL) { + return pAL.toArray(EMPTY_DOUBLE_A); + } + }); + // char + putFactory(CIMDataType.CHAR16, new ValueFactory() { + + public Object make(String pStr) { + if (pStr == null || pStr.length() == 0) throw new IllegalArgumentException( + "Cannot make Character from empty String!"); + return Character.valueOf(pStr.charAt(0)); + } + + public Object[] make(ArrayList pAL) { + return pAL.toArray(EMPTY_CHAR_A); + } + }); + // string + putFactory(CIMDataType.STRING, new ValueFactory() { + + public Object make(String pStr) { + return pStr; + } + + public Object[] make(ArrayList pAL) { + return pAL.toArray(EMPTY_STR_A); + } + }); + // boolean + putFactory(CIMDataType.BOOLEAN, new ValueFactory() { + + public Object make(String pStr) { + return Boolean.valueOf(pStr); + } + + public Object[] make(ArrayList pAL) { + return pAL.toArray(EMPTY_BOOL_A); + } + }); + // datetime + putFactory(CIMDataType.DATETIME, new ValueFactory() { + + public Object make(String pStr) { + try { + return new CIMDateTimeAbsolute(pStr); + } catch (IllegalArgumentException eA) { + try { + return new CIMDateTimeInterval(pStr); + } catch (IllegalArgumentException eI) { + throw new IllegalArgumentException("CIMDataTimeAbsolute:" + eA.getMessage() + + "\nCIMDateTimeInterval:" + eI.getMessage()); + } + } + } + + public Object[] make(ArrayList pAL) { + return pAL.toArray(EMPTY_DT_A); + } + }); + // reference + putFactory(CIMDataType.REFERENCE, new ValueFactory() { + + public Object make(String pStr) { + return new CIMObjectPath(pStr); + } + + public Object[] make(ArrayList pAL) { + return pAL.toArray(EMPTY_OP_A); + } + }); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/EmbObjHandler.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/EmbObjHandler.java similarity index 85% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/EmbObjHandler.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/EmbObjHandler.java index f6b35fc..b24608b 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/EmbObjHandler.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/EmbObjHandler.java @@ -1,351 +1,348 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1689085 2007-04-10 ebak Embedded object enhancements for Pegasus - * 1712656 2007-05-04 ebak Correct type identification for SVC CIMOM - * 1719991 2007-05-16 ebak FVT: regression ClassCastException in EmbObjHandler - * 1820763 2007-10-29 ebak Supporting the EmbeddedInstance qualifier - * 1848607 2007-12-11 ebak Strict EmbeddedObject types - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors - * 2957387 2010-03-03 blaschke-oss EmbededObject XML attribute must not be all uppercases - * 3281781 2011-04-11 blaschke-oss fail to parse Embedded Instance parameter - * 3513353 2012-03-30 blaschke-oss TCK: CIMDataType arrays must have length >= 1 - * 3513349 2012-03-31 blaschke-oss TCK: CIMDataType must not accept null string - * 2691 2013-10-18 blaschke-oss RETURNVALUE should not require PARAMTYPE attribute - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMDataType; -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cim.CIMHelper; -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node.AbstractValueNode; -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node.ArrayIf; -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node.Node; -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node.QualifiedNodeHandler; -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node.ValueArrayNode; -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node.ValueNode; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - * EmbObjHandler helps the parsing of embedded object elements. - */ - -public class EmbObjHandler { - - private String iNodeName; - - private CIMDataType iRawType; - - private boolean iHasEmbObjAttr, iHasEmbInstAttr; - - private SAXSession iSession; - - private CIMDataType iType; - - private Object iValue; - - private QualifiedNodeHandler iQualiHandler; - - private AbstractValueNode iAbsValNode; - - /** - * Generic initialization. - * - * @param pHandler - * @param pNodeName - * @param pAttribs - * @param pSession - * @param pQNodeHandler - * @param pCheckEmbObjAttrib - * @return EmbObjHandler - * @throws SAXException - */ - public static EmbObjHandler init(EmbObjHandler pHandler, String pNodeName, Attributes pAttribs, - SAXSession pSession, QualifiedNodeHandler pQNodeHandler, boolean pCheckEmbObjAttrib) - throws SAXException { - if (pHandler == null) pHandler = new EmbObjHandler(); - pHandler.initInst(pNodeName, pAttribs, pSession, pQNodeHandler, pCheckEmbObjAttrib); - return pHandler; - } - - private EmbObjHandler() { - // init() used for instantiation - } - - /** - * Generic instance initialization. - * - * @param pNodeName - * @param pAttribs - * @param pSession - * @param pQNodeHandler - * @param pCheckEmbObjAttrib - * @throws SAXException - */ - public void initInst(String pNodeName, Attributes pAttribs, SAXSession pSession, - QualifiedNodeHandler pQNodeHandler, boolean pCheckEmbObjAttrib) throws SAXException { - this.iSession = pSession; - this.iNodeName = pNodeName; - this.iQualiHandler = pQNodeHandler; - this.iType = null; - this.iValue = null; - this.iAbsValNode = null; - this.iRawType = Node.getCIMType(pAttribs, true); - if (this.iRawType == null) { - this.iRawType = Node.getParamType(pAttribs); - /* - * if (iRawType==null) throw new SAXException( iNodeName+" must - * contain a TYPE or a PARAMTYPE attribute!" ); - */ - /* - * SVC CIMOM doesn't add TYPE attribute for the RETURNVALUE element, - * but it adds it to the VALUE element. - */ - } - - if (pCheckEmbObjAttrib) { - // DSPs call for EmbeddedObject AND XML is case sensitive, BUT there - // are probably CIMOMs out there that still use EMBEDDEDOBJECT - String embObjStr = pAttribs.getValue("EmbeddedObject"); - if (embObjStr == null) { - embObjStr = pAttribs.getValue("EMBEDDEDOBJECT"); - } - if (embObjStr == null) { - this.iHasEmbInstAttr = this.iHasEmbObjAttr = false; - } else if ("instance".equalsIgnoreCase(embObjStr)) { - this.iHasEmbInstAttr = true; - this.iHasEmbObjAttr = false; - } else if ("object".equalsIgnoreCase(embObjStr)) { - this.iHasEmbInstAttr = false; - this.iHasEmbObjAttr = true; - } else { - throw new SAXException( - "EmbeddedObject attribute's value must be \"object\" or \"instance\". " - + embObjStr + " is invalid!"); - } - } else { - this.iHasEmbInstAttr = this.iHasEmbObjAttr = false; - } - } - - /** - * isEmbeddedObject For this function Object means CLASS or INSTANCE. Object - * can have other meanings at different places !!! :( - * - * @return boolean - */ - private boolean isEmbeddedObject() { - return this.iHasEmbInstAttr - || this.iHasEmbObjAttr - || (this.iQualiHandler != null && (this.iQualiHandler.isEmbeddedObject() || this.iQualiHandler - .isEmbeddedInstance())); - } - - /** - * isEmbeddedClass - * - * @return boolean - */ - private boolean isEmbeddedClass() { - return this.iHasEmbObjAttr - || (this.iQualiHandler != null && this.iQualiHandler.isEmbeddedObject()); - } - - /** - * isEmbeddedInstance - * - * @return boolean - */ - private boolean isEmbeddedInstance() { - return this.iHasEmbInstAttr - || (this.iQualiHandler != null && this.iQualiHandler.isEmbeddedInstance()); - } - - /** - * getValue - * - * @return Object - * @throws SAXException - */ - public Object getValue() throws SAXException { - transform(); - return this.iValue; - } - - /** - * getType - * - * @return Object - * @throws SAXException - */ - public CIMDataType getType() throws SAXException { - transform(); - return this.iType; - } - - /** - * getRawType - * - * @return the type which is retrieved from the XML attributes - */ - public CIMDataType getRawType() { - return this.iRawType; - } - - /** - * getArrayType useful e.g. for PROPERTY.ARRAY - * - * @return CIMDataType - * @throws SAXException - */ - public CIMDataType getArrayType() throws SAXException { - transform(); - return this.iType.isArray() ? this.iType : CIMHelper.UnboundedArrayDataType(this.iType - .getType()); - } - - /** - * addValueNode - * - * @param pValueNode - * - can be ValueNode ore ValueArrayNode for Embedded Objects - */ - public void addValueNode(AbstractValueNode pValueNode) { - if (isEmbeddedObject() - && !(pValueNode == null || pValueNode instanceof ValueNode || pValueNode instanceof ValueArrayNode)) throw new IllegalArgumentException( - "pValueNode's type can be ValueNode or ValueArrayNode or it can be null. " - + pValueNode.getClass().getName() + " is an invalid type!"); - this.iAbsValNode = pValueNode; - } - - private void transform() throws SAXException { - if (this.iType != null) return; - if (this.iAbsValNode == null) { - if (isEmbeddedObject()) { - if (this.iRawType != CIMDataType.STRING_T) throw new SAXException( - "Embedded Object CIM-XML element's type must be string. " + this.iRawType - + " is invalid!"); - if (this.iSession.strictEmbObjParsing()) { - /* - * Here the assumption is that Object = CLASS, Instance = - * INSTANCE. - */ - this.iType = isEmbeddedInstance() ? CIMDataType.OBJECT_T : CIMDataType.CLASS_T; - } else { - /* - * for valueless EmbeddedObject="object" the type can not be - * determined since Pegasus's CIMObject can contain both - * CIMClass and CIMInstance. Is it true for Pegasus 2.7.0 - * too? - */ - this.iType = isEmbeddedInstance() ? CIMDataType.OBJECT_T : CIMDataType.STRING_T; - } - } else { - this.iType = this.iRawType; - } - this.iValue = null; - } else { - setType(); - if (isEmbeddedObject()) { - transformEmbObj(); - } else { - transformNormObj(); - } - } - } - - private void transformEmbObj() throws SAXException { - if (this.iAbsValNode instanceof ValueNode) { - String valueStr = (String) ((ValueNode) this.iAbsValNode).getValue(); - this.iValue = CIMObjectFactory.getEmbeddedObj(this.iRawType, valueStr, this.iSession); - this.iType = CIMObjectFactory.getCIMObjScalarType(this.iValue); - } else { // ValueArrayNode - this.iValue = CIMObjectFactory.getEmbeddedObjA(this.iRawType, - (ValueArrayNode) this.iAbsValNode, this.iSession); - this.iType = CIMObjectFactory.getCIMObjArrayType(this.iValue); - } - if (isEmbeddedInstance() && this.iType.getType() != CIMDataType.OBJECT) throw new SAXException( - this.iNodeName + " element is an EmbeddedInstance with non INSTANCE value. " - + "It's not valid!"); - if (isEmbeddedClass() && this.iType.getType() != CIMDataType.CLASS - && this.iType.getType() != CIMDataType.OBJECT) throw new SAXException( - this.iNodeName - + " element is an EmbeddedObject with non CLASS/INSTANCE value. It's not valid!"); - } - - private void transformNormObj() throws SAXException { - if (this.iAbsValNode instanceof ValueNode) { - this.iType = this.iRawType; - this.iValue = CIMObjectFactory.getObject(this.iType, (ValueNode) this.iAbsValNode); - } else if (this.iAbsValNode instanceof ValueArrayNode) { - this.iType = CIMHelper.UnboundedArrayDataType(this.iRawType.getType()); - this.iValue = CIMObjectFactory.getObject(this.iRawType, - (ValueArrayNode) this.iAbsValNode); - } else { - this.iValue = this.iAbsValNode.getValue(); - if (this.iAbsValNode instanceof ArrayIf) { - if (this.iValue instanceof CIMObjectPath[]) this.iType = new CIMDataType("", 0); - } else { - if (this.iValue instanceof CIMObjectPath) { - this.iType = new CIMDataType(((CIMObjectPath) this.iValue).getObjectName()); - } else { - this.iType = this.iRawType; - } - } - } - } - - /** - * Required to handle the output XML of some non-standard CIMOMs like SVC - * which adds the TYPE attribute to the sub VALUE or VALUE.ARRAY XML - * element. - * - * @throws SAXException - */ - private void setType() throws SAXException { - if (this.iType != null || this.iRawType != null) return; - this.iRawType = this.iAbsValNode.getType(); - if (this.iRawType == null) this.iRawType = (this.iAbsValNode instanceof ArrayIf ? CIMDataType.STRING_ARRAY_T - : CIMDataType.STRING_T); - } - -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1689085 2007-04-10 ebak Embedded object enhancements for Pegasus + * 1712656 2007-05-04 ebak Correct type identification for SVC CIMOM + * 1719991 2007-05-16 ebak FVT: regression ClassCastException in EmbObjHandler + * 1820763 2007-10-29 ebak Supporting the EmbeddedInstance qualifier + * 1848607 2007-12-11 ebak Strict EmbeddedObject types + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors + * 2957387 2010-03-03 blaschke-oss EmbededObject XML attribute must not be all uppercases + * 3281781 2011-04-11 blaschke-oss fail to parse Embedded Instance parameter + * 3513353 2012-03-30 blaschke-oss TCK: CIMDataType arrays must have length >= 1 + * 3513349 2012-03-31 blaschke-oss TCK: CIMDataType must not accept null string + * 2691 2013-10-18 blaschke-oss RETURNVALUE should not require PARAMTYPE attribute + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMDataType; +import org.metricshub.wbem.javax.cim.CIMObjectPath; +import org.metricshub.wbem.sblim.cimclient.internal.cim.CIMHelper; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node.AbstractValueNode; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node.ArrayIf; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node.Node; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node.QualifiedNodeHandler; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node.ValueArrayNode; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node.ValueNode; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + * EmbObjHandler helps the parsing of embedded object elements. + */ + +public class EmbObjHandler { + + private String iNodeName; + + private CIMDataType iRawType; + + private boolean iHasEmbObjAttr, iHasEmbInstAttr; + + private SAXSession iSession; + + private CIMDataType iType; + + private Object iValue; + + private QualifiedNodeHandler iQualiHandler; + + private AbstractValueNode iAbsValNode; + + /** + * Generic initialization. + * + * @param pHandler + * @param pNodeName + * @param pAttribs + * @param pSession + * @param pQNodeHandler + * @param pCheckEmbObjAttrib + * @return EmbObjHandler + * @throws SAXException + */ + public static EmbObjHandler init(EmbObjHandler pHandler, String pNodeName, Attributes pAttribs, + SAXSession pSession, QualifiedNodeHandler pQNodeHandler, boolean pCheckEmbObjAttrib) + throws SAXException { + if (pHandler == null) pHandler = new EmbObjHandler(); + pHandler.initInst(pNodeName, pAttribs, pSession, pQNodeHandler, pCheckEmbObjAttrib); + return pHandler; + } + + private EmbObjHandler() { + // init() used for instantiation + } + + /** + * Generic instance initialization. + * + * @param pNodeName + * @param pAttribs + * @param pSession + * @param pQNodeHandler + * @param pCheckEmbObjAttrib + * @throws SAXException + */ + public void initInst(String pNodeName, Attributes pAttribs, SAXSession pSession, + QualifiedNodeHandler pQNodeHandler, boolean pCheckEmbObjAttrib) throws SAXException { + this.iSession = pSession; + this.iNodeName = pNodeName; + this.iQualiHandler = pQNodeHandler; + this.iType = null; + this.iValue = null; + this.iAbsValNode = null; + this.iRawType = Node.getCIMType(pAttribs, true); + if (this.iRawType == null) { + this.iRawType = Node.getParamType(pAttribs); + /* + * if (iRawType==null) throw new SAXException( iNodeName+" must + * contain a TYPE or a PARAMTYPE attribute!" ); + */ + /* + * SVC CIMOM doesn't add TYPE attribute for the RETURNVALUE element, + * but it adds it to the VALUE element. + */ + } + + if (pCheckEmbObjAttrib) { + // DSPs call for EmbeddedObject AND XML is case sensitive, BUT there + // are probably CIMOMs out there that still use EMBEDDEDOBJECT + String embObjStr = pAttribs.getValue("EmbeddedObject"); + if (embObjStr == null) { + embObjStr = pAttribs.getValue("EMBEDDEDOBJECT"); + } + if (embObjStr == null) { + this.iHasEmbInstAttr = this.iHasEmbObjAttr = false; + } else if ("instance".equalsIgnoreCase(embObjStr)) { + this.iHasEmbInstAttr = true; + this.iHasEmbObjAttr = false; + } else if ("object".equalsIgnoreCase(embObjStr)) { + this.iHasEmbInstAttr = false; + this.iHasEmbObjAttr = true; + } else { + throw new SAXException( + "EmbeddedObject attribute's value must be \"object\" or \"instance\". " + + embObjStr + " is invalid!"); + } + } else { + this.iHasEmbInstAttr = this.iHasEmbObjAttr = false; + } + } + + /** + * isEmbeddedObject For this function Object means CLASS or INSTANCE. Object + * can have other meanings at different places !!! :( + * + * @return boolean + */ + private boolean isEmbeddedObject() { + return this.iHasEmbInstAttr + || this.iHasEmbObjAttr + || (this.iQualiHandler != null && (this.iQualiHandler.isEmbeddedObject() || this.iQualiHandler + .isEmbeddedInstance())); + } + + /** + * isEmbeddedClass + * + * @return boolean + */ + private boolean isEmbeddedClass() { + return this.iHasEmbObjAttr + || (this.iQualiHandler != null && this.iQualiHandler.isEmbeddedObject()); + } + + /** + * isEmbeddedInstance + * + * @return boolean + */ + private boolean isEmbeddedInstance() { + return this.iHasEmbInstAttr + || (this.iQualiHandler != null && this.iQualiHandler.isEmbeddedInstance()); + } + + /** + * getValue + * + * @return Object + * @throws SAXException + */ + public Object getValue() throws SAXException { + transform(); + return this.iValue; + } + + /** + * getType + * + * @return Object + * @throws SAXException + */ + public CIMDataType getType() throws SAXException { + transform(); + return this.iType; + } + + /** + * getRawType + * + * @return the type which is retrieved from the XML attributes + */ + public CIMDataType getRawType() { + return this.iRawType; + } + + /** + * getArrayType useful e.g. for PROPERTY.ARRAY + * + * @return CIMDataType + * @throws SAXException + */ + public CIMDataType getArrayType() throws SAXException { + transform(); + return this.iType.isArray() ? this.iType : CIMHelper.UnboundedArrayDataType(this.iType + .getType()); + } + + /** + * addValueNode + * + * @param pValueNode + * - can be ValueNode ore ValueArrayNode for Embedded Objects + */ + public void addValueNode(AbstractValueNode pValueNode) { + if (isEmbeddedObject() + && !(pValueNode == null || pValueNode instanceof ValueNode || pValueNode instanceof ValueArrayNode)) throw new IllegalArgumentException( + "pValueNode's type can be ValueNode or ValueArrayNode or it can be null. " + + pValueNode.getClass().getName() + " is an invalid type!"); + this.iAbsValNode = pValueNode; + } + + private void transform() throws SAXException { + if (this.iType != null) return; + if (this.iAbsValNode == null) { + if (isEmbeddedObject()) { + if (this.iRawType != CIMDataType.STRING_T) throw new SAXException( + "Embedded Object CIM-XML element's type must be string. " + this.iRawType + + " is invalid!"); + if (this.iSession.strictEmbObjParsing()) { + /* + * Here the assumption is that Object = CLASS, Instance = + * INSTANCE. + */ + this.iType = isEmbeddedInstance() ? CIMDataType.OBJECT_T : CIMDataType.CLASS_T; + } else { + /* + * for valueless EmbeddedObject="object" the type can not be + * determined since Pegasus's CIMObject can contain both + * CIMClass and CIMInstance. Is it true for Pegasus 2.7.0 + * too? + */ + this.iType = isEmbeddedInstance() ? CIMDataType.OBJECT_T : CIMDataType.STRING_T; + } + } else { + this.iType = this.iRawType; + } + this.iValue = null; + } else { + setType(); + if (isEmbeddedObject()) { + transformEmbObj(); + } else { + transformNormObj(); + } + } + } + + private void transformEmbObj() throws SAXException { + if (this.iAbsValNode instanceof ValueNode) { + String valueStr = (String) ((ValueNode) this.iAbsValNode).getValue(); + this.iValue = CIMObjectFactory.getEmbeddedObj(this.iRawType, valueStr, this.iSession); + this.iType = CIMObjectFactory.getCIMObjScalarType(this.iValue); + } else { // ValueArrayNode + this.iValue = CIMObjectFactory.getEmbeddedObjA(this.iRawType, + (ValueArrayNode) this.iAbsValNode, this.iSession); + this.iType = CIMObjectFactory.getCIMObjArrayType(this.iValue); + } + if (isEmbeddedInstance() && this.iType.getType() != CIMDataType.OBJECT) throw new SAXException( + this.iNodeName + " element is an EmbeddedInstance with non INSTANCE value. " + + "It's not valid!"); + if (isEmbeddedClass() && this.iType.getType() != CIMDataType.CLASS + && this.iType.getType() != CIMDataType.OBJECT) throw new SAXException( + this.iNodeName + + " element is an EmbeddedObject with non CLASS/INSTANCE value. It's not valid!"); + } + + private void transformNormObj() throws SAXException { + if (this.iAbsValNode instanceof ValueNode) { + this.iType = this.iRawType; + this.iValue = CIMObjectFactory.getObject(this.iType, (ValueNode) this.iAbsValNode); + } else if (this.iAbsValNode instanceof ValueArrayNode) { + this.iType = CIMHelper.UnboundedArrayDataType(this.iRawType.getType()); + this.iValue = CIMObjectFactory.getObject(this.iRawType, + (ValueArrayNode) this.iAbsValNode); + } else { + this.iValue = this.iAbsValNode.getValue(); + if (this.iAbsValNode instanceof ArrayIf) { + if (this.iValue instanceof CIMObjectPath[]) this.iType = new CIMDataType("", 0); + } else { + if (this.iValue instanceof CIMObjectPath) { + this.iType = new CIMDataType(((CIMObjectPath) this.iValue).getObjectName()); + } else { + this.iType = this.iRawType; + } + } + } + } + + /** + * Required to handle the output XML of some non-standard CIMOMs like SVC + * which adds the TYPE attribute to the sub VALUE or VALUE.ARRAY XML + * element. + * + * @throws SAXException + */ + private void setType() throws SAXException { + if (this.iType != null || this.iRawType != null) return; + this.iRawType = this.iAbsValNode.getType(); + if (this.iRawType == null) this.iRawType = (this.iAbsValNode instanceof ArrayIf ? CIMDataType.STRING_ARRAY_T + : CIMDataType.STRING_T); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/NodeConstIf.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/NodeConstIf.java similarity index 92% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/NodeConstIf.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/NodeConstIf.java index ed613e4..21ac4eb 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/NodeConstIf.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/NodeConstIf.java @@ -1,929 +1,927 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings - * 2210455 2008-10-30 blaschke-oss Enhance javadoc, fix potential null pointers - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors - * 2845211 2009-08-27 raman_arora Pull Enumeration Feature (SAX Parser) - * 2666 2013-09-19 blaschke-oss CR12: Remove ENUMERATIONCONTEXT - * 2672 2013-09-26 blaschke-oss Remove SIMPLEREQACK support - * 2690 2013-10-11 blaschke-oss Remove RESPONSEDESTINATION support - * 2538 2013-11-28 blaschke-oss CR14: Support new CORRELATOR element - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -/** - * Class NodeConstIf - * - */ -public interface NodeConstIf { - - /** - * The CIM element is the root element of every XML Document that is valid - * with respect to this schema.
      - * - * - * <!ELEMENT CIM (MESSAGE|DECLARATION)> - * <!ATTLIST CIM - * CIMVERSION CDATA #REQUIRED - * DTDVERSION CDATA #REQUIRED> - * - * - * @see String - */ - public static final String CIM = "CIM"; - - /** - * The DECLARATION element defines a set of one or more declarations of CIM - * objects.
      - * - * - * - * <!ELEMENT DECLARATION (DECLGROUP|DECLGROUP.WITHNAME|DECLGROUP.WITHPATH)+> - * - * - * @see String - */ - public static final String DECLARATION = "DECLARATION"; - - /** - * The DECLGROUP element defines a logical set of CIM Class, Instance and - * Qualifier declarations.
      - * - * - * <!ELEMENT DECLGROUP ((LOCALNAMESPACEPATH|NAMESPACEPATH)?,QUALIFIER.DECLARATION*,VALUE.OBJECT*)> - * - * - * @see String - */ - public static final String DECLGROUP = "DECLGROUP"; - - /** - * The DECLGROUP.WITHNAME element defines a logical set of CIM Class, - * Instance and Qualifier declarations.
      - * - * - * <!ELEMENT DECLGROUP.WITHNAME ((LOCALNAMESPACEPATH|NAMESPACEPATH)?,QUALIFIER.DECLARATION*,VALUE.NAMEDOBJECT*)> - * - * - * @see String - */ - public static final String DECLGROUP_WITHNAME = "DECLGROUP.WITHNAME"; - - /** - * The DECLGROUP.WITHPATH element defines a logical set of CIM Class and - * Instance declarations.
      - * - * - * <!ELEMENT DECLGROUP.WITHPATH (VALUE.OBJECTWITHPATH|VALUE.OBJECTWITHLOCALPATH)*> - * - * - * @see String - */ - public static final String DECLGROUP_WITHPATH = "DECLGROUP.WITHPATH"; - - /** - * The QUALIFIER.DECLARATION element defines a single CIM Qualifier - * declaration.
      - * - * - * <!ELEMENT QUALIFIER.DECLARATION (SCOPE?,(VALUE|VALUE.ARRAY)?)> - * <!ATTLIST QUALIFIER.DECLARATION - * %CIMName; - * %CIMType; #REQUIRED - * ISARRAY (true|false) #IMPLIED - * %ArraySize; - * %QualifierFlavor;> - * - * - * @see String - */ - public static final String QUALIFIER_DECLARATION = "QUALIFIER.DECLARATION"; - - /** - * The SCOPE element defines the scope of a QUALIFIER.DECLARATION in the - * case that there are restrictions on the scope of the Qualifier - * declaration.
      - * - * - * <!ELEMENT SCOPE EMPTY> - * <!ATTLIST SCOPE - * CLASS (true|false) "false" - * ASSOCIATION (true|false) "false" - * REFERENCE (true|false) "false" - * PROPERTY (true|false) "false" - * METHOD (true|false) "false" - * PARAMETER (true|false) "false" - * INDICATION (true|false) "false"> - * - * - * @see String - */ - public static final String SCOPE = "SCOPE"; - - /** - * The VALUE element is used to define a single (non-array) non-reference - * non-NULL CIM Property value, CIM Qualifier value, CIM Method return - * value, or CIM Method Parameter value.
      - * - * - * <!ELEMENT VALUE (#PCDATA)> - * - * - * @see String - */ - public static final String VALUE = "VALUE"; - - /** - * The VALUE.ARRAY element is used to represent the value of a CIM Property - * or Qualifier that has an array type.
      - * - * - * - * <!ELEMENT VALUE.ARRAY (VALUE|VALUE.NULL)*> - * - * - * @see String - */ - public static final String VALUE_ARRAY = "VALUE.ARRAY"; - - /** - * The VALUE.REFERENCE element is used to define a single CIM reference - * Property value.
      - * - * - * <!ELEMENT VALUE.REFERENCE (CLASSPATH|LOCALCLASSPATH|CLASSNAME|INSTANCEPATH|LOCALINSTANCEPATH|INSTANCENAME)> - * - * - * @see String - */ - public static final String VALUE_REFERENCE = "VALUE.REFERENCE"; - - /** - * The VALUE.REFARRAY element is used to represent the value of an array of - * CIM references.
      - * - * - * <!ELEMENT VALUE.REFARRAY (VALUE.REFERENCE|VALUE.NULL)*> - * - * - * @see String - */ - public static final String VALUE_REFARRAY = "VALUE.REFARRAY"; - - /** - * The VALUE.OBJECT element is used to define a value which is comprised of - * a single CIM Class or Instance definition.
      - * - * - * <!ELEMENT VALUE.OBJECT (CLASS|INSTANCE)> - * - * - * @see String - */ - public static final String VALUE_OBJECT = "VALUE.OBJECT"; - - /** - * The VALUE.NAMEDINSTANCE element is used to define a value which is - * comprised of a single named CIM Instance definition.
      - * - * - * - * <!ELEMENT VALUE.NAMEDINSTANCE (INSTANCENAME,INSTANCE)> - * - * - * @see String - */ - public static final String VALUE_NAMEDINSTANCE = "VALUE.NAMEDINSTANCE"; - - /** - * The VALUE.NAMEDOBJECT element is used to define a value which is - * comprised of a single named CIM Class or Instance definition.
      - * - * - * <!ELEMENT VALUE.NAMEDOBJECT (CLASS|(INSTANCENAME,INSTANCE))> - * - * - * @see String - */ - public static final String VALUE_NAMEDOBJECT = "VALUE.NAMEDOBJECT"; - - /** - * The VALUE.OBJECTWITHLOCALPATH element is used to define a value which is - * comprised of a single CIM Object (Class or Instance) definition with - * additional information that defines the local path to that Object.
      - * - * - * <!ELEMENT VALUE.OBJECTWITHLOCALPATH ((LOCALCLASSPATH,CLASS)|(LOCALINSTANCEPATH,INSTANCE))> - * - * - * @see String - */ - public static final String VALUE_OBJECTWITHLOCALPATH = "VALUE.OBJECTWITHLOCALPATH"; - - /** - * The VALUE.OBJECTWITHPATH element is used to define a value which is - * comprised of a single CIM Object (Class or Instance) definition with - * additional information that defines the absolute path to that Object.
      - * - * - * <!ELEMENT VALUE.OBJECTWITHPATH ((CLASSPATH,CLASS)|(INSTANCEPATH,INSTANCE))> - * - * - * @see String - */ - public static final String VALUE_OBJECTWITHPATH = "VALUE.OBJECTWITHPATH"; - - /** - * The VALUE.NULL element is used to represent a NULL value.
      - * - * - * <!ELEMENT VALUE.NULL EMPTY> - * - * - * @see String - */ - public static final String VALUE_NULL = "VALUE.NULL"; - - /** - * The VALUE.INSTANCEWITHPATH element is used to define value that comprises - * a single CIM instance definition with additional information that defines - * the absolute path to that object.
      - * - * - * <!ELEMENT VALUE.INSTANCEWITHPATH (INSTANCEPATH, INSTANCE)> - * - * - * @see String - */ - public static final String VALUE_INSTANCEWITHPATH = "VALUE.INSTANCEWITHPATH"; - - /** - * The NAMESPACEPATH element is used to define a Namespace Path.
      - * - * - * <!ELEMENT NAMESPACEPATH (HOST,LOCALNAMESPACEPATH)> - * - * - * @see String - */ - public static final String NAMESPACEPATH = "NAMESPACEPATH"; - - /** - * The LOCALNAMESPACEPATH element is used to define a local Namespace path - * (one without a Host component).
      - * - * - * <!ELEMENT LOCALNAMESPACEPATH (NAMESPACE+)> - * - * - * @see String - */ - public static final String LOCALNAMESPACEPATH = "LOCALNAMESPACEPATH"; - - /** - * The HOST element is used to define a single Host.
      - * - * - * <!ELEMENT HOST (#PCDATA)> - * - * - * @see String - */ - public static final String HOST = "HOST"; - - /** - * The NAMESPACE element is used to define a single Namespace component of a - * Namespace path.
      - * - * - * <!ELEMENT NAMESPACE EMPTY> - * <!ATTLIST NAMESPACE - * %CIMName;> - * - * - * @see String - */ - public static final String NAMESPACE = "NAMESPACE"; - - /** - * The CLASSPATH element defines the absolute path to a CIM Class.
      - * - * - * <!ELEMENT CLASSPATH (NAMESPACEPATH,CLASSNAME)> - * - * - * @see String - */ - public static final String CLASSPATH = "CLASSPATH"; - - /** - * The LOCALCLASSPATH element defines the a local path to a CIM Class.
      - * - * - * - * <!ELEMENT LOCALCLASSPATH (LOCALNAMESPACEPATH, CLASSNAME)> - * - * - * - * @see String - */ - public static final String LOCALCLASSPATH = "LOCALCLASSPATH"; - - /** - * The CLASSNAME element defines the qualifying name of a CIM Class.
      - * - * - * <!ELEMENT CLASSNAME EMPTY> - * <!ATTLIST CLASSNAME - * %CIMName;> - * - * - * @see String - */ - public static final String CLASSNAME = "CLASSNAME"; - - /** - * The INSTANCEPATH element defines the absolute path to a CIM Instance.
      - * - * - * <!ELEMENT INSTANCEPATH (NAMESPACEPATH,INSTANCENAME)> - * - * - * @see String - */ - public static final String INSTANCEPATH = "INSTANCEPATH"; - - /** - * The LOCALINSTANCEPATH element defines the local path to a CIM Instance.
      - * - * - * <!ELEMENT LOCALINSTANCEPATH (LOCALNAMESPACEPATH,INSTANCENAME)> - * - * - * @see String - */ - public static final String LOCALINSTANCEPATH = "LOCALINSTANCEPATH"; - - /** - * The INSTANCENAME element defines the location of a CIM Instance within a - * Namespace.
      - * - * - * <!ELEMENT INSTANCENAME (KEYBINDING*|KEYVALUE?|VALUE.REFERENCE?)> - * <!ATTLIST INSTANCENAME - * %ClassName;> - * - * - * @see String - */ - public static final String INSTANCENAME = "INSTANCENAME"; - - /** - * The OBJECTPATH element is used to define a full path to a single CIM - * Object (Class or Instance).
      - * - * - * <!ELEMENT OBJECTPATH (INSTANCEPATH|CLASSPATH)> - * - * - * @see String - */ - public static final String OBJECTPATH = "OBJECTPATH"; - - /** - * The KEYBINDING element defines a single key property value binding.
      - * - * - * <!ELEMENT KEYBINDING (KEYVALUE|VALUE.REFERENCE)> - * <!ATTLIST KEYBINDING - * %CIMName;> - * - * - * @see String - */ - public static final String KEYBINDING = "KEYBINDING"; - - /** - * The KEYVALUE element defines a single property key value when the key - * property is a non-reference type.
      - * - * - * <!ELEMENT KEYVALUE (#PCDATA)> - * <!ATTLIST KEYVALUE - * VALUETYPE (string|boolean|numeric) "string" - * %CIMType; #IMPLIED> - * - * - * @see String - */ - public static final String KEYVALUE = "KEYVALUE"; - - /** - * The CLASS element defines a single CIM Class.
      - * - * - * <!ELEMENT CLASS (QUALIFIER*,(PROPERTY|PROPERTY.ARRAY|PROPERTY.REFERENCE)*,METHOD*)> - * <!ATTLIST CLASS - * %CIMName; - * %SuperClass;> - * - * - * @see String - */ - public static final String CLASS = "CLASS"; - - /** - * The INSTANCE element defines a single CIM Instance of a CIM Class.
      - * - * - * <!ELEMENT INSTANCE (QUALIFIER*,(PROPERTY|PROPERTY.ARRAY|PROPERTY.REFERENCE)*)> - * <!ATTLIST INSTANCE - * %ClassName; - * xml:lang NMTOKEN #IMPLIED> - * - * - * @see String - */ - public static final String INSTANCE = "INSTANCE"; - - /** - * The QUALIFIER element defines a single CIM Qualifier.
      - * - * - * <!ELEMENT QUALIFIER ((VALUE|VALUE.ARRAY)?)> - * <!ATTLIST QUALIFIER - * %CIMName; - * %CIMType; #REQUIRED - * %Propagated; - * %QualifierFlavor; - * xml:lang NMTOKEN #IMPLIED> - * - * - * @see String - */ - public static final String QUALIFIER = "QUALIFIER"; - - /** - * The PROPERTY element defines the value in a CIM Instance or the - * definition in a CIM Class of a single (non-array) CIM Property that is - * not a reference.
      - * - * - * <!ELEMENT PROPERTY (QUALIFIER*,VALUE?)> - * <!ATTLIST PROPERTY - * %CIMName; - * %CIMType; #REQUIRED - * %ClassOrigin; - * %Propagated; - * %EmbeddedObject; - * xml:lang NMTOKEN #IMPLIED> - * - * - * @see String - */ - public static final String PROPERTY = "PROPERTY"; - - /** - * The PROPERTY.ARRAY element defines the value in a CIM Instance or the - * definition in a CIM Class of a single CIM Property with an array type.
      - * - * - * <!ELEMENT PROPERTY.ARRAY (QUALIFIER*,VALUE.ARRAY?)> - * <!ATTLIST PROPERTY.ARRAY - * %CIMName; - * %CIMType; #REQUIRED - * %ArraySize; - * %ClassOrigin; - * %Propagated; - * %EmbeddedObject; - * xml:lang NMTOKEN #IMPLIED> - * - * - * @see String - */ - public static final String PROPERTY_ARRAY = "PROPERTY.ARRAY"; - - /** - * The PROPERTY.REFERENCE element defines the value in a CIM Instance or the - * definition in a CIM Class of a single CIM Property with reference - * semantics.
      - * - * - * <!ELEMENT PROPERTY.REFERENCE (QUALIFIER*,VALUE.REFERENCE?)> - * <!ATTLIST PROPERTY.REFERENCE - * %CIMName; - * %ReferenceClass; - * %ClassOrigin; - * %Propagated;> - * - * - * @see String - */ - public static final String PROPERTY_REFERENCE = "PROPERTY.REFERENCE"; - - /** - * - * The METHOD element defines a single CIM Method.
      - * - * - * <!ELEMENT METHOD (QUALIFIER*,(PARAMETER|PARAMETER.REFERENCE|PARAMETER.ARRAY|PARAMETER.REFARRAY)*)> - * <!ATTLIST METHOD - * %CIMName; - * %CIMType; #IMPLIED - * %ClassOrigin; - * %Propagated;> - * - * - * @see String - */ - public static final String METHOD = "METHOD"; - - /** - * The PARAMETER element defines a single (non-array, non-reference) - * Parameter to a CIM Method.
      - * - * - * <!ELEMENT PARAMETER (QUALIFIER*)> - * <!ATTLIST PARAMETER - * %CIMName; - * %CIMType; #REQUIRED> - * - * - * @see String - */ - public static final String PARAMETER = "PARAMETER"; - - /** - * The PARAMETER.REFERENCE element defines a single reference Parameter to a - * CIM Method.
      - * - * - * <!ELEMENT PARAMETER.REFERENCE (QUALIFIER*)> - * <!ATTLIST PARAMETER.REFERENCE - * %CIMName; - * %ReferenceClass;> - * - * - * @see String - */ - public static final String PARAMETER_REFERENCE = "PARAMETER.REFERENCE"; - - /** - * The PARAMETER.ARRAY element defines a single Parameter to a CIM Method - * that has an array type.
      - * - * - * <!ELEMENT PARAMETER.ARRAY (QUALIFIER*)> - * <!ATTLIST PARAMETER.ARRAY - * %CIMName; - * %CIMType; #REQUIRED - * %ArraySize;> - * - * - * @see String - */ - public static final String PARAMETER_ARRAY = "PARAMETER.ARRAY"; - - /** - * The PARAMETER.REFARRAY element defines a single Parameter to a CIM Method - * that has an array of references type.
      - * - * - * <!ELEMENT PARAMETER.REFARRAY (QUALIFIER*)> - * <!ATTLIST PARAMETER.REFARRAY - * %CIMName; - * %ReferenceClass; - * %ArraySize;> - * - * - * @see String - */ - public static final String PARAMETER_REFARRAY = "PARAMETER.REFARRAY"; - - /* - * TABLE stuff is missing yet - */ - - /** - * The MESSAGE element models a single CIM message.
      - * - * - * <!ELEMENT MESSAGE (SIMPLEREQ|MULTIREQ|SIMPLERSP|MULTIRSP|SIMPLEEXPREQ|MULTIEXPREQ|SIMPLEEXPRSP|MULTIEXPRSP)> - * <!ATTLIST MESSAGE - * ID CDATA #REQUIRED - * PROTOCOLVERSION CDATA #REQUIRED>> - * - * - * @see String - */ - public static final String MESSAGE = "MESSAGE"; - - /** - * The MULTIREQ element defines a Multiple CIM Operation request.
      - * - * - * <!ELEMENT MULTIREQ (SIMPLEREQ,SIMPLEREQ+)> - * - * - * @see String - */ - public static final String MULTIREQ = "MULTIREQ"; - - /** - * The MULTIEXPREQ element defines a Multiple CIM Export request.
      - * - * - * <!ELEMENT MULTIEXPREQ (SIMPLEEXPREQ,SIMPLEEXPREQ+)> - * - * - * @see String - */ - public static final String MULTIEXPREQ = "MULTIEXPREQ"; - - /** - * The SIMPLEREQ element defines a Simple CIM Operation request.
      - * - * - * <!ELEMENT SIMPLEREQ (METHODCALL|IMETHODCALL)> - * - * - * @see String - */ - public static final String SIMPLEREQ = "SIMPLEREQ"; - - /** - * The SIMPLEEXPREQ element defines a Simple CIM Export request.
      - * - * - * <!ELEMENT SIMPLEEXPREQ (EXPMETHODCALL)> - * - * - * @see String - */ - public static final String SIMPLEEXPREQ = "SIMPLEEXPREQ"; - - /** - * The IMETHODCALL element defines a single intrinsic method invocation.
      - * - * - * <!ELEMENT IMETHODCALL (LOCALNAMESPACEPATH,IPARAMVALUE*)> - * <!ATTLIST IMETHODCALL - * %CIMName;> - * - * - * @see String - */ - public static final String IMETHODCALL = "IMETHODCALL"; - - /** - * The METHODCALL element defines a single method invocation on a Class or - * Instance.
      - * - * - * <!ELEMENT METHODCALL ((LOCALCLASSPATH|LOCALINSTANCEPATH),PARAMVALUE*)> - * <!ATTLIST METHODCALL - * %CIMName;> - * - * - * @see String - */ - public static final String METHODCALL = "METHODCALL"; - - /** - * The EXPMETHODCALL element defines a single export method invocation.
      - * - * - * <!ELEMENT EXPMETHODCALL (EXPPARAMVALUE*)> - * <!ATTLIST EXPMETHODCALL - * %CIMName;> - * - * - * @see String - */ - public static final String EXPMETHODCALL = "EXPMETHODCALL"; - - /** - * The PARAMVALUE element defines a single extrinsic method named parameter - * value.
      - * - * - * <!ELEMENT PARAMVALUE (VALUE|VALUE.REFERENCE|VALUE.ARRAY|VALUE.REFARRAY)?> - * <!ATTLIST PARAMVALUE - * %CIMName; - * %ParamType; #IMPLIED - * %EmbeddedObject;> - * - * - * @see String - */ - public static final String PARAMVALUE = "PARAMVALUE"; - - /** - * The IPARAMVALUE element defines a single intrinsic method named parameter - * value.
      - * - * - * <!ELEMENT IPARAMVALUE (VALUE|VALUE.ARRAY|VALUE.REFERENCE|CLASSNAME|INSTANCENAME|QUALIFIER.DECLARATION|CLASS|INSTANCE|VALUE.NAMEDINSTANCE)?> - * <!ATTLIST IPARAMVALUE - * %CIMName;> - * - * - * @see String - */ - public static final String IPARAMVALUE = "IPARAMVALUE"; - - /** - * The EXPPARAMVALUE element defines a single export method named parameter - * value.
      - * - * - * <!ELEMENT EXPPARAMVALUE (INSTANCE?)> - * <!ATTLIST EXPPARAMVALUE - * %CIMName;> - * - * - * @see String - */ - public static final String EXPPARAMVALUE = "EXPPARAMVALUE"; - - /** - * The MULTIRSP element defines a Multiple CIM Operation response.
      - * - * - * <!ELEMENT MULTIRSP (SIMPLERSP,SIMPLERSP+)> - * - * - * @see String - */ - public static final String MULTIRSP = "MULTIRSP"; - - /** - * The MULTIEXPRSP element defines a Multiple CIM Export response.
      - * - * - * <!ELEMENT MULTIEXPRSP (SIMPLEEXPRSP,SIMPLEEXPRSP+)> - * - * - * @see String - */ - public static final String MULTIEXPRSP = "MULTIEXPRSP"; - - /** - * The SIMPLERSP element defines a Simple CIM Operation response.
      - * - * - * <!ELEMENT SIMPLERSP (METHODRESPONSE|IMETHODRESPONSE)> - * - * - * @see String - */ - public static final String SIMPLERSP = "SIMPLERSP"; - - /** - * The SIMPLEEXPRSP element defines a Simple CIM Export response.
      - * - * - * <!ELEMENT SIMPLEEXPRSP (EXPMETHODRESPONSE)> - * - * - * @see String - */ - public static final String SIMPLEEXPRSP = "SIMPLEEXPRSP"; - - /** - * The METHODRESPONSE defines the response to a single CIM extrinsic method - * invocation.
      - * - * - * - * <!ELEMENT METHODRESPONSE (ERROR|(RETURNVALUE?,PARAMVALUE*))> - * <!ATTLIST METHODRESPONSE %CIMName;> - * - * - * - * @see String - */ - public static final String METHODRESPONSE = "METHODRESPONSE"; - - /** - * The EXPMETHODRESPONSE defines the response to a single export method - * invocation.
      - * - * - * <!ELEMENT EXPMETHODRESPONSE (ERROR|IRETURNVALUE?)> - * <!ATTLIST EXPMETHODRESPONSE - * %CIMName;> - * - * - * @see String - */ - public static final String EXPMETHODRESPONSE = "EXPMETHODRESPONSE"; - - /** - * The IMETHODRESPONSE defines the response to a single intrinsic CIM method - * invocation.
      - * - * - * <!ELEMENT IMETHODRESPONSE (ERROR|IRETURNVALUE?)> - * <!ATTLIST IMETHODRESPONSE - * %CIMName;> - * - * - * @see String - */ - public static final String IMETHODRESPONSE = "IMETHODRESPONSE"; - - /** - * The ERROR element is used to define a fundamental error which prevented a - * method from executing normally.
      - * - * - * <!ELEMENT ERROR (INSTANCE*) - * <!ATTLIST ERROR - * CODE CDATA #REQUIRED - * DESCRIPTION CDATA #IMPLIED> - * - * - * @see String - */ - public static final String ERROR = "ERROR"; - - /** - * The RETURNVALUE element specifies the value returned from an extrinsic - * method call.
      - * - * - * <!ELEMENT RETURNVALUE (VALUE|VALUE.REFERENCE)?> - * <!ATTLIST RETURNVALUE - * %EmbeddedObject; - * %ParamType; #IMPLIED> - * - * - * @see String - */ - public static final String RETURNVALUE = "RETURNVALUE"; - - /** - * The IRETURNVALUE element specifies the value returned from an intrinsic - * method call.
      - * - * - * <!ELEMENT IRETURNVALUE (CLASSNAME*|INSTANCENAME*|VALUE*|VALUE.OBJECTWITHPATH*|VALUE.OBJECTWITHLOCALPATH*VALUE.OBJECT*|OBJECTPATH*|QUALIFIER.DECLARATION*|VALUE.ARRAY?|VALUE.REFERENCE?|CLASS*|INSTANCE*|VALUE.NAMEDINSTANCE*)> - * - * - * @see String - */ - public static final String IRETURNVALUE = "IRETURNVALUE"; - - /** - * The CORRELATOR element represents a server-defined operation correlator.
      - * - * - * <!ELEMENT CORRELATOR (VALUE)> - * <!ATTLIST CORRELATOR - * %CIMName; - * %CIMType; #REQUIRED> - * - * - * @see String - */ - public static final String CORRELATOR = "CORRELATOR"; -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings + * 2210455 2008-10-30 blaschke-oss Enhance javadoc, fix potential null pointers + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors + * 2845211 2009-08-27 raman_arora Pull Enumeration Feature (SAX Parser) + * 2666 2013-09-19 blaschke-oss CR12: Remove ENUMERATIONCONTEXT + * 2672 2013-09-26 blaschke-oss Remove SIMPLEREQACK support + * 2690 2013-10-11 blaschke-oss Remove RESPONSEDESTINATION support + * 2538 2013-11-28 blaschke-oss CR14: Support new CORRELATOR element + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +/** + * Class NodeConstIf + * + */ +public interface NodeConstIf { + + /** + * The CIM element is the root element of every XML Document that is valid + * with respect to this schema.
      + * + * + * <!ELEMENT CIM (MESSAGE|DECLARATION)> + * <!ATTLIST CIM + * CIMVERSION CDATA #REQUIRED + * DTDVERSION CDATA #REQUIRED> + * + * + * @see String + */ + public static final String CIM = "CIM"; + + /** + * The DECLARATION element defines a set of one or more declarations of CIM + * objects.
      + * + * + * + * <!ELEMENT DECLARATION (DECLGROUP|DECLGROUP.WITHNAME|DECLGROUP.WITHPATH)+> + * + * + * @see String + */ + public static final String DECLARATION = "DECLARATION"; + + /** + * The DECLGROUP element defines a logical set of CIM Class, Instance and + * Qualifier declarations.
      + * + * + * <!ELEMENT DECLGROUP ((LOCALNAMESPACEPATH|NAMESPACEPATH)?,QUALIFIER.DECLARATION*,VALUE.OBJECT*)> + * + * + * @see String + */ + public static final String DECLGROUP = "DECLGROUP"; + + /** + * The DECLGROUP.WITHNAME element defines a logical set of CIM Class, + * Instance and Qualifier declarations.
      + * + * + * <!ELEMENT DECLGROUP.WITHNAME ((LOCALNAMESPACEPATH|NAMESPACEPATH)?,QUALIFIER.DECLARATION*,VALUE.NAMEDOBJECT*)> + * + * + * @see String + */ + public static final String DECLGROUP_WITHNAME = "DECLGROUP.WITHNAME"; + + /** + * The DECLGROUP.WITHPATH element defines a logical set of CIM Class and + * Instance declarations.
      + * + * + * <!ELEMENT DECLGROUP.WITHPATH (VALUE.OBJECTWITHPATH|VALUE.OBJECTWITHLOCALPATH)*> + * + * + * @see String + */ + public static final String DECLGROUP_WITHPATH = "DECLGROUP.WITHPATH"; + + /** + * The QUALIFIER.DECLARATION element defines a single CIM Qualifier + * declaration.
      + * + * + * <!ELEMENT QUALIFIER.DECLARATION (SCOPE?,(VALUE|VALUE.ARRAY)?)> + * <!ATTLIST QUALIFIER.DECLARATION + * %CIMName; + * %CIMType; #REQUIRED + * ISARRAY (true|false) #IMPLIED + * %ArraySize; + * %QualifierFlavor;> + * + * + * @see String + */ + public static final String QUALIFIER_DECLARATION = "QUALIFIER.DECLARATION"; + + /** + * The SCOPE element defines the scope of a QUALIFIER.DECLARATION in the + * case that there are restrictions on the scope of the Qualifier + * declaration.
      + * + * + * <!ELEMENT SCOPE EMPTY> + * <!ATTLIST SCOPE + * CLASS (true|false) "false" + * ASSOCIATION (true|false) "false" + * REFERENCE (true|false) "false" + * PROPERTY (true|false) "false" + * METHOD (true|false) "false" + * PARAMETER (true|false) "false" + * INDICATION (true|false) "false"> + * + * + * @see String + */ + public static final String SCOPE = "SCOPE"; + + /** + * The VALUE element is used to define a single (non-array) non-reference + * non-NULL CIM Property value, CIM Qualifier value, CIM Method return + * value, or CIM Method Parameter value.
      + * + * + * <!ELEMENT VALUE (#PCDATA)> + * + * + * @see String + */ + public static final String VALUE = "VALUE"; + + /** + * The VALUE.ARRAY element is used to represent the value of a CIM Property + * or Qualifier that has an array type.
      + * + * + * + * <!ELEMENT VALUE.ARRAY (VALUE|VALUE.NULL)*> + * + * + * @see String + */ + public static final String VALUE_ARRAY = "VALUE.ARRAY"; + + /** + * The VALUE.REFERENCE element is used to define a single CIM reference + * Property value.
      + * + * + * <!ELEMENT VALUE.REFERENCE (CLASSPATH|LOCALCLASSPATH|CLASSNAME|INSTANCEPATH|LOCALINSTANCEPATH|INSTANCENAME)> + * + * + * @see String + */ + public static final String VALUE_REFERENCE = "VALUE.REFERENCE"; + + /** + * The VALUE.REFARRAY element is used to represent the value of an array of + * CIM references.
      + * + * + * <!ELEMENT VALUE.REFARRAY (VALUE.REFERENCE|VALUE.NULL)*> + * + * + * @see String + */ + public static final String VALUE_REFARRAY = "VALUE.REFARRAY"; + + /** + * The VALUE.OBJECT element is used to define a value which is comprised of + * a single CIM Class or Instance definition.
      + * + * + * <!ELEMENT VALUE.OBJECT (CLASS|INSTANCE)> + * + * + * @see String + */ + public static final String VALUE_OBJECT = "VALUE.OBJECT"; + + /** + * The VALUE.NAMEDINSTANCE element is used to define a value which is + * comprised of a single named CIM Instance definition.
      + * + * + * + * <!ELEMENT VALUE.NAMEDINSTANCE (INSTANCENAME,INSTANCE)> + * + * + * @see String + */ + public static final String VALUE_NAMEDINSTANCE = "VALUE.NAMEDINSTANCE"; + + /** + * The VALUE.NAMEDOBJECT element is used to define a value which is + * comprised of a single named CIM Class or Instance definition.
      + * + * + * <!ELEMENT VALUE.NAMEDOBJECT (CLASS|(INSTANCENAME,INSTANCE))> + * + * + * @see String + */ + public static final String VALUE_NAMEDOBJECT = "VALUE.NAMEDOBJECT"; + + /** + * The VALUE.OBJECTWITHLOCALPATH element is used to define a value which is + * comprised of a single CIM Object (Class or Instance) definition with + * additional information that defines the local path to that Object.
      + * + * + * <!ELEMENT VALUE.OBJECTWITHLOCALPATH ((LOCALCLASSPATH,CLASS)|(LOCALINSTANCEPATH,INSTANCE))> + * + * + * @see String + */ + public static final String VALUE_OBJECTWITHLOCALPATH = "VALUE.OBJECTWITHLOCALPATH"; + + /** + * The VALUE.OBJECTWITHPATH element is used to define a value which is + * comprised of a single CIM Object (Class or Instance) definition with + * additional information that defines the absolute path to that Object.
      + * + * + * <!ELEMENT VALUE.OBJECTWITHPATH ((CLASSPATH,CLASS)|(INSTANCEPATH,INSTANCE))> + * + * + * @see String + */ + public static final String VALUE_OBJECTWITHPATH = "VALUE.OBJECTWITHPATH"; + + /** + * The VALUE.NULL element is used to represent a NULL value.
      + * + * + * <!ELEMENT VALUE.NULL EMPTY> + * + * + * @see String + */ + public static final String VALUE_NULL = "VALUE.NULL"; + + /** + * The VALUE.INSTANCEWITHPATH element is used to define value that comprises + * a single CIM instance definition with additional information that defines + * the absolute path to that object.
      + * + * + * <!ELEMENT VALUE.INSTANCEWITHPATH (INSTANCEPATH, INSTANCE)> + * + * + * @see String + */ + public static final String VALUE_INSTANCEWITHPATH = "VALUE.INSTANCEWITHPATH"; + + /** + * The NAMESPACEPATH element is used to define a Namespace Path.
      + * + * + * <!ELEMENT NAMESPACEPATH (HOST,LOCALNAMESPACEPATH)> + * + * + * @see String + */ + public static final String NAMESPACEPATH = "NAMESPACEPATH"; + + /** + * The LOCALNAMESPACEPATH element is used to define a local Namespace path + * (one without a Host component).
      + * + * + * <!ELEMENT LOCALNAMESPACEPATH (NAMESPACE+)> + * + * + * @see String + */ + public static final String LOCALNAMESPACEPATH = "LOCALNAMESPACEPATH"; + + /** + * The HOST element is used to define a single Host.
      + * + * + * <!ELEMENT HOST (#PCDATA)> + * + * + * @see String + */ + public static final String HOST = "HOST"; + + /** + * The NAMESPACE element is used to define a single Namespace component of a + * Namespace path.
      + * + * + * <!ELEMENT NAMESPACE EMPTY> + * <!ATTLIST NAMESPACE + * %CIMName;> + * + * + * @see String + */ + public static final String NAMESPACE = "NAMESPACE"; + + /** + * The CLASSPATH element defines the absolute path to a CIM Class.
      + * + * + * <!ELEMENT CLASSPATH (NAMESPACEPATH,CLASSNAME)> + * + * + * @see String + */ + public static final String CLASSPATH = "CLASSPATH"; + + /** + * The LOCALCLASSPATH element defines the a local path to a CIM Class.
      + * + * + * + * <!ELEMENT LOCALCLASSPATH (LOCALNAMESPACEPATH, CLASSNAME)> + * + * + * + * @see String + */ + public static final String LOCALCLASSPATH = "LOCALCLASSPATH"; + + /** + * The CLASSNAME element defines the qualifying name of a CIM Class.
      + * + * + * <!ELEMENT CLASSNAME EMPTY> + * <!ATTLIST CLASSNAME + * %CIMName;> + * + * + * @see String + */ + public static final String CLASSNAME = "CLASSNAME"; + + /** + * The INSTANCEPATH element defines the absolute path to a CIM Instance.
      + * + * + * <!ELEMENT INSTANCEPATH (NAMESPACEPATH,INSTANCENAME)> + * + * + * @see String + */ + public static final String INSTANCEPATH = "INSTANCEPATH"; + + /** + * The LOCALINSTANCEPATH element defines the local path to a CIM Instance.
      + * + * + * <!ELEMENT LOCALINSTANCEPATH (LOCALNAMESPACEPATH,INSTANCENAME)> + * + * + * @see String + */ + public static final String LOCALINSTANCEPATH = "LOCALINSTANCEPATH"; + + /** + * The INSTANCENAME element defines the location of a CIM Instance within a + * Namespace.
      + * + * + * <!ELEMENT INSTANCENAME (KEYBINDING*|KEYVALUE?|VALUE.REFERENCE?)> + * <!ATTLIST INSTANCENAME + * %ClassName;> + * + * + * @see String + */ + public static final String INSTANCENAME = "INSTANCENAME"; + + /** + * The OBJECTPATH element is used to define a full path to a single CIM + * Object (Class or Instance).
      + * + * + * <!ELEMENT OBJECTPATH (INSTANCEPATH|CLASSPATH)> + * + * + * @see String + */ + public static final String OBJECTPATH = "OBJECTPATH"; + + /** + * The KEYBINDING element defines a single key property value binding.
      + * + * + * <!ELEMENT KEYBINDING (KEYVALUE|VALUE.REFERENCE)> + * <!ATTLIST KEYBINDING + * %CIMName;> + * + * + * @see String + */ + public static final String KEYBINDING = "KEYBINDING"; + + /** + * The KEYVALUE element defines a single property key value when the key + * property is a non-reference type.
      + * + * + * <!ELEMENT KEYVALUE (#PCDATA)> + * <!ATTLIST KEYVALUE + * VALUETYPE (string|boolean|numeric) "string" + * %CIMType; #IMPLIED> + * + * + * @see String + */ + public static final String KEYVALUE = "KEYVALUE"; + + /** + * The CLASS element defines a single CIM Class.
      + * + * + * <!ELEMENT CLASS (QUALIFIER*,(PROPERTY|PROPERTY.ARRAY|PROPERTY.REFERENCE)*,METHOD*)> + * <!ATTLIST CLASS + * %CIMName; + * %SuperClass;> + * + * + * @see String + */ + public static final String CLASS = "CLASS"; + + /** + * The INSTANCE element defines a single CIM Instance of a CIM Class.
      + * + * + * <!ELEMENT INSTANCE (QUALIFIER*,(PROPERTY|PROPERTY.ARRAY|PROPERTY.REFERENCE)*)> + * <!ATTLIST INSTANCE + * %ClassName; + * xml:lang NMTOKEN #IMPLIED> + * + * + * @see String + */ + public static final String INSTANCE = "INSTANCE"; + + /** + * The QUALIFIER element defines a single CIM Qualifier.
      + * + * + * <!ELEMENT QUALIFIER ((VALUE|VALUE.ARRAY)?)> + * <!ATTLIST QUALIFIER + * %CIMName; + * %CIMType; #REQUIRED + * %Propagated; + * %QualifierFlavor; + * xml:lang NMTOKEN #IMPLIED> + * + * + * @see String + */ + public static final String QUALIFIER = "QUALIFIER"; + + /** + * The PROPERTY element defines the value in a CIM Instance or the + * definition in a CIM Class of a single (non-array) CIM Property that is + * not a reference.
      + * + * + * <!ELEMENT PROPERTY (QUALIFIER*,VALUE?)> + * <!ATTLIST PROPERTY + * %CIMName; + * %CIMType; #REQUIRED + * %ClassOrigin; + * %Propagated; + * %EmbeddedObject; + * xml:lang NMTOKEN #IMPLIED> + * + * + * @see String + */ + public static final String PROPERTY = "PROPERTY"; + + /** + * The PROPERTY.ARRAY element defines the value in a CIM Instance or the + * definition in a CIM Class of a single CIM Property with an array type.
      + * + * + * <!ELEMENT PROPERTY.ARRAY (QUALIFIER*,VALUE.ARRAY?)> + * <!ATTLIST PROPERTY.ARRAY + * %CIMName; + * %CIMType; #REQUIRED + * %ArraySize; + * %ClassOrigin; + * %Propagated; + * %EmbeddedObject; + * xml:lang NMTOKEN #IMPLIED> + * + * + * @see String + */ + public static final String PROPERTY_ARRAY = "PROPERTY.ARRAY"; + + /** + * The PROPERTY.REFERENCE element defines the value in a CIM Instance or the + * definition in a CIM Class of a single CIM Property with reference + * semantics.
      + * + * + * <!ELEMENT PROPERTY.REFERENCE (QUALIFIER*,VALUE.REFERENCE?)> + * <!ATTLIST PROPERTY.REFERENCE + * %CIMName; + * %ReferenceClass; + * %ClassOrigin; + * %Propagated;> + * + * + * @see String + */ + public static final String PROPERTY_REFERENCE = "PROPERTY.REFERENCE"; + + /** + * + * The METHOD element defines a single CIM Method.
      + * + * + * <!ELEMENT METHOD (QUALIFIER*,(PARAMETER|PARAMETER.REFERENCE|PARAMETER.ARRAY|PARAMETER.REFARRAY)*)> + * <!ATTLIST METHOD + * %CIMName; + * %CIMType; #IMPLIED + * %ClassOrigin; + * %Propagated;> + * + * + * @see String + */ + public static final String METHOD = "METHOD"; + + /** + * The PARAMETER element defines a single (non-array, non-reference) + * Parameter to a CIM Method.
      + * + * + * <!ELEMENT PARAMETER (QUALIFIER*)> + * <!ATTLIST PARAMETER + * %CIMName; + * %CIMType; #REQUIRED> + * + * + * @see String + */ + public static final String PARAMETER = "PARAMETER"; + + /** + * The PARAMETER.REFERENCE element defines a single reference Parameter to a + * CIM Method.
      + * + * + * <!ELEMENT PARAMETER.REFERENCE (QUALIFIER*)> + * <!ATTLIST PARAMETER.REFERENCE + * %CIMName; + * %ReferenceClass;> + * + * + * @see String + */ + public static final String PARAMETER_REFERENCE = "PARAMETER.REFERENCE"; + + /** + * The PARAMETER.ARRAY element defines a single Parameter to a CIM Method + * that has an array type.
      + * + * + * <!ELEMENT PARAMETER.ARRAY (QUALIFIER*)> + * <!ATTLIST PARAMETER.ARRAY + * %CIMName; + * %CIMType; #REQUIRED + * %ArraySize;> + * + * + * @see String + */ + public static final String PARAMETER_ARRAY = "PARAMETER.ARRAY"; + + /** + * The PARAMETER.REFARRAY element defines a single Parameter to a CIM Method + * that has an array of references type.
      + * + * + * <!ELEMENT PARAMETER.REFARRAY (QUALIFIER*)> + * <!ATTLIST PARAMETER.REFARRAY + * %CIMName; + * %ReferenceClass; + * %ArraySize;> + * + * + * @see String + */ + public static final String PARAMETER_REFARRAY = "PARAMETER.REFARRAY"; + + /* + * TABLE stuff is missing yet + */ + + /** + * The MESSAGE element models a single CIM message.
      + * + * + * <!ELEMENT MESSAGE (SIMPLEREQ|MULTIREQ|SIMPLERSP|MULTIRSP|SIMPLEEXPREQ|MULTIEXPREQ|SIMPLEEXPRSP|MULTIEXPRSP)> + * <!ATTLIST MESSAGE + * ID CDATA #REQUIRED + * PROTOCOLVERSION CDATA #REQUIRED>> + * + * + * @see String + */ + public static final String MESSAGE = "MESSAGE"; + + /** + * The MULTIREQ element defines a Multiple CIM Operation request.
      + * + * + * <!ELEMENT MULTIREQ (SIMPLEREQ,SIMPLEREQ+)> + * + * + * @see String + */ + public static final String MULTIREQ = "MULTIREQ"; + + /** + * The MULTIEXPREQ element defines a Multiple CIM Export request.
      + * + * + * <!ELEMENT MULTIEXPREQ (SIMPLEEXPREQ,SIMPLEEXPREQ+)> + * + * + * @see String + */ + public static final String MULTIEXPREQ = "MULTIEXPREQ"; + + /** + * The SIMPLEREQ element defines a Simple CIM Operation request.
      + * + * + * <!ELEMENT SIMPLEREQ (METHODCALL|IMETHODCALL)> + * + * + * @see String + */ + public static final String SIMPLEREQ = "SIMPLEREQ"; + + /** + * The SIMPLEEXPREQ element defines a Simple CIM Export request.
      + * + * + * <!ELEMENT SIMPLEEXPREQ (EXPMETHODCALL)> + * + * + * @see String + */ + public static final String SIMPLEEXPREQ = "SIMPLEEXPREQ"; + + /** + * The IMETHODCALL element defines a single intrinsic method invocation.
      + * + * + * <!ELEMENT IMETHODCALL (LOCALNAMESPACEPATH,IPARAMVALUE*)> + * <!ATTLIST IMETHODCALL + * %CIMName;> + * + * + * @see String + */ + public static final String IMETHODCALL = "IMETHODCALL"; + + /** + * The METHODCALL element defines a single method invocation on a Class or + * Instance.
      + * + * + * <!ELEMENT METHODCALL ((LOCALCLASSPATH|LOCALINSTANCEPATH),PARAMVALUE*)> + * <!ATTLIST METHODCALL + * %CIMName;> + * + * + * @see String + */ + public static final String METHODCALL = "METHODCALL"; + + /** + * The EXPMETHODCALL element defines a single export method invocation.
      + * + * + * <!ELEMENT EXPMETHODCALL (EXPPARAMVALUE*)> + * <!ATTLIST EXPMETHODCALL + * %CIMName;> + * + * + * @see String + */ + public static final String EXPMETHODCALL = "EXPMETHODCALL"; + + /** + * The PARAMVALUE element defines a single extrinsic method named parameter + * value.
      + * + * + * <!ELEMENT PARAMVALUE (VALUE|VALUE.REFERENCE|VALUE.ARRAY|VALUE.REFARRAY)?> + * <!ATTLIST PARAMVALUE + * %CIMName; + * %ParamType; #IMPLIED + * %EmbeddedObject;> + * + * + * @see String + */ + public static final String PARAMVALUE = "PARAMVALUE"; + + /** + * The IPARAMVALUE element defines a single intrinsic method named parameter + * value.
      + * + * + * <!ELEMENT IPARAMVALUE (VALUE|VALUE.ARRAY|VALUE.REFERENCE|CLASSNAME|INSTANCENAME|QUALIFIER.DECLARATION|CLASS|INSTANCE|VALUE.NAMEDINSTANCE)?> + * <!ATTLIST IPARAMVALUE + * %CIMName;> + * + * + * @see String + */ + public static final String IPARAMVALUE = "IPARAMVALUE"; + + /** + * The EXPPARAMVALUE element defines a single export method named parameter + * value.
      + * + * + * <!ELEMENT EXPPARAMVALUE (INSTANCE?)> + * <!ATTLIST EXPPARAMVALUE + * %CIMName;> + * + * + * @see String + */ + public static final String EXPPARAMVALUE = "EXPPARAMVALUE"; + + /** + * The MULTIRSP element defines a Multiple CIM Operation response.
      + * + * + * <!ELEMENT MULTIRSP (SIMPLERSP,SIMPLERSP+)> + * + * + * @see String + */ + public static final String MULTIRSP = "MULTIRSP"; + + /** + * The MULTIEXPRSP element defines a Multiple CIM Export response.
      + * + * + * <!ELEMENT MULTIEXPRSP (SIMPLEEXPRSP,SIMPLEEXPRSP+)> + * + * + * @see String + */ + public static final String MULTIEXPRSP = "MULTIEXPRSP"; + + /** + * The SIMPLERSP element defines a Simple CIM Operation response.
      + * + * + * <!ELEMENT SIMPLERSP (METHODRESPONSE|IMETHODRESPONSE)> + * + * + * @see String + */ + public static final String SIMPLERSP = "SIMPLERSP"; + + /** + * The SIMPLEEXPRSP element defines a Simple CIM Export response.
      + * + * + * <!ELEMENT SIMPLEEXPRSP (EXPMETHODRESPONSE)> + * + * + * @see String + */ + public static final String SIMPLEEXPRSP = "SIMPLEEXPRSP"; + + /** + * The METHODRESPONSE defines the response to a single CIM extrinsic method + * invocation.
      + * + * + * + * <!ELEMENT METHODRESPONSE (ERROR|(RETURNVALUE?,PARAMVALUE*))> + * <!ATTLIST METHODRESPONSE %CIMName;> + * + * + * + * @see String + */ + public static final String METHODRESPONSE = "METHODRESPONSE"; + + /** + * The EXPMETHODRESPONSE defines the response to a single export method + * invocation.
      + * + * + * <!ELEMENT EXPMETHODRESPONSE (ERROR|IRETURNVALUE?)> + * <!ATTLIST EXPMETHODRESPONSE + * %CIMName;> + * + * + * @see String + */ + public static final String EXPMETHODRESPONSE = "EXPMETHODRESPONSE"; + + /** + * The IMETHODRESPONSE defines the response to a single intrinsic CIM method + * invocation.
      + * + * + * <!ELEMENT IMETHODRESPONSE (ERROR|IRETURNVALUE?)> + * <!ATTLIST IMETHODRESPONSE + * %CIMName;> + * + * + * @see String + */ + public static final String IMETHODRESPONSE = "IMETHODRESPONSE"; + + /** + * The ERROR element is used to define a fundamental error which prevented a + * method from executing normally.
      + * + * + * <!ELEMENT ERROR (INSTANCE*) + * <!ATTLIST ERROR + * CODE CDATA #REQUIRED + * DESCRIPTION CDATA #IMPLIED> + * + * + * @see String + */ + public static final String ERROR = "ERROR"; + + /** + * The RETURNVALUE element specifies the value returned from an extrinsic + * method call.
      + * + * + * <!ELEMENT RETURNVALUE (VALUE|VALUE.REFERENCE)?> + * <!ATTLIST RETURNVALUE + * %EmbeddedObject; + * %ParamType; #IMPLIED> + * + * + * @see String + */ + public static final String RETURNVALUE = "RETURNVALUE"; + + /** + * The IRETURNVALUE element specifies the value returned from an intrinsic + * method call.
      + * + * + * <!ELEMENT IRETURNVALUE (CLASSNAME*|INSTANCENAME*|VALUE*|VALUE.OBJECTWITHPATH*|VALUE.OBJECTWITHLOCALPATH*VALUE.OBJECT*|OBJECTPATH*|QUALIFIER.DECLARATION*|VALUE.ARRAY?|VALUE.REFERENCE?|CLASS*|INSTANCE*|VALUE.NAMEDINSTANCE*)> + * + * + * @see String + */ + public static final String IRETURNVALUE = "IRETURNVALUE"; + + /** + * The CORRELATOR element represents a server-defined operation correlator.
      + * + * + * <!ELEMENT CORRELATOR (VALUE)> + * <!ATTLIST CORRELATOR + * %CIMName; + * %CIMType; #REQUIRED> + * + * + * @see String + */ + public static final String CORRELATOR = "CORRELATOR"; +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/NodeFactory.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/NodeFactory.java similarity index 89% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/NodeFactory.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/NodeFactory.java index 3e5aaaf..c21cd6d 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/NodeFactory.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/NodeFactory.java @@ -1,492 +1,490 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2845211 2009-08-27 raman_arora Pull Enumeration Feature (SAX Parser) - * 3498482 2012-03-09 blaschke-oss Red Hat: Possible XML Hash DoS in sblim - * 3535383 2012-08-01 blaschke-oss HashDoS fix 3498482 - * 2672 2013-09-26 blaschke-oss Remove SIMPLEREQACK support - * 2690 2013-10-11 blaschke-oss Remove RESPONSEDESTINATION support - * 2538 2013-11-28 blaschke-oss CR14: Support new CORRELATOR element - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.HashMap; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node.*; - -/** - * Class NodeFactory is responsible for Node instance construction. - * - */ -public class NodeFactory implements NodeConstIf { - - /** - * getNodeInstance - * - * @param pNodeName - * Should be an XML element name constant which is defined in - * NodeConstIf - * @return the Node subclass which implements the parsing of pNodeName named - * XML Element. - */ - public static Node getNodeInstance(String pNodeName) { - createParserMap(); - return cParserMap.get(pNodeName).create(); - } - - /** - * getEnum - * - * @param pNodeName - * @return The corresponding String constant for an XML element name. It - * must be used, because the Node subclasses use reference based - * equals comparisons (==). - */ - public static String getEnum(String pNodeName) { - return NODENAME_HASH.get(pNodeName); - } - - private static HashMap cParserMap; - - private interface FactoryEntry { - - /** - * create - * - * @return Node - */ - public Node create(); - } - - private synchronized static void createParserMap() { - if (cParserMap != null) return; - cParserMap = new HashMap(); - cParserMap.put(CIM, new FactoryEntry() { - - public Node create() { - return new CIMNode(); - } - }); - // DECLARATION - not implemented - // DECLGROUP - not implemented - // DECLGROUP.WITHNAME - not implemented - // DECLGROUP.WITHPATH - not implemented - cParserMap.put(QUALIFIER_DECLARATION, new FactoryEntry() { - - public Node create() { - return new QualiDeclNode(); - } - }); - cParserMap.put(SCOPE, new FactoryEntry() { - - public Node create() { - return new ScopeNode(); - } - }); - cParserMap.put(VALUE, new FactoryEntry() { - - public Node create() { - return new ValueNode(); - } - }); - cParserMap.put(VALUE_ARRAY, new FactoryEntry() { - - public Node create() { - return new ValueArrayNode(); - } - }); - cParserMap.put(VALUE_REFERENCE, new FactoryEntry() { - - public Node create() { - return new ValueReferenceNode(); - } - }); - cParserMap.put(VALUE_REFARRAY, new FactoryEntry() { - - public Node create() { - return new ValueRefArrayNode(); - } - }); - cParserMap.put(VALUE_OBJECT, new FactoryEntry() { - - public Node create() { - return new ValueObjectNode(); - } - }); - cParserMap.put(VALUE_NAMEDINSTANCE, new FactoryEntry() { - - public Node create() { - return new ValueNamedInstanceNode(); - } - }); - cParserMap.put(VALUE_OBJECTWITHLOCALPATH, new FactoryEntry() { - - public Node create() { - return new ValueObjectWithLocalPathNode(); - } - }); - cParserMap.put(VALUE_OBJECTWITHPATH, new FactoryEntry() { - - public Node create() { - return new ValueObjectWithPathNode(); - } - }); - cParserMap.put(VALUE_NULL, new FactoryEntry() { - - public Node create() { - return new ValueNullNode(); - } - }); - cParserMap.put(VALUE_INSTANCEWITHPATH, new FactoryEntry() { - - public Node create() { - return new ValueInstanceWithPathNode(); - } - }); - cParserMap.put(NAMESPACEPATH, new FactoryEntry() { - - public Node create() { - return new NameSpacePathNode(); - } - }); - cParserMap.put(LOCALNAMESPACEPATH, new FactoryEntry() { - - public Node create() { - return new LocalNameSpacePathNode(); - } - }); - cParserMap.put(HOST, new FactoryEntry() { - - public Node create() { - return new HostNode(); - } - }); - cParserMap.put(NAMESPACE, new FactoryEntry() { - - public Node create() { - return new NameSpaceNode(); - } - }); - cParserMap.put(CLASSPATH, new FactoryEntry() { - - public Node create() { - return new ClassPathNode(); - } - }); - cParserMap.put(LOCALCLASSPATH, new FactoryEntry() { - - public Node create() { - return new LocalClassPathNode(); - } - }); - cParserMap.put(CLASSNAME, new FactoryEntry() { - - public Node create() { - return new ClassNameNode(); - } - }); - cParserMap.put(INSTANCEPATH, new FactoryEntry() { - - public Node create() { - return new InstancePathNode(); - } - }); - cParserMap.put(LOCALINSTANCEPATH, new FactoryEntry() { - - public Node create() { - return new LocalInstancePathNode(); - } - }); - cParserMap.put(INSTANCENAME, new FactoryEntry() { - - public Node create() { - return new InstanceNameNode(); - } - }); - cParserMap.put(OBJECTPATH, new FactoryEntry() { - - public Node create() { - return new ObjectPathNode(); - } - }); - cParserMap.put(KEYBINDING, new FactoryEntry() { - - public Node create() { - return new KeyBindingNode(); - } - }); - cParserMap.put(KEYVALUE, new FactoryEntry() { - - public Node create() { - return new KeyValueNode(); - } - }); - cParserMap.put(CLASS, new FactoryEntry() { - - public Node create() { - return new ClassNode(); - } - }); - cParserMap.put(INSTANCE, new FactoryEntry() { - - public Node create() { - return new InstanceNode(); - } - }); - cParserMap.put(QUALIFIER, new FactoryEntry() { - - public Node create() { - return new QualifierNode(); - } - }); - cParserMap.put(PROPERTY, new FactoryEntry() { - - public Node create() { - return new PropertyNode(); - } - }); - cParserMap.put(PROPERTY_ARRAY, new FactoryEntry() { - - public Node create() { - return new PropertyArrayNode(); - } - }); - cParserMap.put(PROPERTY_REFERENCE, new FactoryEntry() { - - public Node create() { - return new PropertyReferenceNode(); - } - }); - cParserMap.put(METHOD, new FactoryEntry() { - - public Node create() { - return new MethodNode(); - } - }); - cParserMap.put(PARAMETER, new FactoryEntry() { - - public Node create() { - return new ParameterNode(); - } - }); - cParserMap.put(PARAMETER_REFERENCE, new FactoryEntry() { - - public Node create() { - return new ParameterReferenceNode(); - } - }); - cParserMap.put(PARAMETER_ARRAY, new FactoryEntry() { - - public Node create() { - return new ParameterArrayNode(); - } - }); - cParserMap.put(PARAMETER_REFARRAY, new FactoryEntry() { - - public Node create() { - return new ParameterRefArrayNode(); - } - }); - cParserMap.put(MESSAGE, new FactoryEntry() { - - public Node create() { - return new MessageNode(); - } - }); - cParserMap.put(MULTIREQ, new FactoryEntry() { - - public Node create() { - return new MultiReqNode(); - } - }); - cParserMap.put(MULTIEXPREQ, new FactoryEntry() { - - public Node create() { - return new MultiExpReqNode(); - } - }); - cParserMap.put(SIMPLEREQ, new FactoryEntry() { - - public Node create() { - return new SimpleReqNode(); - } - }); - cParserMap.put(SIMPLEEXPREQ, new FactoryEntry() { - - public Node create() { - return new SimpleExpReqNode(); - } - }); - cParserMap.put(IMETHODCALL, new FactoryEntry() { - - public Node create() { - return new IMethodCallNode(); - } - }); - cParserMap.put(METHODCALL, new FactoryEntry() { - - public Node create() { - return new MethodCallNode(); - } - }); - cParserMap.put(EXPMETHODCALL, new FactoryEntry() { - - public Node create() { - return new ExpMethodCallNode(); - } - }); - cParserMap.put(PARAMVALUE, new FactoryEntry() { - - public Node create() { - return new ParamValueNode(); - } - }); - cParserMap.put(IPARAMVALUE, new FactoryEntry() { - - public Node create() { - return new IParamValueNode(); - } - }); - cParserMap.put(EXPPARAMVALUE, new FactoryEntry() { - - public Node create() { - return new ExpParamValueNode(); - } - }); - cParserMap.put(MULTIRSP, new FactoryEntry() { - - public Node create() { - return new MultiRspNode(); - } - }); - cParserMap.put(MULTIEXPRSP, new FactoryEntry() { - - public Node create() { - return new MultiExpRspNode(); - } - }); - cParserMap.put(SIMPLERSP, new FactoryEntry() { - - public Node create() { - return new SimpleRspNode(); - } - }); - cParserMap.put(SIMPLEEXPRSP, new FactoryEntry() { - - public Node create() { - return new SimpleExpRspNode(); - } - }); - cParserMap.put(METHODRESPONSE, new FactoryEntry() { - - public Node create() { - return new MethodResponseNode(); - } - }); - cParserMap.put(EXPMETHODRESPONSE, new FactoryEntry() { - - public Node create() { - return new ExpMethodResponseNode(); - } - }); - cParserMap.put(IMETHODRESPONSE, new FactoryEntry() { - - public Node create() { - return new IMethodResponseNode(); - } - }); - cParserMap.put(ERROR, new FactoryEntry() { - - public Node create() { - return new ErrorNode(); - } - }); - cParserMap.put(RETURNVALUE, new FactoryEntry() { - - public Node create() { - return new ReturnValueNode(); - } - }); - cParserMap.put(IRETURNVALUE, new FactoryEntry() { - - public Node create() { - return new IReturnValueNode(); - } - }); - cParserMap.put(CORRELATOR, new FactoryEntry() { - - public Node create() { - return new CorrelatorNode(); - } - }); - } - - private static final HashMap NODENAME_HASH = new HashMap(); - - private static void initNodeNameHash(String[] pEnumA) { - for (int i = 0; i < pEnumA.length; i++) - NODENAME_HASH.put(pEnumA[i], pEnumA[i]); - } - - static { - initNodeNameHash(new String[] { CIM, DECLARATION, DECLGROUP, DECLGROUP_WITHNAME, - DECLGROUP_WITHPATH, QUALIFIER_DECLARATION, SCOPE, VALUE, VALUE_ARRAY, - VALUE_REFERENCE, VALUE_REFARRAY, VALUE_OBJECT, VALUE_NAMEDINSTANCE, - VALUE_NAMEDOBJECT, VALUE_OBJECTWITHLOCALPATH, VALUE_OBJECTWITHPATH, VALUE_NULL, - VALUE_INSTANCEWITHPATH, - - NAMESPACEPATH, LOCALNAMESPACEPATH, HOST, NAMESPACE, CLASSPATH, LOCALCLASSPATH, - CLASSNAME, INSTANCEPATH, LOCALINSTANCEPATH, INSTANCENAME, OBJECTPATH, KEYBINDING, - KEYVALUE, - - CLASS, INSTANCE, QUALIFIER, PROPERTY, PROPERTY_ARRAY, PROPERTY_REFERENCE, METHOD, - PARAMETER, PARAMETER_REFERENCE, PARAMETER_ARRAY, PARAMETER_REFARRAY, - - /* - * TABLE stuff is missing yet - */ - MESSAGE, MULTIREQ, MULTIEXPREQ, SIMPLEREQ, SIMPLEEXPREQ, IMETHODCALL, METHODCALL, - EXPMETHODCALL, PARAMVALUE, IPARAMVALUE, EXPPARAMVALUE, MULTIRSP, MULTIEXPRSP, - SIMPLERSP, SIMPLEEXPRSP, METHODRESPONSE, EXPMETHODRESPONSE, IMETHODRESPONSE, ERROR, - RETURNVALUE, IRETURNVALUE, CORRELATOR }); - } - -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2845211 2009-08-27 raman_arora Pull Enumeration Feature (SAX Parser) + * 3498482 2012-03-09 blaschke-oss Red Hat: Possible XML Hash DoS in sblim + * 3535383 2012-08-01 blaschke-oss HashDoS fix 3498482 + * 2672 2013-09-26 blaschke-oss Remove SIMPLEREQACK support + * 2690 2013-10-11 blaschke-oss Remove RESPONSEDESTINATION support + * 2538 2013-11-28 blaschke-oss CR14: Support new CORRELATOR element + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.HashMap; + +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node.*; + +/** + * Class NodeFactory is responsible for Node instance construction. + * + */ +public class NodeFactory implements NodeConstIf { + + /** + * getNodeInstance + * + * @param pNodeName + * Should be an XML element name constant which is defined in + * NodeConstIf + * @return the Node subclass which implements the parsing of pNodeName named + * XML Element. + */ + public static Node getNodeInstance(String pNodeName) { + createParserMap(); + return cParserMap.get(pNodeName).create(); + } + + /** + * getEnum + * + * @param pNodeName + * @return The corresponding String constant for an XML element name. It + * must be used, because the Node subclasses use reference based + * equals comparisons (==). + */ + public static String getEnum(String pNodeName) { + return NODENAME_HASH.get(pNodeName); + } + + private static HashMap cParserMap; + + private interface FactoryEntry { + + /** + * create + * + * @return Node + */ + public Node create(); + } + + private synchronized static void createParserMap() { + if (cParserMap != null) return; + cParserMap = new HashMap(); + cParserMap.put(CIM, new FactoryEntry() { + + public Node create() { + return new CIMNode(); + } + }); + // DECLARATION - not implemented + // DECLGROUP - not implemented + // DECLGROUP.WITHNAME - not implemented + // DECLGROUP.WITHPATH - not implemented + cParserMap.put(QUALIFIER_DECLARATION, new FactoryEntry() { + + public Node create() { + return new QualiDeclNode(); + } + }); + cParserMap.put(SCOPE, new FactoryEntry() { + + public Node create() { + return new ScopeNode(); + } + }); + cParserMap.put(VALUE, new FactoryEntry() { + + public Node create() { + return new ValueNode(); + } + }); + cParserMap.put(VALUE_ARRAY, new FactoryEntry() { + + public Node create() { + return new ValueArrayNode(); + } + }); + cParserMap.put(VALUE_REFERENCE, new FactoryEntry() { + + public Node create() { + return new ValueReferenceNode(); + } + }); + cParserMap.put(VALUE_REFARRAY, new FactoryEntry() { + + public Node create() { + return new ValueRefArrayNode(); + } + }); + cParserMap.put(VALUE_OBJECT, new FactoryEntry() { + + public Node create() { + return new ValueObjectNode(); + } + }); + cParserMap.put(VALUE_NAMEDINSTANCE, new FactoryEntry() { + + public Node create() { + return new ValueNamedInstanceNode(); + } + }); + cParserMap.put(VALUE_OBJECTWITHLOCALPATH, new FactoryEntry() { + + public Node create() { + return new ValueObjectWithLocalPathNode(); + } + }); + cParserMap.put(VALUE_OBJECTWITHPATH, new FactoryEntry() { + + public Node create() { + return new ValueObjectWithPathNode(); + } + }); + cParserMap.put(VALUE_NULL, new FactoryEntry() { + + public Node create() { + return new ValueNullNode(); + } + }); + cParserMap.put(VALUE_INSTANCEWITHPATH, new FactoryEntry() { + + public Node create() { + return new ValueInstanceWithPathNode(); + } + }); + cParserMap.put(NAMESPACEPATH, new FactoryEntry() { + + public Node create() { + return new NameSpacePathNode(); + } + }); + cParserMap.put(LOCALNAMESPACEPATH, new FactoryEntry() { + + public Node create() { + return new LocalNameSpacePathNode(); + } + }); + cParserMap.put(HOST, new FactoryEntry() { + + public Node create() { + return new HostNode(); + } + }); + cParserMap.put(NAMESPACE, new FactoryEntry() { + + public Node create() { + return new NameSpaceNode(); + } + }); + cParserMap.put(CLASSPATH, new FactoryEntry() { + + public Node create() { + return new ClassPathNode(); + } + }); + cParserMap.put(LOCALCLASSPATH, new FactoryEntry() { + + public Node create() { + return new LocalClassPathNode(); + } + }); + cParserMap.put(CLASSNAME, new FactoryEntry() { + + public Node create() { + return new ClassNameNode(); + } + }); + cParserMap.put(INSTANCEPATH, new FactoryEntry() { + + public Node create() { + return new InstancePathNode(); + } + }); + cParserMap.put(LOCALINSTANCEPATH, new FactoryEntry() { + + public Node create() { + return new LocalInstancePathNode(); + } + }); + cParserMap.put(INSTANCENAME, new FactoryEntry() { + + public Node create() { + return new InstanceNameNode(); + } + }); + cParserMap.put(OBJECTPATH, new FactoryEntry() { + + public Node create() { + return new ObjectPathNode(); + } + }); + cParserMap.put(KEYBINDING, new FactoryEntry() { + + public Node create() { + return new KeyBindingNode(); + } + }); + cParserMap.put(KEYVALUE, new FactoryEntry() { + + public Node create() { + return new KeyValueNode(); + } + }); + cParserMap.put(CLASS, new FactoryEntry() { + + public Node create() { + return new ClassNode(); + } + }); + cParserMap.put(INSTANCE, new FactoryEntry() { + + public Node create() { + return new InstanceNode(); + } + }); + cParserMap.put(QUALIFIER, new FactoryEntry() { + + public Node create() { + return new QualifierNode(); + } + }); + cParserMap.put(PROPERTY, new FactoryEntry() { + + public Node create() { + return new PropertyNode(); + } + }); + cParserMap.put(PROPERTY_ARRAY, new FactoryEntry() { + + public Node create() { + return new PropertyArrayNode(); + } + }); + cParserMap.put(PROPERTY_REFERENCE, new FactoryEntry() { + + public Node create() { + return new PropertyReferenceNode(); + } + }); + cParserMap.put(METHOD, new FactoryEntry() { + + public Node create() { + return new MethodNode(); + } + }); + cParserMap.put(PARAMETER, new FactoryEntry() { + + public Node create() { + return new ParameterNode(); + } + }); + cParserMap.put(PARAMETER_REFERENCE, new FactoryEntry() { + + public Node create() { + return new ParameterReferenceNode(); + } + }); + cParserMap.put(PARAMETER_ARRAY, new FactoryEntry() { + + public Node create() { + return new ParameterArrayNode(); + } + }); + cParserMap.put(PARAMETER_REFARRAY, new FactoryEntry() { + + public Node create() { + return new ParameterRefArrayNode(); + } + }); + cParserMap.put(MESSAGE, new FactoryEntry() { + + public Node create() { + return new MessageNode(); + } + }); + cParserMap.put(MULTIREQ, new FactoryEntry() { + + public Node create() { + return new MultiReqNode(); + } + }); + cParserMap.put(MULTIEXPREQ, new FactoryEntry() { + + public Node create() { + return new MultiExpReqNode(); + } + }); + cParserMap.put(SIMPLEREQ, new FactoryEntry() { + + public Node create() { + return new SimpleReqNode(); + } + }); + cParserMap.put(SIMPLEEXPREQ, new FactoryEntry() { + + public Node create() { + return new SimpleExpReqNode(); + } + }); + cParserMap.put(IMETHODCALL, new FactoryEntry() { + + public Node create() { + return new IMethodCallNode(); + } + }); + cParserMap.put(METHODCALL, new FactoryEntry() { + + public Node create() { + return new MethodCallNode(); + } + }); + cParserMap.put(EXPMETHODCALL, new FactoryEntry() { + + public Node create() { + return new ExpMethodCallNode(); + } + }); + cParserMap.put(PARAMVALUE, new FactoryEntry() { + + public Node create() { + return new ParamValueNode(); + } + }); + cParserMap.put(IPARAMVALUE, new FactoryEntry() { + + public Node create() { + return new IParamValueNode(); + } + }); + cParserMap.put(EXPPARAMVALUE, new FactoryEntry() { + + public Node create() { + return new ExpParamValueNode(); + } + }); + cParserMap.put(MULTIRSP, new FactoryEntry() { + + public Node create() { + return new MultiRspNode(); + } + }); + cParserMap.put(MULTIEXPRSP, new FactoryEntry() { + + public Node create() { + return new MultiExpRspNode(); + } + }); + cParserMap.put(SIMPLERSP, new FactoryEntry() { + + public Node create() { + return new SimpleRspNode(); + } + }); + cParserMap.put(SIMPLEEXPRSP, new FactoryEntry() { + + public Node create() { + return new SimpleExpRspNode(); + } + }); + cParserMap.put(METHODRESPONSE, new FactoryEntry() { + + public Node create() { + return new MethodResponseNode(); + } + }); + cParserMap.put(EXPMETHODRESPONSE, new FactoryEntry() { + + public Node create() { + return new ExpMethodResponseNode(); + } + }); + cParserMap.put(IMETHODRESPONSE, new FactoryEntry() { + + public Node create() { + return new IMethodResponseNode(); + } + }); + cParserMap.put(ERROR, new FactoryEntry() { + + public Node create() { + return new ErrorNode(); + } + }); + cParserMap.put(RETURNVALUE, new FactoryEntry() { + + public Node create() { + return new ReturnValueNode(); + } + }); + cParserMap.put(IRETURNVALUE, new FactoryEntry() { + + public Node create() { + return new IReturnValueNode(); + } + }); + cParserMap.put(CORRELATOR, new FactoryEntry() { + + public Node create() { + return new CorrelatorNode(); + } + }); + } + + private static final HashMap NODENAME_HASH = new HashMap(); + + private static void initNodeNameHash(String[] pEnumA) { + for (int i = 0; i < pEnumA.length; i++) + NODENAME_HASH.put(pEnumA[i], pEnumA[i]); + } + + static { + initNodeNameHash(new String[] { CIM, DECLARATION, DECLGROUP, DECLGROUP_WITHNAME, + DECLGROUP_WITHPATH, QUALIFIER_DECLARATION, SCOPE, VALUE, VALUE_ARRAY, + VALUE_REFERENCE, VALUE_REFARRAY, VALUE_OBJECT, VALUE_NAMEDINSTANCE, + VALUE_NAMEDOBJECT, VALUE_OBJECTWITHLOCALPATH, VALUE_OBJECTWITHPATH, VALUE_NULL, + VALUE_INSTANCEWITHPATH, + + NAMESPACEPATH, LOCALNAMESPACEPATH, HOST, NAMESPACE, CLASSPATH, LOCALCLASSPATH, + CLASSNAME, INSTANCEPATH, LOCALINSTANCEPATH, INSTANCENAME, OBJECTPATH, KEYBINDING, + KEYVALUE, + + CLASS, INSTANCE, QUALIFIER, PROPERTY, PROPERTY_ARRAY, PROPERTY_REFERENCE, METHOD, + PARAMETER, PARAMETER_REFERENCE, PARAMETER_ARRAY, PARAMETER_REFARRAY, + + /* + * TABLE stuff is missing yet + */ + MESSAGE, MULTIREQ, MULTIEXPREQ, SIMPLEREQ, SIMPLEEXPREQ, IMETHODCALL, METHODCALL, + EXPMETHODCALL, PARAMVALUE, IPARAMVALUE, EXPPARAMVALUE, MULTIRSP, MULTIEXPRSP, + SIMPLERSP, SIMPLEEXPRSP, METHODRESPONSE, EXPMETHODRESPONSE, IMETHODRESPONSE, ERROR, + RETURNVALUE, IRETURNVALUE, CORRELATOR }); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/NodePool.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/NodePool.java similarity index 74% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/NodePool.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/NodePool.java index 7562925..37724be 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/NodePool.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/NodePool.java @@ -1,161 +1,159 @@ -/* - (C) Copyright IBM Corp. 2006, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1663270 2007-02-19 ebak Minor performance problems - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.HashMap; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node.Node; - -/** - * NodePool is used by XMLDefaultHandlerImpl to store unused Node instances - * which can be reused later without instantiating new ones. - */ -public class NodePool { - - private HashMap iPoolMap = new HashMap(512); - - private int iHitCnt = 0; - - private int iMissCnt = 0; - - /** - * addNode - * - * @param pNode - */ - public void addNode(Node pNode) { - PoolStack ps = this.iPoolMap.get(pNode.getNodeName()); - if (ps == null) { - this.iPoolMap.put(pNode.getNodeName(), new PoolStack(pNode)); - return; - } - ps.put(pNode); - } - - /** - * getNode - * - * @param pNodeName - * @return Node - */ - public Node getNode(String pNodeName) { - PoolStack ps = this.iPoolMap.get(pNodeName); - if (ps == null) { - ++this.iMissCnt; - return null; - } - Node node = ps.get(); - if (node == null) ++this.iMissCnt; - else ++this.iHitCnt; - return node; - } - - /** - * getHitCnt - * - * @return int - */ - public int getHitCnt() { - return this.iHitCnt; - } - - /** - * getMissCnt - * - * @return int - */ - public int getMissCnt() { - return this.iMissCnt; - } - -} - -class PoolStack { - - private static final int CAPACITY = 8, MAX_USECNT = CAPACITY - 1, MAX_IDX = MAX_USECNT; - - private Node[] iNodeA = new Node[CAPACITY]; - - private int iIdx = 0, iUseCnt = 0; - - /** - * Ctor. - * - * @param pNode - */ - public PoolStack(Node pNode) { - put(pNode); - } - - /** - * put - * - * @param pNode - */ - public void put(Node pNode) { - if (this.iUseCnt < MAX_USECNT) ++this.iUseCnt; - this.iNodeA[this.iIdx] = pNode; - incIdx(); - } - - /** - * get - * - * @return Node - */ - public Node get() { - if (this.iUseCnt == 0) return null; - --this.iUseCnt; - decIdx(); - return this.iNodeA[this.iIdx]; - } - - private void decIdx() { - this.iIdx = (this.iIdx == 0 ? MAX_IDX : this.iIdx - 1); - } - - private void incIdx() { - this.iIdx = (this.iIdx == MAX_IDX ? 0 : this.iIdx + 1); - } - -} +/* + (C) Copyright IBM Corp. 2006, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1663270 2007-02-19 ebak Minor performance problems + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.HashMap; + +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node.Node; + +/** + * NodePool is used by XMLDefaultHandlerImpl to store unused Node instances + * which can be reused later without instantiating new ones. + */ +public class NodePool { + + private HashMap iPoolMap = new HashMap(512); + + private int iHitCnt = 0; + + private int iMissCnt = 0; + + /** + * addNode + * + * @param pNode + */ + public void addNode(Node pNode) { + PoolStack ps = this.iPoolMap.get(pNode.getNodeName()); + if (ps == null) { + this.iPoolMap.put(pNode.getNodeName(), new PoolStack(pNode)); + return; + } + ps.put(pNode); + } + + /** + * getNode + * + * @param pNodeName + * @return Node + */ + public Node getNode(String pNodeName) { + PoolStack ps = this.iPoolMap.get(pNodeName); + if (ps == null) { + ++this.iMissCnt; + return null; + } + Node node = ps.get(); + if (node == null) ++this.iMissCnt; + else ++this.iHitCnt; + return node; + } + + /** + * getHitCnt + * + * @return int + */ + public int getHitCnt() { + return this.iHitCnt; + } + + /** + * getMissCnt + * + * @return int + */ + public int getMissCnt() { + return this.iMissCnt; + } + +} + +class PoolStack { + + private static final int CAPACITY = 8, MAX_USECNT = CAPACITY - 1, MAX_IDX = MAX_USECNT; + + private Node[] iNodeA = new Node[CAPACITY]; + + private int iIdx = 0, iUseCnt = 0; + + /** + * Ctor. + * + * @param pNode + */ + public PoolStack(Node pNode) { + put(pNode); + } + + /** + * put + * + * @param pNode + */ + public void put(Node pNode) { + if (this.iUseCnt < MAX_USECNT) ++this.iUseCnt; + this.iNodeA[this.iIdx] = pNode; + incIdx(); + } + + /** + * get + * + * @return Node + */ + public Node get() { + if (this.iUseCnt == 0) return null; + --this.iUseCnt; + decIdx(); + return this.iNodeA[this.iIdx]; + } + + private void decIdx() { + this.iIdx = (this.iIdx == 0 ? MAX_IDX : this.iIdx - 1); + } + + private void incIdx() { + this.iIdx = (this.iIdx == MAX_IDX ? 0 : this.iIdx + 1); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/SAXHelper.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/SAXHelper.java similarity index 65% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/SAXHelper.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/SAXHelper.java index f22baf1..bc3c7e5 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/SAXHelper.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/SAXHelper.java @@ -1,105 +1,103 @@ -/* - (C) Copyright IBM Corp. 2006, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1660756 2007-02-22 ebak Embedded object support - * 1688273 2007-04-16 ebak Full support of HTTP trailers - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.InputStreamReader; - -import org.sentrysoftware.wbem.javax.cim.CIMArgument; -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; -import org.sentrysoftware.wbem.javax.wbem.WBEMException; -import javax.xml.parsers.SAXParser; -import javax.xml.parsers.SAXParserFactory; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node.AbstractMessageNode; -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node.CIMNode; -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node.MessageNode; -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node.SimpleRspNode; -import org.sentrysoftware.wbem.sblim.cimclient.internal.http.io.TrailerException; -import org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.CIMError; -import org.xml.sax.InputSource; - -/** - * Class SAXHelper stores methods to help high level CIM-XML pull and SAX - * parsing. - */ -public class SAXHelper { - - /** - * parseInvokeMethodResponse - * - * @param pIs - * @param pOutArgs - * @param pDefPath - * @return Object, any kind of JSR48 value class - * @throws Exception - */ - public static Object parseInvokeMethodResponse(InputStreamReader pIs, - CIMArgument[] pOutArgs, CIMObjectPath pDefPath) throws Exception { - XMLDefaultHandlerImpl hndlr = new XMLDefaultHandlerImpl(pDefPath); - SAXParserFactory factory = SAXParserFactory.newInstance(); - SAXParser saxParser = factory.newSAXParser(); - try { - saxParser.parse(new InputSource(pIs), hndlr); - } catch (TrailerException e) { - throw e.getWBEMException(); - } - - CIMNode cimNode = hndlr.getCIMNode(); - MessageNode msgNode = cimNode.getMessageNode(); - AbstractMessageNode absMsgNode = msgNode.getAbstractMessageNode(); - SimpleRspNode simpRspNode = (SimpleRspNode) absMsgNode; - CIMError cimErr = simpRspNode.getCIMError(); - if (cimErr != null) throw new WBEMException(cimErr.getCode(), cimErr.getDescription(), - cimErr.getCIMInstances()); - CIMArgument[] outArgs = simpRspNode.getCIMArguments(); - if (pOutArgs != null && outArgs != null) { - int len = Math.min(pOutArgs.length, outArgs.length); - for (int i = 0; i < len; i++) - pOutArgs[i] = outArgs[i]; - } - return simpRspNode.getReturnValueCount() == 0 ? null : simpRspNode.readReturnValue(); - } - -} +/* + (C) Copyright IBM Corp. 2006, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1660756 2007-02-22 ebak Embedded object support + * 1688273 2007-04-16 ebak Full support of HTTP trailers + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.InputStreamReader; + +import javax.xml.parsers.SAXParser; +import javax.xml.parsers.SAXParserFactory; + +import org.metricshub.wbem.javax.cim.CIMArgument; +import org.metricshub.wbem.javax.cim.CIMObjectPath; +import org.metricshub.wbem.javax.wbem.WBEMException; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node.CIMNode; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node.MessageNode; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node.SimpleRspNode; +import org.metricshub.wbem.sblim.cimclient.internal.http.io.TrailerException; +import org.metricshub.wbem.sblim.cimclient.internal.wbem.CIMError; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node.AbstractMessageNode; +import org.xml.sax.InputSource; + +/** + * Class SAXHelper stores methods to help high level CIM-XML pull and SAX + * parsing. + */ +public class SAXHelper { + + /** + * parseInvokeMethodResponse + * + * @param pIs + * @param pOutArgs + * @param pDefPath + * @return Object, any kind of JSR48 value class + * @throws Exception + */ + public static Object parseInvokeMethodResponse(InputStreamReader pIs, + CIMArgument[] pOutArgs, CIMObjectPath pDefPath) throws Exception { + XMLDefaultHandlerImpl hndlr = new XMLDefaultHandlerImpl(pDefPath); + SAXParserFactory factory = SAXParserFactory.newInstance(); + SAXParser saxParser = factory.newSAXParser(); + try { + saxParser.parse(new InputSource(pIs), hndlr); + } catch (TrailerException e) { + throw e.getWBEMException(); + } + + CIMNode cimNode = hndlr.getCIMNode(); + MessageNode msgNode = cimNode.getMessageNode(); + AbstractMessageNode absMsgNode = msgNode.getAbstractMessageNode(); + SimpleRspNode simpRspNode = (SimpleRspNode) absMsgNode; + CIMError cimErr = simpRspNode.getCIMError(); + if (cimErr != null) throw new WBEMException(cimErr.getCode(), cimErr.getDescription(), + cimErr.getCIMInstances()); + CIMArgument[] outArgs = simpRspNode.getCIMArguments(); + if (pOutArgs != null && outArgs != null) { + int len = Math.min(pOutArgs.length, outArgs.length); + for (int i = 0; i < len; i++) + pOutArgs[i] = outArgs[i]; + } + return simpRspNode.getReturnValueCount() == 0 ? null : simpRspNode.readReturnValue(); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/SAXSession.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/SAXSession.java similarity index 64% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/SAXSession.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/SAXSession.java index a44f727..547b3a1 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/SAXSession.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/SAXSession.java @@ -1,87 +1,84 @@ -/* - (C) Copyright IBM Corp. 2006, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1660756 2007-02-22 ebak Embedded object support - * 1848607 2007-12-11 ebak Strict EmbeddedObject types - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.util.WBEMConfiguration; - -/** - * This class is intended to store variables which are common for a whole - * CIM-XML SAX parsing session. - */ -public class SAXSession { - - private CIMObjectPath iDefLocalPath; - - private boolean iStrictEmbObjParsing = WBEMConfiguration.getGlobalConfiguration() - .strictEmbObjTypes(); - - /** - * Ctor. - * - * @param pDefLocalPath - */ - public SAXSession(CIMObjectPath pDefLocalPath) { - this.iDefLocalPath = pDefLocalPath; - } - - /** - * getDefLocalPath - * - * @return CIMObjectPath - */ - public CIMObjectPath getDefLocalPath() { - return this.iDefLocalPath; - } - - /** - * strictEmbObjParsing - * - * @return boolean - */ - public boolean strictEmbObjParsing() { - return this.iStrictEmbObjParsing; - } - -} +/* + (C) Copyright IBM Corp. 2006, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1660756 2007-02-22 ebak Embedded object support + * 1848607 2007-12-11 ebak Strict EmbeddedObject types + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMObjectPath; +import org.metricshub.wbem.sblim.cimclient.internal.util.WBEMConfiguration; + +/** + * This class is intended to store variables which are common for a whole + * CIM-XML SAX parsing session. + */ +public class SAXSession { + + private CIMObjectPath iDefLocalPath; + + private boolean iStrictEmbObjParsing = WBEMConfiguration.getGlobalConfiguration() + .strictEmbObjTypes(); + + /** + * Ctor. + * + * @param pDefLocalPath + */ + public SAXSession(CIMObjectPath pDefLocalPath) { + this.iDefLocalPath = pDefLocalPath; + } + + /** + * getDefLocalPath + * + * @return CIMObjectPath + */ + public CIMObjectPath getDefLocalPath() { + return this.iDefLocalPath; + } + + /** + * strictEmbObjParsing + * + * @return boolean + */ + public boolean strictEmbObjParsing() { + return this.iStrictEmbObjParsing; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/XMLDefaultHandlerImpl.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/XMLDefaultHandlerImpl.java similarity index 82% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/XMLDefaultHandlerImpl.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/XMLDefaultHandlerImpl.java index 51123c5..6677a78 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/XMLDefaultHandlerImpl.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/XMLDefaultHandlerImpl.java @@ -1,296 +1,293 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1660756 2007-02-22 ebak Embedded object support - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors - * 2713 2013-11-22 blaschke-oss Enforce loose validation of CIM-XML documents - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.ArrayList; -import java.util.logging.Level; - -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node.CIMNode; -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node.Node; -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node.NonVolatileIf; -import org.sentrysoftware.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; -import org.xml.sax.helpers.DefaultHandler; - -/** - * Class XMLDefaultHandlerImpl is DefaultHandler implementation which is used - * for SAX and PULL style XML parsing. - */ -public class XMLDefaultHandlerImpl extends DefaultHandler { - - private Node iRootNode; - - private NodeStack iNodeStack = new NodeStack(); - - private NodePool iNodePool = new NodePool(); - - private StringBuffer iStrBuf; - - private SAXSession iSession; - - private boolean iAnyRoot; - - /** - * NodeStack - */ - static class NodeStack { - - private ArrayList iAL = new ArrayList(); - - /** - * push - * - * @param pNode - */ - public void push(Node pNode) { - this.iAL.add(pNode); - } - - /** - * pop - * - * @return Node - */ - public Node pop() { - if (this.iAL.size() == 0) return null; - return this.iAL.remove(this.iAL.size() - 1); - } - - /** - * peek - * - * @return Node - */ - public Node peek() { - if (this.iAL.size() == 0) return null; - return this.iAL.get(this.iAL.size() - 1); - } - - } - - /** - * Ctor. - * - * @param pSession - * - stores common variables for the whole parsing session - * @param pAnyRoot - * - if true any CIM-XML element can be the root element of the - * XML stream - */ - public XMLDefaultHandlerImpl(SAXSession pSession, boolean pAnyRoot) { - this.iSession = pSession; - this.iAnyRoot = pAnyRoot; - } - - /** - * Ctor. - * - * @param pLocalPath - * - CIMObjectPathes without local paths will be extended by this - * value - * @param pAnyRoot - * - if true any CIM-XML element can be the root element of the - * XML stream - */ - public XMLDefaultHandlerImpl(CIMObjectPath pLocalPath, boolean pAnyRoot) { - this(new SAXSession(pLocalPath), pAnyRoot); - } - - /** - * Ctor. - * - * @param pLocalPath - * - CIMObjectPathes without local paths will be extended by this - * value - */ - public XMLDefaultHandlerImpl(CIMObjectPath pLocalPath) { - this(pLocalPath, false); - } - - /** - * Ctor. - */ - public XMLDefaultHandlerImpl() { - this((CIMObjectPath) null, false); - } - - /** - * @param uri - * @param localName - */ - @Override - public void startElement(String uri, String localName, String qName, Attributes attributes) - throws SAXException { - this.iStrBuf = null; - String nodeNameEnum = NodeFactory.getEnum(qName); - if (nodeNameEnum == null) { - LogAndTraceBroker.getBroker() - .trace( - Level.FINEST, - "Ignoring unrecognized starting CIM-XML element found during parsing: " - + qName); - return; - } - - Node parentNode = getPeekNode(); - if (parentNode == null) { - if (!this.iAnyRoot && nodeNameEnum != NodeConstIf.CIM) throw new SAXException( - "First node of CIM-XML document must be CIM! " + nodeNameEnum + " is invalid!"); - } - if (parentNode != null) parentNode.testChild(nodeNameEnum); - // let's look for a Node instance in the pool - Node node = this.iNodePool.getNode(nodeNameEnum); - // create an instance if pool didn't give us one - if (node == null) { - node = NodeFactory.getNodeInstance(nodeNameEnum); - } - if (parentNode != null) { - if (parentNode instanceof NonVolatileIf) ((NonVolatileIf) parentNode).addChild(node); - } else { - this.iRootNode = node; - } - this.iNodeStack.push(node); - node.init(attributes, this.iSession); - } - - @Override - public void characters(char ch[], int start, int length) { - String str = new String(ch, start, length); - // System.out.println("str("+str.length()+")="+str); - if (this.iStrBuf == null) { - this.iStrBuf = new StringBuffer(str); - } else { - this.iStrBuf.append(str); - } - } - - /** - * @param uri - * @param localName - */ - @Override - public void endElement(String uri, String localName, String qName) throws SAXException { - String nodeNameEnum = NodeFactory.getEnum(qName); - if (nodeNameEnum == null) { - LogAndTraceBroker.getBroker().trace(Level.FINEST, - "Ignoring unrecognized ending CIM-XML element found during parsing: " + qName); - return; - } - Node peekNode = this.iNodeStack.pop(); - try { - // pass character data - if (this.iStrBuf != null) { - peekNode.parseData(this.iStrBuf.toString()); - this.iStrBuf = null; - } - // completeness check - peekNode.testCompletness(); - - // call parent's childParsed() - Node parentNode = this.iNodeStack.peek(); - if (parentNode != null) { - parentNode.childParsed(peekNode); - } - } finally { - peekNode.setCompleted(); - // if peekNode is reusable place it into the NodePool - if (!(peekNode instanceof NonVolatileIf)) { - this.iNodePool.addNode(peekNode); - } - } - } - - @Override - public void endDocument() { - String msg = "hits : " + getNodePoolHits() + "\nmisses : " + getNodePoolMisses(); - LogAndTraceBroker.getBroker().trace(Level.FINE, msg); - } - - /** - * getCIMNode - * - * @return CIMNode, the root Element of the parsed CIM-XML document - */ - public CIMNode getCIMNode() { - return this.iRootNode instanceof CIMNode ? (CIMNode) this.iRootNode : null; - } - - /** - * getRootNode - * - * @return Node, the root element of the parsed CIM-XML stream - */ - public Node getRootNode() { - return this.iRootNode; - } - - /** - * getNodePoolHits - * - * @return int - */ - public int getNodePoolHits() { - return this.iNodePool.getHitCnt(); - } - - /** - * getNodePoolMisses - * - * @return int - */ - public int getNodePoolMisses() { - return this.iNodePool.getMissCnt(); - } - - private Node getPeekNode() { - return this.iNodeStack.peek(); - } -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1660756 2007-02-22 ebak Embedded object support + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors + * 2713 2013-11-22 blaschke-oss Enforce loose validation of CIM-XML documents + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.ArrayList; +import java.util.logging.Level; + +import org.metricshub.wbem.javax.cim.CIMObjectPath; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node.CIMNode; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node.Node; +import org.metricshub.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node.NonVolatileIf; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; +import org.xml.sax.helpers.DefaultHandler; + +/** + * Class XMLDefaultHandlerImpl is DefaultHandler implementation which is used + * for SAX and PULL style XML parsing. + */ +public class XMLDefaultHandlerImpl extends DefaultHandler { + + private Node iRootNode; + + private NodeStack iNodeStack = new NodeStack(); + + private NodePool iNodePool = new NodePool(); + + private StringBuffer iStrBuf; + + private SAXSession iSession; + + private boolean iAnyRoot; + + /** + * NodeStack + */ + static class NodeStack { + + private ArrayList iAL = new ArrayList(); + + /** + * push + * + * @param pNode + */ + public void push(Node pNode) { + this.iAL.add(pNode); + } + + /** + * pop + * + * @return Node + */ + public Node pop() { + if (this.iAL.size() == 0) return null; + return this.iAL.remove(this.iAL.size() - 1); + } + + /** + * peek + * + * @return Node + */ + public Node peek() { + if (this.iAL.size() == 0) return null; + return this.iAL.get(this.iAL.size() - 1); + } + + } + + /** + * Ctor. + * + * @param pSession + * - stores common variables for the whole parsing session + * @param pAnyRoot + * - if true any CIM-XML element can be the root element of the + * XML stream + */ + public XMLDefaultHandlerImpl(SAXSession pSession, boolean pAnyRoot) { + this.iSession = pSession; + this.iAnyRoot = pAnyRoot; + } + + /** + * Ctor. + * + * @param pLocalPath + * - CIMObjectPathes without local paths will be extended by this + * value + * @param pAnyRoot + * - if true any CIM-XML element can be the root element of the + * XML stream + */ + public XMLDefaultHandlerImpl(CIMObjectPath pLocalPath, boolean pAnyRoot) { + this(new SAXSession(pLocalPath), pAnyRoot); + } + + /** + * Ctor. + * + * @param pLocalPath + * - CIMObjectPathes without local paths will be extended by this + * value + */ + public XMLDefaultHandlerImpl(CIMObjectPath pLocalPath) { + this(pLocalPath, false); + } + + /** + * Ctor. + */ + public XMLDefaultHandlerImpl() { + this((CIMObjectPath) null, false); + } + + /** + * @param uri + * @param localName + */ + @Override + public void startElement(String uri, String localName, String qName, Attributes attributes) + throws SAXException { + this.iStrBuf = null; + String nodeNameEnum = NodeFactory.getEnum(qName); + if (nodeNameEnum == null) { + LogAndTraceBroker.getBroker() + .trace( + Level.FINEST, + "Ignoring unrecognized starting CIM-XML element found during parsing: " + + qName); + return; + } + + Node parentNode = getPeekNode(); + if (parentNode == null) { + if (!this.iAnyRoot && nodeNameEnum != NodeConstIf.CIM) throw new SAXException( + "First node of CIM-XML document must be CIM! " + nodeNameEnum + " is invalid!"); + } + if (parentNode != null) parentNode.testChild(nodeNameEnum); + // let's look for a Node instance in the pool + Node node = this.iNodePool.getNode(nodeNameEnum); + // create an instance if pool didn't give us one + if (node == null) { + node = NodeFactory.getNodeInstance(nodeNameEnum); + } + if (parentNode != null) { + if (parentNode instanceof NonVolatileIf) ((NonVolatileIf) parentNode).addChild(node); + } else { + this.iRootNode = node; + } + this.iNodeStack.push(node); + node.init(attributes, this.iSession); + } + + @Override + public void characters(char ch[], int start, int length) { + String str = new String(ch, start, length); + // System.out.println("str("+str.length()+")="+str); + if (this.iStrBuf == null) { + this.iStrBuf = new StringBuffer(str); + } else { + this.iStrBuf.append(str); + } + } + + /** + * @param uri + * @param localName + */ + @Override + public void endElement(String uri, String localName, String qName) throws SAXException { + String nodeNameEnum = NodeFactory.getEnum(qName); + if (nodeNameEnum == null) { + LogAndTraceBroker.getBroker().trace(Level.FINEST, + "Ignoring unrecognized ending CIM-XML element found during parsing: " + qName); + return; + } + Node peekNode = this.iNodeStack.pop(); + try { + // pass character data + if (this.iStrBuf != null) { + peekNode.parseData(this.iStrBuf.toString()); + this.iStrBuf = null; + } + // completeness check + peekNode.testCompletness(); + + // call parent's childParsed() + Node parentNode = this.iNodeStack.peek(); + if (parentNode != null) { + parentNode.childParsed(peekNode); + } + } finally { + peekNode.setCompleted(); + // if peekNode is reusable place it into the NodePool + if (!(peekNode instanceof NonVolatileIf)) { + this.iNodePool.addNode(peekNode); + } + } + } + + @Override + public void endDocument() { + String msg = "hits : " + getNodePoolHits() + "\nmisses : " + getNodePoolMisses(); + LogAndTraceBroker.getBroker().trace(Level.FINE, msg); + } + + /** + * getCIMNode + * + * @return CIMNode, the root Element of the parsed CIM-XML document + */ + public CIMNode getCIMNode() { + return this.iRootNode instanceof CIMNode ? (CIMNode) this.iRootNode : null; + } + + /** + * getRootNode + * + * @return Node, the root element of the parsed CIM-XML stream + */ + public Node getRootNode() { + return this.iRootNode; + } + + /** + * getNodePoolHits + * + * @return int + */ + public int getNodePoolHits() { + return this.iNodePool.getHitCnt(); + } + + /** + * getNodePoolMisses + * + * @return int + */ + public int getNodePoolMisses() { + return this.iNodePool.getMissCnt(); + } + + private Node getPeekNode() { + return this.iNodeStack.peek(); + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractArrayValueNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractArrayValueNode.java similarity index 63% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractArrayValueNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractArrayValueNode.java index ee7af8d..adfada9 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractArrayValueNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractArrayValueNode.java @@ -1,60 +1,58 @@ -/* - (C) Copyright IBM Corp. 2006, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1719991 2007-05-16 ebak FVT: regression ClassCastException in EmbObjHandler - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -/** - * Class AbstractArrayValueNode is the superclass of all VALUE.ARRAY style - * nodes. - */ -public abstract class AbstractArrayValueNode extends AbstractValueNode implements ArrayIf { - - /** - * Ctor. - * - * @param pNameEnum - */ - public AbstractArrayValueNode(String pNameEnum) { - super(pNameEnum); - } - -} +/* + (C) Copyright IBM Corp. 2006, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1719991 2007-05-16 ebak FVT: regression ClassCastException in EmbObjHandler + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +/** + * Class AbstractArrayValueNode is the superclass of all VALUE.ARRAY style + * nodes. + */ +public abstract class AbstractArrayValueNode extends AbstractValueNode implements ArrayIf { + + /** + * Ctor. + * + * @param pNameEnum + */ + public AbstractArrayValueNode(String pNameEnum) { + super(pNameEnum); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractMessageNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractMessageNode.java similarity index 65% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractMessageNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractMessageNode.java index 62239e2..f5bd86e 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractMessageNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractMessageNode.java @@ -1,69 +1,67 @@ -/* - (C) Copyright IBM Corp. 2006, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -/** - * Class AbstractMessageNode is the superclass of AbstractResponseNode and - * AbstractRequestNode classes. - */ -public abstract class AbstractMessageNode extends Node implements NonVolatileIf { - - /** - * Ctor. - * - * @param pNameEnum - */ - public AbstractMessageNode(String pNameEnum) { - super(pNameEnum); - } - - /** - * @param pChild - */ - @Override - public void childParsed(Node pChild) { - // not needed - } - -} +/* + (C) Copyright IBM Corp. 2006, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +/** + * Class AbstractMessageNode is the superclass of AbstractResponseNode and + * AbstractRequestNode classes. + */ +public abstract class AbstractMessageNode extends Node implements NonVolatileIf { + + /** + * Ctor. + * + * @param pNameEnum + */ + public AbstractMessageNode(String pNameEnum) { + super(pNameEnum); + } + + /** + * @param pChild + */ + @Override + public void childParsed(Node pChild) { + // not needed + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractMethodCallNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractMethodCallNode.java similarity index 79% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractMethodCallNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractMethodCallNode.java index 15b5533..ce80e34 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractMethodCallNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractMethodCallNode.java @@ -1,209 +1,206 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1660756 2007-02-22 ebak Embedded object support - * 1686000 2007-04-20 ebak modifyInstance() missing from WBEMClient - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics - * 3511454 2012-03-27 blaschke-oss SAX nodes not reinitialized properly - * 2682 2013-10-02 blaschke-oss (I)MethodCallNode allows no LOCAL*PATH - * 2690 2013-10-11 blaschke-oss Remove RESPONSEDESTINATION support - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.ArrayList; - -import org.sentrysoftware.wbem.javax.cim.CIMArgument; -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cim.CIMElementSorter; -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - *
      - * ELEMENT IMETHODCALL (LOCALNAMESPACEPATH, IPARAMVALUE*)
      - * ATTLIST IMETHODCALL
      - *   %CIMName;
      - *   
      - * ELEMENT METHODCALL ((LOCALINSTANCEPATH | LOCALCLASSPATH), PARAMVALUE*)
      - * ATTLIST METHODCALL
      - *   %CIMName;
      - * 
      - */ -public abstract class AbstractMethodCallNode extends Node implements NonVolatileIf, ObjectPathIf { - - private String iName; - - protected CIMObjectPath iPath; - - /** - * (IPARAMVALUE | PARAMVALUE)* -> ArrayList of CIMArgument - */ - private ArrayList> iArgAL; - - /** - * Sorted array of CIMArguments - */ - private CIMArgument[] iArgA; - - /** - * Ctor. - * - * @param pNameEnum - */ - public AbstractMethodCallNode(String pNameEnum) { - super(pNameEnum); - } - - /** - * @param pSession - */ - @Override - public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { - this.iName = getCIMName(pAttribs); - this.iPath = null; - this.iArgAL = null; - this.iArgA = null; - } - - /** - * @param pChild - */ - public void addChild(Node pChild) { - // nothing to do - } - - @Override - public void childParsed(Node pChild) { - if (pChild instanceof AbstractPathNode) { - this.iPath = ((AbstractPathNode) pChild).getCIMObjectPath(); - } else if (pChild instanceof AbstractParamValueNode) { - if (this.iArgAL == null) this.iArgAL = new ArrayList>(); - this.iArgAL.add(((AbstractParamValueNode) pChild).getCIMArgument()); - } - } - - /** - * @param pData - */ - @Override - public void parseData(String pData) { - // no data - } - - protected abstract void testSpecChild(String pNodeNameEnum) throws SAXException; - - @Override - public void testChild(String pNodeNameEnum) throws SAXException { - testSpecChild(pNodeNameEnum); - } - - /** - * getName - * - * @return String, name of the called method - */ - public String getName() { - return this.iName; - } - - public CIMObjectPath getCIMObjectPath() { - return this.iPath; - } - - private static final CIMArgument[] EMPTY_ARG_A = new CIMArgument[0]; - - /** - * getCIMArguments - * - * @return CIMArgument[] - */ - public CIMArgument[] getCIMArguments() { - if (this.iArgA != null) return this.iArgA; - this.iArgA = this.iArgAL == null ? null : (CIMArgument[]) this.iArgAL.toArray(EMPTY_ARG_A); - return (CIMArgument[]) CIMElementSorter.sort(this.iArgA); - } - - /** - * getArgumentCount - * - * @return int - */ - public int getArgumentCount() { - getCIMArguments(); - return this.iArgA == null ? 0 : this.iArgA.length; - } - - /** - * getArgument - * - * @param pName - * @return CIMArgument - */ - public CIMArgument getArgument(String pName) { - getCIMArguments(); - return (CIMArgument) CIMElementSorter.find(this.iArgA, pName); - } - - /** - * getArgument - * - * @param pIdx - * @return CIMArgument - */ - public CIMArgument getArgument(int pIdx) { - getCIMArguments(); - return this.iArgA == null ? null : this.iArgA[pIdx]; - } - - @Override - public String toString() { - StringBuffer buf = new StringBuffer("Name: " + getName() + "\nPath: " + getCIMObjectPath() - + "\nParamValues:\n"); - for (int i = 0; i < getArgumentCount(); i++) { - buf.append(" " + getArgument(i) + "\n"); - } - return buf.toString(); - } - -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1660756 2007-02-22 ebak Embedded object support + * 1686000 2007-04-20 ebak modifyInstance() missing from WBEMClient + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics + * 3511454 2012-03-27 blaschke-oss SAX nodes not reinitialized properly + * 2682 2013-10-02 blaschke-oss (I)MethodCallNode allows no LOCAL*PATH + * 2690 2013-10-11 blaschke-oss Remove RESPONSEDESTINATION support + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.ArrayList; + +import org.metricshub.wbem.javax.cim.CIMArgument; +import org.metricshub.wbem.javax.cim.CIMObjectPath; +import org.metricshub.wbem.sblim.cimclient.internal.cim.CIMElementSorter; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + *
      + * ELEMENT IMETHODCALL (LOCALNAMESPACEPATH, IPARAMVALUE*)
      + * ATTLIST IMETHODCALL
      + *   %CIMName;
      + *   
      + * ELEMENT METHODCALL ((LOCALINSTANCEPATH | LOCALCLASSPATH), PARAMVALUE*)
      + * ATTLIST METHODCALL
      + *   %CIMName;
      + * 
      + */ +public abstract class AbstractMethodCallNode extends Node implements NonVolatileIf, ObjectPathIf { + + private String iName; + + protected CIMObjectPath iPath; + + /** + * (IPARAMVALUE | PARAMVALUE)* -> ArrayList of CIMArgument + */ + private ArrayList> iArgAL; + + /** + * Sorted array of CIMArguments + */ + private CIMArgument[] iArgA; + + /** + * Ctor. + * + * @param pNameEnum + */ + public AbstractMethodCallNode(String pNameEnum) { + super(pNameEnum); + } + + /** + * @param pSession + */ + @Override + public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { + this.iName = getCIMName(pAttribs); + this.iPath = null; + this.iArgAL = null; + this.iArgA = null; + } + + /** + * @param pChild + */ + public void addChild(Node pChild) { + // nothing to do + } + + @Override + public void childParsed(Node pChild) { + if (pChild instanceof AbstractPathNode) { + this.iPath = ((AbstractPathNode) pChild).getCIMObjectPath(); + } else if (pChild instanceof AbstractParamValueNode) { + if (this.iArgAL == null) this.iArgAL = new ArrayList>(); + this.iArgAL.add(((AbstractParamValueNode) pChild).getCIMArgument()); + } + } + + /** + * @param pData + */ + @Override + public void parseData(String pData) { + // no data + } + + protected abstract void testSpecChild(String pNodeNameEnum) throws SAXException; + + @Override + public void testChild(String pNodeNameEnum) throws SAXException { + testSpecChild(pNodeNameEnum); + } + + /** + * getName + * + * @return String, name of the called method + */ + public String getName() { + return this.iName; + } + + public CIMObjectPath getCIMObjectPath() { + return this.iPath; + } + + private static final CIMArgument[] EMPTY_ARG_A = new CIMArgument[0]; + + /** + * getCIMArguments + * + * @return CIMArgument[] + */ + public CIMArgument[] getCIMArguments() { + if (this.iArgA != null) return this.iArgA; + this.iArgA = this.iArgAL == null ? null : (CIMArgument[]) this.iArgAL.toArray(EMPTY_ARG_A); + return (CIMArgument[]) CIMElementSorter.sort(this.iArgA); + } + + /** + * getArgumentCount + * + * @return int + */ + public int getArgumentCount() { + getCIMArguments(); + return this.iArgA == null ? 0 : this.iArgA.length; + } + + /** + * getArgument + * + * @param pName + * @return CIMArgument + */ + public CIMArgument getArgument(String pName) { + getCIMArguments(); + return (CIMArgument) CIMElementSorter.find(this.iArgA, pName); + } + + /** + * getArgument + * + * @param pIdx + * @return CIMArgument + */ + public CIMArgument getArgument(int pIdx) { + getCIMArguments(); + return this.iArgA == null ? null : this.iArgA[pIdx]; + } + + @Override + public String toString() { + StringBuffer buf = new StringBuffer("Name: " + getName() + "\nPath: " + getCIMObjectPath() + + "\nParamValues:\n"); + for (int i = 0; i < getArgumentCount(); i++) { + buf.append(" " + getArgument(i) + "\n"); + } + return buf.toString(); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractMultiRspNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractMultiRspNode.java similarity index 67% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractMultiRspNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractMultiRspNode.java index 2452d9f..1a1d94e 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractMultiRspNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractMultiRspNode.java @@ -1,74 +1,72 @@ -/* - (C) Copyright IBM Corp. 2006, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2750520 2009-04-10 blaschke-oss Code cleanup from empty statement et al - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -/** - * Class AbstractMultiRspNode is superclass of MultiRsp style Node classes. - */ -public abstract class AbstractMultiRspNode extends AbstractResponseNode { - - /** - * Ctor. - * - * @param pNameEnum - */ - public AbstractMultiRspNode(String pNameEnum) { - super(pNameEnum); - } - - /** - * getResponseCount - * - * @return the number of retrievable responses - */ - public abstract int getResponseCount(); - - /** - * readResponse - * - * @return AbstractSimpleRspNode - */ - public abstract AbstractSimpleRspNode readResponse(); - -} +/* + (C) Copyright IBM Corp. 2006, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2750520 2009-04-10 blaschke-oss Code cleanup from empty statement et al + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +/** + * Class AbstractMultiRspNode is superclass of MultiRsp style Node classes. + */ +public abstract class AbstractMultiRspNode extends AbstractResponseNode { + + /** + * Ctor. + * + * @param pNameEnum + */ + public AbstractMultiRspNode(String pNameEnum) { + super(pNameEnum); + } + + /** + * getResponseCount + * + * @return the number of retrievable responses + */ + public abstract int getResponseCount(); + + /** + * readResponse + * + * @return AbstractSimpleRspNode + */ + public abstract AbstractSimpleRspNode readResponse(); + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractObjectNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractObjectNode.java similarity index 61% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractObjectNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractObjectNode.java index b0bdda3..3f744d7 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractObjectNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractObjectNode.java @@ -1,64 +1,62 @@ -/* - (C) Copyright IBM Corp. 2006, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1660756 2007-02-22 ebak Embedded object support - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; - -/** - * Class AbstractObjectNode is the superclass of ClassNode and InstanceNode - * classes. - */ -public abstract class AbstractObjectNode extends Node implements ValueIf { - - protected CIMObjectPath iLocalPath; - - /** - * Ctor. - * - * @param pNameEnum - */ - public AbstractObjectNode(String pNameEnum) { - super(pNameEnum); - } - -} +/* + (C) Copyright IBM Corp. 2006, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1660756 2007-02-22 ebak Embedded object support + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMObjectPath; + +/** + * Class AbstractObjectNode is the superclass of ClassNode and InstanceNode + * classes. + */ +public abstract class AbstractObjectNode extends Node implements ValueIf { + + protected CIMObjectPath iLocalPath; + + /** + * Ctor. + * + * @param pNameEnum + */ + public AbstractObjectNode(String pNameEnum) { + super(pNameEnum); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractObjectPathNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractObjectPathNode.java similarity index 63% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractObjectPathNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractObjectPathNode.java index 8c2d950..896915a 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractObjectPathNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractObjectPathNode.java @@ -1,59 +1,57 @@ -/** - * (C) Copyright IBM Corp. 2006, 2009 - * - * THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - * ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - * CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - * - * You can obtain a current copy of the Eclipse Public License from - * http://www.opensource.org/licenses/eclipse-1.0.php - * - * @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -/** - * Class AbstractObjectPathNode is the superclass of ClassPathNode, - * InstancePathNode LocalClassPathNode and LocalInstancePathNode classes. - */ -public abstract class AbstractObjectPathNode extends AbstractPathNode { - - /** - * Ctor. - * - * @param pNameEnum - */ - public AbstractObjectPathNode(String pNameEnum) { - super(pNameEnum); - } - -} +/** + * (C) Copyright IBM Corp. 2006, 2009 + * + * THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + * ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + * CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + * + * You can obtain a current copy of the Eclipse Public License from + * http://www.opensource.org/licenses/eclipse-1.0.php + * + * @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +/** + * Class AbstractObjectPathNode is the superclass of ClassPathNode, + * InstancePathNode LocalClassPathNode and LocalInstancePathNode classes. + */ +public abstract class AbstractObjectPathNode extends AbstractPathNode { + + /** + * Ctor. + * + * @param pNameEnum + */ + public AbstractObjectPathNode(String pNameEnum) { + super(pNameEnum); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractParamValueNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractParamValueNode.java similarity index 64% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractParamValueNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractParamValueNode.java index 66175aa..5fa88ef 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractParamValueNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractParamValueNode.java @@ -1,70 +1,68 @@ -/* - (C) Copyright IBM Corp. 2006, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1686000 2007-04-19 ebak modifyInstance() missing from WBEMClient - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMArgument; - -/** - * Class AbstractParamValueNode is the superclass of IParamValueNode and - * ParamValueNode classes. - */ -public abstract class AbstractParamValueNode extends Node implements TypedIf, ValueIf { - - /** - * Ctor. - * - * @param pNameEnum - */ - public AbstractParamValueNode(String pNameEnum) { - super(pNameEnum); - } - - /** - * getCIMArgument - * - * @return CIMArgument - */ - public abstract CIMArgument getCIMArgument(); - -} +/* + (C) Copyright IBM Corp. 2006, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1686000 2007-04-19 ebak modifyInstance() missing from WBEMClient + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMArgument; + +/** + * Class AbstractParamValueNode is the superclass of IParamValueNode and + * ParamValueNode classes. + */ +public abstract class AbstractParamValueNode extends Node implements TypedIf, ValueIf { + + /** + * Ctor. + * + * @param pNameEnum + */ + public AbstractParamValueNode(String pNameEnum) { + super(pNameEnum); + } + + /** + * getCIMArgument + * + * @return CIMArgument + */ + public abstract CIMArgument getCIMArgument(); + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractParameterNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractParameterNode.java similarity index 76% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractParameterNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractParameterNode.java index 1c690a2..87140b2 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractParameterNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractParameterNode.java @@ -1,126 +1,123 @@ -/* - (C) Copyright IBM Corp. 2006, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1660756 2007-02-22 ebak Embedded object support - * 1820763 2007-10-29 ebak Supporting the EmbeddedInstance qualifier - * 1848607 2007-12-11 ebak Strict EmbeddedObject types - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMParameter; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - * Class AbstractParameterNode is the superclass of ParameterArrayNode, - * ParameterNode, ParameterRefArrayNode and ParameterReferenceNode classes. - */ -public abstract class AbstractParameterNode extends Node implements TypedIf { - - private String iName; - - protected QualifiedNodeHandler iQualiHandler; - - protected SAXSession iSession; - - /** - * Ctor. - * - * @param pNameEnum - */ - public AbstractParameterNode(String pNameEnum) { - super(pNameEnum); - } - - @Override - public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { - this.iSession = pSession; - this.iQualiHandler = QualifiedNodeHandler.init(this.iQualiHandler); - this.iName = getCIMName(pAttribs); - specificInit(pAttribs); - } - - protected abstract void specificInit(Attributes pAttribs) throws SAXException; - - @Override - public void testChild(String pNodeNameEnum) throws SAXException { - if (pNodeNameEnum != QUALIFIER) throw new SAXException(getNodeName() + " cannot have " - + pNodeNameEnum + " child node!"); - } - - @Override - public void childParsed(Node pChild) { - this.iQualiHandler.addQualifierNode(pChild); - } - - /** - * @param pData - */ - @Override - public void parseData(String pData) { - // no data - } - - /** - * getCIMParameter - * - * @return CIMParameter - */ - public CIMParameter getCIMParameter() { - /* - * CIMParameter(String name, CIMDataType type, CIMQualifier[] - * qualifiers) - * - * Not dealing with embedded object is faster. Here we don't have to do - * anything with embedded object qualifier, since parameter doesn't have - * value. - * - * Strict embObj type parsing requires different behavior. - */ - return new CIMParameter(this.iName, getType(), this.iQualiHandler - .getQualis(!this.iSession.strictEmbObjParsing())); - } - -} +/* + (C) Copyright IBM Corp. 2006, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1660756 2007-02-22 ebak Embedded object support + * 1820763 2007-10-29 ebak Supporting the EmbeddedInstance qualifier + * 1848607 2007-12-11 ebak Strict EmbeddedObject types + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMParameter; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + * Class AbstractParameterNode is the superclass of ParameterArrayNode, + * ParameterNode, ParameterRefArrayNode and ParameterReferenceNode classes. + */ +public abstract class AbstractParameterNode extends Node implements TypedIf { + + private String iName; + + protected QualifiedNodeHandler iQualiHandler; + + protected SAXSession iSession; + + /** + * Ctor. + * + * @param pNameEnum + */ + public AbstractParameterNode(String pNameEnum) { + super(pNameEnum); + } + + @Override + public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { + this.iSession = pSession; + this.iQualiHandler = QualifiedNodeHandler.init(this.iQualiHandler); + this.iName = getCIMName(pAttribs); + specificInit(pAttribs); + } + + protected abstract void specificInit(Attributes pAttribs) throws SAXException; + + @Override + public void testChild(String pNodeNameEnum) throws SAXException { + if (pNodeNameEnum != QUALIFIER) throw new SAXException(getNodeName() + " cannot have " + + pNodeNameEnum + " child node!"); + } + + @Override + public void childParsed(Node pChild) { + this.iQualiHandler.addQualifierNode(pChild); + } + + /** + * @param pData + */ + @Override + public void parseData(String pData) { + // no data + } + + /** + * getCIMParameter + * + * @return CIMParameter + */ + public CIMParameter getCIMParameter() { + /* + * CIMParameter(String name, CIMDataType type, CIMQualifier[] + * qualifiers) + * + * Not dealing with embedded object is faster. Here we don't have to do + * anything with embedded object qualifier, since parameter doesn't have + * value. + * + * Strict embObj type parsing requires different behavior. + */ + return new CIMParameter(this.iName, getType(), this.iQualiHandler + .getQualis(!this.iSession.strictEmbObjParsing())); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractPathNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractPathNode.java similarity index 64% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractPathNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractPathNode.java index c57bedd..58dfb19 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractPathNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractPathNode.java @@ -1,67 +1,65 @@ -/* - (C) Copyright IBM Corp. 2006, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -/** - * Class AbstractPathNode is the superclass of AbstractObjectPathNode, - * ClassNameNode, InstanceNameNode and ObjectPathNode classes. - */ -public abstract class AbstractPathNode extends Node implements ObjectPathIf, ValueIf { - - /** - * Ctor. - * - * @param pNameEnum - */ - public AbstractPathNode(String pNameEnum) { - super(pNameEnum); - } - - /** - * @see ValueIf#getValue() - * @return CIMObjectPath - */ - public Object getValue() { - return getCIMObjectPath(); - } - -} +/* + (C) Copyright IBM Corp. 2006, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +/** + * Class AbstractPathNode is the superclass of AbstractObjectPathNode, + * ClassNameNode, InstanceNameNode and ObjectPathNode classes. + */ +public abstract class AbstractPathNode extends Node implements ObjectPathIf, ValueIf { + + /** + * Ctor. + * + * @param pNameEnum + */ + public AbstractPathNode(String pNameEnum) { + super(pNameEnum); + } + + /** + * @see ValueIf#getValue() + * @return CIMObjectPath + */ + public Object getValue() { + return getCIMObjectPath(); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractPropertyNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractPropertyNode.java similarity index 78% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractPropertyNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractPropertyNode.java index 9e4e10c..72e34e8 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractPropertyNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractPropertyNode.java @@ -1,164 +1,161 @@ -/* - (C) Copyright IBM Corp. 2006, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1660756 2007-02-22 ebak Embedded object support - * 1689085 2007-04-10 ebak Embedded object enhancements for Pegasus - * 1714878 2007-05-08 ebak Empty string property values are parsed as null - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMClassProperty; -import org.sentrysoftware.wbem.javax.cim.CIMProperty; -import org.sentrysoftware.wbem.javax.cim.CIMQualifier; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - * AbstractPropertyNode is superclass of PropertyArrayNode, PropertyNode and - * PropertyReferenceNode classes. - */ -public abstract class AbstractPropertyNode extends Node implements TypedIf, ValueIf { - - // common attributes - private String iName; - - private String iClassOrigin; - - private boolean iPropagated; - - protected QualifiedNodeHandler iQualiHandler; - - /** - * Ctor. - * - * @param pNameEnum - */ - public AbstractPropertyNode(String pNameEnum) { - super(pNameEnum); - } - - /** - * hasValue - * - * @return true if it has a value child node - */ - protected abstract boolean hasValueNode(); - - protected abstract void childValueNodeParsed(Node pChild) throws SAXException; - - protected abstract void specificInit(Attributes pAttribs, SAXSession pSession) - throws SAXException; - - protected abstract String getChildValueNodeNameEnum(); - - @Override - public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { - this.iQualiHandler = QualifiedNodeHandler.init(this.iQualiHandler); - this.iName = getCIMName(pAttribs); - this.iClassOrigin = getClassOrigin(pAttribs); - this.iPropagated = getPropagated(pAttribs); - specificInit(pAttribs, pSession); - } - - @Override - public void testChild(String pNodeNameEnum) throws SAXException { - String valueNodeNameEnum = getChildValueNodeNameEnum(); - if (pNodeNameEnum == valueNodeNameEnum) { - if (hasValueNode()) throw new SAXException(getNodeName() + " node can have only one " - + valueNodeNameEnum + " child node!"); - } else if (pNodeNameEnum != QUALIFIER) throw new SAXException(getNodeName() - + " node cannot have " + pNodeNameEnum + " child node!"); - } - - /** - * @param pData - */ - @Override - public void parseData(String pData) { - // no data - } - - @Override - public void childParsed(Node pChild) throws SAXException { - if (!this.iQualiHandler.addQualifierNode(pChild)) { - childValueNodeParsed(pChild); - } - } - - protected CIMQualifier[] getQualis() { - // not dealing with embedded object qualifier is faster - return this.iQualiHandler.getQualis(true); - } - - /** - * getCIMProperty - * - * @return CIMProperty - */ - public CIMProperty getCIMProperty() { - /* - * CIMProperty( String name, CIMDataType type, Object value, boolean - * key, boolean propagated, String originClass ) - */ - return new CIMProperty(this.iName, getType(), getValue(), this.iQualiHandler - .isKeyed(), this.iPropagated, this.iClassOrigin); - } - - /** - * getCIMClassProperty - * - * @return CIMClassProperty - */ - public CIMClassProperty getCIMClassProperty() { - /* - * CIMClassProperty( String pName, CIMDataType pType, Object pValue, - * CIMQualifier[] pQualifiers, boolean pKey, boolean propagated, String - * originClass) ); - */ - return new CIMClassProperty(this.iName, getType(), getValue(), getQualis(), - this.iQualiHandler.isKeyed(), this.iPropagated, this.iClassOrigin); - } - -} +/* + (C) Copyright IBM Corp. 2006, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1660756 2007-02-22 ebak Embedded object support + * 1689085 2007-04-10 ebak Embedded object enhancements for Pegasus + * 1714878 2007-05-08 ebak Empty string property values are parsed as null + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMClassProperty; +import org.metricshub.wbem.javax.cim.CIMQualifier; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; +import org.metricshub.wbem.javax.cim.CIMProperty; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + * AbstractPropertyNode is superclass of PropertyArrayNode, PropertyNode and + * PropertyReferenceNode classes. + */ +public abstract class AbstractPropertyNode extends Node implements TypedIf, ValueIf { + + // common attributes + private String iName; + + private String iClassOrigin; + + private boolean iPropagated; + + protected QualifiedNodeHandler iQualiHandler; + + /** + * Ctor. + * + * @param pNameEnum + */ + public AbstractPropertyNode(String pNameEnum) { + super(pNameEnum); + } + + /** + * hasValue + * + * @return true if it has a value child node + */ + protected abstract boolean hasValueNode(); + + protected abstract void childValueNodeParsed(Node pChild) throws SAXException; + + protected abstract void specificInit(Attributes pAttribs, SAXSession pSession) + throws SAXException; + + protected abstract String getChildValueNodeNameEnum(); + + @Override + public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { + this.iQualiHandler = QualifiedNodeHandler.init(this.iQualiHandler); + this.iName = getCIMName(pAttribs); + this.iClassOrigin = getClassOrigin(pAttribs); + this.iPropagated = getPropagated(pAttribs); + specificInit(pAttribs, pSession); + } + + @Override + public void testChild(String pNodeNameEnum) throws SAXException { + String valueNodeNameEnum = getChildValueNodeNameEnum(); + if (pNodeNameEnum == valueNodeNameEnum) { + if (hasValueNode()) throw new SAXException(getNodeName() + " node can have only one " + + valueNodeNameEnum + " child node!"); + } else if (pNodeNameEnum != QUALIFIER) throw new SAXException(getNodeName() + + " node cannot have " + pNodeNameEnum + " child node!"); + } + + /** + * @param pData + */ + @Override + public void parseData(String pData) { + // no data + } + + @Override + public void childParsed(Node pChild) throws SAXException { + if (!this.iQualiHandler.addQualifierNode(pChild)) { + childValueNodeParsed(pChild); + } + } + + protected CIMQualifier[] getQualis() { + // not dealing with embedded object qualifier is faster + return this.iQualiHandler.getQualis(true); + } + + /** + * getCIMProperty + * + * @return CIMProperty + */ + public CIMProperty getCIMProperty() { + /* + * CIMProperty( String name, CIMDataType type, Object value, boolean + * key, boolean propagated, String originClass ) + */ + return new CIMProperty(this.iName, getType(), getValue(), this.iQualiHandler + .isKeyed(), this.iPropagated, this.iClassOrigin); + } + + /** + * getCIMClassProperty + * + * @return CIMClassProperty + */ + public CIMClassProperty getCIMClassProperty() { + /* + * CIMClassProperty( String pName, CIMDataType pType, Object pValue, + * CIMQualifier[] pQualifiers, boolean pKey, boolean propagated, String + * originClass) ); + */ + return new CIMClassProperty(this.iName, getType(), getValue(), getQualis(), + this.iQualiHandler.isKeyed(), this.iPropagated, this.iClassOrigin); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractResponseNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractResponseNode.java similarity index 62% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractResponseNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractResponseNode.java index 731bc70..d8ad8de 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractResponseNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractResponseNode.java @@ -1,59 +1,57 @@ -/* - (C) Copyright IBM Corp. 2006, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -/** - * Class AbstractResponseNode is superclass of AbstractMulitRspNode and - * AbstractSimpleRspNode classes. - */ -public abstract class AbstractResponseNode extends AbstractMessageNode { - - /** - * Ctor. - * - * @param pNameEnum - */ - public AbstractResponseNode(String pNameEnum) { - super(pNameEnum); - } - -} +/* + (C) Copyright IBM Corp. 2006, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +/** + * Class AbstractResponseNode is superclass of AbstractMulitRspNode and + * AbstractSimpleRspNode classes. + */ +public abstract class AbstractResponseNode extends AbstractMessageNode { + + /** + * Ctor. + * + * @param pNameEnum + */ + public AbstractResponseNode(String pNameEnum) { + super(pNameEnum); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractScalarValueNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractScalarValueNode.java similarity index 65% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractScalarValueNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractScalarValueNode.java index 3d1b5d9..1ec4555 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractScalarValueNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractScalarValueNode.java @@ -1,62 +1,60 @@ -/* - (C) Copyright IBM Corp. 2006, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1719991 2007-05-16 ebak FVT: regression ClassCastException in EmbObjHandler - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -/** - * Class AbstractScalarValueNode is superclass of KeyValueNode, - * ValueNamedInstanceNode, ValueNode, ValueNullNode, ValueObjectNode, - * ValueObjectWithLocalPathNode, ValueObjectWithPathNode and ValueReferenceNode - * classes. - */ -public abstract class AbstractScalarValueNode extends AbstractValueNode { - - /** - * Ctor. - * - * @param pNameEnum - */ - public AbstractScalarValueNode(String pNameEnum) { - super(pNameEnum); - } - -} +/* + (C) Copyright IBM Corp. 2006, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1719991 2007-05-16 ebak FVT: regression ClassCastException in EmbObjHandler + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +/** + * Class AbstractScalarValueNode is superclass of KeyValueNode, + * ValueNamedInstanceNode, ValueNode, ValueNullNode, ValueObjectNode, + * ValueObjectWithLocalPathNode, ValueObjectWithPathNode and ValueReferenceNode + * classes. + */ +public abstract class AbstractScalarValueNode extends AbstractValueNode { + + /** + * Ctor. + * + * @param pNameEnum + */ + public AbstractScalarValueNode(String pNameEnum) { + super(pNameEnum); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractSimpleRspNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractSimpleRspNode.java similarity index 62% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractSimpleRspNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractSimpleRspNode.java index ed5c1ef..93fccaf 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractSimpleRspNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractSimpleRspNode.java @@ -1,74 +1,71 @@ -/* - (C) Copyright IBM Corp. 2006, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMArgument; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.CIMError; - -/** - * Class AbstractSimpleRspNode is the superclass of SimpleExpRspNode and - * SimpleRspNode classes. - */ -public abstract class AbstractSimpleRspNode extends AbstractResponseNode implements ErrorIf, - RetValPipeIf { - - /** - * Ctor. - * - * @param pNameEnum - */ - public AbstractSimpleRspNode(String pNameEnum) { - super(pNameEnum); - } - - public abstract CIMError getCIMError(); - - /** - * getCIMArguments - * - * @return CIMArgument[] - */ - public abstract CIMArgument[] getCIMArguments(); - -} +/* + (C) Copyright IBM Corp. 2006, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMArgument; +import org.metricshub.wbem.sblim.cimclient.internal.wbem.CIMError; + +/** + * Class AbstractSimpleRspNode is the superclass of SimpleExpRspNode and + * SimpleRspNode classes. + */ +public abstract class AbstractSimpleRspNode extends AbstractResponseNode implements ErrorIf, + RetValPipeIf { + + /** + * Ctor. + * + * @param pNameEnum + */ + public AbstractSimpleRspNode(String pNameEnum) { + super(pNameEnum); + } + + public abstract CIMError getCIMError(); + + /** + * getCIMArguments + * + * @return CIMArgument[] + */ + public abstract CIMArgument[] getCIMArguments(); + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractValueNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractValueNode.java similarity index 63% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractValueNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractValueNode.java index 4ab8be9..5dd0b2b 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractValueNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractValueNode.java @@ -1,60 +1,58 @@ -/* - (C) Copyright IBM Corp. 2006, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1719991 2007-05-16 ebak FVT: regression ClassCastException in EmbObjHandler - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -/** - * Class AbstractValueNode is the superclass of AbstractArrayValueNode and - * AbstractScalarValueNode classes. - */ -public abstract class AbstractValueNode extends Node implements TypedIf, ValueIf { - - /** - * Ctor. - * - * @param pNameEnum - */ - public AbstractValueNode(String pNameEnum) { - super(pNameEnum); - } - -} +/* + (C) Copyright IBM Corp. 2006, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1719991 2007-05-16 ebak FVT: regression ClassCastException in EmbObjHandler + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +/** + * Class AbstractValueNode is the superclass of AbstractArrayValueNode and + * AbstractScalarValueNode classes. + */ +public abstract class AbstractValueNode extends Node implements TypedIf, ValueIf { + + /** + * Ctor. + * + * @param pNameEnum + */ + public AbstractValueNode(String pNameEnum) { + super(pNameEnum); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ArrayIf.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ArrayIf.java similarity index 61% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ArrayIf.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ArrayIf.java index 814805f..e6f84d9 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ArrayIf.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ArrayIf.java @@ -1,64 +1,62 @@ -/* - (C) Copyright IBM Corp. 2006, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -/** - * It is implemented by the AbstractArrayValueNode class. - */ -public interface ArrayIf { - - /** - * size - * - * @return int - */ - public int size(); - - /** - * elementAt - * - * @param pIdx - * @return Object - */ - public Object elementAt(int pIdx); - -} +/* + (C) Copyright IBM Corp. 2006, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +/** + * It is implemented by the AbstractArrayValueNode class. + */ +public interface ArrayIf { + + /** + * size + * + * @return int + */ + public int size(); + + /** + * elementAt + * + * @param pIdx + * @return Object + */ + public Object elementAt(int pIdx); + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/CIMNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/CIMNode.java similarity index 79% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/CIMNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/CIMNode.java index 765f441..a3e7308 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/CIMNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/CIMNode.java @@ -1,157 +1,155 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1660756 2007-02-22 ebak Embedded object support - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 3511454 2012-03-27 blaschke-oss SAX nodes not reinitialized properly - * 2604 2013-07-01 blaschke-oss SAXException messages should contain node name - * 2708 2013-11-12 blaschke-oss CIMNode quietly ignores DECLARATION child - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - *
      - * ELEMENT CIM (MESSAGE | DECLARATION)
      - * ATTLIST CIM
      - * 	CIMVERSION CDATA #REQUIRED
      - * DTDVERSION CDATA #REQUIRED
      - * 
      - */ -public class CIMNode extends Node implements NonVolatileIf { - - /** - * Ctor. - */ - public CIMNode() { - super(CIM); - } - - private Node iContent; - - private String iCimVersion, iDtdVersion; - - public void addChild(Node pChild) { - this.iContent = pChild; - } - - /** - * @param pSession - */ - @Override - public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { - this.iCimVersion = pAttribs.getValue("CIMVERSION"); - if (this.iCimVersion == null) { throw new SAXException( - "CIMVERSION attribute is mandatory for " + getNodeName() + " node!"); } - this.iDtdVersion = pAttribs.getValue("DTDVERSION"); - if (this.iDtdVersion == null) { throw new SAXException( - "DTDVERSION attribute is mandatory for " + getNodeName() + " node!"); } - this.iContent = null; - } - - /** - * @param pData - */ - @Override - public void parseData(String pData) { - return; - } - - @Override - public void testChild(String pNodeNameEnum) throws SAXException { - if (this.iContent != null) { - String msg = "CIM node also has a " + this.iContent.getNodeName() + " child node!"; - throw new SAXException(msg); - } - if (pNodeNameEnum == MESSAGE) return; - String msg = (pNodeNameEnum == DECLARATION) ? "DECLARATION child node not supported by CIM node!" - : pNodeNameEnum + " cannot be a child node of CIM node!"; - throw new SAXException(msg); - } - - @Override - public void testCompletness() throws SAXException { - if (this.iContent == null) throw new SAXException( - "CIM node must have a MESSAGE or a DECLARATION child!"); - } - - /** - * @param pChild - */ - @Override - public void childParsed(Node pChild) { - // nothing to do here - } - - /** - * getCimVersion - * - * @return String - */ - public String getCimVersion() { - return this.iCimVersion; - } - - /** - * getDtdVersion - * - * @return String - */ - public String getDtdVersion() { - return this.iDtdVersion; - } - - /** - * getMessageNode - * - * @return MessageNode or null - */ - public MessageNode getMessageNode() { - return (this.iContent instanceof MessageNode) ? (MessageNode) this.iContent : null; - } - - // not implemented yet - // public DeclarationNode getDeclarationNode() {} - -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1660756 2007-02-22 ebak Embedded object support + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 3511454 2012-03-27 blaschke-oss SAX nodes not reinitialized properly + * 2604 2013-07-01 blaschke-oss SAXException messages should contain node name + * 2708 2013-11-12 blaschke-oss CIMNode quietly ignores DECLARATION child + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + *
      + * ELEMENT CIM (MESSAGE | DECLARATION)
      + * ATTLIST CIM
      + * 	CIMVERSION CDATA #REQUIRED
      + * DTDVERSION CDATA #REQUIRED
      + * 
      + */ +public class CIMNode extends Node implements NonVolatileIf { + + /** + * Ctor. + */ + public CIMNode() { + super(CIM); + } + + private Node iContent; + + private String iCimVersion, iDtdVersion; + + public void addChild(Node pChild) { + this.iContent = pChild; + } + + /** + * @param pSession + */ + @Override + public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { + this.iCimVersion = pAttribs.getValue("CIMVERSION"); + if (this.iCimVersion == null) { throw new SAXException( + "CIMVERSION attribute is mandatory for " + getNodeName() + " node!"); } + this.iDtdVersion = pAttribs.getValue("DTDVERSION"); + if (this.iDtdVersion == null) { throw new SAXException( + "DTDVERSION attribute is mandatory for " + getNodeName() + " node!"); } + this.iContent = null; + } + + /** + * @param pData + */ + @Override + public void parseData(String pData) { + return; + } + + @Override + public void testChild(String pNodeNameEnum) throws SAXException { + if (this.iContent != null) { + String msg = "CIM node also has a " + this.iContent.getNodeName() + " child node!"; + throw new SAXException(msg); + } + if (pNodeNameEnum == MESSAGE) return; + String msg = (pNodeNameEnum == DECLARATION) ? "DECLARATION child node not supported by CIM node!" + : pNodeNameEnum + " cannot be a child node of CIM node!"; + throw new SAXException(msg); + } + + @Override + public void testCompletness() throws SAXException { + if (this.iContent == null) throw new SAXException( + "CIM node must have a MESSAGE or a DECLARATION child!"); + } + + /** + * @param pChild + */ + @Override + public void childParsed(Node pChild) { + // nothing to do here + } + + /** + * getCimVersion + * + * @return String + */ + public String getCimVersion() { + return this.iCimVersion; + } + + /** + * getDtdVersion + * + * @return String + */ + public String getDtdVersion() { + return this.iDtdVersion; + } + + /** + * getMessageNode + * + * @return MessageNode or null + */ + public MessageNode getMessageNode() { + return (this.iContent instanceof MessageNode) ? (MessageNode) this.iContent : null; + } + + // not implemented yet + // public DeclarationNode getDeclarationNode() {} + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ClassNameNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ClassNameNode.java similarity index 69% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ClassNameNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ClassNameNode.java index f454266..2de56ec 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ClassNameNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ClassNameNode.java @@ -1,122 +1,119 @@ -/* - (C) Copyright IBM Corp. 2006, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1660756 2007-02-22 ebak Embedded object support - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.LocalPathBuilder; -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - *
      - * ELEMENT CLASSNAME EMPTY
      - *   ATTLIST CLASSNAME
      - *   %CIMName;
      - * 
      - */ -public class ClassNameNode extends AbstractPathNode { - - private String iClassName; - - private CIMObjectPath iLocalPath; - - /** - * Ctor. - */ - public ClassNameNode() { - super(CLASSNAME); - } - - @Override - public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { - this.iLocalPath = pSession.getDefLocalPath(); - this.iClassName = getCIMName(pAttribs); - } - - /** - * @param pData - */ - @Override - public void parseData(String pData) { - // no data - } - - /** - * @param pNodeNameEnum - */ - @Override - public void testChild(String pNodeNameEnum) throws SAXException { - throw new SAXException("CLASSNAME node cannot have any child node!"); - } - - @Override - public void testCompletness() { - // no child nodes to test - } - - /** - * @param pChild - */ - @Override - public void childParsed(Node pChild) { - // nothing to do - } - - /** - * getClassName - * - * @return String - */ - public String getClassName() { - return this.iClassName; - } - - public CIMObjectPath getCIMObjectPath() { - return LocalPathBuilder.build(this.iLocalPath, this.iClassName, null); - } - -} +/* + (C) Copyright IBM Corp. 2006, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1660756 2007-02-22 ebak Embedded object support + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMObjectPath; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.LocalPathBuilder; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + *
      + * ELEMENT CLASSNAME EMPTY
      + *   ATTLIST CLASSNAME
      + *   %CIMName;
      + * 
      + */ +public class ClassNameNode extends AbstractPathNode { + + private String iClassName; + + private CIMObjectPath iLocalPath; + + /** + * Ctor. + */ + public ClassNameNode() { + super(CLASSNAME); + } + + @Override + public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { + this.iLocalPath = pSession.getDefLocalPath(); + this.iClassName = getCIMName(pAttribs); + } + + /** + * @param pData + */ + @Override + public void parseData(String pData) { + // no data + } + + /** + * @param pNodeNameEnum + */ + @Override + public void testChild(String pNodeNameEnum) throws SAXException { + throw new SAXException("CLASSNAME node cannot have any child node!"); + } + + @Override + public void testCompletness() { + // no child nodes to test + } + + /** + * @param pChild + */ + @Override + public void childParsed(Node pChild) { + // nothing to do + } + + /** + * getClassName + * + * @return String + */ + public String getClassName() { + return this.iClassName; + } + + public CIMObjectPath getCIMObjectPath() { + return LocalPathBuilder.build(this.iLocalPath, this.iClassName, null); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ClassNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ClassNode.java similarity index 78% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ClassNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ClassNode.java index 3df3285..add4f08 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ClassNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ClassNode.java @@ -1,184 +1,181 @@ -/* - (C) Copyright IBM Corp. 2006, 2012 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1660756 2007-02-22 ebak Embedded object support - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 1783288 2007-09-10 ebak CIMClass.isAssociation() not working for retrieved classes. - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics - * 3500619 2012-03-16 blaschke-oss JSR48 1.0.0: CIMClass association/key clean up - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.ArrayList; - -import org.sentrysoftware.wbem.javax.cim.CIMClass; -import org.sentrysoftware.wbem.javax.cim.CIMClassProperty; -import org.sentrysoftware.wbem.javax.cim.CIMMethod; -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; - -import org.sentrysoftware.wbem.sblim.cimclient.GenericExts; -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.LocalPathBuilder; -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - *
      - * ELEMENT CLASS (QUALIFIER*, (PROPERTY | PROPERTY.ARRAY | PROPERTY.REFERENCE)*, METHOD*)
      - * ATTLIST CLASS
      - * %CIMName; 
      - * %SuperClass;
      - * 
      - */ -public class ClassNode extends AbstractObjectNode { - - private String iName; - - private String iSuperClass; - - private QualifiedNodeHandler iQualiHandler; - - private ArrayList> iCIMClassPropAL; - - private boolean iKeyed; - - private ArrayList> iCIMMethodAL; - - /** - * Ctor. - */ - public ClassNode() { - super(CLASS); - } - - @Override - public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { - this.iLocalPath = pSession.getDefLocalPath(); - this.iQualiHandler = QualifiedNodeHandler.init(this.iQualiHandler); - this.iCIMClassPropAL = GenericExts.initClearArrayList(this.iCIMClassPropAL); - this.iKeyed = false; - this.iCIMMethodAL = GenericExts.initClearArrayList(this.iCIMMethodAL); - this.iName = getCIMName(pAttribs); - this.iSuperClass = pAttribs.getValue("SUPERCLASS"); // not mandatory - } - - /** - * @param pData - */ - @Override - public void parseData(String pData) { - // no data - } - - private static final String[] ALLOWED_CHILDREN = { QUALIFIER, PROPERTY, PROPERTY_ARRAY, - PROPERTY_REFERENCE, METHOD }; - - @Override - public void testChild(String pNodeNameEnum) throws SAXException { - for (int i = 0; i < ALLOWED_CHILDREN.length; i++) - if (ALLOWED_CHILDREN[i] == pNodeNameEnum) return; - throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum - + " child node!"); - } - - @Override - public void childParsed(Node pChild) { - if (this.iQualiHandler.addQualifierNode(pChild)) return; - if (pChild instanceof AbstractPropertyNode) { - if (this.iCIMClassPropAL == null) this.iCIMClassPropAL = new ArrayList>(); - CIMClassProperty prop = ((AbstractPropertyNode) pChild).getCIMClassProperty(); - if (prop.isKey()) this.iKeyed = true; - this.iCIMClassPropAL.add(prop); - } else { - if (this.iCIMMethodAL == null) this.iCIMMethodAL = new ArrayList>(); - this.iCIMMethodAL.add(((MethodNode) pChild).getCIMMethod()); - } - } - - @Override - public void testCompletness() { - // all child nodes are optional - } - - /** - * getCIMClass - * - * @return CIMClass - */ - public CIMClass getCIMClass() { - /* - * ebak: this constructor can add localPath info to the class CIMClass( - * CIMObjectPath path, String superclass, CIMQualifier[] qualifiers, - * CIMClassProperty[] props, CIMMethod[] pMethods, boolean - * pIsAssociation, boolean pIsKeyed ) - */ - return new CIMClass(LocalPathBuilder.build(this.iLocalPath, this.iName, null), - this.iSuperClass, this.iQualiHandler.getQualis(), this.iCIMClassPropAL - .toArray(EMPTY_PA), this.iCIMMethodAL.toArray(EMPTY_MA), this.iQualiHandler - .isAssociation(), this.iKeyed); - } - - private static final CIMMethod[] EMPTY_MA = new CIMMethod[0]; - - private static final CIMClassProperty[] EMPTY_PA = new CIMClassProperty[0]; - - /** - * getCIMClass - * - * @param pObjPath - * @return CIMClass with the provided object path - */ - public CIMClass getCIMClass(CIMObjectPath pObjPath) { - return new CIMClass(pObjPath, this.iSuperClass, this.iQualiHandler.getQualis(), - this.iCIMClassPropAL.toArray(EMPTY_PA), this.iCIMMethodAL.toArray(EMPTY_MA), - this.iQualiHandler.isAssociation(), this.iKeyed); - } - - /** - * @see ValueIf#getValue() - * @return CIMClass - */ - public Object getValue() { - return getCIMClass(); - } - -} +/* + (C) Copyright IBM Corp. 2006, 2012 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1660756 2007-02-22 ebak Embedded object support + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 1783288 2007-09-10 ebak CIMClass.isAssociation() not working for retrieved classes. + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics + * 3500619 2012-03-16 blaschke-oss JSR48 1.0.0: CIMClass association/key clean up + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.ArrayList; + +import org.metricshub.wbem.javax.cim.CIMClass; +import org.metricshub.wbem.javax.cim.CIMClassProperty; +import org.metricshub.wbem.javax.cim.CIMMethod; +import org.metricshub.wbem.javax.cim.CIMObjectPath; +import org.metricshub.wbem.sblim.cimclient.GenericExts; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.LocalPathBuilder; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + *
      + * ELEMENT CLASS (QUALIFIER*, (PROPERTY | PROPERTY.ARRAY | PROPERTY.REFERENCE)*, METHOD*)
      + * ATTLIST CLASS
      + * %CIMName; 
      + * %SuperClass;
      + * 
      + */ +public class ClassNode extends AbstractObjectNode { + + private String iName; + + private String iSuperClass; + + private QualifiedNodeHandler iQualiHandler; + + private ArrayList> iCIMClassPropAL; + + private boolean iKeyed; + + private ArrayList> iCIMMethodAL; + + /** + * Ctor. + */ + public ClassNode() { + super(CLASS); + } + + @Override + public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { + this.iLocalPath = pSession.getDefLocalPath(); + this.iQualiHandler = QualifiedNodeHandler.init(this.iQualiHandler); + this.iCIMClassPropAL = GenericExts.initClearArrayList(this.iCIMClassPropAL); + this.iKeyed = false; + this.iCIMMethodAL = GenericExts.initClearArrayList(this.iCIMMethodAL); + this.iName = getCIMName(pAttribs); + this.iSuperClass = pAttribs.getValue("SUPERCLASS"); // not mandatory + } + + /** + * @param pData + */ + @Override + public void parseData(String pData) { + // no data + } + + private static final String[] ALLOWED_CHILDREN = { QUALIFIER, PROPERTY, PROPERTY_ARRAY, + PROPERTY_REFERENCE, METHOD }; + + @Override + public void testChild(String pNodeNameEnum) throws SAXException { + for (int i = 0; i < ALLOWED_CHILDREN.length; i++) + if (ALLOWED_CHILDREN[i] == pNodeNameEnum) return; + throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum + + " child node!"); + } + + @Override + public void childParsed(Node pChild) { + if (this.iQualiHandler.addQualifierNode(pChild)) return; + if (pChild instanceof AbstractPropertyNode) { + if (this.iCIMClassPropAL == null) this.iCIMClassPropAL = new ArrayList>(); + CIMClassProperty prop = ((AbstractPropertyNode) pChild).getCIMClassProperty(); + if (prop.isKey()) this.iKeyed = true; + this.iCIMClassPropAL.add(prop); + } else { + if (this.iCIMMethodAL == null) this.iCIMMethodAL = new ArrayList>(); + this.iCIMMethodAL.add(((MethodNode) pChild).getCIMMethod()); + } + } + + @Override + public void testCompletness() { + // all child nodes are optional + } + + /** + * getCIMClass + * + * @return CIMClass + */ + public CIMClass getCIMClass() { + /* + * ebak: this constructor can add localPath info to the class CIMClass( + * CIMObjectPath path, String superclass, CIMQualifier[] qualifiers, + * CIMClassProperty[] props, CIMMethod[] pMethods, boolean + * pIsAssociation, boolean pIsKeyed ) + */ + return new CIMClass(LocalPathBuilder.build(this.iLocalPath, this.iName, null), + this.iSuperClass, this.iQualiHandler.getQualis(), this.iCIMClassPropAL + .toArray(EMPTY_PA), this.iCIMMethodAL.toArray(EMPTY_MA), this.iQualiHandler + .isAssociation(), this.iKeyed); + } + + private static final CIMMethod[] EMPTY_MA = new CIMMethod[0]; + + private static final CIMClassProperty[] EMPTY_PA = new CIMClassProperty[0]; + + /** + * getCIMClass + * + * @param pObjPath + * @return CIMClass with the provided object path + */ + public CIMClass getCIMClass(CIMObjectPath pObjPath) { + return new CIMClass(pObjPath, this.iSuperClass, this.iQualiHandler.getQualis(), + this.iCIMClassPropAL.toArray(EMPTY_PA), this.iCIMMethodAL.toArray(EMPTY_MA), + this.iQualiHandler.isAssociation(), this.iKeyed); + } + + /** + * @see ValueIf#getValue() + * @return CIMClass + */ + public Object getValue() { + return getCIMClass(); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ClassPathNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ClassPathNode.java similarity index 77% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ClassPathNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ClassPathNode.java index 616824b..060e9a5 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ClassPathNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ClassPathNode.java @@ -1,140 +1,137 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1660756 2007-02-22 ebak Embedded object support - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 1742873 2007-06-25 ebak IPv6 ready cim-client - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 3511454 2012-03-27 blaschke-oss SAX nodes not reinitialized properly - * 3602604 2013-01-29 blaschke-oss Clean up SAXException messages - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.sentrysoftware.wbem.sblim.cimclient.internal.util.XMLHostStr; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - * ELEMENT CLASSPATH (NAMESPACEPATH, CLASSNAME) - */ -public class ClassPathNode extends AbstractObjectPathNode { - - // child nodes: - private boolean iHasNameSpacePath, iHasClassName; - - private String iLocalNameSpacePathStr; - - private XMLHostStr iHostStr; - - private String iClassNameStr; - - /** - * Ctor. - */ - public ClassPathNode() { - super(CLASSPATH); - } - - /** - * @param pAttribs - * @param pSession - */ - @Override - public void init(Attributes pAttribs, SAXSession pSession) { - // reset - this.iHasNameSpacePath = this.iHasClassName = false; - this.iLocalNameSpacePathStr = this.iClassNameStr = null; - this.iHostStr = new XMLHostStr(); - } - - /** - * @param pData - */ - @Override - public void parseData(String pData) { - // no data - } - - @Override - public void testChild(String pNodeNameEnum) throws SAXException { - if (pNodeNameEnum == NAMESPACEPATH) { - if (this.iHasNameSpacePath) throw new SAXException( - "CLASSPATH node already has a NAMESPACEPATH child node!"); - } else if (pNodeNameEnum == CLASSNAME) { - if (this.iHasClassName) throw new SAXException( - "CLASSPATH node already has a CLASSNAME child node!"); - } else throw new SAXException("CLASSPATH node cannot have " + pNodeNameEnum - + " child node!" + " It can have NAMESPACEPATH and CLASSNAME child nodes only!"); - } - - @Override - public void childParsed(Node pChild) { - if (pChild instanceof NameSpacePathNode) { - NameSpacePathNode nsPathNode = (NameSpacePathNode) pChild; - this.iLocalNameSpacePathStr = nsPathNode.getLocalNameSpacePath(); - this.iHostStr.set(nsPathNode.getHostStr()); - this.iHasNameSpacePath = true; - } else { - this.iClassNameStr = ((ClassNameNode) pChild).getClassName(); - this.iHasClassName = true; - } - } - - @Override - public void testCompletness() throws SAXException { - if (!this.iHasNameSpacePath) throw new SAXException( - "NAMESPACEPATH child node is mandatory for CLASSPATH node!"); - if (!this.iHasClassName) throw new SAXException( - "CLASSNAME child node is mandatory for CLASSPATH node!"); - } - - public CIMObjectPath getCIMObjectPath() { - /* - * CIMObjectPath( String scheme, String host, String port, String - * namespace, String objectName, CIMProperty[] keys ) - */ - return new CIMObjectPath(this.iHostStr.getProtocol(), this.iHostStr.getHost(), - this.iHostStr.getPort(), this.iLocalNameSpacePathStr, this.iClassNameStr, null); - } - -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1660756 2007-02-22 ebak Embedded object support + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 1742873 2007-06-25 ebak IPv6 ready cim-client + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 3511454 2012-03-27 blaschke-oss SAX nodes not reinitialized properly + * 3602604 2013-01-29 blaschke-oss Clean up SAXException messages + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMObjectPath; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; +import org.metricshub.wbem.sblim.cimclient.internal.util.XMLHostStr; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + * ELEMENT CLASSPATH (NAMESPACEPATH, CLASSNAME) + */ +public class ClassPathNode extends AbstractObjectPathNode { + + // child nodes: + private boolean iHasNameSpacePath, iHasClassName; + + private String iLocalNameSpacePathStr; + + private XMLHostStr iHostStr; + + private String iClassNameStr; + + /** + * Ctor. + */ + public ClassPathNode() { + super(CLASSPATH); + } + + /** + * @param pAttribs + * @param pSession + */ + @Override + public void init(Attributes pAttribs, SAXSession pSession) { + // reset + this.iHasNameSpacePath = this.iHasClassName = false; + this.iLocalNameSpacePathStr = this.iClassNameStr = null; + this.iHostStr = new XMLHostStr(); + } + + /** + * @param pData + */ + @Override + public void parseData(String pData) { + // no data + } + + @Override + public void testChild(String pNodeNameEnum) throws SAXException { + if (pNodeNameEnum == NAMESPACEPATH) { + if (this.iHasNameSpacePath) throw new SAXException( + "CLASSPATH node already has a NAMESPACEPATH child node!"); + } else if (pNodeNameEnum == CLASSNAME) { + if (this.iHasClassName) throw new SAXException( + "CLASSPATH node already has a CLASSNAME child node!"); + } else throw new SAXException("CLASSPATH node cannot have " + pNodeNameEnum + + " child node!" + " It can have NAMESPACEPATH and CLASSNAME child nodes only!"); + } + + @Override + public void childParsed(Node pChild) { + if (pChild instanceof NameSpacePathNode) { + NameSpacePathNode nsPathNode = (NameSpacePathNode) pChild; + this.iLocalNameSpacePathStr = nsPathNode.getLocalNameSpacePath(); + this.iHostStr.set(nsPathNode.getHostStr()); + this.iHasNameSpacePath = true; + } else { + this.iClassNameStr = ((ClassNameNode) pChild).getClassName(); + this.iHasClassName = true; + } + } + + @Override + public void testCompletness() throws SAXException { + if (!this.iHasNameSpacePath) throw new SAXException( + "NAMESPACEPATH child node is mandatory for CLASSPATH node!"); + if (!this.iHasClassName) throw new SAXException( + "CLASSNAME child node is mandatory for CLASSPATH node!"); + } + + public CIMObjectPath getCIMObjectPath() { + /* + * CIMObjectPath( String scheme, String host, String port, String + * namespace, String objectName, CIMProperty[] keys ) + */ + return new CIMObjectPath(this.iHostStr.getProtocol(), this.iHostStr.getHost(), + this.iHostStr.getPort(), this.iLocalNameSpacePathStr, this.iClassNameStr, null); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/CorrelatorNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/CorrelatorNode.java similarity index 70% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/CorrelatorNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/CorrelatorNode.java index 427792d..361198a 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/CorrelatorNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/CorrelatorNode.java @@ -1,120 +1,117 @@ -/* - (C) Copyright IBM Corp. 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Dave Blaschke, blaschke@us.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 2538 2013-11-28 blaschke-oss CR14: Support new CORRELATOR element - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMDataType; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - *
      - * ELEMENT CORRELATOR (VALUE)
      - * ATTLIST CORRELATOR
      - *   %CIMName;
      - *   %CIMType; #REQUIRED
      - * 
      - */ -public class CorrelatorNode extends Node implements TypedIf, ValueIf { - - // private String iName; - - private CIMDataType iType; - - private Object iValue; - - private boolean iHasValue; - - /** - * Ctor. - */ - public CorrelatorNode() { - super(CORRELATOR); - } - - /** - * @param pSession - */ - @Override - public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { - /* this.iName = */getCIMName(pAttribs); - this.iType = getCIMType(pAttribs, false); - this.iValue = null; - this.iHasValue = false; - } - - /** - * @param pData - */ - @Override - public void parseData(String pData) { - // no data - } - - @Override - public void testChild(String pNodeNameEnum) throws SAXException { - if (pNodeNameEnum != VALUE) throw new SAXException(pNodeNameEnum - + " cannot be the child node of " + getNodeName() + " node!"); - if (this.iHasValue) throw new SAXException(getNodeName() - + " node can have only one child node!"); - } - - @Override - public void childParsed(Node pChild) { - if (pChild instanceof ValueNode) this.iHasValue = true; - this.iValue = ((ValueNode) pChild).getValue(); - } - - @Override - public void testCompletness() throws SAXException { - if (!this.iHasValue) throw new SAXException(getNodeName() - + " node must have one VALUE child node!"); - } - - public CIMDataType getType() { - return this.iType; - } - - public Object getValue() { - return this.iValue; - } - -} +/* + (C) Copyright IBM Corp. 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Dave Blaschke, blaschke@us.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 2538 2013-11-28 blaschke-oss CR14: Support new CORRELATOR element + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMDataType; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + *
      + * ELEMENT CORRELATOR (VALUE)
      + * ATTLIST CORRELATOR
      + *   %CIMName;
      + *   %CIMType; #REQUIRED
      + * 
      + */ +public class CorrelatorNode extends Node implements TypedIf, ValueIf { + + // private String iName; + + private CIMDataType iType; + + private Object iValue; + + private boolean iHasValue; + + /** + * Ctor. + */ + public CorrelatorNode() { + super(CORRELATOR); + } + + /** + * @param pSession + */ + @Override + public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { + /* this.iName = */getCIMName(pAttribs); + this.iType = getCIMType(pAttribs, false); + this.iValue = null; + this.iHasValue = false; + } + + /** + * @param pData + */ + @Override + public void parseData(String pData) { + // no data + } + + @Override + public void testChild(String pNodeNameEnum) throws SAXException { + if (pNodeNameEnum != VALUE) throw new SAXException(pNodeNameEnum + + " cannot be the child node of " + getNodeName() + " node!"); + if (this.iHasValue) throw new SAXException(getNodeName() + + " node can have only one child node!"); + } + + @Override + public void childParsed(Node pChild) { + if (pChild instanceof ValueNode) this.iHasValue = true; + this.iValue = ((ValueNode) pChild).getValue(); + } + + @Override + public void testCompletness() throws SAXException { + if (!this.iHasValue) throw new SAXException(getNodeName() + + " node must have one VALUE child node!"); + } + + public CIMDataType getType() { + return this.iType; + } + + public Object getValue() { + return this.iValue; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ErrorIf.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ErrorIf.java similarity index 58% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ErrorIf.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ErrorIf.java index c3a230f..5906660 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ErrorIf.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ErrorIf.java @@ -1,58 +1,56 @@ -/* - (C) Copyright IBM Corp. 2006, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.CIMError; - -/** - * This interface is implemented by Nodes which can provide CIMError info. - */ -public interface ErrorIf { - - /** - * getCIMError - * - * @return CIMError - */ - public CIMError getCIMError(); - -} +/* + (C) Copyright IBM Corp. 2006, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.sblim.cimclient.internal.wbem.CIMError; + +/** + * This interface is implemented by Nodes which can provide CIMError info. + */ +public interface ErrorIf { + + /** + * getCIMError + * + * @return CIMError + */ + public CIMError getCIMError(); + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ErrorNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ErrorNode.java similarity index 75% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ErrorNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ErrorNode.java index adf00aa..cee89ba 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ErrorNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ErrorNode.java @@ -1,134 +1,131 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1660756 2007-02-22 ebak Embedded object support - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors - * 3293248 2011-05-03 blaschke-oss Support for CIM_ERROR instances within ERROR - * 2604 2013-07-01 blaschke-oss SAXException messages should contain node name - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.ArrayList; - -import org.sentrysoftware.wbem.javax.cim.CIMInstance; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.CIMError; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - *
      - * ELEMENT ERROR (INSTANCE*)
      - * ATTLIST ERROR
      - *   CODE CDATA #REQUIRED
      - *   DESCRIPTION CDATA #IMPLIED
      - * 
      - */ -public class ErrorNode extends Node implements ErrorIf { - - private int iCode; - - private String iDesc; - - private ArrayList iCIMInstAL; - - /** - * Ctor. - */ - public ErrorNode() { - super(ERROR); - } - - /** - * @param pSession - */ - @Override - public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { - this.iCIMInstAL = null; - String code = pAttribs.getValue("CODE"); - if (code == null) throw new SAXException(getNodeName() - + " node must have a CODE attribute!"); - try { - this.iCode = Integer.parseInt(code); - } catch (NumberFormatException e) { - throw new SAXException("Failed to parse CODE attribute in " + getNodeName() + " node!", - e); - } - this.iDesc = pAttribs.getValue("DESCRIPTION"); - } - - /** - * @param pData - */ - @Override - public void parseData(String pData) { - // no data - } - - @Override - public void testChild(String pNodeNameEnum) throws SAXException { - if (pNodeNameEnum != INSTANCE) throw new SAXException(getNodeName() + " node cannot have " - + pNodeNameEnum + " child node!"); - } - - @Override - public void childParsed(Node pChild) { - if (this.iCIMInstAL == null) this.iCIMInstAL = new ArrayList(); - this.iCIMInstAL.add(((InstanceNode) pChild).getCIMInstance()); - } - - @Override - public void testCompletness() { - // no mandatory child nodes - } - - private static final CIMInstance[] EMPTY_IA = new CIMInstance[0]; - - public CIMError getCIMError() { - if (this.iCIMInstAL != null) { return new CIMError(this.iCode, this.iDesc, this.iCIMInstAL - .toArray(EMPTY_IA)); } - return new CIMError(this.iCode, this.iDesc); - } - -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1660756 2007-02-22 ebak Embedded object support + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors + * 3293248 2011-05-03 blaschke-oss Support for CIM_ERROR instances within ERROR + * 2604 2013-07-01 blaschke-oss SAXException messages should contain node name + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.ArrayList; + +import org.metricshub.wbem.javax.cim.CIMInstance; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; +import org.metricshub.wbem.sblim.cimclient.internal.wbem.CIMError; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + *
      + * ELEMENT ERROR (INSTANCE*)
      + * ATTLIST ERROR
      + *   CODE CDATA #REQUIRED
      + *   DESCRIPTION CDATA #IMPLIED
      + * 
      + */ +public class ErrorNode extends Node implements ErrorIf { + + private int iCode; + + private String iDesc; + + private ArrayList iCIMInstAL; + + /** + * Ctor. + */ + public ErrorNode() { + super(ERROR); + } + + /** + * @param pSession + */ + @Override + public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { + this.iCIMInstAL = null; + String code = pAttribs.getValue("CODE"); + if (code == null) throw new SAXException(getNodeName() + + " node must have a CODE attribute!"); + try { + this.iCode = Integer.parseInt(code); + } catch (NumberFormatException e) { + throw new SAXException("Failed to parse CODE attribute in " + getNodeName() + " node!", + e); + } + this.iDesc = pAttribs.getValue("DESCRIPTION"); + } + + /** + * @param pData + */ + @Override + public void parseData(String pData) { + // no data + } + + @Override + public void testChild(String pNodeNameEnum) throws SAXException { + if (pNodeNameEnum != INSTANCE) throw new SAXException(getNodeName() + " node cannot have " + + pNodeNameEnum + " child node!"); + } + + @Override + public void childParsed(Node pChild) { + if (this.iCIMInstAL == null) this.iCIMInstAL = new ArrayList(); + this.iCIMInstAL.add(((InstanceNode) pChild).getCIMInstance()); + } + + @Override + public void testCompletness() { + // no mandatory child nodes + } + + private static final CIMInstance[] EMPTY_IA = new CIMInstance[0]; + + public CIMError getCIMError() { + if (this.iCIMInstAL != null) { return new CIMError(this.iCode, this.iDesc, this.iCIMInstAL + .toArray(EMPTY_IA)); } + return new CIMError(this.iCode, this.iDesc); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ExpMethodCallNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ExpMethodCallNode.java similarity index 74% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ExpMethodCallNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ExpMethodCallNode.java index 518590d..2fd6cc3 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ExpMethodCallNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ExpMethodCallNode.java @@ -1,131 +1,129 @@ -/* - (C) Copyright IBM Corp. 2006, 2012 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1660756 2007-02-22 ebak Embedded object support - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 3511454 2012-03-27 blaschke-oss SAX nodes not reinitialized properly - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.ArrayList; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - *
      - * ELEMENT EXPMETHODCALL (EXPPARAMVALUE*)
      - * ATTLIST EXPMETHODCALL
      - *   %CIMName;
      - * 
      - */ -/** - * Class ExpMethodCallNode is responsible for - * - */ -public class ExpMethodCallNode extends Node implements NonVolatileIf { - - private String iName; - - private ArrayList iExpParamValNodeAList; - - /** - * Ctor. - */ - public ExpMethodCallNode() { - super(EXPMETHODCALL); - } - - public void addChild(Node pChild) { - if (this.iExpParamValNodeAList == null) this.iExpParamValNodeAList = new ArrayList(); - this.iExpParamValNodeAList.add(pChild); - } - - /** - * @param pSession - */ - @Override - public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { - this.iName = getCIMName(pAttribs); - if (this.iExpParamValNodeAList != null) this.iExpParamValNodeAList.clear(); - } - - /** - * @param pData - */ - @Override - public void parseData(String pData) { - // no data - } - - @Override - public void testChild(String pNodeNameEnum) throws SAXException { - if (pNodeNameEnum != EXPPARAMVALUE) throw new SAXException(getNodeName() - + " node can have " + EXPPARAMVALUE + " child only! " + pNodeNameEnum - + " is invalid!"); - } - - /** - * @param pChild - */ - @Override - public void childParsed(Node pChild) { - // nothing to do yet - - } - - @Override - public void testCompletness() { - // no mandatory child - } - - /** - * getName - * - * @return String - */ - public String getName() { - return this.iName; - } - -} +/* + (C) Copyright IBM Corp. 2006, 2012 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1660756 2007-02-22 ebak Embedded object support + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 3511454 2012-03-27 blaschke-oss SAX nodes not reinitialized properly + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.ArrayList; + +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + *
      + * ELEMENT EXPMETHODCALL (EXPPARAMVALUE*)
      + * ATTLIST EXPMETHODCALL
      + *   %CIMName;
      + * 
      + */ +/** + * Class ExpMethodCallNode is responsible for + * + */ +public class ExpMethodCallNode extends Node implements NonVolatileIf { + + private String iName; + + private ArrayList iExpParamValNodeAList; + + /** + * Ctor. + */ + public ExpMethodCallNode() { + super(EXPMETHODCALL); + } + + public void addChild(Node pChild) { + if (this.iExpParamValNodeAList == null) this.iExpParamValNodeAList = new ArrayList(); + this.iExpParamValNodeAList.add(pChild); + } + + /** + * @param pSession + */ + @Override + public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { + this.iName = getCIMName(pAttribs); + if (this.iExpParamValNodeAList != null) this.iExpParamValNodeAList.clear(); + } + + /** + * @param pData + */ + @Override + public void parseData(String pData) { + // no data + } + + @Override + public void testChild(String pNodeNameEnum) throws SAXException { + if (pNodeNameEnum != EXPPARAMVALUE) throw new SAXException(getNodeName() + + " node can have " + EXPPARAMVALUE + " child only! " + pNodeNameEnum + + " is invalid!"); + } + + /** + * @param pChild + */ + @Override + public void childParsed(Node pChild) { + // nothing to do yet + + } + + @Override + public void testCompletness() { + // no mandatory child + } + + /** + * getName + * + * @return String + */ + public String getName() { + return this.iName; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ExpMethodResponseNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ExpMethodResponseNode.java similarity index 76% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ExpMethodResponseNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ExpMethodResponseNode.java index 1f3384d..27bef4d 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ExpMethodResponseNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ExpMethodResponseNode.java @@ -1,146 +1,144 @@ -/* - (C) Copyright IBM Corp. 2006, 2012 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1660756 2007-02-22 ebak Embedded object support - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors - * 3511454 2012-03-27 blaschke-oss SAX nodes not reinitialized properly - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.CIMError; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - *
      - * ELEMENT EXPMETHODRESPONSE (ERROR|IRETURNVALUE?)
      - * ATTLIST EXPMETHODRESPONSE
      - *   %CIMName;
      - * 
      - */ -public class ExpMethodResponseNode extends Node implements ErrorIf, RetValPipeIf, NonVolatileIf { - - private String iName; - - private ErrorNode iErrorNode; - - private IReturnValueNode iRetValNode; - - /** - * Ctor. - */ - public ExpMethodResponseNode() { - super(EXPMETHODRESPONSE); - } - - public void addChild(Node pChild) { - if (pChild instanceof ErrorNode) this.iErrorNode = (ErrorNode) pChild; - else this.iRetValNode = (IReturnValueNode) pChild; - } - - /** - * @param pSession - */ - @Override - public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { - this.iName = getCIMName(pAttribs); - this.iErrorNode = null; - this.iRetValNode = null; - } - - /** - * @param pData - */ - @Override - public void parseData(String pData) { - // no data - } - - @Override - public void testChild(String pNodeNameEnum) throws SAXException { - if (pNodeNameEnum == ERROR || pNodeNameEnum == IRETURNVALUE) { - Node node; - if (this.iErrorNode != null) node = this.iErrorNode; - else if (this.iRetValNode != null) node = this.iRetValNode; - else node = null; - if (node != null) throw new SAXException(pNodeNameEnum + " child node is invalid for " - + getNodeName() + " node, since it already has a " + node.getNodeName() - + " child node!"); - } else throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum - + " child node!"); - } - - /** - * @param pChild - */ - @Override - public void childParsed(Node pChild) { - // nothing to do yet - } - - @Override - public void testCompletness() { - // no mandatory child nodes - } - - public CIMError getCIMError() { - return this.iErrorNode == null ? null : this.iErrorNode.getCIMError(); - } - - public int getReturnValueCount() { - return this.iRetValNode == null ? 0 : this.iRetValNode.getReturnValueCount(); - } - - public Object readReturnValue() { - return this.iRetValNode.readReturnValue(); - } - - /** - * getName - * - * @return String - */ - public String getName() { - return this.iName; - } -} +/* + (C) Copyright IBM Corp. 2006, 2012 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1660756 2007-02-22 ebak Embedded object support + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors + * 3511454 2012-03-27 blaschke-oss SAX nodes not reinitialized properly + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; +import org.metricshub.wbem.sblim.cimclient.internal.wbem.CIMError; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + *
      + * ELEMENT EXPMETHODRESPONSE (ERROR|IRETURNVALUE?)
      + * ATTLIST EXPMETHODRESPONSE
      + *   %CIMName;
      + * 
      + */ +public class ExpMethodResponseNode extends Node implements ErrorIf, RetValPipeIf, NonVolatileIf { + + private String iName; + + private ErrorNode iErrorNode; + + private IReturnValueNode iRetValNode; + + /** + * Ctor. + */ + public ExpMethodResponseNode() { + super(EXPMETHODRESPONSE); + } + + public void addChild(Node pChild) { + if (pChild instanceof ErrorNode) this.iErrorNode = (ErrorNode) pChild; + else this.iRetValNode = (IReturnValueNode) pChild; + } + + /** + * @param pSession + */ + @Override + public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { + this.iName = getCIMName(pAttribs); + this.iErrorNode = null; + this.iRetValNode = null; + } + + /** + * @param pData + */ + @Override + public void parseData(String pData) { + // no data + } + + @Override + public void testChild(String pNodeNameEnum) throws SAXException { + if (pNodeNameEnum == ERROR || pNodeNameEnum == IRETURNVALUE) { + Node node; + if (this.iErrorNode != null) node = this.iErrorNode; + else if (this.iRetValNode != null) node = this.iRetValNode; + else node = null; + if (node != null) throw new SAXException(pNodeNameEnum + " child node is invalid for " + + getNodeName() + " node, since it already has a " + node.getNodeName() + + " child node!"); + } else throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum + + " child node!"); + } + + /** + * @param pChild + */ + @Override + public void childParsed(Node pChild) { + // nothing to do yet + } + + @Override + public void testCompletness() { + // no mandatory child nodes + } + + public CIMError getCIMError() { + return this.iErrorNode == null ? null : this.iErrorNode.getCIMError(); + } + + public int getReturnValueCount() { + return this.iRetValNode == null ? 0 : this.iRetValNode.getReturnValueCount(); + } + + public Object readReturnValue() { + return this.iRetValNode.readReturnValue(); + } + + /** + * getName + * + * @return String + */ + public String getName() { + return this.iName; + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ExpParamValueNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ExpParamValueNode.java similarity index 73% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ExpParamValueNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ExpParamValueNode.java index 8eea5b3..0204136 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ExpParamValueNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ExpParamValueNode.java @@ -1,124 +1,122 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1660756 2007-02-22 ebak Embedded object support - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 3511454 2012-03-27 blaschke-oss SAX nodes not reinitialized properly - * 2687 2013-10-10 blaschke-oss ExpParamValueNode allows VALUE, (I)METHODRESPONSE children - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - *
      - * ELEMENT EXPPARAMVALUE (INSTANCE?)
      - * ATTLIST EXPPARAMVALUE
      - *   %CIMName;
      - * 
      - */ -public class ExpParamValueNode extends Node implements NonVolatileIf { - - private String iName; - - private Node iChildNode; - - /** - * Ctor. - */ - public ExpParamValueNode() { - super(EXPPARAMVALUE); - } - - public void addChild(Node pChild) { - this.iChildNode = pChild; - } - - /** - * @param pSession - */ - @Override - public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { - this.iName = getCIMName(pAttribs); - this.iChildNode = null; - } - - /** - * @param pData - */ - @Override - public void parseData(String pData) { - // no data - } - - @Override - public void testChild(String pNodeNameEnum) throws SAXException { - if (this.iChildNode != null) throw new SAXException(getNodeName() - + " node can have only one child node!"); - if (pNodeNameEnum != INSTANCE) throw new SAXException(getNodeName() + " node cannot have " - + pNodeNameEnum + " child node!"); - } - - /** - * @param pChild - */ - @Override - public void childParsed(Node pChild) { - // nothing to do yet - } - - @Override - public void testCompletness() { - // child node is optional - } - - /** - * getName - * - * @return String - */ - public String getName() { - return this.iName; - } - -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1660756 2007-02-22 ebak Embedded object support + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 3511454 2012-03-27 blaschke-oss SAX nodes not reinitialized properly + * 2687 2013-10-10 blaschke-oss ExpParamValueNode allows VALUE, (I)METHODRESPONSE children + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + *
      + * ELEMENT EXPPARAMVALUE (INSTANCE?)
      + * ATTLIST EXPPARAMVALUE
      + *   %CIMName;
      + * 
      + */ +public class ExpParamValueNode extends Node implements NonVolatileIf { + + private String iName; + + private Node iChildNode; + + /** + * Ctor. + */ + public ExpParamValueNode() { + super(EXPPARAMVALUE); + } + + public void addChild(Node pChild) { + this.iChildNode = pChild; + } + + /** + * @param pSession + */ + @Override + public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { + this.iName = getCIMName(pAttribs); + this.iChildNode = null; + } + + /** + * @param pData + */ + @Override + public void parseData(String pData) { + // no data + } + + @Override + public void testChild(String pNodeNameEnum) throws SAXException { + if (this.iChildNode != null) throw new SAXException(getNodeName() + + " node can have only one child node!"); + if (pNodeNameEnum != INSTANCE) throw new SAXException(getNodeName() + " node cannot have " + + pNodeNameEnum + " child node!"); + } + + /** + * @param pChild + */ + @Override + public void childParsed(Node pChild) { + // nothing to do yet + } + + @Override + public void testCompletness() { + // child node is optional + } + + /** + * getName + * + * @return String + */ + public String getName() { + return this.iName; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/HostNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/HostNode.java similarity index 71% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/HostNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/HostNode.java index 658f841..58adab7 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/HostNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/HostNode.java @@ -1,113 +1,111 @@ -/* - (C) Copyright IBM Corp. 2006, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1660756 2007-02-22 ebak Embedded object support - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 1742873 2007-06-25 ebak IPv6 ready cim-client - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - * ELEMENT HOST (#PCDATA) - */ -public class HostNode extends Node { - - private String iHost; - - /** - * Ctor. - */ - public HostNode() { - super(HOST); - } - - /** - * @param pAttribs - * @param pSession - */ - @Override - public void init(Attributes pAttribs, SAXSession pSession) { - this.iHost = null; - // no attributes - } - - @Override - public void parseData(String pData) { - this.iHost = pData; - } - - /** - * @param pNodeNameEnum - */ - @Override - public void testChild(String pNodeNameEnum) throws SAXException { - throw new SAXException("HOST node cannot have any child node!"); - } - - /** - * @param pChild - */ - @Override - public void childParsed(Node pChild) { - // no child node - - } - - @Override - public void testCompletness() throws SAXException { - if (this.iHost == null) throw new SAXException( - "HOST node must contain the host name as #PCDATA!"); - } - - /** - * getHostStr - * - * @return String which may contain the protocol, host and port - */ - public String getHostStr() { - return this.iHost; - } - -} +/* + (C) Copyright IBM Corp. 2006, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1660756 2007-02-22 ebak Embedded object support + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 1742873 2007-06-25 ebak IPv6 ready cim-client + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + * ELEMENT HOST (#PCDATA) + */ +public class HostNode extends Node { + + private String iHost; + + /** + * Ctor. + */ + public HostNode() { + super(HOST); + } + + /** + * @param pAttribs + * @param pSession + */ + @Override + public void init(Attributes pAttribs, SAXSession pSession) { + this.iHost = null; + // no attributes + } + + @Override + public void parseData(String pData) { + this.iHost = pData; + } + + /** + * @param pNodeNameEnum + */ + @Override + public void testChild(String pNodeNameEnum) throws SAXException { + throw new SAXException("HOST node cannot have any child node!"); + } + + /** + * @param pChild + */ + @Override + public void childParsed(Node pChild) { + // no child node + + } + + @Override + public void testCompletness() throws SAXException { + if (this.iHost == null) throw new SAXException( + "HOST node must contain the host name as #PCDATA!"); + } + + /** + * getHostStr + * + * @return String which may contain the protocol, host and port + */ + public String getHostStr() { + return this.iHost; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/IMethodCallNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/IMethodCallNode.java similarity index 72% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/IMethodCallNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/IMethodCallNode.java index 0c214a3..7fc0f18 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/IMethodCallNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/IMethodCallNode.java @@ -1,79 +1,77 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1686000 2007-04-20 ebak modifyInstance() missing from WBEMClient - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2682 2013-10-02 blaschke-oss (I)MethodCallNode allows no LOCAL*PATH - * 2690 2013-10-11 blaschke-oss Remove RESPONSEDESTINATION support - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.xml.sax.SAXException; - -/** - * ELEMENT IMETHODCALL (LOCALNAMESPACEPATH, IPARAMVALUE*) ATTLIST IMETHODCALL - * %CIMName; - */ -public class IMethodCallNode extends AbstractMethodCallNode { - - /** - * Ctor. - */ - public IMethodCallNode() { - super(IMETHODCALL); - } - - @Override - protected void testSpecChild(String pNodeNameEnum) throws SAXException { - if (pNodeNameEnum == LOCALNAMESPACEPATH) { - if (this.iPath != null) throw new SAXException(getNodeName() - + " node can have only one " + pNodeNameEnum + " child node!"); - } else if (pNodeNameEnum != IPARAMVALUE) throw new SAXException(getNodeName() - + " node cannot have " + pNodeNameEnum + " child node!"); - } - - @Override - public void testCompletness() throws SAXException { - if (this.iPath == null) throw new SAXException( - "IMETHODCALL node must have a LOCALNAMESPACEPATH child node!"); - } - -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1686000 2007-04-20 ebak modifyInstance() missing from WBEMClient + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2682 2013-10-02 blaschke-oss (I)MethodCallNode allows no LOCAL*PATH + * 2690 2013-10-11 blaschke-oss Remove RESPONSEDESTINATION support + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.xml.sax.SAXException; + +/** + * ELEMENT IMETHODCALL (LOCALNAMESPACEPATH, IPARAMVALUE*) ATTLIST IMETHODCALL + * %CIMName; + */ +public class IMethodCallNode extends AbstractMethodCallNode { + + /** + * Ctor. + */ + public IMethodCallNode() { + super(IMETHODCALL); + } + + @Override + protected void testSpecChild(String pNodeNameEnum) throws SAXException { + if (pNodeNameEnum == LOCALNAMESPACEPATH) { + if (this.iPath != null) throw new SAXException(getNodeName() + + " node can have only one " + pNodeNameEnum + " child node!"); + } else if (pNodeNameEnum != IPARAMVALUE) throw new SAXException(getNodeName() + + " node cannot have " + pNodeNameEnum + " child node!"); + } + + @Override + public void testCompletness() throws SAXException { + if (this.iPath == null) throw new SAXException( + "IMETHODCALL node must have a LOCALNAMESPACEPATH child node!"); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/IMethodResponseNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/IMethodResponseNode.java similarity index 82% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/IMethodResponseNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/IMethodResponseNode.java index b608dba..b671249 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/IMethodResponseNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/IMethodResponseNode.java @@ -1,206 +1,203 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1660756 2007-02-22 ebak Embedded object support - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors - * 2845211 2009-08-27 raman_arora Pull Enumeration Feature (SAX Parser) - * 3511454 2012-03-27 blaschke-oss SAX nodes not reinitialized properly - * 2697 2012-10-30 blaschke-oss (I)MethodResponseNode allows ERROR with PARAMVALUE - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.ArrayList; - -import org.sentrysoftware.wbem.javax.cim.CIMArgument; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.CIMError; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - *
      - * ELEMENT IMETHODRESPONSE (ERROR|IRETURNVALUE?)
      - * ATTLIST IMETHODRESPONSE
      - *   %CIMName; 
      - * 
      - */ -/** - * Class IMethodResponseNode is responsible for - * - */ -public class IMethodResponseNode extends Node implements ErrorIf, RetValPipeIf, NonVolatileIf { - - private String iName; - - private ErrorNode iErrorNode; - - private IReturnValueNode iRetValNode; - - private ArrayList> iCIMArgAL; - - private static final CIMArgument[] EMPTY_ARG_A = new CIMArgument[0]; - - private boolean iHasError; - - private boolean iHasRetVal; - - /** - * Ctor. - */ - public IMethodResponseNode() { - super(IMETHODRESPONSE); - } - - public void addChild(Node pChild) { - if (pChild instanceof IReturnValueNode) { - this.iRetValNode = (IReturnValueNode) pChild; - } else if (pChild instanceof ErrorNode) { - this.iErrorNode = (ErrorNode) pChild; - } - } - - /** - * @param pSession - */ - @Override - public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { - this.iName = getCIMName(pAttribs); - this.iErrorNode = null; - this.iRetValNode = null; - if (this.iCIMArgAL != null) this.iCIMArgAL.clear(); - this.iHasError = false; - this.iHasRetVal = false; - } - - /** - * @param pData - */ - @Override - public void parseData(String pData) { - // no data - } - - @Override - public void testChild(String pNodeNameEnum) throws SAXException { - if (pNodeNameEnum == ERROR) { - String ownedNodeName; - if (this.iHasRetVal) ownedNodeName = IRETURNVALUE; - else if (this.iHasError) ownedNodeName = ERROR; - else if (this.iCIMArgAL != null && this.iCIMArgAL.size() > 0) ownedNodeName = PARAMVALUE; - else ownedNodeName = null; - if (ownedNodeName != null) throw new SAXException(pNodeNameEnum - + " child node is invalid for " + getNodeName() - + " node, since it already has a " + ownedNodeName + " child node!"); - } else if (pNodeNameEnum == IRETURNVALUE) { - String ownedNodeName; - if (this.iHasRetVal) ownedNodeName = IRETURNVALUE; - else if (this.iHasError) ownedNodeName = ERROR; - else ownedNodeName = null; - if (ownedNodeName != null) throw new SAXException(pNodeNameEnum - + " child node is invalid for " + getNodeName() - + " node, since it already has a " + ownedNodeName + " child node!"); - } else if (pNodeNameEnum == PARAMVALUE) { - if (this.iHasError) throw new SAXException(pNodeNameEnum - + " child node is invalid for " + getNodeName() - + " node, since it already has an ERROR child node!"); - } else throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum - + " child node!"); - } - - /** - * @param pChild - */ - @Override - public void childParsed(Node pChild) { - if (pChild instanceof ErrorNode) { - this.iHasError = true; - this.iErrorNode = (ErrorNode) pChild; - } else if (pChild instanceof IReturnValueNode) { - this.iHasRetVal = true; - this.iRetValNode = (IReturnValueNode) pChild; - } else - // Values of parameters should be stored in array - if (pChild instanceof ParamValueNode) { - if (this.iCIMArgAL == null) this.iCIMArgAL = new ArrayList>(); - this.iCIMArgAL.add(((ParamValueNode) pChild).getCIMArgument()); - } - } - - @Override - public void testCompletness() { - // no mandatory child nodes - } - - public CIMError getCIMError() { - return this.iErrorNode == null ? null : this.iErrorNode.getCIMError(); - } - - public int getReturnValueCount() { - return this.iRetValNode == null ? 0 : this.iRetValNode.getReturnValueCount(); - } - - public Object readReturnValue() { - return this.iRetValNode.readReturnValue(); - } - - /** - * getName - * - * @return String - */ - public String getName() { - return this.iName; - } - - /** - * getCIMArguments : returns the array of parsed parameters and their values - * : String name, CIMDataType type, Object value - * - * @return CIMArgument<?>[] - */ - public CIMArgument[] getCIMArguments() { - if (this.iCIMArgAL == null || this.iCIMArgAL.size() == 0) return null; - return this.iCIMArgAL.toArray(EMPTY_ARG_A); - } - -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1660756 2007-02-22 ebak Embedded object support + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors + * 2845211 2009-08-27 raman_arora Pull Enumeration Feature (SAX Parser) + * 3511454 2012-03-27 blaschke-oss SAX nodes not reinitialized properly + * 2697 2012-10-30 blaschke-oss (I)MethodResponseNode allows ERROR with PARAMVALUE + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.ArrayList; + +import org.metricshub.wbem.javax.cim.CIMArgument; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; +import org.metricshub.wbem.sblim.cimclient.internal.wbem.CIMError; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + *
      + * ELEMENT IMETHODRESPONSE (ERROR|IRETURNVALUE?)
      + * ATTLIST IMETHODRESPONSE
      + *   %CIMName; 
      + * 
      + */ +/** + * Class IMethodResponseNode is responsible for + * + */ +public class IMethodResponseNode extends Node implements ErrorIf, RetValPipeIf, NonVolatileIf { + + private String iName; + + private ErrorNode iErrorNode; + + private IReturnValueNode iRetValNode; + + private ArrayList> iCIMArgAL; + + private static final CIMArgument[] EMPTY_ARG_A = new CIMArgument[0]; + + private boolean iHasError; + + private boolean iHasRetVal; + + /** + * Ctor. + */ + public IMethodResponseNode() { + super(IMETHODRESPONSE); + } + + public void addChild(Node pChild) { + if (pChild instanceof IReturnValueNode) { + this.iRetValNode = (IReturnValueNode) pChild; + } else if (pChild instanceof ErrorNode) { + this.iErrorNode = (ErrorNode) pChild; + } + } + + /** + * @param pSession + */ + @Override + public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { + this.iName = getCIMName(pAttribs); + this.iErrorNode = null; + this.iRetValNode = null; + if (this.iCIMArgAL != null) this.iCIMArgAL.clear(); + this.iHasError = false; + this.iHasRetVal = false; + } + + /** + * @param pData + */ + @Override + public void parseData(String pData) { + // no data + } + + @Override + public void testChild(String pNodeNameEnum) throws SAXException { + if (pNodeNameEnum == ERROR) { + String ownedNodeName; + if (this.iHasRetVal) ownedNodeName = IRETURNVALUE; + else if (this.iHasError) ownedNodeName = ERROR; + else if (this.iCIMArgAL != null && this.iCIMArgAL.size() > 0) ownedNodeName = PARAMVALUE; + else ownedNodeName = null; + if (ownedNodeName != null) throw new SAXException(pNodeNameEnum + + " child node is invalid for " + getNodeName() + + " node, since it already has a " + ownedNodeName + " child node!"); + } else if (pNodeNameEnum == IRETURNVALUE) { + String ownedNodeName; + if (this.iHasRetVal) ownedNodeName = IRETURNVALUE; + else if (this.iHasError) ownedNodeName = ERROR; + else ownedNodeName = null; + if (ownedNodeName != null) throw new SAXException(pNodeNameEnum + + " child node is invalid for " + getNodeName() + + " node, since it already has a " + ownedNodeName + " child node!"); + } else if (pNodeNameEnum == PARAMVALUE) { + if (this.iHasError) throw new SAXException(pNodeNameEnum + + " child node is invalid for " + getNodeName() + + " node, since it already has an ERROR child node!"); + } else throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum + + " child node!"); + } + + /** + * @param pChild + */ + @Override + public void childParsed(Node pChild) { + if (pChild instanceof ErrorNode) { + this.iHasError = true; + this.iErrorNode = (ErrorNode) pChild; + } else if (pChild instanceof IReturnValueNode) { + this.iHasRetVal = true; + this.iRetValNode = (IReturnValueNode) pChild; + } else + // Values of parameters should be stored in array + if (pChild instanceof ParamValueNode) { + if (this.iCIMArgAL == null) this.iCIMArgAL = new ArrayList>(); + this.iCIMArgAL.add(((ParamValueNode) pChild).getCIMArgument()); + } + } + + @Override + public void testCompletness() { + // no mandatory child nodes + } + + public CIMError getCIMError() { + return this.iErrorNode == null ? null : this.iErrorNode.getCIMError(); + } + + public int getReturnValueCount() { + return this.iRetValNode == null ? 0 : this.iRetValNode.getReturnValueCount(); + } + + public Object readReturnValue() { + return this.iRetValNode.readReturnValue(); + } + + /** + * getName + * + * @return String + */ + public String getName() { + return this.iName; + } + + /** + * getCIMArguments : returns the array of parsed parameters and their values + * : String name, CIMDataType type, Object value + * + * @return CIMArgument<?>[] + */ + public CIMArgument[] getCIMArguments() { + if (this.iCIMArgAL == null || this.iCIMArgAL.size() == 0) return null; + return this.iCIMArgAL.toArray(EMPTY_ARG_A); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/IParamValueNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/IParamValueNode.java similarity index 78% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/IParamValueNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/IParamValueNode.java index dcf8244..553ee7d 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/IParamValueNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/IParamValueNode.java @@ -1,169 +1,166 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1660756 2007-02-22 ebak Embedded object support - * 1686000 2007-04-20 ebak modifyInstance() missing from WBEMClient - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics - * 2680 2013-10-02 blaschke-oss IPARAMVALUE parsing broken on DOM/SAX - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMArgument; -import org.sentrysoftware.wbem.javax.cim.CIMDataType; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - * FIXME: Why hasn't it got TYPE attribute? For VALUE and VALUE.ARRAY it would - * be necessary. - * - *
      - * 
      - * ELEMENT IPARAMVALUE (VALUE | VALUE.ARRAY | VALUE.REFERENCE | INSTANCENAME | CLASSNAME |
      - *   QUALIFIER.DECLARATION | CLASS | INSTANCE | VALUE.NAMEDINSTANCE)?
      - * ATTLIST IPARAMVALUE
      - *   %CIMName;
      - * 
      - */ -public class IParamValueNode extends AbstractParamValueNode { - - private String iName; - - /** - * child element - */ - private Object iValue; - - private boolean iIsArray; - - private CIMDataType iType; - - /** - * Ctor. - */ - public IParamValueNode() { - super(IPARAMVALUE); - } - - /** - * @param pSession - */ - @Override - public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { - this.iValue = null; - this.iType = null; - this.iName = getCIMName(pAttribs); - } - - /** - * @param pData - */ - @Override - public void parseData(String pData) { - // no data - } - - private static final String[] ALLOWED_CHILDREN = { VALUE, VALUE_ARRAY, VALUE_REFERENCE, - INSTANCENAME, CLASSNAME, QUALIFIER_DECLARATION, CLASS, INSTANCE, VALUE_NAMEDINSTANCE }; - - @Override - public void testChild(String pNodeNameEnum) throws SAXException { - boolean allowed = false; - for (int i = 0; i < ALLOWED_CHILDREN.length; i++) { - if (ALLOWED_CHILDREN[i] == pNodeNameEnum) { - allowed = true; - break; - } - } - if (!allowed) throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum - + " child node!"); - /* - * this kind of check is not so strict (ValueNode.getValue() can return - * null) - */ - if (this.iValue != null) throw new SAXException(getNodeName() - + " node cannot have more than one child node!"); - - } - - @Override - public void childParsed(Node pChild) { - this.iValue = ((ValueIf) pChild).getValue(); - this.iIsArray = pChild instanceof ArrayIf; - if (pChild instanceof TypedIf) this.iType = ((TypedIf) pChild).getType(); - else if (pChild instanceof ObjectPathIf) this.iType = CIMDataType - .getDataType(((ObjectPathIf) pChild).getCIMObjectPath()); - else if (pChild instanceof ValueIf) this.iType = CIMDataType.getDataType(((ValueIf) pChild) - .getValue()); - } - - @Override - public void testCompletness() { - // child node is optional - } - - @Override - public CIMArgument getCIMArgument() { - return new CIMArgument(this.iName, getType(), this.iValue); - } - - /** - * getName - * - * @return String - */ - public String getName() { - return this.iName; - } - - public CIMDataType getType() { - return this.iType == null ? (this.iIsArray ? CIMDataType.STRING_ARRAY_T - : CIMDataType.STRING_T) : this.iType; - } - - public Object getValue() { - return this.iValue; - } - -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1660756 2007-02-22 ebak Embedded object support + * 1686000 2007-04-20 ebak modifyInstance() missing from WBEMClient + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics + * 2680 2013-10-02 blaschke-oss IPARAMVALUE parsing broken on DOM/SAX + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMArgument; +import org.metricshub.wbem.javax.cim.CIMDataType; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + * FIXME: Why hasn't it got TYPE attribute? For VALUE and VALUE.ARRAY it would + * be necessary. + * + *
      + * 
      + * ELEMENT IPARAMVALUE (VALUE | VALUE.ARRAY | VALUE.REFERENCE | INSTANCENAME | CLASSNAME |
      + *   QUALIFIER.DECLARATION | CLASS | INSTANCE | VALUE.NAMEDINSTANCE)?
      + * ATTLIST IPARAMVALUE
      + *   %CIMName;
      + * 
      + */ +public class IParamValueNode extends AbstractParamValueNode { + + private String iName; + + /** + * child element + */ + private Object iValue; + + private boolean iIsArray; + + private CIMDataType iType; + + /** + * Ctor. + */ + public IParamValueNode() { + super(IPARAMVALUE); + } + + /** + * @param pSession + */ + @Override + public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { + this.iValue = null; + this.iType = null; + this.iName = getCIMName(pAttribs); + } + + /** + * @param pData + */ + @Override + public void parseData(String pData) { + // no data + } + + private static final String[] ALLOWED_CHILDREN = { VALUE, VALUE_ARRAY, VALUE_REFERENCE, + INSTANCENAME, CLASSNAME, QUALIFIER_DECLARATION, CLASS, INSTANCE, VALUE_NAMEDINSTANCE }; + + @Override + public void testChild(String pNodeNameEnum) throws SAXException { + boolean allowed = false; + for (int i = 0; i < ALLOWED_CHILDREN.length; i++) { + if (ALLOWED_CHILDREN[i] == pNodeNameEnum) { + allowed = true; + break; + } + } + if (!allowed) throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum + + " child node!"); + /* + * this kind of check is not so strict (ValueNode.getValue() can return + * null) + */ + if (this.iValue != null) throw new SAXException(getNodeName() + + " node cannot have more than one child node!"); + + } + + @Override + public void childParsed(Node pChild) { + this.iValue = ((ValueIf) pChild).getValue(); + this.iIsArray = pChild instanceof ArrayIf; + if (pChild instanceof TypedIf) this.iType = ((TypedIf) pChild).getType(); + else if (pChild instanceof ObjectPathIf) this.iType = CIMDataType + .getDataType(((ObjectPathIf) pChild).getCIMObjectPath()); + else if (pChild instanceof ValueIf) this.iType = CIMDataType.getDataType(((ValueIf) pChild) + .getValue()); + } + + @Override + public void testCompletness() { + // child node is optional + } + + @Override + public CIMArgument getCIMArgument() { + return new CIMArgument(this.iName, getType(), this.iValue); + } + + /** + * getName + * + * @return String + */ + public String getName() { + return this.iName; + } + + public CIMDataType getType() { + return this.iType == null ? (this.iIsArray ? CIMDataType.STRING_ARRAY_T + : CIMDataType.STRING_T) : this.iType; + } + + public Object getValue() { + return this.iValue; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/IReturnValueNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/IReturnValueNode.java similarity index 81% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/IReturnValueNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/IReturnValueNode.java index fd3e0e5..3760369 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/IReturnValueNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/IReturnValueNode.java @@ -1,157 +1,155 @@ -/* - (C) Copyright IBM Corp. 2006, 2012 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1660756 2007-02-22 ebak Embedded object support - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2845211 2009-08-27 raman_arora Pull Enumeration Feature (SAX Parser) - * 3511454 2012-03-27 blaschke-oss SAX nodes not reinitialized properly - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.LinkedList; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - *
      - * 
      - * ELEMENT IRETURNVALUE (
      - *   CLASSNAME* | INSTANCENAME* | VALUE* | VALUE.OBJECTWITHPATH* | VALUE.OBJECTWITHLOCALPATH* |
      - *   VALUE.OBJECT* | OBJECTPATH* | QUALIFIER.DECLARATION* | VALUE.ARRAY? | VALUE.REFERENCE? |
      - *   CLASS* | INSTANCE* | VALUE.NAMEDINSTANCE*
      - * )
      - * 
      - */ -public class IReturnValueNode extends Node implements RetValPipeIf, NonVolatileIf { - - private String iChildNameEnum; - - private LinkedList iChildValueLL; - - /** - * Ctor. - */ - public IReturnValueNode() { - super(IRETURNVALUE); - } - - /** - * @param pChild - */ - public void addChild(Node pChild) { /* we don't need it here */} - - /** - * @param pAttribs - * @param pSession - */ - @Override - public void init(Attributes pAttribs, SAXSession pSession) { - // currently it's not really necessary here, since the Node is - // NonVolatile - this.iChildNameEnum = null; - this.iChildValueLL = null; - // no attribs - } - - /** - * @param pData - */ - @Override - public void parseData(String pData) { - // no data - } - - private static final String[] ALLOWED_CHILDREN = { CLASSNAME, INSTANCENAME, INSTANCEPATH, - VALUE, VALUE_OBJECTWITHPATH, VALUE_OBJECTWITHLOCALPATH, VALUE_OBJECT, OBJECTPATH, - QUALIFIER_DECLARATION, VALUE_ARRAY, VALUE_REFERENCE, CLASS, INSTANCE, - VALUE_NAMEDINSTANCE, VALUE_INSTANCEWITHPATH }; - - // private static final String[] SINGLE_CHILDREN = { VALUE_ARRAY, - // VALUE_REFERENCE }; - - /** - * @see Node#testChild(java.lang.String) - */ - @Override - public void testChild(String pNodeNameEnum) throws SAXException { - if (this.iChildNameEnum != null) { - if (pNodeNameEnum != this.iChildNameEnum) throw new SAXException(getNodeName() - + " node cannot have " + pNodeNameEnum + " child node, since it already has " - + this.iChildNameEnum + " child node(s)!"); - if (this.iChildNameEnum == VALUE_ARRAY || this.iChildNameEnum == VALUE_REFERENCE) throw new SAXException( - getNodeName() + " node can have only one " + this.iChildNameEnum - + " child node!"); - } else { - boolean found = false; - for (int i = 0; i < ALLOWED_CHILDREN.length; i++) { - if ((found = (pNodeNameEnum == ALLOWED_CHILDREN[i])) == true) break; - } - if (!found) throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum - + " child node!"); - } - } - - @Override - public void childParsed(Node pChild) { - if (this.iChildValueLL == null) { - this.iChildNameEnum = pChild.getNodeName(); - this.iChildValueLL = new LinkedList(); - } - this.iChildValueLL.add(((ValueIf) pChild).getValue()); - } - - @Override - public void testCompletness() { - // child nodes are optional - } - - public int getReturnValueCount() { - return this.iChildValueLL == null ? 0 : this.iChildValueLL.size(); - } - - public Object readReturnValue() { - return this.iChildValueLL == null ? null : this.iChildValueLL.removeFirst(); - } - -} +/* + (C) Copyright IBM Corp. 2006, 2012 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1660756 2007-02-22 ebak Embedded object support + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2845211 2009-08-27 raman_arora Pull Enumeration Feature (SAX Parser) + * 3511454 2012-03-27 blaschke-oss SAX nodes not reinitialized properly + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.LinkedList; + +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + *
      + * 
      + * ELEMENT IRETURNVALUE (
      + *   CLASSNAME* | INSTANCENAME* | VALUE* | VALUE.OBJECTWITHPATH* | VALUE.OBJECTWITHLOCALPATH* |
      + *   VALUE.OBJECT* | OBJECTPATH* | QUALIFIER.DECLARATION* | VALUE.ARRAY? | VALUE.REFERENCE? |
      + *   CLASS* | INSTANCE* | VALUE.NAMEDINSTANCE*
      + * )
      + * 
      + */ +public class IReturnValueNode extends Node implements RetValPipeIf, NonVolatileIf { + + private String iChildNameEnum; + + private LinkedList iChildValueLL; + + /** + * Ctor. + */ + public IReturnValueNode() { + super(IRETURNVALUE); + } + + /** + * @param pChild + */ + public void addChild(Node pChild) { /* we don't need it here */} + + /** + * @param pAttribs + * @param pSession + */ + @Override + public void init(Attributes pAttribs, SAXSession pSession) { + // currently it's not really necessary here, since the Node is + // NonVolatile + this.iChildNameEnum = null; + this.iChildValueLL = null; + // no attribs + } + + /** + * @param pData + */ + @Override + public void parseData(String pData) { + // no data + } + + private static final String[] ALLOWED_CHILDREN = { CLASSNAME, INSTANCENAME, INSTANCEPATH, + VALUE, VALUE_OBJECTWITHPATH, VALUE_OBJECTWITHLOCALPATH, VALUE_OBJECT, OBJECTPATH, + QUALIFIER_DECLARATION, VALUE_ARRAY, VALUE_REFERENCE, CLASS, INSTANCE, + VALUE_NAMEDINSTANCE, VALUE_INSTANCEWITHPATH }; + + // private static final String[] SINGLE_CHILDREN = { VALUE_ARRAY, + // VALUE_REFERENCE }; + + /** + * @see Node#testChild(java.lang.String) + */ + @Override + public void testChild(String pNodeNameEnum) throws SAXException { + if (this.iChildNameEnum != null) { + if (pNodeNameEnum != this.iChildNameEnum) throw new SAXException(getNodeName() + + " node cannot have " + pNodeNameEnum + " child node, since it already has " + + this.iChildNameEnum + " child node(s)!"); + if (this.iChildNameEnum == VALUE_ARRAY || this.iChildNameEnum == VALUE_REFERENCE) throw new SAXException( + getNodeName() + " node can have only one " + this.iChildNameEnum + + " child node!"); + } else { + boolean found = false; + for (int i = 0; i < ALLOWED_CHILDREN.length; i++) { + if ((found = (pNodeNameEnum == ALLOWED_CHILDREN[i])) == true) break; + } + if (!found) throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum + + " child node!"); + } + } + + @Override + public void childParsed(Node pChild) { + if (this.iChildValueLL == null) { + this.iChildNameEnum = pChild.getNodeName(); + this.iChildValueLL = new LinkedList(); + } + this.iChildValueLL.add(((ValueIf) pChild).getValue()); + } + + @Override + public void testCompletness() { + // child nodes are optional + } + + public int getReturnValueCount() { + return this.iChildValueLL == null ? 0 : this.iChildValueLL.size(); + } + + public Object readReturnValue() { + return this.iChildValueLL == null ? null : this.iChildValueLL.removeFirst(); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/InstanceNameNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/InstanceNameNode.java similarity index 78% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/InstanceNameNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/InstanceNameNode.java index 18c3d0d..8de2296 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/InstanceNameNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/InstanceNameNode.java @@ -1,164 +1,161 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1660756 2007-02-22 ebak Embedded object support - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics - * 2707 2013-11-12 blaschke-oss INSTANCENAME ignores KEYVALUE and VALUE.REFERENCE children - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.ArrayList; - -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; -import org.sentrysoftware.wbem.javax.cim.CIMProperty; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.LocalPathBuilder; -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - *
      - * perhaps it's a documentation mistake: ELEMENT INSTANCENAME (KEYBINDING* | KEYVALUE? | VALUE.REFERENCE?)
      - * ELEMENT INSTANCENAME (KEYBINDING*)
      - * ATTLIST INSTANCENAME
      - *  %ClassName;
      - * 
      - */ -public class InstanceNameNode extends AbstractPathNode { - - private String iClassName; - - private ArrayList> iCIMPropAL; - - private CIMObjectPath iLocalPath; - - private String iNodeName; - - /** - * Ctor. - */ - public InstanceNameNode() { - super(INSTANCENAME); - } - - @Override - public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { - this.iLocalPath = pSession.getDefLocalPath(); - if (this.iCIMPropAL != null) this.iCIMPropAL.clear(); - this.iClassName = getClassName(pAttribs); - this.iNodeName = null; - } - - /** - * @param pData - */ - @Override - public void parseData(String pData) { - // no data - } - - private static final String[] ALLOWED_CHILDREN = { KEYBINDING, KEYVALUE, VALUE_REFERENCE }; - - @Override - public void testChild(String pNodeNameEnum) throws SAXException { - for (int i = 0; i < ALLOWED_CHILDREN.length; i++) - if (ALLOWED_CHILDREN[i] == pNodeNameEnum) { - if (this.iNodeName != null && this.iNodeName != pNodeNameEnum) throw new SAXException( - getNodeName() + " node cannot have " + pNodeNameEnum - + " child node, it already has a " + this.iNodeName + "!"); - if (pNodeNameEnum != KEYBINDING) { - if (this.iNodeName != null) throw new SAXException(getNodeName() - + " node can have only one " + pNodeNameEnum + " child node!"); - } - this.iNodeName = pNodeNameEnum; - return; - } - throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum - + " child node!"); - } - - @Override - public void childParsed(Node pChild) { - if (this.iCIMPropAL == null) this.iCIMPropAL = new ArrayList>(); - if (pChild instanceof KeyBindingNode) this.iCIMPropAL.add(((KeyBindingNode) pChild) - .getCIMProperty()); - else this.iCIMPropAL.add(new CIMProperty("", ((AbstractScalarValueNode) pChild) - .getType(), ((AbstractScalarValueNode) pChild).getValue(), true, false, null)); - } - - @Override - public void testCompletness() { - // no mandatory child nodes - } - - /** - * getClassName - * - * @return String - */ - public String getClassName() { - return this.iClassName; - } - - private static final CIMProperty[] EMPTY_PA = new CIMProperty[0]; - - /** - * getKeys - * - * @return CIMProperty[] - */ - public CIMProperty[] getKeys() { - if (this.iCIMPropAL == null || this.iCIMPropAL.size() == 0) return null; - return this.iCIMPropAL.toArray(EMPTY_PA); - } - - public CIMObjectPath getCIMObjectPath() { - /* - * CIMObjectPath(String objectName, String namespace, CIMProperty[] - * keys) - */ - return LocalPathBuilder.build(this.iLocalPath, this.iClassName, null, getKeys()); - } - -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1660756 2007-02-22 ebak Embedded object support + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics + * 2707 2013-11-12 blaschke-oss INSTANCENAME ignores KEYVALUE and VALUE.REFERENCE children + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.ArrayList; + +import org.metricshub.wbem.javax.cim.CIMObjectPath; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.LocalPathBuilder; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; +import org.metricshub.wbem.javax.cim.CIMProperty; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + *
      + * perhaps it's a documentation mistake: ELEMENT INSTANCENAME (KEYBINDING* | KEYVALUE? | VALUE.REFERENCE?)
      + * ELEMENT INSTANCENAME (KEYBINDING*)
      + * ATTLIST INSTANCENAME
      + *  %ClassName;
      + * 
      + */ +public class InstanceNameNode extends AbstractPathNode { + + private String iClassName; + + private ArrayList> iCIMPropAL; + + private CIMObjectPath iLocalPath; + + private String iNodeName; + + /** + * Ctor. + */ + public InstanceNameNode() { + super(INSTANCENAME); + } + + @Override + public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { + this.iLocalPath = pSession.getDefLocalPath(); + if (this.iCIMPropAL != null) this.iCIMPropAL.clear(); + this.iClassName = getClassName(pAttribs); + this.iNodeName = null; + } + + /** + * @param pData + */ + @Override + public void parseData(String pData) { + // no data + } + + private static final String[] ALLOWED_CHILDREN = { KEYBINDING, KEYVALUE, VALUE_REFERENCE }; + + @Override + public void testChild(String pNodeNameEnum) throws SAXException { + for (int i = 0; i < ALLOWED_CHILDREN.length; i++) + if (ALLOWED_CHILDREN[i] == pNodeNameEnum) { + if (this.iNodeName != null && this.iNodeName != pNodeNameEnum) throw new SAXException( + getNodeName() + " node cannot have " + pNodeNameEnum + + " child node, it already has a " + this.iNodeName + "!"); + if (pNodeNameEnum != KEYBINDING) { + if (this.iNodeName != null) throw new SAXException(getNodeName() + + " node can have only one " + pNodeNameEnum + " child node!"); + } + this.iNodeName = pNodeNameEnum; + return; + } + throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum + + " child node!"); + } + + @Override + public void childParsed(Node pChild) { + if (this.iCIMPropAL == null) this.iCIMPropAL = new ArrayList>(); + if (pChild instanceof KeyBindingNode) this.iCIMPropAL.add(((KeyBindingNode) pChild) + .getCIMProperty()); + else this.iCIMPropAL.add(new CIMProperty("", ((AbstractScalarValueNode) pChild) + .getType(), ((AbstractScalarValueNode) pChild).getValue(), true, false, null)); + } + + @Override + public void testCompletness() { + // no mandatory child nodes + } + + /** + * getClassName + * + * @return String + */ + public String getClassName() { + return this.iClassName; + } + + private static final CIMProperty[] EMPTY_PA = new CIMProperty[0]; + + /** + * getKeys + * + * @return CIMProperty[] + */ + public CIMProperty[] getKeys() { + if (this.iCIMPropAL == null || this.iCIMPropAL.size() == 0) return null; + return this.iCIMPropAL.toArray(EMPTY_PA); + } + + public CIMObjectPath getCIMObjectPath() { + /* + * CIMObjectPath(String objectName, String namespace, CIMProperty[] + * keys) + */ + return LocalPathBuilder.build(this.iLocalPath, this.iClassName, null, getKeys()); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/InstanceNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/InstanceNode.java similarity index 74% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/InstanceNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/InstanceNode.java index 62f4a73..aa603f9 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/InstanceNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/InstanceNode.java @@ -1,166 +1,163 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1660756 2007-02-22 ebak Embedded object support - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics - * 3598613 2013-01-11 blaschke-oss different data type in cim instance and cim object path - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.ArrayList; - -import org.sentrysoftware.wbem.javax.cim.CIMInstance; -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; -import org.sentrysoftware.wbem.javax.cim.CIMProperty; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cim.CIMHelper; -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.LocalPathBuilder; -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.sentrysoftware.wbem.sblim.cimclient.internal.util.WBEMConfiguration; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - *
      - * ELEMENT INSTANCE (QUALIFIER*, (PROPERTY | PROPERTY.ARRAY | PROPERTY.REFERENCE)*)
      - * ATTLIST INSTANCE
      - *   %ClassName;
      - *   xml:lang   NMTOKEN      #IMPLIED
      - * 
      - */ -public class InstanceNode extends AbstractObjectNode { - - private String iClassName; - - /** - * FIXME: What to do with the qualifiers? JSR48 doesn't specify qualifiers - * for CIMInstance! - */ - private QualifiedNodeHandler iQualiHandler; - - private ArrayList> iCIMPropAL; - - /** - * Ctor. - */ - public InstanceNode() { - super(INSTANCE); - } - - @Override - public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { - this.iLocalPath = pSession.getDefLocalPath(); - this.iQualiHandler = new QualifiedNodeHandler(); - this.iCIMPropAL = null; - this.iClassName = getClassName(pAttribs); - } - - /** - * @param pData - */ - @Override - public void parseData(String pData) { - // no data - } - - private static final String[] ALLOWED_CHILDREN = { QUALIFIER, PROPERTY, PROPERTY_ARRAY, - PROPERTY_REFERENCE }; - - @Override - public void testChild(String pNodeNameEnum) throws SAXException { - for (int i = 0; i < ALLOWED_CHILDREN.length; i++) - if (ALLOWED_CHILDREN[i] == pNodeNameEnum) return; - throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum - + " child node!"); - } - - @Override - public void childParsed(Node pChild) { - if (this.iQualiHandler.addQualifierNode(pChild)) return; - if (this.iCIMPropAL == null) this.iCIMPropAL = new ArrayList>(); - this.iCIMPropAL.add(((AbstractPropertyNode) pChild).getCIMProperty()); - } - - @Override - public void testCompletness() { - // all child nodes are optional - } - - /** - * getCIMInstance - * - * @return CIMInstance - */ - public CIMInstance getCIMInstance() { - return new CIMInstance(LocalPathBuilder.build(this.iLocalPath, this.iClassName, null), - getProps()); - } - - /** - * getCIMInstance - * - * @param pObjPath - * @return CIMInstance with the provided object path - */ - public CIMInstance getCIMInstance(CIMObjectPath pObjPath) { - if (WBEMConfiguration.getGlobalConfiguration().synchronizeNumericKeyDataTypes()) return CIMHelper - .CIMInstanceWithSynchonizedNumericKeyDataTypes(pObjPath, getProps()); - return new CIMInstance(pObjPath, getProps()); - } - - /** - * @see ValueIf#getValue() - * @return CIMInstance - */ - public Object getValue() { - return getCIMInstance(); - } - - private static final CIMProperty[] EMPTY_PA = new CIMProperty[0]; - - private CIMProperty[] getProps() { - if (this.iCIMPropAL == null) return null; - return this.iCIMPropAL.toArray(EMPTY_PA); - } - -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1660756 2007-02-22 ebak Embedded object support + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics + * 3598613 2013-01-11 blaschke-oss different data type in cim instance and cim object path + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.ArrayList; + +import org.metricshub.wbem.javax.cim.CIMInstance; +import org.metricshub.wbem.javax.cim.CIMObjectPath; +import org.metricshub.wbem.sblim.cimclient.internal.cim.CIMHelper; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.LocalPathBuilder; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; +import org.metricshub.wbem.sblim.cimclient.internal.util.WBEMConfiguration; +import org.metricshub.wbem.javax.cim.CIMProperty; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + *
      + * ELEMENT INSTANCE (QUALIFIER*, (PROPERTY | PROPERTY.ARRAY | PROPERTY.REFERENCE)*)
      + * ATTLIST INSTANCE
      + *   %ClassName;
      + *   xml:lang   NMTOKEN      #IMPLIED
      + * 
      + */ +public class InstanceNode extends AbstractObjectNode { + + private String iClassName; + + /** + * FIXME: What to do with the qualifiers? JSR48 doesn't specify qualifiers + * for CIMInstance! + */ + private QualifiedNodeHandler iQualiHandler; + + private ArrayList> iCIMPropAL; + + /** + * Ctor. + */ + public InstanceNode() { + super(INSTANCE); + } + + @Override + public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { + this.iLocalPath = pSession.getDefLocalPath(); + this.iQualiHandler = new QualifiedNodeHandler(); + this.iCIMPropAL = null; + this.iClassName = getClassName(pAttribs); + } + + /** + * @param pData + */ + @Override + public void parseData(String pData) { + // no data + } + + private static final String[] ALLOWED_CHILDREN = { QUALIFIER, PROPERTY, PROPERTY_ARRAY, + PROPERTY_REFERENCE }; + + @Override + public void testChild(String pNodeNameEnum) throws SAXException { + for (int i = 0; i < ALLOWED_CHILDREN.length; i++) + if (ALLOWED_CHILDREN[i] == pNodeNameEnum) return; + throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum + + " child node!"); + } + + @Override + public void childParsed(Node pChild) { + if (this.iQualiHandler.addQualifierNode(pChild)) return; + if (this.iCIMPropAL == null) this.iCIMPropAL = new ArrayList>(); + this.iCIMPropAL.add(((AbstractPropertyNode) pChild).getCIMProperty()); + } + + @Override + public void testCompletness() { + // all child nodes are optional + } + + /** + * getCIMInstance + * + * @return CIMInstance + */ + public CIMInstance getCIMInstance() { + return new CIMInstance(LocalPathBuilder.build(this.iLocalPath, this.iClassName, null), + getProps()); + } + + /** + * getCIMInstance + * + * @param pObjPath + * @return CIMInstance with the provided object path + */ + public CIMInstance getCIMInstance(CIMObjectPath pObjPath) { + if (WBEMConfiguration.getGlobalConfiguration().synchronizeNumericKeyDataTypes()) return CIMHelper + .CIMInstanceWithSynchonizedNumericKeyDataTypes(pObjPath, getProps()); + return new CIMInstance(pObjPath, getProps()); + } + + /** + * @see ValueIf#getValue() + * @return CIMInstance + */ + public Object getValue() { + return getCIMInstance(); + } + + private static final CIMProperty[] EMPTY_PA = new CIMProperty[0]; + + private CIMProperty[] getProps() { + if (this.iCIMPropAL == null) return null; + return this.iCIMPropAL.toArray(EMPTY_PA); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/InstancePathNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/InstancePathNode.java similarity index 77% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/InstancePathNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/InstancePathNode.java index 70b75fe..3f34d17 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/InstancePathNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/InstancePathNode.java @@ -1,149 +1,146 @@ -/* - (C) Copyright IBM Corp. 2006, 2012 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1660756 2007-02-22 ebak Embedded object support - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 1742873 2007-06-25 ebak IPv6 ready cim-client - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics - * 3511454 2012-03-27 blaschke-oss SAX nodes not reinitialized properly - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; -import org.sentrysoftware.wbem.javax.cim.CIMProperty; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.sentrysoftware.wbem.sblim.cimclient.internal.util.XMLHostStr; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - * ELEMENT INSTANCEPATH (NAMESPACEPATH, INSTANCENAME) - */ -public class InstancePathNode extends AbstractObjectPathNode { - - // INSTANCEPATH - private boolean iHasInstancePath; - - private String iLocalNameSpacePathStr; - - private XMLHostStr iHostStr; - - // INSTANCENAME - private boolean iHasInstanceName; - - private String iClassNameStr; - - private CIMProperty[] iKeys; - - /** - * Ctor. - */ - public InstancePathNode() { - super(INSTANCEPATH); - } - - /** - * @param pAttribs - * @param pSession - */ - @Override - public void init(Attributes pAttribs, SAXSession pSession) { - this.iHasInstanceName = this.iHasInstancePath = false; - this.iLocalNameSpacePathStr = this.iClassNameStr = null; - this.iHostStr = new XMLHostStr(); - this.iKeys = null; - } - - @Override - public void testChild(String pNodeNameEnum) throws SAXException { - if (pNodeNameEnum == NAMESPACEPATH) { - if (this.iHasInstancePath) throw new SAXException( - "INSTANCEPATH node can have only one NAMESPACEPATH child node!"); - } else if (pNodeNameEnum == INSTANCENAME) { - if (this.iHasInstanceName) throw new SAXException( - "INSTANCEPATH node can have only one INSTANCENAME child node!"); - } else throw new SAXException("INSTANCEPATH node cannot have " + pNodeNameEnum - + " child node!"); - } - - /** - * @param pData - */ - @Override - public void parseData(String pData) { - // no data - } - - @Override - public void childParsed(Node pChild) { - if (pChild instanceof NameSpacePathNode) { - NameSpacePathNode nsPathNode = (NameSpacePathNode) pChild; - this.iHostStr.set(nsPathNode.getHostStr()); - this.iLocalNameSpacePathStr = nsPathNode.getLocalNameSpacePath(); - this.iHasInstancePath = true; - } else { - InstanceNameNode instNameNode = (InstanceNameNode) pChild; - this.iClassNameStr = instNameNode.getClassName(); - this.iKeys = instNameNode.getKeys(); - this.iHasInstanceName = true; - } - } - - @Override - public void testCompletness() throws SAXException { - if (!this.iHasInstancePath) throw new SAXException( - "INSTANCEPATH node must have a NAMESPACEPATH child node!"); - if (!this.iHasInstanceName) throw new SAXException( - "INSTANCEPATH node must have an INSTANCENAME child node!"); - } - - public CIMObjectPath getCIMObjectPath() { - /* - * CIMObjectPath( String scheme, String host, String port, String - * namespace, String objectName, CIMProperty[] keys ) - */ - return new CIMObjectPath(this.iHostStr.getProtocol(), this.iHostStr.getHost(), - this.iHostStr.getPort(), this.iLocalNameSpacePathStr, this.iClassNameStr, - this.iKeys); - } - -} +/* + (C) Copyright IBM Corp. 2006, 2012 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1660756 2007-02-22 ebak Embedded object support + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 1742873 2007-06-25 ebak IPv6 ready cim-client + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics + * 3511454 2012-03-27 blaschke-oss SAX nodes not reinitialized properly + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMObjectPath; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; +import org.metricshub.wbem.sblim.cimclient.internal.util.XMLHostStr; +import org.metricshub.wbem.javax.cim.CIMProperty; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + * ELEMENT INSTANCEPATH (NAMESPACEPATH, INSTANCENAME) + */ +public class InstancePathNode extends AbstractObjectPathNode { + + // INSTANCEPATH + private boolean iHasInstancePath; + + private String iLocalNameSpacePathStr; + + private XMLHostStr iHostStr; + + // INSTANCENAME + private boolean iHasInstanceName; + + private String iClassNameStr; + + private CIMProperty[] iKeys; + + /** + * Ctor. + */ + public InstancePathNode() { + super(INSTANCEPATH); + } + + /** + * @param pAttribs + * @param pSession + */ + @Override + public void init(Attributes pAttribs, SAXSession pSession) { + this.iHasInstanceName = this.iHasInstancePath = false; + this.iLocalNameSpacePathStr = this.iClassNameStr = null; + this.iHostStr = new XMLHostStr(); + this.iKeys = null; + } + + @Override + public void testChild(String pNodeNameEnum) throws SAXException { + if (pNodeNameEnum == NAMESPACEPATH) { + if (this.iHasInstancePath) throw new SAXException( + "INSTANCEPATH node can have only one NAMESPACEPATH child node!"); + } else if (pNodeNameEnum == INSTANCENAME) { + if (this.iHasInstanceName) throw new SAXException( + "INSTANCEPATH node can have only one INSTANCENAME child node!"); + } else throw new SAXException("INSTANCEPATH node cannot have " + pNodeNameEnum + + " child node!"); + } + + /** + * @param pData + */ + @Override + public void parseData(String pData) { + // no data + } + + @Override + public void childParsed(Node pChild) { + if (pChild instanceof NameSpacePathNode) { + NameSpacePathNode nsPathNode = (NameSpacePathNode) pChild; + this.iHostStr.set(nsPathNode.getHostStr()); + this.iLocalNameSpacePathStr = nsPathNode.getLocalNameSpacePath(); + this.iHasInstancePath = true; + } else { + InstanceNameNode instNameNode = (InstanceNameNode) pChild; + this.iClassNameStr = instNameNode.getClassName(); + this.iKeys = instNameNode.getKeys(); + this.iHasInstanceName = true; + } + } + + @Override + public void testCompletness() throws SAXException { + if (!this.iHasInstancePath) throw new SAXException( + "INSTANCEPATH node must have a NAMESPACEPATH child node!"); + if (!this.iHasInstanceName) throw new SAXException( + "INSTANCEPATH node must have an INSTANCENAME child node!"); + } + + public CIMObjectPath getCIMObjectPath() { + /* + * CIMObjectPath( String scheme, String host, String port, String + * namespace, String objectName, CIMProperty[] keys ) + */ + return new CIMObjectPath(this.iHostStr.getProtocol(), this.iHostStr.getHost(), + this.iHostStr.getPort(), this.iLocalNameSpacePathStr, this.iClassNameStr, + this.iKeys); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/KeyBindingNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/KeyBindingNode.java similarity index 74% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/KeyBindingNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/KeyBindingNode.java index 60a5ac6..d4da725 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/KeyBindingNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/KeyBindingNode.java @@ -1,130 +1,127 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1660756 2007-02-22 ebak Embedded object support - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics - * 3602604 2013-01-29 blaschke-oss Clean up SAXException messages - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMDataType; -import org.sentrysoftware.wbem.javax.cim.CIMProperty; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - * ELEMENT KEYBINDING (KEYVALUE | VALUE.REFERENCE) ATTLIST KEYBINDING %CIMName; - */ -public class KeyBindingNode extends Node { - - private String iName; - - // child element - private boolean iHasChild; - - private CIMDataType iType; - - private Object iValue; - - /** - * Ctor. - */ - public KeyBindingNode() { - super(KEYBINDING); - } - - /** - * @param pSession - */ - @Override - public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { - this.iHasChild = false; - this.iValue = null; - this.iName = getCIMName(pAttribs); - } - - /** - * @param pData - */ - @Override - public void parseData(String pData) { - // no data - } - - @Override - public void testChild(String pNodeNameEnum) throws SAXException { - if (this.iHasChild) throw new SAXException("KEYBINDING node can only have one child node!"); - if (pNodeNameEnum != KEYVALUE && pNodeNameEnum != VALUE_REFERENCE) throw new SAXException( - "KEYBINDING node's child node can be KEYVALUE or VALUE_REFERENCE but not " - + pNodeNameEnum); - } - - @Override - public void childParsed(Node pChild) { - AbstractScalarValueNode abstScalarValNode = (AbstractScalarValueNode) pChild; - this.iType = abstScalarValNode.getType(); - this.iValue = abstScalarValNode.getValue(); - this.iHasChild = true; - } - - @Override - public void testCompletness() throws SAXException { - if (!this.iHasChild) throw new SAXException( - "KEYBINDING node must have a KEYVALUE or VALUE_REFERENCE child node!"); - } - - /** - * getCIMProperty - * - * @return CIMProperty - */ - public CIMProperty getCIMProperty() { - // CIMProperty( - // String name, CIMDataType type, Object value, boolean key, boolean - // propagated, String originClass - // ) - return new CIMProperty(this.iName, this.iType, this.iValue, true, false, null); - } - -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1660756 2007-02-22 ebak Embedded object support + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics + * 3602604 2013-01-29 blaschke-oss Clean up SAXException messages + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMDataType; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; +import org.metricshub.wbem.javax.cim.CIMProperty; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + * ELEMENT KEYBINDING (KEYVALUE | VALUE.REFERENCE) ATTLIST KEYBINDING %CIMName; + */ +public class KeyBindingNode extends Node { + + private String iName; + + // child element + private boolean iHasChild; + + private CIMDataType iType; + + private Object iValue; + + /** + * Ctor. + */ + public KeyBindingNode() { + super(KEYBINDING); + } + + /** + * @param pSession + */ + @Override + public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { + this.iHasChild = false; + this.iValue = null; + this.iName = getCIMName(pAttribs); + } + + /** + * @param pData + */ + @Override + public void parseData(String pData) { + // no data + } + + @Override + public void testChild(String pNodeNameEnum) throws SAXException { + if (this.iHasChild) throw new SAXException("KEYBINDING node can only have one child node!"); + if (pNodeNameEnum != KEYVALUE && pNodeNameEnum != VALUE_REFERENCE) throw new SAXException( + "KEYBINDING node's child node can be KEYVALUE or VALUE_REFERENCE but not " + + pNodeNameEnum); + } + + @Override + public void childParsed(Node pChild) { + AbstractScalarValueNode abstScalarValNode = (AbstractScalarValueNode) pChild; + this.iType = abstScalarValNode.getType(); + this.iValue = abstScalarValNode.getValue(); + this.iHasChild = true; + } + + @Override + public void testCompletness() throws SAXException { + if (!this.iHasChild) throw new SAXException( + "KEYBINDING node must have a KEYVALUE or VALUE_REFERENCE child node!"); + } + + /** + * getCIMProperty + * + * @return CIMProperty + */ + public CIMProperty getCIMProperty() { + // CIMProperty( + // String name, CIMDataType type, Object value, boolean key, boolean + // propagated, String originClass + // ) + return new CIMProperty(this.iName, this.iType, this.iValue, true, false, null); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/KeyValueNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/KeyValueNode.java similarity index 78% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/KeyValueNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/KeyValueNode.java index 7a5f6d3..f323511 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/KeyValueNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/KeyValueNode.java @@ -1,224 +1,221 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1660756 2007-02-22 ebak Embedded object support - * 1714878 2007-05-08 ebak Empty string property values are parsed as nulls - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 1769504 2007-08-08 ebak Type identification for VALUETYPE="numeric" - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors - * 2823494 2009-08-03 rgummada Change Boolean constructor to static - * 3572993 2012-10-01 blaschke-oss parseDouble("2.2250738585072012e-308") DoS vulnerability - * 3602604 2013-01-29 blaschke-oss Clean up SAXException messages - * 2604 2013-07-01 blaschke-oss SAXException messages should contain node name - * 2683 2013-10-07 blaschke-oss KEYVALUE VALUETYPE optional, "string" default - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMDataType; -import org.sentrysoftware.wbem.javax.cim.CIMDateTimeAbsolute; -import org.sentrysoftware.wbem.javax.cim.CIMDateTimeInterval; -import org.sentrysoftware.wbem.javax.cim.UnsignedInteger64; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.CIMObjectFactory; -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.sentrysoftware.wbem.sblim.cimclient.internal.util.MOF; -import org.sentrysoftware.wbem.sblim.cimclient.internal.util.Util; -import org.sentrysoftware.wbem.sblim.cimclient.internal.util.WBEMConfiguration; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - * ELEMENT KEYVALUE (#PCDATA) ATTLIST KEYVALUE VALUETYPE (string | boolean | - * numeric) "string" %CIMType; #IMPLIED - */ -public class KeyValueNode extends AbstractScalarValueNode { - - private CIMDataType iType; - - private String iValueTypeStr; - - private Object iValue; - - /** - * Ctor. - */ - public KeyValueNode() { - super(KEYVALUE); - } - - /** - * @param pSession - */ - @Override - public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { - this.iType = getCIMType(pAttribs, true); - this.iValue = null; - if (this.iType != null) { - if (this.iType.isArray()) throw new SAXException("KEYVALUE node cannot be array typed!"); - return; - } - // let's see the VALUETYPE attribute - this.iValueTypeStr = pAttribs.getValue("VALUETYPE"); - if (this.iValueTypeStr == null) this.iValueTypeStr = "string"; - } - - @Override - public void parseData(String pData) throws SAXException { - if (this.iType == null) { - setTypeAndValue(pData); - } else { - this.iValue = CIMObjectFactory.getObject(this.iType, pData); - } - } - - /** - * @param pNodeNameEnum - */ - @Override - public void testChild(String pNodeNameEnum) throws SAXException { - throw new SAXException("KEYVALUE node cannot have any child nodes!"); - } - - /** - * @param pChild - */ - @Override - public void childParsed(Node pChild) { - // no child - } - - @Override - public void testCompletness() { - // nothing to do - } - - public Object getValue() { - /* - * null key values are not allowed, empty #PCDATA means empty String - */ - return this.iValue == null ? "" : this.iValue; - } - - public CIMDataType getType() { - return this.iType; - } - - private void setTypeAndValue(String pValue) throws SAXException { - // determine iType from iValueTypeStr if required - if (this.iType != null) return; - - if (this.iValueTypeStr.equals("numeric")) { - if (!setUInt64(pValue) && !setSInt64(pValue) && !setReal64(pValue)) throw new SAXException( - "Unparseable \"number\" value in " + getNodeName() + " node: " + pValue + "!"); - } else if (this.iValueTypeStr.equals(MOF.DT_STR)) { - if (!setDTAbsolute(pValue) && !setDTInterval(pValue)) { - this.iValue = pValue; - this.iType = CIMDataType.STRING_T; - } - } else if (this.iValueTypeStr.equals(MOF.DT_BOOL)) { - if (!setBoolean(pValue)) throw new SAXException("Unparseable \"boolean\" value in " - + getNodeName() + " node: " + pValue + "!"); - } else { - throw new SAXException("KEYVALUE node's VALUETYPE attribute must be " + MOF.DT_STR - + ", " + MOF.DT_BOOL + " or numeric! " + pValue + " is not allowed!"); - } - } - - private boolean setUInt64(String pValue) { - try { - this.iValue = new UnsignedInteger64(pValue); - } catch (NumberFormatException e) { - return false; - } - this.iType = CIMDataType.UINT64_T; - return true; - } - - private boolean setSInt64(String pValue) { - try { - this.iValue = new Long(pValue); - } catch (NumberFormatException e) { - return false; - } - this.iType = CIMDataType.SINT64_T; - return true; - } - - private boolean setReal64(String pValue) { - try { - if (WBEMConfiguration.getGlobalConfiguration().verifyJavaLangDoubleStrings()) { - if (Util.isBadDoubleString(pValue)) return false; - } - this.iValue = new Double(pValue); - } catch (NumberFormatException e) { - return false; - } - this.iType = CIMDataType.REAL64_T; - return true; - } - - private boolean setBoolean(String pValue) { - this.iValue = Boolean.valueOf(pValue); - this.iType = CIMDataType.BOOLEAN_T; - return true; - } - - private boolean setDTAbsolute(String pValue) { - try { - this.iValue = new CIMDateTimeAbsolute(pValue); - } catch (IllegalArgumentException e) { - return false; - } - this.iType = CIMDataType.DATETIME_T; - return true; - } - - private boolean setDTInterval(String pValue) { - try { - this.iValue = new CIMDateTimeInterval(pValue); - } catch (IllegalArgumentException e) { - return false; - } - this.iType = CIMDataType.DATETIME_T; - return true; - } - -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1660756 2007-02-22 ebak Embedded object support + * 1714878 2007-05-08 ebak Empty string property values are parsed as nulls + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 1769504 2007-08-08 ebak Type identification for VALUETYPE="numeric" + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors + * 2823494 2009-08-03 rgummada Change Boolean constructor to static + * 3572993 2012-10-01 blaschke-oss parseDouble("2.2250738585072012e-308") DoS vulnerability + * 3602604 2013-01-29 blaschke-oss Clean up SAXException messages + * 2604 2013-07-01 blaschke-oss SAXException messages should contain node name + * 2683 2013-10-07 blaschke-oss KEYVALUE VALUETYPE optional, "string" default + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMDataType; +import org.metricshub.wbem.javax.cim.CIMDateTimeAbsolute; +import org.metricshub.wbem.javax.cim.CIMDateTimeInterval; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.CIMObjectFactory; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; +import org.metricshub.wbem.sblim.cimclient.internal.util.MOF; +import org.metricshub.wbem.sblim.cimclient.internal.util.Util; +import org.metricshub.wbem.sblim.cimclient.internal.util.WBEMConfiguration; +import org.metricshub.wbem.javax.cim.UnsignedInteger64; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + * ELEMENT KEYVALUE (#PCDATA) ATTLIST KEYVALUE VALUETYPE (string | boolean | + * numeric) "string" %CIMType; #IMPLIED + */ +public class KeyValueNode extends AbstractScalarValueNode { + + private CIMDataType iType; + + private String iValueTypeStr; + + private Object iValue; + + /** + * Ctor. + */ + public KeyValueNode() { + super(KEYVALUE); + } + + /** + * @param pSession + */ + @Override + public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { + this.iType = getCIMType(pAttribs, true); + this.iValue = null; + if (this.iType != null) { + if (this.iType.isArray()) throw new SAXException("KEYVALUE node cannot be array typed!"); + return; + } + // let's see the VALUETYPE attribute + this.iValueTypeStr = pAttribs.getValue("VALUETYPE"); + if (this.iValueTypeStr == null) this.iValueTypeStr = "string"; + } + + @Override + public void parseData(String pData) throws SAXException { + if (this.iType == null) { + setTypeAndValue(pData); + } else { + this.iValue = CIMObjectFactory.getObject(this.iType, pData); + } + } + + /** + * @param pNodeNameEnum + */ + @Override + public void testChild(String pNodeNameEnum) throws SAXException { + throw new SAXException("KEYVALUE node cannot have any child nodes!"); + } + + /** + * @param pChild + */ + @Override + public void childParsed(Node pChild) { + // no child + } + + @Override + public void testCompletness() { + // nothing to do + } + + public Object getValue() { + /* + * null key values are not allowed, empty #PCDATA means empty String + */ + return this.iValue == null ? "" : this.iValue; + } + + public CIMDataType getType() { + return this.iType; + } + + private void setTypeAndValue(String pValue) throws SAXException { + // determine iType from iValueTypeStr if required + if (this.iType != null) return; + + if (this.iValueTypeStr.equals("numeric")) { + if (!setUInt64(pValue) && !setSInt64(pValue) && !setReal64(pValue)) throw new SAXException( + "Unparseable \"number\" value in " + getNodeName() + " node: " + pValue + "!"); + } else if (this.iValueTypeStr.equals(MOF.DT_STR)) { + if (!setDTAbsolute(pValue) && !setDTInterval(pValue)) { + this.iValue = pValue; + this.iType = CIMDataType.STRING_T; + } + } else if (this.iValueTypeStr.equals(MOF.DT_BOOL)) { + if (!setBoolean(pValue)) throw new SAXException("Unparseable \"boolean\" value in " + + getNodeName() + " node: " + pValue + "!"); + } else { + throw new SAXException("KEYVALUE node's VALUETYPE attribute must be " + MOF.DT_STR + + ", " + MOF.DT_BOOL + " or numeric! " + pValue + " is not allowed!"); + } + } + + private boolean setUInt64(String pValue) { + try { + this.iValue = new UnsignedInteger64(pValue); + } catch (NumberFormatException e) { + return false; + } + this.iType = CIMDataType.UINT64_T; + return true; + } + + private boolean setSInt64(String pValue) { + try { + this.iValue = new Long(pValue); + } catch (NumberFormatException e) { + return false; + } + this.iType = CIMDataType.SINT64_T; + return true; + } + + private boolean setReal64(String pValue) { + try { + if (WBEMConfiguration.getGlobalConfiguration().verifyJavaLangDoubleStrings()) { + if (Util.isBadDoubleString(pValue)) return false; + } + this.iValue = new Double(pValue); + } catch (NumberFormatException e) { + return false; + } + this.iType = CIMDataType.REAL64_T; + return true; + } + + private boolean setBoolean(String pValue) { + this.iValue = Boolean.valueOf(pValue); + this.iType = CIMDataType.BOOLEAN_T; + return true; + } + + private boolean setDTAbsolute(String pValue) { + try { + this.iValue = new CIMDateTimeAbsolute(pValue); + } catch (IllegalArgumentException e) { + return false; + } + this.iType = CIMDataType.DATETIME_T; + return true; + } + + private boolean setDTInterval(String pValue) { + try { + this.iValue = new CIMDateTimeInterval(pValue); + } catch (IllegalArgumentException e) { + return false; + } + this.iType = CIMDataType.DATETIME_T; + return true; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/LocalClassPathNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/LocalClassPathNode.java similarity index 77% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/LocalClassPathNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/LocalClassPathNode.java index 3aa8a67..bf0fbb3 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/LocalClassPathNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/LocalClassPathNode.java @@ -1,136 +1,133 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1660756 2007-02-22 ebak Embedded object support - * 1686000 2007-04-20 ebak modifyInstance() missing from WBEMClient - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2974884 2010-04-20 blaschke-oss Exception when attaching 2 CDRoms with invoke method - * 3602604 2013-01-29 blaschke-oss Clean up SAXException messages - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.LocalPathBuilder; -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - * ELEMENT LOCALCLASSPATH (LOCALNAMESPACEPATH, CLASSNAME) - */ -public class LocalClassPathNode extends AbstractObjectPathNode { - - // LOCALNAMESPACEPATH - private boolean iHasLocalNameSpacePath, iHasClassName; - - private String iNameSpaceStr; - - // CLASSNAME - private String iClassNameStr; - - // --- - private CIMObjectPath iLocalPath; - - /** - * Ctor. - */ - public LocalClassPathNode() { - super(LOCALCLASSPATH); - } - - /** - * @param pAttribs - */ - @Override - public void init(Attributes pAttribs, SAXSession pSession) { - this.iLocalPath = pSession.getDefLocalPath(); - this.iHasLocalNameSpacePath = this.iHasClassName = false; - this.iNameSpaceStr = this.iClassNameStr = null; - // no attributes - } - - /** - * @param pData - */ - @Override - public void parseData(String pData) { - // no data - } - - @Override - public void testChild(String pNodeNameEnum) throws SAXException { - if (pNodeNameEnum == LOCALNAMESPACEPATH) { - if (this.iHasLocalNameSpacePath) throw new SAXException( - "LOCALCLASSPATH node already has a LOCALNAMESPACEPATH child node!"); - } else if (pNodeNameEnum == CLASSNAME) { - if (this.iHasClassName) throw new SAXException( - "LOCALCLASSPATH node already has a CLASSNAME child node!"); - } else throw new SAXException("LOCALCLASSPATH node cannot have " + pNodeNameEnum - + " child node!" - + " It can have LOCALNAMESPACEPATH and CLASSNAME child nodes only!"); - } - - @Override - public void childParsed(Node pChild) { - if (pChild instanceof LocalNameSpacePathNode) { - this.iNameSpaceStr = ((LocalNameSpacePathNode) pChild).getNameSpace(); - this.iHasLocalNameSpacePath = true; - } else { - this.iClassNameStr = ((ClassNameNode) pChild).getClassName(); - this.iHasClassName = true; - } - } - - @Override - public void testCompletness() throws SAXException { - if (!this.iHasLocalNameSpacePath) throw new SAXException( - "LOCALNAMESPACE child node is mandatory for LOCALCLASSPATH node!"); - if (!this.iHasClassName) throw new SAXException( - "CLASSNAME child node is mandatory for LOCALCLASSPATH node!"); - } - - public CIMObjectPath getCIMObjectPath() { - return LocalPathBuilder.build(this.iLocalPath, this.iClassNameStr, this.iNameSpaceStr); - } - -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1660756 2007-02-22 ebak Embedded object support + * 1686000 2007-04-20 ebak modifyInstance() missing from WBEMClient + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2974884 2010-04-20 blaschke-oss Exception when attaching 2 CDRoms with invoke method + * 3602604 2013-01-29 blaschke-oss Clean up SAXException messages + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMObjectPath; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.LocalPathBuilder; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + * ELEMENT LOCALCLASSPATH (LOCALNAMESPACEPATH, CLASSNAME) + */ +public class LocalClassPathNode extends AbstractObjectPathNode { + + // LOCALNAMESPACEPATH + private boolean iHasLocalNameSpacePath, iHasClassName; + + private String iNameSpaceStr; + + // CLASSNAME + private String iClassNameStr; + + // --- + private CIMObjectPath iLocalPath; + + /** + * Ctor. + */ + public LocalClassPathNode() { + super(LOCALCLASSPATH); + } + + /** + * @param pAttribs + */ + @Override + public void init(Attributes pAttribs, SAXSession pSession) { + this.iLocalPath = pSession.getDefLocalPath(); + this.iHasLocalNameSpacePath = this.iHasClassName = false; + this.iNameSpaceStr = this.iClassNameStr = null; + // no attributes + } + + /** + * @param pData + */ + @Override + public void parseData(String pData) { + // no data + } + + @Override + public void testChild(String pNodeNameEnum) throws SAXException { + if (pNodeNameEnum == LOCALNAMESPACEPATH) { + if (this.iHasLocalNameSpacePath) throw new SAXException( + "LOCALCLASSPATH node already has a LOCALNAMESPACEPATH child node!"); + } else if (pNodeNameEnum == CLASSNAME) { + if (this.iHasClassName) throw new SAXException( + "LOCALCLASSPATH node already has a CLASSNAME child node!"); + } else throw new SAXException("LOCALCLASSPATH node cannot have " + pNodeNameEnum + + " child node!" + + " It can have LOCALNAMESPACEPATH and CLASSNAME child nodes only!"); + } + + @Override + public void childParsed(Node pChild) { + if (pChild instanceof LocalNameSpacePathNode) { + this.iNameSpaceStr = ((LocalNameSpacePathNode) pChild).getNameSpace(); + this.iHasLocalNameSpacePath = true; + } else { + this.iClassNameStr = ((ClassNameNode) pChild).getClassName(); + this.iHasClassName = true; + } + } + + @Override + public void testCompletness() throws SAXException { + if (!this.iHasLocalNameSpacePath) throw new SAXException( + "LOCALNAMESPACE child node is mandatory for LOCALCLASSPATH node!"); + if (!this.iHasClassName) throw new SAXException( + "CLASSNAME child node is mandatory for LOCALCLASSPATH node!"); + } + + public CIMObjectPath getCIMObjectPath() { + return LocalPathBuilder.build(this.iLocalPath, this.iClassNameStr, this.iNameSpaceStr); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/LocalInstancePathNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/LocalInstancePathNode.java similarity index 76% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/LocalInstancePathNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/LocalInstancePathNode.java index 0624ef6..f4eb1d4 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/LocalInstancePathNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/LocalInstancePathNode.java @@ -1,145 +1,142 @@ -/* - (C) Copyright IBM Corp. 2006, 2012 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1660756 2007-02-22 ebak Embedded object support - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics - * 3511454 2012-03-27 blaschke-oss SAX nodes not reinitialized properly - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; -import org.sentrysoftware.wbem.javax.cim.CIMProperty; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.LocalPathBuilder; -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - * ELEMENT LOCALINSTANCEPATH (LOCALNAMESPACEPATH, INSTANCENAME) - */ -public class LocalInstancePathNode extends AbstractObjectPathNode { - - // LOCALNAMESPACEPATH - private boolean iHasLocalNameSpacePath; - - private String iNameSpaceStr; - - // INSTANCENAME - private boolean iHasInstanceName; - - private String iClassNameStr; - - private CIMProperty[] iKeys; - - // base localpath - private CIMObjectPath iLocalPath; - - /** - * Ctor. - */ - public LocalInstancePathNode() { - super(LOCALINSTANCEPATH); - } - - /** - * @param pAttribs - */ - @Override - public void init(Attributes pAttribs, SAXSession pSession) { - this.iLocalPath = pSession.getDefLocalPath(); - this.iHasLocalNameSpacePath = this.iHasInstanceName = false; - this.iNameSpaceStr = this.iClassNameStr = null; - this.iKeys = null; - // no attributes - } - - /** - * @param pData - */ - @Override - public void parseData(String pData) { - // no data - } - - @Override - public void testChild(String pNodeNameEnum) throws SAXException { - if (pNodeNameEnum == LOCALNAMESPACEPATH) { - if (this.iHasLocalNameSpacePath) throw new SAXException(getNodeName() - + " node can have only one LOCALNAMESPACEPATH child node!"); - } else if (pNodeNameEnum == INSTANCENAME) { - if (this.iHasInstanceName) throw new SAXException(getNodeName() - + " node can have only one INSTANCENAME child node!"); - } else throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum - + " child node!"); - } - - @Override - public void childParsed(Node pChild) { - if (pChild instanceof LocalNameSpacePathNode) { - this.iHasLocalNameSpacePath = true; - this.iNameSpaceStr = ((LocalNameSpacePathNode) pChild).getNameSpace(); - } else { - this.iHasInstanceName = true; - InstanceNameNode instNameNode = (InstanceNameNode) pChild; - this.iClassNameStr = instNameNode.getClassName(); - this.iKeys = instNameNode.getKeys(); - } - } - - @Override - public void testCompletness() throws SAXException { - if (!this.iHasLocalNameSpacePath) throw new SAXException(getNodeName() - + " node must have a LOCALNAMESPACEPATH child node!"); - if (!this.iHasInstanceName) throw new SAXException(getNodeName() - + " node must have a INSTANCENAME child node!"); - } - - public CIMObjectPath getCIMObjectPath() { - // CIMObjectPath(String objectName, String namespace, CIMProperty[] - // keys) - return LocalPathBuilder.build(this.iLocalPath, this.iClassNameStr, this.iNameSpaceStr, - this.iKeys); - } - -} +/* + (C) Copyright IBM Corp. 2006, 2012 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1660756 2007-02-22 ebak Embedded object support + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics + * 3511454 2012-03-27 blaschke-oss SAX nodes not reinitialized properly + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMObjectPath; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.LocalPathBuilder; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; +import org.metricshub.wbem.javax.cim.CIMProperty; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + * ELEMENT LOCALINSTANCEPATH (LOCALNAMESPACEPATH, INSTANCENAME) + */ +public class LocalInstancePathNode extends AbstractObjectPathNode { + + // LOCALNAMESPACEPATH + private boolean iHasLocalNameSpacePath; + + private String iNameSpaceStr; + + // INSTANCENAME + private boolean iHasInstanceName; + + private String iClassNameStr; + + private CIMProperty[] iKeys; + + // base localpath + private CIMObjectPath iLocalPath; + + /** + * Ctor. + */ + public LocalInstancePathNode() { + super(LOCALINSTANCEPATH); + } + + /** + * @param pAttribs + */ + @Override + public void init(Attributes pAttribs, SAXSession pSession) { + this.iLocalPath = pSession.getDefLocalPath(); + this.iHasLocalNameSpacePath = this.iHasInstanceName = false; + this.iNameSpaceStr = this.iClassNameStr = null; + this.iKeys = null; + // no attributes + } + + /** + * @param pData + */ + @Override + public void parseData(String pData) { + // no data + } + + @Override + public void testChild(String pNodeNameEnum) throws SAXException { + if (pNodeNameEnum == LOCALNAMESPACEPATH) { + if (this.iHasLocalNameSpacePath) throw new SAXException(getNodeName() + + " node can have only one LOCALNAMESPACEPATH child node!"); + } else if (pNodeNameEnum == INSTANCENAME) { + if (this.iHasInstanceName) throw new SAXException(getNodeName() + + " node can have only one INSTANCENAME child node!"); + } else throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum + + " child node!"); + } + + @Override + public void childParsed(Node pChild) { + if (pChild instanceof LocalNameSpacePathNode) { + this.iHasLocalNameSpacePath = true; + this.iNameSpaceStr = ((LocalNameSpacePathNode) pChild).getNameSpace(); + } else { + this.iHasInstanceName = true; + InstanceNameNode instNameNode = (InstanceNameNode) pChild; + this.iClassNameStr = instNameNode.getClassName(); + this.iKeys = instNameNode.getKeys(); + } + } + + @Override + public void testCompletness() throws SAXException { + if (!this.iHasLocalNameSpacePath) throw new SAXException(getNodeName() + + " node must have a LOCALNAMESPACEPATH child node!"); + if (!this.iHasInstanceName) throw new SAXException(getNodeName() + + " node must have a INSTANCENAME child node!"); + } + + public CIMObjectPath getCIMObjectPath() { + // CIMObjectPath(String objectName, String namespace, CIMProperty[] + // keys) + return LocalPathBuilder.build(this.iLocalPath, this.iClassNameStr, this.iNameSpaceStr, + this.iKeys); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/LocalNameSpacePathNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/LocalNameSpacePathNode.java similarity index 76% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/LocalNameSpacePathNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/LocalNameSpacePathNode.java index 1f6e362..4948b9d 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/LocalNameSpacePathNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/LocalNameSpacePathNode.java @@ -1,141 +1,138 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1660756 2007-02-22 ebak Embedded object support - * 1686000 2007-04-20 ebak modifyInstance() missing from WBEMClient - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 3521119 2012-04-24 blaschke-oss JSR48 1.0.0: remove CIMObjectPath 2/3/4-parm ctors - * 2711 2013-11-13 blaschke-oss LOCALNAMESPACEPATH allows 0 NAMESPACE children - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.sentrysoftware.wbem.sblim.cimclient.internal.util.WBEMConfiguration; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - * ELEMENT LOCALNAMESPACEPATH (NAMESPACE+) - */ -public class LocalNameSpacePathNode extends AbstractPathNode { - - private StringBuffer iNameSpaceStrBuf; - - private String iNameSpaceStr; - - private CIMObjectPath iNameSpacePath; - - private CIMObjectPath iLocalPath; - - /** - * Ctor. - */ - public LocalNameSpacePathNode() { - super(LOCALNAMESPACEPATH); - } - - /** - * @param pAttribs - */ - @Override - public void init(Attributes pAttribs, SAXSession pSession) { - this.iLocalPath = pSession.getDefLocalPath(); - this.iNameSpaceStrBuf = null; - this.iNameSpaceStr = null; - this.iNameSpacePath = null; - // no attributes - } - - /** - * @param pData - */ - @Override - public void parseData(String pData) { - // no data - } - - @Override - public void testChild(String pNodeNameEnum) throws SAXException { - if (pNodeNameEnum != NAMESPACE) throw new SAXException(getNodeName() - + " node can have NAMESPACE child node only! " + pNodeNameEnum - + " child node is invalid!"); - } - - @Override - public void childParsed(Node pChild) { - String nsStr = ((NameSpaceNode) pChild).getNameSpace(); - if (this.iNameSpaceStrBuf == null) { - this.iNameSpaceStrBuf = new StringBuffer(nsStr); - } else { - this.iNameSpaceStrBuf.append('/' + nsStr); - } - } - - @Override - public void testCompletness() throws SAXException { - if (this.iNameSpaceStrBuf == null) { - if (WBEMConfiguration.getGlobalConfiguration().allowEmptyLocalNameSpacePath() - && this.iLocalPath != null && this.iLocalPath.getNamespace() != null) return; - throw new SAXException(getNodeName() - + " node must have at least one NAMESPACE child node!"); - } - } - - /** - * getNameSpace - * - * @return String - */ - public String getNameSpace() { - if (this.iNameSpaceStr != null) return this.iNameSpaceStr; - return this.iNameSpaceStr = (this.iNameSpaceStrBuf == null ? this.iLocalPath.getNamespace() - : this.iNameSpaceStrBuf.toString()); - } - - public CIMObjectPath getCIMObjectPath() { - if (this.iNameSpacePath != null) return this.iNameSpacePath; - return this.iNameSpacePath = new CIMObjectPath(null, null, null, getNameSpace(), null, null); - } - -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1660756 2007-02-22 ebak Embedded object support + * 1686000 2007-04-20 ebak modifyInstance() missing from WBEMClient + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 3521119 2012-04-24 blaschke-oss JSR48 1.0.0: remove CIMObjectPath 2/3/4-parm ctors + * 2711 2013-11-13 blaschke-oss LOCALNAMESPACEPATH allows 0 NAMESPACE children + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMObjectPath; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; +import org.metricshub.wbem.sblim.cimclient.internal.util.WBEMConfiguration; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + * ELEMENT LOCALNAMESPACEPATH (NAMESPACE+) + */ +public class LocalNameSpacePathNode extends AbstractPathNode { + + private StringBuffer iNameSpaceStrBuf; + + private String iNameSpaceStr; + + private CIMObjectPath iNameSpacePath; + + private CIMObjectPath iLocalPath; + + /** + * Ctor. + */ + public LocalNameSpacePathNode() { + super(LOCALNAMESPACEPATH); + } + + /** + * @param pAttribs + */ + @Override + public void init(Attributes pAttribs, SAXSession pSession) { + this.iLocalPath = pSession.getDefLocalPath(); + this.iNameSpaceStrBuf = null; + this.iNameSpaceStr = null; + this.iNameSpacePath = null; + // no attributes + } + + /** + * @param pData + */ + @Override + public void parseData(String pData) { + // no data + } + + @Override + public void testChild(String pNodeNameEnum) throws SAXException { + if (pNodeNameEnum != NAMESPACE) throw new SAXException(getNodeName() + + " node can have NAMESPACE child node only! " + pNodeNameEnum + + " child node is invalid!"); + } + + @Override + public void childParsed(Node pChild) { + String nsStr = ((NameSpaceNode) pChild).getNameSpace(); + if (this.iNameSpaceStrBuf == null) { + this.iNameSpaceStrBuf = new StringBuffer(nsStr); + } else { + this.iNameSpaceStrBuf.append('/' + nsStr); + } + } + + @Override + public void testCompletness() throws SAXException { + if (this.iNameSpaceStrBuf == null) { + if (WBEMConfiguration.getGlobalConfiguration().allowEmptyLocalNameSpacePath() + && this.iLocalPath != null && this.iLocalPath.getNamespace() != null) return; + throw new SAXException(getNodeName() + + " node must have at least one NAMESPACE child node!"); + } + } + + /** + * getNameSpace + * + * @return String + */ + public String getNameSpace() { + if (this.iNameSpaceStr != null) return this.iNameSpaceStr; + return this.iNameSpaceStr = (this.iNameSpaceStrBuf == null ? this.iLocalPath.getNamespace() + : this.iNameSpaceStrBuf.toString()); + } + + public CIMObjectPath getCIMObjectPath() { + if (this.iNameSpacePath != null) return this.iNameSpacePath; + return this.iNameSpacePath = new CIMObjectPath(null, null, null, getNameSpace(), null, null); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/MessageNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/MessageNode.java similarity index 78% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/MessageNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/MessageNode.java index aecabf6..94ea368 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/MessageNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/MessageNode.java @@ -1,136 +1,134 @@ -/* - (C) Copyright IBM Corp. 2006, 2012 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1660756 2007-02-22 ebak Embedded object support - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 3511454 2012-03-27 blaschke-oss SAX nodes not reinitialized properly - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - *
      - * ELEMENT MESSAGE (SIMPLEREQ | MULTIREQ | SIMPLERSP | MULTIRSP | SIMPLEEXPREQ | MULTIEXPREQ |
      - *    SIMPLEEXPRSP | MULTIEXPRSP)
      - * ATTLIST MESSAGE
      - *    ID CDATA #REQUIRED
      - *    PROTOCOLVERSION CDATA #REQUIRED
      - * 
      - */ -public class MessageNode extends Node implements NonVolatileIf { - - private String iID; - - private String iProtocolVersion; - - private AbstractMessageNode iAbstractMsgNode; - - /** - * Ctor. - */ - public MessageNode() { - super(MESSAGE); - } - - public void addChild(Node pChild) { - this.iAbstractMsgNode = (AbstractMessageNode) pChild; - } - - /** - * @param pSession - */ - @Override - public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { - this.iID = pAttribs.getValue("ID"); - if (this.iID == null) throw new SAXException("ID attribute is mandatory for MESSAGE node!"); - this.iProtocolVersion = pAttribs.getValue("PROTOCOLVERSION"); - if (this.iProtocolVersion == null) throw new SAXException( - "PROTOCOLVERSION attribute is mandatory for MESSAGE node!"); - this.iAbstractMsgNode = null; - } - - /** - * @param pData - */ - @Override - public void parseData(String pData) { - // no data - } - - private static final String[] ALLOWED_CHILDREN = { SIMPLEREQ, MULTIREQ, SIMPLERSP, MULTIRSP, - SIMPLEEXPREQ, MULTIEXPREQ, SIMPLEEXPRSP, MULTIEXPRSP }; - - @Override - public void testChild(String pNodeNameEnum) throws SAXException { - if (this.iAbstractMsgNode != null) throw new SAXException( - "MESSAGE node can have only one child node!"); - for (int i = 0; i < ALLOWED_CHILDREN.length; i++) - if (pNodeNameEnum == ALLOWED_CHILDREN[i]) return; - throw new SAXException("MESSAGE node cannot have " + pNodeNameEnum + " child node!"); - } - - /** - * @param pChild - */ - @Override - public void childParsed(Node pChild) { - // nothing to do - } - - @Override - public void testCompletness() throws SAXException { - if (this.iAbstractMsgNode == null) throw new SAXException( - "MESSAGE node must have a child node!"); - } - - /** - * getAbstractMessageNode - * - * @return AbstractMessageNode - */ - public AbstractMessageNode getAbstractMessageNode() { - return this.iAbstractMsgNode; - } - -} +/* + (C) Copyright IBM Corp. 2006, 2012 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1660756 2007-02-22 ebak Embedded object support + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 3511454 2012-03-27 blaschke-oss SAX nodes not reinitialized properly + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + *
      + * ELEMENT MESSAGE (SIMPLEREQ | MULTIREQ | SIMPLERSP | MULTIRSP | SIMPLEEXPREQ | MULTIEXPREQ |
      + *    SIMPLEEXPRSP | MULTIEXPRSP)
      + * ATTLIST MESSAGE
      + *    ID CDATA #REQUIRED
      + *    PROTOCOLVERSION CDATA #REQUIRED
      + * 
      + */ +public class MessageNode extends Node implements NonVolatileIf { + + private String iID; + + private String iProtocolVersion; + + private AbstractMessageNode iAbstractMsgNode; + + /** + * Ctor. + */ + public MessageNode() { + super(MESSAGE); + } + + public void addChild(Node pChild) { + this.iAbstractMsgNode = (AbstractMessageNode) pChild; + } + + /** + * @param pSession + */ + @Override + public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { + this.iID = pAttribs.getValue("ID"); + if (this.iID == null) throw new SAXException("ID attribute is mandatory for MESSAGE node!"); + this.iProtocolVersion = pAttribs.getValue("PROTOCOLVERSION"); + if (this.iProtocolVersion == null) throw new SAXException( + "PROTOCOLVERSION attribute is mandatory for MESSAGE node!"); + this.iAbstractMsgNode = null; + } + + /** + * @param pData + */ + @Override + public void parseData(String pData) { + // no data + } + + private static final String[] ALLOWED_CHILDREN = { SIMPLEREQ, MULTIREQ, SIMPLERSP, MULTIRSP, + SIMPLEEXPREQ, MULTIEXPREQ, SIMPLEEXPRSP, MULTIEXPRSP }; + + @Override + public void testChild(String pNodeNameEnum) throws SAXException { + if (this.iAbstractMsgNode != null) throw new SAXException( + "MESSAGE node can have only one child node!"); + for (int i = 0; i < ALLOWED_CHILDREN.length; i++) + if (pNodeNameEnum == ALLOWED_CHILDREN[i]) return; + throw new SAXException("MESSAGE node cannot have " + pNodeNameEnum + " child node!"); + } + + /** + * @param pChild + */ + @Override + public void childParsed(Node pChild) { + // nothing to do + } + + @Override + public void testCompletness() throws SAXException { + if (this.iAbstractMsgNode == null) throw new SAXException( + "MESSAGE node must have a child node!"); + } + + /** + * getAbstractMessageNode + * + * @return AbstractMessageNode + */ + public AbstractMessageNode getAbstractMessageNode() { + return this.iAbstractMsgNode; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/MethodCallNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/MethodCallNode.java similarity index 73% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/MethodCallNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/MethodCallNode.java index a4c8963..cdae094 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/MethodCallNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/MethodCallNode.java @@ -1,79 +1,77 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1686000 2007-04-20 ebak modifyInstance() missing from WBEMClient - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2682 2013-10-02 blaschke-oss (I)MethodCallNode allows no LOCAL*PATH - * 2690 2013-10-11 blaschke-oss Remove RESPONSEDESTINATION support - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.xml.sax.SAXException; - -/** - * ELEMENT METHODCALL ((LOCALINSTANCEPATH | LOCALCLASSPATH), PARAMVALUE*) - * ATTLIST METHODCALL %CIMName; - */ -public class MethodCallNode extends AbstractMethodCallNode { - - /** - * Ctor. - */ - public MethodCallNode() { - super(METHODCALL); - } - - @Override - protected void testSpecChild(String pNodeNameEnum) throws SAXException { - if (pNodeNameEnum == LOCALCLASSPATH || pNodeNameEnum == LOCALINSTANCEPATH) { - if (this.iPath != null) throw new SAXException(getNodeName() - + " node can have only one LOCALINSTANCEPATH or LOCALCLASSPATH child node!"); - } else if (pNodeNameEnum != PARAMVALUE) throw new SAXException(getNodeName() - + " node cannot have " + pNodeNameEnum + " child node!"); - } - - @Override - public void testCompletness() throws SAXException { - if (this.iPath == null) throw new SAXException( - "METHODCALL node must have a LOCALINSTANCEPATH or LOCALCLASSPATH child node!"); - } - -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1686000 2007-04-20 ebak modifyInstance() missing from WBEMClient + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2682 2013-10-02 blaschke-oss (I)MethodCallNode allows no LOCAL*PATH + * 2690 2013-10-11 blaschke-oss Remove RESPONSEDESTINATION support + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.xml.sax.SAXException; + +/** + * ELEMENT METHODCALL ((LOCALINSTANCEPATH | LOCALCLASSPATH), PARAMVALUE*) + * ATTLIST METHODCALL %CIMName; + */ +public class MethodCallNode extends AbstractMethodCallNode { + + /** + * Ctor. + */ + public MethodCallNode() { + super(METHODCALL); + } + + @Override + protected void testSpecChild(String pNodeNameEnum) throws SAXException { + if (pNodeNameEnum == LOCALCLASSPATH || pNodeNameEnum == LOCALINSTANCEPATH) { + if (this.iPath != null) throw new SAXException(getNodeName() + + " node can have only one LOCALINSTANCEPATH or LOCALCLASSPATH child node!"); + } else if (pNodeNameEnum != PARAMVALUE) throw new SAXException(getNodeName() + + " node cannot have " + pNodeNameEnum + " child node!"); + } + + @Override + public void testCompletness() throws SAXException { + if (this.iPath == null) throw new SAXException( + "METHODCALL node must have a LOCALINSTANCEPATH or LOCALCLASSPATH child node!"); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/MethodNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/MethodNode.java similarity index 79% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/MethodNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/MethodNode.java index e9979f1..bb07d2d 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/MethodNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/MethodNode.java @@ -1,178 +1,175 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1660756 2007-02-22 ebak Embedded object support - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 1848607 2007-12-11 ebak Strict EmbeddedObject types - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors - * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics - * 3602604 2013-01-29 blaschke-oss Clean up SAXException messages - * 2703 2013-11-08 blaschke-oss MethodNode should not require TYPE attribute - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.ArrayList; - -import org.sentrysoftware.wbem.javax.cim.CIMDataType; -import org.sentrysoftware.wbem.javax.cim.CIMMethod; -import org.sentrysoftware.wbem.javax.cim.CIMParameter; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.EmbObjHandler; -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - *
      - * 
      - * ELEMENT METHOD (QUALIFIER*, (PARAMETER | PARAMETER.REFERENCE | PARAMETER.ARRAY | PARAMETER.REFARRAY)*)
      - * ATTLIST METHOD
      - *   %CIMName;
      - *   %CIMType;              #IMPLIED
      - *   %ClassOrigin;
      - *   %Propagated;>
      - * 
      - */ -public class MethodNode extends Node { - - private String iName; - - private CIMDataType iType; - - private String iClassOrigin; - - private boolean iPropagated; - - private QualifiedNodeHandler iQualiHandler; - - private EmbObjHandler iEmbObjHandler; - - private SAXSession iSession; - - /** - * PARAMETER.XXX*, AbstractParameterNode* - */ - private ArrayList> iCIMParamAL; - - /** - * Ctor. - */ - public MethodNode() { - super(METHOD); - } - - @Override - public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { - this.iSession = pSession; - this.iQualiHandler = QualifiedNodeHandler.init(this.iQualiHandler); - this.iEmbObjHandler = EmbObjHandler.init(this.iEmbObjHandler, getNodeName(), pAttribs, - this.iSession, this.iQualiHandler, true); - - if (this.iCIMParamAL != null) this.iCIMParamAL.clear(); - - this.iName = getCIMName(pAttribs); - - this.iType = getCIMType(pAttribs, true); - if (this.iType != null && this.iType.isArray()) throw new SAXException( - "METHOD node's TYPE cannot be an array!"); - this.iClassOrigin = getClassOrigin(pAttribs); - this.iPropagated = getPropagated(pAttribs); - } - - /** - * @param pData - */ - @Override - public void parseData(String pData) { - // no data - } - - private static final String[] ALLOWED_CHILDREN = { QUALIFIER, PARAMETER, PARAMETER_REFERENCE, - PARAMETER_ARRAY, PARAMETER_REFARRAY }; - - @Override - public void testChild(String pNodeNameEnum) throws SAXException { - for (int i = 0; i < ALLOWED_CHILDREN.length; i++) - if (pNodeNameEnum.equalsIgnoreCase(ALLOWED_CHILDREN[i])) return; - throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum - + " child node!"); - } - - @Override - public void childParsed(Node pChild) { - if (this.iQualiHandler.addQualifierNode(pChild)) return; - if (this.iCIMParamAL == null) this.iCIMParamAL = new ArrayList>(); - this.iCIMParamAL.add(((AbstractParameterNode) pChild).getCIMParameter()); - } - - @Override - public void testCompletness() throws SAXException { - this.iType = this.iEmbObjHandler.getType(); - if (this.iType != null && this.iType.isArray()) throw new SAXException( - "METHOD node's TYPE attribute cannot be an array!"); - } - - /** - * getCIMMethod - * - * @return CIMMethod - */ - public CIMMethod getCIMMethod() { - /* - * CIMMethod( String name, CIMDataType type, CIMQualifier[] qualifiers, - * CIMParameter[] parameters, boolean propagated, String originClass ); - * - * EmbeddedObject qualifier mustn't be removed. Return type cannot be - * changed. - * - * The situation changed by the introduction of the strict embedded - * object type parsing. - */ - return new CIMMethod(this.iName, this.iType, this.iQualiHandler - .getQualis(!this.iSession.strictEmbObjParsing()), this.iCIMParamAL == null ? null - : (CIMParameter[]) this.iCIMParamAL.toArray(EMPTY_PA), this.iPropagated, - this.iClassOrigin); - } - - private static final CIMParameter[] EMPTY_PA = new CIMParameter[0]; - -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1660756 2007-02-22 ebak Embedded object support + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 1848607 2007-12-11 ebak Strict EmbeddedObject types + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors + * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics + * 3602604 2013-01-29 blaschke-oss Clean up SAXException messages + * 2703 2013-11-08 blaschke-oss MethodNode should not require TYPE attribute + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.ArrayList; + +import org.metricshub.wbem.javax.cim.CIMDataType; +import org.metricshub.wbem.javax.cim.CIMMethod; +import org.metricshub.wbem.javax.cim.CIMParameter; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.EmbObjHandler; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + *
      + * 
      + * ELEMENT METHOD (QUALIFIER*, (PARAMETER | PARAMETER.REFERENCE | PARAMETER.ARRAY | PARAMETER.REFARRAY)*)
      + * ATTLIST METHOD
      + *   %CIMName;
      + *   %CIMType;              #IMPLIED
      + *   %ClassOrigin;
      + *   %Propagated;>
      + * 
      + */ +public class MethodNode extends Node { + + private String iName; + + private CIMDataType iType; + + private String iClassOrigin; + + private boolean iPropagated; + + private QualifiedNodeHandler iQualiHandler; + + private EmbObjHandler iEmbObjHandler; + + private SAXSession iSession; + + /** + * PARAMETER.XXX*, AbstractParameterNode* + */ + private ArrayList> iCIMParamAL; + + /** + * Ctor. + */ + public MethodNode() { + super(METHOD); + } + + @Override + public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { + this.iSession = pSession; + this.iQualiHandler = QualifiedNodeHandler.init(this.iQualiHandler); + this.iEmbObjHandler = EmbObjHandler.init(this.iEmbObjHandler, getNodeName(), pAttribs, + this.iSession, this.iQualiHandler, true); + + if (this.iCIMParamAL != null) this.iCIMParamAL.clear(); + + this.iName = getCIMName(pAttribs); + + this.iType = getCIMType(pAttribs, true); + if (this.iType != null && this.iType.isArray()) throw new SAXException( + "METHOD node's TYPE cannot be an array!"); + this.iClassOrigin = getClassOrigin(pAttribs); + this.iPropagated = getPropagated(pAttribs); + } + + /** + * @param pData + */ + @Override + public void parseData(String pData) { + // no data + } + + private static final String[] ALLOWED_CHILDREN = { QUALIFIER, PARAMETER, PARAMETER_REFERENCE, + PARAMETER_ARRAY, PARAMETER_REFARRAY }; + + @Override + public void testChild(String pNodeNameEnum) throws SAXException { + for (int i = 0; i < ALLOWED_CHILDREN.length; i++) + if (pNodeNameEnum.equalsIgnoreCase(ALLOWED_CHILDREN[i])) return; + throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum + + " child node!"); + } + + @Override + public void childParsed(Node pChild) { + if (this.iQualiHandler.addQualifierNode(pChild)) return; + if (this.iCIMParamAL == null) this.iCIMParamAL = new ArrayList>(); + this.iCIMParamAL.add(((AbstractParameterNode) pChild).getCIMParameter()); + } + + @Override + public void testCompletness() throws SAXException { + this.iType = this.iEmbObjHandler.getType(); + if (this.iType != null && this.iType.isArray()) throw new SAXException( + "METHOD node's TYPE attribute cannot be an array!"); + } + + /** + * getCIMMethod + * + * @return CIMMethod + */ + public CIMMethod getCIMMethod() { + /* + * CIMMethod( String name, CIMDataType type, CIMQualifier[] qualifiers, + * CIMParameter[] parameters, boolean propagated, String originClass ); + * + * EmbeddedObject qualifier mustn't be removed. Return type cannot be + * changed. + * + * The situation changed by the introduction of the strict embedded + * object type parsing. + */ + return new CIMMethod(this.iName, this.iType, this.iQualiHandler + .getQualis(!this.iSession.strictEmbObjParsing()), this.iCIMParamAL == null ? null + : (CIMParameter[]) this.iCIMParamAL.toArray(EMPTY_PA), this.iPropagated, + this.iClassOrigin); + } + + private static final CIMParameter[] EMPTY_PA = new CIMParameter[0]; + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/MethodResponseNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/MethodResponseNode.java similarity index 82% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/MethodResponseNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/MethodResponseNode.java index b3736b9..b74a306 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/MethodResponseNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/MethodResponseNode.java @@ -1,200 +1,197 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1660756 2007-02-22 ebak Embedded object support - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors - * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics - * 2845211 2009-08-27 raman_arora Pull Enumeration Feature (SAX Parser) - * 3511454 2012-03-27 blaschke-oss SAX nodes not reinitialized properly - * 2697 2012-10-30 blaschke-oss (I)MethodResponseNode allows ERROR with PARAMVALUE - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.ArrayList; - -import org.sentrysoftware.wbem.javax.cim.CIMArgument; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.CIMError; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - *
      - * ELEMENT METHODRESPONSE (ERROR|(RETURNVALUE?,PARAMVALUE*))
      - * ATTLIST METHODRESPONSE
      - *   %CIMName;
      - * 
      - */ -public class MethodResponseNode extends Node implements ErrorIf, RetValPipeIf, NonVolatileIf { - - private String iName; - - private CIMError iError; - - private Object iRetVal; - - private ArrayList> iCIMArgAL; - - private boolean iHasError; - - private boolean iHasRetVal; - - /** - * Ctor. - */ - public MethodResponseNode() { - super(METHODRESPONSE); - } - - /** - * @param pChild - */ - public void addChild(Node pChild) { - // nothing to do - } - - /** - * @param pSession - */ - @Override - public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { - this.iName = getCIMName(pAttribs); - this.iError = null; - this.iRetVal = null; - if (this.iCIMArgAL != null) this.iCIMArgAL.clear(); - this.iHasError = false; - this.iHasRetVal = false; - } - - /** - * @param pData - */ - @Override - public void parseData(String pData) { - // no data - } - - @Override - public void testChild(String pNodeNameEnum) throws SAXException { - if (pNodeNameEnum == ERROR) { - String ownedNodeName; - if (this.iHasRetVal) ownedNodeName = RETURNVALUE; - else if (this.iHasError) ownedNodeName = ERROR; - else if (this.iCIMArgAL != null && this.iCIMArgAL.size() > 0) ownedNodeName = PARAMVALUE; - else ownedNodeName = null; - if (ownedNodeName != null) throw new SAXException(pNodeNameEnum - + " child node is invalid for " + getNodeName() - + " node, since it already has a " + ownedNodeName + " child node!"); - } else if (pNodeNameEnum == RETURNVALUE) { - String ownedNodeName; - if (this.iHasRetVal) ownedNodeName = RETURNVALUE; - else if (this.iHasError) ownedNodeName = ERROR; - else ownedNodeName = null; - if (ownedNodeName != null) throw new SAXException(pNodeNameEnum - + " child node is invalid for " + getNodeName() - + " node, since it already has a " + ownedNodeName + " child node!"); - } else if (pNodeNameEnum == PARAMVALUE) { - if (this.iHasError) throw new SAXException(pNodeNameEnum - + " child node is invalid for " + getNodeName() - + " node, since it already has an ERROR child node!"); - } else throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum - + " child node!"); - } - - @Override - public void childParsed(Node pChild) { - if (pChild instanceof ErrorNode) { - this.iHasError = true; - this.iError = ((ErrorNode) pChild).getCIMError(); - } else if (pChild instanceof ReturnValueNode) { - this.iHasRetVal = true; - this.iRetVal = ((ReturnValueNode) pChild).getValue(); - } else if (pChild instanceof ParamValueNode) { - if (this.iCIMArgAL == null) this.iCIMArgAL = new ArrayList>(); - this.iCIMArgAL.add(((ParamValueNode) pChild).getCIMArgument()); - } - } - - @Override - public void testCompletness() { - // no mandatory child - } - - public CIMError getCIMError() { - return this.iError; - } - - private static final CIMArgument[] EMPTY_ARG_A = new CIMArgument[0]; - - /** - * getCIMArguments : returns the array of parsed parameters and their values - * : String name, CIMDataType type, Object value - * - * @return CIMArgument<?>[] - */ - public CIMArgument[] getCIMArguments() { - if (this.iCIMArgAL == null || this.iCIMArgAL.size() == 0) return null; - return this.iCIMArgAL.toArray(EMPTY_ARG_A); - } - - public int getReturnValueCount() { - return this.iRetVal == null ? 0 : 1; - } - - public Object readReturnValue() { - Object val = this.iRetVal; - this.iRetVal = null; - return val; - } - - /** - * getName - * - * @return String - */ - public String getName() { - return this.iName; - } - -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1660756 2007-02-22 ebak Embedded object support + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors + * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics + * 2845211 2009-08-27 raman_arora Pull Enumeration Feature (SAX Parser) + * 3511454 2012-03-27 blaschke-oss SAX nodes not reinitialized properly + * 2697 2012-10-30 blaschke-oss (I)MethodResponseNode allows ERROR with PARAMVALUE + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.ArrayList; + +import org.metricshub.wbem.javax.cim.CIMArgument; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; +import org.metricshub.wbem.sblim.cimclient.internal.wbem.CIMError; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + *
      + * ELEMENT METHODRESPONSE (ERROR|(RETURNVALUE?,PARAMVALUE*))
      + * ATTLIST METHODRESPONSE
      + *   %CIMName;
      + * 
      + */ +public class MethodResponseNode extends Node implements ErrorIf, RetValPipeIf, NonVolatileIf { + + private String iName; + + private CIMError iError; + + private Object iRetVal; + + private ArrayList> iCIMArgAL; + + private boolean iHasError; + + private boolean iHasRetVal; + + /** + * Ctor. + */ + public MethodResponseNode() { + super(METHODRESPONSE); + } + + /** + * @param pChild + */ + public void addChild(Node pChild) { + // nothing to do + } + + /** + * @param pSession + */ + @Override + public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { + this.iName = getCIMName(pAttribs); + this.iError = null; + this.iRetVal = null; + if (this.iCIMArgAL != null) this.iCIMArgAL.clear(); + this.iHasError = false; + this.iHasRetVal = false; + } + + /** + * @param pData + */ + @Override + public void parseData(String pData) { + // no data + } + + @Override + public void testChild(String pNodeNameEnum) throws SAXException { + if (pNodeNameEnum == ERROR) { + String ownedNodeName; + if (this.iHasRetVal) ownedNodeName = RETURNVALUE; + else if (this.iHasError) ownedNodeName = ERROR; + else if (this.iCIMArgAL != null && this.iCIMArgAL.size() > 0) ownedNodeName = PARAMVALUE; + else ownedNodeName = null; + if (ownedNodeName != null) throw new SAXException(pNodeNameEnum + + " child node is invalid for " + getNodeName() + + " node, since it already has a " + ownedNodeName + " child node!"); + } else if (pNodeNameEnum == RETURNVALUE) { + String ownedNodeName; + if (this.iHasRetVal) ownedNodeName = RETURNVALUE; + else if (this.iHasError) ownedNodeName = ERROR; + else ownedNodeName = null; + if (ownedNodeName != null) throw new SAXException(pNodeNameEnum + + " child node is invalid for " + getNodeName() + + " node, since it already has a " + ownedNodeName + " child node!"); + } else if (pNodeNameEnum == PARAMVALUE) { + if (this.iHasError) throw new SAXException(pNodeNameEnum + + " child node is invalid for " + getNodeName() + + " node, since it already has an ERROR child node!"); + } else throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum + + " child node!"); + } + + @Override + public void childParsed(Node pChild) { + if (pChild instanceof ErrorNode) { + this.iHasError = true; + this.iError = ((ErrorNode) pChild).getCIMError(); + } else if (pChild instanceof ReturnValueNode) { + this.iHasRetVal = true; + this.iRetVal = ((ReturnValueNode) pChild).getValue(); + } else if (pChild instanceof ParamValueNode) { + if (this.iCIMArgAL == null) this.iCIMArgAL = new ArrayList>(); + this.iCIMArgAL.add(((ParamValueNode) pChild).getCIMArgument()); + } + } + + @Override + public void testCompletness() { + // no mandatory child + } + + public CIMError getCIMError() { + return this.iError; + } + + private static final CIMArgument[] EMPTY_ARG_A = new CIMArgument[0]; + + /** + * getCIMArguments : returns the array of parsed parameters and their values + * : String name, CIMDataType type, Object value + * + * @return CIMArgument<?>[] + */ + public CIMArgument[] getCIMArguments() { + if (this.iCIMArgAL == null || this.iCIMArgAL.size() == 0) return null; + return this.iCIMArgAL.toArray(EMPTY_ARG_A); + } + + public int getReturnValueCount() { + return this.iRetVal == null ? 0 : 1; + } + + public Object readReturnValue() { + Object val = this.iRetVal; + this.iRetVal = null; + return val; + } + + /** + * getName + * + * @return String + */ + public String getName() { + return this.iName; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/MultiExpReqNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/MultiExpReqNode.java similarity index 74% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/MultiExpReqNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/MultiExpReqNode.java index 2578cdd..c9087f9 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/MultiExpReqNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/MultiExpReqNode.java @@ -1,105 +1,103 @@ -/* - (C) Copyright IBM Corp. 2006, 2012 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1660756 2007-02-22 ebak Embedded object support - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 3511454 2012-03-27 blaschke-oss SAX nodes not reinitialized properly - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.ArrayList; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - * ELEMENT MULTIEXPREQ (SIMPLEEXPREQ, SIMPLEEXPREQ+) - */ -public class MultiExpReqNode extends AbstractMessageNode { - - private ArrayList iSimpleExpReqAList; - - /** - * Ctor. - */ - public MultiExpReqNode() { - super(MULTIEXPREQ); - } - - public void addChild(Node pChild) { - if (this.iSimpleExpReqAList == null) this.iSimpleExpReqAList = new ArrayList(); - this.iSimpleExpReqAList.add(pChild); - } - - /** - * @param pAttribs - * @param pSession - */ - @Override - public void init(Attributes pAttribs, SAXSession pSession) { - if (this.iSimpleExpReqAList != null) this.iSimpleExpReqAList.clear(); - // no attributes - } - - /** - * @param pData - */ - @Override - public void parseData(String pData) { - // no data - } - - @Override - public void testChild(String pNodeNameEnum) throws SAXException { - if (pNodeNameEnum != SIMPLEEXPREQ) throw new SAXException( - "MULTIEXPREQ node can have SIMPLEEXPREQ child nodes only! " + pNodeNameEnum - + " child node is invalid!"); - } - - @Override - public void testCompletness() throws SAXException { - if (this.iSimpleExpReqAList == null || this.iSimpleExpReqAList.size() < 2) throw new SAXException( - "MULTIEXPREQ node must have at least two SIMPLEEXPREQ child nodes!"); - } - -} +/* + (C) Copyright IBM Corp. 2006, 2012 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1660756 2007-02-22 ebak Embedded object support + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 3511454 2012-03-27 blaschke-oss SAX nodes not reinitialized properly + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.ArrayList; + +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + * ELEMENT MULTIEXPREQ (SIMPLEEXPREQ, SIMPLEEXPREQ+) + */ +public class MultiExpReqNode extends AbstractMessageNode { + + private ArrayList iSimpleExpReqAList; + + /** + * Ctor. + */ + public MultiExpReqNode() { + super(MULTIEXPREQ); + } + + public void addChild(Node pChild) { + if (this.iSimpleExpReqAList == null) this.iSimpleExpReqAList = new ArrayList(); + this.iSimpleExpReqAList.add(pChild); + } + + /** + * @param pAttribs + * @param pSession + */ + @Override + public void init(Attributes pAttribs, SAXSession pSession) { + if (this.iSimpleExpReqAList != null) this.iSimpleExpReqAList.clear(); + // no attributes + } + + /** + * @param pData + */ + @Override + public void parseData(String pData) { + // no data + } + + @Override + public void testChild(String pNodeNameEnum) throws SAXException { + if (pNodeNameEnum != SIMPLEEXPREQ) throw new SAXException( + "MULTIEXPREQ node can have SIMPLEEXPREQ child nodes only! " + pNodeNameEnum + + " child node is invalid!"); + } + + @Override + public void testCompletness() throws SAXException { + if (this.iSimpleExpReqAList == null || this.iSimpleExpReqAList.size() < 2) throw new SAXException( + "MULTIEXPREQ node must have at least two SIMPLEEXPREQ child nodes!"); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/MultiExpRspNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/MultiExpRspNode.java similarity index 74% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/MultiExpRspNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/MultiExpRspNode.java index 662481c..8a08d4e 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/MultiExpRspNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/MultiExpRspNode.java @@ -1,106 +1,104 @@ -/* - (C) Copyright IBM Corp. 2006, 2012 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1660756 2007-02-22 ebak Embedded object support - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors - * 3511454 2012-03-27 blaschke-oss SAX nodes not reinitialized properly - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.ArrayList; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - * ELEMENT MULTIEXPRSP (SIMPLEEXPRSP, SIMPLEEXPRSP+) - */ -public class MultiExpRspNode extends AbstractMessageNode { - - private ArrayList iSimpleExpRspAList; - - /** - * Ctor. - */ - public MultiExpRspNode() { - super(MULTIEXPRSP); - } - - public void addChild(Node pChild) { - if (this.iSimpleExpRspAList == null) this.iSimpleExpRspAList = new ArrayList(); - this.iSimpleExpRspAList.add(pChild); - } - - /** - * @param pAttribs - * @param pSession - */ - @Override - public void init(Attributes pAttribs, SAXSession pSession) { - if (this.iSimpleExpRspAList != null) this.iSimpleExpRspAList.clear(); - // no attributes - } - - /** - * @param pData - */ - @Override - public void parseData(String pData) { - // no data - } - - @Override - public void testChild(String pNodeNameEnum) throws SAXException { - if (pNodeNameEnum != SIMPLEEXPRSP) throw new SAXException(getNodeName() - + " node can have SIMPLEEXPRSP child node only! " + pNodeNameEnum - + " child node is invalid!"); - } - - @Override - public void testCompletness() throws SAXException { - if (this.iSimpleExpRspAList == null || this.iSimpleExpRspAList.size() < 2) throw new SAXException( - getNodeName() + " node must have at least two SIMPLEEXPRSP child nodes!"); - } - -} +/* + (C) Copyright IBM Corp. 2006, 2012 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1660756 2007-02-22 ebak Embedded object support + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors + * 3511454 2012-03-27 blaschke-oss SAX nodes not reinitialized properly + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.ArrayList; + +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + * ELEMENT MULTIEXPRSP (SIMPLEEXPRSP, SIMPLEEXPRSP+) + */ +public class MultiExpRspNode extends AbstractMessageNode { + + private ArrayList iSimpleExpRspAList; + + /** + * Ctor. + */ + public MultiExpRspNode() { + super(MULTIEXPRSP); + } + + public void addChild(Node pChild) { + if (this.iSimpleExpRspAList == null) this.iSimpleExpRspAList = new ArrayList(); + this.iSimpleExpRspAList.add(pChild); + } + + /** + * @param pAttribs + * @param pSession + */ + @Override + public void init(Attributes pAttribs, SAXSession pSession) { + if (this.iSimpleExpRspAList != null) this.iSimpleExpRspAList.clear(); + // no attributes + } + + /** + * @param pData + */ + @Override + public void parseData(String pData) { + // no data + } + + @Override + public void testChild(String pNodeNameEnum) throws SAXException { + if (pNodeNameEnum != SIMPLEEXPRSP) throw new SAXException(getNodeName() + + " node can have SIMPLEEXPRSP child node only! " + pNodeNameEnum + + " child node is invalid!"); + } + + @Override + public void testCompletness() throws SAXException { + if (this.iSimpleExpRspAList == null || this.iSimpleExpRspAList.size() < 2) throw new SAXException( + getNodeName() + " node must have at least two SIMPLEEXPRSP child nodes!"); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/MultiReqNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/MultiReqNode.java similarity index 74% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/MultiReqNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/MultiReqNode.java index 903bcd2..960d1c6 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/MultiReqNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/MultiReqNode.java @@ -1,114 +1,112 @@ -/* - (C) Copyright IBM Corp. 2006, 2012 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1660756 2007-02-22 ebak Embedded object support - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 3511454 2012-03-27 blaschke-oss SAX nodes not reinitialized properly - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.ArrayList; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - * ELEMENT MULTIREQ (SIMPLEREQ, SIMPLEREQ+) - */ -public class MultiReqNode extends AbstractMessageNode { - - private ArrayList iSimpleReqAList; - - /** - * Ctor. - */ - public MultiReqNode() { - super(MULTIREQ); - } - - public void addChild(Node pChild) { - if (this.iSimpleReqAList == null) this.iSimpleReqAList = new ArrayList(); - this.iSimpleReqAList.add(pChild); - } - - /** - * @param pAttribs - * @param pSession - */ - @Override - public void init(Attributes pAttribs, SAXSession pSession) { - if (this.iSimpleReqAList != null) this.iSimpleReqAList.clear(); - // no attributes - } - - /** - * @param pData - */ - @Override - public void parseData(String pData) { - // no data - } - - @Override - public void testChild(String pNodeNameEnum) throws SAXException { - if (pNodeNameEnum != SIMPLEREQ) throw new SAXException( - "MULTIREQ node can have SIMPLEREQ child nodes only! " + pNodeNameEnum - + " child node is invalid!"); - } - - @Override - public void testCompletness() throws SAXException { - if (this.iSimpleReqAList == null || this.iSimpleReqAList.size() < 2) throw new SAXException( - "MULTIREQ node must have at least 2 SIMPLEREQ child nodes!"); - } - - /** - * size - * - * @return int - */ - public int size() { - return this.iSimpleReqAList == null ? 0 : this.iSimpleReqAList.size(); - } - -} +/* + (C) Copyright IBM Corp. 2006, 2012 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1660756 2007-02-22 ebak Embedded object support + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 3511454 2012-03-27 blaschke-oss SAX nodes not reinitialized properly + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.ArrayList; + +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + * ELEMENT MULTIREQ (SIMPLEREQ, SIMPLEREQ+) + */ +public class MultiReqNode extends AbstractMessageNode { + + private ArrayList iSimpleReqAList; + + /** + * Ctor. + */ + public MultiReqNode() { + super(MULTIREQ); + } + + public void addChild(Node pChild) { + if (this.iSimpleReqAList == null) this.iSimpleReqAList = new ArrayList(); + this.iSimpleReqAList.add(pChild); + } + + /** + * @param pAttribs + * @param pSession + */ + @Override + public void init(Attributes pAttribs, SAXSession pSession) { + if (this.iSimpleReqAList != null) this.iSimpleReqAList.clear(); + // no attributes + } + + /** + * @param pData + */ + @Override + public void parseData(String pData) { + // no data + } + + @Override + public void testChild(String pNodeNameEnum) throws SAXException { + if (pNodeNameEnum != SIMPLEREQ) throw new SAXException( + "MULTIREQ node can have SIMPLEREQ child nodes only! " + pNodeNameEnum + + " child node is invalid!"); + } + + @Override + public void testCompletness() throws SAXException { + if (this.iSimpleReqAList == null || this.iSimpleReqAList.size() < 2) throw new SAXException( + "MULTIREQ node must have at least 2 SIMPLEREQ child nodes!"); + } + + /** + * size + * + * @return int + */ + public int size() { + return this.iSimpleReqAList == null ? 0 : this.iSimpleReqAList.size(); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/MultiRspNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/MultiRspNode.java similarity index 73% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/MultiRspNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/MultiRspNode.java index 1ca4564..441a2a6 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/MultiRspNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/MultiRspNode.java @@ -1,105 +1,103 @@ -/* - (C) Copyright IBM Corp. 2006, 2012 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1660756 2007-02-22 ebak Embedded object support - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 3511454 2012-03-27 blaschke-oss SAX nodes not reinitialized properly - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.ArrayList; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - * ELEMENT MULTIRSP (SIMPLERSP, SIMPLERSP+) - */ -public class MultiRspNode extends AbstractMessageNode { - - private ArrayList iSimpleRspAList; - - /** - * Ctor. - */ - public MultiRspNode() { - super(MULTIRSP); - } - - public void addChild(Node pChild) { - if (this.iSimpleRspAList == null) this.iSimpleRspAList = new ArrayList(); - this.iSimpleRspAList.add(pChild); - } - - /** - * @param pAttribs - * @param pSession - */ - @Override - public void init(Attributes pAttribs, SAXSession pSession) { - if (this.iSimpleRspAList != null) this.iSimpleRspAList.clear(); - // no attribs - } - - /** - * @param pData - */ - @Override - public void parseData(String pData) { - // no data - - } - - @Override - public void testChild(String pNodeNameEnum) throws SAXException { - if (pNodeNameEnum != SIMPLERSP) throw new SAXException(getNodeName() + " node cannot have " - + pNodeNameEnum + " child node!"); - } - - @Override - public void testCompletness() throws SAXException { - if (this.iSimpleRspAList == null || this.iSimpleRspAList.size() < 2) throw new SAXException( - getNodeName() + " node must have at least two SIMPLERSP child nodes!"); - } - -} +/* + (C) Copyright IBM Corp. 2006, 2012 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1660756 2007-02-22 ebak Embedded object support + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 3511454 2012-03-27 blaschke-oss SAX nodes not reinitialized properly + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.ArrayList; + +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + * ELEMENT MULTIRSP (SIMPLERSP, SIMPLERSP+) + */ +public class MultiRspNode extends AbstractMessageNode { + + private ArrayList iSimpleRspAList; + + /** + * Ctor. + */ + public MultiRspNode() { + super(MULTIRSP); + } + + public void addChild(Node pChild) { + if (this.iSimpleRspAList == null) this.iSimpleRspAList = new ArrayList(); + this.iSimpleRspAList.add(pChild); + } + + /** + * @param pAttribs + * @param pSession + */ + @Override + public void init(Attributes pAttribs, SAXSession pSession) { + if (this.iSimpleRspAList != null) this.iSimpleRspAList.clear(); + // no attribs + } + + /** + * @param pData + */ + @Override + public void parseData(String pData) { + // no data + + } + + @Override + public void testChild(String pNodeNameEnum) throws SAXException { + if (pNodeNameEnum != SIMPLERSP) throw new SAXException(getNodeName() + " node cannot have " + + pNodeNameEnum + " child node!"); + } + + @Override + public void testCompletness() throws SAXException { + if (this.iSimpleRspAList == null || this.iSimpleRspAList.size() < 2) throw new SAXException( + getNodeName() + " node must have at least two SIMPLERSP child nodes!"); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/NameSpaceNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/NameSpaceNode.java similarity index 71% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/NameSpaceNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/NameSpaceNode.java index 31c707a..2289772 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/NameSpaceNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/NameSpaceNode.java @@ -1,114 +1,112 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1660756 2007-02-22 ebak Embedded object support - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2604 2013-07-01 blaschke-oss SAXException messages should contain node name - * 2673 2013-09-26 blaschke-oss NameSpaceNode does not need testCompletness() - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - * ELEMENT NAMESPACE EMPTY ATTRLIST NAMESPACE %CIMName; - * - */ -public class NameSpaceNode extends Node { - - private String iNameSpaceValue; - - /** - * Ctor. - */ - public NameSpaceNode() { - super(NAMESPACE); - } - - /** - * @param pSession - */ - @Override - public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { - this.iNameSpaceValue = getCIMName(pAttribs); - } - - /** - * @param pData - */ - @Override - public void parseData(String pData) { - // no data - } - - /** - * @param pNodeNameEnum - */ - @Override - public void testChild(String pNodeNameEnum) throws SAXException { - throw new SAXException("NAMESPACE node cannot have any child node!"); - } - - /** - * @param pChild - */ - @Override - public void childParsed(Node pChild) { - // no child - } - - @Override - public void testCompletness() { - // no child - } - - /** - * getNameSpace - * - * @return String - */ - public String getNameSpace() { - return this.iNameSpaceValue; - } - -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1660756 2007-02-22 ebak Embedded object support + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2604 2013-07-01 blaschke-oss SAXException messages should contain node name + * 2673 2013-09-26 blaschke-oss NameSpaceNode does not need testCompletness() + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + * ELEMENT NAMESPACE EMPTY ATTRLIST NAMESPACE %CIMName; + * + */ +public class NameSpaceNode extends Node { + + private String iNameSpaceValue; + + /** + * Ctor. + */ + public NameSpaceNode() { + super(NAMESPACE); + } + + /** + * @param pSession + */ + @Override + public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { + this.iNameSpaceValue = getCIMName(pAttribs); + } + + /** + * @param pData + */ + @Override + public void parseData(String pData) { + // no data + } + + /** + * @param pNodeNameEnum + */ + @Override + public void testChild(String pNodeNameEnum) throws SAXException { + throw new SAXException("NAMESPACE node cannot have any child node!"); + } + + /** + * @param pChild + */ + @Override + public void childParsed(Node pChild) { + // no child + } + + @Override + public void testCompletness() { + // no child + } + + /** + * getNameSpace + * + * @return String + */ + public String getNameSpace() { + return this.iNameSpaceValue; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/NameSpacePathNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/NameSpacePathNode.java similarity index 78% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/NameSpacePathNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/NameSpacePathNode.java index 9900892..344e5d9 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/NameSpacePathNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/NameSpacePathNode.java @@ -1,144 +1,142 @@ -/* - (C) Copyright IBM Corp. 2006, 2012 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1660756 2007-02-22 ebak Embedded object support - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 1742873 2007-06-25 ebak IPv6 ready cim-client - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 3511454 2012-03-27 blaschke-oss SAX nodes not reinitialized properly - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - * ELEMENT NAMESPACEPATH (HOST, LOCALNAMESPACEPATH) - */ -public class NameSpacePathNode extends Node { - - // HOST - private boolean iHasHost; - - private String iHostStr; - - // LOCALNAMESPACEPATH - private boolean iHasLocalNameSpacePath; - - private String iLocalNameSpacePathStr; - - /** - * Ctor. - */ - public NameSpacePathNode() { - super(NAMESPACEPATH); - } - - /** - * @param pAttribs - * @param pSession - */ - @Override - public void init(Attributes pAttribs, SAXSession pSession) { - this.iHasHost = this.iHasLocalNameSpacePath = false; - this.iHostStr = this.iLocalNameSpacePathStr = null; - // no attributes - } - - /** - * @param pData - */ - @Override - public void parseData(String pData) { - // no data - } - - @Override - public void testChild(String pNodeNameEnum) throws SAXException { - if (pNodeNameEnum == HOST) { - if (this.iHasHost) throw new SAXException(getNodeName() - + " node can have only one HOST child node!"); - } else if (pNodeNameEnum == LOCALNAMESPACEPATH) { - if (this.iHasLocalNameSpacePath) throw new SAXException(getNodeName() - + " node can have only one LOCALNAMESPACEPATH child node!"); - } else throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum - + " child node!"); - } - - @Override - public void childParsed(Node pChild) { - if (pChild instanceof HostNode) { - this.iHasHost = true; - this.iHostStr = ((HostNode) pChild).getHostStr(); - } else { - this.iHasLocalNameSpacePath = true; - this.iLocalNameSpacePathStr = ((LocalNameSpacePathNode) pChild).getNameSpace(); - } - } - - @Override - public void testCompletness() throws SAXException { - if (!this.iHasHost) throw new SAXException("HOST child node is mandatory for " - + getNodeName() + " node!"); - if (!this.iHasLocalNameSpacePath) throw new SAXException( - "LOCALNAMESPACEPATH child node is mandatory for " + getNodeName() + " node!"); - } - - /** - * getHostStr - * - * @return String which may contain the protocol, host and port - */ - public String getHostStr() { - return this.iHostStr; - } - - /** - * getLocalNameSpacePath - * - * @return String - */ - public String getLocalNameSpacePath() { - return this.iLocalNameSpacePathStr; - } - -} +/* + (C) Copyright IBM Corp. 2006, 2012 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1660756 2007-02-22 ebak Embedded object support + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 1742873 2007-06-25 ebak IPv6 ready cim-client + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 3511454 2012-03-27 blaschke-oss SAX nodes not reinitialized properly + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + * ELEMENT NAMESPACEPATH (HOST, LOCALNAMESPACEPATH) + */ +public class NameSpacePathNode extends Node { + + // HOST + private boolean iHasHost; + + private String iHostStr; + + // LOCALNAMESPACEPATH + private boolean iHasLocalNameSpacePath; + + private String iLocalNameSpacePathStr; + + /** + * Ctor. + */ + public NameSpacePathNode() { + super(NAMESPACEPATH); + } + + /** + * @param pAttribs + * @param pSession + */ + @Override + public void init(Attributes pAttribs, SAXSession pSession) { + this.iHasHost = this.iHasLocalNameSpacePath = false; + this.iHostStr = this.iLocalNameSpacePathStr = null; + // no attributes + } + + /** + * @param pData + */ + @Override + public void parseData(String pData) { + // no data + } + + @Override + public void testChild(String pNodeNameEnum) throws SAXException { + if (pNodeNameEnum == HOST) { + if (this.iHasHost) throw new SAXException(getNodeName() + + " node can have only one HOST child node!"); + } else if (pNodeNameEnum == LOCALNAMESPACEPATH) { + if (this.iHasLocalNameSpacePath) throw new SAXException(getNodeName() + + " node can have only one LOCALNAMESPACEPATH child node!"); + } else throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum + + " child node!"); + } + + @Override + public void childParsed(Node pChild) { + if (pChild instanceof HostNode) { + this.iHasHost = true; + this.iHostStr = ((HostNode) pChild).getHostStr(); + } else { + this.iHasLocalNameSpacePath = true; + this.iLocalNameSpacePathStr = ((LocalNameSpacePathNode) pChild).getNameSpace(); + } + } + + @Override + public void testCompletness() throws SAXException { + if (!this.iHasHost) throw new SAXException("HOST child node is mandatory for " + + getNodeName() + " node!"); + if (!this.iHasLocalNameSpacePath) throw new SAXException( + "LOCALNAMESPACEPATH child node is mandatory for " + getNodeName() + " node!"); + } + + /** + * getHostStr + * + * @return String which may contain the protocol, host and port + */ + public String getHostStr() { + return this.iHostStr; + } + + /** + * getLocalNameSpacePath + * + * @return String + */ + public String getLocalNameSpacePath() { + return this.iLocalNameSpacePathStr; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/Node.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/Node.java similarity index 87% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/Node.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/Node.java index 08ecdda..c7d541a 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/Node.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/Node.java @@ -1,395 +1,392 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1660756 2007-02-22 ebak Embedded object support - * 1689085 2007-04-10 ebak Embedded object enhancements for Pegasus - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 1735614 2007-06-12 ebak Wrong ARRAYSIZE attribute handling in SAX/PULL - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2038305 2008-08-14 blaschke-oss SAXException SBLIM Java Client V2.0.7 - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 3513353 2012-03-30 blaschke-oss TCK: CIMDataType arrays must have length >= 1 - * 3602604 2013-01-29 blaschke-oss Clean up SAXException messages - * 2605 2013-03-20 buccella SAX parser throws wrong exception - * 2693 2013-10-21 blaschke-oss ReturnValueNode allows invalid PARAMTYPE attribute - * 2702 2013-11-07 blaschke-oss Bad PROPERTY.ARRAY ARRAYSIZE generates NumberFormatException - * 2706 2013-11-11 blaschke-oss Bad PARAMETER.REFARRAY ARRAYSIZE generates NumberFormatException - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMDataType; -import org.sentrysoftware.wbem.javax.cim.CIMFlavor; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cim.CIMHelper; -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.CIMObjectFactory; -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.NodeConstIf; -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.sentrysoftware.wbem.sblim.cimclient.internal.util.MOF; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - * Class Node is the abstract base class of all parseable XML elements. It - * contains helper functions for the implementations. - */ -public abstract class Node implements NodeConstIf { - - private String iNameEnum; - - private boolean iCompleted; - - /** - * Ctor. - * - * @param pNameEnum - * The name of the node which must be a String constant which is - * defined inside this class (because the implementation compares - * by reference). - */ - public Node(String pNameEnum) { - this.iNameEnum = pNameEnum; - } - - /** - * getNodeName - * - * @return The name of the node. This name have to be one of the String - * constant defined in the class. - */ - public String getNodeName() { - return this.iNameEnum; - } - - /** - * The SAX ContentHandler implementation calls this method after testChild() - * and addChild() calls. The implementation must reset it's instance unless - * it implements NonVolatileIf - * - * @param pAttribs - * @param pSession - * - stores variables which are common for the whole SAX parsing - * session - * @throws SAXException - */ - public abstract void init(Attributes pAttribs, SAXSession pSession) throws SAXException; - - /** - * XML element's data have to be passed - * - * @param pData - * - String which is concatenated in SAX's - * DefaultHandler.characters() implementation. - * @throws SAXException - */ - public abstract void parseData(String pData) throws SAXException; - - /** - * It have to be called by SAX's DefaultHandler implementation when it - * detects a new child element (startElement()). - * - * @param pNodeNameEnum - * - the name of the child element, it must be one of the String - * constant defined in class Node, because the implementer - * subclasses uses reference based equals comparisons (==) - * @throws SAXException - * - It have to be thrown when the Node cannot have - * pNodeNameEnum named child Node. - */ - public abstract void testChild(String pNodeNameEnum) throws SAXException; - - /** - * It have to be called by SAX's DefaultHandler.endElement(). It's task is - * to check that the Element is built up correctly. The implementer function - * can do some post processing here. testCompletness - * - * @throws SAXException - * It must be thrown when the Node is not valid. - */ - public abstract void testCompletness() throws SAXException; - - /** - * Have to be called by SAX's DefaultHandler.endElement() - * - * @param pChild - * @throws SAXException - * - parent Nodes can make conversions here (e.g. type string - * into CIMDataType), failed operation should throw - * SAXException) - */ - public abstract void childParsed(Node pChild) throws SAXException; - - /** - * completed - * - * @return true if the parsing of the node is completed - */ - public boolean isCompleted() { - return this.iCompleted; - } - - /** - * Have to be called by SAX's DefaultHandler at endElement(), after calling - * testCompletness(). - */ - public void setCompleted() { - this.iCompleted = true; - } - - /** - * When a Node instance is going to be reused, this function must be called - * before. - */ - public void clearCompleted() { - this.iCompleted = false; - } - - /** - * ENTITY % CIMName "NAME CDATA #REQUIRED" - * - * @param pAttribs - * @return String - * @throws SAXException - */ - public static String getCIMName(Attributes pAttribs) throws SAXException { - String name = pAttribs.getValue("NAME"); - if (name == null) throw new SAXException("NAME attribute not found!"); - return name; - } - - /** - * ENTITY % ClassName "CLASSNAME CDATA #REQUIRED" - * - * @param pAttribs - * @return String - * @throws SAXException - */ - public static String getClassName(Attributes pAttribs) throws SAXException { - String name = pAttribs.getValue("CLASSNAME"); - if (name == null) throw new SAXException("CLASSNAME attribute not found!"); - return name; - } - - /** - * ENTITY % ReferenceClass "REFERENCECLASS CDATA #IMPLIED" - * - * @param pAttribs - * @return String - */ - public static String getReferenceClass(Attributes pAttribs) { - return pAttribs.getValue("REFERENCECLASS"); - } - - /** - * ENTITY % ClassOrigin "CLASSORIGIN CDATA #IMPLIED - * - * @param pAttribs - * @return String - */ - public static String getClassOrigin(Attributes pAttribs) { - return pAttribs.getValue("CLASSORIGIN"); - } - - /** - * ENTITY % Propagated "PROPAGATED (true|false) 'false'" getPropagated - * - * @param pAttribs - * @return boolean - */ - public static boolean getPropagated(Attributes pAttribs) { - String str = pAttribs.getValue("PROPAGATED"); - return MOF.TRUE.equalsIgnoreCase(str); - } - - /** - * ENTITY % ArraySize "ARRAYSIZE CDATA #IMPLIED" - * - * @param pAttribs - * @return int - * @throws SAXException - */ - public static int getArraySize(Attributes pAttribs) throws SAXException { - String arraySizeStr = pAttribs.getValue("ARRAYSIZE"); - // 0 - unbounded size - int size = 0; - try { - size = arraySizeStr == null || arraySizeStr.length() == 0 ? 0 : Integer - .parseInt(arraySizeStr); - } catch (NumberFormatException e) { - throw new SAXException(arraySizeStr + " is not a valid ARRAYSIZE attribute!"); - } - if (size < 0) throw new SAXException("ARRAYSIZE cannot be " + size + "!"); - return size; - } - - /** - * ENTITY % CIMType "TYPE - * (boolean|string|char16|uint8|sint8|uint16|sint16|uint32 - * |sint32|uint64|sint64|datetime|real32|real64)" getCIMType - * - * @param pAttribs - * @param pOptional - * @return CIMDataType - * @throws SAXException - */ - public static CIMDataType getCIMType(Attributes pAttribs, boolean pOptional) - throws SAXException { - String typeStr = pAttribs.getValue("TYPE"); - if (typeStr == null) { - if (pOptional) return null; - throw new SAXException("TYPE attribute not found!"); - } - CIMDataType type = CIMObjectFactory.getType(typeStr); - if (type == null) throw new SAXException(typeStr + " is not a valid TYPE attribute!"); - if (type.getType() == CIMDataType.REFERENCE) throw new SAXException( - "TYPE attribute cannot be \"reference\"!"); - // Is it array? - // Yes if ISARRAY is true or ARRAYSIZE>-1. - boolean isArray = hasTrueAttribute(pAttribs, "ISARRAY"); - String arraySizeStr = pAttribs.getValue("ARRAYSIZE"); - int arraySize; - try { - arraySize = (arraySizeStr == null || arraySizeStr.length() == 0 ? (isArray ? 0 : -1) - : Integer.parseInt(arraySizeStr)); - } catch (NumberFormatException e) { - throw new SAXException(arraySizeStr + " is not a valid ARRAYSIZE attribute!"); - } - if (isArray || arraySize >= 0) { - if (arraySize > 0) return new CIMDataType(type.getType(), arraySize); - return CIMHelper.UnboundedArrayDataType(type.getType()); - } - return type; - } - - /** - * getCIMType(pAttribs, pOptional=false); - * - * @param pAttribs - * @return CIMDataType - * @throws SAXException - */ - public static CIMDataType getCIMType(Attributes pAttribs) throws SAXException { - return getCIMType(pAttribs, false); - } - - /** - * ENTITY % ParamType "PARAMTYPE ( - * boolean|string|char16|uint8|sint8|uint16|sint16 - * |uint32|sint32|uint64|sint64|datetime| real32|real64|reference) - * - * @param pAttribs - * @return CIMDataType - * @throws SAXException - */ - public static CIMDataType getParamType(Attributes pAttribs) throws SAXException { - String typeStr = pAttribs.getValue("PARAMTYPE"); - return CIMObjectFactory.getType(typeStr); - } - - /** - *
      -	 * ENTITY % QualifierFlavor "
      -	 * OVERRIDABLE    (true|false)  'true'
      -	 * TOSUBCLASS     (true|false)  'true'
      -	 * TOINSTANCE     (true|false)  'false'
      -	 * TRANSLATABLE   (true|false)  'false'"
      -	 * 
      - * - * @param pAttribs - * @return int - CIMFlavor bit mixture - */ - public int getQualifierFlavor(Attributes pAttribs) { - int flavors = 0; - if (!getBoolAttribute(pAttribs, "OVERRIDABLE", true)) flavors |= CIMFlavor.DISABLEOVERRIDE; - if (!getBoolAttribute(pAttribs, "TOSUBCLASS", true)) flavors |= CIMFlavor.RESTRICTED; - if (getBoolAttribute(pAttribs, "TRANSLATABLE", false)) flavors |= CIMFlavor.TRANSLATE; - return flavors; - } - - /** - * hasTrueAttribute - * - * @param pAttribs - * @param pName - * @return boolean - */ - public static boolean hasTrueAttribute(Attributes pAttribs, String pName) { - return MOF.TRUE.equalsIgnoreCase(pAttribs.getValue(pName)); - } - - /** - * getBoolAttribute - * - * @param pAttribs - * @param pName - * @param pDefVal - * @return boolean - */ - public static boolean getBoolAttribute(Attributes pAttribs, String pName, boolean pDefVal) { - String val = pAttribs.getValue(pName); - if (MOF.TRUE.equalsIgnoreCase(val)) return true; - if (MOF.FALSE.equalsIgnoreCase(val)) return false; - return pDefVal; - } - - /** - * duplicatedNode - * - * @param pParsedNodeName - * @param pNewNodeName - * @throws SAXException - */ - public void duplicatedNode(String pParsedNodeName, String pNewNodeName) throws SAXException { - throw new SAXException(getNodeName() + " has a " + pParsedNodeName - + " child node which disallows an additional " + pNewNodeName + " child node!"); - } - - /** - * illegalChildNodePair - * - * @param pNodeName0 - * @param pNodeName1 - * @throws SAXException - */ - public void illegalChildNodePair(String pNodeName0, String pNodeName1) throws SAXException { - throw new SAXException(pNodeName0 + ", " + pNodeName1 + " child node pair is illegal for " - + getNodeName() + " node!"); - } - -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1660756 2007-02-22 ebak Embedded object support + * 1689085 2007-04-10 ebak Embedded object enhancements for Pegasus + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 1735614 2007-06-12 ebak Wrong ARRAYSIZE attribute handling in SAX/PULL + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2038305 2008-08-14 blaschke-oss SAXException SBLIM Java Client V2.0.7 + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 3513353 2012-03-30 blaschke-oss TCK: CIMDataType arrays must have length >= 1 + * 3602604 2013-01-29 blaschke-oss Clean up SAXException messages + * 2605 2013-03-20 buccella SAX parser throws wrong exception + * 2693 2013-10-21 blaschke-oss ReturnValueNode allows invalid PARAMTYPE attribute + * 2702 2013-11-07 blaschke-oss Bad PROPERTY.ARRAY ARRAYSIZE generates NumberFormatException + * 2706 2013-11-11 blaschke-oss Bad PARAMETER.REFARRAY ARRAYSIZE generates NumberFormatException + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMDataType; +import org.metricshub.wbem.sblim.cimclient.internal.cim.CIMHelper; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.CIMObjectFactory; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; +import org.metricshub.wbem.sblim.cimclient.internal.util.MOF; +import org.metricshub.wbem.javax.cim.CIMFlavor; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.NodeConstIf; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + * Class Node is the abstract base class of all parseable XML elements. It + * contains helper functions for the implementations. + */ +public abstract class Node implements NodeConstIf { + + private String iNameEnum; + + private boolean iCompleted; + + /** + * Ctor. + * + * @param pNameEnum + * The name of the node which must be a String constant which is + * defined inside this class (because the implementation compares + * by reference). + */ + public Node(String pNameEnum) { + this.iNameEnum = pNameEnum; + } + + /** + * getNodeName + * + * @return The name of the node. This name have to be one of the String + * constant defined in the class. + */ + public String getNodeName() { + return this.iNameEnum; + } + + /** + * The SAX ContentHandler implementation calls this method after testChild() + * and addChild() calls. The implementation must reset it's instance unless + * it implements NonVolatileIf + * + * @param pAttribs + * @param pSession + * - stores variables which are common for the whole SAX parsing + * session + * @throws SAXException + */ + public abstract void init(Attributes pAttribs, SAXSession pSession) throws SAXException; + + /** + * XML element's data have to be passed + * + * @param pData + * - String which is concatenated in SAX's + * DefaultHandler.characters() implementation. + * @throws SAXException + */ + public abstract void parseData(String pData) throws SAXException; + + /** + * It have to be called by SAX's DefaultHandler implementation when it + * detects a new child element (startElement()). + * + * @param pNodeNameEnum + * - the name of the child element, it must be one of the String + * constant defined in class Node, because the implementer + * subclasses uses reference based equals comparisons (==) + * @throws SAXException + * - It have to be thrown when the Node cannot have + * pNodeNameEnum named child Node. + */ + public abstract void testChild(String pNodeNameEnum) throws SAXException; + + /** + * It have to be called by SAX's DefaultHandler.endElement(). It's task is + * to check that the Element is built up correctly. The implementer function + * can do some post processing here. testCompletness + * + * @throws SAXException + * It must be thrown when the Node is not valid. + */ + public abstract void testCompletness() throws SAXException; + + /** + * Have to be called by SAX's DefaultHandler.endElement() + * + * @param pChild + * @throws SAXException + * - parent Nodes can make conversions here (e.g. type string + * into CIMDataType), failed operation should throw + * SAXException) + */ + public abstract void childParsed(Node pChild) throws SAXException; + + /** + * completed + * + * @return true if the parsing of the node is completed + */ + public boolean isCompleted() { + return this.iCompleted; + } + + /** + * Have to be called by SAX's DefaultHandler at endElement(), after calling + * testCompletness(). + */ + public void setCompleted() { + this.iCompleted = true; + } + + /** + * When a Node instance is going to be reused, this function must be called + * before. + */ + public void clearCompleted() { + this.iCompleted = false; + } + + /** + * ENTITY % CIMName "NAME CDATA #REQUIRED" + * + * @param pAttribs + * @return String + * @throws SAXException + */ + public static String getCIMName(Attributes pAttribs) throws SAXException { + String name = pAttribs.getValue("NAME"); + if (name == null) throw new SAXException("NAME attribute not found!"); + return name; + } + + /** + * ENTITY % ClassName "CLASSNAME CDATA #REQUIRED" + * + * @param pAttribs + * @return String + * @throws SAXException + */ + public static String getClassName(Attributes pAttribs) throws SAXException { + String name = pAttribs.getValue("CLASSNAME"); + if (name == null) throw new SAXException("CLASSNAME attribute not found!"); + return name; + } + + /** + * ENTITY % ReferenceClass "REFERENCECLASS CDATA #IMPLIED" + * + * @param pAttribs + * @return String + */ + public static String getReferenceClass(Attributes pAttribs) { + return pAttribs.getValue("REFERENCECLASS"); + } + + /** + * ENTITY % ClassOrigin "CLASSORIGIN CDATA #IMPLIED + * + * @param pAttribs + * @return String + */ + public static String getClassOrigin(Attributes pAttribs) { + return pAttribs.getValue("CLASSORIGIN"); + } + + /** + * ENTITY % Propagated "PROPAGATED (true|false) 'false'" getPropagated + * + * @param pAttribs + * @return boolean + */ + public static boolean getPropagated(Attributes pAttribs) { + String str = pAttribs.getValue("PROPAGATED"); + return MOF.TRUE.equalsIgnoreCase(str); + } + + /** + * ENTITY % ArraySize "ARRAYSIZE CDATA #IMPLIED" + * + * @param pAttribs + * @return int + * @throws SAXException + */ + public static int getArraySize(Attributes pAttribs) throws SAXException { + String arraySizeStr = pAttribs.getValue("ARRAYSIZE"); + // 0 - unbounded size + int size = 0; + try { + size = arraySizeStr == null || arraySizeStr.length() == 0 ? 0 : Integer + .parseInt(arraySizeStr); + } catch (NumberFormatException e) { + throw new SAXException(arraySizeStr + " is not a valid ARRAYSIZE attribute!"); + } + if (size < 0) throw new SAXException("ARRAYSIZE cannot be " + size + "!"); + return size; + } + + /** + * ENTITY % CIMType "TYPE + * (boolean|string|char16|uint8|sint8|uint16|sint16|uint32 + * |sint32|uint64|sint64|datetime|real32|real64)" getCIMType + * + * @param pAttribs + * @param pOptional + * @return CIMDataType + * @throws SAXException + */ + public static CIMDataType getCIMType(Attributes pAttribs, boolean pOptional) + throws SAXException { + String typeStr = pAttribs.getValue("TYPE"); + if (typeStr == null) { + if (pOptional) return null; + throw new SAXException("TYPE attribute not found!"); + } + CIMDataType type = CIMObjectFactory.getType(typeStr); + if (type == null) throw new SAXException(typeStr + " is not a valid TYPE attribute!"); + if (type.getType() == CIMDataType.REFERENCE) throw new SAXException( + "TYPE attribute cannot be \"reference\"!"); + // Is it array? + // Yes if ISARRAY is true or ARRAYSIZE>-1. + boolean isArray = hasTrueAttribute(pAttribs, "ISARRAY"); + String arraySizeStr = pAttribs.getValue("ARRAYSIZE"); + int arraySize; + try { + arraySize = (arraySizeStr == null || arraySizeStr.length() == 0 ? (isArray ? 0 : -1) + : Integer.parseInt(arraySizeStr)); + } catch (NumberFormatException e) { + throw new SAXException(arraySizeStr + " is not a valid ARRAYSIZE attribute!"); + } + if (isArray || arraySize >= 0) { + if (arraySize > 0) return new CIMDataType(type.getType(), arraySize); + return CIMHelper.UnboundedArrayDataType(type.getType()); + } + return type; + } + + /** + * getCIMType(pAttribs, pOptional=false); + * + * @param pAttribs + * @return CIMDataType + * @throws SAXException + */ + public static CIMDataType getCIMType(Attributes pAttribs) throws SAXException { + return getCIMType(pAttribs, false); + } + + /** + * ENTITY % ParamType "PARAMTYPE ( + * boolean|string|char16|uint8|sint8|uint16|sint16 + * |uint32|sint32|uint64|sint64|datetime| real32|real64|reference) + * + * @param pAttribs + * @return CIMDataType + * @throws SAXException + */ + public static CIMDataType getParamType(Attributes pAttribs) throws SAXException { + String typeStr = pAttribs.getValue("PARAMTYPE"); + return CIMObjectFactory.getType(typeStr); + } + + /** + *
      +	 * ENTITY % QualifierFlavor "
      +	 * OVERRIDABLE    (true|false)  'true'
      +	 * TOSUBCLASS     (true|false)  'true'
      +	 * TOINSTANCE     (true|false)  'false'
      +	 * TRANSLATABLE   (true|false)  'false'"
      +	 * 
      + * + * @param pAttribs + * @return int - CIMFlavor bit mixture + */ + public int getQualifierFlavor(Attributes pAttribs) { + int flavors = 0; + if (!getBoolAttribute(pAttribs, "OVERRIDABLE", true)) flavors |= CIMFlavor.DISABLEOVERRIDE; + if (!getBoolAttribute(pAttribs, "TOSUBCLASS", true)) flavors |= CIMFlavor.RESTRICTED; + if (getBoolAttribute(pAttribs, "TRANSLATABLE", false)) flavors |= CIMFlavor.TRANSLATE; + return flavors; + } + + /** + * hasTrueAttribute + * + * @param pAttribs + * @param pName + * @return boolean + */ + public static boolean hasTrueAttribute(Attributes pAttribs, String pName) { + return MOF.TRUE.equalsIgnoreCase(pAttribs.getValue(pName)); + } + + /** + * getBoolAttribute + * + * @param pAttribs + * @param pName + * @param pDefVal + * @return boolean + */ + public static boolean getBoolAttribute(Attributes pAttribs, String pName, boolean pDefVal) { + String val = pAttribs.getValue(pName); + if (MOF.TRUE.equalsIgnoreCase(val)) return true; + if (MOF.FALSE.equalsIgnoreCase(val)) return false; + return pDefVal; + } + + /** + * duplicatedNode + * + * @param pParsedNodeName + * @param pNewNodeName + * @throws SAXException + */ + public void duplicatedNode(String pParsedNodeName, String pNewNodeName) throws SAXException { + throw new SAXException(getNodeName() + " has a " + pParsedNodeName + + " child node which disallows an additional " + pNewNodeName + " child node!"); + } + + /** + * illegalChildNodePair + * + * @param pNodeName0 + * @param pNodeName1 + * @throws SAXException + */ + public void illegalChildNodePair(String pNodeName0, String pNodeName1) throws SAXException { + throw new SAXException(pNodeName0 + ", " + pNodeName1 + " child node pair is illegal for " + + getNodeName() + " node!"); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/NonVolatileIf.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/NonVolatileIf.java similarity index 63% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/NonVolatileIf.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/NonVolatileIf.java index 63304a4..d99dd16 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/NonVolatileIf.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/NonVolatileIf.java @@ -1,59 +1,57 @@ -/* - (C) Copyright IBM Corp. 2006, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1663270 2007-02-19 ebak Minor performance problems - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -/** - * This interface have to be implemented by those Node classes which instances - * cannot be reused. (e.g. CIM, MESSAGE, SIMPLERSP, IMETHODRESPONSE, - * IRETURNVALUE) - */ -public interface NonVolatileIf { - - /** - * Have to be called by SAX's DefaultHandler.startElement() after - * testChild() call. - * - * @param pChild - */ - public abstract void addChild(Node pChild); - -} +/* + (C) Copyright IBM Corp. 2006, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1663270 2007-02-19 ebak Minor performance problems + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +/** + * This interface have to be implemented by those Node classes which instances + * cannot be reused. (e.g. CIM, MESSAGE, SIMPLERSP, IMETHODRESPONSE, + * IRETURNVALUE) + */ +public interface NonVolatileIf { + + /** + * Have to be called by SAX's DefaultHandler.startElement() after + * testChild() call. + * + * @param pChild + */ + public abstract void addChild(Node pChild); + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ObjectPathIf.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ObjectPathIf.java similarity index 58% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ObjectPathIf.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ObjectPathIf.java index 45c449b..6eaef1a 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ObjectPathIf.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ObjectPathIf.java @@ -1,57 +1,55 @@ -/* - (C) Copyright IBM Corp. 2006, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; - -/** - * It's implemented by Nodes which can construct a CIMObjectPath. - */ -public interface ObjectPathIf { - - /** - * getCIMObjectPath - * - * @return CIMObjectPath - */ - CIMObjectPath getCIMObjectPath(); -} +/* + (C) Copyright IBM Corp. 2006, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMObjectPath; + +/** + * It's implemented by Nodes which can construct a CIMObjectPath. + */ +public interface ObjectPathIf { + + /** + * getCIMObjectPath + * + * @return CIMObjectPath + */ + CIMObjectPath getCIMObjectPath(); +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ObjectPathNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ObjectPathNode.java similarity index 73% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ObjectPathNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ObjectPathNode.java index 771540d..4bdb6ce 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ObjectPathNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ObjectPathNode.java @@ -1,114 +1,111 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1660756 2007-02-22 ebak Embedded object support - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2677 2013-09-30 blaschke-oss ObjectPathNode allows all child nodes - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - * ELEMENT OBJECTPATH (INSTANCEPATH | CLASSPATH) - */ -public class ObjectPathNode extends AbstractPathNode { - - // (INSTANCEPATH | CLASSPATH) - private CIMObjectPath iObjPath; - - // private AbstractObjectPathNode iChildNode; - - /** - * Ctor. - */ - public ObjectPathNode() { - super(OBJECTPATH); - } - - /** - * @param pAttribs - * @param pSession - */ - @Override - public void init(Attributes pAttribs, SAXSession pSession) { - this.iObjPath = null; - // no attributes - } - - /** - * @param pData - */ - @Override - public void parseData(String pData) { - // no data - } - - @Override - public void testChild(String pNodeNameEnum) throws SAXException { - if (this.iObjPath != null) throw new SAXException(getNodeName() - + " node can have only one INSTANCEPATH or CLASSPATH child node!" + " Additional " - + pNodeNameEnum + " child node is invalid!"); - if (pNodeNameEnum != CLASSPATH && pNodeNameEnum != INSTANCEPATH) throw new SAXException( - getNodeName() + " node child node can be CLASSPATH or INSTANCEPATH but a " - + pNodeNameEnum + " node was found!"); - } - - @Override - public void childParsed(Node pChild) { - this.iObjPath = ((AbstractObjectPathNode) pChild).getCIMObjectPath(); - } - - @Override - public void testCompletness() throws SAXException { - if (this.iObjPath == null) throw new SAXException(getNodeName() - + " node must have a INSTANCEPATH or CLASSPATH child node!"); - } - - public CIMObjectPath getCIMObjectPath() { - return this.iObjPath; - } - -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1660756 2007-02-22 ebak Embedded object support + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2677 2013-09-30 blaschke-oss ObjectPathNode allows all child nodes + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMObjectPath; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + * ELEMENT OBJECTPATH (INSTANCEPATH | CLASSPATH) + */ +public class ObjectPathNode extends AbstractPathNode { + + // (INSTANCEPATH | CLASSPATH) + private CIMObjectPath iObjPath; + + // private AbstractObjectPathNode iChildNode; + + /** + * Ctor. + */ + public ObjectPathNode() { + super(OBJECTPATH); + } + + /** + * @param pAttribs + * @param pSession + */ + @Override + public void init(Attributes pAttribs, SAXSession pSession) { + this.iObjPath = null; + // no attributes + } + + /** + * @param pData + */ + @Override + public void parseData(String pData) { + // no data + } + + @Override + public void testChild(String pNodeNameEnum) throws SAXException { + if (this.iObjPath != null) throw new SAXException(getNodeName() + + " node can have only one INSTANCEPATH or CLASSPATH child node!" + " Additional " + + pNodeNameEnum + " child node is invalid!"); + if (pNodeNameEnum != CLASSPATH && pNodeNameEnum != INSTANCEPATH) throw new SAXException( + getNodeName() + " node child node can be CLASSPATH or INSTANCEPATH but a " + + pNodeNameEnum + " node was found!"); + } + + @Override + public void childParsed(Node pChild) { + this.iObjPath = ((AbstractObjectPathNode) pChild).getCIMObjectPath(); + } + + @Override + public void testCompletness() throws SAXException { + if (this.iObjPath == null) throw new SAXException(getNodeName() + + " node must have a INSTANCEPATH or CLASSPATH child node!"); + } + + public CIMObjectPath getCIMObjectPath() { + return this.iObjPath; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ParamValueNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ParamValueNode.java similarity index 80% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ParamValueNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ParamValueNode.java index 9bb19fe..883e421 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ParamValueNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ParamValueNode.java @@ -1,182 +1,179 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1660756 2007-02-22 ebak Embedded object support - * 1689085 2007-04-10 ebak Embedded object enhancements for Pegasus - * 1719991 2007-05-16 ebak FVT: regression ClassCastException in EmbObjHandler - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics - * 2605 2013-03-20 buccella SAX parser throws wrong exception - * 2537 2013-10-17 blaschke-oss Add new data types for PARAMVALUE - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMArgument; -import org.sentrysoftware.wbem.javax.cim.CIMDataType; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.EmbObjHandler; -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - * ELEMENT PARAMVALUE (VALUE | VALUE.REFERENCE | VALUE.ARRAY | VALUE.REFARRAY | - * CLASSNAME | INSTANCENAME | CLASS | INSTANCE | VALUE.NAMEDINSTANCE)? ATTLIST - * PARAMVALUE %CIMName; %ParamType; #IMPLIED %EmbeddedObject; #IMPLIED - new - */ -public class ParamValueNode extends AbstractParamValueNode { - - private String iName; - - private EmbObjHandler iEmbObjHandler; - - private CIMDataType iType; - - // VALUE.xxx node - private boolean iHasChild; - - private boolean iHasTypeValue; - - private Object iValue; - - /** - * Ctor. - */ - public ParamValueNode() { - super(PARAMVALUE); - } - - @Override - public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { - this.iEmbObjHandler = EmbObjHandler.init(this.iEmbObjHandler, getNodeName(), pAttribs, - pSession, null, true); - this.iHasChild = false; - this.iHasTypeValue = false; - this.iName = getCIMName(pAttribs); - this.iType = null; - this.iValue = null; - } - - /** - * @param pData - */ - @Override - public void parseData(String pData) { - // no data - } - - private static final String[] ALLOWED_CHILDREN = { VALUE, VALUE_REFERENCE, VALUE_ARRAY, - VALUE_REFARRAY, CLASSNAME, INSTANCENAME, CLASS, INSTANCE, VALUE_NAMEDINSTANCE }; - - @Override - public void testChild(String pNodeNameEnum) throws SAXException { - boolean allowed = false; - for (int i = 0; i < ALLOWED_CHILDREN.length; i++) { - if (ALLOWED_CHILDREN[i] == pNodeNameEnum) { - allowed = true; - break; - } - } - if (!allowed) throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum - + " child node!"); - if (this.iHasChild) throw new SAXException(getNodeName() - + " node cannot have more than one child node!"); - // type check - CIMDataType rawType = this.iEmbObjHandler.getRawType(); - if (rawType != null) { - if (pNodeNameEnum == VALUE_REFERENCE || pNodeNameEnum == VALUE_REFARRAY) { - if (rawType.getType() != CIMDataType.REFERENCE) throw new SAXException( - "PARAMVALUE node's PARAMTYPE attribute is not reference (" + rawType - + "), but a " + pNodeNameEnum + " child node is found!"); - } - } - } - - @Override - public void childParsed(Node pChild) { - if (pChild instanceof AbstractValueNode) { - this.iEmbObjHandler.addValueNode((AbstractValueNode) pChild); - } else { - this.iValue = ((ValueIf) pChild).getValue(); - if (pChild instanceof TypedIf) this.iType = ((TypedIf) pChild).getType(); - else if (pChild instanceof ObjectPathIf) this.iType = CIMDataType - .getDataType(((ObjectPathIf) pChild).getCIMObjectPath()); - else if (pChild instanceof ValueIf) this.iType = CIMDataType - .getDataType(((ValueIf) pChild).getValue()); - this.iHasTypeValue = true; - } - this.iHasChild = true; - } - - @Override - public void testCompletness() throws SAXException { - if (!this.iHasTypeValue) { - // here is a type and value conversion - this.iType = this.iEmbObjHandler.getType(); - this.iValue = this.iEmbObjHandler.getValue(); - } - } - - public CIMDataType getType() { - return this.iType; - } - - /** - * getCIMArgument - * - * @return CIMArgument - */ - @Override - public CIMArgument getCIMArgument() { - /* - * CIMArgument(String name, CIMDataType type, Object value) - */ - return new CIMArgument(this.iName, this.iType, this.iValue); - } - - /** - * @see ValueIf#getValue() - */ - public Object getValue() { - return this.iValue; - } - -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1660756 2007-02-22 ebak Embedded object support + * 1689085 2007-04-10 ebak Embedded object enhancements for Pegasus + * 1719991 2007-05-16 ebak FVT: regression ClassCastException in EmbObjHandler + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics + * 2605 2013-03-20 buccella SAX parser throws wrong exception + * 2537 2013-10-17 blaschke-oss Add new data types for PARAMVALUE + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMArgument; +import org.metricshub.wbem.javax.cim.CIMDataType; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.EmbObjHandler; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + * ELEMENT PARAMVALUE (VALUE | VALUE.REFERENCE | VALUE.ARRAY | VALUE.REFARRAY | + * CLASSNAME | INSTANCENAME | CLASS | INSTANCE | VALUE.NAMEDINSTANCE)? ATTLIST + * PARAMVALUE %CIMName; %ParamType; #IMPLIED %EmbeddedObject; #IMPLIED - new + */ +public class ParamValueNode extends AbstractParamValueNode { + + private String iName; + + private EmbObjHandler iEmbObjHandler; + + private CIMDataType iType; + + // VALUE.xxx node + private boolean iHasChild; + + private boolean iHasTypeValue; + + private Object iValue; + + /** + * Ctor. + */ + public ParamValueNode() { + super(PARAMVALUE); + } + + @Override + public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { + this.iEmbObjHandler = EmbObjHandler.init(this.iEmbObjHandler, getNodeName(), pAttribs, + pSession, null, true); + this.iHasChild = false; + this.iHasTypeValue = false; + this.iName = getCIMName(pAttribs); + this.iType = null; + this.iValue = null; + } + + /** + * @param pData + */ + @Override + public void parseData(String pData) { + // no data + } + + private static final String[] ALLOWED_CHILDREN = { VALUE, VALUE_REFERENCE, VALUE_ARRAY, + VALUE_REFARRAY, CLASSNAME, INSTANCENAME, CLASS, INSTANCE, VALUE_NAMEDINSTANCE }; + + @Override + public void testChild(String pNodeNameEnum) throws SAXException { + boolean allowed = false; + for (int i = 0; i < ALLOWED_CHILDREN.length; i++) { + if (ALLOWED_CHILDREN[i] == pNodeNameEnum) { + allowed = true; + break; + } + } + if (!allowed) throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum + + " child node!"); + if (this.iHasChild) throw new SAXException(getNodeName() + + " node cannot have more than one child node!"); + // type check + CIMDataType rawType = this.iEmbObjHandler.getRawType(); + if (rawType != null) { + if (pNodeNameEnum == VALUE_REFERENCE || pNodeNameEnum == VALUE_REFARRAY) { + if (rawType.getType() != CIMDataType.REFERENCE) throw new SAXException( + "PARAMVALUE node's PARAMTYPE attribute is not reference (" + rawType + + "), but a " + pNodeNameEnum + " child node is found!"); + } + } + } + + @Override + public void childParsed(Node pChild) { + if (pChild instanceof AbstractValueNode) { + this.iEmbObjHandler.addValueNode((AbstractValueNode) pChild); + } else { + this.iValue = ((ValueIf) pChild).getValue(); + if (pChild instanceof TypedIf) this.iType = ((TypedIf) pChild).getType(); + else if (pChild instanceof ObjectPathIf) this.iType = CIMDataType + .getDataType(((ObjectPathIf) pChild).getCIMObjectPath()); + else if (pChild instanceof ValueIf) this.iType = CIMDataType + .getDataType(((ValueIf) pChild).getValue()); + this.iHasTypeValue = true; + } + this.iHasChild = true; + } + + @Override + public void testCompletness() throws SAXException { + if (!this.iHasTypeValue) { + // here is a type and value conversion + this.iType = this.iEmbObjHandler.getType(); + this.iValue = this.iEmbObjHandler.getValue(); + } + } + + public CIMDataType getType() { + return this.iType; + } + + /** + * getCIMArgument + * + * @return CIMArgument + */ + @Override + public CIMArgument getCIMArgument() { + /* + * CIMArgument(String name, CIMDataType type, Object value) + */ + return new CIMArgument(this.iName, this.iType, this.iValue); + } + + /** + * @see ValueIf#getValue() + */ + public Object getValue() { + return this.iValue; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ParameterArrayNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ParameterArrayNode.java similarity index 69% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ParameterArrayNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ParameterArrayNode.java index 67a2fce..2c80f8c 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ParameterArrayNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ParameterArrayNode.java @@ -1,92 +1,89 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 1820763 2007-10-29 ebak Supporting the EmbeddedInstance qualifier - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2705 2013-11-11 blaschke-oss PARAMETER.ARRAY does not require TYPE attribute - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMDataType; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.EmbObjHandler; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - *
      - * ELEMENT PARAMETER.ARRAY (QUALIFIER*)
      - * ATTLIST PARAMETER.ARRAY
      - *   %CIMName;
      - *   %CIMType;              #REQUIRED
      - *   %ArraySize;
      - * 
      - */ -public class ParameterArrayNode extends AbstractParameterNode { - - private CIMDataType iType; - - private EmbObjHandler iEmbObjHandler; - - /** - * Ctor. - */ - public ParameterArrayNode() { - super(PARAMETER_ARRAY); - } - - @Override - protected void specificInit(Attributes pAttribs) throws SAXException { - if (getCIMType(pAttribs, true) == null) throw new SAXException( - "PARAMETER.ARRAY element missing TYPE attribute!"); - this.iEmbObjHandler = EmbObjHandler.init(this.iEmbObjHandler, getNodeName(), pAttribs, - this.iSession, this.iQualiHandler, true); - } - - @Override - public void testCompletness() throws SAXException { - this.iType = this.iEmbObjHandler.getArrayType(); - } - - public CIMDataType getType() { - return this.iType; - } - -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 1820763 2007-10-29 ebak Supporting the EmbeddedInstance qualifier + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2705 2013-11-11 blaschke-oss PARAMETER.ARRAY does not require TYPE attribute + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMDataType; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.EmbObjHandler; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + *
      + * ELEMENT PARAMETER.ARRAY (QUALIFIER*)
      + * ATTLIST PARAMETER.ARRAY
      + *   %CIMName;
      + *   %CIMType;              #REQUIRED
      + *   %ArraySize;
      + * 
      + */ +public class ParameterArrayNode extends AbstractParameterNode { + + private CIMDataType iType; + + private EmbObjHandler iEmbObjHandler; + + /** + * Ctor. + */ + public ParameterArrayNode() { + super(PARAMETER_ARRAY); + } + + @Override + protected void specificInit(Attributes pAttribs) throws SAXException { + if (getCIMType(pAttribs, true) == null) throw new SAXException( + "PARAMETER.ARRAY element missing TYPE attribute!"); + this.iEmbObjHandler = EmbObjHandler.init(this.iEmbObjHandler, getNodeName(), pAttribs, + this.iSession, this.iQualiHandler, true); + } + + @Override + public void testCompletness() throws SAXException { + this.iType = this.iEmbObjHandler.getArrayType(); + } + + public CIMDataType getType() { + return this.iType; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ParameterNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ParameterNode.java similarity index 69% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ParameterNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ParameterNode.java index 44cdcf5..7f2239e 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ParameterNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ParameterNode.java @@ -1,88 +1,85 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 1820763 2007-10-29 ebak Supporting the EmbeddedInstance qualifier - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2704 2013-11-11 blaschke-oss PARAMETER does not require TYPE attribute - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMDataType; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.EmbObjHandler; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - * ELEMENT PARAMETER (QUALIFIER*) ATTLIST PARAMETER %CIMName; %CIMType; - */ -public class ParameterNode extends AbstractParameterNode { - - private CIMDataType iType; - - private EmbObjHandler iEmbObjHandler; - - /** - * Ctor. - */ - public ParameterNode() { - super(PARAMETER); - } - - @Override - protected void specificInit(Attributes pAttribs) throws SAXException { - if (getCIMType(pAttribs, true) == null) throw new SAXException( - "PARAMETER element missing TYPE attribute!"); - this.iEmbObjHandler = EmbObjHandler.init(this.iEmbObjHandler, getNodeName(), pAttribs, - this.iSession, this.iQualiHandler, true); - } - - @Override - public void testCompletness() throws SAXException { - this.iType = this.iEmbObjHandler.getType(); - if (this.iType.isArray()) throw new SAXException( - "PARAMETER node's TYPE attribute cannot be an array!"); - } - - public CIMDataType getType() { - return this.iType; - } - -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 1820763 2007-10-29 ebak Supporting the EmbeddedInstance qualifier + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2704 2013-11-11 blaschke-oss PARAMETER does not require TYPE attribute + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMDataType; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.EmbObjHandler; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + * ELEMENT PARAMETER (QUALIFIER*) ATTLIST PARAMETER %CIMName; %CIMType; + */ +public class ParameterNode extends AbstractParameterNode { + + private CIMDataType iType; + + private EmbObjHandler iEmbObjHandler; + + /** + * Ctor. + */ + public ParameterNode() { + super(PARAMETER); + } + + @Override + protected void specificInit(Attributes pAttribs) throws SAXException { + if (getCIMType(pAttribs, true) == null) throw new SAXException( + "PARAMETER element missing TYPE attribute!"); + this.iEmbObjHandler = EmbObjHandler.init(this.iEmbObjHandler, getNodeName(), pAttribs, + this.iSession, this.iQualiHandler, true); + } + + @Override + public void testCompletness() throws SAXException { + this.iType = this.iEmbObjHandler.getType(); + if (this.iType.isArray()) throw new SAXException( + "PARAMETER node's TYPE attribute cannot be an array!"); + } + + public CIMDataType getType() { + return this.iType; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ParameterRefArrayNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ParameterRefArrayNode.java similarity index 71% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ParameterRefArrayNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ParameterRefArrayNode.java index b7dd3fb..6d8d383 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ParameterRefArrayNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ParameterRefArrayNode.java @@ -1,89 +1,86 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 1735614 2007-06-12 ebak Wrong ARRAYSIZE attribute handling in SAX/PULL - * 1820763 2007-10-29 ebak Supporting the EmbeddedInstance qualifier - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2433593 2008-12-18 rgummada isArray returns true for method parameters of type reference - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2605 2013-03-20 buccella SAX parser throws wrong exception - * 2636 2013-05-08 blaschke-oss Nested embedded instances cause CIMXMLParseException - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMDataType; - -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - *
      - * ELEMENT PARAMETER.REFARRAY (QUALIFIER*)
      - * ATTLIST PARAMETER.REFARRAY
      - *   %CIMName;
      - *   %ReferenceClass;
      - *   %ArraySize;
      - * 
      - */ -public class ParameterRefArrayNode extends AbstractParameterNode { - - private CIMDataType iType; - - /** - * Ctor. - */ - public ParameterRefArrayNode() { - super(PARAMETER_REFARRAY); - } - - @Override - protected void specificInit(Attributes pAttribs) throws SAXException { - String refClass = getReferenceClass(pAttribs); - this.iType = new CIMDataType(refClass != null ? refClass : "", getArraySize(pAttribs)); - - } - - @Override - public void testCompletness() { /* */} - - public CIMDataType getType() { - return this.iType; - } - -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 1735614 2007-06-12 ebak Wrong ARRAYSIZE attribute handling in SAX/PULL + * 1820763 2007-10-29 ebak Supporting the EmbeddedInstance qualifier + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2433593 2008-12-18 rgummada isArray returns true for method parameters of type reference + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2605 2013-03-20 buccella SAX parser throws wrong exception + * 2636 2013-05-08 blaschke-oss Nested embedded instances cause CIMXMLParseException + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMDataType; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + *
      + * ELEMENT PARAMETER.REFARRAY (QUALIFIER*)
      + * ATTLIST PARAMETER.REFARRAY
      + *   %CIMName;
      + *   %ReferenceClass;
      + *   %ArraySize;
      + * 
      + */ +public class ParameterRefArrayNode extends AbstractParameterNode { + + private CIMDataType iType; + + /** + * Ctor. + */ + public ParameterRefArrayNode() { + super(PARAMETER_REFARRAY); + } + + @Override + protected void specificInit(Attributes pAttribs) throws SAXException { + String refClass = getReferenceClass(pAttribs); + this.iType = new CIMDataType(refClass != null ? refClass : "", getArraySize(pAttribs)); + + } + + @Override + public void testCompletness() { /* */} + + public CIMDataType getType() { + return this.iType; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ParameterReferenceNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ParameterReferenceNode.java similarity index 68% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ParameterReferenceNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ParameterReferenceNode.java index a59b476..20bd71a 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ParameterReferenceNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ParameterReferenceNode.java @@ -1,83 +1,80 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 1820763 2007-10-29 ebak Supporting the EmbeddedInstance qualifier - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2636 2013-05-08 blaschke-oss Nested embedded instances cause CIMXMLParseException - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMDataType; - -import org.xml.sax.Attributes; - -/** - *
      - * ELEMENT PARAMETER.REFERENCE (QUALIFIER*)
      - * ATTLIST PARAMETER.REFERENCE
      - *   %CIMName;
      - *   %ReferenceClass;
      - * 
      - */ -public class ParameterReferenceNode extends AbstractParameterNode { - - private CIMDataType iType; - - /** - * Ctor. - */ - public ParameterReferenceNode() { - super(PARAMETER_REFERENCE); - } - - @Override - protected void specificInit(Attributes pAttribs) { - String refClass = getReferenceClass(pAttribs); - this.iType = new CIMDataType(refClass != null ? refClass : ""); - } - - @Override - public void testCompletness() { /* */} - - public CIMDataType getType() { - return this.iType; - } - -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 1820763 2007-10-29 ebak Supporting the EmbeddedInstance qualifier + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2636 2013-05-08 blaschke-oss Nested embedded instances cause CIMXMLParseException + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMDataType; +import org.xml.sax.Attributes; + +/** + *
      + * ELEMENT PARAMETER.REFERENCE (QUALIFIER*)
      + * ATTLIST PARAMETER.REFERENCE
      + *   %CIMName;
      + *   %ReferenceClass;
      + * 
      + */ +public class ParameterReferenceNode extends AbstractParameterNode { + + private CIMDataType iType; + + /** + * Ctor. + */ + public ParameterReferenceNode() { + super(PARAMETER_REFERENCE); + } + + @Override + protected void specificInit(Attributes pAttribs) { + String refClass = getReferenceClass(pAttribs); + this.iType = new CIMDataType(refClass != null ? refClass : ""); + } + + @Override + public void testCompletness() { /* */} + + public CIMDataType getType() { + return this.iType; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/PropertyArrayNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/PropertyArrayNode.java similarity index 75% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/PropertyArrayNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/PropertyArrayNode.java index 8383e9c..07147ba 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/PropertyArrayNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/PropertyArrayNode.java @@ -1,142 +1,139 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1660756 2007-02-22 ebak Embedded object support - * 1689085 2007-04-10 ebak Embedded object enhancements for Pegasus - * 1714878 2007-05-08 ebak Empty string property values are parsed as nulls - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics - * 2701 2013-11-07 blaschke-oss PROPERTY.ARRAY does not require TYPE attribute - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMDataType; -import org.sentrysoftware.wbem.javax.cim.CIMQualifier; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.EmbObjHandler; -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - *
      - * ELEMENT PROPERTY.ARRAY (QUALIFIER*, VALUE.ARRAY?)
      - * ATTLIST PROPERTY.ARRAY 
      - *   %CIMName;
      - *   %CIMType;              #REQUIRED
      - *   %ArraySize;
      - *   %ClassOrigin;
      - *   %Propagated;
      - *   %EmbeddedObject;    	#IMPLIED - new
      - *   xml:lang   NMTOKEN     #IMPLIED
      - * 
      - */ -public class PropertyArrayNode extends AbstractPropertyNode { - - // VALUE.ARRAY - // required for super.testChild() - private boolean iHasValueArray; - - private boolean iHasTypeAttribute; - - private CIMDataType iType; - - private Object iValue; - - private EmbObjHandler iEmbObjHandler; - - /** - * Ctor. - */ - public PropertyArrayNode() { - super(PROPERTY_ARRAY); - } - - @Override - protected void specificInit(Attributes pAttribs, SAXSession pSession) throws SAXException { - this.iHasTypeAttribute = (getCIMType(pAttribs, true) != null); - this.iEmbObjHandler = EmbObjHandler.init(this.iEmbObjHandler, getNodeName(), pAttribs, - pSession, this.iQualiHandler, true); - this.iHasValueArray = false; - } - - @Override - protected void childValueNodeParsed(Node pChild) throws SAXException { - if (!this.iHasTypeAttribute && ((ValueArrayNode) pChild).getType() == null) throw new SAXException( - "PROPERTY.ARRAY element missing TYPE attribute!"); - this.iEmbObjHandler.addValueNode((ValueArrayNode) pChild); - this.iHasValueArray = true; - } - - @Override - public void testCompletness() throws SAXException { - /* - * Value and type conversion are placed here. It can throw Exception. - */ - this.iType = this.iEmbObjHandler.getArrayType(); - this.iValue = this.iEmbObjHandler.getValue(); - } - - public CIMDataType getType() { - return this.iType; - } - - @Override - protected String getChildValueNodeNameEnum() { - return VALUE_ARRAY; - } - - public Object getValue() { - // if iHasValueArray is false iObjA is null, since nulled in init() - return this.iValue; - } - - @Override - protected boolean hasValueNode() { - return this.iHasValueArray; - } - - @Override - protected CIMQualifier[] getQualis() { - return this.iQualiHandler.getQualis(this.iType == CIMDataType.STRING_ARRAY_T); - } - -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1660756 2007-02-22 ebak Embedded object support + * 1689085 2007-04-10 ebak Embedded object enhancements for Pegasus + * 1714878 2007-05-08 ebak Empty string property values are parsed as nulls + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics + * 2701 2013-11-07 blaschke-oss PROPERTY.ARRAY does not require TYPE attribute + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMDataType; +import org.metricshub.wbem.javax.cim.CIMQualifier; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.EmbObjHandler; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + *
      + * ELEMENT PROPERTY.ARRAY (QUALIFIER*, VALUE.ARRAY?)
      + * ATTLIST PROPERTY.ARRAY 
      + *   %CIMName;
      + *   %CIMType;              #REQUIRED
      + *   %ArraySize;
      + *   %ClassOrigin;
      + *   %Propagated;
      + *   %EmbeddedObject;    	#IMPLIED - new
      + *   xml:lang   NMTOKEN     #IMPLIED
      + * 
      + */ +public class PropertyArrayNode extends AbstractPropertyNode { + + // VALUE.ARRAY + // required for super.testChild() + private boolean iHasValueArray; + + private boolean iHasTypeAttribute; + + private CIMDataType iType; + + private Object iValue; + + private EmbObjHandler iEmbObjHandler; + + /** + * Ctor. + */ + public PropertyArrayNode() { + super(PROPERTY_ARRAY); + } + + @Override + protected void specificInit(Attributes pAttribs, SAXSession pSession) throws SAXException { + this.iHasTypeAttribute = (getCIMType(pAttribs, true) != null); + this.iEmbObjHandler = EmbObjHandler.init(this.iEmbObjHandler, getNodeName(), pAttribs, + pSession, this.iQualiHandler, true); + this.iHasValueArray = false; + } + + @Override + protected void childValueNodeParsed(Node pChild) throws SAXException { + if (!this.iHasTypeAttribute && ((ValueArrayNode) pChild).getType() == null) throw new SAXException( + "PROPERTY.ARRAY element missing TYPE attribute!"); + this.iEmbObjHandler.addValueNode((ValueArrayNode) pChild); + this.iHasValueArray = true; + } + + @Override + public void testCompletness() throws SAXException { + /* + * Value and type conversion are placed here. It can throw Exception. + */ + this.iType = this.iEmbObjHandler.getArrayType(); + this.iValue = this.iEmbObjHandler.getValue(); + } + + public CIMDataType getType() { + return this.iType; + } + + @Override + protected String getChildValueNodeNameEnum() { + return VALUE_ARRAY; + } + + public Object getValue() { + // if iHasValueArray is false iObjA is null, since nulled in init() + return this.iValue; + } + + @Override + protected boolean hasValueNode() { + return this.iHasValueArray; + } + + @Override + protected CIMQualifier[] getQualis() { + return this.iQualiHandler.getQualis(this.iType == CIMDataType.STRING_ARRAY_T); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/PropertyNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/PropertyNode.java similarity index 74% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/PropertyNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/PropertyNode.java index 830e030..2887239 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/PropertyNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/PropertyNode.java @@ -1,139 +1,136 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1660756 2007-02-22 ebak Embedded object support - * 1689085 2007-04-10 ebak Embedded object enhancements for Pegasus - * 1714878 2007-05-08 ebak Empty string property values are parsed as nulls - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics - * 2700 2013-11-07 blaschke-oss PROPERTY does not require TYPE attribute - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMDataType; -import org.sentrysoftware.wbem.javax.cim.CIMQualifier; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.EmbObjHandler; -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - *
      - * ELEMENT PROPERTY (QUALIFIER*, VALUE?)
      - * ATTLIST PROPERTY 
      - *   %CIMName;
      - *   %ClassOrigin;
      - *   %Propagated;
      - *   %CIMType;              #REQUIRED
      - *   %EmbeddedObject;       #IMPLIED  - new
      - *   xml:lang   NMTOKEN     #IMPLIED
      - * 
      - */ -public class PropertyNode extends AbstractPropertyNode { - - private CIMDataType iType; - - // VALUE element - private boolean iHasValue; - - private boolean iHasTypeAttribute; - - private Object iValue; - - private EmbObjHandler iEmbObjHandler; - - /** - * Ctor. - */ - public PropertyNode() { - super(PROPERTY); - } - - @Override - protected void specificInit(Attributes pAttribs, SAXSession pSession) throws SAXException { - this.iHasTypeAttribute = (getCIMType(pAttribs, true) != null); - this.iEmbObjHandler = EmbObjHandler.init(this.iEmbObjHandler, getNodeName(), pAttribs, - pSession, this.iQualiHandler, true); - this.iHasValue = false; - } - - @Override - public void childValueNodeParsed(Node pChild) throws SAXException { - this.iHasValue = true; - if (!this.iHasTypeAttribute && ((ValueNode) pChild).getType() == null) throw new SAXException( - "PROPERTY element missing TYPE attribute!"); - this.iEmbObjHandler.addValueNode((ValueNode) pChild); - } - - @Override - protected String getChildValueNodeNameEnum() { - return VALUE; - } - - @Override - protected boolean hasValueNode() { - return this.iHasValue; - } - - @Override - protected CIMQualifier[] getQualis() { - return this.iQualiHandler.getQualis(getType() == CIMDataType.STRING_T); - } - - @Override - public void testCompletness() throws SAXException { - /* - * Value and type conversion are placed here. It can throw Exception. - */ - this.iType = this.iEmbObjHandler.getType(); - this.iValue = this.iEmbObjHandler.getValue(); - } - - public CIMDataType getType() { - return this.iType; - } - - public Object getValue() { - return this.iValue; - } - -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1660756 2007-02-22 ebak Embedded object support + * 1689085 2007-04-10 ebak Embedded object enhancements for Pegasus + * 1714878 2007-05-08 ebak Empty string property values are parsed as nulls + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics + * 2700 2013-11-07 blaschke-oss PROPERTY does not require TYPE attribute + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMDataType; +import org.metricshub.wbem.javax.cim.CIMQualifier; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.EmbObjHandler; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + *
      + * ELEMENT PROPERTY (QUALIFIER*, VALUE?)
      + * ATTLIST PROPERTY 
      + *   %CIMName;
      + *   %ClassOrigin;
      + *   %Propagated;
      + *   %CIMType;              #REQUIRED
      + *   %EmbeddedObject;       #IMPLIED  - new
      + *   xml:lang   NMTOKEN     #IMPLIED
      + * 
      + */ +public class PropertyNode extends AbstractPropertyNode { + + private CIMDataType iType; + + // VALUE element + private boolean iHasValue; + + private boolean iHasTypeAttribute; + + private Object iValue; + + private EmbObjHandler iEmbObjHandler; + + /** + * Ctor. + */ + public PropertyNode() { + super(PROPERTY); + } + + @Override + protected void specificInit(Attributes pAttribs, SAXSession pSession) throws SAXException { + this.iHasTypeAttribute = (getCIMType(pAttribs, true) != null); + this.iEmbObjHandler = EmbObjHandler.init(this.iEmbObjHandler, getNodeName(), pAttribs, + pSession, this.iQualiHandler, true); + this.iHasValue = false; + } + + @Override + public void childValueNodeParsed(Node pChild) throws SAXException { + this.iHasValue = true; + if (!this.iHasTypeAttribute && ((ValueNode) pChild).getType() == null) throw new SAXException( + "PROPERTY element missing TYPE attribute!"); + this.iEmbObjHandler.addValueNode((ValueNode) pChild); + } + + @Override + protected String getChildValueNodeNameEnum() { + return VALUE; + } + + @Override + protected boolean hasValueNode() { + return this.iHasValue; + } + + @Override + protected CIMQualifier[] getQualis() { + return this.iQualiHandler.getQualis(getType() == CIMDataType.STRING_T); + } + + @Override + public void testCompletness() throws SAXException { + /* + * Value and type conversion are placed here. It can throw Exception. + */ + this.iType = this.iEmbObjHandler.getType(); + this.iValue = this.iEmbObjHandler.getValue(); + } + + public CIMDataType getType() { + return this.iType; + } + + public Object getValue() { + return this.iValue; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/PropertyReferenceNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/PropertyReferenceNode.java similarity index 73% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/PropertyReferenceNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/PropertyReferenceNode.java index 2719b7a..027e1ca 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/PropertyReferenceNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/PropertyReferenceNode.java @@ -1,121 +1,118 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1660756 2007-02-22 ebak Embedded object support - * 1689085 2007-04-10 ebak Embedded object enhancements for Pegasus - * 1714878 2007-05-08 ebak Empty string property values are parsed as nulls - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2636 2013-05-08 blaschke-oss Nested embedded instances cause CIMXMLParseException - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMDataType; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.xml.sax.Attributes; - -/** - *
      - * 
      - * ELEMENT PROPERTY.REFERENCE (QUALIFIER*, (VALUE.REFERENCE)?)
      - * ATTLIST PROPERTY.REFERENCE
      - *   %CIMName; 
      - *   %ReferenceClass; 
      - *   %ClassOrigin;
      - *   %Propagated;
      - * 
      - */ -public class PropertyReferenceNode extends AbstractPropertyNode { - - private String iRefClassName; - - // VALUE.REFERENCE - private boolean iHasValueRef; - - private Object iValue; - - /** - * Ctor. - */ - public PropertyReferenceNode() { - super(PROPERTY_REFERENCE); - } - - @Override - protected void childValueNodeParsed(Node pChild) { - this.iValue = ((ValueReferenceNode) pChild).getValue(); - this.iHasValueRef = true; - } - - @Override - protected String getChildValueNodeNameEnum() { - return VALUE_REFERENCE; - } - - public Object getValue() { - return this.iHasValueRef ? this.iValue : null; - } - - @Override - protected boolean hasValueNode() { - return this.iHasValueRef; - } - - /** - * @param pSession - */ - @Override - protected void specificInit(Attributes pAttribs, SAXSession pSession) { - this.iHasValueRef = false; - this.iRefClassName = getReferenceClass(pAttribs); - } - - @Override - public void testCompletness() { - // - } - - public CIMDataType getType() { - return new CIMDataType(this.iRefClassName != null ? this.iRefClassName : ""); - } - -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1660756 2007-02-22 ebak Embedded object support + * 1689085 2007-04-10 ebak Embedded object enhancements for Pegasus + * 1714878 2007-05-08 ebak Empty string property values are parsed as nulls + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2636 2013-05-08 blaschke-oss Nested embedded instances cause CIMXMLParseException + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMDataType; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; +import org.xml.sax.Attributes; + +/** + *
      + * 
      + * ELEMENT PROPERTY.REFERENCE (QUALIFIER*, (VALUE.REFERENCE)?)
      + * ATTLIST PROPERTY.REFERENCE
      + *   %CIMName; 
      + *   %ReferenceClass; 
      + *   %ClassOrigin;
      + *   %Propagated;
      + * 
      + */ +public class PropertyReferenceNode extends AbstractPropertyNode { + + private String iRefClassName; + + // VALUE.REFERENCE + private boolean iHasValueRef; + + private Object iValue; + + /** + * Ctor. + */ + public PropertyReferenceNode() { + super(PROPERTY_REFERENCE); + } + + @Override + protected void childValueNodeParsed(Node pChild) { + this.iValue = ((ValueReferenceNode) pChild).getValue(); + this.iHasValueRef = true; + } + + @Override + protected String getChildValueNodeNameEnum() { + return VALUE_REFERENCE; + } + + public Object getValue() { + return this.iHasValueRef ? this.iValue : null; + } + + @Override + protected boolean hasValueNode() { + return this.iHasValueRef; + } + + /** + * @param pSession + */ + @Override + protected void specificInit(Attributes pAttribs, SAXSession pSession) { + this.iHasValueRef = false; + this.iRefClassName = getReferenceClass(pAttribs); + } + + @Override + public void testCompletness() { + // + } + + public CIMDataType getType() { + return new CIMDataType(this.iRefClassName != null ? this.iRefClassName : ""); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/QualiDeclNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/QualiDeclNode.java similarity index 80% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/QualiDeclNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/QualiDeclNode.java index b2e4671..4858f34 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/QualiDeclNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/QualiDeclNode.java @@ -1,223 +1,220 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1660756 2007-02-22 ebak Embedded object support - * 1712656 2007-05-04 ebak Correct type identification for SVC CIMOM - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics - * 3511454 2012-03-27 blaschke-oss SAX nodes not reinitialized properly - * 3513353 2012-03-30 blaschke-oss TCK: CIMDataType arrays must have length >= 1 - * 3521119 2012-04-24 blaschke-oss JSR48 1.0.0: remove CIMObjectPath 2/3/4-parm ctors - * 2604 2013-07-01 blaschke-oss SAXException messages should contain node name - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMDataType; -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; -import org.sentrysoftware.wbem.javax.cim.CIMQualifierType; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cim.CIMHelper; -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.CIMObjectFactory; -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - *
      - * ELEMENT QUALIFIER.DECLARATION (SCOPE?, (VALUE | VALUE.ARRAY)?)
      - * ATTLIST QUALIFIER.DECLARATION 
      - * 	%CIMName;               
      - * 	%CIMType;               #REQUIRED
      - * 	ISARRAY    (true|false) #IMPLIED
      - * 	%ArraySize;
      - * 	%QualifierFlavor;
      - * 
      - */ -public class QualiDeclNode extends Node implements TypedIf, ValueIf { - - // child nodes - // SCOPE - private boolean iHasScope; - - private int iScope; - - // VALUE - private String iValueNodeName; - - private Object iValue; - - // attributes - private String iName; - - private CIMDataType iType; - - private int iFlavor; - - /** - * Ctor. - */ - public QualiDeclNode() { - super(QUALIFIER_DECLARATION); - } - - /** - * getName - * - * @return String - */ - public String getName() { - return this.iName; - } - - public CIMDataType getType() { - return this.iType; - } - - /** - * getFlavor - * - * @return int - CIMFlavor bitset - */ - public int getFlavor() { - return this.iFlavor; - } - - /** - * @param pSession - */ - @Override - public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { - this.iHasScope = false; - this.iScope = 0; - this.iValueNodeName = null; - this.iValue = null; - this.iName = getCIMName(pAttribs); - this.iType = getCIMType(pAttribs, true); - this.iFlavor = getQualifierFlavor(pAttribs); - } - - /** - * @param pData - */ - @Override - public void parseData(String pData) { - // no data - } - - @Override - public void testChild(String pNodeNameEnum) throws SAXException { - if (pNodeNameEnum == VALUE || pNodeNameEnum == VALUE_ARRAY) { - if (this.iValueNodeName != null) throw new SAXException("Cannot add " + pNodeNameEnum - + " node, this " + getNodeName() + " node has already got a " - + this.iValueNodeName + " node!"); - } else if (pNodeNameEnum == SCOPE) { - if (this.iHasScope) throw new SAXException("Cannot add " + pNodeNameEnum - + " node, this " + getNodeName() + " node has already got one!"); - } else throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum - + " child node!"); - } - - /** - * Required to handle the output XML of some non-standard CIMOMs like SVC - * which adds the TYPE attribute to the sub VALUE or VALUE.ARRAY XML - * element. - * - * @param pTypedIf - * @throws SAXException - */ - private void setType(TypedIf pTypedIf) throws SAXException { - if (this.iType != null) return; - this.iType = pTypedIf.getType(); - if (this.iType == null) throw new SAXException("Unknown type for Qualifier declaration in " - + getNodeName() + " node!"); - } - - @Override - public void childParsed(Node pChild) throws SAXException { - if (pChild instanceof ScopeNode) { - this.iHasScope = true; - this.iScope = ((ScopeNode) pChild).getScope(); - } else { - this.iValueNodeName = pChild.getNodeName(); - if (pChild instanceof ValueArrayNode) { - ValueArrayNode valAChild = (ValueArrayNode) pChild; - setType(valAChild); - this.iValue = CIMObjectFactory.getObject(this.iType, valAChild); - // making array type - if (!this.iType.isArray()) this.iType = CIMHelper.UnboundedArrayDataType(this.iType - .getType()); - } else if (pChild instanceof ValueNode) { - ValueNode valChild = (ValueNode) pChild; - setType(valChild); - this.iValue = CIMObjectFactory.getObject(this.iType, valChild); - } else { - this.iValue = null; - } - } - - } - - @Override - public void testCompletness() throws SAXException { - if (this.iType == null) throw new SAXException("Unknown type for Qualifier declaration in " - + getNodeName() + " node!"); - } - - /** - * getCIMQualifierType - * - * @return CIMQualifierType - */ - public CIMQualifierType getCIMQualifierType() { - /* - * CIMQualifierType( CIMObjectPath pPath, CIMDataType pType, Object - * pValue, int pScope, int pFlavor ) - */ - return new CIMQualifierType(new CIMObjectPath(null, null, null, null, this.iName, - null), this.iType, this.iValue, this.iScope, this.iFlavor); - } - - public Object getValue() { - return getCIMQualifierType(); - } - -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1660756 2007-02-22 ebak Embedded object support + * 1712656 2007-05-04 ebak Correct type identification for SVC CIMOM + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics + * 3511454 2012-03-27 blaschke-oss SAX nodes not reinitialized properly + * 3513353 2012-03-30 blaschke-oss TCK: CIMDataType arrays must have length >= 1 + * 3521119 2012-04-24 blaschke-oss JSR48 1.0.0: remove CIMObjectPath 2/3/4-parm ctors + * 2604 2013-07-01 blaschke-oss SAXException messages should contain node name + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMDataType; +import org.metricshub.wbem.javax.cim.CIMObjectPath; +import org.metricshub.wbem.javax.cim.CIMQualifierType; +import org.metricshub.wbem.sblim.cimclient.internal.cim.CIMHelper; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.CIMObjectFactory; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + *
      + * ELEMENT QUALIFIER.DECLARATION (SCOPE?, (VALUE | VALUE.ARRAY)?)
      + * ATTLIST QUALIFIER.DECLARATION 
      + * 	%CIMName;               
      + * 	%CIMType;               #REQUIRED
      + * 	ISARRAY    (true|false) #IMPLIED
      + * 	%ArraySize;
      + * 	%QualifierFlavor;
      + * 
      + */ +public class QualiDeclNode extends Node implements TypedIf, ValueIf { + + // child nodes + // SCOPE + private boolean iHasScope; + + private int iScope; + + // VALUE + private String iValueNodeName; + + private Object iValue; + + // attributes + private String iName; + + private CIMDataType iType; + + private int iFlavor; + + /** + * Ctor. + */ + public QualiDeclNode() { + super(QUALIFIER_DECLARATION); + } + + /** + * getName + * + * @return String + */ + public String getName() { + return this.iName; + } + + public CIMDataType getType() { + return this.iType; + } + + /** + * getFlavor + * + * @return int - CIMFlavor bitset + */ + public int getFlavor() { + return this.iFlavor; + } + + /** + * @param pSession + */ + @Override + public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { + this.iHasScope = false; + this.iScope = 0; + this.iValueNodeName = null; + this.iValue = null; + this.iName = getCIMName(pAttribs); + this.iType = getCIMType(pAttribs, true); + this.iFlavor = getQualifierFlavor(pAttribs); + } + + /** + * @param pData + */ + @Override + public void parseData(String pData) { + // no data + } + + @Override + public void testChild(String pNodeNameEnum) throws SAXException { + if (pNodeNameEnum == VALUE || pNodeNameEnum == VALUE_ARRAY) { + if (this.iValueNodeName != null) throw new SAXException("Cannot add " + pNodeNameEnum + + " node, this " + getNodeName() + " node has already got a " + + this.iValueNodeName + " node!"); + } else if (pNodeNameEnum == SCOPE) { + if (this.iHasScope) throw new SAXException("Cannot add " + pNodeNameEnum + + " node, this " + getNodeName() + " node has already got one!"); + } else throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum + + " child node!"); + } + + /** + * Required to handle the output XML of some non-standard CIMOMs like SVC + * which adds the TYPE attribute to the sub VALUE or VALUE.ARRAY XML + * element. + * + * @param pTypedIf + * @throws SAXException + */ + private void setType(TypedIf pTypedIf) throws SAXException { + if (this.iType != null) return; + this.iType = pTypedIf.getType(); + if (this.iType == null) throw new SAXException("Unknown type for Qualifier declaration in " + + getNodeName() + " node!"); + } + + @Override + public void childParsed(Node pChild) throws SAXException { + if (pChild instanceof ScopeNode) { + this.iHasScope = true; + this.iScope = ((ScopeNode) pChild).getScope(); + } else { + this.iValueNodeName = pChild.getNodeName(); + if (pChild instanceof ValueArrayNode) { + ValueArrayNode valAChild = (ValueArrayNode) pChild; + setType(valAChild); + this.iValue = CIMObjectFactory.getObject(this.iType, valAChild); + // making array type + if (!this.iType.isArray()) this.iType = CIMHelper.UnboundedArrayDataType(this.iType + .getType()); + } else if (pChild instanceof ValueNode) { + ValueNode valChild = (ValueNode) pChild; + setType(valChild); + this.iValue = CIMObjectFactory.getObject(this.iType, valChild); + } else { + this.iValue = null; + } + } + + } + + @Override + public void testCompletness() throws SAXException { + if (this.iType == null) throw new SAXException("Unknown type for Qualifier declaration in " + + getNodeName() + " node!"); + } + + /** + * getCIMQualifierType + * + * @return CIMQualifierType + */ + public CIMQualifierType getCIMQualifierType() { + /* + * CIMQualifierType( CIMObjectPath pPath, CIMDataType pType, Object + * pValue, int pScope, int pFlavor ) + */ + return new CIMQualifierType(new CIMObjectPath(null, null, null, null, this.iName, + null), this.iType, this.iValue, this.iScope, this.iFlavor); + } + + public Object getValue() { + return getCIMQualifierType(); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/QualifiedNodeHandler.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/QualifiedNodeHandler.java similarity index 80% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/QualifiedNodeHandler.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/QualifiedNodeHandler.java index 01ac197..db2dc73 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/QualifiedNodeHandler.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/QualifiedNodeHandler.java @@ -1,200 +1,197 @@ -/* - (C) Copyright IBM Corp. 2006, 2012 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1660756 2007-02-22 ebak Embedded object support - * 1783288 2007-09-10 ebak CIMClass.isAssociation() not working for retrieved classes. - * 1820763 2007-10-29 ebak Supporting the EmbeddedInstance qualifier - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2013628 2008-07-30 rgummada SAXException when listing classes - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics - * 2823494 2009-08-03 rgummada Change Boolean constructor to static - * 2957387 2010-03-03 blaschke-oss EmbededObject XML attribute must not be all uppercases - * 3511454 2012-03-27 blaschke-oss SAX nodes not reinitialized properly - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.ArrayList; - -import org.sentrysoftware.wbem.javax.cim.CIMDataType; -import org.sentrysoftware.wbem.javax.cim.CIMQualifier; - -import org.sentrysoftware.wbem.sblim.cimclient.GenericExts; -import org.sentrysoftware.wbem.sblim.cimclient.internal.cim.CIMQualifiedElementInterfaceImpl; - -/** - * Class QualifiedNodeHandler helps parsing XML elements with QUALIFIER child - * elements. - */ -public class QualifiedNodeHandler { - - private static final Boolean TRUE = Boolean.TRUE; - - private ArrayList> iQualiAL; - - private CIMQualifiedElementInterfaceImpl iQualiImpl; - - private boolean iHasEmbObjQuali, iHasEmbInstQuali; - - private boolean iHasKeyQuali, iHasAssocQuali; - - /** - * init - * - * @param pQNH - * - if it's null it returns with a new instance otherwise it - * inits and returns pQNH - * @return a QualifiedNodeHandler instance - */ - public static QualifiedNodeHandler init(QualifiedNodeHandler pQNH) { - if (pQNH == null) pQNH = new QualifiedNodeHandler(); - pQNH.init(); - return pQNH; - } - - /** - * init - for reusing an existing QualifiedNodeHandler instance - */ - public void init() { - this.iQualiAL = GenericExts.initClearArrayList(this.iQualiAL); - this.iHasEmbObjQuali = this.iHasEmbInstQuali = this.iHasKeyQuali = this.iHasAssocQuali = false; - this.iQualiImpl = null; - } - - /** - * addQualifierNode - * - * @param pNode - * @return false if pNode is not instance of QualifierNode - */ - public boolean addQualifierNode(Node pNode) { - if (!(pNode instanceof QualifierNode)) return false; - if (this.iQualiAL == null) this.iQualiAL = new ArrayList>(); - CIMQualifier quali = ((QualifierNode) pNode).getQualifier(); - if (quali != null) { - // check for null, - // because it can be null if child node is not populated - if (CIMDataType.BOOLEAN_T.equals(quali.getDataType()) && TRUE.equals(quali.getValue())) { - if ("EmbeddedObject".equalsIgnoreCase(quali.getName())) { - this.iHasEmbObjQuali = true; - } else if ("KEY".equalsIgnoreCase(quali.getName())) { - this.iHasKeyQuali = true; - } else if ("ASSOCIATION".equalsIgnoreCase(quali.getName())) { - this.iHasAssocQuali = true; - } - } else if (CIMDataType.STRING_T.equals(quali.getDataType()) - && "EMBEDDEDINSTANCE".equalsIgnoreCase(quali.getName())) { - this.iHasEmbInstQuali = true; - } - this.iQualiAL.add(quali); - } - return true; - } - - /** - * getQualis - * - * @return CIMQualifier[] - */ - public CIMQualifier[] getQualis() { - return getQualis(false); - } - - /** - * getQualis - * - * @param pIncludeEmbObj - * @return CIMQualifier[] - */ - public CIMQualifier[] getQualis(boolean pIncludeEmbObj) { - makeQualiImpl(pIncludeEmbObj); - return this.iQualiImpl.getQualifiers(); - } - - /** - * isKeyed - * - * @return boolean - */ - public boolean isKeyed() { - return this.iHasKeyQuali; - } - - /** - * isAssociation - * - * @return boolean - */ - public boolean isAssociation() { - return this.iHasAssocQuali; - } - - /** - * isEmbeddedObject - * - * @return boolean - */ - public boolean isEmbeddedObject() { - return this.iHasEmbObjQuali; - } - - /** - * isEmbeddedInstance - * - * @return boolean - */ - public boolean isEmbeddedInstance() { - return this.iHasEmbInstQuali; - } - - private static final CIMQualifier[] EMPTY_QA = new CIMQualifier[0]; - - private void makeQualiImpl(boolean pIncludeEmbObj) { - if (this.iQualiImpl != null) return; - if (this.iQualiAL == null) { - this.iQualiImpl = new CIMQualifiedElementInterfaceImpl(null); - return; - } - this.iQualiImpl = new CIMQualifiedElementInterfaceImpl(this.iQualiAL.toArray(EMPTY_QA), - this.iHasKeyQuali, pIncludeEmbObj); - this.iQualiAL = null; - } - -} +/* + (C) Copyright IBM Corp. 2006, 2012 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1660756 2007-02-22 ebak Embedded object support + * 1783288 2007-09-10 ebak CIMClass.isAssociation() not working for retrieved classes. + * 1820763 2007-10-29 ebak Supporting the EmbeddedInstance qualifier + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2013628 2008-07-30 rgummada SAXException when listing classes + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics + * 2823494 2009-08-03 rgummada Change Boolean constructor to static + * 2957387 2010-03-03 blaschke-oss EmbededObject XML attribute must not be all uppercases + * 3511454 2012-03-27 blaschke-oss SAX nodes not reinitialized properly + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.ArrayList; + +import org.metricshub.wbem.javax.cim.CIMDataType; +import org.metricshub.wbem.javax.cim.CIMQualifier; +import org.metricshub.wbem.sblim.cimclient.GenericExts; +import org.metricshub.wbem.sblim.cimclient.internal.cim.CIMQualifiedElementInterfaceImpl; + +/** + * Class QualifiedNodeHandler helps parsing XML elements with QUALIFIER child + * elements. + */ +public class QualifiedNodeHandler { + + private static final Boolean TRUE = Boolean.TRUE; + + private ArrayList> iQualiAL; + + private CIMQualifiedElementInterfaceImpl iQualiImpl; + + private boolean iHasEmbObjQuali, iHasEmbInstQuali; + + private boolean iHasKeyQuali, iHasAssocQuali; + + /** + * init + * + * @param pQNH + * - if it's null it returns with a new instance otherwise it + * inits and returns pQNH + * @return a QualifiedNodeHandler instance + */ + public static QualifiedNodeHandler init(QualifiedNodeHandler pQNH) { + if (pQNH == null) pQNH = new QualifiedNodeHandler(); + pQNH.init(); + return pQNH; + } + + /** + * init - for reusing an existing QualifiedNodeHandler instance + */ + public void init() { + this.iQualiAL = GenericExts.initClearArrayList(this.iQualiAL); + this.iHasEmbObjQuali = this.iHasEmbInstQuali = this.iHasKeyQuali = this.iHasAssocQuali = false; + this.iQualiImpl = null; + } + + /** + * addQualifierNode + * + * @param pNode + * @return false if pNode is not instance of QualifierNode + */ + public boolean addQualifierNode(Node pNode) { + if (!(pNode instanceof QualifierNode)) return false; + if (this.iQualiAL == null) this.iQualiAL = new ArrayList>(); + CIMQualifier quali = ((QualifierNode) pNode).getQualifier(); + if (quali != null) { + // check for null, + // because it can be null if child node is not populated + if (CIMDataType.BOOLEAN_T.equals(quali.getDataType()) && TRUE.equals(quali.getValue())) { + if ("EmbeddedObject".equalsIgnoreCase(quali.getName())) { + this.iHasEmbObjQuali = true; + } else if ("KEY".equalsIgnoreCase(quali.getName())) { + this.iHasKeyQuali = true; + } else if ("ASSOCIATION".equalsIgnoreCase(quali.getName())) { + this.iHasAssocQuali = true; + } + } else if (CIMDataType.STRING_T.equals(quali.getDataType()) + && "EMBEDDEDINSTANCE".equalsIgnoreCase(quali.getName())) { + this.iHasEmbInstQuali = true; + } + this.iQualiAL.add(quali); + } + return true; + } + + /** + * getQualis + * + * @return CIMQualifier[] + */ + public CIMQualifier[] getQualis() { + return getQualis(false); + } + + /** + * getQualis + * + * @param pIncludeEmbObj + * @return CIMQualifier[] + */ + public CIMQualifier[] getQualis(boolean pIncludeEmbObj) { + makeQualiImpl(pIncludeEmbObj); + return this.iQualiImpl.getQualifiers(); + } + + /** + * isKeyed + * + * @return boolean + */ + public boolean isKeyed() { + return this.iHasKeyQuali; + } + + /** + * isAssociation + * + * @return boolean + */ + public boolean isAssociation() { + return this.iHasAssocQuali; + } + + /** + * isEmbeddedObject + * + * @return boolean + */ + public boolean isEmbeddedObject() { + return this.iHasEmbObjQuali; + } + + /** + * isEmbeddedInstance + * + * @return boolean + */ + public boolean isEmbeddedInstance() { + return this.iHasEmbInstQuali; + } + + private static final CIMQualifier[] EMPTY_QA = new CIMQualifier[0]; + + private void makeQualiImpl(boolean pIncludeEmbObj) { + if (this.iQualiImpl != null) return; + if (this.iQualiAL == null) { + this.iQualiImpl = new CIMQualifiedElementInterfaceImpl(null); + return; + } + this.iQualiImpl = new CIMQualifiedElementInterfaceImpl(this.iQualiAL.toArray(EMPTY_QA), + this.iHasKeyQuali, pIncludeEmbObj); + this.iQualiAL = null; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/QualifierNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/QualifierNode.java similarity index 79% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/QualifierNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/QualifierNode.java index e23b8f0..7090da9 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/QualifierNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/QualifierNode.java @@ -1,189 +1,186 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1660756 2007-02-22 ebak Embedded object support - * 1712656 2007-05-04 ebak Correct type identification for SVC CIMOM - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 1737141 2007-06-18 ebak Sync up with JSR48 evolution - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2013628 2008-07-30 rgummada SAXException when listing classes - * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics - * 3513353 2012-03-30 blaschke-oss TCK: CIMDataType arrays must have length >= 1 - * 2604 2013-07-01 blaschke-oss SAXException messages should contain node name - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMDataType; -import org.sentrysoftware.wbem.javax.cim.CIMQualifier; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cim.CIMHelper; -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.CIMObjectFactory; -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - *
      - * ELEMENT QUALIFIER ((VALUE | VALUE.ARRAY)?)
      - * ATTLIST QUALIFIER 
      - *  %CIMName;
      - *  %CIMType;              #REQUIRED
      - *  %Propagated;
      - *  %QualifierFlavor;
      - *  xml:lang   NMTOKEN     #IMPLIED
      - * 
      - */ -public class QualifierNode extends Node { - - private String iName; - - private CIMDataType iType; - - private boolean iPropagated; - - private int iFlavor; - - // (VALUE | VALUE.ARRAY) - // it can be built when child is available - private CIMQualifier iQuali; - - /** - * Ctor. - */ - public QualifierNode() { - super(QUALIFIER); - } - - /** - * @param pSession - */ - @Override - public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { - this.iQuali = null; - this.iName = getCIMName(pAttribs); - /* - * non-standard CIMOM can supply the type info in the sub Node - */ - this.iType = getCIMType(pAttribs, true); - - this.iPropagated = getPropagated(pAttribs); - this.iFlavor = getQualifierFlavor(pAttribs); - } - - /** - * @param pData - */ - @Override - public void parseData(String pData) { - // no data - } - - @Override - public void testChild(String pNodeNameEnum) throws SAXException { - if (this.iQuali != null) throw new SAXException(getNodeName() - + " node can have only one VALUE or VALUE.ARRAY child node!"); - if (pNodeNameEnum != VALUE && pNodeNameEnum != VALUE_ARRAY) throw new SAXException( - pNodeNameEnum + " child node is not valid for " + getNodeName() + " node!"); - } - - @Override - public void childParsed(Node pChild) throws SAXException { - AbstractValueNode absValNode = (AbstractValueNode) pChild; - Object value; - CIMDataType type; - if (absValNode instanceof ValueArrayNode) { - ValueArrayNode valANode = (ValueArrayNode) absValNode; - setType(valANode); - // create array value - value = CIMObjectFactory.getObject(this.iType, valANode); - // constructs array type - type = this.iType.isArray() ? this.iType : CIMHelper.UnboundedArrayDataType(this.iType - .getType()); - } else if (absValNode instanceof ValueNode) { - ValueNode valNode = (ValueNode) absValNode; - setType(valNode); - String valueStr = (String) valNode.getValue(); - type = this.iType; - value = CIMObjectFactory.getObject(type, valueStr); - } else { - type = CIMDataType.STRING_T; - value = null; - } - this.iQuali = new CIMQualifier(this.iName, type, value, this.iFlavor, - this.iPropagated); - } - - @Override - public void testCompletness() { - // child node is optional, hence commented to support - // servers that do not implement default value to qualifier node - /* - * if (iQuali == null) throw new SAXException(getNodeName() + " must have a - * VALUE or VALUE.ARRAY child node!"); - */ - } - - /** - * getQualifier - * - * @return CIMQualifier - */ - public CIMQualifier getQualifier() { - return this.iQuali; - } - - /** - * Required to handle the output XML of some non-standard CIMOMs like SVC - * which adds the TYPE attribute to the sub VALUE or VALUE.ARRAY XML - * element. - * - * @param pTypedIf - * @throws SAXException - */ - private void setType(TypedIf pTypedIf) throws SAXException { - if (this.iType != null) return; - this.iType = pTypedIf.getType(); - if (this.iType == null) throw new SAXException("Unknown type for Qualifier declaration in " - + getNodeName() + " node!"); - } - -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1660756 2007-02-22 ebak Embedded object support + * 1712656 2007-05-04 ebak Correct type identification for SVC CIMOM + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 1737141 2007-06-18 ebak Sync up with JSR48 evolution + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2013628 2008-07-30 rgummada SAXException when listing classes + * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics + * 3513353 2012-03-30 blaschke-oss TCK: CIMDataType arrays must have length >= 1 + * 2604 2013-07-01 blaschke-oss SAXException messages should contain node name + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMDataType; +import org.metricshub.wbem.javax.cim.CIMQualifier; +import org.metricshub.wbem.sblim.cimclient.internal.cim.CIMHelper; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.CIMObjectFactory; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + *
      + * ELEMENT QUALIFIER ((VALUE | VALUE.ARRAY)?)
      + * ATTLIST QUALIFIER 
      + *  %CIMName;
      + *  %CIMType;              #REQUIRED
      + *  %Propagated;
      + *  %QualifierFlavor;
      + *  xml:lang   NMTOKEN     #IMPLIED
      + * 
      + */ +public class QualifierNode extends Node { + + private String iName; + + private CIMDataType iType; + + private boolean iPropagated; + + private int iFlavor; + + // (VALUE | VALUE.ARRAY) + // it can be built when child is available + private CIMQualifier iQuali; + + /** + * Ctor. + */ + public QualifierNode() { + super(QUALIFIER); + } + + /** + * @param pSession + */ + @Override + public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { + this.iQuali = null; + this.iName = getCIMName(pAttribs); + /* + * non-standard CIMOM can supply the type info in the sub Node + */ + this.iType = getCIMType(pAttribs, true); + + this.iPropagated = getPropagated(pAttribs); + this.iFlavor = getQualifierFlavor(pAttribs); + } + + /** + * @param pData + */ + @Override + public void parseData(String pData) { + // no data + } + + @Override + public void testChild(String pNodeNameEnum) throws SAXException { + if (this.iQuali != null) throw new SAXException(getNodeName() + + " node can have only one VALUE or VALUE.ARRAY child node!"); + if (pNodeNameEnum != VALUE && pNodeNameEnum != VALUE_ARRAY) throw new SAXException( + pNodeNameEnum + " child node is not valid for " + getNodeName() + " node!"); + } + + @Override + public void childParsed(Node pChild) throws SAXException { + AbstractValueNode absValNode = (AbstractValueNode) pChild; + Object value; + CIMDataType type; + if (absValNode instanceof ValueArrayNode) { + ValueArrayNode valANode = (ValueArrayNode) absValNode; + setType(valANode); + // create array value + value = CIMObjectFactory.getObject(this.iType, valANode); + // constructs array type + type = this.iType.isArray() ? this.iType : CIMHelper.UnboundedArrayDataType(this.iType + .getType()); + } else if (absValNode instanceof ValueNode) { + ValueNode valNode = (ValueNode) absValNode; + setType(valNode); + String valueStr = (String) valNode.getValue(); + type = this.iType; + value = CIMObjectFactory.getObject(type, valueStr); + } else { + type = CIMDataType.STRING_T; + value = null; + } + this.iQuali = new CIMQualifier(this.iName, type, value, this.iFlavor, + this.iPropagated); + } + + @Override + public void testCompletness() { + // child node is optional, hence commented to support + // servers that do not implement default value to qualifier node + /* + * if (iQuali == null) throw new SAXException(getNodeName() + " must have a + * VALUE or VALUE.ARRAY child node!"); + */ + } + + /** + * getQualifier + * + * @return CIMQualifier + */ + public CIMQualifier getQualifier() { + return this.iQuali; + } + + /** + * Required to handle the output XML of some non-standard CIMOMs like SVC + * which adds the TYPE attribute to the sub VALUE or VALUE.ARRAY XML + * element. + * + * @param pTypedIf + * @throws SAXException + */ + private void setType(TypedIf pTypedIf) throws SAXException { + if (this.iType != null) return; + this.iType = pTypedIf.getType(); + if (this.iType == null) throw new SAXException("Unknown type for Qualifier declaration in " + + getNodeName() + " node!"); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/RetValPipeIf.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/RetValPipeIf.java similarity index 62% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/RetValPipeIf.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/RetValPipeIf.java index 7bda54b..d7e1d98 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/RetValPipeIf.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/RetValPipeIf.java @@ -1,63 +1,61 @@ -/* - (C) Copyright IBM Corp. 2006, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-05 ebak Make SBLIM client JSR48 compliant - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -/** - * RetValPipeIf is a FIFO interface which helps PULL parsing. - */ -public interface RetValPipeIf { - - /** - * getReturnValueCount - * - * @return the currently available return values - */ - public abstract int getReturnValueCount(); - - /** - * readReturnValue - * - * @return a return value Object from a FIFO - */ - public abstract Object readReturnValue(); - -} +/* + (C) Copyright IBM Corp. 2006, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-05 ebak Make SBLIM client JSR48 compliant + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +/** + * RetValPipeIf is a FIFO interface which helps PULL parsing. + */ +public interface RetValPipeIf { + + /** + * getReturnValueCount + * + * @return the currently available return values + */ + public abstract int getReturnValueCount(); + + /** + * readReturnValue + * + * @return a return value Object from a FIFO + */ + public abstract Object readReturnValue(); + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ReturnValueNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ReturnValueNode.java similarity index 77% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ReturnValueNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ReturnValueNode.java index efe742f..2dc244f 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ReturnValueNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ReturnValueNode.java @@ -1,145 +1,142 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1660756 2007-02-22 ebak Embedded object support - * 1689085 2007-04-10 ebak Embedded object enhancements for Pegasus - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 1742873 2007-06-25 ebak IPv6 ready cim-client - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 3194700 2011-03-01 blaschke-oss Exception thrown on extrinsic methods - * 3602604 2013-01-29 blaschke-oss Clean up SAXException messages - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMDataType; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.EmbObjHandler; -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - *
      - * ELEMENT RETURNVALUE (VALUE | VALUE.REFERENCE)?
      - * ATTLIST RETURNVALUE
      - *   %ParamType;       #IMPLIED
      - *   %EmbeddedObject;  #IMPLIED - new
      - * 
      - */ -public class ReturnValueNode extends Node implements TypedIf, ValueIf { - - private EmbObjHandler iEmbObjHandler; - - private CIMDataType iType; - - // (VALUE | VALUE.REFERENCE) - private boolean iHasValue; - - private Object iValue; - - /** - * Ctor. - */ - public ReturnValueNode() { - super(RETURNVALUE); - } - - @Override - public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { - this.iType = null; - this.iValue = null; - this.iEmbObjHandler = EmbObjHandler.init(this.iEmbObjHandler, getNodeName(), pAttribs, - pSession, null, true); - this.iHasValue = false; - } - - /** - * @param pData - */ - @Override - public void parseData(String pData) { - // no data - } - - @Override - public void testChild(String pNodeNameEnum) throws SAXException { - if (pNodeNameEnum == VALUE || pNodeNameEnum == VALUE_REFERENCE) { - if (this.iHasValue) throw new SAXException(getNodeName() - + " node can have only one child node!"); - } else throw new SAXException(pNodeNameEnum + " cannot be the child node of " - + getNodeName() + " node!"); - } - - @Override - public void childParsed(Node pChild) throws SAXException { - AbstractValueNode valNode = (AbstractValueNode) pChild; - if (valNode instanceof ValueReferenceNode) { - if (this.iType != null && this.iType.getType() != CIMDataType.REFERENCE) throw new SAXException( - getNodeName() + " node's child node is VALUE.REFERENCE " - + "but its type based on PARAMTYPE attribute is " + this.iType + "!"); - ValueReferenceNode valRefNode = (ValueReferenceNode) valNode; - this.iValue = valRefNode.getCIMObjectPath(); - this.iType = valRefNode.getType(); - } else { // VALUE node - this.iEmbObjHandler.addValueNode((ValueNode) pChild); - } - this.iHasValue = true; - } - - @Override - public void testCompletness() throws SAXException { - // DSP0203 v2.3 changed these from required to optional - // if (!this.iHasValue) throw new SAXException(getNodeName() - // + " node must have a VALUE or VALUE.REFERENCE child node!"); - if (this.iType == null) { - this.iType = this.iEmbObjHandler.getType(); - this.iValue = this.iEmbObjHandler.getValue(); - } - } - - public CIMDataType getType() { - return this.iType; - } - - public Object getValue() { - return this.iValue; - } - -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1660756 2007-02-22 ebak Embedded object support + * 1689085 2007-04-10 ebak Embedded object enhancements for Pegasus + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 1742873 2007-06-25 ebak IPv6 ready cim-client + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 3194700 2011-03-01 blaschke-oss Exception thrown on extrinsic methods + * 3602604 2013-01-29 blaschke-oss Clean up SAXException messages + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMDataType; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.EmbObjHandler; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + *
      + * ELEMENT RETURNVALUE (VALUE | VALUE.REFERENCE)?
      + * ATTLIST RETURNVALUE
      + *   %ParamType;       #IMPLIED
      + *   %EmbeddedObject;  #IMPLIED - new
      + * 
      + */ +public class ReturnValueNode extends Node implements TypedIf, ValueIf { + + private EmbObjHandler iEmbObjHandler; + + private CIMDataType iType; + + // (VALUE | VALUE.REFERENCE) + private boolean iHasValue; + + private Object iValue; + + /** + * Ctor. + */ + public ReturnValueNode() { + super(RETURNVALUE); + } + + @Override + public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { + this.iType = null; + this.iValue = null; + this.iEmbObjHandler = EmbObjHandler.init(this.iEmbObjHandler, getNodeName(), pAttribs, + pSession, null, true); + this.iHasValue = false; + } + + /** + * @param pData + */ + @Override + public void parseData(String pData) { + // no data + } + + @Override + public void testChild(String pNodeNameEnum) throws SAXException { + if (pNodeNameEnum == VALUE || pNodeNameEnum == VALUE_REFERENCE) { + if (this.iHasValue) throw new SAXException(getNodeName() + + " node can have only one child node!"); + } else throw new SAXException(pNodeNameEnum + " cannot be the child node of " + + getNodeName() + " node!"); + } + + @Override + public void childParsed(Node pChild) throws SAXException { + AbstractValueNode valNode = (AbstractValueNode) pChild; + if (valNode instanceof ValueReferenceNode) { + if (this.iType != null && this.iType.getType() != CIMDataType.REFERENCE) throw new SAXException( + getNodeName() + " node's child node is VALUE.REFERENCE " + + "but its type based on PARAMTYPE attribute is " + this.iType + "!"); + ValueReferenceNode valRefNode = (ValueReferenceNode) valNode; + this.iValue = valRefNode.getCIMObjectPath(); + this.iType = valRefNode.getType(); + } else { // VALUE node + this.iEmbObjHandler.addValueNode((ValueNode) pChild); + } + this.iHasValue = true; + } + + @Override + public void testCompletness() throws SAXException { + // DSP0203 v2.3 changed these from required to optional + // if (!this.iHasValue) throw new SAXException(getNodeName() + // + " node must have a VALUE or VALUE.REFERENCE child node!"); + if (this.iType == null) { + this.iType = this.iEmbObjHandler.getType(); + this.iValue = this.iEmbObjHandler.getValue(); + } + } + + public CIMDataType getType() { + return this.iType; + } + + public Object getValue() { + return this.iValue; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ScopeNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ScopeNode.java similarity index 75% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ScopeNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ScopeNode.java index c8a1061..465b28c 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ScopeNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ScopeNode.java @@ -1,130 +1,128 @@ -/* - (C) Copyright IBM Corp. 2006, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1660756 2007-02-22 ebak Embedded object support - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMScope; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - *
      - * ELEMENT SCOPE EMPTY
      - * ATTLIST SCOPE
      - *     CLASS (true | false) "false"
      - *     ASSOCIATION (true | false) "false"
      - *     REFERENCE (true | false) "false"
      - *     PROPERTY (true | false) "false"
      - *     METHOD (true | false) "false"
      - *     PARAMETER (true | false) "false"
      - *     INDICATION (true | false) "false"
      - * 
      - */ -public class ScopeNode extends Node { - - private int iScope; - - /** - * Ctor. - */ - public ScopeNode() { - super(SCOPE); - } - - /** - * getScope - * - * @return int - set of CIMScope bits - */ - public int getScope() { - return this.iScope; - } - - /** - * @param pSession - */ - @Override - public void init(Attributes pAttribs, SAXSession pSession) { - this.iScope = 0; - if (hasTrueAttribute(pAttribs, "CLASS")) this.iScope |= CIMScope.CLASS; - if (hasTrueAttribute(pAttribs, "ASSOCIATION")) this.iScope |= CIMScope.ASSOCIATION; - if (hasTrueAttribute(pAttribs, "REFERENCE")) this.iScope |= CIMScope.REFERENCE; - if (hasTrueAttribute(pAttribs, "PROPERTY")) this.iScope |= CIMScope.PROPERTY; - if (hasTrueAttribute(pAttribs, "METHOD")) this.iScope |= CIMScope.METHOD; - if (hasTrueAttribute(pAttribs, "PARAMETER")) this.iScope |= CIMScope.PARAMETER; - if (hasTrueAttribute(pAttribs, "INDICATION")) this.iScope |= CIMScope.INDICATION; - } - - /** - * @param pData - */ - @Override - public void parseData(String pData) { - // no data - } - - /** - * @param pNodeNameEnum - */ - @Override - public void testChild(String pNodeNameEnum) throws SAXException { - throw new SAXException("SCOPE node cannot have any child node!"); - } - - /** - * @param pChild - */ - @Override - public void childParsed(Node pChild) { - // no child - } - - @Override - public void testCompletness() { - // Nothing to test, since it doesn't have any child node. - } - -} +/* + (C) Copyright IBM Corp. 2006, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1660756 2007-02-22 ebak Embedded object support + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMScope; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + *
      + * ELEMENT SCOPE EMPTY
      + * ATTLIST SCOPE
      + *     CLASS (true | false) "false"
      + *     ASSOCIATION (true | false) "false"
      + *     REFERENCE (true | false) "false"
      + *     PROPERTY (true | false) "false"
      + *     METHOD (true | false) "false"
      + *     PARAMETER (true | false) "false"
      + *     INDICATION (true | false) "false"
      + * 
      + */ +public class ScopeNode extends Node { + + private int iScope; + + /** + * Ctor. + */ + public ScopeNode() { + super(SCOPE); + } + + /** + * getScope + * + * @return int - set of CIMScope bits + */ + public int getScope() { + return this.iScope; + } + + /** + * @param pSession + */ + @Override + public void init(Attributes pAttribs, SAXSession pSession) { + this.iScope = 0; + if (hasTrueAttribute(pAttribs, "CLASS")) this.iScope |= CIMScope.CLASS; + if (hasTrueAttribute(pAttribs, "ASSOCIATION")) this.iScope |= CIMScope.ASSOCIATION; + if (hasTrueAttribute(pAttribs, "REFERENCE")) this.iScope |= CIMScope.REFERENCE; + if (hasTrueAttribute(pAttribs, "PROPERTY")) this.iScope |= CIMScope.PROPERTY; + if (hasTrueAttribute(pAttribs, "METHOD")) this.iScope |= CIMScope.METHOD; + if (hasTrueAttribute(pAttribs, "PARAMETER")) this.iScope |= CIMScope.PARAMETER; + if (hasTrueAttribute(pAttribs, "INDICATION")) this.iScope |= CIMScope.INDICATION; + } + + /** + * @param pData + */ + @Override + public void parseData(String pData) { + // no data + } + + /** + * @param pNodeNameEnum + */ + @Override + public void testChild(String pNodeNameEnum) throws SAXException { + throw new SAXException("SCOPE node cannot have any child node!"); + } + + /** + * @param pChild + */ + @Override + public void childParsed(Node pChild) { + // no child + } + + @Override + public void testCompletness() { + // Nothing to test, since it doesn't have any child node. + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/SimpleExpReqNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/SimpleExpReqNode.java similarity index 74% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/SimpleExpReqNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/SimpleExpReqNode.java index 6469e0d..2c99bb2 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/SimpleExpReqNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/SimpleExpReqNode.java @@ -1,108 +1,106 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1660756 2007-02-22 ebak Embedded object support - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 3511454 2012-03-27 blaschke-oss SAX nodes not reinitialized properly - * 2538 2013-11-28 blaschke-oss CR14: Support new CORRELATOR element - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - * ELEMENT SIMPLEEXPREQ (CORRELATOR*, EXPMETHODCALL) - */ -public class SimpleExpReqNode extends AbstractMessageNode { - - private ExpMethodCallNode iMethodCallNode; - - /** - * Ctor. - */ - public SimpleExpReqNode() { - super(SIMPLEEXPREQ); - } - - public void addChild(Node pChild) { - if (pChild instanceof ExpMethodCallNode) { - this.iMethodCallNode = (ExpMethodCallNode) pChild; - } else if (pChild instanceof CorrelatorNode) { - // TODO: return to WBEMClient API if JSR48 changes - } - } - - /** - * @param pAttribs - * @param pSession - */ - @Override - public void init(Attributes pAttribs, SAXSession pSession) { - this.iMethodCallNode = null; - // no attributes - } - - /** - * @param pData - */ - @Override - public void parseData(String pData) { - // no data - } - - @Override - public void testChild(String pNodeNameEnum) throws SAXException { - if (pNodeNameEnum == EXPMETHODCALL) { - if (this.iMethodCallNode != null) throw new SAXException(getNodeName() - + " node can have only one child node!"); - } else if (pNodeNameEnum != CORRELATOR) throw new SAXException(getNodeName() - + " node cannot have " + pNodeNameEnum + " child node!"); - } - - @Override - public void testCompletness() throws SAXException { - if (this.iMethodCallNode == null) throw new SAXException(getNodeName() - + " node must have a child node!"); - } - -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1660756 2007-02-22 ebak Embedded object support + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 3511454 2012-03-27 blaschke-oss SAX nodes not reinitialized properly + * 2538 2013-11-28 blaschke-oss CR14: Support new CORRELATOR element + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + * ELEMENT SIMPLEEXPREQ (CORRELATOR*, EXPMETHODCALL) + */ +public class SimpleExpReqNode extends AbstractMessageNode { + + private ExpMethodCallNode iMethodCallNode; + + /** + * Ctor. + */ + public SimpleExpReqNode() { + super(SIMPLEEXPREQ); + } + + public void addChild(Node pChild) { + if (pChild instanceof ExpMethodCallNode) { + this.iMethodCallNode = (ExpMethodCallNode) pChild; + } else if (pChild instanceof CorrelatorNode) { + // TODO: return to WBEMClient API if JSR48 changes + } + } + + /** + * @param pAttribs + * @param pSession + */ + @Override + public void init(Attributes pAttribs, SAXSession pSession) { + this.iMethodCallNode = null; + // no attributes + } + + /** + * @param pData + */ + @Override + public void parseData(String pData) { + // no data + } + + @Override + public void testChild(String pNodeNameEnum) throws SAXException { + if (pNodeNameEnum == EXPMETHODCALL) { + if (this.iMethodCallNode != null) throw new SAXException(getNodeName() + + " node can have only one child node!"); + } else if (pNodeNameEnum != CORRELATOR) throw new SAXException(getNodeName() + + " node cannot have " + pNodeNameEnum + " child node!"); + } + + @Override + public void testCompletness() throws SAXException { + if (this.iMethodCallNode == null) throw new SAXException(getNodeName() + + " node must have a child node!"); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/SimpleExpRspNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/SimpleExpRspNode.java similarity index 75% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/SimpleExpRspNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/SimpleExpRspNode.java index d097f89..15f3724 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/SimpleExpRspNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/SimpleExpRspNode.java @@ -1,132 +1,129 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1660756 2007-02-22 ebak Embedded object support - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics - * 3511454 2012-03-27 blaschke-oss SAX nodes not reinitialized properly - * 3602604 2013-01-29 blaschke-oss Clean up SAXException messages - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMArgument; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.CIMError; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - *
      - * ELEMENT SIMPLEEXPRSP (EXPMETHODRESPONSE)
      - * ELEMENT EXPMETHODRESPONSE (ERROR|IRETURNVALUE?)
      - * 
      - */ -public class SimpleExpRspNode extends AbstractSimpleRspNode { - - private ExpMethodResponseNode iExpMethodRspNode; - - /** - * Ctor. - */ - public SimpleExpRspNode() { - super(SIMPLEEXPRSP); - } - - public void addChild(Node pChild) { - this.iExpMethodRspNode = (ExpMethodResponseNode) pChild; - } - - /** - * @param pAttribs - * @param pSession - */ - @Override - public void init(Attributes pAttribs, SAXSession pSession) { - this.iExpMethodRspNode = null; - // no attribs - } - - /** - * @param pData - */ - @Override - public void parseData(String pData) { - // no data - } - - @Override - public void testChild(String pNodeNameEnum) throws SAXException { - if (this.iExpMethodRspNode != null) throw new SAXException(getNodeName() - + " node can have only one child node!"); - if (pNodeNameEnum != EXPMETHODRESPONSE) throw new SAXException(getNodeName() - + " node's child node can be EXPMETHODRESPONSE only! " + pNodeNameEnum - + " is invalid!"); - } - - @Override - public void testCompletness() throws SAXException { - if (this.iExpMethodRspNode == null) throw new SAXException(getNodeName() - + " node must have an EXPMETHODRESPONSE child node!"); - } - - @Override - public CIMError getCIMError() { - // can be null if it's value was read out before - if (this.iExpMethodRspNode == null) return null; - return this.iExpMethodRspNode.getCIMError(); - } - - @Override - public CIMArgument[] getCIMArguments() { - // no out arguments - return null; - } - - public int getReturnValueCount() { - return this.iExpMethodRspNode == null ? 0 : this.iExpMethodRspNode.getReturnValueCount(); - } - - public Object readReturnValue() { - return this.iExpMethodRspNode == null ? null : this.iExpMethodRspNode.readReturnValue(); - } - -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1660756 2007-02-22 ebak Embedded object support + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics + * 3511454 2012-03-27 blaschke-oss SAX nodes not reinitialized properly + * 3602604 2013-01-29 blaschke-oss Clean up SAXException messages + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMArgument; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; +import org.metricshub.wbem.sblim.cimclient.internal.wbem.CIMError; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + *
      + * ELEMENT SIMPLEEXPRSP (EXPMETHODRESPONSE)
      + * ELEMENT EXPMETHODRESPONSE (ERROR|IRETURNVALUE?)
      + * 
      + */ +public class SimpleExpRspNode extends AbstractSimpleRspNode { + + private ExpMethodResponseNode iExpMethodRspNode; + + /** + * Ctor. + */ + public SimpleExpRspNode() { + super(SIMPLEEXPRSP); + } + + public void addChild(Node pChild) { + this.iExpMethodRspNode = (ExpMethodResponseNode) pChild; + } + + /** + * @param pAttribs + * @param pSession + */ + @Override + public void init(Attributes pAttribs, SAXSession pSession) { + this.iExpMethodRspNode = null; + // no attribs + } + + /** + * @param pData + */ + @Override + public void parseData(String pData) { + // no data + } + + @Override + public void testChild(String pNodeNameEnum) throws SAXException { + if (this.iExpMethodRspNode != null) throw new SAXException(getNodeName() + + " node can have only one child node!"); + if (pNodeNameEnum != EXPMETHODRESPONSE) throw new SAXException(getNodeName() + + " node's child node can be EXPMETHODRESPONSE only! " + pNodeNameEnum + + " is invalid!"); + } + + @Override + public void testCompletness() throws SAXException { + if (this.iExpMethodRspNode == null) throw new SAXException(getNodeName() + + " node must have an EXPMETHODRESPONSE child node!"); + } + + @Override + public CIMError getCIMError() { + // can be null if it's value was read out before + if (this.iExpMethodRspNode == null) return null; + return this.iExpMethodRspNode.getCIMError(); + } + + @Override + public CIMArgument[] getCIMArguments() { + // no out arguments + return null; + } + + public int getReturnValueCount() { + return this.iExpMethodRspNode == null ? 0 : this.iExpMethodRspNode.getReturnValueCount(); + } + + public Object readReturnValue() { + return this.iExpMethodRspNode == null ? null : this.iExpMethodRspNode.readReturnValue(); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/SimpleReqNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/SimpleReqNode.java similarity index 76% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/SimpleReqNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/SimpleReqNode.java index 3003998..442fcf9 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/SimpleReqNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/SimpleReqNode.java @@ -1,122 +1,120 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1660756 2007-02-22 ebak Embedded object support - * 1686000 2007-04-20 ebak modifyInstance() missing from WBEMClient - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 3511454 2012-03-27 blaschke-oss SAX nodes not reinitialized properly - * 2712 2013-11-14 blaschke-oss SimpleReqNode allows any CIM element as child - * 2538 2013-11-28 blaschke-oss CR14: Support new CORRELATOR element - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - * ELEMENT SIMPLEREQ (CORRELATOR*, (METHODCALL | IMETHODCALL)) - */ -public class SimpleReqNode extends AbstractMessageNode { - - private AbstractMethodCallNode iMethodCallNode; - - /** - * Ctor. - */ - public SimpleReqNode() { - super(SIMPLEREQ); - } - - public void addChild(Node pChild) { - if (pChild instanceof AbstractMethodCallNode) { - this.iMethodCallNode = (AbstractMethodCallNode) pChild; - } else if (pChild instanceof CorrelatorNode) { - // TODO: return to WBEMClient API if JSR48 changes - } - } - - /** - * @param pAttribs - * @param pSession - */ - @Override - public void init(Attributes pAttribs, SAXSession pSession) { - this.iMethodCallNode = null; - // no attributes - } - - /** - * @param pData - */ - @Override - public void parseData(String pData) { - // no data - } - - /** - * @param pNodeNameEnum - */ - @Override - public void testChild(String pNodeNameEnum) throws SAXException { - if (pNodeNameEnum == IMETHODCALL || pNodeNameEnum == METHODCALL) { - if (this.iMethodCallNode != null) throw new SAXException( - "SIMPLEREQ node can have only one child node!"); - } else if (pNodeNameEnum != CORRELATOR) throw new SAXException( - "SIMPLEREQ node cannot have " + pNodeNameEnum + " child node!"); - } - - @Override - public void testCompletness() throws SAXException { - if (this.iMethodCallNode == null) throw new SAXException( - "SIMPLEREQ node must have a child node!"); - } - - /** - * getAbstractMethodCallNode - * - * @return AbstractMethodCallNode - */ - public AbstractMethodCallNode getAbstractMethodCallNode() { - return this.iMethodCallNode; - } - -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1660756 2007-02-22 ebak Embedded object support + * 1686000 2007-04-20 ebak modifyInstance() missing from WBEMClient + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 3511454 2012-03-27 blaschke-oss SAX nodes not reinitialized properly + * 2712 2013-11-14 blaschke-oss SimpleReqNode allows any CIM element as child + * 2538 2013-11-28 blaschke-oss CR14: Support new CORRELATOR element + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + * ELEMENT SIMPLEREQ (CORRELATOR*, (METHODCALL | IMETHODCALL)) + */ +public class SimpleReqNode extends AbstractMessageNode { + + private AbstractMethodCallNode iMethodCallNode; + + /** + * Ctor. + */ + public SimpleReqNode() { + super(SIMPLEREQ); + } + + public void addChild(Node pChild) { + if (pChild instanceof AbstractMethodCallNode) { + this.iMethodCallNode = (AbstractMethodCallNode) pChild; + } else if (pChild instanceof CorrelatorNode) { + // TODO: return to WBEMClient API if JSR48 changes + } + } + + /** + * @param pAttribs + * @param pSession + */ + @Override + public void init(Attributes pAttribs, SAXSession pSession) { + this.iMethodCallNode = null; + // no attributes + } + + /** + * @param pData + */ + @Override + public void parseData(String pData) { + // no data + } + + /** + * @param pNodeNameEnum + */ + @Override + public void testChild(String pNodeNameEnum) throws SAXException { + if (pNodeNameEnum == IMETHODCALL || pNodeNameEnum == METHODCALL) { + if (this.iMethodCallNode != null) throw new SAXException( + "SIMPLEREQ node can have only one child node!"); + } else if (pNodeNameEnum != CORRELATOR) throw new SAXException( + "SIMPLEREQ node cannot have " + pNodeNameEnum + " child node!"); + } + + @Override + public void testCompletness() throws SAXException { + if (this.iMethodCallNode == null) throw new SAXException( + "SIMPLEREQ node must have a child node!"); + } + + /** + * getAbstractMethodCallNode + * + * @return AbstractMethodCallNode + */ + public AbstractMethodCallNode getAbstractMethodCallNode() { + return this.iMethodCallNode; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/SimpleRspNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/SimpleRspNode.java similarity index 77% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/SimpleRspNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/SimpleRspNode.java index 9c6c913..4218e61 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/SimpleRspNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/SimpleRspNode.java @@ -1,144 +1,141 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1660756 2007-02-22 ebak Embedded object support - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics - * 2845211 2009-08-27 raman_arora Pull Enumeration Feature (SAX Parser) - * 3511454 2012-03-27 blaschke-oss SAX nodes not reinitialized properly - * 2672 2013-09-26 blaschke-oss Remove SIMPLEREQACK support - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMArgument; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.CIMError; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - *
      - * ELEMENT SIMPLERSP (METHODRESPONSE | IMETHODRESPONSE)
      - * 
      - * ELEMENT METHODRESPONSE (ERROR|(RETURNVALUE?,PARAMVALUE*))
      - * ELEMENT IMETHODRESPONSE (ERROR|IRETURNVALUE?) *
      - * 
      - */ -public class SimpleRspNode extends AbstractSimpleRspNode { - - private Node iChildNode; - - /** - * Ctor. - */ - public SimpleRspNode() { - super(SIMPLERSP); - } - - public void addChild(Node pChild) { - this.iChildNode = pChild; - } - - /** - * @param pAttribs - * @param pSession - */ - @Override - public void init(Attributes pAttribs, SAXSession pSession) { - this.iChildNode = null; - // no attributes - } - - /** - * @param pData - */ - @Override - public void parseData(String pData) { - // no data - } - - @Override - public void testChild(String pNodeNameEnum) throws SAXException { - if (this.iChildNode != null) throw new SAXException(getNodeName() - + " node can have only one child node!"); - if (pNodeNameEnum != METHODRESPONSE && pNodeNameEnum != IMETHODRESPONSE) throw new SAXException( - getNodeName() + " node cannot have " + pNodeNameEnum + " child node!"); - } - - @Override - public void testCompletness() throws SAXException { - if (this.iChildNode == null) throw new SAXException(getNodeName() - + " node must have a child node!"); - } - - @Override - public CIMError getCIMError() { - if (this.iChildNode instanceof ErrorIf) { return ((ErrorIf) this.iChildNode).getCIMError(); } - return null; - } - - /** - * getCIMArguments : returns the array of parsed parameters and their values - * : String name, CIMDataType type, Object value - * - * @return CIMArgument<?>[] - */ - @Override - public CIMArgument[] getCIMArguments() { - if (this.iChildNode instanceof MethodResponseNode) return ((MethodResponseNode) this.iChildNode) - .getCIMArguments(); - else if (this.iChildNode instanceof IMethodResponseNode) return ((IMethodResponseNode) this.iChildNode) - .getCIMArguments(); - return null; - } - - public int getReturnValueCount() { - if (this.iChildNode instanceof RetValPipeIf) { return ((RetValPipeIf) this.iChildNode) - .getReturnValueCount(); } - return 0; - } - - public Object readReturnValue() { - return ((RetValPipeIf) this.iChildNode).readReturnValue(); - } - -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1660756 2007-02-22 ebak Embedded object support + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics + * 2845211 2009-08-27 raman_arora Pull Enumeration Feature (SAX Parser) + * 3511454 2012-03-27 blaschke-oss SAX nodes not reinitialized properly + * 2672 2013-09-26 blaschke-oss Remove SIMPLEREQACK support + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMArgument; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; +import org.metricshub.wbem.sblim.cimclient.internal.wbem.CIMError; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + *
      + * ELEMENT SIMPLERSP (METHODRESPONSE | IMETHODRESPONSE)
      + * 
      + * ELEMENT METHODRESPONSE (ERROR|(RETURNVALUE?,PARAMVALUE*))
      + * ELEMENT IMETHODRESPONSE (ERROR|IRETURNVALUE?) *
      + * 
      + */ +public class SimpleRspNode extends AbstractSimpleRspNode { + + private Node iChildNode; + + /** + * Ctor. + */ + public SimpleRspNode() { + super(SIMPLERSP); + } + + public void addChild(Node pChild) { + this.iChildNode = pChild; + } + + /** + * @param pAttribs + * @param pSession + */ + @Override + public void init(Attributes pAttribs, SAXSession pSession) { + this.iChildNode = null; + // no attributes + } + + /** + * @param pData + */ + @Override + public void parseData(String pData) { + // no data + } + + @Override + public void testChild(String pNodeNameEnum) throws SAXException { + if (this.iChildNode != null) throw new SAXException(getNodeName() + + " node can have only one child node!"); + if (pNodeNameEnum != METHODRESPONSE && pNodeNameEnum != IMETHODRESPONSE) throw new SAXException( + getNodeName() + " node cannot have " + pNodeNameEnum + " child node!"); + } + + @Override + public void testCompletness() throws SAXException { + if (this.iChildNode == null) throw new SAXException(getNodeName() + + " node must have a child node!"); + } + + @Override + public CIMError getCIMError() { + if (this.iChildNode instanceof ErrorIf) { return ((ErrorIf) this.iChildNode).getCIMError(); } + return null; + } + + /** + * getCIMArguments : returns the array of parsed parameters and their values + * : String name, CIMDataType type, Object value + * + * @return CIMArgument<?>[] + */ + @Override + public CIMArgument[] getCIMArguments() { + if (this.iChildNode instanceof MethodResponseNode) return ((MethodResponseNode) this.iChildNode) + .getCIMArguments(); + else if (this.iChildNode instanceof IMethodResponseNode) return ((IMethodResponseNode) this.iChildNode) + .getCIMArguments(); + return null; + } + + public int getReturnValueCount() { + if (this.iChildNode instanceof RetValPipeIf) { return ((RetValPipeIf) this.iChildNode) + .getReturnValueCount(); } + return 0; + } + + public Object readReturnValue() { + return ((RetValPipeIf) this.iChildNode).readReturnValue(); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/TypedIf.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/TypedIf.java similarity index 59% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/TypedIf.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/TypedIf.java index 62f19e8..88d3487 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/TypedIf.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/TypedIf.java @@ -1,57 +1,55 @@ -/* - (C) Copyright IBM Corp. 2006, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMDataType; - -/** - * TypedIf is implemented by those classes which can provide a CIMDataType. - */ -public interface TypedIf { - - /** - * getType - * - * @return null if the type is unknown - */ - public CIMDataType getType(); -} +/* + (C) Copyright IBM Corp. 2006, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMDataType; + +/** + * TypedIf is implemented by those classes which can provide a CIMDataType. + */ +public interface TypedIf { + + /** + * getType + * + * @return null if the type is unknown + */ + public CIMDataType getType(); +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueArrayNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueArrayNode.java similarity index 77% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueArrayNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueArrayNode.java index 21ad628..8c5dcf9 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueArrayNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueArrayNode.java @@ -1,157 +1,154 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1660756 2007-02-22 ebak Embedded object support - * 1712656 2007-05-04 ebak Correct type identification for SVC CIMOM - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 1735693 2007-06-12 ebak Empty VALUE.ARRAY elements are parsed as nulls - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 3513353 2012-03-30 blaschke-oss TCK: CIMDataType arrays must have length >= 1 - * 2715 2013-11-26 blaschke-oss Add VALUE.NULL support - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.ArrayList; - -import org.sentrysoftware.wbem.javax.cim.CIMDataType; - -import org.sentrysoftware.wbem.sblim.cimclient.GenericExts; -import org.sentrysoftware.wbem.sblim.cimclient.internal.cim.CIMHelper; -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - * ELEMENT VALUE.ARRAY (VALUE|VALUE.NULL)*
      - * For non-standard CIMOMs the TYPE and PARAMTYPE attributes are handled. - */ -public class ValueArrayNode extends AbstractArrayValueNode { - - // VALUE * - private ArrayList iValueAL; - - private CIMDataType iType; - - /** - * Ctor. - */ - public ValueArrayNode() { - super(VALUE_ARRAY); - } - - /** - * @param pSession - */ - @Override - public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { - this.iValueAL = GenericExts.initClearArrayList(this.iValueAL); - /* - * For supporting non-standard CIMOMs TYPE and PARAMTYPE attributes are - * handled - */ - CIMDataType scalarType = getCIMType(pAttribs, true); - if (scalarType == null) scalarType = getParamType(pAttribs); - // make array type - this.iType = scalarType == null ? null : CIMHelper.UnboundedArrayDataType(scalarType - .getType()); - } - - /** - * @param pData - */ - @Override - public void parseData(String pData) { - // no data - } - - @Override - public void testChild(String pNodeNameEnum) throws SAXException { - if (pNodeNameEnum != VALUE && pNodeNameEnum != VALUE_NULL) throw new SAXException( - "Only VALUE and VALUE.NULL nodes can be added to VALUE.ARRAY nodes but " - + pNodeNameEnum + " found!"); - } - - @Override - public void childParsed(Node pChild) { - if (this.iValueAL == null) this.iValueAL = new ArrayList(); - if (pChild instanceof ValueNode) this.iValueAL.add(((ValueNode) pChild).getValue()); - else if (pChild instanceof ValueNullNode) this.iValueAL.add(null); - } - - @Override - public void testCompletness() { - // Nothing to test, since it is OK if it doesn't have child node. - } - - /** - * @see ArrayIf#elementAt(int) - * @return String value of VALUE child node - */ - public Object elementAt(int pIdx) { - return this.iValueAL.get(pIdx); - } - - public int size() { - return this.iValueAL == null ? 0 : this.iValueAL.size(); - } - - /** - * @see TypedIf#getType() - * @return usually null, because the type is unknown, but can return - * non-null in case of non-standard CIMOM. - */ - public CIMDataType getType() { - return this.iType; - } - - private static final String[] EMPTY_SA = new String[0]; - - /** - * @see ValueIf#getValue() If - * the getType() returns non-null value, the container Node have to - * convert the String into the corresponding Java object. - * @return String[] - */ - public Object getValue() { - return this.iValueAL == null ? EMPTY_SA : this.iValueAL.toArray(EMPTY_SA); - } - -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1660756 2007-02-22 ebak Embedded object support + * 1712656 2007-05-04 ebak Correct type identification for SVC CIMOM + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 1735693 2007-06-12 ebak Empty VALUE.ARRAY elements are parsed as nulls + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 3513353 2012-03-30 blaschke-oss TCK: CIMDataType arrays must have length >= 1 + * 2715 2013-11-26 blaschke-oss Add VALUE.NULL support + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.ArrayList; + +import org.metricshub.wbem.javax.cim.CIMDataType; +import org.metricshub.wbem.sblim.cimclient.GenericExts; +import org.metricshub.wbem.sblim.cimclient.internal.cim.CIMHelper; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + * ELEMENT VALUE.ARRAY (VALUE|VALUE.NULL)*
      + * For non-standard CIMOMs the TYPE and PARAMTYPE attributes are handled. + */ +public class ValueArrayNode extends AbstractArrayValueNode { + + // VALUE * + private ArrayList iValueAL; + + private CIMDataType iType; + + /** + * Ctor. + */ + public ValueArrayNode() { + super(VALUE_ARRAY); + } + + /** + * @param pSession + */ + @Override + public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { + this.iValueAL = GenericExts.initClearArrayList(this.iValueAL); + /* + * For supporting non-standard CIMOMs TYPE and PARAMTYPE attributes are + * handled + */ + CIMDataType scalarType = getCIMType(pAttribs, true); + if (scalarType == null) scalarType = getParamType(pAttribs); + // make array type + this.iType = scalarType == null ? null : CIMHelper.UnboundedArrayDataType(scalarType + .getType()); + } + + /** + * @param pData + */ + @Override + public void parseData(String pData) { + // no data + } + + @Override + public void testChild(String pNodeNameEnum) throws SAXException { + if (pNodeNameEnum != VALUE && pNodeNameEnum != VALUE_NULL) throw new SAXException( + "Only VALUE and VALUE.NULL nodes can be added to VALUE.ARRAY nodes but " + + pNodeNameEnum + " found!"); + } + + @Override + public void childParsed(Node pChild) { + if (this.iValueAL == null) this.iValueAL = new ArrayList(); + if (pChild instanceof ValueNode) this.iValueAL.add(((ValueNode) pChild).getValue()); + else if (pChild instanceof ValueNullNode) this.iValueAL.add(null); + } + + @Override + public void testCompletness() { + // Nothing to test, since it is OK if it doesn't have child node. + } + + /** + * @see ArrayIf#elementAt(int) + * @return String value of VALUE child node + */ + public Object elementAt(int pIdx) { + return this.iValueAL.get(pIdx); + } + + public int size() { + return this.iValueAL == null ? 0 : this.iValueAL.size(); + } + + /** + * @see TypedIf#getType() + * @return usually null, because the type is unknown, but can return + * non-null in case of non-standard CIMOM. + */ + public CIMDataType getType() { + return this.iType; + } + + private static final String[] EMPTY_SA = new String[0]; + + /** + * @see ValueIf#getValue() If + * the getType() returns non-null value, the container Node have to + * convert the String into the corresponding Java object. + * @return String[] + */ + public Object getValue() { + return this.iValueAL == null ? EMPTY_SA : this.iValueAL.toArray(EMPTY_SA); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueIf.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueIf.java similarity index 62% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueIf.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueIf.java index fae702d..0fc079c 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueIf.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueIf.java @@ -1,58 +1,56 @@ -/* - (C) Copyright IBM Corp. 2006, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -/** - * ValueIf should be implemented by Nodes which are able to return JSR48 value - * objects. (like: CIMDataTime, Integer, String, CIMClass, CIMInstance, - * UnsignetInteger8, ...) - * - */ -public interface ValueIf { - - /** - * getValue - * - * @return if type is unknown it returns a String - */ - public Object getValue(); -} +/* + (C) Copyright IBM Corp. 2006, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +/** + * ValueIf should be implemented by Nodes which are able to return JSR48 value + * objects. (like: CIMDataTime, Integer, String, CIMClass, CIMInstance, + * UnsignetInteger8, ...) + * + */ +public interface ValueIf { + + /** + * getValue + * + * @return if type is unknown it returns a String + */ + public Object getValue(); +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueInstanceWithPathNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueInstanceWithPathNode.java similarity index 73% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueInstanceWithPathNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueInstanceWithPathNode.java index e00cbf2..3f7d858 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueInstanceWithPathNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueInstanceWithPathNode.java @@ -1,149 +1,146 @@ -/* - (C) Copyright IBM Corp. 2009, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Ramandeep S Arora, IBM, arorar@us.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 2845211 2009-08-27 raman_arora Pull Enumeration Feature (SAX Parser) - * 3598613 2013-01-11 blaschke-oss different data type in cim instance and cim object path - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMDataType; -import org.sentrysoftware.wbem.javax.cim.CIMInstance; -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cim.CIMHelper; -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.sentrysoftware.wbem.sblim.cimclient.internal.util.WBEMConfiguration; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - *
      - * ELEMENT VALUE.INSTANCEWITHPATH (INSTANCEPATH, INSTANCE)
      - * 
      - * ELEMENT INSTANCEPATH (NAMESPACEPATH,INSTANCENAME)
      - *    
      - * ELEMENT INSTANCE (QUALIFIER*, (PROPERTY | PROPERTY.ARRAY | PROPERTY.REFERENCE)*)
      - * ATTLIST INSTANCE
      - *   %ClassName;
      - *   xml:lang   NMTOKEN      #IMPLIED
      - * 
      - */ -public class ValueInstanceWithPathNode extends AbstractScalarValueNode { - - // INSTANCEPATH - private CIMObjectPath iCIMInstPath; - - // INSTANCE - private CIMInstance iCIMInstance; - - /** - * Ctor. - */ - public ValueInstanceWithPathNode() { - super(VALUE_INSTANCEWITHPATH); - } - - /** - * @param pAttribs - * @param pSession - */ - @Override - public void init(Attributes pAttribs, SAXSession pSession) { - // no attribute - this.iCIMInstPath = null; - this.iCIMInstance = null; - } - - /** - * @param pData - */ - @Override - public void parseData(String pData) { - // no data - } - - @Override - public void testChild(String pNodeNameEnum) throws SAXException { - if (pNodeNameEnum == INSTANCEPATH) { - if (this.iCIMInstPath != null) throw new SAXException( - "VALUE.INSTANCEWITHPATH node can have only one INSTANCEPATH node, but another one was found!"); - } else if (pNodeNameEnum == INSTANCE) { - if (this.iCIMInstance != null) throw new SAXException( - "VALUE.INSTANCEWITHPATH node can have only one INSTANCE node, but another one was found!"); - } else { - throw new SAXException("VALUE.INSTANCEWITHPATH node cannot have " + pNodeNameEnum - + " child node!"); - } - } - - @Override - public void childParsed(Node pChild) { - if (pChild instanceof InstancePathNode) { - this.iCIMInstPath = ((InstancePathNode) pChild).getCIMObjectPath(); - } else { - this.iCIMInstance = ((InstanceNode) pChild).getCIMInstance(); - } - } - - @Override - public void testCompletness() throws SAXException { - if (this.iCIMInstPath == null) throw new SAXException( - "VALUE.INSTANCEWITHPATH node must have an INSTANCEPATH child node!"); - if (this.iCIMInstance == null) throw new SAXException( - "VALUE.INSTANCEWITHPATH node must have an INSTANCE child node!"); - } - - /** - * @see ValueIf#getValue() - * @return CIMInstance - */ - public Object getValue() { - /* - * INSTANCENAME contains the key properties only, INSTANCE contains - * non-key properties too. - */ - if (WBEMConfiguration.getGlobalConfiguration().synchronizeNumericKeyDataTypes()) return CIMHelper - .CIMInstanceWithSynchonizedNumericKeyDataTypes(this.iCIMInstPath, this.iCIMInstance - .getProperties()); - return new CIMInstance(this.iCIMInstPath, this.iCIMInstance.getProperties()); - } - - public CIMDataType getType() { - return CIMDataType.OBJECT_T; - } - -} +/* + (C) Copyright IBM Corp. 2009, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Ramandeep S Arora, IBM, arorar@us.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 2845211 2009-08-27 raman_arora Pull Enumeration Feature (SAX Parser) + * 3598613 2013-01-11 blaschke-oss different data type in cim instance and cim object path + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMDataType; +import org.metricshub.wbem.javax.cim.CIMInstance; +import org.metricshub.wbem.javax.cim.CIMObjectPath; +import org.metricshub.wbem.sblim.cimclient.internal.cim.CIMHelper; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; +import org.metricshub.wbem.sblim.cimclient.internal.util.WBEMConfiguration; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + *
      + * ELEMENT VALUE.INSTANCEWITHPATH (INSTANCEPATH, INSTANCE)
      + * 
      + * ELEMENT INSTANCEPATH (NAMESPACEPATH,INSTANCENAME)
      + *    
      + * ELEMENT INSTANCE (QUALIFIER*, (PROPERTY | PROPERTY.ARRAY | PROPERTY.REFERENCE)*)
      + * ATTLIST INSTANCE
      + *   %ClassName;
      + *   xml:lang   NMTOKEN      #IMPLIED
      + * 
      + */ +public class ValueInstanceWithPathNode extends AbstractScalarValueNode { + + // INSTANCEPATH + private CIMObjectPath iCIMInstPath; + + // INSTANCE + private CIMInstance iCIMInstance; + + /** + * Ctor. + */ + public ValueInstanceWithPathNode() { + super(VALUE_INSTANCEWITHPATH); + } + + /** + * @param pAttribs + * @param pSession + */ + @Override + public void init(Attributes pAttribs, SAXSession pSession) { + // no attribute + this.iCIMInstPath = null; + this.iCIMInstance = null; + } + + /** + * @param pData + */ + @Override + public void parseData(String pData) { + // no data + } + + @Override + public void testChild(String pNodeNameEnum) throws SAXException { + if (pNodeNameEnum == INSTANCEPATH) { + if (this.iCIMInstPath != null) throw new SAXException( + "VALUE.INSTANCEWITHPATH node can have only one INSTANCEPATH node, but another one was found!"); + } else if (pNodeNameEnum == INSTANCE) { + if (this.iCIMInstance != null) throw new SAXException( + "VALUE.INSTANCEWITHPATH node can have only one INSTANCE node, but another one was found!"); + } else { + throw new SAXException("VALUE.INSTANCEWITHPATH node cannot have " + pNodeNameEnum + + " child node!"); + } + } + + @Override + public void childParsed(Node pChild) { + if (pChild instanceof InstancePathNode) { + this.iCIMInstPath = ((InstancePathNode) pChild).getCIMObjectPath(); + } else { + this.iCIMInstance = ((InstanceNode) pChild).getCIMInstance(); + } + } + + @Override + public void testCompletness() throws SAXException { + if (this.iCIMInstPath == null) throw new SAXException( + "VALUE.INSTANCEWITHPATH node must have an INSTANCEPATH child node!"); + if (this.iCIMInstance == null) throw new SAXException( + "VALUE.INSTANCEWITHPATH node must have an INSTANCE child node!"); + } + + /** + * @see ValueIf#getValue() + * @return CIMInstance + */ + public Object getValue() { + /* + * INSTANCENAME contains the key properties only, INSTANCE contains + * non-key properties too. + */ + if (WBEMConfiguration.getGlobalConfiguration().synchronizeNumericKeyDataTypes()) return CIMHelper + .CIMInstanceWithSynchonizedNumericKeyDataTypes(this.iCIMInstPath, this.iCIMInstance + .getProperties()); + return new CIMInstance(this.iCIMInstPath, this.iCIMInstance.getProperties()); + } + + public CIMDataType getType() { + return CIMDataType.OBJECT_T; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueNamedInstanceNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueNamedInstanceNode.java similarity index 76% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueNamedInstanceNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueNamedInstanceNode.java index 790fe3b..dd774be 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueNamedInstanceNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueNamedInstanceNode.java @@ -1,161 +1,158 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1660756 2007-02-22 ebak Embedded object support - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors - * 3598613 2013-01-11 blaschke-oss different data type in cim instance and cim object path - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMDataType; -import org.sentrysoftware.wbem.javax.cim.CIMInstance; -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cim.CIMHelper; -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.sentrysoftware.wbem.sblim.cimclient.internal.util.WBEMConfiguration; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - *
      - * ELEMENT VALUE.NAMEDINSTANCE (INSTANCENAME, INSTANCE)
      - * 
      - * ELEMENT INSTANCENAME (KEYBINDING* | KEYVALUE? | VALUE.REFERENCE?)
      - * ATTLIST INSTANCENAME
      - *   %ClassName;
      - *   
      - * ELEMENT INSTANCE (QUALIFIER*, (PROPERTY | PROPERTY.ARRAY | PROPERTY.REFERENCE)*)
      - * ATTLIST INSTANCE
      - *   %ClassName;
      - *   xml:lang   NMTOKEN      #IMPLIED 
      - * FIXME: Why INSTANCE has qualifiers? CIMInstance doesn't have!
      - * FIXME: InstanceName and instance provides redundant information. Why?
      - * 
      - */ -public class ValueNamedInstanceNode extends AbstractScalarValueNode { - - // INSTANCENAME - private CIMObjectPath iCIMInstPath; - - // INSTANCE - private CIMInstance iCIMInstance; - - /** - * Ctor. - */ - public ValueNamedInstanceNode() { - super(VALUE_NAMEDINSTANCE); - } - - /** - * @param pAttribs - * @param pSession - */ - @Override - public void init(Attributes pAttribs, SAXSession pSession) { - this.iCIMInstPath = null; - this.iCIMInstance = null; - // no attribute - } - - /** - * @param pData - */ - @Override - public void parseData(String pData) { - // no data - } - - @Override - public void testChild(String pNodeNameEnum) throws SAXException { - if (pNodeNameEnum == INSTANCENAME) { - if (this.iCIMInstPath != null) throw new SAXException( - "VALUE.NAMEDINSTANCE node can have only one INSTANCENAME node, but another one was found!"); - } else if (pNodeNameEnum == INSTANCE) { - if (this.iCIMInstance != null) throw new SAXException( - "VALUE.NAMEDINSTANCE node can have only one INSTANCE node, but another one was found!"); - } else { - throw new SAXException("VALUE.NAMEDINSTANCE node cannot have " + pNodeNameEnum - + " child node!"); - } - } - - @Override - public void childParsed(Node pChild) { - if (pChild instanceof InstanceNameNode) { - this.iCIMInstPath = ((InstanceNameNode) pChild).getCIMObjectPath(); - } else { - this.iCIMInstance = ((InstanceNode) pChild).getCIMInstance(); - } - } - - @Override - public void testCompletness() throws SAXException { - if (this.iCIMInstPath == null) throw new SAXException( - "VALUE.NAMEDINSTANCE node must have an INSTANCENAME child node!"); - if (this.iCIMInstance == null) throw new SAXException( - "VALUE.NAMEDINSTANCE node must have an INSTANCE child node!"); - } - - /** - * @see ValueIf#getValue() - * @return CIMInstance - */ - public Object getValue() { - // CIMObjectPath op=iInstanceNameNode.getCIMObjectPath(); - /* - * INSTANCENAME contains the key properties only, INSTANCE contains the - * non-key properties too. - */ - if (WBEMConfiguration.getGlobalConfiguration().synchronizeNumericKeyDataTypes()) return CIMHelper - .CIMInstanceWithSynchonizedNumericKeyDataTypes(this.iCIMInstPath, this.iCIMInstance - .getProperties()); - return new CIMInstance(this.iCIMInstPath, this.iCIMInstance.getProperties()); - } - - public CIMDataType getType() { - return CIMDataType.OBJECT_T; - } - -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1660756 2007-02-22 ebak Embedded object support + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors + * 3598613 2013-01-11 blaschke-oss different data type in cim instance and cim object path + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMDataType; +import org.metricshub.wbem.javax.cim.CIMInstance; +import org.metricshub.wbem.javax.cim.CIMObjectPath; +import org.metricshub.wbem.sblim.cimclient.internal.cim.CIMHelper; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; +import org.metricshub.wbem.sblim.cimclient.internal.util.WBEMConfiguration; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + *
      + * ELEMENT VALUE.NAMEDINSTANCE (INSTANCENAME, INSTANCE)
      + * 
      + * ELEMENT INSTANCENAME (KEYBINDING* | KEYVALUE? | VALUE.REFERENCE?)
      + * ATTLIST INSTANCENAME
      + *   %ClassName;
      + *   
      + * ELEMENT INSTANCE (QUALIFIER*, (PROPERTY | PROPERTY.ARRAY | PROPERTY.REFERENCE)*)
      + * ATTLIST INSTANCE
      + *   %ClassName;
      + *   xml:lang   NMTOKEN      #IMPLIED 
      + * FIXME: Why INSTANCE has qualifiers? CIMInstance doesn't have!
      + * FIXME: InstanceName and instance provides redundant information. Why?
      + * 
      + */ +public class ValueNamedInstanceNode extends AbstractScalarValueNode { + + // INSTANCENAME + private CIMObjectPath iCIMInstPath; + + // INSTANCE + private CIMInstance iCIMInstance; + + /** + * Ctor. + */ + public ValueNamedInstanceNode() { + super(VALUE_NAMEDINSTANCE); + } + + /** + * @param pAttribs + * @param pSession + */ + @Override + public void init(Attributes pAttribs, SAXSession pSession) { + this.iCIMInstPath = null; + this.iCIMInstance = null; + // no attribute + } + + /** + * @param pData + */ + @Override + public void parseData(String pData) { + // no data + } + + @Override + public void testChild(String pNodeNameEnum) throws SAXException { + if (pNodeNameEnum == INSTANCENAME) { + if (this.iCIMInstPath != null) throw new SAXException( + "VALUE.NAMEDINSTANCE node can have only one INSTANCENAME node, but another one was found!"); + } else if (pNodeNameEnum == INSTANCE) { + if (this.iCIMInstance != null) throw new SAXException( + "VALUE.NAMEDINSTANCE node can have only one INSTANCE node, but another one was found!"); + } else { + throw new SAXException("VALUE.NAMEDINSTANCE node cannot have " + pNodeNameEnum + + " child node!"); + } + } + + @Override + public void childParsed(Node pChild) { + if (pChild instanceof InstanceNameNode) { + this.iCIMInstPath = ((InstanceNameNode) pChild).getCIMObjectPath(); + } else { + this.iCIMInstance = ((InstanceNode) pChild).getCIMInstance(); + } + } + + @Override + public void testCompletness() throws SAXException { + if (this.iCIMInstPath == null) throw new SAXException( + "VALUE.NAMEDINSTANCE node must have an INSTANCENAME child node!"); + if (this.iCIMInstance == null) throw new SAXException( + "VALUE.NAMEDINSTANCE node must have an INSTANCE child node!"); + } + + /** + * @see ValueIf#getValue() + * @return CIMInstance + */ + public Object getValue() { + // CIMObjectPath op=iInstanceNameNode.getCIMObjectPath(); + /* + * INSTANCENAME contains the key properties only, INSTANCE contains the + * non-key properties too. + */ + if (WBEMConfiguration.getGlobalConfiguration().synchronizeNumericKeyDataTypes()) return CIMHelper + .CIMInstanceWithSynchonizedNumericKeyDataTypes(this.iCIMInstPath, this.iCIMInstance + .getProperties()); + return new CIMInstance(this.iCIMInstPath, this.iCIMInstance.getProperties()); + } + + public CIMDataType getType() { + return CIMDataType.OBJECT_T; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueNode.java similarity index 75% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueNode.java index 9c08fbe..ca92305 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueNode.java @@ -1,134 +1,131 @@ -/* - (C) Copyright IBM Corp. 2006, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1660756 2007-02-22 ebak Embedded object support - * 1712656 2007-05-04 ebak Correct type identification for SVC CIMOM - * 1714878 2007-05-08 ebak Empty string property values are parsed as nulls - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMDataType; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - * ELEMENT VALUE (#PCDATA)
      - * For non-standard CIMOMs the TYPE and PARAMTYPE attributes are supported. - */ -public class ValueNode extends AbstractScalarValueNode { - - private CIMDataType iType; - - private String iData; - - /** - * Ctor. - */ - public ValueNode() { - super(VALUE); - } - - /** - * @param pSession - */ - @Override - public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { - this.iData = null; - /* - * For supporting non-standard CIMOMs TYPE and PARAMTYPE attributes are - * handled - */ - this.iType = getCIMType(pAttribs, true); - if (this.iType == null) this.iType = getParamType(pAttribs); - } - - @Override - public void parseData(String pData) { - this.iData = pData; - } - - @Override - public void testChild(String pNodeNameEnum) throws SAXException { - throw new SAXException("VALUE node cannot have any child node! (" + pNodeNameEnum + ")"); - } - - /** - * @param pChild - */ - @Override - public void childParsed(Node pChild) { - // no child - } - - @Override - public void testCompletness() { - // no child nodes - } - - /** - * @see ValueIf#getValue() If - * the getType() returns non-null value, the container Node have to - * convert the String into the corresponding Java object. - * @return String - */ - public Object getValue() { - /* - * If iData is null we return empty String. If null values have to be - * represented by avoiding the VALUE element, or placing VALUE.NULLs - * into VALUE.ARRAYs. - */ - return this.iData == null ? "" : this.iData; - } - - /** - * @see TypedIf#getType() - * @return usually null, because the type is unknown, but can return - * non-null in case of non-standard CIMOM. - */ - public CIMDataType getType() { - return this.iType; - } - -} +/* + (C) Copyright IBM Corp. 2006, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1660756 2007-02-22 ebak Embedded object support + * 1712656 2007-05-04 ebak Correct type identification for SVC CIMOM + * 1714878 2007-05-08 ebak Empty string property values are parsed as nulls + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMDataType; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + * ELEMENT VALUE (#PCDATA)
      + * For non-standard CIMOMs the TYPE and PARAMTYPE attributes are supported. + */ +public class ValueNode extends AbstractScalarValueNode { + + private CIMDataType iType; + + private String iData; + + /** + * Ctor. + */ + public ValueNode() { + super(VALUE); + } + + /** + * @param pSession + */ + @Override + public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { + this.iData = null; + /* + * For supporting non-standard CIMOMs TYPE and PARAMTYPE attributes are + * handled + */ + this.iType = getCIMType(pAttribs, true); + if (this.iType == null) this.iType = getParamType(pAttribs); + } + + @Override + public void parseData(String pData) { + this.iData = pData; + } + + @Override + public void testChild(String pNodeNameEnum) throws SAXException { + throw new SAXException("VALUE node cannot have any child node! (" + pNodeNameEnum + ")"); + } + + /** + * @param pChild + */ + @Override + public void childParsed(Node pChild) { + // no child + } + + @Override + public void testCompletness() { + // no child nodes + } + + /** + * @see ValueIf#getValue() If + * the getType() returns non-null value, the container Node have to + * convert the String into the corresponding Java object. + * @return String + */ + public Object getValue() { + /* + * If iData is null we return empty String. If null values have to be + * represented by avoiding the VALUE element, or placing VALUE.NULLs + * into VALUE.ARRAYs. + */ + return this.iData == null ? "" : this.iData; + } + + /** + * @see TypedIf#getType() + * @return usually null, because the type is unknown, but can return + * non-null in case of non-standard CIMOM. + */ + public CIMDataType getType() { + return this.iType; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueNullNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueNullNode.java similarity index 68% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueNullNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueNullNode.java index 6f2d735..32f5069 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueNullNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueNullNode.java @@ -1,116 +1,113 @@ -/* - (C) Copyright IBM Corp. 2006, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1660756 2007-02-22 ebak Embedded object support - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMDataType; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - * ELEMENT VALUE.NULL EMPTY - */ -public class ValueNullNode extends AbstractScalarValueNode { - - /** - * Ctor. - */ - public ValueNullNode() { - super(VALUE_NULL); - } - - /** - * @param pAttribs - * @param pSession - */ - @Override - public void init(Attributes pAttribs, SAXSession pSession) { - // no attributes - } - - /** - * @param pData - */ - @Override - public void parseData(String pData) { - // no data - } - - /** - * @param pNodeNameEnum - */ - @Override - public void testChild(String pNodeNameEnum) throws SAXException { - throw new SAXException("VALUE.NULL node cannot have any child node!"); - } - - /** - * @param pChild - */ - @Override - public void childParsed(Node pChild) { - // no child - } - - @Override - public void testCompletness() { - // nothing to test - } - - /** - * @see ValueIf#getValue() - * @return null - */ - public Object getValue() { - return null; - } - - public CIMDataType getType() { - // type is unknown - return null; - } - -} +/* + (C) Copyright IBM Corp. 2006, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1660756 2007-02-22 ebak Embedded object support + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMDataType; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + * ELEMENT VALUE.NULL EMPTY + */ +public class ValueNullNode extends AbstractScalarValueNode { + + /** + * Ctor. + */ + public ValueNullNode() { + super(VALUE_NULL); + } + + /** + * @param pAttribs + * @param pSession + */ + @Override + public void init(Attributes pAttribs, SAXSession pSession) { + // no attributes + } + + /** + * @param pData + */ + @Override + public void parseData(String pData) { + // no data + } + + /** + * @param pNodeNameEnum + */ + @Override + public void testChild(String pNodeNameEnum) throws SAXException { + throw new SAXException("VALUE.NULL node cannot have any child node!"); + } + + /** + * @param pChild + */ + @Override + public void childParsed(Node pChild) { + // no child + } + + @Override + public void testCompletness() { + // nothing to test + } + + /** + * @see ValueIf#getValue() + * @return null + */ + public Object getValue() { + return null; + } + + public CIMDataType getType() { + // type is unknown + return null; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueObjectNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueObjectNode.java similarity index 74% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueObjectNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueObjectNode.java index 803de02..7f820eb 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueObjectNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueObjectNode.java @@ -1,127 +1,124 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1660756 2007-02-22 ebak Embedded object support - * 1679534 2007-03-13 ebak wrong ValueObjectNode.testChild() - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 3602604 2013-01-29 blaschke-oss Clean up SAXException messages - * 2604 2013-07-01 blaschke-oss SAXException messages should contain node name - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMClass; -import org.sentrysoftware.wbem.javax.cim.CIMDataType; -import org.sentrysoftware.wbem.javax.cim.CIMNamedElementInterface; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - * ELEMENT VALUE.OBJECT (CLASS | INSTANCE) - */ -public class ValueObjectNode extends AbstractScalarValueNode { - - private CIMNamedElementInterface iCIMObject; - - /** - * Ctor. - */ - public ValueObjectNode() { - super(VALUE_OBJECT); - } - - /** - * @param pAttribs - * @param pSession - */ - @Override - public void init(Attributes pAttribs, SAXSession pSession) { - this.iCIMObject = null; - // no attributes - } - - /** - * @param pData - */ - @Override - public void parseData(String pData) { - // no data - } - - @Override - public void testChild(String pNodeNameEnum) throws SAXException { - if (this.iCIMObject != null) throw new SAXException("This " + getNodeName() - + " node can have only one child but an additional " + pNodeNameEnum - + " node found!"); - if (pNodeNameEnum != CLASS && pNodeNameEnum != INSTANCE) throw new SAXException( - getNodeName() + " node child node can be CLASS or INSTANCE but a " + pNodeNameEnum - + " node was found!"); - } - - @Override - public void childParsed(Node pChild) { - AbstractObjectNode objNode = (AbstractObjectNode) pChild; - if (objNode instanceof ClassNode) this.iCIMObject = ((ClassNode) objNode).getCIMClass(); - else this.iCIMObject = ((InstanceNode) objNode).getCIMInstance(); - } - - @Override - public void testCompletness() throws SAXException { - if (this.iCIMObject == null) throw new SAXException( - "VALUE.OBJECT node must have a CLASS or INSTANCE child node!"); - } - - /** - * @seeValueIf#getValue() - * @return CIMClass or CIMInstance - */ - public Object getValue() { - return this.iCIMObject; - } - - public CIMDataType getType() { - if (this.iCIMObject instanceof CIMClass) return CIMDataType.CLASS_T; - return CIMDataType.OBJECT_T; - } - -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1660756 2007-02-22 ebak Embedded object support + * 1679534 2007-03-13 ebak wrong ValueObjectNode.testChild() + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 3602604 2013-01-29 blaschke-oss Clean up SAXException messages + * 2604 2013-07-01 blaschke-oss SAXException messages should contain node name + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMClass; +import org.metricshub.wbem.javax.cim.CIMDataType; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; +import org.metricshub.wbem.javax.cim.CIMNamedElementInterface; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + * ELEMENT VALUE.OBJECT (CLASS | INSTANCE) + */ +public class ValueObjectNode extends AbstractScalarValueNode { + + private CIMNamedElementInterface iCIMObject; + + /** + * Ctor. + */ + public ValueObjectNode() { + super(VALUE_OBJECT); + } + + /** + * @param pAttribs + * @param pSession + */ + @Override + public void init(Attributes pAttribs, SAXSession pSession) { + this.iCIMObject = null; + // no attributes + } + + /** + * @param pData + */ + @Override + public void parseData(String pData) { + // no data + } + + @Override + public void testChild(String pNodeNameEnum) throws SAXException { + if (this.iCIMObject != null) throw new SAXException("This " + getNodeName() + + " node can have only one child but an additional " + pNodeNameEnum + + " node found!"); + if (pNodeNameEnum != CLASS && pNodeNameEnum != INSTANCE) throw new SAXException( + getNodeName() + " node child node can be CLASS or INSTANCE but a " + pNodeNameEnum + + " node was found!"); + } + + @Override + public void childParsed(Node pChild) { + AbstractObjectNode objNode = (AbstractObjectNode) pChild; + if (objNode instanceof ClassNode) this.iCIMObject = ((ClassNode) objNode).getCIMClass(); + else this.iCIMObject = ((InstanceNode) objNode).getCIMInstance(); + } + + @Override + public void testCompletness() throws SAXException { + if (this.iCIMObject == null) throw new SAXException( + "VALUE.OBJECT node must have a CLASS or INSTANCE child node!"); + } + + /** + * @seeValueIf#getValue() + * @return CIMClass or CIMInstance + */ + public Object getValue() { + return this.iCIMObject; + } + + public CIMDataType getType() { + if (this.iCIMObject instanceof CIMClass) return CIMDataType.CLASS_T; + return CIMDataType.OBJECT_T; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueObjectWithLocalPathNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueObjectWithLocalPathNode.java similarity index 79% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueObjectWithLocalPathNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueObjectWithLocalPathNode.java index 8fafce5..91f5ff0 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueObjectWithLocalPathNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueObjectWithLocalPathNode.java @@ -1,162 +1,159 @@ -/* - (C) Copyright IBM Corp. 2006, 2012 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1660756 2007-02-22 ebak Embedded object support - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 3511454 2012-03-27 blaschke-oss SAX nodes not reinitialized properly - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMClass; -import org.sentrysoftware.wbem.javax.cim.CIMDataType; -import org.sentrysoftware.wbem.javax.cim.CIMNamedElementInterface; -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - * ELEMENT VALUE.OBJECTWITHLOCALPATH ((LOCALCLASSPATH, CLASS) | - * (LOCALINSTANCEPATH, INSTANCE)) - */ -public class ValueObjectWithLocalPathNode extends AbstractScalarValueNode { - - // ObjectPath element - private String iPathNodeNameEnum; - - private CIMObjectPath iObjPath; - - // Object element - private String iObjNodeNameEnum; - - private CIMNamedElementInterface iCIMObj; - - /** - * Ctor. - */ - public ValueObjectWithLocalPathNode() { - super(VALUE_OBJECTWITHLOCALPATH); - } - - /** - * @param pAttribs - * @param pSession - */ - @Override - public void init(Attributes pAttribs, SAXSession pSession) { - this.iPathNodeNameEnum = this.iObjNodeNameEnum = null; - this.iObjPath = null; - this.iCIMObj = null; - // no attributes - } - - /** - * @param pData - */ - @Override - public void parseData(String pData) { - // no data - } - - @Override - public void testChild(String pNodeNameEnum) throws SAXException { - if (pNodeNameEnum == LOCALCLASSPATH) { - if (this.iPathNodeNameEnum != null) duplicatedNode(this.iPathNodeNameEnum, - LOCALCLASSPATH); - if (this.iObjNodeNameEnum == INSTANCE) illegalChildNodePair(LOCALCLASSPATH, INSTANCE); - } else if (pNodeNameEnum == CLASS) { - if (this.iObjNodeNameEnum != null) duplicatedNode(this.iObjNodeNameEnum, CLASS); - if (this.iPathNodeNameEnum == LOCALINSTANCEPATH) illegalChildNodePair( - LOCALINSTANCEPATH, CLASS); - } else if (pNodeNameEnum == LOCALINSTANCEPATH) { - if (this.iPathNodeNameEnum != null) duplicatedNode(this.iPathNodeNameEnum, - LOCALINSTANCEPATH); - if (this.iObjNodeNameEnum == CLASS) illegalChildNodePair(LOCALINSTANCEPATH, CLASS); - } else if (pNodeNameEnum == INSTANCE) { - if (this.iObjNodeNameEnum != null) duplicatedNode(this.iObjNodeNameEnum, INSTANCE); - if (this.iPathNodeNameEnum == LOCALCLASSPATH) illegalChildNodePair(LOCALCLASSPATH, - INSTANCE); - } else throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum - + " child!"); - } - - @Override - public void childParsed(Node pChild) throws SAXException { - if (pChild instanceof AbstractObjectPathNode) { - this.iPathNodeNameEnum = pChild.getNodeName(); - this.iObjPath = ((AbstractObjectPathNode) pChild).getCIMObjectPath(); - } else { // ClassNode or InstanceNode, iObjPath must be available - // here - this.iObjNodeNameEnum = pChild.getNodeName(); - if (this.iPathNodeNameEnum == null) throw new SAXException(getNodeName() - + " first child should contain an object path!"); - if (pChild instanceof ClassNode) { - this.iCIMObj = ((ClassNode) pChild).getCIMClass(this.iObjPath); - } else { - this.iCIMObj = ((InstanceNode) pChild).getCIMInstance(this.iObjPath); - } - } - } - - @Override - public void testCompletness() throws SAXException { - if (this.iPathNodeNameEnum == null) throw new SAXException(getNodeName() - + " node must have a LOCALCLASSPATH or a LOCALINSTANCEPATH child node!"); - if (this.iObjNodeNameEnum == null) throw new SAXException(getNodeName() - + " node must have a CLASS or INSTANCE child node!"); - } - - /** - * @see ValueIf#getValue() - * @return CIMClass or CIMInstance - */ - public Object getValue() { - return this.iCIMObj; - } - - public CIMDataType getType() { - if (this.iCIMObj instanceof CIMClass) return CIMDataType.CLASS_T; - return CIMDataType.OBJECT_T; - } - -} +/* + (C) Copyright IBM Corp. 2006, 2012 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1660756 2007-02-22 ebak Embedded object support + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 3511454 2012-03-27 blaschke-oss SAX nodes not reinitialized properly + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMClass; +import org.metricshub.wbem.javax.cim.CIMDataType; +import org.metricshub.wbem.javax.cim.CIMObjectPath; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; +import org.metricshub.wbem.javax.cim.CIMNamedElementInterface; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + * ELEMENT VALUE.OBJECTWITHLOCALPATH ((LOCALCLASSPATH, CLASS) | + * (LOCALINSTANCEPATH, INSTANCE)) + */ +public class ValueObjectWithLocalPathNode extends AbstractScalarValueNode { + + // ObjectPath element + private String iPathNodeNameEnum; + + private CIMObjectPath iObjPath; + + // Object element + private String iObjNodeNameEnum; + + private CIMNamedElementInterface iCIMObj; + + /** + * Ctor. + */ + public ValueObjectWithLocalPathNode() { + super(VALUE_OBJECTWITHLOCALPATH); + } + + /** + * @param pAttribs + * @param pSession + */ + @Override + public void init(Attributes pAttribs, SAXSession pSession) { + this.iPathNodeNameEnum = this.iObjNodeNameEnum = null; + this.iObjPath = null; + this.iCIMObj = null; + // no attributes + } + + /** + * @param pData + */ + @Override + public void parseData(String pData) { + // no data + } + + @Override + public void testChild(String pNodeNameEnum) throws SAXException { + if (pNodeNameEnum == LOCALCLASSPATH) { + if (this.iPathNodeNameEnum != null) duplicatedNode(this.iPathNodeNameEnum, + LOCALCLASSPATH); + if (this.iObjNodeNameEnum == INSTANCE) illegalChildNodePair(LOCALCLASSPATH, INSTANCE); + } else if (pNodeNameEnum == CLASS) { + if (this.iObjNodeNameEnum != null) duplicatedNode(this.iObjNodeNameEnum, CLASS); + if (this.iPathNodeNameEnum == LOCALINSTANCEPATH) illegalChildNodePair( + LOCALINSTANCEPATH, CLASS); + } else if (pNodeNameEnum == LOCALINSTANCEPATH) { + if (this.iPathNodeNameEnum != null) duplicatedNode(this.iPathNodeNameEnum, + LOCALINSTANCEPATH); + if (this.iObjNodeNameEnum == CLASS) illegalChildNodePair(LOCALINSTANCEPATH, CLASS); + } else if (pNodeNameEnum == INSTANCE) { + if (this.iObjNodeNameEnum != null) duplicatedNode(this.iObjNodeNameEnum, INSTANCE); + if (this.iPathNodeNameEnum == LOCALCLASSPATH) illegalChildNodePair(LOCALCLASSPATH, + INSTANCE); + } else throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum + + " child!"); + } + + @Override + public void childParsed(Node pChild) throws SAXException { + if (pChild instanceof AbstractObjectPathNode) { + this.iPathNodeNameEnum = pChild.getNodeName(); + this.iObjPath = ((AbstractObjectPathNode) pChild).getCIMObjectPath(); + } else { // ClassNode or InstanceNode, iObjPath must be available + // here + this.iObjNodeNameEnum = pChild.getNodeName(); + if (this.iPathNodeNameEnum == null) throw new SAXException(getNodeName() + + " first child should contain an object path!"); + if (pChild instanceof ClassNode) { + this.iCIMObj = ((ClassNode) pChild).getCIMClass(this.iObjPath); + } else { + this.iCIMObj = ((InstanceNode) pChild).getCIMInstance(this.iObjPath); + } + } + } + + @Override + public void testCompletness() throws SAXException { + if (this.iPathNodeNameEnum == null) throw new SAXException(getNodeName() + + " node must have a LOCALCLASSPATH or a LOCALINSTANCEPATH child node!"); + if (this.iObjNodeNameEnum == null) throw new SAXException(getNodeName() + + " node must have a CLASS or INSTANCE child node!"); + } + + /** + * @see ValueIf#getValue() + * @return CIMClass or CIMInstance + */ + public Object getValue() { + return this.iCIMObj; + } + + public CIMDataType getType() { + if (this.iCIMObj instanceof CIMClass) return CIMDataType.CLASS_T; + return CIMDataType.OBJECT_T; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueObjectWithPathNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueObjectWithPathNode.java similarity index 78% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueObjectWithPathNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueObjectWithPathNode.java index 22dab7b..4f876fd 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueObjectWithPathNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueObjectWithPathNode.java @@ -1,158 +1,155 @@ -/* - (C) Copyright IBM Corp. 2006, 2012 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1660756 2007-02-22 ebak Embedded object support - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 3511454 2012-03-27 blaschke-oss SAX nodes not reinitialized properly - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMClass; -import org.sentrysoftware.wbem.javax.cim.CIMDataType; -import org.sentrysoftware.wbem.javax.cim.CIMNamedElementInterface; -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - * ELEMENT VALUE.OBJECTWITHPATH ((CLASSPATH, CLASS) | (INSTANCEPATH, INSTANCE)) - */ -public class ValueObjectWithPathNode extends AbstractScalarValueNode { - - // ObjectPath element - private String iPathNodeNameEnum; - - private CIMObjectPath iObjPath; - - // CIMObject element - private String iObjNodeNameEnum; - - private CIMNamedElementInterface iCIMObj; - - /** - * Ctor. - */ - public ValueObjectWithPathNode() { - super(VALUE_OBJECTWITHPATH); - } - - /** - * @param pAttribs - * @param pSession - */ - @Override - public void init(Attributes pAttribs, SAXSession pSession) { - this.iPathNodeNameEnum = this.iObjNodeNameEnum = null; - this.iObjPath = null; - this.iCIMObj = null; - // no attributes - } - - /** - * @param pData - */ - @Override - public void parseData(String pData) { - // no data - } - - @Override - public void testChild(String pNodeNameEnum) throws SAXException { - if (pNodeNameEnum == CLASSPATH) { - if (this.iPathNodeNameEnum != null) duplicatedNode(this.iPathNodeNameEnum, CLASSPATH); - if (this.iObjNodeNameEnum == INSTANCE) illegalChildNodePair(CLASSPATH, INSTANCE); - } else if (pNodeNameEnum == CLASS) { - if (this.iObjNodeNameEnum != null) duplicatedNode(this.iObjNodeNameEnum, CLASS); - if (this.iPathNodeNameEnum == INSTANCEPATH) illegalChildNodePair(INSTANCEPATH, CLASS); - } else if (pNodeNameEnum == INSTANCEPATH) { - if (this.iPathNodeNameEnum != null) duplicatedNode(this.iPathNodeNameEnum, INSTANCEPATH); - if (this.iObjNodeNameEnum == CLASS) illegalChildNodePair(INSTANCEPATH, CLASS); - } else if (pNodeNameEnum == INSTANCE) { - if (this.iObjNodeNameEnum != null) duplicatedNode(this.iObjNodeNameEnum, INSTANCE); - if (this.iPathNodeNameEnum == CLASSPATH) illegalChildNodePair(CLASSPATH, INSTANCE); - } else throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum - + " child!"); - - } - - @Override - public void childParsed(Node pChild) throws SAXException { - if (pChild instanceof AbstractObjectPathNode) { - this.iPathNodeNameEnum = pChild.getNodeName(); - this.iObjPath = ((AbstractObjectPathNode) pChild).getCIMObjectPath(); - } else { // ClassNode or InstanceNode, iObjPath must be available - // here - this.iObjNodeNameEnum = pChild.getNodeName(); - if (this.iPathNodeNameEnum == null) throw new SAXException(getNodeName() - + " first child should contain an object path!"); - if (pChild instanceof ClassNode) { - this.iCIMObj = ((ClassNode) pChild).getCIMClass(this.iObjPath); - } else { - this.iCIMObj = ((InstanceNode) pChild).getCIMInstance(this.iObjPath); - } - } - } - - @Override - public void testCompletness() throws SAXException { - if (this.iPathNodeNameEnum == null) throw new SAXException(getNodeName() - + " node must have a CLASSPATH or a INSTANCEPATH child node!"); - if (this.iObjNodeNameEnum == null) throw new SAXException(getNodeName() - + " node must have a CLASS or INSTANCE child node!"); - } - - /** - * @see ValueIf#getValue() - * @return CIMClass or CIMInstance - */ - public Object getValue() { - return this.iCIMObj; - } - - public CIMDataType getType() { - if (this.iCIMObj instanceof CIMClass) return CIMDataType.CLASS_T; - return CIMDataType.OBJECT_T; - } - -} +/* + (C) Copyright IBM Corp. 2006, 2012 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1660756 2007-02-22 ebak Embedded object support + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 3511454 2012-03-27 blaschke-oss SAX nodes not reinitialized properly + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMClass; +import org.metricshub.wbem.javax.cim.CIMDataType; +import org.metricshub.wbem.javax.cim.CIMObjectPath; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; +import org.metricshub.wbem.javax.cim.CIMNamedElementInterface; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + * ELEMENT VALUE.OBJECTWITHPATH ((CLASSPATH, CLASS) | (INSTANCEPATH, INSTANCE)) + */ +public class ValueObjectWithPathNode extends AbstractScalarValueNode { + + // ObjectPath element + private String iPathNodeNameEnum; + + private CIMObjectPath iObjPath; + + // CIMObject element + private String iObjNodeNameEnum; + + private CIMNamedElementInterface iCIMObj; + + /** + * Ctor. + */ + public ValueObjectWithPathNode() { + super(VALUE_OBJECTWITHPATH); + } + + /** + * @param pAttribs + * @param pSession + */ + @Override + public void init(Attributes pAttribs, SAXSession pSession) { + this.iPathNodeNameEnum = this.iObjNodeNameEnum = null; + this.iObjPath = null; + this.iCIMObj = null; + // no attributes + } + + /** + * @param pData + */ + @Override + public void parseData(String pData) { + // no data + } + + @Override + public void testChild(String pNodeNameEnum) throws SAXException { + if (pNodeNameEnum == CLASSPATH) { + if (this.iPathNodeNameEnum != null) duplicatedNode(this.iPathNodeNameEnum, CLASSPATH); + if (this.iObjNodeNameEnum == INSTANCE) illegalChildNodePair(CLASSPATH, INSTANCE); + } else if (pNodeNameEnum == CLASS) { + if (this.iObjNodeNameEnum != null) duplicatedNode(this.iObjNodeNameEnum, CLASS); + if (this.iPathNodeNameEnum == INSTANCEPATH) illegalChildNodePair(INSTANCEPATH, CLASS); + } else if (pNodeNameEnum == INSTANCEPATH) { + if (this.iPathNodeNameEnum != null) duplicatedNode(this.iPathNodeNameEnum, INSTANCEPATH); + if (this.iObjNodeNameEnum == CLASS) illegalChildNodePair(INSTANCEPATH, CLASS); + } else if (pNodeNameEnum == INSTANCE) { + if (this.iObjNodeNameEnum != null) duplicatedNode(this.iObjNodeNameEnum, INSTANCE); + if (this.iPathNodeNameEnum == CLASSPATH) illegalChildNodePair(CLASSPATH, INSTANCE); + } else throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum + + " child!"); + + } + + @Override + public void childParsed(Node pChild) throws SAXException { + if (pChild instanceof AbstractObjectPathNode) { + this.iPathNodeNameEnum = pChild.getNodeName(); + this.iObjPath = ((AbstractObjectPathNode) pChild).getCIMObjectPath(); + } else { // ClassNode or InstanceNode, iObjPath must be available + // here + this.iObjNodeNameEnum = pChild.getNodeName(); + if (this.iPathNodeNameEnum == null) throw new SAXException(getNodeName() + + " first child should contain an object path!"); + if (pChild instanceof ClassNode) { + this.iCIMObj = ((ClassNode) pChild).getCIMClass(this.iObjPath); + } else { + this.iCIMObj = ((InstanceNode) pChild).getCIMInstance(this.iObjPath); + } + } + } + + @Override + public void testCompletness() throws SAXException { + if (this.iPathNodeNameEnum == null) throw new SAXException(getNodeName() + + " node must have a CLASSPATH or a INSTANCEPATH child node!"); + if (this.iObjNodeNameEnum == null) throw new SAXException(getNodeName() + + " node must have a CLASS or INSTANCE child node!"); + } + + /** + * @see ValueIf#getValue() + * @return CIMClass or CIMInstance + */ + public Object getValue() { + return this.iCIMObj; + } + + public CIMDataType getType() { + if (this.iCIMObj instanceof CIMClass) return CIMDataType.CLASS_T; + return CIMDataType.OBJECT_T; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueRefArrayNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueRefArrayNode.java similarity index 76% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueRefArrayNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueRefArrayNode.java index 5cb05c1..2601e9c 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueRefArrayNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueRefArrayNode.java @@ -1,143 +1,140 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1660756 2007-02-22 ebak Embedded object support - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2750520 2009-04-10 blaschke-oss Code cleanup from empty statement et al - * 3511454 2012-03-27 blaschke-oss SAX nodes not reinitialized properly - * 3513349 2012-03-31 blaschke-oss TCK: CIMDataType must not accept null string - * 3602604 2013-01-29 blaschke-oss Clean up SAXException messages - * 2604 2013-07-01 blaschke-oss SAXException messages should contain node name - * 2715 2013-11-26 blaschke-oss Add VALUE.NULL support - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.ArrayList; - -import org.sentrysoftware.wbem.javax.cim.CIMDataType; -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; - -import org.sentrysoftware.wbem.sblim.cimclient.GenericExts; -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - * ELEMENT VALUE.REFARRAY (VALUE.REFERENCE|VALUE.NULL)* - */ -public class ValueRefArrayNode extends AbstractArrayValueNode { - - private ArrayList iCIMObjPathAL; - - /** - * Ctor. - */ - public ValueRefArrayNode() { - super(VALUE_REFARRAY); - } - - /** - * @param pAttribs - * @param pSession - */ - @Override - public void init(Attributes pAttribs, SAXSession pSession) { - this.iCIMObjPathAL = GenericExts.initClearArrayList(this.iCIMObjPathAL); - // no attributes - } - - /** - * @param pData - */ - @Override - public void parseData(String pData) { - // no data - } - - @Override - public void testChild(String pNodeNameEnum) throws SAXException { - if (pNodeNameEnum != VALUE_REFERENCE && pNodeNameEnum != VALUE_NULL) throw new SAXException( - getNodeName() - + " node child node can be VALUE.REFERENCE or VALUE.NULL only while it is " - + pNodeNameEnum + "!"); - } - - @Override - public void childParsed(Node pChild) { - if (this.iCIMObjPathAL == null) this.iCIMObjPathAL = new ArrayList(); - if (pChild instanceof ValueReferenceNode) this.iCIMObjPathAL - .add(((ValueReferenceNode) pChild).getCIMObjectPath()); - else if (pChild instanceof ValueNullNode) this.iCIMObjPathAL.add(null); - } - - @Override - public void testCompletness() { - // child nodes are not mandatory - } - - /** - * @see ArrayIf#elementAt(int) - * @return CIMObjectPath - */ - public Object elementAt(int pIdx) { - return this.iCIMObjPathAL == null ? null : this.iCIMObjPathAL.get(pIdx); - } - - public int size() { - return this.iCIMObjPathAL == null ? 0 : this.iCIMObjPathAL.size(); - } - - public CIMDataType getType() { - return new CIMDataType("", 0); - } - - private static final CIMObjectPath[] EMPTY_OPA = new CIMObjectPath[0]; - - /** - * @see ValueIf#getValue() - * @return CIMObjectPath[] - */ - public Object getValue() { - return size() == 0 ? null : this.iCIMObjPathAL.toArray(EMPTY_OPA); - } - -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1660756 2007-02-22 ebak Embedded object support + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2750520 2009-04-10 blaschke-oss Code cleanup from empty statement et al + * 3511454 2012-03-27 blaschke-oss SAX nodes not reinitialized properly + * 3513349 2012-03-31 blaschke-oss TCK: CIMDataType must not accept null string + * 3602604 2013-01-29 blaschke-oss Clean up SAXException messages + * 2604 2013-07-01 blaschke-oss SAXException messages should contain node name + * 2715 2013-11-26 blaschke-oss Add VALUE.NULL support + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.ArrayList; + +import org.metricshub.wbem.javax.cim.CIMDataType; +import org.metricshub.wbem.javax.cim.CIMObjectPath; +import org.metricshub.wbem.sblim.cimclient.GenericExts; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + * ELEMENT VALUE.REFARRAY (VALUE.REFERENCE|VALUE.NULL)* + */ +public class ValueRefArrayNode extends AbstractArrayValueNode { + + private ArrayList iCIMObjPathAL; + + /** + * Ctor. + */ + public ValueRefArrayNode() { + super(VALUE_REFARRAY); + } + + /** + * @param pAttribs + * @param pSession + */ + @Override + public void init(Attributes pAttribs, SAXSession pSession) { + this.iCIMObjPathAL = GenericExts.initClearArrayList(this.iCIMObjPathAL); + // no attributes + } + + /** + * @param pData + */ + @Override + public void parseData(String pData) { + // no data + } + + @Override + public void testChild(String pNodeNameEnum) throws SAXException { + if (pNodeNameEnum != VALUE_REFERENCE && pNodeNameEnum != VALUE_NULL) throw new SAXException( + getNodeName() + + " node child node can be VALUE.REFERENCE or VALUE.NULL only while it is " + + pNodeNameEnum + "!"); + } + + @Override + public void childParsed(Node pChild) { + if (this.iCIMObjPathAL == null) this.iCIMObjPathAL = new ArrayList(); + if (pChild instanceof ValueReferenceNode) this.iCIMObjPathAL + .add(((ValueReferenceNode) pChild).getCIMObjectPath()); + else if (pChild instanceof ValueNullNode) this.iCIMObjPathAL.add(null); + } + + @Override + public void testCompletness() { + // child nodes are not mandatory + } + + /** + * @see ArrayIf#elementAt(int) + * @return CIMObjectPath + */ + public Object elementAt(int pIdx) { + return this.iCIMObjPathAL == null ? null : this.iCIMObjPathAL.get(pIdx); + } + + public int size() { + return this.iCIMObjPathAL == null ? 0 : this.iCIMObjPathAL.size(); + } + + public CIMDataType getType() { + return new CIMDataType("", 0); + } + + private static final CIMObjectPath[] EMPTY_OPA = new CIMObjectPath[0]; + + /** + * @see ValueIf#getValue() + * @return CIMObjectPath[] + */ + public Object getValue() { + return size() == 0 ? null : this.iCIMObjPathAL.toArray(EMPTY_OPA); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueReferenceNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueReferenceNode.java similarity index 79% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueReferenceNode.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueReferenceNode.java index 65e04db..05c1f65 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueReferenceNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueReferenceNode.java @@ -1,147 +1,144 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant - * 1663270 2007-02-19 ebak Minor performance problems - * 1660756 2007-02-22 ebak Embedded object support - * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 3511454 2012-03-27 blaschke-oss SAX nodes not reinitialized properly - * 3466280 2012-04-23 blaschke-oss get instance failure for CIM_IndicationSubscription - * 2604 2013-07-01 blaschke-oss SAXException messages should contain node name - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.node; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMDataType; -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - * ELEMENT VALUE.REFERENCE (CLASSPATH | LOCALCLASSPATH | CLASSNAME | - * INSTANCEPATH | LOCALINSTANCEPATH | INSTANCENAME) - */ -public class ValueReferenceNode extends AbstractScalarValueNode implements ObjectPathIf { - - private CIMObjectPath iCIMObjPath; - - private String iChildNodeName = null; - - /** - * Ctor. - */ - public ValueReferenceNode() { - super(VALUE_REFERENCE); - } - - @Override - public void childParsed(Node pChild) { - this.iCIMObjPath = ((AbstractPathNode) pChild).getCIMObjectPath(); - if ((CLASSNAME.equalsIgnoreCase(this.iChildNodeName) || INSTANCENAME - .equalsIgnoreCase(this.iChildNodeName)) - && this.iCIMObjPath.getNamespace() != null) { - // LocalPathBuilder includes default namespace in CLASSNAME and - // INSTANCENAME elements, needs to be stripped - this.iCIMObjPath = new CIMObjectPath(this.iCIMObjPath.getScheme(), this.iCIMObjPath - .getHost(), this.iCIMObjPath.getPort(), null, this.iCIMObjPath.getObjectName(), - this.iCIMObjPath.getKeys(), this.iCIMObjPath.getXmlSchemaName()); - } - } - - /** - * @param pAttribs - * @param pSession - */ - @Override - public void init(Attributes pAttribs, SAXSession pSession) { - this.iCIMObjPath = null; - this.iChildNodeName = null; - // no attributes - } - - /** - * @param pData - */ - @Override - public void parseData(String pData) { - // there is no data - } - - private static final String[] ALLOWED_CHILDREN = { CLASSPATH, LOCALCLASSPATH, CLASSNAME, - INSTANCEPATH, LOCALINSTANCEPATH, INSTANCENAME }; - - @Override - public void testChild(String pNodeNameEnum) throws SAXException { - if (this.iCIMObjPath != null) throw new SAXException("Child node " + pNodeNameEnum - + " is illegal, since VALUE.REFERENCE already has a child!"); - for (int i = 0; i < ALLOWED_CHILDREN.length; i++) - if (ALLOWED_CHILDREN[i] == pNodeNameEnum) { - this.iChildNodeName = pNodeNameEnum; - return; - } - throw new SAXException("Invalid child node in " + getNodeName() + " node: " + pNodeNameEnum - + "! Valid nodes are CLASSPATH, LOCALCLASSPATH, CLASSNAME, " - + "INSTANCEPATH, LOCALINSTANCEPATH, INSTANCENAME"); - } - - @Override - public void testCompletness() throws SAXException { - if (this.iCIMObjPath == null) throw new SAXException( - "VALUE.REFERENCE node must have a child node!"); - } - - /** - * @see ValueIf#getValue() - * @return CIMObjectPath - */ - public Object getValue() { - return this.iCIMObjPath; - } - - public CIMDataType getType() { - return this.iCIMObjPath == null ? null : new CIMDataType(this.iCIMObjPath.getObjectName()); - } - - public CIMObjectPath getCIMObjectPath() { - return this.iCIMObjPath; - } - -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant + * 1663270 2007-02-19 ebak Minor performance problems + * 1660756 2007-02-22 ebak Embedded object support + * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 3511454 2012-03-27 blaschke-oss SAX nodes not reinitialized properly + * 3466280 2012-04-23 blaschke-oss get instance failure for CIM_IndicationSubscription + * 2604 2013-07-01 blaschke-oss SAXException messages should contain node name + */ + +package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMDataType; +import org.metricshub.wbem.javax.cim.CIMObjectPath; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + * ELEMENT VALUE.REFERENCE (CLASSPATH | LOCALCLASSPATH | CLASSNAME | + * INSTANCEPATH | LOCALINSTANCEPATH | INSTANCENAME) + */ +public class ValueReferenceNode extends AbstractScalarValueNode implements ObjectPathIf { + + private CIMObjectPath iCIMObjPath; + + private String iChildNodeName = null; + + /** + * Ctor. + */ + public ValueReferenceNode() { + super(VALUE_REFERENCE); + } + + @Override + public void childParsed(Node pChild) { + this.iCIMObjPath = ((AbstractPathNode) pChild).getCIMObjectPath(); + if ((CLASSNAME.equalsIgnoreCase(this.iChildNodeName) || INSTANCENAME + .equalsIgnoreCase(this.iChildNodeName)) + && this.iCIMObjPath.getNamespace() != null) { + // LocalPathBuilder includes default namespace in CLASSNAME and + // INSTANCENAME elements, needs to be stripped + this.iCIMObjPath = new CIMObjectPath(this.iCIMObjPath.getScheme(), this.iCIMObjPath + .getHost(), this.iCIMObjPath.getPort(), null, this.iCIMObjPath.getObjectName(), + this.iCIMObjPath.getKeys(), this.iCIMObjPath.getXmlSchemaName()); + } + } + + /** + * @param pAttribs + * @param pSession + */ + @Override + public void init(Attributes pAttribs, SAXSession pSession) { + this.iCIMObjPath = null; + this.iChildNodeName = null; + // no attributes + } + + /** + * @param pData + */ + @Override + public void parseData(String pData) { + // there is no data + } + + private static final String[] ALLOWED_CHILDREN = { CLASSPATH, LOCALCLASSPATH, CLASSNAME, + INSTANCEPATH, LOCALINSTANCEPATH, INSTANCENAME }; + + @Override + public void testChild(String pNodeNameEnum) throws SAXException { + if (this.iCIMObjPath != null) throw new SAXException("Child node " + pNodeNameEnum + + " is illegal, since VALUE.REFERENCE already has a child!"); + for (int i = 0; i < ALLOWED_CHILDREN.length; i++) + if (ALLOWED_CHILDREN[i] == pNodeNameEnum) { + this.iChildNodeName = pNodeNameEnum; + return; + } + throw new SAXException("Invalid child node in " + getNodeName() + " node: " + pNodeNameEnum + + "! Valid nodes are CLASSPATH, LOCALCLASSPATH, CLASSNAME, " + + "INSTANCEPATH, LOCALINSTANCEPATH, INSTANCENAME"); + } + + @Override + public void testCompletness() throws SAXException { + if (this.iCIMObjPath == null) throw new SAXException( + "VALUE.REFERENCE node must have a child node!"); + } + + /** + * @see ValueIf#getValue() + * @return CIMObjectPath + */ + public Object getValue() { + return this.iCIMObjPath; + } + + public CIMDataType getType() { + return this.iCIMObjPath == null ? null : new CIMDataType(this.iCIMObjPath.getObjectName()); + } + + public CIMObjectPath getCIMObjectPath() { + return this.iCIMObjPath; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/package.html b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/package.html similarity index 100% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/node/package.html rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/package.html diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/package.html b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/package.html similarity index 100% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/cimxml/sax/package.html rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/package.html diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/discovery/package.html b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/discovery/package.html similarity index 100% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/discovery/package.html rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/discovery/package.html diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/discovery/slp/DiscovererSLP.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/discovery/slp/DiscovererSLP.java similarity index 81% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/discovery/slp/DiscovererSLP.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/discovery/slp/DiscovererSLP.java index cf25c9e..27c97b3 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/discovery/slp/DiscovererSLP.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/discovery/slp/DiscovererSLP.java @@ -1,256 +1,254 @@ -/* - (C) Copyright IBM Corp. 2007, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Alexander Wolf-Reber, IBM, a.wolf-reber@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1678915 2007-03-12 lupusalex Integrated WBEM service discovery via SLP - * 1729361 2007-06-04 lupusalex Multicast discovery is broken in DiscovererSLP - * 1804402 2007-09-28 ebak IPv6 ready SLP - * 1892103 2008-02-13 ebak SLP improvements - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.discovery.slp; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.net.InetAddress; -import java.util.ArrayList; -import java.util.Enumeration; -import java.util.LinkedList; -import java.util.List; -import java.util.Locale; -import java.util.Vector; -import java.util.logging.Level; - -import org.sentrysoftware.wbem.sblim.cimclient.discovery.Discoverer; -import org.sentrysoftware.wbem.sblim.cimclient.discovery.WBEMServiceAdvertisement; -import org.sentrysoftware.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; -import org.sentrysoftware.wbem.sblim.slp.Locator; -import org.sentrysoftware.wbem.sblim.slp.ServiceLocationException; -import org.sentrysoftware.wbem.sblim.slp.ServiceLocationManager; -import org.sentrysoftware.wbem.sblim.slp.ServiceType; -import org.sentrysoftware.wbem.sblim.slp.ServiceURL; -import org.sentrysoftware.wbem.sblim.slp.internal.SLPDefaults; - -/** - * Class DiscovererSLP is the SLP specific implementation of the Discoverer - * interface. - * - * @since 2.0.2 - */ -public class DiscovererSLP extends Object implements Discoverer { - - private static final String SERVICE_WBEM = "service:wbem"; - - private static final ServiceType SERVICE_TYPE = new ServiceType(SERVICE_WBEM); - - private static final Vector ATTRIBUTES = new Vector(); - - private Locale iLocale; - - private Vector iScopes; - - /** - * Ctor. - * - * @param pLocale - * The locale setting to use for the Locator - */ - public DiscovererSLP(Locale pLocale) { - this.iLocale = pLocale; - this.iScopes = new Vector(); - this.iScopes.add(SLPDefaults.DEFAULT_SCOPE); - } - - /** - * Returns locale - * - * @return The value of locale. - */ - public Locale getLocale() { - return this.iLocale; - } - - /** - * Sets locale - * - * @param pLocale - * The new value of locale. - */ - public void setLocale(Locale pLocale) { - this.iLocale = pLocale; - } - - /** - * Returns scopes - * - * @return The value of scopes. - */ - public Vector getScopes() { - return this.iScopes; - } - - /** - * Sets scopes - * - * @param pScopes - * The new value of scopes. - */ - public void setScopes(Vector pScopes) { - this.iScopes = pScopes; - } - - /* - * (non-Javadoc) - * - * @see org.sblim.cimclient.discovery.Discoverer#findWbemServices(String[]) - */ - public WBEMServiceAdvertisement[] findWbemServices(final String[] pDirectoryUrls) { - - List advertisements = new ArrayList(); - - if (pDirectoryUrls != null && pDirectoryUrls.length > 0) { - for (int i = 0; i < pDirectoryUrls.length; ++i) { - advertisements.addAll(findWbemServices(pDirectoryUrls[i])); - } - } else { - advertisements.addAll(findWbemServices((String) null)); - } - - return advertisements.toArray(new WBEMServiceAdvertisement[advertisements.size()]); - } - - private List findWbemServices(final String pDA) { - final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); - logger.entry(); - logger.trace(Level.FINEST, "SLP discovery started on DA " + pDA); - try { - - Vector agents; - if (pDA != null) { - agents = new Vector(); - InetAddress address = InetAddress.getByName(pDA); - if (address == null) { return new LinkedList(); } - agents.add(address); - } else { - agents = null; - } - - final Locator locator = ServiceLocationManager.getLocator(this.iLocale); - - List advertisements = new ArrayList(); - Enumeration serviceEnum = locator.findServices(SERVICE_TYPE, this.iScopes, "", - agents); - - while (serviceEnum != null && serviceEnum.hasMoreElements()) { - ServiceURL url; - try { - url = (ServiceURL) serviceEnum.nextElement(); - } catch (RuntimeException e) { - logger.trace(Level.FINE, e.getMessage(), e); - continue; - } - Enumeration attributeEnum = locator.findAttributes(url, this.iScopes, - ATTRIBUTES, agents); - List attributes = new ArrayList(); - while (attributeEnum != null && attributeEnum.hasMoreElements()) { - try { - attributes.add(attributeEnum.nextElement().toString()); - } catch (RuntimeException e) { - logger.trace(Level.FINE, e.getMessage(), e); - continue; - } - } - advertisements.add(new WBEMServiceAdvertisementSLP(pDA, url, attributes)); - } - logger.trace(Level.FINEST, "SLP discovery completed on DA " + pDA + ". " - + advertisements.size() + " WBEM services found"); - logger.exit(); - return advertisements; - - } catch (ServiceLocationException e) { - LogAndTraceBroker.getBroker().trace(Level.FINE, "SLP discovery failed with error", e); - } catch (Exception e) { - LogAndTraceBroker.getBroker() - .trace(Level.FINE, "Exception during service discovery", e); - } - logger.exit(); - return new LinkedList(); - } - - public String[] findDirectoryServices() { - final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); - logger.entry(); - try { - ArrayList agents = new ArrayList(); - - final Locator locator = ServiceLocationManager.getLocator(this.iLocale); - - Enumeration serviceEnum = locator.findServices(SLPDefaults.DA_SERVICE_TYPE, - this.iScopes, ""); - - while (serviceEnum != null && serviceEnum.hasMoreElements()) { - ServiceURL url = (ServiceURL) serviceEnum.nextElement(); - agents.add(url.getHost()); - } - - logger.trace(Level.FINER, "SLP DA discovery completed in local subnet. " - + agents.size() + " DAs found:" + agents.toString()); - if (agents.size() == 0) { - serviceEnum = locator.findServices(SLPDefaults.SA_SERVICE_TYPE, this.iScopes, ""); - - while (serviceEnum != null && serviceEnum.hasMoreElements()) { - ServiceURL url = (ServiceURL) serviceEnum.nextElement(); - agents.add(url.getHost()); - } - logger.trace(Level.FINER, "SLP SA discovery completed in local subnet. " - + agents.size() + " SAs found:" + agents.toString()); - } - - logger.exit(); - return agents.toArray(new String[agents.size()]); - - } catch (ServiceLocationException e) { - LogAndTraceBroker.getBroker().trace(Level.FINE, "SLP discovery failed with error", e); - } catch (Exception e) { - LogAndTraceBroker.getBroker() - .trace(Level.FINE, "Exception during service discovery", e); - } - logger.exit(); - return new String[0]; - } -} +/* + (C) Copyright IBM Corp. 2007, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Alexander Wolf-Reber, IBM, a.wolf-reber@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1678915 2007-03-12 lupusalex Integrated WBEM service discovery via SLP + * 1729361 2007-06-04 lupusalex Multicast discovery is broken in DiscovererSLP + * 1804402 2007-09-28 ebak IPv6 ready SLP + * 1892103 2008-02-13 ebak SLP improvements + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors + */ + +package org.metricshub.wbem.sblim.cimclient.internal.discovery.slp; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.net.InetAddress; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.LinkedList; +import java.util.List; +import java.util.Locale; +import java.util.Vector; +import java.util.logging.Level; + +import org.metricshub.wbem.sblim.cimclient.discovery.WBEMServiceAdvertisement; +import org.metricshub.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; +import org.metricshub.wbem.sblim.slp.Locator; +import org.metricshub.wbem.sblim.slp.ServiceLocationException; +import org.metricshub.wbem.sblim.slp.ServiceLocationManager; +import org.metricshub.wbem.sblim.slp.ServiceType; +import org.metricshub.wbem.sblim.slp.ServiceURL; +import org.metricshub.wbem.sblim.slp.internal.SLPDefaults; +import org.metricshub.wbem.sblim.cimclient.discovery.Discoverer; + +/** + * Class DiscovererSLP is the SLP specific implementation of the Discoverer + * interface. + * + * @since 2.0.2 + */ +public class DiscovererSLP extends Object implements Discoverer { + + private static final String SERVICE_WBEM = "service:wbem"; + + private static final ServiceType SERVICE_TYPE = new ServiceType(SERVICE_WBEM); + + private static final Vector ATTRIBUTES = new Vector(); + + private Locale iLocale; + + private Vector iScopes; + + /** + * Ctor. + * + * @param pLocale + * The locale setting to use for the Locator + */ + public DiscovererSLP(Locale pLocale) { + this.iLocale = pLocale; + this.iScopes = new Vector(); + this.iScopes.add(SLPDefaults.DEFAULT_SCOPE); + } + + /** + * Returns locale + * + * @return The value of locale. + */ + public Locale getLocale() { + return this.iLocale; + } + + /** + * Sets locale + * + * @param pLocale + * The new value of locale. + */ + public void setLocale(Locale pLocale) { + this.iLocale = pLocale; + } + + /** + * Returns scopes + * + * @return The value of scopes. + */ + public Vector getScopes() { + return this.iScopes; + } + + /** + * Sets scopes + * + * @param pScopes + * The new value of scopes. + */ + public void setScopes(Vector pScopes) { + this.iScopes = pScopes; + } + + /* + * (non-Javadoc) + * + * @see org.sblim.cimclient.discovery.Discoverer#findWbemServices(String[]) + */ + public WBEMServiceAdvertisement[] findWbemServices(final String[] pDirectoryUrls) { + + List advertisements = new ArrayList(); + + if (pDirectoryUrls != null && pDirectoryUrls.length > 0) { + for (int i = 0; i < pDirectoryUrls.length; ++i) { + advertisements.addAll(findWbemServices(pDirectoryUrls[i])); + } + } else { + advertisements.addAll(findWbemServices((String) null)); + } + + return advertisements.toArray(new WBEMServiceAdvertisement[advertisements.size()]); + } + + private List findWbemServices(final String pDA) { + final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); + logger.entry(); + logger.trace(Level.FINEST, "SLP discovery started on DA " + pDA); + try { + + Vector agents; + if (pDA != null) { + agents = new Vector(); + InetAddress address = InetAddress.getByName(pDA); + if (address == null) { return new LinkedList(); } + agents.add(address); + } else { + agents = null; + } + + final Locator locator = ServiceLocationManager.getLocator(this.iLocale); + + List advertisements = new ArrayList(); + Enumeration serviceEnum = locator.findServices(SERVICE_TYPE, this.iScopes, "", + agents); + + while (serviceEnum != null && serviceEnum.hasMoreElements()) { + ServiceURL url; + try { + url = (ServiceURL) serviceEnum.nextElement(); + } catch (RuntimeException e) { + logger.trace(Level.FINE, e.getMessage(), e); + continue; + } + Enumeration attributeEnum = locator.findAttributes(url, this.iScopes, + ATTRIBUTES, agents); + List attributes = new ArrayList(); + while (attributeEnum != null && attributeEnum.hasMoreElements()) { + try { + attributes.add(attributeEnum.nextElement().toString()); + } catch (RuntimeException e) { + logger.trace(Level.FINE, e.getMessage(), e); + continue; + } + } + advertisements.add(new WBEMServiceAdvertisementSLP(pDA, url, attributes)); + } + logger.trace(Level.FINEST, "SLP discovery completed on DA " + pDA + ". " + + advertisements.size() + " WBEM services found"); + logger.exit(); + return advertisements; + + } catch (ServiceLocationException e) { + LogAndTraceBroker.getBroker().trace(Level.FINE, "SLP discovery failed with error", e); + } catch (Exception e) { + LogAndTraceBroker.getBroker() + .trace(Level.FINE, "Exception during service discovery", e); + } + logger.exit(); + return new LinkedList(); + } + + public String[] findDirectoryServices() { + final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); + logger.entry(); + try { + ArrayList agents = new ArrayList(); + + final Locator locator = ServiceLocationManager.getLocator(this.iLocale); + + Enumeration serviceEnum = locator.findServices(SLPDefaults.DA_SERVICE_TYPE, + this.iScopes, ""); + + while (serviceEnum != null && serviceEnum.hasMoreElements()) { + ServiceURL url = (ServiceURL) serviceEnum.nextElement(); + agents.add(url.getHost()); + } + + logger.trace(Level.FINER, "SLP DA discovery completed in local subnet. " + + agents.size() + " DAs found:" + agents.toString()); + if (agents.size() == 0) { + serviceEnum = locator.findServices(SLPDefaults.SA_SERVICE_TYPE, this.iScopes, ""); + + while (serviceEnum != null && serviceEnum.hasMoreElements()) { + ServiceURL url = (ServiceURL) serviceEnum.nextElement(); + agents.add(url.getHost()); + } + logger.trace(Level.FINER, "SLP SA discovery completed in local subnet. " + + agents.size() + " SAs found:" + agents.toString()); + } + + logger.exit(); + return agents.toArray(new String[agents.size()]); + + } catch (ServiceLocationException e) { + LogAndTraceBroker.getBroker().trace(Level.FINE, "SLP discovery failed with error", e); + } catch (Exception e) { + LogAndTraceBroker.getBroker() + .trace(Level.FINE, "Exception during service discovery", e); + } + logger.exit(); + return new String[0]; + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/discovery/slp/WBEMServiceAdvertisementSLP.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/discovery/slp/WBEMServiceAdvertisementSLP.java similarity index 83% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/discovery/slp/WBEMServiceAdvertisementSLP.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/discovery/slp/WBEMServiceAdvertisementSLP.java index 0617404..887a6bc 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/discovery/slp/WBEMServiceAdvertisementSLP.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/discovery/slp/WBEMServiceAdvertisementSLP.java @@ -1,295 +1,293 @@ -/* - (C) Copyright IBM Corp. 2007, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Alexander Wolf-Reber, IBM, a.wolf-reber@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1678915 2007-03-12 lupusalex Integrated WBEM service discovery via SLP - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.discovery.slp; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.Set; -import java.util.Map.Entry; -import java.util.logging.Level; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; -import javax.security.auth.Subject; -import org.sentrysoftware.wbem.javax.wbem.client.WBEMClient; -import org.sentrysoftware.wbem.javax.wbem.client.WBEMClientFactory; - -import org.sentrysoftware.wbem.sblim.cimclient.discovery.WBEMServiceAdvertisement; -import org.sentrysoftware.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; -import org.sentrysoftware.wbem.sblim.slp.ServiceURL; - -/** - * Class WBEMServiceAdvertisementSLP is the SLP specific implementation if the - * WBEMServiceAdvertisement interface. - * - * - * @since 2.0.2 - */ -public class WBEMServiceAdvertisementSLP implements WBEMServiceAdvertisement { - - private static final Pattern ATTR_PATTERN = Pattern.compile("[(]?(.+)=([^)]+)[)]?"); - - private String iDA; - - private ServiceURL iServiceUrl; - - private Map iAttributeMap; - - private boolean iExpired = false; - - /** - * Ctor. - * - * @param pDA - * The Directory Agent from which this advertisement was received - * @param pUrl - * The SLP service url returned by Locator.findServices(). - * @param pAttributes - * The attribute list (List<String>) where each entry looks - * either like this key=value or this - * (key=value). - */ - public WBEMServiceAdvertisementSLP(String pDA, ServiceURL pUrl, List pAttributes) { - if (pDA == null || pUrl == null) throw new IllegalArgumentException( - "Directory and URL must not be null"); - this.iDA = pDA; - this.iServiceUrl = pUrl; - parseAttributes(pAttributes); - - } - - private void parseAttributes(List pAttributes) { - this.iAttributeMap = new HashMap(); - Iterator iter = pAttributes.iterator(); - while (iter.hasNext()) { - String attribute = iter.next(); - Matcher matcher = ATTR_PATTERN.matcher(attribute); - if (matcher.matches()) { - String key = matcher.group(1).trim(); - String value = matcher.group(2).trim(); - this.iAttributeMap.put(key, value); - } else { - LogAndTraceBroker.getBroker().trace(Level.FINE, - "SLP discovery returned invalid attribute: " + attribute); - } - } - } - - /* - * (non-Javadoc) - * - * @see - * org.sblim.cimclient.discovery.WbemService#getAttribute(java.lang.String) - */ - public String getAttribute(String pAttributeName) { - return this.iAttributeMap.get(pAttributeName); - } - - /* - * (non-Javadoc) - * - * @see org.sblim.cimclient.discovery.WbemService#getAttributes() - */ - public Set> getAttributes() { - return this.iAttributeMap.entrySet(); - } - - /* - * (non-Javadoc) - * - * @see org.sblim.cimclient.discovery.WbemService#getConcreteServiceType() - */ - public String getConcreteServiceType() { - return this.iServiceUrl.getServiceType().getConcreteTypeName(); - } - - /* - * (non-Javadoc) - * - * @see org.sblim.cimclient.discovery.WbemService#getServiceUrl() - */ - public String getServiceUrl() { - return getConcreteServiceType() + "://" + this.iServiceUrl.getHost() + ":" - + String.valueOf(this.iServiceUrl.getPort()); - } - - /* - * (non-Javadoc) - * - * @see - * org.sblim.cimclient.discovery.WBEMServiceAdvertisement#createClient(javax - * .security.auth.Subject, java.util.Locale[]) - */ - public WBEMClient createClient(Subject pSubject, Locale[] pLocales) throws Exception { - String communication = getAttribute(COMM_MECHANISM); - if (communication.equalsIgnoreCase("OTHER")) { - communication = getAttribute(OTHER_COMM_MECHN_DESC); - } - WBEMClient client = WBEMClientFactory.getClient(communication); - CIMObjectPath path = new CIMObjectPath(this.iServiceUrl.getServiceType() - .getConcreteTypeName(), this.iServiceUrl.getHost(), String.valueOf(this.iServiceUrl - .getPort()), null, null, null); - client.initialize(path, pSubject, pLocales); - return client; - } - - public String getDirectory() { - return this.iDA; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - StringBuffer buffer = new StringBuffer(); - // buffer.append(iServiceUrl.getServiceType()); - // buffer.append("://"); - // buffer.append(iServiceUrl.getHost()); - buffer.append(getServiceUrl()); - buffer.append("{slp da=\""); - buffer.append(this.iDA); - buffer.append("\", attributes=["); - Iterator> iter = this.iAttributeMap.entrySet().iterator(); - while (iter.hasNext()) { - Entry entry = iter.next(); - buffer.append("\""); - buffer.append(entry.getKey()); - buffer.append("="); - buffer.append(entry.getValue()); - buffer.append("\""); - if (iter.hasNext()) buffer.append(", "); - } - buffer.append("]}"); - return buffer.toString(); - } - - public String[] getInteropNamespaces() { - return parseCommaSeparatedList(getAttribute(INTEROP_NS)); - } - - private String[] parseCommaSeparatedList(String pAttribute) { - String[] split = pAttribute.split("[,\\n]"); - int emptyCount = 0; - for (int i = 0; i < split.length; ++i) { - split[i] = split[i].trim(); - if (split[i].length() == 0) { - ++emptyCount; - } - } - if (emptyCount > 0) { - String[] result = new String[split.length - emptyCount]; - int j = 0; - for (int i = 0; i < split.length; ++i) { - if (split[i].length() > 0) { - result[j++] = split[i]; - } - } - return result; - } - return split; - } - - /* - * (non-Javadoc) - * - * @see - * org.sblim.cimclient.discovery.WBEMServiceAdvertisement#getServiceId() - */ - public String getServiceId() { - return getAttribute(SERVICE_ID); - } - - /* - * (non-Javadoc) - * - * @see org.sblim.cimclient.discovery.WBEMServiceAdvertisement#isExpired() - */ - public boolean isExpired() { - return this.iExpired; - } - - /* - * (non-Javadoc) - * - * @see - * org.sblim.cimclient.discovery.WBEMServiceAdvertisement#setExpired(boolean - * ) - */ - public void setExpired(boolean pExpired) { - this.iExpired = pExpired; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals(Object pObj) { - if (pObj == this) { return true; } - if (pObj != null && pObj instanceof WBEMServiceAdvertisement) { - WBEMServiceAdvertisement that = (WBEMServiceAdvertisement) pObj; - return getServiceUrl().equals(that.getServiceUrl()) - && getDirectory().equals(that.getDirectory()); - } - return false; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#hashCode() - */ - @Override - public int hashCode() { - return this.iServiceUrl.hashCode() + this.iDA.hashCode(); - } -} +/* + (C) Copyright IBM Corp. 2007, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Alexander Wolf-Reber, IBM, a.wolf-reber@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1678915 2007-03-12 lupusalex Integrated WBEM service discovery via SLP + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.discovery.slp; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Set; +import java.util.Map.Entry; +import java.util.logging.Level; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import javax.security.auth.Subject; + +import org.metricshub.wbem.javax.cim.CIMObjectPath; +import org.metricshub.wbem.javax.wbem.client.WBEMClient; +import org.metricshub.wbem.javax.wbem.client.WBEMClientFactory; +import org.metricshub.wbem.sblim.cimclient.discovery.WBEMServiceAdvertisement; +import org.metricshub.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; +import org.metricshub.wbem.sblim.slp.ServiceURL; + +/** + * Class WBEMServiceAdvertisementSLP is the SLP specific implementation if the + * WBEMServiceAdvertisement interface. + * + * + * @since 2.0.2 + */ +public class WBEMServiceAdvertisementSLP implements WBEMServiceAdvertisement { + + private static final Pattern ATTR_PATTERN = Pattern.compile("[(]?(.+)=([^)]+)[)]?"); + + private String iDA; + + private ServiceURL iServiceUrl; + + private Map iAttributeMap; + + private boolean iExpired = false; + + /** + * Ctor. + * + * @param pDA + * The Directory Agent from which this advertisement was received + * @param pUrl + * The SLP service url returned by Locator.findServices(). + * @param pAttributes + * The attribute list (List<String>) where each entry looks + * either like this key=value or this + * (key=value). + */ + public WBEMServiceAdvertisementSLP(String pDA, ServiceURL pUrl, List pAttributes) { + if (pDA == null || pUrl == null) throw new IllegalArgumentException( + "Directory and URL must not be null"); + this.iDA = pDA; + this.iServiceUrl = pUrl; + parseAttributes(pAttributes); + + } + + private void parseAttributes(List pAttributes) { + this.iAttributeMap = new HashMap(); + Iterator iter = pAttributes.iterator(); + while (iter.hasNext()) { + String attribute = iter.next(); + Matcher matcher = ATTR_PATTERN.matcher(attribute); + if (matcher.matches()) { + String key = matcher.group(1).trim(); + String value = matcher.group(2).trim(); + this.iAttributeMap.put(key, value); + } else { + LogAndTraceBroker.getBroker().trace(Level.FINE, + "SLP discovery returned invalid attribute: " + attribute); + } + } + } + + /* + * (non-Javadoc) + * + * @see + * org.sblim.cimclient.discovery.WbemService#getAttribute(java.lang.String) + */ + public String getAttribute(String pAttributeName) { + return this.iAttributeMap.get(pAttributeName); + } + + /* + * (non-Javadoc) + * + * @see org.sblim.cimclient.discovery.WbemService#getAttributes() + */ + public Set> getAttributes() { + return this.iAttributeMap.entrySet(); + } + + /* + * (non-Javadoc) + * + * @see org.sblim.cimclient.discovery.WbemService#getConcreteServiceType() + */ + public String getConcreteServiceType() { + return this.iServiceUrl.getServiceType().getConcreteTypeName(); + } + + /* + * (non-Javadoc) + * + * @see org.sblim.cimclient.discovery.WbemService#getServiceUrl() + */ + public String getServiceUrl() { + return getConcreteServiceType() + "://" + this.iServiceUrl.getHost() + ":" + + String.valueOf(this.iServiceUrl.getPort()); + } + + /* + * (non-Javadoc) + * + * @see + * org.sblim.cimclient.discovery.WBEMServiceAdvertisement#createClient(javax + * .security.auth.Subject, java.util.Locale[]) + */ + public WBEMClient createClient(Subject pSubject, Locale[] pLocales) throws Exception { + String communication = getAttribute(COMM_MECHANISM); + if (communication.equalsIgnoreCase("OTHER")) { + communication = getAttribute(OTHER_COMM_MECHN_DESC); + } + WBEMClient client = WBEMClientFactory.getClient(communication); + CIMObjectPath path = new CIMObjectPath(this.iServiceUrl.getServiceType() + .getConcreteTypeName(), this.iServiceUrl.getHost(), String.valueOf(this.iServiceUrl + .getPort()), null, null, null); + client.initialize(path, pSubject, pLocales); + return client; + } + + public String getDirectory() { + return this.iDA; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + StringBuffer buffer = new StringBuffer(); + // buffer.append(iServiceUrl.getServiceType()); + // buffer.append("://"); + // buffer.append(iServiceUrl.getHost()); + buffer.append(getServiceUrl()); + buffer.append("{slp da=\""); + buffer.append(this.iDA); + buffer.append("\", attributes=["); + Iterator> iter = this.iAttributeMap.entrySet().iterator(); + while (iter.hasNext()) { + Entry entry = iter.next(); + buffer.append("\""); + buffer.append(entry.getKey()); + buffer.append("="); + buffer.append(entry.getValue()); + buffer.append("\""); + if (iter.hasNext()) buffer.append(", "); + } + buffer.append("]}"); + return buffer.toString(); + } + + public String[] getInteropNamespaces() { + return parseCommaSeparatedList(getAttribute(INTEROP_NS)); + } + + private String[] parseCommaSeparatedList(String pAttribute) { + String[] split = pAttribute.split("[,\\n]"); + int emptyCount = 0; + for (int i = 0; i < split.length; ++i) { + split[i] = split[i].trim(); + if (split[i].length() == 0) { + ++emptyCount; + } + } + if (emptyCount > 0) { + String[] result = new String[split.length - emptyCount]; + int j = 0; + for (int i = 0; i < split.length; ++i) { + if (split[i].length() > 0) { + result[j++] = split[i]; + } + } + return result; + } + return split; + } + + /* + * (non-Javadoc) + * + * @see + * org.sblim.cimclient.discovery.WBEMServiceAdvertisement#getServiceId() + */ + public String getServiceId() { + return getAttribute(SERVICE_ID); + } + + /* + * (non-Javadoc) + * + * @see org.sblim.cimclient.discovery.WBEMServiceAdvertisement#isExpired() + */ + public boolean isExpired() { + return this.iExpired; + } + + /* + * (non-Javadoc) + * + * @see + * org.sblim.cimclient.discovery.WBEMServiceAdvertisement#setExpired(boolean + * ) + */ + public void setExpired(boolean pExpired) { + this.iExpired = pExpired; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#equals(java.lang.Object) + */ + @Override + public boolean equals(Object pObj) { + if (pObj == this) { return true; } + if (pObj != null && pObj instanceof WBEMServiceAdvertisement) { + WBEMServiceAdvertisement that = (WBEMServiceAdvertisement) pObj; + return getServiceUrl().equals(that.getServiceUrl()) + && getDirectory().equals(that.getDirectory()); + } + return false; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#hashCode() + */ + @Override + public int hashCode() { + return this.iServiceUrl.hashCode() + this.iDA.hashCode(); + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/discovery/slp/package.html b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/discovery/slp/package.html similarity index 100% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/discovery/slp/package.html rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/discovery/slp/package.html diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/AuthorizationHandler.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/AuthorizationHandler.java similarity index 78% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/AuthorizationHandler.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/AuthorizationHandler.java index de5deb2..884ab88 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/AuthorizationHandler.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/AuthorizationHandler.java @@ -1,121 +1,119 @@ -/* - (C) Copyright IBM Corp. 2005, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1535756 2006-08-07 lupusalex Make code warning free - * 1516242 2006-11-27 lupusalex Support of OpenPegasus local authentication - * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.http; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.ArrayList; -import java.util.Iterator; - -/** - * Class AuthorizationHandler manages AdAuthorizationInfo instances - * - */ -public class AuthorizationHandler { - - private ArrayList iAuthList = new ArrayList(); - - /** - * Adds an AuthorizationInfo to the handler - * - * @param pAuthorizationInfo - * The AuthorizationInfo to add - */ - public synchronized void addAuthorizationInfo(AuthorizationInfo pAuthorizationInfo) { - this.iAuthList.add(pAuthorizationInfo); - } - - /** - * Returns the corresponding AuthorizationInfo for a given set of parameters - * - * @param pAuthorizationModule - * The authorization module - * @param pProxy - * Proxy authentication ? - * @param pAddr - * Host address - * @param pPort - * Host port - * @param pProtocol - * Protocol - * @param pRealm - * Realm - * @param pScheme - * Scheme - * @return The AuthorizationInfo or null if none fits - */ - public synchronized AuthorizationInfo getAuthorizationInfo(String pAuthorizationModule, - Boolean pProxy, String pAddr, int pPort, String pProtocol, String pRealm, String pScheme) { - - AuthorizationInfo request = AuthorizationInfo.createAuthorizationInfo(pAuthorizationModule, - pProxy, pAddr, pPort, pProtocol, pRealm, pScheme); - - Iterator iter = this.iAuthList.iterator(); - while (iter.hasNext()) { - AuthorizationInfo authInfo = iter.next(); - - if (authInfo.match(request)) return authInfo; - - } - return null; - } - - /** - * Returns the AuthorizationInfo at a given index - * - * @param pIndex - * The index - * @return The AuthorizationInfo - */ - public synchronized AuthorizationInfo getAuthorizationInfo(int pIndex) { - return this.iAuthList.get(pIndex); - } - - @Override - public String toString() { - return "AuthorizationHandler=[AuthInfoList=" + this.iAuthList + "]"; - } -} +/* + (C) Copyright IBM Corp. 2005, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1535756 2006-08-07 lupusalex Make code warning free + * 1516242 2006-11-27 lupusalex Support of OpenPegasus local authentication + * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.http; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.ArrayList; +import java.util.Iterator; + +/** + * Class AuthorizationHandler manages AdAuthorizationInfo instances + * + */ +public class AuthorizationHandler { + + private ArrayList iAuthList = new ArrayList(); + + /** + * Adds an AuthorizationInfo to the handler + * + * @param pAuthorizationInfo + * The AuthorizationInfo to add + */ + public synchronized void addAuthorizationInfo(AuthorizationInfo pAuthorizationInfo) { + this.iAuthList.add(pAuthorizationInfo); + } + + /** + * Returns the corresponding AuthorizationInfo for a given set of parameters + * + * @param pAuthorizationModule + * The authorization module + * @param pProxy + * Proxy authentication ? + * @param pAddr + * Host address + * @param pPort + * Host port + * @param pProtocol + * Protocol + * @param pRealm + * Realm + * @param pScheme + * Scheme + * @return The AuthorizationInfo or null if none fits + */ + public synchronized AuthorizationInfo getAuthorizationInfo(String pAuthorizationModule, + Boolean pProxy, String pAddr, int pPort, String pProtocol, String pRealm, String pScheme) { + + AuthorizationInfo request = AuthorizationInfo.createAuthorizationInfo(pAuthorizationModule, + pProxy, pAddr, pPort, pProtocol, pRealm, pScheme); + + Iterator iter = this.iAuthList.iterator(); + while (iter.hasNext()) { + AuthorizationInfo authInfo = iter.next(); + + if (authInfo.match(request)) return authInfo; + + } + return null; + } + + /** + * Returns the AuthorizationInfo at a given index + * + * @param pIndex + * The index + * @return The AuthorizationInfo + */ + public synchronized AuthorizationInfo getAuthorizationInfo(int pIndex) { + return this.iAuthList.get(pIndex); + } + + @Override + public String toString() { + return "AuthorizationHandler=[AuthInfoList=" + this.iAuthList + "]"; + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/AuthorizationInfo.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/AuthorizationInfo.java similarity index 87% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/AuthorizationInfo.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/AuthorizationInfo.java index 9101121..3a9691c 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/AuthorizationInfo.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/AuthorizationInfo.java @@ -1,515 +1,513 @@ -/* - (C) Copyright IBM Corp. 2005, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 17970 2005-08-11 pineiro5 Logon from z/OS not possible - * 1516242 2006-07-05 lupusalex Support of OpenPegasus local authentication - * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.http; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.net.PasswordAuthentication; -import java.net.URI; -import java.security.NoSuchAlgorithmException; -import java.util.logging.Level; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; -import org.sentrysoftware.wbem.sblim.cimclient.internal.logging.Messages; -import org.sentrysoftware.wbem.sblim.cimclient.internal.util.WBEMConfiguration; - -/** - * Abstract superclass for HTTP authorization information. - * - * @see WwwAuthInfo - * @see PegasusLocalAuthInfo - */ -public abstract class AuthorizationInfo { - - protected String iAddr; - - protected int iPort; - - protected String iProtocol; - - protected String iRealm; - - protected String iScheme; - - protected PasswordAuthentication iCredentials; - - protected long iNc = 1; - - protected String iCnonce; - - protected String iOpaque; - - protected String iAlgorithm; - - protected String iUri; - - protected String iNonce; - - protected String iQop; - - protected String iA1; - - protected String iResponse; - - // protected byte[] iDigest; - - /** - * Initialize - * - * @param pProxy - * Proxy authentication ? - * @param pAddress - * Server address - * @param pPort - * Server port - * @param pProtocol - * Protocol - * @param pRealm - * Realm - * @param pScheme - * Scheme - */ - public void init(Boolean pProxy, String pAddress, int pPort, String pProtocol, String pRealm, - String pScheme) { - this.iAddr = pAddress; - this.iPort = pPort; - this.iProtocol = pProtocol; - this.iRealm = pRealm; - this.iScheme = pScheme; - } - - /** - * Sets opaque - * - * @param opaque - * new Value - */ - public void setOpaque(String opaque) { - this.iOpaque = opaque; - } - - /** - * Returns opaque - * - * @return Opaque - */ - public String getOpaque() { - return this.iOpaque; - } - - /** - * Returns Qop - * - * @return Qop - */ - public String getQop() { - return this.iQop; - } - - /** - * Sets Qop - * - * @param qop - * New value - */ - public void setQop(String qop) { - this.iQop = qop; - } - - /** - * Returns nc - * - * @return nc - */ - public long getNc() { - return this.iNc; - } - - /** - * Sets nc - * - * @param nc - * New value - */ - public void setNc(long nc) { - this.iNc = nc; - } - - /** - * Sets nonce - * - * @param nonce - * New Value - */ - public void setNonce(String nonce) { - this.iNonce = nonce; - } - - /** - * Returns nonce - * - * @return nonce - */ - public String getNonce() { - return this.iNonce; - } - - /** - * Set cnonce - * - * @param cnonce - * New value - */ - public void setCnonce(String cnonce) { - this.iCnonce = cnonce; - } - - /** - * Returns cnonce - * - * @return cnonce - */ - public String getCnonce() { - return this.iCnonce; - } - - /** - * Set algorithm - * - * @param algorithm - * New value - */ - public void setAlgorithm(String algorithm) { - this.iAlgorithm = algorithm; - } - - /** - * Returns algorithm - * - * @return algorithm - */ - public String getAlgorithm() { - return this.iAlgorithm; - } - - /** - * Returns A1 - * - * @return A1 - */ - public String getA1() { - return this.iA1; - } - - /** - * Sets A1 - * - * @param A1 - * New value - */ - public void setA1(String A1) { - this.iA1 = A1; - } - - /** - * Sets response - * - * @param response - * New value - */ - public void setResponse(String response) { - this.iResponse = response; - } - - /** - * Returns response - * - * @return New value - */ - public String getResponse() { - return this.iResponse; - } - - /** - * Returns URI - * - * @return URI - */ - public String getURI() { - return this.iUri; - } - - /** - * Sets URI - * - * @param uri - * New value - */ - public void setURI(String uri) { - this.iUri = uri; - } - - /** - * Sets credentials - * - * @param credentials - * New value - */ - public void setCredentials(PasswordAuthentication credentials) { - this.iCredentials = credentials; - } - - /** - * Returns the address - * - * @return The server address - */ - public String getAddr() { - return this.iAddr; - } - - /** - * Returns the port - * - * @return The server port - */ - public int getPort() { - return this.iPort; - } - - /** - * Returns the protocol - * - * @return The protocol - */ - public String getProtocol() { - return this.iProtocol; - } - - /** - * Returns the realm - * - * @return The realm - */ - public String getRealm() { - return this.iRealm; - } - - /** - * Sets the realm - * - * @param realm - * New value - */ - public void setRealm(String realm) { - this.iRealm = realm; - } - - /** - * Returns the scheme - * - * @return The scheme - */ - public String getScheme() { - return this.iScheme; - } - - /** - * Sets the scheme - * - * @param scheme - * New value - */ - public void setScheme(String scheme) { - this.iScheme = scheme; - } - - /** - * Returns the credentials - * - * @return The credentials - */ - public PasswordAuthentication getCredentials() { - return this.iCredentials; - } - - /** - * Compares two authorization informations. - * - * @param obj - * The other authorization information - * @return true if type, realm, scheme, address, protocol and - * port of both authorization informations are equal, - * false otherwise. - */ - public boolean match(Object obj) { - if (obj == null || !(obj instanceof AuthorizationInfo)) return false; - AuthorizationInfo that = (AuthorizationInfo) obj; - - boolean type = getClass().equals(that.getClass()); - // boolean prxt = (iProxy == null || that.iProxy == null)? - // true:iProxy.equals(that.iProxy); - boolean prmpt = (this.iRealm == null || that.iRealm == null) ? true : this.iRealm - .equals(that.iRealm); - boolean schm = (this.iScheme == null || that.iScheme == null) ? true : this.iScheme - .equals(that.iScheme); - boolean adr = (this.iAddr == null || that.iAddr == null) ? true : this.iAddr - .equals(that.iAddr); - boolean prot = (this.iProtocol == null || that.iProtocol == null) ? true : this.iProtocol - .equals(that.iProtocol); - boolean prt = (this.iPort <= 0 || that.iPort <= 0) ? true : (this.iPort == that.iPort); - return (type && prmpt && schm && adr && prot && prt); - } - - /** - * Updates the authorization information according to a received challenge. - * - * @param challenge - * The received challenge - * @param authenticate - * The authenticate header field - * @param url - * The url of the CIM server - * @param requestMethod - * The HTTP request method (POST or MPOST) - * @throws NoSuchAlgorithmException - */ - public abstract void updateAuthenticationInfo(Challenge challenge, String authenticate, - URI url, String requestMethod) throws NoSuchAlgorithmException; - - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - @Override - public abstract String toString(); - - /** - * Gets the HTTP header field name for this authentication information - * - * @return The field name - */ - public abstract String getHeaderFieldName(); - - /** - * Determines if the authorization information is already sent on the very - * first http request or after the "401 Unauthorized" response - * - * @return true or false - */ - public abstract boolean isSentOnFirstRequest(); - - /** - * Determines if the connection is kept alive after the "401 Unauthorized" - * response - * - * @return true or false - */ - public abstract boolean isKeptAlive(); - - /** - * Factory method for AuthorizationInfo objects. Returns an instance of a - * subclass according to the requested type. - * - * @param pModule - * The authorization info type to be constructed - * @param pProxy - * Proxy authentication ? - * @param pAddress - * Server address - * @param pPort - * Server port - * @param pProtocol - * Protocol (http/https) - * @param pRealm - * Realm - * @param pScheme - * Scheme (e.g. Basic, Digest) - * @return An instance of a AuthorizationInfo subclass or null - * @see WBEMConfiguration#getHttpAuthenticationModule() - * @see WwwAuthInfo - * @see PegasusLocalAuthInfo - */ - public static AuthorizationInfo createAuthorizationInfo(String pModule, Boolean pProxy, - String pAddress, int pPort, String pProtocol, String pRealm, String pScheme) { - - AuthorizationInfo info = createAuthorizationInfo(pModule); - - if (info != null) { - info.init(pProxy, pAddress, pPort, pProtocol, pRealm, pScheme); - } - - return info; - - } - - /** - * Factory method for AuthorizationInfo objects. Returns an instance of a - * subclass according to the requested type. - * - * @param pModule - * The authorization info type to be constructed - * @return An instance of a AuthorizationInfo subclass or null - */ - public static AuthorizationInfo createAuthorizationInfo(String pModule) { - - if (WwwAuthInfo.class.getName().equals(pModule)) { return new WwwAuthInfo(); } - if (PegasusLocalAuthInfo.class.getName().equals(pModule)) { return new PegasusLocalAuthInfo(); } - - try { - Class module = Class.forName(pModule); - AuthorizationInfo info = (AuthorizationInfo) module.newInstance(); - return info; - } catch (Exception e) { - LogAndTraceBroker.getBroker().trace(Level.FINER, - "Exception while loading authentication module", e); - LogAndTraceBroker.getBroker().message(Messages.HTTP_AUTH_MODULE_INVALID, pModule); - } - return null; - } -} +/* + (C) Copyright IBM Corp. 2005, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 17970 2005-08-11 pineiro5 Logon from z/OS not possible + * 1516242 2006-07-05 lupusalex Support of OpenPegasus local authentication + * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors + */ + +package org.metricshub.wbem.sblim.cimclient.internal.http; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.net.PasswordAuthentication; +import java.net.URI; +import java.security.NoSuchAlgorithmException; +import java.util.logging.Level; + +import org.metricshub.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; +import org.metricshub.wbem.sblim.cimclient.internal.logging.Messages; +import org.metricshub.wbem.sblim.cimclient.internal.util.WBEMConfiguration; + +/** + * Abstract superclass for HTTP authorization information. + * + * @see WwwAuthInfo + * @see PegasusLocalAuthInfo + */ +public abstract class AuthorizationInfo { + + protected String iAddr; + + protected int iPort; + + protected String iProtocol; + + protected String iRealm; + + protected String iScheme; + + protected PasswordAuthentication iCredentials; + + protected long iNc = 1; + + protected String iCnonce; + + protected String iOpaque; + + protected String iAlgorithm; + + protected String iUri; + + protected String iNonce; + + protected String iQop; + + protected String iA1; + + protected String iResponse; + + // protected byte[] iDigest; + + /** + * Initialize + * + * @param pProxy + * Proxy authentication ? + * @param pAddress + * Server address + * @param pPort + * Server port + * @param pProtocol + * Protocol + * @param pRealm + * Realm + * @param pScheme + * Scheme + */ + public void init(Boolean pProxy, String pAddress, int pPort, String pProtocol, String pRealm, + String pScheme) { + this.iAddr = pAddress; + this.iPort = pPort; + this.iProtocol = pProtocol; + this.iRealm = pRealm; + this.iScheme = pScheme; + } + + /** + * Sets opaque + * + * @param opaque + * new Value + */ + public void setOpaque(String opaque) { + this.iOpaque = opaque; + } + + /** + * Returns opaque + * + * @return Opaque + */ + public String getOpaque() { + return this.iOpaque; + } + + /** + * Returns Qop + * + * @return Qop + */ + public String getQop() { + return this.iQop; + } + + /** + * Sets Qop + * + * @param qop + * New value + */ + public void setQop(String qop) { + this.iQop = qop; + } + + /** + * Returns nc + * + * @return nc + */ + public long getNc() { + return this.iNc; + } + + /** + * Sets nc + * + * @param nc + * New value + */ + public void setNc(long nc) { + this.iNc = nc; + } + + /** + * Sets nonce + * + * @param nonce + * New Value + */ + public void setNonce(String nonce) { + this.iNonce = nonce; + } + + /** + * Returns nonce + * + * @return nonce + */ + public String getNonce() { + return this.iNonce; + } + + /** + * Set cnonce + * + * @param cnonce + * New value + */ + public void setCnonce(String cnonce) { + this.iCnonce = cnonce; + } + + /** + * Returns cnonce + * + * @return cnonce + */ + public String getCnonce() { + return this.iCnonce; + } + + /** + * Set algorithm + * + * @param algorithm + * New value + */ + public void setAlgorithm(String algorithm) { + this.iAlgorithm = algorithm; + } + + /** + * Returns algorithm + * + * @return algorithm + */ + public String getAlgorithm() { + return this.iAlgorithm; + } + + /** + * Returns A1 + * + * @return A1 + */ + public String getA1() { + return this.iA1; + } + + /** + * Sets A1 + * + * @param A1 + * New value + */ + public void setA1(String A1) { + this.iA1 = A1; + } + + /** + * Sets response + * + * @param response + * New value + */ + public void setResponse(String response) { + this.iResponse = response; + } + + /** + * Returns response + * + * @return New value + */ + public String getResponse() { + return this.iResponse; + } + + /** + * Returns URI + * + * @return URI + */ + public String getURI() { + return this.iUri; + } + + /** + * Sets URI + * + * @param uri + * New value + */ + public void setURI(String uri) { + this.iUri = uri; + } + + /** + * Sets credentials + * + * @param credentials + * New value + */ + public void setCredentials(PasswordAuthentication credentials) { + this.iCredentials = credentials; + } + + /** + * Returns the address + * + * @return The server address + */ + public String getAddr() { + return this.iAddr; + } + + /** + * Returns the port + * + * @return The server port + */ + public int getPort() { + return this.iPort; + } + + /** + * Returns the protocol + * + * @return The protocol + */ + public String getProtocol() { + return this.iProtocol; + } + + /** + * Returns the realm + * + * @return The realm + */ + public String getRealm() { + return this.iRealm; + } + + /** + * Sets the realm + * + * @param realm + * New value + */ + public void setRealm(String realm) { + this.iRealm = realm; + } + + /** + * Returns the scheme + * + * @return The scheme + */ + public String getScheme() { + return this.iScheme; + } + + /** + * Sets the scheme + * + * @param scheme + * New value + */ + public void setScheme(String scheme) { + this.iScheme = scheme; + } + + /** + * Returns the credentials + * + * @return The credentials + */ + public PasswordAuthentication getCredentials() { + return this.iCredentials; + } + + /** + * Compares two authorization informations. + * + * @param obj + * The other authorization information + * @return true if type, realm, scheme, address, protocol and + * port of both authorization informations are equal, + * false otherwise. + */ + public boolean match(Object obj) { + if (obj == null || !(obj instanceof AuthorizationInfo)) return false; + AuthorizationInfo that = (AuthorizationInfo) obj; + + boolean type = getClass().equals(that.getClass()); + // boolean prxt = (iProxy == null || that.iProxy == null)? + // true:iProxy.equals(that.iProxy); + boolean prmpt = (this.iRealm == null || that.iRealm == null) ? true : this.iRealm + .equals(that.iRealm); + boolean schm = (this.iScheme == null || that.iScheme == null) ? true : this.iScheme + .equals(that.iScheme); + boolean adr = (this.iAddr == null || that.iAddr == null) ? true : this.iAddr + .equals(that.iAddr); + boolean prot = (this.iProtocol == null || that.iProtocol == null) ? true : this.iProtocol + .equals(that.iProtocol); + boolean prt = (this.iPort <= 0 || that.iPort <= 0) ? true : (this.iPort == that.iPort); + return (type && prmpt && schm && adr && prot && prt); + } + + /** + * Updates the authorization information according to a received challenge. + * + * @param challenge + * The received challenge + * @param authenticate + * The authenticate header field + * @param url + * The url of the CIM server + * @param requestMethod + * The HTTP request method (POST or MPOST) + * @throws NoSuchAlgorithmException + */ + public abstract void updateAuthenticationInfo(Challenge challenge, String authenticate, + URI url, String requestMethod) throws NoSuchAlgorithmException; + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public abstract String toString(); + + /** + * Gets the HTTP header field name for this authentication information + * + * @return The field name + */ + public abstract String getHeaderFieldName(); + + /** + * Determines if the authorization information is already sent on the very + * first http request or after the "401 Unauthorized" response + * + * @return true or false + */ + public abstract boolean isSentOnFirstRequest(); + + /** + * Determines if the connection is kept alive after the "401 Unauthorized" + * response + * + * @return true or false + */ + public abstract boolean isKeptAlive(); + + /** + * Factory method for AuthorizationInfo objects. Returns an instance of a + * subclass according to the requested type. + * + * @param pModule + * The authorization info type to be constructed + * @param pProxy + * Proxy authentication ? + * @param pAddress + * Server address + * @param pPort + * Server port + * @param pProtocol + * Protocol (http/https) + * @param pRealm + * Realm + * @param pScheme + * Scheme (e.g. Basic, Digest) + * @return An instance of a AuthorizationInfo subclass or null + * @see WBEMConfiguration#getHttpAuthenticationModule() + * @see WwwAuthInfo + * @see PegasusLocalAuthInfo + */ + public static AuthorizationInfo createAuthorizationInfo(String pModule, Boolean pProxy, + String pAddress, int pPort, String pProtocol, String pRealm, String pScheme) { + + AuthorizationInfo info = createAuthorizationInfo(pModule); + + if (info != null) { + info.init(pProxy, pAddress, pPort, pProtocol, pRealm, pScheme); + } + + return info; + + } + + /** + * Factory method for AuthorizationInfo objects. Returns an instance of a + * subclass according to the requested type. + * + * @param pModule + * The authorization info type to be constructed + * @return An instance of a AuthorizationInfo subclass or null + */ + public static AuthorizationInfo createAuthorizationInfo(String pModule) { + + if (WwwAuthInfo.class.getName().equals(pModule)) { return new WwwAuthInfo(); } + if (PegasusLocalAuthInfo.class.getName().equals(pModule)) { return new PegasusLocalAuthInfo(); } + + try { + Class module = Class.forName(pModule); + AuthorizationInfo info = (AuthorizationInfo) module.newInstance(); + return info; + } catch (Exception e) { + LogAndTraceBroker.getBroker().trace(Level.FINER, + "Exception while loading authentication module", e); + LogAndTraceBroker.getBroker().message(Messages.HTTP_AUTH_MODULE_INVALID, pModule); + } + return null; + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/BASE64Encoder.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/BASE64Encoder.java similarity index 81% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/BASE64Encoder.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/BASE64Encoder.java index f728a81..d907f98 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/BASE64Encoder.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/BASE64Encoder.java @@ -1,143 +1,141 @@ -/* - (C) Copyright IBM Corp. 2005, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 17970 2005-08-11 pineiro5 Logon from z/OS not possible - * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.http; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.UnsupportedEncodingException; - -/** - * Class BASE64Encoder implements the BASE64 encoding algorithm - * - */ -public final class BASE64Encoder { - - private static byte BASE64_ALPHABET[] = { 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, - 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, 100, 101, 102, 103, - 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, - 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47 }; - - private BASE64Encoder() { - // no instances - } - - /** - * Encodes a given byte array - * - * @param pPlain - * The raw bytes - * @return The encoded bytes - */ - public static String encode(byte[] pPlain) { - byte encoded[]; - int totalBits = pPlain.length << 3; - int remainder = totalBits % 24; - int totalEncoded = totalBits / 24; - - int size = totalEncoded; - if (remainder > 0) size++; - - encoded = new byte[size << 2]; - - short highBits = 0; - short lowBits = 0; - short byte1 = 0; - short byte2 = 0; - short byte3 = 0; - int dest = 0; - int source = 0; - for (int i = 0; i < totalEncoded; i++) { - byte1 = (short) (pPlain[source++] & 0xFF); - byte2 = (short) (pPlain[source++] & 0xFF); - byte3 = (short) (pPlain[source++] & 0xFF); - - highBits = (short) (byte1 & 0x03); - lowBits = (short) (byte2 & 0x0F); - - short val1 = (short) (byte1 >> 2); - short val2 = (short) (byte2 >> 4); - short val3 = (short) (byte3 >> 6); - - encoded[dest++] = BASE64_ALPHABET[val1]; - encoded[dest++] = BASE64_ALPHABET[val2 | (highBits << 4)]; - encoded[dest++] = BASE64_ALPHABET[(lowBits << 2) | val3]; - encoded[dest++] = BASE64_ALPHABET[byte3 & 0x3f]; - } - - if (remainder == 8) { - byte1 = (short) (pPlain[source] & 0xFF); - highBits = (short) (byte1 & 0x03); - short val1 = (short) (byte1 >> 2); - encoded[dest++] = BASE64_ALPHABET[val1]; - encoded[dest++] = BASE64_ALPHABET[highBits << 4]; - encoded[dest++] = (byte) 61; // '=' - encoded[dest++] = (byte) 61; // '=' - } else if (remainder == 16) { - byte1 = (short) (pPlain[source++] & 0xFF); - byte2 = (short) (pPlain[source++] & 0xFF); - highBits = (short) (byte1 & 0x03); - lowBits = (short) (byte2 & 0x0F); - - short val1 = (short) (byte1 >> 2); - short val2 = (short) (byte2 >> 4); - - encoded[dest++] = BASE64_ALPHABET[val1]; - encoded[dest++] = BASE64_ALPHABET[val2 | (highBits << 4)]; - encoded[dest++] = BASE64_ALPHABET[lowBits << 2]; - encoded[dest++] = (byte) 61; // '=' - } - String res; - try { - res = new String(encoded, "ASCII"); - } catch (UnsupportedEncodingException e) { - try { - res = new String(encoded, "UTF-8"); - } catch (UnsupportedEncodingException e1) { - res = new String(encoded); - } - } - return res; - } - -} +/* + (C) Copyright IBM Corp. 2005, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 17970 2005-08-11 pineiro5 Logon from z/OS not possible + * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.http; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.UnsupportedEncodingException; + +/** + * Class BASE64Encoder implements the BASE64 encoding algorithm + * + */ +public final class BASE64Encoder { + + private static byte BASE64_ALPHABET[] = { 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, + 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, 100, 101, 102, 103, + 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, + 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47 }; + + private BASE64Encoder() { + // no instances + } + + /** + * Encodes a given byte array + * + * @param pPlain + * The raw bytes + * @return The encoded bytes + */ + public static String encode(byte[] pPlain) { + byte encoded[]; + int totalBits = pPlain.length << 3; + int remainder = totalBits % 24; + int totalEncoded = totalBits / 24; + + int size = totalEncoded; + if (remainder > 0) size++; + + encoded = new byte[size << 2]; + + short highBits = 0; + short lowBits = 0; + short byte1 = 0; + short byte2 = 0; + short byte3 = 0; + int dest = 0; + int source = 0; + for (int i = 0; i < totalEncoded; i++) { + byte1 = (short) (pPlain[source++] & 0xFF); + byte2 = (short) (pPlain[source++] & 0xFF); + byte3 = (short) (pPlain[source++] & 0xFF); + + highBits = (short) (byte1 & 0x03); + lowBits = (short) (byte2 & 0x0F); + + short val1 = (short) (byte1 >> 2); + short val2 = (short) (byte2 >> 4); + short val3 = (short) (byte3 >> 6); + + encoded[dest++] = BASE64_ALPHABET[val1]; + encoded[dest++] = BASE64_ALPHABET[val2 | (highBits << 4)]; + encoded[dest++] = BASE64_ALPHABET[(lowBits << 2) | val3]; + encoded[dest++] = BASE64_ALPHABET[byte3 & 0x3f]; + } + + if (remainder == 8) { + byte1 = (short) (pPlain[source] & 0xFF); + highBits = (short) (byte1 & 0x03); + short val1 = (short) (byte1 >> 2); + encoded[dest++] = BASE64_ALPHABET[val1]; + encoded[dest++] = BASE64_ALPHABET[highBits << 4]; + encoded[dest++] = (byte) 61; // '=' + encoded[dest++] = (byte) 61; // '=' + } else if (remainder == 16) { + byte1 = (short) (pPlain[source++] & 0xFF); + byte2 = (short) (pPlain[source++] & 0xFF); + highBits = (short) (byte1 & 0x03); + lowBits = (short) (byte2 & 0x0F); + + short val1 = (short) (byte1 >> 2); + short val2 = (short) (byte2 >> 4); + + encoded[dest++] = BASE64_ALPHABET[val1]; + encoded[dest++] = BASE64_ALPHABET[val2 | (highBits << 4)]; + encoded[dest++] = BASE64_ALPHABET[lowBits << 2]; + encoded[dest++] = (byte) 61; // '=' + } + String res; + try { + res = new String(encoded, "ASCII"); + } catch (UnsupportedEncodingException e) { + try { + res = new String(encoded, "UTF-8"); + } catch (UnsupportedEncodingException e1) { + res = new String(encoded); + } + } + return res; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/Challenge.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/Challenge.java similarity index 88% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/Challenge.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/Challenge.java index 41d3c59..e41d1b2 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/Challenge.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/Challenge.java @@ -1,282 +1,280 @@ -/* - (C) Copyright IBM Corp. 2005, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 3596303 2013-01-04 blaschke-oss windows http response WWW-Authenticate: Negotiate fails - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.http; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.Vector; - -/** - * Class Challenge holds a http authentication challenge - * - */ -public class Challenge { - - private String iScheme; - - private HttpHeader iParams; - - private Challenge() { - // hidden ctor - } - - /** - * Returns the parameters - * - * @return The parameters - */ - public HttpHeader getParams() { - return this.iParams; - } - - /** - * Returns the scheme - * - * @return The scheme - */ - public String getScheme() { - return this.iScheme; - } - - /** - * Returns the realm - * - * @return The realm - */ - public String getRealm() { - return this.iParams.getField("realm"); - } - - /** - * Parses the challenge as received from the host. RFC 2617 defines the - * following syntax for a challenge: - * - *
      -	 * challenge = auth-scheme 1*SP 1#auth-param 
      -	 * auth-scheme = token 
      -	 * auth-param = token "=" ( token | quoted-string )
      -	 * 
      - * - * @param pLine - * The challenge string - * @return The parsed challenge - * @throws HttpParseException - * If the challenge string is ill-formed - */ - public static Challenge[] parseChallenge(String pLine) throws HttpParseException { - if (pLine == null || pLine.length() == 0) throw new IllegalArgumentException( - "Invalid challenge, empty"); - pLine = pLine.trim(); - if (pLine.length() == 0) throw new IllegalArgumentException("Invalid challenge, empty"); - - Vector challenges = new Vector(); - - try { - int start = 0, end = 0; - - // Break up comma-separated list into tokens - Vector tokensBetweenCommas = new Vector(); - while ((end = indexOfOutsideQuotedString(pLine, ',', start)) > 0) { - tokensBetweenCommas.add(removeWhitespace(pLine.substring(start, end))); - start = end + 1; - } - if (start < pLine.length()) tokensBetweenCommas.add(removeWhitespace(pLine - .substring(start))); - - // Break up tokens into auth-scheme and auth-param - Vector tokens = new Vector(); - for (int i = 0; i < tokensBetweenCommas.size(); i++) { - String token = tokensBetweenCommas.elementAt(i); - - if (token.length() == 0) continue; - - start = 0; - end = indexOfOutsideQuotedString(token, ' ', start); - - if (end == -1) { - tokens.add(token); - } else { - tokens.add(token.substring(0, end)); - start = end + 1; - end = indexOfOutsideQuotedString(token, ' ', start); - - if (end == -1) { - // RFC 2617 indicates this token should be of the - // name=value format, but at least one old CIMOM (SVC - // ICAT) does not follow this rule. The Client - // effectively ignores this token, and so must continue - // to do so. - if (indexOfOutsideQuotedString(token, '=', start) == -1) { - // throw new - // HttpParseException("Invalid challenge, second token must be name=value in " - // + token); - } else { - tokens.add(token.substring(start)); - } - } else { - throw new HttpParseException("Invalid challenge, too many tokens in " - + token); - } - } - } - - Challenge challenge = new Challenge(); - challenge.iScheme = null; - challenge.iParams = new HttpHeader(); - - for (int i = 0; i < tokens.size(); i++) { - String token = tokens.elementAt(i); - - int equalSign = indexOfOutsideQuotedString(token, '=', 0); - if (equalSign == 0) { - throw new HttpParseException( - "Invalid challenge, no token before equal sign in " + token); - } else if (equalSign > 0) { - // param - if (challenge.iScheme == null) throw new HttpParseException( - "Invalid challenge, param without scheme"); - String name = token.substring(0, equalSign); - String value = token.substring(equalSign + 1); - if (value.length() == 0) { - throw new HttpParseException( - "Invalid challenge, no token after equal sign in " + token); - } else if (value.startsWith("\"") && value.endsWith("\"") && value.length() > 1) { - challenge.iParams.addField(name, value.substring(1, value.length() - 1)); - } else { - challenge.iParams.addField(name, value); - } - } else { - // scheme - if (challenge.iScheme != null) { - // new scheme - challenges.add(challenge); - - challenge = new Challenge(); - challenge.iParams = new HttpHeader(); - } - challenge.iScheme = new String(token); - } - } - - if (challenge.iScheme != null) { - challenges.add(challenge); - } - } catch (HttpParseException e) { - throw e; - } catch (Exception e) { - throw new HttpParseException("Invalid challenge, " + e.getMessage()); - } - - return challenges.toArray(new Challenge[challenges.size()]); - - } - - /* - * Removes unnecessary whitespace from a challenge such that - * " scheme name = value " becomes "scheme name=value" - */ - private static String removeWhitespace(String str) throws HttpParseException { - char inBuf[] = str.trim().toCharArray(); - StringBuilder outStr = new StringBuilder(); - boolean inQuotes = false; - - for (int inIdx = 0; inIdx < inBuf.length; inIdx++) { - if (inQuotes || !Character.isSpaceChar(inBuf[inIdx])) { - if (inBuf[inIdx] == '=' && outStr.length() == 0) throw new HttpParseException( - "Invalid challenge, no token before equal sign in " + str); - - outStr.append(inBuf[inIdx]); - } else { - // Whitespace not within quoted string - int i = skipSpaces(inBuf, inIdx + 1); - if (i >= inBuf.length) throw new HttpParseException( - "Invalid challenge, no token after space in " + str); - - if (inBuf[i] == '=') { - // auth-param, remove all whitespace up to next token - i = skipSpaces(inBuf, i + 1); - if (i >= inBuf.length) throw new HttpParseException( - "Invalid challenge, no token after equal sign in " + str); - outStr.append('='); - } else { - // another token, combine all whitespace up to next token - // into single space - outStr.append(' '); - } - outStr.append(inBuf[i]); - inIdx = i; - } - if (inBuf[inIdx] == '\"') inQuotes = !inQuotes; - } - if (inQuotes) throw new HttpParseException( - "Invalid challenge, quoted string not terminated in " + str); - return outStr.toString(); - } - - private static int skipSpaces(char[] buf, int pos) { - while (pos < buf.length && Character.isSpaceChar(buf[pos])) - pos++; - return pos; - } - - private static int indexOfOutsideQuotedString(String str, int ch, int pos) - throws HttpParseException { - int len = str.length(); - boolean inQuotes = false; - - while (pos < len) { - if (str.charAt(pos) == '\"') { - inQuotes = !inQuotes; - } else if (str.charAt(pos) == ch) { - if (!inQuotes) return pos; - } - pos++; - } - if (inQuotes) throw new HttpParseException( - "Invalid callenge, quoted string not terminated in " + str); - return -1; - } - -} +/* + (C) Copyright IBM Corp. 2005, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 3596303 2013-01-04 blaschke-oss windows http response WWW-Authenticate: Negotiate fails + */ + +package org.metricshub.wbem.sblim.cimclient.internal.http; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.Vector; + +/** + * Class Challenge holds a http authentication challenge + * + */ +public class Challenge { + + private String iScheme; + + private HttpHeader iParams; + + private Challenge() { + // hidden ctor + } + + /** + * Returns the parameters + * + * @return The parameters + */ + public HttpHeader getParams() { + return this.iParams; + } + + /** + * Returns the scheme + * + * @return The scheme + */ + public String getScheme() { + return this.iScheme; + } + + /** + * Returns the realm + * + * @return The realm + */ + public String getRealm() { + return this.iParams.getField("realm"); + } + + /** + * Parses the challenge as received from the host. RFC 2617 defines the + * following syntax for a challenge: + * + *
      +	 * challenge = auth-scheme 1*SP 1#auth-param 
      +	 * auth-scheme = token 
      +	 * auth-param = token "=" ( token | quoted-string )
      +	 * 
      + * + * @param pLine + * The challenge string + * @return The parsed challenge + * @throws HttpParseException + * If the challenge string is ill-formed + */ + public static Challenge[] parseChallenge(String pLine) throws HttpParseException { + if (pLine == null || pLine.length() == 0) throw new IllegalArgumentException( + "Invalid challenge, empty"); + pLine = pLine.trim(); + if (pLine.length() == 0) throw new IllegalArgumentException("Invalid challenge, empty"); + + Vector challenges = new Vector(); + + try { + int start = 0, end = 0; + + // Break up comma-separated list into tokens + Vector tokensBetweenCommas = new Vector(); + while ((end = indexOfOutsideQuotedString(pLine, ',', start)) > 0) { + tokensBetweenCommas.add(removeWhitespace(pLine.substring(start, end))); + start = end + 1; + } + if (start < pLine.length()) tokensBetweenCommas.add(removeWhitespace(pLine + .substring(start))); + + // Break up tokens into auth-scheme and auth-param + Vector tokens = new Vector(); + for (int i = 0; i < tokensBetweenCommas.size(); i++) { + String token = tokensBetweenCommas.elementAt(i); + + if (token.length() == 0) continue; + + start = 0; + end = indexOfOutsideQuotedString(token, ' ', start); + + if (end == -1) { + tokens.add(token); + } else { + tokens.add(token.substring(0, end)); + start = end + 1; + end = indexOfOutsideQuotedString(token, ' ', start); + + if (end == -1) { + // RFC 2617 indicates this token should be of the + // name=value format, but at least one old CIMOM (SVC + // ICAT) does not follow this rule. The Client + // effectively ignores this token, and so must continue + // to do so. + if (indexOfOutsideQuotedString(token, '=', start) == -1) { + // throw new + // HttpParseException("Invalid challenge, second token must be name=value in " + // + token); + } else { + tokens.add(token.substring(start)); + } + } else { + throw new HttpParseException("Invalid challenge, too many tokens in " + + token); + } + } + } + + Challenge challenge = new Challenge(); + challenge.iScheme = null; + challenge.iParams = new HttpHeader(); + + for (int i = 0; i < tokens.size(); i++) { + String token = tokens.elementAt(i); + + int equalSign = indexOfOutsideQuotedString(token, '=', 0); + if (equalSign == 0) { + throw new HttpParseException( + "Invalid challenge, no token before equal sign in " + token); + } else if (equalSign > 0) { + // param + if (challenge.iScheme == null) throw new HttpParseException( + "Invalid challenge, param without scheme"); + String name = token.substring(0, equalSign); + String value = token.substring(equalSign + 1); + if (value.length() == 0) { + throw new HttpParseException( + "Invalid challenge, no token after equal sign in " + token); + } else if (value.startsWith("\"") && value.endsWith("\"") && value.length() > 1) { + challenge.iParams.addField(name, value.substring(1, value.length() - 1)); + } else { + challenge.iParams.addField(name, value); + } + } else { + // scheme + if (challenge.iScheme != null) { + // new scheme + challenges.add(challenge); + + challenge = new Challenge(); + challenge.iParams = new HttpHeader(); + } + challenge.iScheme = new String(token); + } + } + + if (challenge.iScheme != null) { + challenges.add(challenge); + } + } catch (HttpParseException e) { + throw e; + } catch (Exception e) { + throw new HttpParseException("Invalid challenge, " + e.getMessage()); + } + + return challenges.toArray(new Challenge[challenges.size()]); + + } + + /* + * Removes unnecessary whitespace from a challenge such that + * " scheme name = value " becomes "scheme name=value" + */ + private static String removeWhitespace(String str) throws HttpParseException { + char inBuf[] = str.trim().toCharArray(); + StringBuilder outStr = new StringBuilder(); + boolean inQuotes = false; + + for (int inIdx = 0; inIdx < inBuf.length; inIdx++) { + if (inQuotes || !Character.isSpaceChar(inBuf[inIdx])) { + if (inBuf[inIdx] == '=' && outStr.length() == 0) throw new HttpParseException( + "Invalid challenge, no token before equal sign in " + str); + + outStr.append(inBuf[inIdx]); + } else { + // Whitespace not within quoted string + int i = skipSpaces(inBuf, inIdx + 1); + if (i >= inBuf.length) throw new HttpParseException( + "Invalid challenge, no token after space in " + str); + + if (inBuf[i] == '=') { + // auth-param, remove all whitespace up to next token + i = skipSpaces(inBuf, i + 1); + if (i >= inBuf.length) throw new HttpParseException( + "Invalid challenge, no token after equal sign in " + str); + outStr.append('='); + } else { + // another token, combine all whitespace up to next token + // into single space + outStr.append(' '); + } + outStr.append(inBuf[i]); + inIdx = i; + } + if (inBuf[inIdx] == '\"') inQuotes = !inQuotes; + } + if (inQuotes) throw new HttpParseException( + "Invalid challenge, quoted string not terminated in " + str); + return outStr.toString(); + } + + private static int skipSpaces(char[] buf, int pos) { + while (pos < buf.length && Character.isSpaceChar(buf[pos])) + pos++; + return pos; + } + + private static int indexOfOutsideQuotedString(String str, int ch, int pos) + throws HttpParseException { + int len = str.length(); + boolean inQuotes = false; + + while (pos < len) { + if (str.charAt(pos) == '\"') { + inQuotes = !inQuotes; + } else if (str.charAt(pos) == ch) { + if (!inQuotes) return pos; + } + pos++; + } + if (inQuotes) throw new HttpParseException( + "Invalid callenge, quoted string not terminated in " + str); + return -1; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/HttpClient.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpClient.java similarity index 93% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/HttpClient.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpClient.java index 02752bf..c324b87 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/HttpClient.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpClient.java @@ -1,1290 +1,1288 @@ -/* - HttpClient.java - - (C) Copyright IBM Corp. 2005, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 13799 2004-12-07 thschaef Fix chunking support - * 17620 2005-06-29 thschaef eliminate ASCIIPrintStream1 in import statement - * 17970 2005-08-11 pineiro5 Logon from z/OS not possible - * 1353168 2005-11-24 fiuczy Possible NullPointerExcection in HttpClient.streamFinished() - * 1422316 2006-05-15 lupusalex Disable delayed acknowledgement - * 1486379 2006-05-29 lupusalex CIM client retries twice when HTTP/1.1 401 is returned - * 1498130 2006-05-31 lupusalex Selection of xml parser on a per connection basis - * 1516244 2006-07-10 ebak GCJ support - * 1536711 2006-08-15 lupusalex NullPointerException causes client call to never return - * 1535756 2006-08-07 lupusalex Make code warning free - * 1565091 2006-10-17 ebak ssl handshake exception - * 1516242 2006-11-27 lupusalex Support of OpenPegasus local authentication - * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant - * 1604329 2006-12-18 lupusalex Fix OpenPegasus auth module - * 1620526 2007-01-08 lupusalex Socket Leak in HTTPClient.getResponseCode() - * 1627832 2007-01-08 lupuslaex Incorrect retry behaviour on HTTP 401 - * 1637546 2007-01-27 lupusalex CIMEnumerationImpl has faulty close function - * 1647148 2007-01-29 lupusalex HttpClient.resetSocket() doesn't set socket timeout - * 1647159 2007-01-29 lupusalex HttpClientPool runs out of HttpClients - * 1649595 2007-02-01 lupusalex No chunkig requested - * 1660743 2007-02-15 lupusalex SSLContext is static - * 1702832 2007-04-18 lupusalex WBEMClientCIMXL.setCustomSocketFactory() not implemented - * 1715511 2007-05-09 lupusalex FVT: Wrong HTTP header values - * 1892046 2008-02-13 blaschke-oss Basic/digest authentication problem for Japanese users - * 1931216 2008-04-01 blaschke-oss In HTTPClient need to get status before closing connection - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings - * 2372030 2008-12-01 blaschke-oss Add property to control synchronized SSL handshaking - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2714989 2009-03-26 blaschke-oss Code cleanup from redundant null check et al - * 2750520 2009-04-10 blaschke-oss Code cleanup from empty statement et al - * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors - * 2817962 2009-08-05 blaschke-oss socket creation connects w/o a timeout - * 2994776 2010-05-05 blaschke-oss http 401 gives CIM_ERR_FAILED instead of CIM_ERR_ACCESS_DENIED - * 2997865 2010-05-07 blaschke-oss Infinite loop in HttpClient - * 3004762 2010-06-16 blaschke-oss HTTPClient infinite loop for HTTP 407 - * 3022554 2010-06-30 blaschke-oss Flushing socket ignores skip() return code - * 3046073 2010-09-07 blaschke-oss Performance hit due to socket conn. creation with timeout - * 3195069 2011-02-28 blaschke-oss Need support to disable SSL Handshake - * 3235440 2011-03-22 blaschke-oss NullPointerException when socket factory returns null - * 3323310 2011-06-20 blaschke-oss Need the ability to override certain Global Properties - * 3400209 2011-08-31 blaschke-oss Highlighted Static Analysis (PMD) issues - * 3444912 2011-11-29 blaschke-oss Client delay during SSL handshake - * 3492224 2012-02-23 blaschke-oss Need two different timeouts for Socket connections - * 3504304 2012-03-14 blaschke-oss Rename socket timeout variables - * 3523918 2012-05-06 blaschke-oss "java.io.IOException: Unexpected EOF" returned as HTTP 401 - * 3524050 2012-06-06 blaschke-oss Improve WWW-Authenticate in HTTPClient.java - * 3557283 2012-11-05 blaschke-oss Print full response when get EOF from CIMOM - * 3601894 2013-01-23 blaschke-oss Enhance HTTP and CIM-XML tracing - * 2619 2013-02-22 blaschke-oss Host should contain port when not 5988/5989 - * 2621 2013-02-23 blaschke-oss Not all chunked input has trailers - * 2618 2013-02-27 blaschke-oss Need to add property to disable weak cipher suites for the secure indication - * 2642 2013-05-21 blaschke-oss Seperate properties needed for cim client and listener to filter out ciphers - * 2654 2013-07-29 blaschke-oss Check jcc idle time with CIMOM keepalive timeout to avoid EOF - * 2655 2013-08-14 blaschke-oss Content-length must be ignored when Transfer-encoding present - * 2151 2013-08-20 blaschke-oss gzip compression not supported - * 2709 2013-11-13 blaschke-oss Lower the level of the EOF message to FINE - */ -package org.sentrysoftware.wbem.sblim.cimclient.internal.http; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.BufferedInputStream; -import java.io.BufferedOutputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.HttpURLConnection; -import java.net.InetSocketAddress; -import java.net.Socket; -import java.net.SocketTimeoutException; -import java.net.URI; -import java.security.AccessController; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; -import java.security.PrivilegedAction; -import java.util.Arrays; -import java.util.Iterator; -import java.util.StringTokenizer; -import java.util.Vector; -import java.util.Map.Entry; -import java.util.logging.Level; -import java.util.zip.GZIPInputStream; - -import javax.net.SocketFactory; -import javax.net.ssl.HandshakeCompletedEvent; -import javax.net.ssl.HandshakeCompletedListener; -import javax.net.ssl.SSLSession; -import javax.net.ssl.SSLSocket; -import javax.net.ssl.SSLSocketFactory; - -import org.sentrysoftware.wbem.sblim.cimclient.WBEMConfigurationProperties; -import org.sentrysoftware.wbem.sblim.cimclient.internal.http.HttpHeader.HeaderEntry; -import org.sentrysoftware.wbem.sblim.cimclient.internal.http.io.ASCIIPrintStream; -import org.sentrysoftware.wbem.sblim.cimclient.internal.http.io.BoundedInputStream; -import org.sentrysoftware.wbem.sblim.cimclient.internal.http.io.ChunkedInputStream; -import org.sentrysoftware.wbem.sblim.cimclient.internal.http.io.KeepAliveInputStream; -import org.sentrysoftware.wbem.sblim.cimclient.internal.http.io.PersistentInputStream; -import org.sentrysoftware.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; -import org.sentrysoftware.wbem.sblim.cimclient.internal.logging.Messages; -import org.sentrysoftware.wbem.sblim.cimclient.internal.util.WBEMConstants; - -/** - * Class HttpClient implements a HTTP client - * - */ -public class HttpClient implements HandshakeCompletedListener { - - private static class HostPortPair { - - String iHost; - - /** - * Ctor. - * - * @param url - * The url - */ - public HostPortPair(URI url) { - this.iHost = url.getScheme().toLowerCase() + ':' + url.getHost().toLowerCase() + ':' - + url.getPort(); - } - - @Override - public boolean equals(Object o) { - if (!(o instanceof HostPortPair)) return false; - - return this.iHost.equals(((HostPortPair) o).iHost); - } - - @Override - public int hashCode() { - return this.iHost.hashCode(); - } - - @Override - public String toString() { - return "HostPortPair=[+" + this.iHost + "]"; - } - } - - private static class GetProperty implements PrivilegedAction { - - String iPropertyName; - - GetProperty(String propertyName) { - this.iPropertyName = propertyName; - } - - public Object run() { - return System.getProperty(this.iPropertyName); - } - } - - private static String iEncoding; - - static { - try { - iEncoding = (String) AccessController.doPrivileged(new PrivilegedAction() { - - public Object run() { - return System.getProperty("file.encoding", "ISO8859_1"); - } - }); - if (!isASCIISuperset(iEncoding)) iEncoding = "ISO8859_1"; - } catch (Exception exception) { - iEncoding = "ISO8859_1"; - } - } - - /** - * Converts a byte array to a String of hex digits - * - * @param digest - * The byte array - * @return The hex string - */ - public static String convertToHexString(byte[] digest) { - char hexDigit[] = "0123456789abcdef".toCharArray(); - - StringBuffer buf = new StringBuffer(); - for (int i = 0; i < digest.length; i++) { - int b = digest[i]; - buf.append(hexDigit[(b >> 4) & 0xF]); - buf.append(hexDigit[(b) & 0xF]); - } - return buf.toString(); - } - - /** - * Returns a client from a http client pool - * - * @param url - * The url to connect to - * @param clientPool - * The client pool - * @param auth_handler - * The authentication handler to use - * @return A http client from the pool - */ - public static HttpClient getClient(URI url, HttpClientPool clientPool, - AuthorizationHandler auth_handler) { - - return clientPool.retrieveAvailableConnectionFromPool(url, auth_handler); - } - - protected static String dequote(String str) { - int len = str.length(); - if (len > 1 && str.charAt(0) == '\"' && str.charAt(len - 1) == '\"') return str.substring( - 1, len - 1); - return str; - } - - protected static void handleRsp(String authInfo, AuthorizationInfo prevAuthInfo) - throws IOException { - if (authInfo != null) { - HttpHeader params = HttpHeader.parse(authInfo); - - String nonce = params.getField("nextnonce"); - if (nonce != null) { - prevAuthInfo.setNonce(nonce); - prevAuthInfo.setNc(0); - } else { - nonce = prevAuthInfo.getNonce(); - } - String qop = params.getField("qop"); - if (qop != null) { - if (!"auth".equalsIgnoreCase(qop) && !"auth-int".equalsIgnoreCase(qop)) { - // TODO - throw new IOException( - "Authentication Digest with integrity check not supported"); - } - byte[] rspauth; - String rspauthStr = dequote(params.getField("rspauth")); - if (rspauthStr != null) { - rspauth = parseHex(rspauthStr); - - String cnonce = dequote(params.getField("cnonce")); - if (cnonce != null && !cnonce.equals(prevAuthInfo.getCnonce())) { throw new IOException( - "Digest authentication: Invalid nonce counter"); } - String ncStr = params.getField("nc"); - if (ncStr != null) { - try { - long nc = Long.parseLong(ncStr, 16); - if (nc != prevAuthInfo.getNc()) { throw new IOException(); } - } catch (Exception e) { - throw new IOException("Digest authentication: Invalid nonce counter"); - } - } - - String HA1, HA2; - MessageDigest md5; - try { - md5 = MessageDigest.getInstance("MD5"); - md5.reset(); - byte[] bytes = prevAuthInfo.getA1().getBytes("UTF-8"); - md5.update(bytes); - HA1 = convertToHexString(md5.digest()); - if ("MD5-sess".equalsIgnoreCase(params.getField("algorithm"))) { - md5.reset(); - md5.update((HA1 + ":" + nonce + ":" + cnonce).getBytes("UTF-8")); - HA1 = convertToHexString(md5.digest()); - } - - HA2 = ":" + prevAuthInfo.getURI(); - if ("auth-int".equalsIgnoreCase(qop)) { - md5.reset(); - md5.update(new byte[] {}); - HA2 += ":" + convertToHexString(md5.digest()); - } - md5.reset(); - md5.update(HA2.getBytes("UTF-8")); - HA2 = convertToHexString(md5.digest()); - - md5.reset(); - md5.update((HA1 + ":" + nonce + ":" + ncStr + ":" + cnonce + ":" + qop - + ":" + HA2).getBytes("UTF-8")); - String hsh = convertToHexString(md5.digest()); - byte[] hash = parseHex(hsh); - - if (!Arrays.equals(hash, rspauth)) throw new IOException( - "Digest Authentication failed!"); - - } catch (NoSuchAlgorithmException e1) { - throw new IOException( - "Unable to validate Authentication response: NoSuchAlgorithmException"); - } - } - } else { - // TODO compute md5 of the entity-body - } - } - } - - protected static byte[] parseHex(String hex) { - byte[] value = new byte[hex.length() >> 1]; - int n = 0; - for (int i = 0; i < value.length; i++) { - value[i] = (byte) (0xff & Integer.parseInt(hex.substring(n, n + 1), 16)); - n += 2; - } - return value; - } - - private static boolean isASCIISuperset(String charset) throws Exception { - String asciiSuperSet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_.!~*'();/?:@&=+$,"; - byte abyte0[] = { 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, - 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, - 116, 117, 118, 119, 120, 121, 122, 45, 95, 46, 33, 126, 42, 39, 40, 41, 59, 47, 63, - 58, 64, 38, 61, 43, 36, 44 }; - byte convertedArray[] = asciiSuperSet.getBytes(charset); - return Arrays.equals(convertedArray, abyte0); - } - - private boolean iConnected = false; - - private HttpClientPool iHttpClientPool; - - private AuthorizationHandler iAuth_handler; - - private SSLSession iSession; - - private InputStream iIStream; - - private boolean iUseHttp11 = true; - - private boolean iKeepAlive = true; - - private HttpClientMethod iMethod; - - private OutputStream iOStream; - - private AuthorizationInfo iPrevAuthInfo; - - private AuthorizationInfo iPrevProxy; - - private HttpHeader iRequestHeaders = new HttpHeader(); - - private String iRequestMethod = "POST"; - - private boolean iReset = true; - - private HttpClientMethod iResponse; - - private HttpHeader iResponseHeaders = new HttpHeader(); - - private InputStream iServerInput; - - private ByteArrayOutputStream iServerOutput; - - private Socket iSocket; - - private URI iUrl; - - private long iPreviousResponseTime = -1; - - /** - * Ctor. - * - * @param url - * The url to connect to - * @param clientPool - * The associated client pool - * @param auth_handler - * The authentication handler - */ - public HttpClient(URI url, HttpClientPool clientPool, AuthorizationHandler auth_handler) { - this.iUrl = url; - this.iAuth_handler = auth_handler; - this.iHttpClientPool = clientPool; - } - - /** - * Connects to the http server - * - * @throws IOException - */ - public void connect() throws IOException { - LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); - logger.entry(); - try { - this.iReset = true; - this.iResponse = null; - this.iConnected = true; - this.iServerOutput = null; - resetSocket(); - } finally { - logger.exit(); - } - } - - /** - * Disconnects the session - */ - public synchronized void disconnect() { - LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); - logger.entry(); - this.iConnected = false; - if (this.iSocket != null) { - try { - this.iSocket.close(); - } catch (IOException e) { - logger.trace(Level.FINE, "Unexpected problem closing http socket", e); - } - this.iSocket = null; - this.iServerInput = null; - this.iReset = true; - this.iResponse = null; - } - logger.exit(); - } - - @Override - protected void finalize() throws Throwable { - try { - this.iSocket.close(); - } catch (IOException e) { - // bad luck - } finally { - super.finalize(); - } - } - - /** - * Returns the http header field value for a given index - * - * @param index - * The index - * @return The header field value - */ - public synchronized String getHeaderFieldValue(int index) { - - if (index < 0) throw new IllegalArgumentException(); - if (index == 0) return this.iResponse.toString(); - - Iterator> iterator = this.iResponseHeaders.iterator(); - while (iterator.hasNext() && --index >= 0) { - Entry entry = iterator.next(); - if (index == 0) return entry.getValue().toString(); - } - return null; - } - - /** - * Returns the http header field for a given name - * - * @param name - * The name - * @return The header field - */ - public synchronized String getHeaderField(String name) { - return this.iResponseHeaders.getField(name); - } - - /** - * Return the http header field name for a given index - * - * @param index - * The index - * @return The name - */ - public synchronized String getHeaderFieldName(int index) { - if (index < 0) throw new IllegalArgumentException(); - if (index == 0) return null; - - Iterator> iterator = this.iResponseHeaders.iterator(); - while (iterator.hasNext() && --index >= 0) { - Entry entry = iterator.next(); - if (index == 0) return entry.getKey().toString(); - } - return null; - } - - /** - * Returns the input stream of this http connection - * - * @return The input stream - * @throws IOException - */ - public synchronized InputStream getInputStream() throws IOException { - if (getResponseCode() < 500 && this.iResponse != null && this.iServerInput != null) return this.iServerInput; - - throw new IOException("Failed to open an input stream from server: HTTPResponse " - + getResponseCode()); - } - - /** - * Returns the output stream of this http connection - * - * @return The output stream - */ - public synchronized OutputStream getOutputStream() { - if (this.iServerOutput == null) { - this.iServerOutput = new ByteArrayOutputStream(); - } - return this.iServerOutput; - } - - /** - * Returns the request method - * - * @return The request method - */ - public String getRequestMethod() { - return this.iRequestMethod; - } - - /** - * Returns the request property for a given key - * - * @param key - * The key - * @return The property - */ - public String getRequestProperty(String key) { - return this.iRequestHeaders.getField(key); - } - - /** - * Returns the response code - * - * @return The response code - * @throws IOException - */ - public synchronized int getResponseCode() throws IOException { - LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); - logger.entry(); - try { - long ResponseTime = -1; - Exception delayedException = null; - if (this.iReset && this.iResponse == null) { - boolean authFailed = false; - int IoRetry = 1; - int AuthentificationRetry = 1; - do { - logger.trace(Level.FINER, "Attempting http request (retry counters:" + IoRetry - + "/" + AuthentificationRetry + ")"); - long RequestTime = System.currentTimeMillis(); - - if (this.iPreviousResponseTime != -1) { - long time = RequestTime - this.iPreviousResponseTime; - long maxTime = this.iHttpClientPool.getConfigurationContext() - .getSocketIdleTimeout(); - if (maxTime > 0 && time > maxTime) { - logger.trace(Level.FINER, "Closing socket after " + time - + "ms of idle time"); - - if (this.iSocket != null && !this.iSocket.isClosed()) { - try { - this.iSocket.close(); - } catch (IOException e) { - logger.trace(Level.FINER, - "Exception caught while closing socket", e); - } - } - this.iSocket = null; - this.iReset = true; - this.iResponse = null; - } - } - - ResponseTime = -1; - resetSocket(); - this.iReset = false; - try { - ASCIIPrintStream out = (ASCIIPrintStream) this.iOStream; - if (out == null) throw new IOException("could not open output stream"); - - String file = this.iUrl.getPath(); - if (file == null || file.length() == 0) file = "/"; - String query = this.iUrl.getQuery(); - if (query != null) file = file + '?' + query; - - this.iMethod = new HttpClientMethod(this.iRequestMethod, this.iUrl - .getPath(), 1, this.iUseHttp11 ? 1 : 0); - logger.trace(Level.FINER, "HTTP Operation= " + this.iMethod); - - this.iMethod.write(out); - - StringBuilder hostField = new StringBuilder(this.iUrl.getHost()); - if (this.iUrl.getPort() > 0 - && ((WBEMConstants.HTTPS.equalsIgnoreCase(this.iUrl.getScheme()) && this.iUrl - .getPort() != WBEMConstants.DEFAULT_WBEM_SECURE_PORT) || (WBEMConstants.HTTP - .equalsIgnoreCase(this.iUrl.getScheme()) && this.iUrl - .getPort() != WBEMConstants.DEFAULT_WBEM_PORT))) { - hostField.append(':'); - hostField.append(this.iUrl.getPort()); - } - this.iRequestHeaders.addField("Host", hostField.toString()); - - if (this.iServerOutput != null) this.iRequestHeaders.addField( - "Content-length", "" + this.iServerOutput.size()); - else this.iRequestHeaders.addField("Content-length", "0"); - if (this.iHttpClientPool.getConfigurationContext().isHttpChunked()) { - this.iRequestHeaders.addField("TE", "trailers"); - } - - if (iUseHttp11 && !iHttpClientPool.getConfigurationContext().useKeepAliveStrictMode()) { - // AMMO-863 Systematic use of the Keep-alive - // header is not recommended with HTTP/1.1 - // And may cause issues with EMC's VAPP appliances - // so we made the header available only when - // new strict mode is disabled - logger.trace(Level.INFO, - "HTTP 1.1 protocol and 'Connection=Keep-alive' strict mode disabled, we add the header"); - iRequestHeaders.addField("Connection", "Keep-alive"); - } - - if (this.iPrevAuthInfo == null) { - AuthorizationInfo authInfo = this.iAuth_handler.getAuthorizationInfo(0); - String authenticate = this.iHttpClientPool.getConfigurationContext() - .getHttpWwwAuthenticateInfo(); - - if (authInfo.isSentOnFirstRequest()) { - this.iRequestHeaders.addField(authInfo.getHeaderFieldName(), - authInfo.toString()); - } else if (authenticate != null) { - try { - this.iPrevAuthInfo = getAuthentication(false, - this.iPrevAuthInfo, authenticate); - if (this.iPrevAuthInfo != null) { - this.iRequestHeaders.addField(this.iPrevAuthInfo - .getHeaderFieldName(), this.iPrevAuthInfo - .toString()); - } - } catch (NoSuchAlgorithmException e) { - logger.trace(Level.FINER, "Unable to find digest algorithm", e); - } catch (IllegalArgumentException e) { - logger - .trace( - Level.FINER, - WBEMConfigurationProperties.HTTP_WWW_AUTHENTICATE_INFO - + " did not contain WWW-Authenticate information", - e); - } catch (HttpParseException e) { - logger - .trace( - Level.FINER, - WBEMConfigurationProperties.HTTP_WWW_AUTHENTICATE_INFO - + " did not contain valid WWW-Authenticate information", - e); - } - } - } else { - this.iRequestHeaders.addField(this.iPrevAuthInfo.getHeaderFieldName(), - this.iPrevAuthInfo.toString()); - } - - if (this.iPrevProxy != null) this.iRequestHeaders.addField( - "Proxy-authorization", this.iPrevProxy.toString()); - - boolean isGzipped = false; - if (this.iHttpClientPool.getConfigurationContext().isGzipEncodingEnabled()) { - isGzipped = true; - this.iRequestHeaders.addField("Accept-Encoding", "gzip,identity;q=0.5"); - } - - this.iRequestHeaders.write(out); - - logger.trace(Level.FINER, "Request HTTP Headers= " + this.iRequestHeaders); - - if (out.checkError() != null) { - delayedException = out.checkError(); - logger.trace(Level.FINER, - "Exception caught while writing to the http output stream.", - delayedException); - if (this.iSocket != null && !this.iSocket.isClosed()) { - try { - this.iSocket.close(); - } catch (IOException e) { - logger.trace(Level.FINER, - "Exception caught while closing socket", e); - } - } - this.iSocket = null; - this.iReset = true; - this.iResponse = null; - --IoRetry; - continue; - } - if (this.iServerOutput != null) { - this.iServerOutput.writeTo(out); - } - out.flush(); - - // byte[] header = new byte[8]; - // istream.mark(8); - // int totalRead; - // int k; - // for (totalRead = 0; totalRead < 8; totalRead += k) { - // k = istream.read(header, totalRead, 8 - totalRead); - // if (k < 0) - // break; - // } - // - // if (header[0] != 72 // HTTP1. - // || header[1] != 84 - // || header[2] != 84 - // || header[3] != 80 - // || header[4] != 47 - // || header[5] != 49 - // || header[6] != 46 - // || totalRead != 8) { - // retry = 0; - // throw new IOException("Unexpected end of file from - // server. Header does not match HTTP header: "+new - // String(header)); - // } - // - // istream.reset(); - - this.iResponse = new HttpClientMethod(this.iIStream); - logger.trace(Level.FINER, "HTTP Response= " + this.iResponse); - ResponseTime = System.currentTimeMillis(); - - this.iResponseHeaders = new HttpHeader(this.iIStream); - logger.trace(Level.FINER, "Response HTTP Headers= " - + this.iResponseHeaders.toString()); - this.iKeepAlive = false; - if ("Keep-alive".equalsIgnoreCase(this.iResponseHeaders - .getField("Connection")) - || (this.iResponse.getMajorVersion() == 1 && this.iResponse - .getMinorVersion() == 1) - || this.iResponseHeaders.getField("Keep-alive") != null) { - this.iKeepAlive = true; - } - - this.iServerInput = new PersistentInputStream(this.iIStream); - // String keepAliveHdr = - // iResponseHeaders.getField("Keep-Alive"); - - String contentLength = this.iResponseHeaders.getField("Content-length"); - long length = -1; - try { - if (contentLength != null && contentLength.length() > 0) length = Long - .parseLong(contentLength); - } catch (Exception e) { - logger.trace(Level.FINER, - "Exception while parsing the content length of http response", - e); - } - this.iKeepAlive = (length >= 0 || this.iResponse.getStatus() == 304 || this.iResponse - .getStatus() == 204); - - if (isGzipped) { - String contentEncoding = this.iResponseHeaders - .getField("Content-Encoding"); - if (contentEncoding != null - && contentEncoding.toLowerCase().contains("gzip")) { - length = -1; // ignore Content-length - this.iServerInput = new GZIPInputStream(this.iServerInput); - } - } - - String transferEncoding = this.iResponseHeaders - .getField("Transfer-encoding"); - if (transferEncoding != null) { - length = -1; // ignore Content-length - if (transferEncoding.toLowerCase().endsWith("chunked")) { - this.iServerInput = new ChunkedInputStream(this.iServerInput, - this.iResponseHeaders.getField("Trailer"), "Response"); - this.iKeepAlive = true; - } - } - - if (length >= 0) this.iServerInput = new BoundedInputStream( - this.iServerInput, length); - - logger.trace(Level.FINER, "KeepAlive=" - + (this.iKeepAlive ? "true" : "false")); - - if (this.iKeepAlive) { - this.iServerInput = new KeepAliveInputStream(this.iServerInput, this); - } - - switch (this.iResponse.getStatus()) { - case 100: { - continue; - } - case HttpURLConnection.HTTP_OK: - String authInfo = this.iResponseHeaders - .getField("Authentication-Info"); - handleRsp(authInfo, this.iPrevAuthInfo); - - authInfo = this.iResponseHeaders.getField("Authentication-Proxy"); - handleRsp(authInfo, this.iPrevProxy); - - if (this.iServerOutput != null) this.iServerOutput = null; - - this.iPreviousResponseTime = ResponseTime; - return HttpURLConnection.HTTP_OK; - - case HttpURLConnection.HTTP_UNAUTHORIZED: - --AuthentificationRetry; - String authenticate = this.iResponseHeaders - .getField("WWW-Authenticate"); - try { - this.iPrevAuthInfo = getAuthentication(false, - this.iPrevAuthInfo, authenticate); - if (this.iPrevAuthInfo != null) { - this.iRequestHeaders.addField(this.iPrevAuthInfo - .getHeaderFieldName(), this.iPrevAuthInfo - .toString()); - } - } catch (NoSuchAlgorithmException e) { - logger.trace(Level.FINER, "Unable to find digest algorithm", e); - } catch (IllegalArgumentException e) { - logger - .trace( - Level.FINER, - "HTTP 401 response did not contain WWW-Authenticate information", - e); - } catch (HttpParseException e) { - logger - .trace( - Level.FINER, - "HTTP 401 response did not contain valid WWW-Authenticate information", - e); - } - - if (!authFailed) { - authFailed = true; - logger - .trace(Level.FINER, - "Authorization failed, retrying with authorization info."); - } - if (this.iPrevAuthInfo != null && this.iPrevAuthInfo.isKeptAlive()) { - this.iKeepAlive = true; - } - break; - case HttpURLConnection.HTTP_PROXY_AUTH: - --AuthentificationRetry; - logger.message(Messages.HTTP_PROXY_AUTH_UNSUPPORTED, this.iUrl); - - // TODO implement http proxy authentication - /* - * authenticate = - * responseHeaders.getField("Proxy-Authenticate" - * ); prevProxy = getAuthentication(true, - * prevProxy, authenticate, this); if - * (prevAuthInfo != null) - * requestHeaders.addField - * ("Proxy-Authorization", - * prevProxy.toString()); - * - * while ((total = serverInput.available()) > 0) - * { serverInput.skip(total); } break; - */ - break; - default: - int status = this.iResponse.getStatus(); - if (!this.iKeepAlive) closeConnection(); - else this.iServerInput.close(); - this.iPreviousResponseTime = ResponseTime; - return status; - } - } catch (SocketTimeoutException e) { - throw e; - } catch (IOException e) { - logger.message(Messages.HTTP_CONNECTION_FAILED, new Object[] { this.iUrl, - e.getMessage() }); - StringBuilder msg = new StringBuilder("Http connection failed "); - if (ResponseTime != -1) { - msg.append("after"); - msg.append(ResponseTime - RequestTime); - msg.append(" milliseconds"); - } else { - msg.append("before response received"); - } - if (this.iPreviousResponseTime != -1) { - msg.append(", "); - msg.append(System.currentTimeMillis() - this.iPreviousResponseTime); - msg.append(" milliseconds after previous response on same socket"); - } - logger.trace(Level.FINE, msg.toString(), e); - delayedException = e; - if (this.iSocket != null && !this.iSocket.isClosed()) { - try { - this.iSocket.close(); - } catch (IOException e2) { - logger.trace(Level.FINER, "Exception caught while closing socket", - e2); - } - } - this.iSocket = null; - this.iReset = true; - this.iResponse = null; - --IoRetry; - } - - } while (AuthentificationRetry >= 0 && IoRetry >= 0); - } - - if (this.iResponse != null) { - logger.trace(Level.FINER, "http response code=" + this.iResponse.getStatus()); - if (ResponseTime != -1) this.iPreviousResponseTime = ResponseTime; - return this.iResponse.getStatus(); - } - throw (IOException) (delayedException != null ? delayedException : new Exception( - "Unable to get response after maximum retries")); - } finally { - logger.exit(); - } - } - - /** - * Returns the response message - * - * @return The response message - */ - public String getResponseMessage() { - if (this.iResponse != null) return this.iResponse.getResponseMessage(); - return null; - } - - public void handshakeCompleted(HandshakeCompletedEvent event) { - LogAndTraceBroker.getBroker().trace(Level.FINER, "Http handshake completed."); - this.iSession = event.getSession(); - } - - /** - * Resets state - */ - public void reset() { - this.iRequestHeaders.clear(); - this.iResponseHeaders.clear(); - this.iResponse = null; - this.iReset = true; - } - - /** - * Sets the request method - * - * @param method - * The request method - */ - public void setRequestMethod(String method) { - this.iRequestMethod = method; - } - - /** - * Sets the request property - * - * @param key - * The property name - * @param value - * The value - */ - public void setRequestProperty(String key, String value) { - this.iRequestHeaders.addField(key, value); - } - - /** - * Releases the client and returns it to the pool - */ - public void streamFinished() { - streamFinished(true); - } - - /** - * Releases the client and returns it to the pool - * - * @param keep - * if true return to the pool, if false - * drop. - */ - public void streamFinished(boolean keep) { - - LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); - logger.entry(); - - HostPortPair hpp = new HostPortPair(this.iUrl); - if (keep) { // TODO configurable from property file - logger.trace(Level.FINER, "Adding http client to pool (" + hpp + ")"); - this.iHttpClientPool.returnAvailableConnectionToPool(this); - } else { - logger.trace(Level.FINER, "Disconnectiong http client (" + hpp + ")"); - this.iHttpClientPool.removeConnectionFromPool(this); - disconnect(); - } - logger.exit(); - } - - /** - * Enables/Disables use of http 1.1 - * - * @param bool - * if true http 1.1 is enabled. - */ - public void useHttp11(boolean bool) { - this.iUseHttp11 = bool; - } - - /** - * Returns if a proxy is used - * - * @return true if a proxy is used - */ - public boolean usingProxy() { - // TODO Auto-generated method stub - return false; - } - - protected AuthorizationInfo getAuthentication(boolean proxy, AuthorizationInfo prevAuthInfo, - String authenticate) throws HttpParseException, NoSuchAlgorithmException { - Challenge[] challenges = Challenge.parseChallenge(authenticate); - - // AuthorizationHandler auth_handler = - // AuthorizationHandler.getInstance(); - int cntr = 0; - prevAuthInfo = null; - while (cntr < challenges.length) { - Challenge challenge = challenges[cntr]; - cntr++; - // if (challenge.getScheme().equalsIgnoreCase("Digest")) { - // HttpHeader headers = challenge.getParams(); - // String stale = headers.getField("stale"); - // } - prevAuthInfo = this.iAuth_handler.getAuthorizationInfo(this.iHttpClientPool - .getConfigurationContext().getHttpAuthenticationModule(), proxy ? Boolean.TRUE - : Boolean.FALSE, this.iUrl.getHost(), this.iUrl.getPort(), this.iUrl - .getScheme(), challenge.getRealm(), challenge.getScheme()); - - if (prevAuthInfo != null) { - prevAuthInfo.updateAuthenticationInfo(challenge, authenticate, this.iUrl, - this.iRequestMethod); - return prevAuthInfo; - } - } - return null; - } - - private void closeConnection() { - LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); - logger.entry(); - if (this.iSocket != null) { - try { - this.iSocket.close(); - } catch (IOException e) { - logger.trace(Level.FINER, "Exception while closing the socket", e); - } - this.iSocket = null; - this.iServerInput = null; - // response = null; - } - logger.exit(); - } - - private String[] parseProperty(String propertyName) { - String s = (String) AccessController.doPrivileged(new GetProperty(propertyName)); - String as[]; - if (s == null || s.length() == 0) { - as = null; - } else { - Vector vector = new Vector(); - for (StringTokenizer stringtokenizer = new StringTokenizer(s, ","); stringtokenizer - .hasMoreElements(); vector.addElement(stringtokenizer.nextElement())) { - // add each token to vector - } - as = new String[vector.size()]; - for (int i1 = 0; i1 < as.length; i1++) - as[i1] = (String) vector.elementAt(i1); - } - return as; - } - - private void resetSocket() throws IOException { - LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); - logger.entry(); - if (!this.iKeepAlive) { - logger.trace(Level.FINER, "KeepAlive=false, closing http connection..."); - closeConnection(); - } - - int httpTimeout = this.iHttpClientPool.getConfigurationContext().getHttpTimeout(); - logger.trace(Level.FINER, "Setting http timeout=" + httpTimeout); - - if (this.iSocket == null) { - // Determine whether we need to connect with a timeout or not - boolean socketConnectWithTimeout = this.iHttpClientPool.getConfigurationContext() - .socketConnectWithTimeout(); - logger.trace(Level.FINER, "Socket=null, creating http socket " - + (socketConnectWithTimeout ? "with" : "without") + " timeout."); - - // On Java 5+ InetSocketAddress(String,int) constructor will call - // any security manager's checkConnect method - if (!socketConnectWithTimeout) { - SecurityManager sm = System.getSecurityManager(); - if (sm != null) { - sm.checkConnect(this.iUrl.getHost(), this.iUrl.getPort()); - } - } - - SocketFactory factory = this.iHttpClientPool.getConfigurationContext() - .getCustomSocketFactory(); - if (factory == null) { - factory = HttpSocketFactory - .getInstance() - .getClientSocketFactory( - WBEMConstants.HTTPS.equalsIgnoreCase(this.iUrl.getScheme()) ? this.iHttpClientPool - .getSslContext() - : null); - if (factory == null) { - logger.message(Messages.HTTP_NO_SOCKET_FACTORY, this.iUrl.getScheme()); - throw new IllegalStateException("Unable to load socket factory:" - + this.iUrl.getScheme()); - } - } - logger.trace(Level.FINER, "Creating new http for url " + this.iUrl.toString()); - if (socketConnectWithTimeout) { - int connectTimeout = this.iHttpClientPool.getConfigurationContext() - .getSocketConnectTimeout(); - logger.trace(Level.FINER, "Setting socket connect timeout=" + connectTimeout); - - if (factory instanceof SSLSocketFactory) { - Socket sock = new Socket(); - sock.connect(new InetSocketAddress(this.iUrl.getHost(), this.iUrl.getPort()), - connectTimeout); - this.iSocket = ((SSLSocketFactory) factory).createSocket(sock, this.iUrl - .getHost(), this.iUrl.getPort(), true); - - } else { - this.iSocket = factory.createSocket(); - if (this.iSocket != null) this.iSocket.connect(new InetSocketAddress(this.iUrl - .getHost(), this.iUrl.getPort()), connectTimeout); - } - } else { - this.iSocket = factory.createSocket(this.iUrl.getHost(), this.iUrl.getPort()); - } - if (this.iSocket == null) { - logger.trace(Level.WARNING, "Socket factory " + factory.getClass().getName() - + " returned null socket"); - throw new IOException("Socket factory did not create socket"); - } - - this.iPreviousResponseTime = -1; - this.iSocket.setTcpNoDelay(true); - this.iSocket.setKeepAlive(true); - this.iSocket.setSoTimeout(httpTimeout); - - if (this.iSocket instanceof SSLSocket) { - // Determine whether we need to perform SSL handshake or not - boolean performHandshake = this.iHttpClientPool.getConfigurationContext() - .performSslHandshake(); - logger.trace(Level.FINER, "SSL socket created, handshake " - + (performHandshake ? "will" : "will not") + " be performed."); - - if (performHandshake) { - SSLSocket sk = (SSLSocket) this.iSocket; - - String protocols[] = parseProperty("https.protocols"); - if (protocols != null) { - logger.trace(Level.FINER, - "Setting SSLSocket.setEnabledProtocols() from \"https.protocols\"=" - + String.valueOf(Arrays.asList(protocols))); - sk.setEnabledProtocols(protocols); - } - - String ciphersuites[] = parseProperty("https.cipherSuites"); - if (ciphersuites != null) { - logger.trace(Level.FINER, - "Setting SSLSocket.setEnableCipheSuites() from \"https.cipherSuites\"=" - + String.valueOf(Arrays.asList(ciphersuites))); - sk.setEnabledCipherSuites(ciphersuites); - } - - String disableCipherSuites = this.iHttpClientPool.getConfigurationContext() - .getSslClientCipherSuitesToDisable(); - if (disableCipherSuites != null) { - sk.setEnabledCipherSuites(this.iHttpClientPool.getUpdatedCipherSuites(sk - .getEnabledCipherSuites(), disableCipherSuites)); - } - - // Determine whether we need to perform synchronized SSL - // handshake or not - boolean synchronizedHandshake = this.iHttpClientPool.getConfigurationContext() - .synchronizedSslHandshake(); - logger.trace(Level.FINER, "Starting " - + (synchronizedHandshake ? "synchronized" : "unsynchronized") - + " http handshake."); - - sk.addHandshakeCompletedListener(this); - if (synchronizedHandshake) { - synchronized (SSLSocket.class) { - sk.startHandshake(); - } - } else { - sk.startHandshake(); - } - } - } - - this.iIStream = new BufferedInputStream(this.iSocket.getInputStream()); - this.iOStream = new ASCIIPrintStream(new BufferedOutputStream(this.iSocket - .getOutputStream(), 1024), false, iEncoding); - this.iServerInput = null; - } else { - if (this.iServerInput != null && !(this.iServerInput instanceof KeepAliveInputStream)) { - logger.trace(Level.FINER, "Socket!=null, flushing the stream..."); - long totalBytes = 0; - long total; - while ((total = this.iServerInput.available()) > 0) { - total = this.iServerInput.skip(total); - if (total >= 0) totalBytes += total; - } - logger.trace(Level.FINER, "total bytes on the stream=" + totalBytes); - } - this.iSocket.setSoTimeout(httpTimeout); - } - } - - /** - * Returns connected - * - * @return The value of connected. - */ - public boolean isConnected() { - return this.iConnected; - } - - @Override - public String toString() { - StringBuffer result = new StringBuffer(); - result.append('['); - result.append("URI="); - result.append(this.iUrl); - result.append(", "); - result.append(this.iConnected ? "connected" : "not connected"); - result.append(", "); - result.append(this.iKeepAlive ? "kept alive" : "not kept alive"); - result.append(", "); - result.append(this.iUseHttp11 ? "HTTP 1.1" : "HTTP 1.0"); - result.append(", "); - result.append("Method="); - result.append(this.iMethod); - result.append(", "); - result.append("Request Method="); - result.append(this.iRequestMethod); - result.append(", "); - result.append("Protocol="); - result.append(this.iSession != null ? this.iSession.getProtocol() : "http"); - result.append(", "); - result.append("CipherSuite="); - result.append(this.iSession != null ? this.iSession.getCipherSuite() : "n/a"); - result.append(']'); - return result.toString(); - } -} +/* + HttpClient.java + + (C) Copyright IBM Corp. 2005, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 13799 2004-12-07 thschaef Fix chunking support + * 17620 2005-06-29 thschaef eliminate ASCIIPrintStream1 in import statement + * 17970 2005-08-11 pineiro5 Logon from z/OS not possible + * 1353168 2005-11-24 fiuczy Possible NullPointerExcection in HttpClient.streamFinished() + * 1422316 2006-05-15 lupusalex Disable delayed acknowledgement + * 1486379 2006-05-29 lupusalex CIM client retries twice when HTTP/1.1 401 is returned + * 1498130 2006-05-31 lupusalex Selection of xml parser on a per connection basis + * 1516244 2006-07-10 ebak GCJ support + * 1536711 2006-08-15 lupusalex NullPointerException causes client call to never return + * 1535756 2006-08-07 lupusalex Make code warning free + * 1565091 2006-10-17 ebak ssl handshake exception + * 1516242 2006-11-27 lupusalex Support of OpenPegasus local authentication + * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant + * 1604329 2006-12-18 lupusalex Fix OpenPegasus auth module + * 1620526 2007-01-08 lupusalex Socket Leak in HTTPClient.getResponseCode() + * 1627832 2007-01-08 lupuslaex Incorrect retry behaviour on HTTP 401 + * 1637546 2007-01-27 lupusalex CIMEnumerationImpl has faulty close function + * 1647148 2007-01-29 lupusalex HttpClient.resetSocket() doesn't set socket timeout + * 1647159 2007-01-29 lupusalex HttpClientPool runs out of HttpClients + * 1649595 2007-02-01 lupusalex No chunkig requested + * 1660743 2007-02-15 lupusalex SSLContext is static + * 1702832 2007-04-18 lupusalex WBEMClientCIMXL.setCustomSocketFactory() not implemented + * 1715511 2007-05-09 lupusalex FVT: Wrong HTTP header values + * 1892046 2008-02-13 blaschke-oss Basic/digest authentication problem for Japanese users + * 1931216 2008-04-01 blaschke-oss In HTTPClient need to get status before closing connection + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings + * 2372030 2008-12-01 blaschke-oss Add property to control synchronized SSL handshaking + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2714989 2009-03-26 blaschke-oss Code cleanup from redundant null check et al + * 2750520 2009-04-10 blaschke-oss Code cleanup from empty statement et al + * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors + * 2817962 2009-08-05 blaschke-oss socket creation connects w/o a timeout + * 2994776 2010-05-05 blaschke-oss http 401 gives CIM_ERR_FAILED instead of CIM_ERR_ACCESS_DENIED + * 2997865 2010-05-07 blaschke-oss Infinite loop in HttpClient + * 3004762 2010-06-16 blaschke-oss HTTPClient infinite loop for HTTP 407 + * 3022554 2010-06-30 blaschke-oss Flushing socket ignores skip() return code + * 3046073 2010-09-07 blaschke-oss Performance hit due to socket conn. creation with timeout + * 3195069 2011-02-28 blaschke-oss Need support to disable SSL Handshake + * 3235440 2011-03-22 blaschke-oss NullPointerException when socket factory returns null + * 3323310 2011-06-20 blaschke-oss Need the ability to override certain Global Properties + * 3400209 2011-08-31 blaschke-oss Highlighted Static Analysis (PMD) issues + * 3444912 2011-11-29 blaschke-oss Client delay during SSL handshake + * 3492224 2012-02-23 blaschke-oss Need two different timeouts for Socket connections + * 3504304 2012-03-14 blaschke-oss Rename socket timeout variables + * 3523918 2012-05-06 blaschke-oss "java.io.IOException: Unexpected EOF" returned as HTTP 401 + * 3524050 2012-06-06 blaschke-oss Improve WWW-Authenticate in HTTPClient.java + * 3557283 2012-11-05 blaschke-oss Print full response when get EOF from CIMOM + * 3601894 2013-01-23 blaschke-oss Enhance HTTP and CIM-XML tracing + * 2619 2013-02-22 blaschke-oss Host should contain port when not 5988/5989 + * 2621 2013-02-23 blaschke-oss Not all chunked input has trailers + * 2618 2013-02-27 blaschke-oss Need to add property to disable weak cipher suites for the secure indication + * 2642 2013-05-21 blaschke-oss Seperate properties needed for cim client and listener to filter out ciphers + * 2654 2013-07-29 blaschke-oss Check jcc idle time with CIMOM keepalive timeout to avoid EOF + * 2655 2013-08-14 blaschke-oss Content-length must be ignored when Transfer-encoding present + * 2151 2013-08-20 blaschke-oss gzip compression not supported + * 2709 2013-11-13 blaschke-oss Lower the level of the EOF message to FINE + */ +package org.metricshub.wbem.sblim.cimclient.internal.http; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.HttpURLConnection; +import java.net.InetSocketAddress; +import java.net.Socket; +import java.net.SocketTimeoutException; +import java.net.URI; +import java.security.AccessController; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.security.PrivilegedAction; +import java.util.Arrays; +import java.util.Iterator; +import java.util.StringTokenizer; +import java.util.Vector; +import java.util.Map.Entry; +import java.util.logging.Level; +import java.util.zip.GZIPInputStream; + +import javax.net.SocketFactory; +import javax.net.ssl.HandshakeCompletedEvent; +import javax.net.ssl.HandshakeCompletedListener; +import javax.net.ssl.SSLSession; +import javax.net.ssl.SSLSocket; +import javax.net.ssl.SSLSocketFactory; + +import org.metricshub.wbem.sblim.cimclient.WBEMConfigurationProperties; +import org.metricshub.wbem.sblim.cimclient.internal.http.HttpHeader.HeaderEntry; +import org.metricshub.wbem.sblim.cimclient.internal.http.io.ASCIIPrintStream; +import org.metricshub.wbem.sblim.cimclient.internal.http.io.BoundedInputStream; +import org.metricshub.wbem.sblim.cimclient.internal.http.io.ChunkedInputStream; +import org.metricshub.wbem.sblim.cimclient.internal.http.io.KeepAliveInputStream; +import org.metricshub.wbem.sblim.cimclient.internal.http.io.PersistentInputStream; +import org.metricshub.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; +import org.metricshub.wbem.sblim.cimclient.internal.logging.Messages; +import org.metricshub.wbem.sblim.cimclient.internal.util.WBEMConstants; + +/** + * Class HttpClient implements a HTTP client + * + */ +public class HttpClient implements HandshakeCompletedListener { + + private static class HostPortPair { + + String iHost; + + /** + * Ctor. + * + * @param url + * The url + */ + public HostPortPair(URI url) { + this.iHost = url.getScheme().toLowerCase() + ':' + url.getHost().toLowerCase() + ':' + + url.getPort(); + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof HostPortPair)) return false; + + return this.iHost.equals(((HostPortPair) o).iHost); + } + + @Override + public int hashCode() { + return this.iHost.hashCode(); + } + + @Override + public String toString() { + return "HostPortPair=[+" + this.iHost + "]"; + } + } + + private static class GetProperty implements PrivilegedAction { + + String iPropertyName; + + GetProperty(String propertyName) { + this.iPropertyName = propertyName; + } + + public Object run() { + return System.getProperty(this.iPropertyName); + } + } + + private static String iEncoding; + + static { + try { + iEncoding = (String) AccessController.doPrivileged(new PrivilegedAction() { + + public Object run() { + return System.getProperty("file.encoding", "ISO8859_1"); + } + }); + if (!isASCIISuperset(iEncoding)) iEncoding = "ISO8859_1"; + } catch (Exception exception) { + iEncoding = "ISO8859_1"; + } + } + + /** + * Converts a byte array to a String of hex digits + * + * @param digest + * The byte array + * @return The hex string + */ + public static String convertToHexString(byte[] digest) { + char hexDigit[] = "0123456789abcdef".toCharArray(); + + StringBuffer buf = new StringBuffer(); + for (int i = 0; i < digest.length; i++) { + int b = digest[i]; + buf.append(hexDigit[(b >> 4) & 0xF]); + buf.append(hexDigit[(b) & 0xF]); + } + return buf.toString(); + } + + /** + * Returns a client from a http client pool + * + * @param url + * The url to connect to + * @param clientPool + * The client pool + * @param auth_handler + * The authentication handler to use + * @return A http client from the pool + */ + public static HttpClient getClient(URI url, HttpClientPool clientPool, + AuthorizationHandler auth_handler) { + + return clientPool.retrieveAvailableConnectionFromPool(url, auth_handler); + } + + protected static String dequote(String str) { + int len = str.length(); + if (len > 1 && str.charAt(0) == '\"' && str.charAt(len - 1) == '\"') return str.substring( + 1, len - 1); + return str; + } + + protected static void handleRsp(String authInfo, AuthorizationInfo prevAuthInfo) + throws IOException { + if (authInfo != null) { + HttpHeader params = HttpHeader.parse(authInfo); + + String nonce = params.getField("nextnonce"); + if (nonce != null) { + prevAuthInfo.setNonce(nonce); + prevAuthInfo.setNc(0); + } else { + nonce = prevAuthInfo.getNonce(); + } + String qop = params.getField("qop"); + if (qop != null) { + if (!"auth".equalsIgnoreCase(qop) && !"auth-int".equalsIgnoreCase(qop)) { + // TODO + throw new IOException( + "Authentication Digest with integrity check not supported"); + } + byte[] rspauth; + String rspauthStr = dequote(params.getField("rspauth")); + if (rspauthStr != null) { + rspauth = parseHex(rspauthStr); + + String cnonce = dequote(params.getField("cnonce")); + if (cnonce != null && !cnonce.equals(prevAuthInfo.getCnonce())) { throw new IOException( + "Digest authentication: Invalid nonce counter"); } + String ncStr = params.getField("nc"); + if (ncStr != null) { + try { + long nc = Long.parseLong(ncStr, 16); + if (nc != prevAuthInfo.getNc()) { throw new IOException(); } + } catch (Exception e) { + throw new IOException("Digest authentication: Invalid nonce counter"); + } + } + + String HA1, HA2; + MessageDigest md5; + try { + md5 = MessageDigest.getInstance("MD5"); + md5.reset(); + byte[] bytes = prevAuthInfo.getA1().getBytes("UTF-8"); + md5.update(bytes); + HA1 = convertToHexString(md5.digest()); + if ("MD5-sess".equalsIgnoreCase(params.getField("algorithm"))) { + md5.reset(); + md5.update((HA1 + ":" + nonce + ":" + cnonce).getBytes("UTF-8")); + HA1 = convertToHexString(md5.digest()); + } + + HA2 = ":" + prevAuthInfo.getURI(); + if ("auth-int".equalsIgnoreCase(qop)) { + md5.reset(); + md5.update(new byte[] {}); + HA2 += ":" + convertToHexString(md5.digest()); + } + md5.reset(); + md5.update(HA2.getBytes("UTF-8")); + HA2 = convertToHexString(md5.digest()); + + md5.reset(); + md5.update((HA1 + ":" + nonce + ":" + ncStr + ":" + cnonce + ":" + qop + + ":" + HA2).getBytes("UTF-8")); + String hsh = convertToHexString(md5.digest()); + byte[] hash = parseHex(hsh); + + if (!Arrays.equals(hash, rspauth)) throw new IOException( + "Digest Authentication failed!"); + + } catch (NoSuchAlgorithmException e1) { + throw new IOException( + "Unable to validate Authentication response: NoSuchAlgorithmException"); + } + } + } else { + // TODO compute md5 of the entity-body + } + } + } + + protected static byte[] parseHex(String hex) { + byte[] value = new byte[hex.length() >> 1]; + int n = 0; + for (int i = 0; i < value.length; i++) { + value[i] = (byte) (0xff & Integer.parseInt(hex.substring(n, n + 1), 16)); + n += 2; + } + return value; + } + + private static boolean isASCIISuperset(String charset) throws Exception { + String asciiSuperSet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_.!~*'();/?:@&=+$,"; + byte abyte0[] = { 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 71, 72, + 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, + 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, + 116, 117, 118, 119, 120, 121, 122, 45, 95, 46, 33, 126, 42, 39, 40, 41, 59, 47, 63, + 58, 64, 38, 61, 43, 36, 44 }; + byte convertedArray[] = asciiSuperSet.getBytes(charset); + return Arrays.equals(convertedArray, abyte0); + } + + private boolean iConnected = false; + + private HttpClientPool iHttpClientPool; + + private AuthorizationHandler iAuth_handler; + + private SSLSession iSession; + + private InputStream iIStream; + + private boolean iUseHttp11 = true; + + private boolean iKeepAlive = true; + + private HttpClientMethod iMethod; + + private OutputStream iOStream; + + private AuthorizationInfo iPrevAuthInfo; + + private AuthorizationInfo iPrevProxy; + + private HttpHeader iRequestHeaders = new HttpHeader(); + + private String iRequestMethod = "POST"; + + private boolean iReset = true; + + private HttpClientMethod iResponse; + + private HttpHeader iResponseHeaders = new HttpHeader(); + + private InputStream iServerInput; + + private ByteArrayOutputStream iServerOutput; + + private Socket iSocket; + + private URI iUrl; + + private long iPreviousResponseTime = -1; + + /** + * Ctor. + * + * @param url + * The url to connect to + * @param clientPool + * The associated client pool + * @param auth_handler + * The authentication handler + */ + public HttpClient(URI url, HttpClientPool clientPool, AuthorizationHandler auth_handler) { + this.iUrl = url; + this.iAuth_handler = auth_handler; + this.iHttpClientPool = clientPool; + } + + /** + * Connects to the http server + * + * @throws IOException + */ + public void connect() throws IOException { + LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); + logger.entry(); + try { + this.iReset = true; + this.iResponse = null; + this.iConnected = true; + this.iServerOutput = null; + resetSocket(); + } finally { + logger.exit(); + } + } + + /** + * Disconnects the session + */ + public synchronized void disconnect() { + LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); + logger.entry(); + this.iConnected = false; + if (this.iSocket != null) { + try { + this.iSocket.close(); + } catch (IOException e) { + logger.trace(Level.FINE, "Unexpected problem closing http socket", e); + } + this.iSocket = null; + this.iServerInput = null; + this.iReset = true; + this.iResponse = null; + } + logger.exit(); + } + + @Override + protected void finalize() throws Throwable { + try { + this.iSocket.close(); + } catch (IOException e) { + // bad luck + } finally { + super.finalize(); + } + } + + /** + * Returns the http header field value for a given index + * + * @param index + * The index + * @return The header field value + */ + public synchronized String getHeaderFieldValue(int index) { + + if (index < 0) throw new IllegalArgumentException(); + if (index == 0) return this.iResponse.toString(); + + Iterator> iterator = this.iResponseHeaders.iterator(); + while (iterator.hasNext() && --index >= 0) { + Entry entry = iterator.next(); + if (index == 0) return entry.getValue().toString(); + } + return null; + } + + /** + * Returns the http header field for a given name + * + * @param name + * The name + * @return The header field + */ + public synchronized String getHeaderField(String name) { + return this.iResponseHeaders.getField(name); + } + + /** + * Return the http header field name for a given index + * + * @param index + * The index + * @return The name + */ + public synchronized String getHeaderFieldName(int index) { + if (index < 0) throw new IllegalArgumentException(); + if (index == 0) return null; + + Iterator> iterator = this.iResponseHeaders.iterator(); + while (iterator.hasNext() && --index >= 0) { + Entry entry = iterator.next(); + if (index == 0) return entry.getKey().toString(); + } + return null; + } + + /** + * Returns the input stream of this http connection + * + * @return The input stream + * @throws IOException + */ + public synchronized InputStream getInputStream() throws IOException { + if (getResponseCode() < 500 && this.iResponse != null && this.iServerInput != null) return this.iServerInput; + + throw new IOException("Failed to open an input stream from server: HTTPResponse " + + getResponseCode()); + } + + /** + * Returns the output stream of this http connection + * + * @return The output stream + */ + public synchronized OutputStream getOutputStream() { + if (this.iServerOutput == null) { + this.iServerOutput = new ByteArrayOutputStream(); + } + return this.iServerOutput; + } + + /** + * Returns the request method + * + * @return The request method + */ + public String getRequestMethod() { + return this.iRequestMethod; + } + + /** + * Returns the request property for a given key + * + * @param key + * The key + * @return The property + */ + public String getRequestProperty(String key) { + return this.iRequestHeaders.getField(key); + } + + /** + * Returns the response code + * + * @return The response code + * @throws IOException + */ + public synchronized int getResponseCode() throws IOException { + LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); + logger.entry(); + try { + long ResponseTime = -1; + Exception delayedException = null; + if (this.iReset && this.iResponse == null) { + boolean authFailed = false; + int IoRetry = 1; + int AuthentificationRetry = 1; + do { + logger.trace(Level.FINER, "Attempting http request (retry counters:" + IoRetry + + "/" + AuthentificationRetry + ")"); + long RequestTime = System.currentTimeMillis(); + + if (this.iPreviousResponseTime != -1) { + long time = RequestTime - this.iPreviousResponseTime; + long maxTime = this.iHttpClientPool.getConfigurationContext() + .getSocketIdleTimeout(); + if (maxTime > 0 && time > maxTime) { + logger.trace(Level.FINER, "Closing socket after " + time + + "ms of idle time"); + + if (this.iSocket != null && !this.iSocket.isClosed()) { + try { + this.iSocket.close(); + } catch (IOException e) { + logger.trace(Level.FINER, + "Exception caught while closing socket", e); + } + } + this.iSocket = null; + this.iReset = true; + this.iResponse = null; + } + } + + ResponseTime = -1; + resetSocket(); + this.iReset = false; + try { + ASCIIPrintStream out = (ASCIIPrintStream) this.iOStream; + if (out == null) throw new IOException("could not open output stream"); + + String file = this.iUrl.getPath(); + if (file == null || file.length() == 0) file = "/"; + String query = this.iUrl.getQuery(); + if (query != null) file = file + '?' + query; + + this.iMethod = new HttpClientMethod(this.iRequestMethod, this.iUrl + .getPath(), 1, this.iUseHttp11 ? 1 : 0); + logger.trace(Level.FINER, "HTTP Operation= " + this.iMethod); + + this.iMethod.write(out); + + StringBuilder hostField = new StringBuilder(this.iUrl.getHost()); + if (this.iUrl.getPort() > 0 + && ((WBEMConstants.HTTPS.equalsIgnoreCase(this.iUrl.getScheme()) && this.iUrl + .getPort() != WBEMConstants.DEFAULT_WBEM_SECURE_PORT) || (WBEMConstants.HTTP + .equalsIgnoreCase(this.iUrl.getScheme()) && this.iUrl + .getPort() != WBEMConstants.DEFAULT_WBEM_PORT))) { + hostField.append(':'); + hostField.append(this.iUrl.getPort()); + } + this.iRequestHeaders.addField("Host", hostField.toString()); + + if (this.iServerOutput != null) this.iRequestHeaders.addField( + "Content-length", "" + this.iServerOutput.size()); + else this.iRequestHeaders.addField("Content-length", "0"); + if (this.iHttpClientPool.getConfigurationContext().isHttpChunked()) { + this.iRequestHeaders.addField("TE", "trailers"); + } + + if (iUseHttp11 && !iHttpClientPool.getConfigurationContext().useKeepAliveStrictMode()) { + // AMMO-863 Systematic use of the Keep-alive + // header is not recommended with HTTP/1.1 + // And may cause issues with EMC's VAPP appliances + // so we made the header available only when + // new strict mode is disabled + logger.trace(Level.INFO, + "HTTP 1.1 protocol and 'Connection=Keep-alive' strict mode disabled, we add the header"); + iRequestHeaders.addField("Connection", "Keep-alive"); + } + + if (this.iPrevAuthInfo == null) { + AuthorizationInfo authInfo = this.iAuth_handler.getAuthorizationInfo(0); + String authenticate = this.iHttpClientPool.getConfigurationContext() + .getHttpWwwAuthenticateInfo(); + + if (authInfo.isSentOnFirstRequest()) { + this.iRequestHeaders.addField(authInfo.getHeaderFieldName(), + authInfo.toString()); + } else if (authenticate != null) { + try { + this.iPrevAuthInfo = getAuthentication(false, + this.iPrevAuthInfo, authenticate); + if (this.iPrevAuthInfo != null) { + this.iRequestHeaders.addField(this.iPrevAuthInfo + .getHeaderFieldName(), this.iPrevAuthInfo + .toString()); + } + } catch (NoSuchAlgorithmException e) { + logger.trace(Level.FINER, "Unable to find digest algorithm", e); + } catch (IllegalArgumentException e) { + logger + .trace( + Level.FINER, + WBEMConfigurationProperties.HTTP_WWW_AUTHENTICATE_INFO + + " did not contain WWW-Authenticate information", + e); + } catch (HttpParseException e) { + logger + .trace( + Level.FINER, + WBEMConfigurationProperties.HTTP_WWW_AUTHENTICATE_INFO + + " did not contain valid WWW-Authenticate information", + e); + } + } + } else { + this.iRequestHeaders.addField(this.iPrevAuthInfo.getHeaderFieldName(), + this.iPrevAuthInfo.toString()); + } + + if (this.iPrevProxy != null) this.iRequestHeaders.addField( + "Proxy-authorization", this.iPrevProxy.toString()); + + boolean isGzipped = false; + if (this.iHttpClientPool.getConfigurationContext().isGzipEncodingEnabled()) { + isGzipped = true; + this.iRequestHeaders.addField("Accept-Encoding", "gzip,identity;q=0.5"); + } + + this.iRequestHeaders.write(out); + + logger.trace(Level.FINER, "Request HTTP Headers= " + this.iRequestHeaders); + + if (out.checkError() != null) { + delayedException = out.checkError(); + logger.trace(Level.FINER, + "Exception caught while writing to the http output stream.", + delayedException); + if (this.iSocket != null && !this.iSocket.isClosed()) { + try { + this.iSocket.close(); + } catch (IOException e) { + logger.trace(Level.FINER, + "Exception caught while closing socket", e); + } + } + this.iSocket = null; + this.iReset = true; + this.iResponse = null; + --IoRetry; + continue; + } + if (this.iServerOutput != null) { + this.iServerOutput.writeTo(out); + } + out.flush(); + + // byte[] header = new byte[8]; + // istream.mark(8); + // int totalRead; + // int k; + // for (totalRead = 0; totalRead < 8; totalRead += k) { + // k = istream.read(header, totalRead, 8 - totalRead); + // if (k < 0) + // break; + // } + // + // if (header[0] != 72 // HTTP1. + // || header[1] != 84 + // || header[2] != 84 + // || header[3] != 80 + // || header[4] != 47 + // || header[5] != 49 + // || header[6] != 46 + // || totalRead != 8) { + // retry = 0; + // throw new IOException("Unexpected end of file from + // server. Header does not match HTTP header: "+new + // String(header)); + // } + // + // istream.reset(); + + this.iResponse = new HttpClientMethod(this.iIStream); + logger.trace(Level.FINER, "HTTP Response= " + this.iResponse); + ResponseTime = System.currentTimeMillis(); + + this.iResponseHeaders = new HttpHeader(this.iIStream); + logger.trace(Level.FINER, "Response HTTP Headers= " + + this.iResponseHeaders.toString()); + this.iKeepAlive = false; + if ("Keep-alive".equalsIgnoreCase(this.iResponseHeaders + .getField("Connection")) + || (this.iResponse.getMajorVersion() == 1 && this.iResponse + .getMinorVersion() == 1) + || this.iResponseHeaders.getField("Keep-alive") != null) { + this.iKeepAlive = true; + } + + this.iServerInput = new PersistentInputStream(this.iIStream); + // String keepAliveHdr = + // iResponseHeaders.getField("Keep-Alive"); + + String contentLength = this.iResponseHeaders.getField("Content-length"); + long length = -1; + try { + if (contentLength != null && contentLength.length() > 0) length = Long + .parseLong(contentLength); + } catch (Exception e) { + logger.trace(Level.FINER, + "Exception while parsing the content length of http response", + e); + } + this.iKeepAlive = (length >= 0 || this.iResponse.getStatus() == 304 || this.iResponse + .getStatus() == 204); + + if (isGzipped) { + String contentEncoding = this.iResponseHeaders + .getField("Content-Encoding"); + if (contentEncoding != null + && contentEncoding.toLowerCase().contains("gzip")) { + length = -1; // ignore Content-length + this.iServerInput = new GZIPInputStream(this.iServerInput); + } + } + + String transferEncoding = this.iResponseHeaders + .getField("Transfer-encoding"); + if (transferEncoding != null) { + length = -1; // ignore Content-length + if (transferEncoding.toLowerCase().endsWith("chunked")) { + this.iServerInput = new ChunkedInputStream(this.iServerInput, + this.iResponseHeaders.getField("Trailer"), "Response"); + this.iKeepAlive = true; + } + } + + if (length >= 0) this.iServerInput = new BoundedInputStream( + this.iServerInput, length); + + logger.trace(Level.FINER, "KeepAlive=" + + (this.iKeepAlive ? "true" : "false")); + + if (this.iKeepAlive) { + this.iServerInput = new KeepAliveInputStream(this.iServerInput, this); + } + + switch (this.iResponse.getStatus()) { + case 100: { + continue; + } + case HttpURLConnection.HTTP_OK: + String authInfo = this.iResponseHeaders + .getField("Authentication-Info"); + handleRsp(authInfo, this.iPrevAuthInfo); + + authInfo = this.iResponseHeaders.getField("Authentication-Proxy"); + handleRsp(authInfo, this.iPrevProxy); + + if (this.iServerOutput != null) this.iServerOutput = null; + + this.iPreviousResponseTime = ResponseTime; + return HttpURLConnection.HTTP_OK; + + case HttpURLConnection.HTTP_UNAUTHORIZED: + --AuthentificationRetry; + String authenticate = this.iResponseHeaders + .getField("WWW-Authenticate"); + try { + this.iPrevAuthInfo = getAuthentication(false, + this.iPrevAuthInfo, authenticate); + if (this.iPrevAuthInfo != null) { + this.iRequestHeaders.addField(this.iPrevAuthInfo + .getHeaderFieldName(), this.iPrevAuthInfo + .toString()); + } + } catch (NoSuchAlgorithmException e) { + logger.trace(Level.FINER, "Unable to find digest algorithm", e); + } catch (IllegalArgumentException e) { + logger + .trace( + Level.FINER, + "HTTP 401 response did not contain WWW-Authenticate information", + e); + } catch (HttpParseException e) { + logger + .trace( + Level.FINER, + "HTTP 401 response did not contain valid WWW-Authenticate information", + e); + } + + if (!authFailed) { + authFailed = true; + logger + .trace(Level.FINER, + "Authorization failed, retrying with authorization info."); + } + if (this.iPrevAuthInfo != null && this.iPrevAuthInfo.isKeptAlive()) { + this.iKeepAlive = true; + } + break; + case HttpURLConnection.HTTP_PROXY_AUTH: + --AuthentificationRetry; + logger.message(Messages.HTTP_PROXY_AUTH_UNSUPPORTED, this.iUrl); + + // TODO implement http proxy authentication + /* + * authenticate = + * responseHeaders.getField("Proxy-Authenticate" + * ); prevProxy = getAuthentication(true, + * prevProxy, authenticate, this); if + * (prevAuthInfo != null) + * requestHeaders.addField + * ("Proxy-Authorization", + * prevProxy.toString()); + * + * while ((total = serverInput.available()) > 0) + * { serverInput.skip(total); } break; + */ + break; + default: + int status = this.iResponse.getStatus(); + if (!this.iKeepAlive) closeConnection(); + else this.iServerInput.close(); + this.iPreviousResponseTime = ResponseTime; + return status; + } + } catch (SocketTimeoutException e) { + throw e; + } catch (IOException e) { + logger.message(Messages.HTTP_CONNECTION_FAILED, new Object[] { this.iUrl, + e.getMessage() }); + StringBuilder msg = new StringBuilder("Http connection failed "); + if (ResponseTime != -1) { + msg.append("after"); + msg.append(ResponseTime - RequestTime); + msg.append(" milliseconds"); + } else { + msg.append("before response received"); + } + if (this.iPreviousResponseTime != -1) { + msg.append(", "); + msg.append(System.currentTimeMillis() - this.iPreviousResponseTime); + msg.append(" milliseconds after previous response on same socket"); + } + logger.trace(Level.FINE, msg.toString(), e); + delayedException = e; + if (this.iSocket != null && !this.iSocket.isClosed()) { + try { + this.iSocket.close(); + } catch (IOException e2) { + logger.trace(Level.FINER, "Exception caught while closing socket", + e2); + } + } + this.iSocket = null; + this.iReset = true; + this.iResponse = null; + --IoRetry; + } + + } while (AuthentificationRetry >= 0 && IoRetry >= 0); + } + + if (this.iResponse != null) { + logger.trace(Level.FINER, "http response code=" + this.iResponse.getStatus()); + if (ResponseTime != -1) this.iPreviousResponseTime = ResponseTime; + return this.iResponse.getStatus(); + } + throw (IOException) (delayedException != null ? delayedException : new Exception( + "Unable to get response after maximum retries")); + } finally { + logger.exit(); + } + } + + /** + * Returns the response message + * + * @return The response message + */ + public String getResponseMessage() { + if (this.iResponse != null) return this.iResponse.getResponseMessage(); + return null; + } + + public void handshakeCompleted(HandshakeCompletedEvent event) { + LogAndTraceBroker.getBroker().trace(Level.FINER, "Http handshake completed."); + this.iSession = event.getSession(); + } + + /** + * Resets state + */ + public void reset() { + this.iRequestHeaders.clear(); + this.iResponseHeaders.clear(); + this.iResponse = null; + this.iReset = true; + } + + /** + * Sets the request method + * + * @param method + * The request method + */ + public void setRequestMethod(String method) { + this.iRequestMethod = method; + } + + /** + * Sets the request property + * + * @param key + * The property name + * @param value + * The value + */ + public void setRequestProperty(String key, String value) { + this.iRequestHeaders.addField(key, value); + } + + /** + * Releases the client and returns it to the pool + */ + public void streamFinished() { + streamFinished(true); + } + + /** + * Releases the client and returns it to the pool + * + * @param keep + * if true return to the pool, if false + * drop. + */ + public void streamFinished(boolean keep) { + + LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); + logger.entry(); + + HostPortPair hpp = new HostPortPair(this.iUrl); + if (keep) { // TODO configurable from property file + logger.trace(Level.FINER, "Adding http client to pool (" + hpp + ")"); + this.iHttpClientPool.returnAvailableConnectionToPool(this); + } else { + logger.trace(Level.FINER, "Disconnectiong http client (" + hpp + ")"); + this.iHttpClientPool.removeConnectionFromPool(this); + disconnect(); + } + logger.exit(); + } + + /** + * Enables/Disables use of http 1.1 + * + * @param bool + * if true http 1.1 is enabled. + */ + public void useHttp11(boolean bool) { + this.iUseHttp11 = bool; + } + + /** + * Returns if a proxy is used + * + * @return true if a proxy is used + */ + public boolean usingProxy() { + // TODO Auto-generated method stub + return false; + } + + protected AuthorizationInfo getAuthentication(boolean proxy, AuthorizationInfo prevAuthInfo, + String authenticate) throws HttpParseException, NoSuchAlgorithmException { + Challenge[] challenges = Challenge.parseChallenge(authenticate); + + // AuthorizationHandler auth_handler = + // AuthorizationHandler.getInstance(); + int cntr = 0; + prevAuthInfo = null; + while (cntr < challenges.length) { + Challenge challenge = challenges[cntr]; + cntr++; + // if (challenge.getScheme().equalsIgnoreCase("Digest")) { + // HttpHeader headers = challenge.getParams(); + // String stale = headers.getField("stale"); + // } + prevAuthInfo = this.iAuth_handler.getAuthorizationInfo(this.iHttpClientPool + .getConfigurationContext().getHttpAuthenticationModule(), proxy ? Boolean.TRUE + : Boolean.FALSE, this.iUrl.getHost(), this.iUrl.getPort(), this.iUrl + .getScheme(), challenge.getRealm(), challenge.getScheme()); + + if (prevAuthInfo != null) { + prevAuthInfo.updateAuthenticationInfo(challenge, authenticate, this.iUrl, + this.iRequestMethod); + return prevAuthInfo; + } + } + return null; + } + + private void closeConnection() { + LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); + logger.entry(); + if (this.iSocket != null) { + try { + this.iSocket.close(); + } catch (IOException e) { + logger.trace(Level.FINER, "Exception while closing the socket", e); + } + this.iSocket = null; + this.iServerInput = null; + // response = null; + } + logger.exit(); + } + + private String[] parseProperty(String propertyName) { + String s = (String) AccessController.doPrivileged(new GetProperty(propertyName)); + String as[]; + if (s == null || s.length() == 0) { + as = null; + } else { + Vector vector = new Vector(); + for (StringTokenizer stringtokenizer = new StringTokenizer(s, ","); stringtokenizer + .hasMoreElements(); vector.addElement(stringtokenizer.nextElement())) { + // add each token to vector + } + as = new String[vector.size()]; + for (int i1 = 0; i1 < as.length; i1++) + as[i1] = (String) vector.elementAt(i1); + } + return as; + } + + private void resetSocket() throws IOException { + LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); + logger.entry(); + if (!this.iKeepAlive) { + logger.trace(Level.FINER, "KeepAlive=false, closing http connection..."); + closeConnection(); + } + + int httpTimeout = this.iHttpClientPool.getConfigurationContext().getHttpTimeout(); + logger.trace(Level.FINER, "Setting http timeout=" + httpTimeout); + + if (this.iSocket == null) { + // Determine whether we need to connect with a timeout or not + boolean socketConnectWithTimeout = this.iHttpClientPool.getConfigurationContext() + .socketConnectWithTimeout(); + logger.trace(Level.FINER, "Socket=null, creating http socket " + + (socketConnectWithTimeout ? "with" : "without") + " timeout."); + + // On Java 5+ InetSocketAddress(String,int) constructor will call + // any security manager's checkConnect method + if (!socketConnectWithTimeout) { + SecurityManager sm = System.getSecurityManager(); + if (sm != null) { + sm.checkConnect(this.iUrl.getHost(), this.iUrl.getPort()); + } + } + + SocketFactory factory = this.iHttpClientPool.getConfigurationContext() + .getCustomSocketFactory(); + if (factory == null) { + factory = HttpSocketFactory + .getInstance() + .getClientSocketFactory( + WBEMConstants.HTTPS.equalsIgnoreCase(this.iUrl.getScheme()) ? this.iHttpClientPool + .getSslContext() + : null); + if (factory == null) { + logger.message(Messages.HTTP_NO_SOCKET_FACTORY, this.iUrl.getScheme()); + throw new IllegalStateException("Unable to load socket factory:" + + this.iUrl.getScheme()); + } + } + logger.trace(Level.FINER, "Creating new http for url " + this.iUrl.toString()); + if (socketConnectWithTimeout) { + int connectTimeout = this.iHttpClientPool.getConfigurationContext() + .getSocketConnectTimeout(); + logger.trace(Level.FINER, "Setting socket connect timeout=" + connectTimeout); + + if (factory instanceof SSLSocketFactory) { + Socket sock = new Socket(); + sock.connect(new InetSocketAddress(this.iUrl.getHost(), this.iUrl.getPort()), + connectTimeout); + this.iSocket = ((SSLSocketFactory) factory).createSocket(sock, this.iUrl + .getHost(), this.iUrl.getPort(), true); + + } else { + this.iSocket = factory.createSocket(); + if (this.iSocket != null) this.iSocket.connect(new InetSocketAddress(this.iUrl + .getHost(), this.iUrl.getPort()), connectTimeout); + } + } else { + this.iSocket = factory.createSocket(this.iUrl.getHost(), this.iUrl.getPort()); + } + if (this.iSocket == null) { + logger.trace(Level.WARNING, "Socket factory " + factory.getClass().getName() + + " returned null socket"); + throw new IOException("Socket factory did not create socket"); + } + + this.iPreviousResponseTime = -1; + this.iSocket.setTcpNoDelay(true); + this.iSocket.setKeepAlive(true); + this.iSocket.setSoTimeout(httpTimeout); + + if (this.iSocket instanceof SSLSocket) { + // Determine whether we need to perform SSL handshake or not + boolean performHandshake = this.iHttpClientPool.getConfigurationContext() + .performSslHandshake(); + logger.trace(Level.FINER, "SSL socket created, handshake " + + (performHandshake ? "will" : "will not") + " be performed."); + + if (performHandshake) { + SSLSocket sk = (SSLSocket) this.iSocket; + + String protocols[] = parseProperty("https.protocols"); + if (protocols != null) { + logger.trace(Level.FINER, + "Setting SSLSocket.setEnabledProtocols() from \"https.protocols\"=" + + String.valueOf(Arrays.asList(protocols))); + sk.setEnabledProtocols(protocols); + } + + String ciphersuites[] = parseProperty("https.cipherSuites"); + if (ciphersuites != null) { + logger.trace(Level.FINER, + "Setting SSLSocket.setEnableCipheSuites() from \"https.cipherSuites\"=" + + String.valueOf(Arrays.asList(ciphersuites))); + sk.setEnabledCipherSuites(ciphersuites); + } + + String disableCipherSuites = this.iHttpClientPool.getConfigurationContext() + .getSslClientCipherSuitesToDisable(); + if (disableCipherSuites != null) { + sk.setEnabledCipherSuites(this.iHttpClientPool.getUpdatedCipherSuites(sk + .getEnabledCipherSuites(), disableCipherSuites)); + } + + // Determine whether we need to perform synchronized SSL + // handshake or not + boolean synchronizedHandshake = this.iHttpClientPool.getConfigurationContext() + .synchronizedSslHandshake(); + logger.trace(Level.FINER, "Starting " + + (synchronizedHandshake ? "synchronized" : "unsynchronized") + + " http handshake."); + + sk.addHandshakeCompletedListener(this); + if (synchronizedHandshake) { + synchronized (SSLSocket.class) { + sk.startHandshake(); + } + } else { + sk.startHandshake(); + } + } + } + + this.iIStream = new BufferedInputStream(this.iSocket.getInputStream()); + this.iOStream = new ASCIIPrintStream(new BufferedOutputStream(this.iSocket + .getOutputStream(), 1024), false, iEncoding); + this.iServerInput = null; + } else { + if (this.iServerInput != null && !(this.iServerInput instanceof KeepAliveInputStream)) { + logger.trace(Level.FINER, "Socket!=null, flushing the stream..."); + long totalBytes = 0; + long total; + while ((total = this.iServerInput.available()) > 0) { + total = this.iServerInput.skip(total); + if (total >= 0) totalBytes += total; + } + logger.trace(Level.FINER, "total bytes on the stream=" + totalBytes); + } + this.iSocket.setSoTimeout(httpTimeout); + } + } + + /** + * Returns connected + * + * @return The value of connected. + */ + public boolean isConnected() { + return this.iConnected; + } + + @Override + public String toString() { + StringBuffer result = new StringBuffer(); + result.append('['); + result.append("URI="); + result.append(this.iUrl); + result.append(", "); + result.append(this.iConnected ? "connected" : "not connected"); + result.append(", "); + result.append(this.iKeepAlive ? "kept alive" : "not kept alive"); + result.append(", "); + result.append(this.iUseHttp11 ? "HTTP 1.1" : "HTTP 1.0"); + result.append(", "); + result.append("Method="); + result.append(this.iMethod); + result.append(", "); + result.append("Request Method="); + result.append(this.iRequestMethod); + result.append(", "); + result.append("Protocol="); + result.append(this.iSession != null ? this.iSession.getProtocol() : "http"); + result.append(", "); + result.append("CipherSuite="); + result.append(this.iSession != null ? this.iSession.getCipherSuite() : "n/a"); + result.append(']'); + return result.toString(); + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/HttpClientMethod.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpClientMethod.java similarity index 82% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/HttpClientMethod.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpClientMethod.java index c54b70f..c6e5e6f 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/HttpClientMethod.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpClientMethod.java @@ -1,201 +1,199 @@ -/* - (C) Copyright IBM Corp. 2005, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1535756 2006-08-07 lupusalex Make code warning free - * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.http; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.IOException; -import java.io.InputStream; -import java.net.HttpURLConnection; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.http.io.ASCIIPrintStream; - -/** - * Class HttpClientMethod encapsulates a http client method - * - */ -public class HttpClientMethod extends HttpMethod { - - private boolean iIncomming = true; - - private String iHttpHeader; - - private int iMinor, iMajor; - - private int iStatus; - - private String iMethod; - - private String iRequest; - - private String iResponse; - - /** - * Ctor. Creates an outgoing http method - * - * @param pMethod - * The method - * @param pRequest - * The request - * @param pMajor - * The major version - * @param pMinor - * The minor version - */ - public HttpClientMethod(String pMethod, String pRequest, int pMajor, int pMinor) { - this.iMinor = pMinor; - this.iMajor = pMajor; - this.iRequest = pRequest; - this.iMethod = pMethod; - this.iIncomming = false; - } - - /** - * Ctor. Parses an incoming http method from a given input stream - * - * @param pReader - * The input stream - * @throws IOException - */ - public HttpClientMethod(InputStream pReader) throws IOException { - String line = null; - - do { - line = readLine(pReader); - } while (line == null || line.length() == 0); - int rqt = line.indexOf(' '); - int prev = 0; - if (rqt > -1) { // Parse the header - int next = rqt; - this.iHttpHeader = line.substring(prev, next).toUpperCase(); - - prev = this.iHttpHeader.indexOf('/'); - if (prev > 0 && this.iHttpHeader.substring(0, prev).equalsIgnoreCase("HTTP")) { - next = this.iHttpHeader.indexOf('.', prev + 1); - try { - this.iMajor = Integer.parseInt(this.iHttpHeader.substring(prev + 1, next)); - this.iMinor = Integer.parseInt(this.iHttpHeader.substring(next + 1)); - } catch (Exception e) { - throw new HttpException(HttpURLConnection.HTTP_BAD_METHOD, "Bad method"); - } - prev = rqt; - rqt = line.indexOf(' ', prev + 1); - if (rqt > -1) { - try { - this.iStatus = Integer.parseInt(line.substring(prev + 1, rqt)); - } catch (Exception e) { - throw new HttpException(HttpURLConnection.HTTP_BAD_METHOD, "Bad method"); - } - this.iResponse = line.substring(rqt + 1); - return; - } - } else throw new HttpException(HttpURLConnection.HTTP_BAD_METHOD, "Bad method"); - } - throw new HttpException(HttpURLConnection.HTTP_BAD_METHOD, "Bad method"); - } - - /** - * Returns the major version - * - * @return The major version - */ - public int getMajorVersion() { - return this.iMajor; - } - - /** - * Returns the minor version - * - * @return The minor version - */ - public int getMinorVersion() { - return this.iMinor; - } - - /** - * Returns the method name - * - * @return The method name - */ - public String getMethodName() { - return this.iMethod; - } - - /** - * Return the status - * - * @return The status - */ - public int getStatus() { - return this.iStatus; - } - - /** - * Writes the method to a given stream - * - * @param pStream - * The stream - */ - public void write(ASCIIPrintStream pStream) { - pStream.print(this.iMethod + " " + this.iRequest + " HTTP/" + this.iMajor + "." - + this.iMinor + "\r\n"); - } - - /** - * Returns the response message - * - * @return The response message - */ - public String getResponseMessage() { - return this.iResponse; - } - - @Override - public String toString() { - if (this.iIncomming) { return this.iHttpHeader + " " + this.iStatus + " " + this.iResponse; } - return this.iMethod + " " + this.iRequest + " HTTP/" + this.iMajor + "." + this.iMinor; - } -} +/* + (C) Copyright IBM Corp. 2005, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1535756 2006-08-07 lupusalex Make code warning free + * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors + */ + +package org.metricshub.wbem.sblim.cimclient.internal.http; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.IOException; +import java.io.InputStream; +import java.net.HttpURLConnection; + +import org.metricshub.wbem.sblim.cimclient.internal.http.io.ASCIIPrintStream; + +/** + * Class HttpClientMethod encapsulates a http client method + * + */ +public class HttpClientMethod extends HttpMethod { + + private boolean iIncomming = true; + + private String iHttpHeader; + + private int iMinor, iMajor; + + private int iStatus; + + private String iMethod; + + private String iRequest; + + private String iResponse; + + /** + * Ctor. Creates an outgoing http method + * + * @param pMethod + * The method + * @param pRequest + * The request + * @param pMajor + * The major version + * @param pMinor + * The minor version + */ + public HttpClientMethod(String pMethod, String pRequest, int pMajor, int pMinor) { + this.iMinor = pMinor; + this.iMajor = pMajor; + this.iRequest = pRequest; + this.iMethod = pMethod; + this.iIncomming = false; + } + + /** + * Ctor. Parses an incoming http method from a given input stream + * + * @param pReader + * The input stream + * @throws IOException + */ + public HttpClientMethod(InputStream pReader) throws IOException { + String line = null; + + do { + line = readLine(pReader); + } while (line == null || line.length() == 0); + int rqt = line.indexOf(' '); + int prev = 0; + if (rqt > -1) { // Parse the header + int next = rqt; + this.iHttpHeader = line.substring(prev, next).toUpperCase(); + + prev = this.iHttpHeader.indexOf('/'); + if (prev > 0 && this.iHttpHeader.substring(0, prev).equalsIgnoreCase("HTTP")) { + next = this.iHttpHeader.indexOf('.', prev + 1); + try { + this.iMajor = Integer.parseInt(this.iHttpHeader.substring(prev + 1, next)); + this.iMinor = Integer.parseInt(this.iHttpHeader.substring(next + 1)); + } catch (Exception e) { + throw new HttpException(HttpURLConnection.HTTP_BAD_METHOD, "Bad method"); + } + prev = rqt; + rqt = line.indexOf(' ', prev + 1); + if (rqt > -1) { + try { + this.iStatus = Integer.parseInt(line.substring(prev + 1, rqt)); + } catch (Exception e) { + throw new HttpException(HttpURLConnection.HTTP_BAD_METHOD, "Bad method"); + } + this.iResponse = line.substring(rqt + 1); + return; + } + } else throw new HttpException(HttpURLConnection.HTTP_BAD_METHOD, "Bad method"); + } + throw new HttpException(HttpURLConnection.HTTP_BAD_METHOD, "Bad method"); + } + + /** + * Returns the major version + * + * @return The major version + */ + public int getMajorVersion() { + return this.iMajor; + } + + /** + * Returns the minor version + * + * @return The minor version + */ + public int getMinorVersion() { + return this.iMinor; + } + + /** + * Returns the method name + * + * @return The method name + */ + public String getMethodName() { + return this.iMethod; + } + + /** + * Return the status + * + * @return The status + */ + public int getStatus() { + return this.iStatus; + } + + /** + * Writes the method to a given stream + * + * @param pStream + * The stream + */ + public void write(ASCIIPrintStream pStream) { + pStream.print(this.iMethod + " " + this.iRequest + " HTTP/" + this.iMajor + "." + + this.iMinor + "\r\n"); + } + + /** + * Returns the response message + * + * @return The response message + */ + public String getResponseMessage() { + return this.iResponse; + } + + @Override + public String toString() { + if (this.iIncomming) { return this.iHttpHeader + " " + this.iStatus + " " + this.iResponse; } + return this.iMethod + " " + this.iRequest + " HTTP/" + this.iMajor + "." + this.iMinor; + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/HttpClientPool.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpClientPool.java similarity index 88% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/HttpClientPool.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpClientPool.java index f5f046e..06b7f4f 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/HttpClientPool.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpClientPool.java @@ -1,332 +1,330 @@ -/* - (C) Copyright IBM Corp. 2005, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1353168 2005-11-24 fiuczy Possible NullPointerExcection in HttpClient.streamFinished() - * 1498130 2006-05-31 lupusalex Selection of xml parser on a per connection basis - * 1535756 2006-08-07 lupusalex Make code warning free - * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant - * 1646434 2007-01-28 lupusalex CIMClient close() invalidates all it's enumerations - * 1647159 2007-01-29 lupusalex HttpClientPool runs out of HttpClients - * 1660743 2007-02-15 lupusalex SSLContext is static - * 1714902 2007-05-08 lupusalex Threading related weak spots - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 3400209 2011-08-31 blaschke-oss Highlighted Static Analysis (PMD) issues - * 2618 2013-02-27 blaschke-oss Need to add property to disable weak cipher suites for the secure indication - * 2642 2013-05-21 blaschke-oss Seperate properties needed for cim client and listener to filter out ciphers - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.http; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.net.URI; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.logging.Level; - -import javax.net.ssl.SSLContext; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; -import org.sentrysoftware.wbem.sblim.cimclient.internal.util.Util; -import org.sentrysoftware.wbem.sblim.cimclient.internal.util.WBEMConfiguration; - -/** - * Class HttpClientPool implements a pool for http client connections - * - */ -public class HttpClientPool { - - /** - * Guarded by "this" - */ - private List iAllConnections; - - /** - * Guarded by "this" - */ - private List iAvailableConnections; - - /** - * Guarded by "this" - */ - private boolean iClosed = false; - - private final int iPoolSize; - - private final WBEMConfiguration iConfiguration; - - /** - * Guarded by "this" - */ - private SSLContext iSslContext; - - private String[] iEnabledCipherSuites = null; - - /** - * Ctor. - * - * @param pConfiguration - * The configuration for this session. Must be non-null. - */ - public HttpClientPool(WBEMConfiguration pConfiguration) { - super(); - this.iConfiguration = pConfiguration; - this.iAllConnections = new ArrayList(pConfiguration.getHttpPoolSize()); - this.iAvailableConnections = new ArrayList(pConfiguration.getHttpPoolSize()); - this.iPoolSize = pConfiguration.getHttpPoolSize(); - this.iSslContext = null; - this.iEnabledCipherSuites = null; - } - - /** - * Returns the number of connections in this pool that are available/free - * for (re-)use. - * - * @return number of available/free connections in pool - */ - public synchronized int getNumberOfAllConnections() { - return this.iAllConnections.size(); - } - - /** - * Returns the number of all connections in this pool. - * - * @return number of all connections in pool - */ - public synchronized int getNumberOfAvailableConnections() { - return this.iAvailableConnections.size(); - } - - /** - * Returns the configuration context of this pool - * - * @return The configuration - */ - public WBEMConfiguration getConfigurationContext() { - return this.iConfiguration; - } - - /** - * Returns the SSL context for the clients in this pool. The context is - * initialized on the first call of this method (lazy initialization). - * - * @return The SSL context - */ - public synchronized SSLContext getSslContext() { - if (this.iSslContext == null) { - this.iSslContext = HttpSocketFactory.getInstance().getClientSSLContext( - this.iConfiguration); - } - return this.iSslContext; - } - - /** - * Returns the available connections of this pool for a given - * URI&AuthorizationHandler - * - * @param pUri - * The uri - * @param pHandler - * The authorization handler - * @return A connection if one is available, null otherwise - */ - public synchronized HttpClient retrieveAvailableConnectionFromPool(URI pUri, - AuthorizationHandler pHandler) { - if (this.iClosed) { - LogAndTraceBroker.getBroker().trace(Level.FINE, - "Attempt to get client from closed http client pool,"); - throw new IllegalStateException("HttpClientPool is closed. Retrieve connection failed."); - } - if (getNumberOfAvailableConnections() > 0) { - LogAndTraceBroker.getBroker().trace( - Level.FINE, - "Reusing client (" + pUri.toString() + ", max: " + getPoolSize() + ", current:" - + getNumberOfAvailableConnections()); - - return this.iAvailableConnections.remove(0); - } - - LogAndTraceBroker.getBroker().trace( - Level.FINE, - "New client (" + pUri.toString() + ", max: " + getPoolSize() + ", current:" - + getNumberOfAvailableConnections()); - HttpClient client = new HttpClient(pUri, this, pHandler); - addConnectionToPool(client); - return client; - } - - /** - * Add the connection to the pool. Connection is added as available - * connection. Use method {@link #addConnectionToPool(HttpClient)} to add - * the connection without being available for reuse. - * - * @param httpClient - * connection that is to be added to the pool - * @return true if connection was added otherwise false - */ - public synchronized boolean returnAvailableConnectionToPool(HttpClient httpClient) { - if (httpClient == null) { return false; } - - if (this.iClosed) { - this.iAllConnections.remove(httpClient); - httpClient.disconnect(); - return false; - } - - if (getPoolSize() > this.iAvailableConnections.size()) { - if (!this.iAvailableConnections.contains(httpClient)) { - // ensure that the connection exists in allConnections owned by - // pool - addConnectionToPool(httpClient); - this.iAvailableConnections.add(httpClient); - return true; - } - } else { - LogAndTraceBroker.getBroker().trace(Level.FINE, - "Http pool size reached, discarding client."); - this.iAllConnections.remove(httpClient); - this.iAvailableConnections.remove(httpClient); - httpClient.disconnect(); - } - return false; // connection was not added to pool - } - - /** - * Add the connection to the pool, but does NOT add it as available - * connection. Use method - * {@link #returnAvailableConnectionToPool(HttpClient)} to also add the - * connection to the available connections. - * - * @param httpClient - * connection that is to be added to the pool - * @return true if connection was added otherwise false - */ - public synchronized boolean addConnectionToPool(HttpClient httpClient) { - if (this.iClosed) { - LogAndTraceBroker.getBroker().trace(Level.FINE, - "Attempt to add client to closed http client pool,"); - throw new IllegalStateException("HttpClientPool is closed. Add connection failed."); - } - if (httpClient != null && !this.iAllConnections.contains(httpClient)) { - // if connection is not in pool add it - this.iAllConnections.add(httpClient); - return true; - } - return false; - } - - /** - * Removes a connection completely from the pool. - * - * @param httpClient - * connection that is to be removed from the pool - * @return true if connection was removed otherwise false - */ - public synchronized boolean removeConnectionFromPool(HttpClient httpClient) { - if (httpClient != null) { - this.iAvailableConnections.remove(httpClient); - if (this.iAllConnections.remove(httpClient)) { return true; } - return false; // connection was not in pool! - } - return false; // no connection given - } - - /** - * Closes the pool. This will disconnect all clients in the pool. - */ - public synchronized void closePool() { - this.iClosed = true; - Iterator iter = this.iAvailableConnections.iterator(); - while (iter.hasNext()) { - HttpClient httpClient = iter.next(); - this.iAllConnections.remove(httpClient); - httpClient.disconnect(); - } - this.iAvailableConnections.clear(); - } - - @Override - protected void finalize() throws Throwable { - closePool(); - super.finalize(); - } - - /** - * Returns poolSize - * - * @return The value of poolSize. - */ - public int getPoolSize() { - return this.iPoolSize; - } - - /** - * Returns updated array of cipher suites which is current cipher suites - * less any cipher suites listed to be disabled - * - * NOTE: The updated array is generated only upon first invocation and then - * saved, effectively making this a lazy initialization of the cipher suites - * on a HttpClientPool basis - it has to be done here and not in WBEMClient - * where it belongs because socket characteristics are not known to - * WBEMClient - * - * @param pCurrentCipherSuites - * The currently enabled cipher suites - * @param pDisableCipherSuites - * The list of cipher suites to be disabled - * @return The updated enabled cipher suites - */ - public synchronized String[] getUpdatedCipherSuites(String[] pCurrentCipherSuites, - String pDisableCipherSuites) { - if (this.iEnabledCipherSuites == null) { - this.iEnabledCipherSuites = Util.getFilteredStringArray(pCurrentCipherSuites, - pDisableCipherSuites); - int before = pCurrentCipherSuites.length; - int after = this.iEnabledCipherSuites.length; - if (before > 0 && after == 0) LogAndTraceBroker.getBroker().trace(Level.WARNING, - "All cipher suites disabled for client!"); - else if (before > after) LogAndTraceBroker.getBroker().trace(Level.FINE, - "Some (" + (before - after) + ") cipher suites disabled for client"); - else if (before == after) LogAndTraceBroker.getBroker().trace(Level.FINER, - "No cipher suites disabled for client"); - } - return this.iEnabledCipherSuites; - } -} +/* + (C) Copyright IBM Corp. 2005, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1353168 2005-11-24 fiuczy Possible NullPointerExcection in HttpClient.streamFinished() + * 1498130 2006-05-31 lupusalex Selection of xml parser on a per connection basis + * 1535756 2006-08-07 lupusalex Make code warning free + * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant + * 1646434 2007-01-28 lupusalex CIMClient close() invalidates all it's enumerations + * 1647159 2007-01-29 lupusalex HttpClientPool runs out of HttpClients + * 1660743 2007-02-15 lupusalex SSLContext is static + * 1714902 2007-05-08 lupusalex Threading related weak spots + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 3400209 2011-08-31 blaschke-oss Highlighted Static Analysis (PMD) issues + * 2618 2013-02-27 blaschke-oss Need to add property to disable weak cipher suites for the secure indication + * 2642 2013-05-21 blaschke-oss Seperate properties needed for cim client and listener to filter out ciphers + */ + +package org.metricshub.wbem.sblim.cimclient.internal.http; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.net.URI; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.logging.Level; + +import javax.net.ssl.SSLContext; + +import org.metricshub.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; +import org.metricshub.wbem.sblim.cimclient.internal.util.Util; +import org.metricshub.wbem.sblim.cimclient.internal.util.WBEMConfiguration; + +/** + * Class HttpClientPool implements a pool for http client connections + * + */ +public class HttpClientPool { + + /** + * Guarded by "this" + */ + private List iAllConnections; + + /** + * Guarded by "this" + */ + private List iAvailableConnections; + + /** + * Guarded by "this" + */ + private boolean iClosed = false; + + private final int iPoolSize; + + private final WBEMConfiguration iConfiguration; + + /** + * Guarded by "this" + */ + private SSLContext iSslContext; + + private String[] iEnabledCipherSuites = null; + + /** + * Ctor. + * + * @param pConfiguration + * The configuration for this session. Must be non-null. + */ + public HttpClientPool(WBEMConfiguration pConfiguration) { + super(); + this.iConfiguration = pConfiguration; + this.iAllConnections = new ArrayList(pConfiguration.getHttpPoolSize()); + this.iAvailableConnections = new ArrayList(pConfiguration.getHttpPoolSize()); + this.iPoolSize = pConfiguration.getHttpPoolSize(); + this.iSslContext = null; + this.iEnabledCipherSuites = null; + } + + /** + * Returns the number of connections in this pool that are available/free + * for (re-)use. + * + * @return number of available/free connections in pool + */ + public synchronized int getNumberOfAllConnections() { + return this.iAllConnections.size(); + } + + /** + * Returns the number of all connections in this pool. + * + * @return number of all connections in pool + */ + public synchronized int getNumberOfAvailableConnections() { + return this.iAvailableConnections.size(); + } + + /** + * Returns the configuration context of this pool + * + * @return The configuration + */ + public WBEMConfiguration getConfigurationContext() { + return this.iConfiguration; + } + + /** + * Returns the SSL context for the clients in this pool. The context is + * initialized on the first call of this method (lazy initialization). + * + * @return The SSL context + */ + public synchronized SSLContext getSslContext() { + if (this.iSslContext == null) { + this.iSslContext = HttpSocketFactory.getInstance().getClientSSLContext( + this.iConfiguration); + } + return this.iSslContext; + } + + /** + * Returns the available connections of this pool for a given + * URI&AuthorizationHandler + * + * @param pUri + * The uri + * @param pHandler + * The authorization handler + * @return A connection if one is available, null otherwise + */ + public synchronized HttpClient retrieveAvailableConnectionFromPool(URI pUri, + AuthorizationHandler pHandler) { + if (this.iClosed) { + LogAndTraceBroker.getBroker().trace(Level.FINE, + "Attempt to get client from closed http client pool,"); + throw new IllegalStateException("HttpClientPool is closed. Retrieve connection failed."); + } + if (getNumberOfAvailableConnections() > 0) { + LogAndTraceBroker.getBroker().trace( + Level.FINE, + "Reusing client (" + pUri.toString() + ", max: " + getPoolSize() + ", current:" + + getNumberOfAvailableConnections()); + + return this.iAvailableConnections.remove(0); + } + + LogAndTraceBroker.getBroker().trace( + Level.FINE, + "New client (" + pUri.toString() + ", max: " + getPoolSize() + ", current:" + + getNumberOfAvailableConnections()); + HttpClient client = new HttpClient(pUri, this, pHandler); + addConnectionToPool(client); + return client; + } + + /** + * Add the connection to the pool. Connection is added as available + * connection. Use method {@link #addConnectionToPool(HttpClient)} to add + * the connection without being available for reuse. + * + * @param httpClient + * connection that is to be added to the pool + * @return true if connection was added otherwise false + */ + public synchronized boolean returnAvailableConnectionToPool(HttpClient httpClient) { + if (httpClient == null) { return false; } + + if (this.iClosed) { + this.iAllConnections.remove(httpClient); + httpClient.disconnect(); + return false; + } + + if (getPoolSize() > this.iAvailableConnections.size()) { + if (!this.iAvailableConnections.contains(httpClient)) { + // ensure that the connection exists in allConnections owned by + // pool + addConnectionToPool(httpClient); + this.iAvailableConnections.add(httpClient); + return true; + } + } else { + LogAndTraceBroker.getBroker().trace(Level.FINE, + "Http pool size reached, discarding client."); + this.iAllConnections.remove(httpClient); + this.iAvailableConnections.remove(httpClient); + httpClient.disconnect(); + } + return false; // connection was not added to pool + } + + /** + * Add the connection to the pool, but does NOT add it as available + * connection. Use method + * {@link #returnAvailableConnectionToPool(HttpClient)} to also add the + * connection to the available connections. + * + * @param httpClient + * connection that is to be added to the pool + * @return true if connection was added otherwise false + */ + public synchronized boolean addConnectionToPool(HttpClient httpClient) { + if (this.iClosed) { + LogAndTraceBroker.getBroker().trace(Level.FINE, + "Attempt to add client to closed http client pool,"); + throw new IllegalStateException("HttpClientPool is closed. Add connection failed."); + } + if (httpClient != null && !this.iAllConnections.contains(httpClient)) { + // if connection is not in pool add it + this.iAllConnections.add(httpClient); + return true; + } + return false; + } + + /** + * Removes a connection completely from the pool. + * + * @param httpClient + * connection that is to be removed from the pool + * @return true if connection was removed otherwise false + */ + public synchronized boolean removeConnectionFromPool(HttpClient httpClient) { + if (httpClient != null) { + this.iAvailableConnections.remove(httpClient); + if (this.iAllConnections.remove(httpClient)) { return true; } + return false; // connection was not in pool! + } + return false; // no connection given + } + + /** + * Closes the pool. This will disconnect all clients in the pool. + */ + public synchronized void closePool() { + this.iClosed = true; + Iterator iter = this.iAvailableConnections.iterator(); + while (iter.hasNext()) { + HttpClient httpClient = iter.next(); + this.iAllConnections.remove(httpClient); + httpClient.disconnect(); + } + this.iAvailableConnections.clear(); + } + + @Override + protected void finalize() throws Throwable { + closePool(); + super.finalize(); + } + + /** + * Returns poolSize + * + * @return The value of poolSize. + */ + public int getPoolSize() { + return this.iPoolSize; + } + + /** + * Returns updated array of cipher suites which is current cipher suites + * less any cipher suites listed to be disabled + * + * NOTE: The updated array is generated only upon first invocation and then + * saved, effectively making this a lazy initialization of the cipher suites + * on a HttpClientPool basis - it has to be done here and not in WBEMClient + * where it belongs because socket characteristics are not known to + * WBEMClient + * + * @param pCurrentCipherSuites + * The currently enabled cipher suites + * @param pDisableCipherSuites + * The list of cipher suites to be disabled + * @return The updated enabled cipher suites + */ + public synchronized String[] getUpdatedCipherSuites(String[] pCurrentCipherSuites, + String pDisableCipherSuites) { + if (this.iEnabledCipherSuites == null) { + this.iEnabledCipherSuites = Util.getFilteredStringArray(pCurrentCipherSuites, + pDisableCipherSuites); + int before = pCurrentCipherSuites.length; + int after = this.iEnabledCipherSuites.length; + if (before > 0 && after == 0) LogAndTraceBroker.getBroker().trace(Level.WARNING, + "All cipher suites disabled for client!"); + else if (before > after) LogAndTraceBroker.getBroker().trace(Level.FINE, + "Some (" + (before - after) + ") cipher suites disabled for client"); + else if (before == after) LogAndTraceBroker.getBroker().trace(Level.FINER, + "No cipher suites disabled for client"); + } + return this.iEnabledCipherSuites; + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/HttpConnectionHandler.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpConnectionHandler.java similarity index 86% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/HttpConnectionHandler.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpConnectionHandler.java index 517375f..d13b10c 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/HttpConnectionHandler.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpConnectionHandler.java @@ -1,286 +1,284 @@ -/* - (C) Copyright IBM Corp. 2005, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 17931 2005-07-28 thschaef Add InetAddress to CIM Event - * 1535756 2006-08-07 lupusalex Make code warning free - * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant - * 1649779 2007-02-01 lupusalex Indication listener threads freeze - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors - * 3185818 2011-02-18 blaschke-oss indicationOccured URL incorrect - * 3495662 2012-02-29 blaschke-oss Invalid HTML from HttpConnectionHandler.writeError - * 2635 2013-05-16 blaschke-oss Slowloris DoS attack for CIM indication listener port - * 2657 2013-08-20 blaschke-oss Potential null pointer exception in handleConnection - */ -package org.sentrysoftware.wbem.sblim.cimclient.internal.http; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.InetAddress; -import java.net.Socket; -import java.net.SocketTimeoutException; -import java.util.HashMap; -import java.util.Map; -import java.util.logging.Level; - -import javax.net.ssl.SSLSocket; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.http.io.ASCIIPrintStream; -import org.sentrysoftware.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; -import org.sentrysoftware.wbem.sblim.cimclient.internal.util.WBEMConfiguration; -import org.sentrysoftware.wbem.sblim.cimclient.internal.util.WBEMConstants; - -/** - * Class HttpConnectionHandler is responsible for handling an incoming - * connection - * - */ -public class HttpConnectionHandler { - - /** - * MAJOR_VERSION - */ - public static final int MAJOR_VERSION = 1; - - /** - * MINOR_VERSION - */ - public static final int MINOR_VERSION = 1; - - HttpContentHandler iHandler; - - private int iHeaderTimeout; - - private int iMaxAllowedTimeouts; - - private Map iSuspectIPs = new HashMap(); - - private StringBuilder iBlockedIPs = null; - - /** - * Ctor. - * - * @param pHandler - * The content handler - * @param pProperties - * The configuration properties - */ - public HttpConnectionHandler(HttpContentHandler pHandler, WBEMConfiguration pProperties) { - this.iHandler = pHandler; - this.iHeaderTimeout = pProperties.getListenerHttpHeaderTimeout(); - this.iMaxAllowedTimeouts = pProperties.getListenerMaxAllowedTimeouts(); - } - - private synchronized void addSuspectIP(String pSuspectIP) { - if (this.iMaxAllowedTimeouts == 0) return; - - Integer times = this.iSuspectIPs.get(pSuspectIP); - if (times == null) { - this.iSuspectIPs.put(pSuspectIP, Integer.valueOf(1)); - } else { - int timesVal = times.intValue() + 1; - this.iSuspectIPs.put(pSuspectIP, Integer.valueOf(timesVal)); - if (timesVal >= this.iMaxAllowedTimeouts) { - boolean newIP = false; - if (this.iBlockedIPs == null) { - this.iBlockedIPs = new StringBuilder(pSuspectIP); - newIP = true; - } else if (this.iBlockedIPs.indexOf(pSuspectIP) == -1) { - this.iBlockedIPs.append(','); - this.iBlockedIPs.append(pSuspectIP); - newIP = true; - } - if (newIP) LogAndTraceBroker.getBroker().trace( - Level.WARNING, - "Maximum allowable timeouts exceeded, all future connections ignored from " - + pSuspectIP); - } - } - } - - private synchronized boolean isBlockedIP(Socket socket) { - return (this.iBlockedIPs != null && this.iBlockedIPs.indexOf(socket.getInetAddress() - .getHostAddress()) != -1); - } - - /** - * Handles the incoming connection and forwards to the content handler - * - * @param socket - * The socket of the connection - */ - public void handleConnection(Socket socket) { - InputStream is = null; - OutputStream os = null; - if (isBlockedIP(socket)) { - LogAndTraceBroker.getBroker().trace( - Level.FINEST, - "Incoming connection ignored from blocked IP " - + socket.getInetAddress().getHostAddress()); - } else try { - is = socket.getInputStream(); - os = socket.getOutputStream(); - do { // handle persistent connections - MessageReader reader = new MessageReader(is, this.iHeaderTimeout); - boolean persistent = reader.isPersistentConnectionSupported(); - persistent = false; - boolean chunk = reader.isChunkSupported(); - - HttpServerMethod readerMethod = reader.getMethod(); - if (readerMethod.getMethodName().equals("POST") - || readerMethod.getMethodName().equals("M-POST")) { - // TODO: validate authorization - - MessageWriter writer = new MessageWriter(os, persistent, chunk); - try { - StringBuilder localURL = new StringBuilder( - socket instanceof SSLSocket ? "https://" : "http://"); - InetAddress localAddress = socket.getLocalAddress(); - if (localAddress != null) { - localURL.append(localAddress.getHostAddress()); - int port = socket.getLocalPort(); - if (port > 0) { - localURL.append(":"); - localURL.append(port); - } - } - - // 17931 - this.iHandler.handleContent(reader, writer, socket.getInetAddress(), - localURL.toString()); - writer.setMethod(new HttpServerMethod(readerMethod.getMajorVersion(), - readerMethod.getMinorVersion(), 200, "OK")); - } catch (HttpException e) { - writer.setMethod(new HttpServerMethod(readerMethod.getMajorVersion(), - readerMethod.getMinorVersion(), e.getStatus(), e.getMessage())); - } catch (Throwable t) { - writer.setMethod(new HttpServerMethod(readerMethod.getMajorVersion(), - readerMethod.getMinorVersion(), 501, "Not Implemented")); - // TODO: define the correct error description - writer.reset(); - // TODO: report an specific error - writeError(writer.getOutputStream(), "error", "error"); - } finally { - try { - writer.close(); - } catch (IOException e) { - LogAndTraceBroker.getBroker().trace(Level.FINER, - "Exception while closing output stream from server socket", e); - } - } - } else { - persistent = false; - MessageWriter writer = new MessageWriter(os, false, false); - HttpHeader header = new HttpHeader(); - writer.setHeader(header); - // header.addField("Connection", persistent? - // "Keep-Alive","close"); - writer.setMethod(new HttpServerMethod(readerMethod.getMajorVersion(), - readerMethod.getMinorVersion(), 501, "Not Implemented")); - writeError(writer.getOutputStream(), "", ""); - try { - writer.close(); - } catch (IOException e) { - LogAndTraceBroker.getBroker().trace(Level.FINER, - "Exception while closing output stream from server socket", e); - } - } - - if (!persistent) break; - try { - reader.close(); - } catch (IOException e) { - LogAndTraceBroker.getBroker().trace(Level.FINER, - "Exception while closing input stream from server socket", e); - } - } while (true); - } catch (IOException e) { - LogAndTraceBroker.getBroker().trace(Level.FINER, - "Exception while reading from server socket", e); - - if (e instanceof SocketTimeoutException - || WBEMConstants.INDICATION_DOS_EXCEPTION_MESSAGE.equalsIgnoreCase(e - .getMessage())) { - addSuspectIP(socket.getInetAddress().getHostAddress()); - } - } - try { - socket.close(); - } catch (IOException e) { - LogAndTraceBroker.getBroker().trace(Level.FINER, - "Exception while closing server socket", e); - } - } - - /** - * Closes the handler. Will also close the content handler. - */ - public void close() { - this.iHandler.close(); - } - - private void writeError(ASCIIPrintStream dos, String title, String body) { - dos.print(" " + title + "" + body - + ""); - - } - - /** - * Get the IPs blocked by the listener associated with the specified port. - * - * @return The comma-separated list of blocked IPs. - */ - public synchronized String getBlockedIPs() { - return (this.iBlockedIPs == null) ? null : this.iBlockedIPs.toString(); - } - - /** - * Set the IPs to be blocked by the listener associated with the specified - * port. - * - * @param pIPs - * The comma-separated list of blocked IPs. - */ - public synchronized void setBlockedIPs(String pIPs) { - this.iBlockedIPs = (pIPs == null || pIPs.trim().length() == 0) ? null : new StringBuilder( - pIPs); - } -} +/* + (C) Copyright IBM Corp. 2005, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 17931 2005-07-28 thschaef Add InetAddress to CIM Event + * 1535756 2006-08-07 lupusalex Make code warning free + * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant + * 1649779 2007-02-01 lupusalex Indication listener threads freeze + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors + * 3185818 2011-02-18 blaschke-oss indicationOccured URL incorrect + * 3495662 2012-02-29 blaschke-oss Invalid HTML from HttpConnectionHandler.writeError + * 2635 2013-05-16 blaschke-oss Slowloris DoS attack for CIM indication listener port + * 2657 2013-08-20 blaschke-oss Potential null pointer exception in handleConnection + */ +package org.metricshub.wbem.sblim.cimclient.internal.http; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.InetAddress; +import java.net.Socket; +import java.net.SocketTimeoutException; +import java.util.HashMap; +import java.util.Map; +import java.util.logging.Level; + +import javax.net.ssl.SSLSocket; + +import org.metricshub.wbem.sblim.cimclient.internal.http.io.ASCIIPrintStream; +import org.metricshub.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; +import org.metricshub.wbem.sblim.cimclient.internal.util.WBEMConfiguration; +import org.metricshub.wbem.sblim.cimclient.internal.util.WBEMConstants; + +/** + * Class HttpConnectionHandler is responsible for handling an incoming + * connection + * + */ +public class HttpConnectionHandler { + + /** + * MAJOR_VERSION + */ + public static final int MAJOR_VERSION = 1; + + /** + * MINOR_VERSION + */ + public static final int MINOR_VERSION = 1; + + HttpContentHandler iHandler; + + private int iHeaderTimeout; + + private int iMaxAllowedTimeouts; + + private Map iSuspectIPs = new HashMap(); + + private StringBuilder iBlockedIPs = null; + + /** + * Ctor. + * + * @param pHandler + * The content handler + * @param pProperties + * The configuration properties + */ + public HttpConnectionHandler(HttpContentHandler pHandler, WBEMConfiguration pProperties) { + this.iHandler = pHandler; + this.iHeaderTimeout = pProperties.getListenerHttpHeaderTimeout(); + this.iMaxAllowedTimeouts = pProperties.getListenerMaxAllowedTimeouts(); + } + + private synchronized void addSuspectIP(String pSuspectIP) { + if (this.iMaxAllowedTimeouts == 0) return; + + Integer times = this.iSuspectIPs.get(pSuspectIP); + if (times == null) { + this.iSuspectIPs.put(pSuspectIP, Integer.valueOf(1)); + } else { + int timesVal = times.intValue() + 1; + this.iSuspectIPs.put(pSuspectIP, Integer.valueOf(timesVal)); + if (timesVal >= this.iMaxAllowedTimeouts) { + boolean newIP = false; + if (this.iBlockedIPs == null) { + this.iBlockedIPs = new StringBuilder(pSuspectIP); + newIP = true; + } else if (this.iBlockedIPs.indexOf(pSuspectIP) == -1) { + this.iBlockedIPs.append(','); + this.iBlockedIPs.append(pSuspectIP); + newIP = true; + } + if (newIP) LogAndTraceBroker.getBroker().trace( + Level.WARNING, + "Maximum allowable timeouts exceeded, all future connections ignored from " + + pSuspectIP); + } + } + } + + private synchronized boolean isBlockedIP(Socket socket) { + return (this.iBlockedIPs != null && this.iBlockedIPs.indexOf(socket.getInetAddress() + .getHostAddress()) != -1); + } + + /** + * Handles the incoming connection and forwards to the content handler + * + * @param socket + * The socket of the connection + */ + public void handleConnection(Socket socket) { + InputStream is = null; + OutputStream os = null; + if (isBlockedIP(socket)) { + LogAndTraceBroker.getBroker().trace( + Level.FINEST, + "Incoming connection ignored from blocked IP " + + socket.getInetAddress().getHostAddress()); + } else try { + is = socket.getInputStream(); + os = socket.getOutputStream(); + do { // handle persistent connections + MessageReader reader = new MessageReader(is, this.iHeaderTimeout); + boolean persistent = reader.isPersistentConnectionSupported(); + persistent = false; + boolean chunk = reader.isChunkSupported(); + + HttpServerMethod readerMethod = reader.getMethod(); + if (readerMethod.getMethodName().equals("POST") + || readerMethod.getMethodName().equals("M-POST")) { + // TODO: validate authorization + + MessageWriter writer = new MessageWriter(os, persistent, chunk); + try { + StringBuilder localURL = new StringBuilder( + socket instanceof SSLSocket ? "https://" : "http://"); + InetAddress localAddress = socket.getLocalAddress(); + if (localAddress != null) { + localURL.append(localAddress.getHostAddress()); + int port = socket.getLocalPort(); + if (port > 0) { + localURL.append(":"); + localURL.append(port); + } + } + + // 17931 + this.iHandler.handleContent(reader, writer, socket.getInetAddress(), + localURL.toString()); + writer.setMethod(new HttpServerMethod(readerMethod.getMajorVersion(), + readerMethod.getMinorVersion(), 200, "OK")); + } catch (HttpException e) { + writer.setMethod(new HttpServerMethod(readerMethod.getMajorVersion(), + readerMethod.getMinorVersion(), e.getStatus(), e.getMessage())); + } catch (Throwable t) { + writer.setMethod(new HttpServerMethod(readerMethod.getMajorVersion(), + readerMethod.getMinorVersion(), 501, "Not Implemented")); + // TODO: define the correct error description + writer.reset(); + // TODO: report an specific error + writeError(writer.getOutputStream(), "error", "error"); + } finally { + try { + writer.close(); + } catch (IOException e) { + LogAndTraceBroker.getBroker().trace(Level.FINER, + "Exception while closing output stream from server socket", e); + } + } + } else { + persistent = false; + MessageWriter writer = new MessageWriter(os, false, false); + HttpHeader header = new HttpHeader(); + writer.setHeader(header); + // header.addField("Connection", persistent? + // "Keep-Alive","close"); + writer.setMethod(new HttpServerMethod(readerMethod.getMajorVersion(), + readerMethod.getMinorVersion(), 501, "Not Implemented")); + writeError(writer.getOutputStream(), "", ""); + try { + writer.close(); + } catch (IOException e) { + LogAndTraceBroker.getBroker().trace(Level.FINER, + "Exception while closing output stream from server socket", e); + } + } + + if (!persistent) break; + try { + reader.close(); + } catch (IOException e) { + LogAndTraceBroker.getBroker().trace(Level.FINER, + "Exception while closing input stream from server socket", e); + } + } while (true); + } catch (IOException e) { + LogAndTraceBroker.getBroker().trace(Level.FINER, + "Exception while reading from server socket", e); + + if (e instanceof SocketTimeoutException + || WBEMConstants.INDICATION_DOS_EXCEPTION_MESSAGE.equalsIgnoreCase(e + .getMessage())) { + addSuspectIP(socket.getInetAddress().getHostAddress()); + } + } + try { + socket.close(); + } catch (IOException e) { + LogAndTraceBroker.getBroker().trace(Level.FINER, + "Exception while closing server socket", e); + } + } + + /** + * Closes the handler. Will also close the content handler. + */ + public void close() { + this.iHandler.close(); + } + + private void writeError(ASCIIPrintStream dos, String title, String body) { + dos.print(" " + title + "" + body + + ""); + + } + + /** + * Get the IPs blocked by the listener associated with the specified port. + * + * @return The comma-separated list of blocked IPs. + */ + public synchronized String getBlockedIPs() { + return (this.iBlockedIPs == null) ? null : this.iBlockedIPs.toString(); + } + + /** + * Set the IPs to be blocked by the listener associated with the specified + * port. + * + * @param pIPs + * The comma-separated list of blocked IPs. + */ + public synchronized void setBlockedIPs(String pIPs) { + this.iBlockedIPs = (pIPs == null || pIPs.trim().length() == 0) ? null : new StringBuilder( + pIPs); + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/HttpContentHandler.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpContentHandler.java similarity index 71% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/HttpContentHandler.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpContentHandler.java index 561e0d6..3a9d6e8 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/HttpContentHandler.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpContentHandler.java @@ -1,80 +1,78 @@ -/* - (C) Copyright IBM Corp. 2005, 2011 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 17931 2005-07-28 thschaef Add InetAddress to CIM Event - * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 3185818 2011-02-18 blaschke-oss indicationOccured URL incorrect - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.http; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.IOException; -import java.net.InetAddress; - -/** - * Class HttpContentHandler is responsible for handling the content of an http - * connection. - * - */ -public abstract class HttpContentHandler { - - /** - * Handles the content of a given connection - * - * @param pMessageReader - * The reader of the connection - * @param pMessageWriter - * The writer of the connection - * @param pInetAddress - * The remote network address - * @param pLocalAddress - * The local network address - * @throws HttpException - * @throws IOException - */ - public abstract void handleContent(MessageReader pMessageReader, MessageWriter pMessageWriter, - InetAddress pInetAddress, String pLocalAddress) throws HttpException, IOException; - - /** - * Closes the handler - */ - public abstract void close(); -} +/* + (C) Copyright IBM Corp. 2005, 2011 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 17931 2005-07-28 thschaef Add InetAddress to CIM Event + * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 3185818 2011-02-18 blaschke-oss indicationOccured URL incorrect + */ + +package org.metricshub.wbem.sblim.cimclient.internal.http; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.IOException; +import java.net.InetAddress; + +/** + * Class HttpContentHandler is responsible for handling the content of an http + * connection. + * + */ +public abstract class HttpContentHandler { + + /** + * Handles the content of a given connection + * + * @param pMessageReader + * The reader of the connection + * @param pMessageWriter + * The writer of the connection + * @param pInetAddress + * The remote network address + * @param pLocalAddress + * The local network address + * @throws HttpException + * @throws IOException + */ + public abstract void handleContent(MessageReader pMessageReader, MessageWriter pMessageWriter, + InetAddress pInetAddress, String pLocalAddress) throws HttpException, IOException; + + /** + * Closes the handler + */ + public abstract void close(); +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/HttpException.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpException.java similarity index 74% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/HttpException.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpException.java index 65bb6c1..1021a10 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/HttpException.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpException.java @@ -1,117 +1,115 @@ -/* - (C) Copyright IBM Corp. 2005, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1535756 2006-08-07 lupusalex Make code warning free - * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.http; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.IOException; - -/** - * Class HttpException represents HTTP related problems - * - */ -public class HttpException extends IOException { - - private static final long serialVersionUID = 934925248736106630L; - - int iStatus; - - /** - * Ctor. Equivalent to HttpException(-1, null, null) - */ - public HttpException() { - this(-1, null, null); - } - - /** - * Ctor. Equivalent to HttpException(-1, reason, null) - * - * @param reason - * The reason - */ - public HttpException(String reason) { - this(-1, reason, null); - } - - /** - * Ctor. Equivalent to HttpException(-1, reason, null) - * - * @param status - * The status - * @param reason - * The reason - */ - public HttpException(int status, String reason) { - this(status, reason, null); - } - - /** - * Ctor. Equivalent to HttpException(-1, reason, null) - * - * @param status - * The status - * @param reason - * The reason - * @param cimError - * The CIM error - */ - public HttpException(int status, String reason, String cimError) { - super(reason); - this.iStatus = status; - } - - /** - * Returns the status - * - * @return The status - */ - public int getStatus() { - return this.iStatus; - } - - @Override - public String toString() { - return super.toString() + "(status:" + this.iStatus + ")"; - } -} +/* + (C) Copyright IBM Corp. 2005, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1535756 2006-08-07 lupusalex Make code warning free + * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.http; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.IOException; + +/** + * Class HttpException represents HTTP related problems + * + */ +public class HttpException extends IOException { + + private static final long serialVersionUID = 934925248736106630L; + + int iStatus; + + /** + * Ctor. Equivalent to HttpException(-1, null, null) + */ + public HttpException() { + this(-1, null, null); + } + + /** + * Ctor. Equivalent to HttpException(-1, reason, null) + * + * @param reason + * The reason + */ + public HttpException(String reason) { + this(-1, reason, null); + } + + /** + * Ctor. Equivalent to HttpException(-1, reason, null) + * + * @param status + * The status + * @param reason + * The reason + */ + public HttpException(int status, String reason) { + this(status, reason, null); + } + + /** + * Ctor. Equivalent to HttpException(-1, reason, null) + * + * @param status + * The status + * @param reason + * The reason + * @param cimError + * The CIM error + */ + public HttpException(int status, String reason, String cimError) { + super(reason); + this.iStatus = status; + } + + /** + * Returns the status + * + * @return The status + */ + public int getStatus() { + return this.iStatus; + } + + @Override + public String toString() { + return super.toString() + "(status:" + this.iStatus + ")"; + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/HttpHeader.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpHeader.java similarity index 89% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/HttpHeader.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpHeader.java index 123e5fd..493d56d 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/HttpHeader.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpHeader.java @@ -1,538 +1,535 @@ -/* - (C) Copyright IBM Corp. 2005, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 17970 2005-08-11 pineiro5 Logon from z/OS not possible - * 1353138 2005-11-24 fiuczy CIMObject element in HTTP header wrong encoded - * 1535756 2006-08-07 lupusalex Make code warning free - * 1516242 2006-11-27 lupusalex Support of OpenPegasus local authentication - * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant - * 1688273 2007-04-19 lupusalex Full support of HTTP trailers - * 1715612 2007-05-09 lupusalex FVT: Status 0 in trailer is parsed as error - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2641758 2009-02-27 blaschke-oss CIM Client does not recognize HTTP extension headers - * 3304058 2011-05-20 blaschke-oss Use same date format in change history - * 3553858 2012-08-06 blaschke-oss Append duplicate HTTP header fields instead of replace - * 3601894 2013-01-23 blaschke-oss Enhance HTTP and CIM-XML tracing - * 2635 2013-05-16 blaschke-oss Slowloris DoS attack for CIM indication listener port - * 2718 2013-11-29 blaschke-oss Bad CIMStatusCode generates NumberFormatException - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.http; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.BufferedWriter; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStreamWriter; -import java.io.UnsupportedEncodingException; -import java.net.URLDecoder; -import java.security.AccessController; -import java.security.PrivilegedAction; -import java.util.BitSet; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.Map.Entry; -import java.util.logging.Level; - -import org.sentrysoftware.wbem.javax.wbem.WBEMException; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.http.io.ASCIIPrintStream; -import org.sentrysoftware.wbem.sblim.cimclient.internal.http.io.TrailerException; -import org.sentrysoftware.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; -import org.sentrysoftware.wbem.sblim.cimclient.internal.logging.Messages; -import org.sentrysoftware.wbem.sblim.cimclient.internal.util.WBEMConstants; - -/** - * Class HttpHeader represents a http header block - * - */ -public class HttpHeader { - - private static BitSet cDontNeedEncoding; - - private static final String HEX_STR = "0123456789ABCDEF"; - - private static String cDfltEncName = null; - - static { - cDontNeedEncoding = new BitSet(256); - int i; - for (i = 'a'; i <= 'z'; i++) { - cDontNeedEncoding.set(i); - } - for (i = 'A'; i <= 'Z'; i++) { - cDontNeedEncoding.set(i); - } - for (i = '0'; i <= '9'; i++) { - cDontNeedEncoding.set(i); - } - cDontNeedEncoding.set(' '); - cDontNeedEncoding.set('-'); - cDontNeedEncoding.set('_'); - cDontNeedEncoding.set('/'); - cDontNeedEncoding.set('.'); - cDontNeedEncoding.set('*'); - - } - - private Hashtable iFields = new Hashtable(); - - /** - * Ctor. - */ - public HttpHeader() { - // empty - } - - /** - * Ctor. Parses the header from an input stream - * - * @param pReader - * The input stream - * @throws IOException - */ - public HttpHeader(InputStream pReader) throws IOException { - this(pReader, 0); - } - - /** - * Ctor. Parses the header from an input stream - * - * @param pReader - * The input stream - * @param pTimeout - * Maximum allowable time to read header - * @throws IOException - */ - public HttpHeader(InputStream pReader, long pTimeout) throws IOException { - String line = null; - long timeStart = System.currentTimeMillis(); - // TODO: this needs to be optimized!!! - while (((line = HttpMethod.readLine(pReader)) != null) && (line.length() > 0)) { - // get the header - if (pTimeout > 0 && (System.currentTimeMillis() - timeStart > pTimeout)) { throw new IOException( - WBEMConstants.INDICATION_DOS_EXCEPTION_MESSAGE); } - try { - int separator; - if ((separator = line.indexOf(':')) > -1) { - String header; - String value; - int headerStartIndex = 0; - - // Ignore prefix-match from HTTP extension (RFC 2774), it'll - // look like "nn-" - if (line.indexOf('-') == 2 && Character.isDigit(line.charAt(0)) - && Character.isDigit(line.charAt(1))) { - headerStartIndex = 3; - } - - header = line.substring(headerStartIndex, separator); - value = line.substring(separator + 1); - // TODO validate header and value, they must not be empty - // entries - if (value.length() > 0 && value.startsWith(" ")) addParsedField(header, value - .substring(1)); - else addParsedField(header, value); - } else { - LogAndTraceBroker.getBroker().message(Messages.HTTP_INVALID_HEADER, line); - } - } catch (Exception e) { - LogAndTraceBroker.getBroker().trace(Level.FINER, - "Exception while parsing http header", e); - LogAndTraceBroker.getBroker().message(Messages.HTTP_INVALID_HEADER, line); - } - } - return; - } - - /** - * Adds a header field for client output (this means duplicate header - * entries are replaced) - * - * @param pName - * The name of the header field - * @param pValue - * The value - */ - public void addField(String pName, String pValue) { - if (pName == null || pName.length() == 0) return; - - if (pValue != null) { - this.iFields.put(new HeaderEntry(pName), pValue); - } else { - this.iFields.remove(new HeaderEntry(pName)); - } - } - - /** - * Adds a header field from parsed server input (this means duplicate header - * entries are appended in comma-separated list as defined by RFC 2616) - * - * @param pName - * The name of the header field - * @param pValue - * The value - */ - public void addParsedField(String pName, String pValue) { - if (pName == null || pName.length() == 0) return; - - if (pValue != null) { - String oldValue = this.iFields.put(new HeaderEntry(pName), pValue); - if (oldValue != null) { - // Field already exists, so append value to existing value; it - // is done checking put() return code, instead of checking get() - // return code prior to put(), because typical user case does - // not include duplicate fields - StringBuilder combinedValue = new StringBuilder(oldValue); - combinedValue.append(','); - combinedValue.append(pValue); - this.iFields.put(new HeaderEntry(pName), combinedValue.toString()); - } - } else { - this.iFields.remove(new HeaderEntry(pName)); - } - } - - /** - * Clears all header fields - */ - public void clear() { - this.iFields.clear(); - } - - /** - * Return an iterator over the header fields - * - * @return The iterator - */ - public Iterator> iterator() { - return this.iFields.entrySet().iterator(); - } - - /** - * Parses a line from a header block - * - * @param pLine - * The line - * @return The http header - */ - public static HttpHeader parse(String pLine) { - int prev = 0; - int next = 0; - HttpHeader header = new HttpHeader(); - if (pLine != null && pLine.length() > 0) { - next = pLine.indexOf(','); - while (next > -1) { - String hdr = pLine.substring(prev, next); - int separator = hdr.indexOf('='); - if (separator > -1) { - String key; - String value; - key = hdr.substring(0, separator); - value = hdr.substring(separator + 1); - - header.addParsedField(key, value); - } else { - // something goes wrong. no separator found - } - prev = next + 1; - while (Character.isSpaceChar(pLine.charAt(prev))) - prev++; - next = pLine.indexOf(',', prev); - } - String hdr = pLine.substring(prev); - int separator = hdr.indexOf('='); - if (separator > -1) { - header.addParsedField(hdr.substring(0, separator), hdr.substring(separator + 1)); - } - } - - return header; - } - - @Override - public String toString() { - StringBuffer buf = new StringBuffer(); - int i = 0; - Iterator> iterator = this.iFields.entrySet().iterator(); - while (iterator.hasNext()) { - if (i++ > 0) buf.append(','); - Entry entry = iterator.next(); - buf.append(entry.getKey().toString()); - buf.append(": "); - buf.append(entry.getValue().toString()); - } - return buf.toString(); - } - - /** - * Removes a field from the header - * - * @param pName - * The name of the field - */ - public void removeField(String pName) { - this.iFields.remove(new HeaderEntry(pName)); - } - - /** - * Returns a field from the header - * - * @param pName - * The name of the field - * @return The value - */ - public String getField(String pName) { - return this.iFields.get(new HeaderEntry(pName)); - } - - /** - * Writes a header block to a stream - * - * @param pWriter - * The stream - */ - public void write(ASCIIPrintStream pWriter) { - - Iterator> iterator = this.iFields.entrySet().iterator(); - while (iterator.hasNext()) { - Entry entry = iterator.next(); - pWriter.print(entry.getKey().toString()); - pWriter.print(": "); - pWriter.print(entry.getValue().toString()); - pWriter.print("\r\n"); - } - pWriter.print("\r\n"); - } - - /** - * Encodes raw data - * - * @param pData - * The raw data - * @return The encoded data - */ - public static synchronized String encode(byte[] pData) { - String str = null; - try { - if (cDfltEncName == null) cDfltEncName = (String) AccessController - .doPrivileged(new GetProperty("file.encoding")); - str = encode(pData, cDfltEncName); - } catch (UnsupportedEncodingException e) { - LogAndTraceBroker.getBroker().trace(Level.FINER, - "Exception while encoding http header data", e); - } - return str; - } - - /** - * Encodes raw data for a given character set - * - * @param pData - * The raw data - * @param pEnc - * The character set - * @return The encoded data - * @throws UnsupportedEncodingException - */ - public static String encode(byte[] pData, String pEnc) throws UnsupportedEncodingException { - - int maxBytesPerChar = 10; - // BufferedWriter validates encoding - ByteArrayOutputStream buf = new ByteArrayOutputStream(maxBytesPerChar); - new BufferedWriter(new OutputStreamWriter(buf, pEnc)); - StringBuffer out = new StringBuffer(pData.length); - - for (int i = 0; i < pData.length; i++) { - int c = pData[i] & 0xFF; - if (cDontNeedEncoding.get(c)) { - if (c == ' ') { - out.append("%20"); - } else { - out.append((char) c); - } - } else { - out.append('%'); - out.append(HEX_STR.charAt((c >> 4) & 0x0f)); - out.append(HEX_STR.charAt(c & 0x0f)); - } - } - - return out.toString(); - } - - /** - * Encodes a given string for a given character set - * - * @param pData - * The source string - * @param pSourceEnc - * The source character set - * @param pTargetEnc - * The target character set - * @return The encoded string - * @throws UnsupportedEncodingException - */ - public static String encode(String pData, String pSourceEnc, String pTargetEnc) - throws UnsupportedEncodingException { - - return encode(pData.getBytes(pSourceEnc), pTargetEnc); - } - - /** - * Class HeaderEntry represents a single header field - * - */ - public static class HeaderEntry { - - String iHeader; - - int iHashcode; - - /** - * Ctor. - * - * @param pName - * The name of the header field - */ - public HeaderEntry(String pName) { - this.iHeader = pName; - this.iHashcode = pName.toUpperCase().hashCode(); - } - - @Override - public boolean equals(Object obj) { - if (obj == null || !(obj instanceof HeaderEntry)) return false; - return this.iHeader.equalsIgnoreCase(((HeaderEntry) obj).iHeader); - } - - @Override - public String toString() { - return this.iHeader; - } - - @Override - public int hashCode() { - return this.iHashcode; - } - } - - /** - * Class GetProperty implements privileged access to system properties - * - */ - private static class GetProperty implements PrivilegedAction { - - String iPropertyName; - - GetProperty(String propertyName) { - this.iPropertyName = propertyName; - } - - public Object run() { - return System.getProperty(this.iPropertyName); - } - } - - /** - * Throws a TrailerException if it contains recognized CIM errors in http - * trailer entries. - * - * @throws TrailerException - */ - public void examineTrailer() throws TrailerException { - examineTrailer(null); - } - - /** - * Throws a TrailerException if it contains recognized CIM errors in http - * trailer entries. - * - * @param pOrigin - * The origin of the trailer (response, request, etc.) - * @throws TrailerException - */ - public void examineTrailer(String pOrigin) throws TrailerException { - Iterator> itr = this.iterator(); - int code = 0, i = 0; - String desc = null; - StringBuilder hdrs = null; - if (LogAndTraceBroker.getBroker().isLoggableTrace(Level.FINER)) hdrs = new StringBuilder(); - while (itr.hasNext()) { - Entry ent = itr.next(); - String keyStr = ent.getKey().toString(); - if (hdrs != null) { - if (i++ > 0) hdrs.append(','); - hdrs.append(keyStr); - hdrs.append(": "); - hdrs.append(this.getField(keyStr)); - } - try { - if (keyStr.equalsIgnoreCase(WBEMConstants.HTTP_TRAILER_STATUS_CODE)) { - String valStr = URLDecoder.decode(this.getField(keyStr), WBEMConstants.UTF8); - try { - code = Integer.parseInt(valStr); - } catch (NumberFormatException e) { - String msg = new String(WBEMConstants.HTTP_TRAILER_STATUS_CODE + " \"" - + valStr + "\" invalid, setting to CIM_ERR_FAILED"); - LogAndTraceBroker.getBroker().trace(Level.FINER, msg, e); - code = WBEMException.CIM_ERR_FAILED; - if (desc == null) desc = msg; - } - } else if (keyStr.equalsIgnoreCase(WBEMConstants.HTTP_TRAILER_STATUS_DESCRIPTION)) { - desc = URLDecoder.decode(this.getField(keyStr), WBEMConstants.UTF8); - } - } catch (UnsupportedEncodingException e) { - // if UTF-8 isn't supported we're in real trouble - throw new Error(e); - } - } - if (hdrs != null && hdrs.length() > 0) LogAndTraceBroker.getBroker().trace( - Level.FINER, - (pOrigin == null ? "Unknown" : pOrigin) + " HTTP Trailer Headers= " - + hdrs.toString()); - if (code > 0) { - if (desc != null) { throw new TrailerException(new WBEMException(code, desc)); } - throw new TrailerException(new WBEMException(code)); - } - } -} +/* + (C) Copyright IBM Corp. 2005, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 17970 2005-08-11 pineiro5 Logon from z/OS not possible + * 1353138 2005-11-24 fiuczy CIMObject element in HTTP header wrong encoded + * 1535756 2006-08-07 lupusalex Make code warning free + * 1516242 2006-11-27 lupusalex Support of OpenPegasus local authentication + * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant + * 1688273 2007-04-19 lupusalex Full support of HTTP trailers + * 1715612 2007-05-09 lupusalex FVT: Status 0 in trailer is parsed as error + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2641758 2009-02-27 blaschke-oss CIM Client does not recognize HTTP extension headers + * 3304058 2011-05-20 blaschke-oss Use same date format in change history + * 3553858 2012-08-06 blaschke-oss Append duplicate HTTP header fields instead of replace + * 3601894 2013-01-23 blaschke-oss Enhance HTTP and CIM-XML tracing + * 2635 2013-05-16 blaschke-oss Slowloris DoS attack for CIM indication listener port + * 2718 2013-11-29 blaschke-oss Bad CIMStatusCode generates NumberFormatException + */ + +package org.metricshub.wbem.sblim.cimclient.internal.http; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.BufferedWriter; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStreamWriter; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.util.BitSet; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.Map.Entry; +import java.util.logging.Level; + +import org.metricshub.wbem.javax.wbem.WBEMException; +import org.metricshub.wbem.sblim.cimclient.internal.http.io.ASCIIPrintStream; +import org.metricshub.wbem.sblim.cimclient.internal.http.io.TrailerException; +import org.metricshub.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; +import org.metricshub.wbem.sblim.cimclient.internal.logging.Messages; +import org.metricshub.wbem.sblim.cimclient.internal.util.WBEMConstants; + +/** + * Class HttpHeader represents a http header block + * + */ +public class HttpHeader { + + private static BitSet cDontNeedEncoding; + + private static final String HEX_STR = "0123456789ABCDEF"; + + private static String cDfltEncName = null; + + static { + cDontNeedEncoding = new BitSet(256); + int i; + for (i = 'a'; i <= 'z'; i++) { + cDontNeedEncoding.set(i); + } + for (i = 'A'; i <= 'Z'; i++) { + cDontNeedEncoding.set(i); + } + for (i = '0'; i <= '9'; i++) { + cDontNeedEncoding.set(i); + } + cDontNeedEncoding.set(' '); + cDontNeedEncoding.set('-'); + cDontNeedEncoding.set('_'); + cDontNeedEncoding.set('/'); + cDontNeedEncoding.set('.'); + cDontNeedEncoding.set('*'); + + } + + private Hashtable iFields = new Hashtable(); + + /** + * Ctor. + */ + public HttpHeader() { + // empty + } + + /** + * Ctor. Parses the header from an input stream + * + * @param pReader + * The input stream + * @throws IOException + */ + public HttpHeader(InputStream pReader) throws IOException { + this(pReader, 0); + } + + /** + * Ctor. Parses the header from an input stream + * + * @param pReader + * The input stream + * @param pTimeout + * Maximum allowable time to read header + * @throws IOException + */ + public HttpHeader(InputStream pReader, long pTimeout) throws IOException { + String line = null; + long timeStart = System.currentTimeMillis(); + // TODO: this needs to be optimized!!! + while (((line = HttpMethod.readLine(pReader)) != null) && (line.length() > 0)) { + // get the header + if (pTimeout > 0 && (System.currentTimeMillis() - timeStart > pTimeout)) { throw new IOException( + WBEMConstants.INDICATION_DOS_EXCEPTION_MESSAGE); } + try { + int separator; + if ((separator = line.indexOf(':')) > -1) { + String header; + String value; + int headerStartIndex = 0; + + // Ignore prefix-match from HTTP extension (RFC 2774), it'll + // look like "nn-" + if (line.indexOf('-') == 2 && Character.isDigit(line.charAt(0)) + && Character.isDigit(line.charAt(1))) { + headerStartIndex = 3; + } + + header = line.substring(headerStartIndex, separator); + value = line.substring(separator + 1); + // TODO validate header and value, they must not be empty + // entries + if (value.length() > 0 && value.startsWith(" ")) addParsedField(header, value + .substring(1)); + else addParsedField(header, value); + } else { + LogAndTraceBroker.getBroker().message(Messages.HTTP_INVALID_HEADER, line); + } + } catch (Exception e) { + LogAndTraceBroker.getBroker().trace(Level.FINER, + "Exception while parsing http header", e); + LogAndTraceBroker.getBroker().message(Messages.HTTP_INVALID_HEADER, line); + } + } + return; + } + + /** + * Adds a header field for client output (this means duplicate header + * entries are replaced) + * + * @param pName + * The name of the header field + * @param pValue + * The value + */ + public void addField(String pName, String pValue) { + if (pName == null || pName.length() == 0) return; + + if (pValue != null) { + this.iFields.put(new HeaderEntry(pName), pValue); + } else { + this.iFields.remove(new HeaderEntry(pName)); + } + } + + /** + * Adds a header field from parsed server input (this means duplicate header + * entries are appended in comma-separated list as defined by RFC 2616) + * + * @param pName + * The name of the header field + * @param pValue + * The value + */ + public void addParsedField(String pName, String pValue) { + if (pName == null || pName.length() == 0) return; + + if (pValue != null) { + String oldValue = this.iFields.put(new HeaderEntry(pName), pValue); + if (oldValue != null) { + // Field already exists, so append value to existing value; it + // is done checking put() return code, instead of checking get() + // return code prior to put(), because typical user case does + // not include duplicate fields + StringBuilder combinedValue = new StringBuilder(oldValue); + combinedValue.append(','); + combinedValue.append(pValue); + this.iFields.put(new HeaderEntry(pName), combinedValue.toString()); + } + } else { + this.iFields.remove(new HeaderEntry(pName)); + } + } + + /** + * Clears all header fields + */ + public void clear() { + this.iFields.clear(); + } + + /** + * Return an iterator over the header fields + * + * @return The iterator + */ + public Iterator> iterator() { + return this.iFields.entrySet().iterator(); + } + + /** + * Parses a line from a header block + * + * @param pLine + * The line + * @return The http header + */ + public static HttpHeader parse(String pLine) { + int prev = 0; + int next = 0; + HttpHeader header = new HttpHeader(); + if (pLine != null && pLine.length() > 0) { + next = pLine.indexOf(','); + while (next > -1) { + String hdr = pLine.substring(prev, next); + int separator = hdr.indexOf('='); + if (separator > -1) { + String key; + String value; + key = hdr.substring(0, separator); + value = hdr.substring(separator + 1); + + header.addParsedField(key, value); + } else { + // something goes wrong. no separator found + } + prev = next + 1; + while (Character.isSpaceChar(pLine.charAt(prev))) + prev++; + next = pLine.indexOf(',', prev); + } + String hdr = pLine.substring(prev); + int separator = hdr.indexOf('='); + if (separator > -1) { + header.addParsedField(hdr.substring(0, separator), hdr.substring(separator + 1)); + } + } + + return header; + } + + @Override + public String toString() { + StringBuffer buf = new StringBuffer(); + int i = 0; + Iterator> iterator = this.iFields.entrySet().iterator(); + while (iterator.hasNext()) { + if (i++ > 0) buf.append(','); + Entry entry = iterator.next(); + buf.append(entry.getKey().toString()); + buf.append(": "); + buf.append(entry.getValue().toString()); + } + return buf.toString(); + } + + /** + * Removes a field from the header + * + * @param pName + * The name of the field + */ + public void removeField(String pName) { + this.iFields.remove(new HeaderEntry(pName)); + } + + /** + * Returns a field from the header + * + * @param pName + * The name of the field + * @return The value + */ + public String getField(String pName) { + return this.iFields.get(new HeaderEntry(pName)); + } + + /** + * Writes a header block to a stream + * + * @param pWriter + * The stream + */ + public void write(ASCIIPrintStream pWriter) { + + Iterator> iterator = this.iFields.entrySet().iterator(); + while (iterator.hasNext()) { + Entry entry = iterator.next(); + pWriter.print(entry.getKey().toString()); + pWriter.print(": "); + pWriter.print(entry.getValue().toString()); + pWriter.print("\r\n"); + } + pWriter.print("\r\n"); + } + + /** + * Encodes raw data + * + * @param pData + * The raw data + * @return The encoded data + */ + public static synchronized String encode(byte[] pData) { + String str = null; + try { + if (cDfltEncName == null) cDfltEncName = (String) AccessController + .doPrivileged(new GetProperty("file.encoding")); + str = encode(pData, cDfltEncName); + } catch (UnsupportedEncodingException e) { + LogAndTraceBroker.getBroker().trace(Level.FINER, + "Exception while encoding http header data", e); + } + return str; + } + + /** + * Encodes raw data for a given character set + * + * @param pData + * The raw data + * @param pEnc + * The character set + * @return The encoded data + * @throws UnsupportedEncodingException + */ + public static String encode(byte[] pData, String pEnc) throws UnsupportedEncodingException { + + int maxBytesPerChar = 10; + // BufferedWriter validates encoding + ByteArrayOutputStream buf = new ByteArrayOutputStream(maxBytesPerChar); + new BufferedWriter(new OutputStreamWriter(buf, pEnc)); + StringBuffer out = new StringBuffer(pData.length); + + for (int i = 0; i < pData.length; i++) { + int c = pData[i] & 0xFF; + if (cDontNeedEncoding.get(c)) { + if (c == ' ') { + out.append("%20"); + } else { + out.append((char) c); + } + } else { + out.append('%'); + out.append(HEX_STR.charAt((c >> 4) & 0x0f)); + out.append(HEX_STR.charAt(c & 0x0f)); + } + } + + return out.toString(); + } + + /** + * Encodes a given string for a given character set + * + * @param pData + * The source string + * @param pSourceEnc + * The source character set + * @param pTargetEnc + * The target character set + * @return The encoded string + * @throws UnsupportedEncodingException + */ + public static String encode(String pData, String pSourceEnc, String pTargetEnc) + throws UnsupportedEncodingException { + + return encode(pData.getBytes(pSourceEnc), pTargetEnc); + } + + /** + * Class HeaderEntry represents a single header field + * + */ + public static class HeaderEntry { + + String iHeader; + + int iHashcode; + + /** + * Ctor. + * + * @param pName + * The name of the header field + */ + public HeaderEntry(String pName) { + this.iHeader = pName; + this.iHashcode = pName.toUpperCase().hashCode(); + } + + @Override + public boolean equals(Object obj) { + if (obj == null || !(obj instanceof HeaderEntry)) return false; + return this.iHeader.equalsIgnoreCase(((HeaderEntry) obj).iHeader); + } + + @Override + public String toString() { + return this.iHeader; + } + + @Override + public int hashCode() { + return this.iHashcode; + } + } + + /** + * Class GetProperty implements privileged access to system properties + * + */ + private static class GetProperty implements PrivilegedAction { + + String iPropertyName; + + GetProperty(String propertyName) { + this.iPropertyName = propertyName; + } + + public Object run() { + return System.getProperty(this.iPropertyName); + } + } + + /** + * Throws a TrailerException if it contains recognized CIM errors in http + * trailer entries. + * + * @throws TrailerException + */ + public void examineTrailer() throws TrailerException { + examineTrailer(null); + } + + /** + * Throws a TrailerException if it contains recognized CIM errors in http + * trailer entries. + * + * @param pOrigin + * The origin of the trailer (response, request, etc.) + * @throws TrailerException + */ + public void examineTrailer(String pOrigin) throws TrailerException { + Iterator> itr = this.iterator(); + int code = 0, i = 0; + String desc = null; + StringBuilder hdrs = null; + if (LogAndTraceBroker.getBroker().isLoggableTrace(Level.FINER)) hdrs = new StringBuilder(); + while (itr.hasNext()) { + Entry ent = itr.next(); + String keyStr = ent.getKey().toString(); + if (hdrs != null) { + if (i++ > 0) hdrs.append(','); + hdrs.append(keyStr); + hdrs.append(": "); + hdrs.append(this.getField(keyStr)); + } + try { + if (keyStr.equalsIgnoreCase(WBEMConstants.HTTP_TRAILER_STATUS_CODE)) { + String valStr = URLDecoder.decode(this.getField(keyStr), WBEMConstants.UTF8); + try { + code = Integer.parseInt(valStr); + } catch (NumberFormatException e) { + String msg = new String(WBEMConstants.HTTP_TRAILER_STATUS_CODE + " \"" + + valStr + "\" invalid, setting to CIM_ERR_FAILED"); + LogAndTraceBroker.getBroker().trace(Level.FINER, msg, e); + code = WBEMException.CIM_ERR_FAILED; + if (desc == null) desc = msg; + } + } else if (keyStr.equalsIgnoreCase(WBEMConstants.HTTP_TRAILER_STATUS_DESCRIPTION)) { + desc = URLDecoder.decode(this.getField(keyStr), WBEMConstants.UTF8); + } + } catch (UnsupportedEncodingException e) { + // if UTF-8 isn't supported we're in real trouble + throw new Error(e); + } + } + if (hdrs != null && hdrs.length() > 0) LogAndTraceBroker.getBroker().trace( + Level.FINER, + (pOrigin == null ? "Unknown" : pOrigin) + " HTTP Trailer Headers= " + + hdrs.toString()); + if (code > 0) { + if (desc != null) { throw new TrailerException(new WBEMException(code, desc)); } + throw new TrailerException(new WBEMException(code)); + } + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/HttpHeaderParser.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpHeaderParser.java similarity index 86% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/HttpHeaderParser.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpHeaderParser.java index f4a7ffc..05cbdae 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/HttpHeaderParser.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpHeaderParser.java @@ -1,245 +1,243 @@ -/* - (C) Copyright IBM Corp. 2005, 2010 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1535756 2006-08-07 lupusalex Make code warning free - * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2750520 2009-04-10 blaschke-oss Code cleanup from empty statement et al - * 3001353 2010-05-18 blaschke-oss HttpHeaderParser ignores return value of toLowerCase() - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.http; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.Vector; - -/** - * Class HttpHeaderParser parses http headers - * - */ -public class HttpHeaderParser { - - String iRaw; - - Vector iNameValuePair; - - /** - * Ctor. - * - * @param pHeader - * The header block - */ - public HttpHeaderParser(String pHeader) { - this.iRaw = pHeader; - this.iNameValuePair = new Vector(); - if (this.iRaw != null) { - this.iRaw = this.iRaw.trim(); - char charArray[] = this.iRaw.toCharArray(); - int startPosValue = 0; - int currentPos = 0; - boolean isName = true; - boolean withinQuote = false; - int len = charArray.length; - String nvp[] = new String[2]; - do { - char c = charArray[currentPos]; - if (c == '=') { - nvp[0] = (new String(charArray, startPosValue, currentPos - startPosValue)) - .toLowerCase(); - isName = false; - startPosValue = ++currentPos; - } else if (c == '"') { - if (withinQuote) { - nvp[1] = new String(charArray, startPosValue, currentPos - startPosValue); - this.iNameValuePair.add(nvp); - nvp = new String[2]; - withinQuote = false; - while (++currentPos < len - && (charArray[currentPos] == ' ' || charArray[currentPos] == ',' || charArray[currentPos] == ';')) { - // ignore spaces and preceding comma - } - isName = true; - startPosValue = currentPos; - } else { - withinQuote = true; - startPosValue = ++currentPos; - } - } else if (c == ' ' || c == ',' || c == ';') { - if (withinQuote) { - currentPos++; - } else { - if (isName) { - nvp[0] = (new String(charArray, startPosValue, currentPos - - startPosValue)).toLowerCase(); - this.iNameValuePair.add(nvp); - nvp = new String[2]; - } else { - nvp[1] = new String(charArray, startPosValue, currentPos - - startPosValue); - this.iNameValuePair.add(nvp); - nvp = new String[2]; - } - - while (++currentPos < len - && (charArray[currentPos] == ' ' || charArray[currentPos] == ',' || charArray[currentPos] == ';')) { - // ignore spaces and preceding comma - } - isName = true; - startPosValue = currentPos; - } - } else { - currentPos++; - } - } while (currentPos < len); - - if (--currentPos > startPosValue) { - if (!isName) { - if (charArray[currentPos] == '"') { - nvp[1] = new String(charArray, startPosValue, currentPos - startPosValue); - this.iNameValuePair.add(nvp); - nvp = new String[2]; - } else { - nvp[1] = new String(charArray, startPosValue, - (currentPos - startPosValue) + 1); - this.iNameValuePair.add(nvp); - nvp = new String[2]; - } - } else { - nvp[0] = (new String(charArray, startPosValue, (currentPos - startPosValue) + 1)) - .toLowerCase(); - } - this.iNameValuePair.add(nvp); - } else if (currentPos == startPosValue) { - if (!isName) { - if (charArray[currentPos] == '"') { - nvp[1] = String.valueOf(charArray[currentPos - 1]); - this.iNameValuePair.add(nvp); - nvp = new String[2]; - } else { - nvp[1] = String.valueOf(charArray[currentPos]); - this.iNameValuePair.add(nvp); - nvp = new String[2]; - } - } else { - nvp[0] = String.valueOf(charArray[currentPos]).toLowerCase(); - } - this.iNameValuePair.add(nvp); - } - } - } - - /** - * Returns the header field at a given index - * - * @param pIndex - * The index - * @return The field name - */ - public String getField(int pIndex) { - if (pIndex < 0 || pIndex > this.iNameValuePair.size()) return null; - return this.iNameValuePair.elementAt(pIndex)[0]; - } - - /** - * Returns the value of a header field at a given index - * - * @param pIndex - * @return The value - */ - public String getValue(int pIndex) { - if (pIndex < 0 || pIndex > this.iNameValuePair.size()) return null; - return this.iNameValuePair.elementAt(pIndex)[1]; - } - - /** - * Returns the value of a header field for a given name - * - * @param pName - * The name - * @return The value - */ - public String getValue(String pName) { - return getValue(pName, null); - } - - /** - * Returns the value of a header field for a given name specifying a - * default. - * - * @param pName - * The name of the header field - * @param pDefault - * The value returned if no field of the given name exists - * @return The value - */ - public String getValue(String pName, String pDefault) { - if (pName == null) return pDefault; - pName = pName.toLowerCase(); - for (int i = 0; i < this.iNameValuePair.size(); i++) { - if (this.iNameValuePair.elementAt(i)[0] == null) return pDefault; - if (pName.equals(this.iNameValuePair.elementAt(i)[0])) return this.iNameValuePair - .elementAt(i)[1]; - } - return pDefault; - } - - /** - * Returns the value of a numeric header field for a given name specifying a - * default. - * - * @param pName - * The name of the header field - * @param pDefault - * The value returned if no field of the given name exists - * @return The value - */ - public int getIntValue(String pName, int pDefault) { - try { - return Integer.parseInt(getValue(pName, String.valueOf(pDefault))); - } catch (Exception e) { - return pDefault; - } - } - - @Override - public String toString() { - return "raw:" + this.iRaw; - } -} +/* + (C) Copyright IBM Corp. 2005, 2010 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1535756 2006-08-07 lupusalex Make code warning free + * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2750520 2009-04-10 blaschke-oss Code cleanup from empty statement et al + * 3001353 2010-05-18 blaschke-oss HttpHeaderParser ignores return value of toLowerCase() + */ + +package org.metricshub.wbem.sblim.cimclient.internal.http; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.Vector; + +/** + * Class HttpHeaderParser parses http headers + * + */ +public class HttpHeaderParser { + + String iRaw; + + Vector iNameValuePair; + + /** + * Ctor. + * + * @param pHeader + * The header block + */ + public HttpHeaderParser(String pHeader) { + this.iRaw = pHeader; + this.iNameValuePair = new Vector(); + if (this.iRaw != null) { + this.iRaw = this.iRaw.trim(); + char charArray[] = this.iRaw.toCharArray(); + int startPosValue = 0; + int currentPos = 0; + boolean isName = true; + boolean withinQuote = false; + int len = charArray.length; + String nvp[] = new String[2]; + do { + char c = charArray[currentPos]; + if (c == '=') { + nvp[0] = (new String(charArray, startPosValue, currentPos - startPosValue)) + .toLowerCase(); + isName = false; + startPosValue = ++currentPos; + } else if (c == '"') { + if (withinQuote) { + nvp[1] = new String(charArray, startPosValue, currentPos - startPosValue); + this.iNameValuePair.add(nvp); + nvp = new String[2]; + withinQuote = false; + while (++currentPos < len + && (charArray[currentPos] == ' ' || charArray[currentPos] == ',' || charArray[currentPos] == ';')) { + // ignore spaces and preceding comma + } + isName = true; + startPosValue = currentPos; + } else { + withinQuote = true; + startPosValue = ++currentPos; + } + } else if (c == ' ' || c == ',' || c == ';') { + if (withinQuote) { + currentPos++; + } else { + if (isName) { + nvp[0] = (new String(charArray, startPosValue, currentPos + - startPosValue)).toLowerCase(); + this.iNameValuePair.add(nvp); + nvp = new String[2]; + } else { + nvp[1] = new String(charArray, startPosValue, currentPos + - startPosValue); + this.iNameValuePair.add(nvp); + nvp = new String[2]; + } + + while (++currentPos < len + && (charArray[currentPos] == ' ' || charArray[currentPos] == ',' || charArray[currentPos] == ';')) { + // ignore spaces and preceding comma + } + isName = true; + startPosValue = currentPos; + } + } else { + currentPos++; + } + } while (currentPos < len); + + if (--currentPos > startPosValue) { + if (!isName) { + if (charArray[currentPos] == '"') { + nvp[1] = new String(charArray, startPosValue, currentPos - startPosValue); + this.iNameValuePair.add(nvp); + nvp = new String[2]; + } else { + nvp[1] = new String(charArray, startPosValue, + (currentPos - startPosValue) + 1); + this.iNameValuePair.add(nvp); + nvp = new String[2]; + } + } else { + nvp[0] = (new String(charArray, startPosValue, (currentPos - startPosValue) + 1)) + .toLowerCase(); + } + this.iNameValuePair.add(nvp); + } else if (currentPos == startPosValue) { + if (!isName) { + if (charArray[currentPos] == '"') { + nvp[1] = String.valueOf(charArray[currentPos - 1]); + this.iNameValuePair.add(nvp); + nvp = new String[2]; + } else { + nvp[1] = String.valueOf(charArray[currentPos]); + this.iNameValuePair.add(nvp); + nvp = new String[2]; + } + } else { + nvp[0] = String.valueOf(charArray[currentPos]).toLowerCase(); + } + this.iNameValuePair.add(nvp); + } + } + } + + /** + * Returns the header field at a given index + * + * @param pIndex + * The index + * @return The field name + */ + public String getField(int pIndex) { + if (pIndex < 0 || pIndex > this.iNameValuePair.size()) return null; + return this.iNameValuePair.elementAt(pIndex)[0]; + } + + /** + * Returns the value of a header field at a given index + * + * @param pIndex + * @return The value + */ + public String getValue(int pIndex) { + if (pIndex < 0 || pIndex > this.iNameValuePair.size()) return null; + return this.iNameValuePair.elementAt(pIndex)[1]; + } + + /** + * Returns the value of a header field for a given name + * + * @param pName + * The name + * @return The value + */ + public String getValue(String pName) { + return getValue(pName, null); + } + + /** + * Returns the value of a header field for a given name specifying a + * default. + * + * @param pName + * The name of the header field + * @param pDefault + * The value returned if no field of the given name exists + * @return The value + */ + public String getValue(String pName, String pDefault) { + if (pName == null) return pDefault; + pName = pName.toLowerCase(); + for (int i = 0; i < this.iNameValuePair.size(); i++) { + if (this.iNameValuePair.elementAt(i)[0] == null) return pDefault; + if (pName.equals(this.iNameValuePair.elementAt(i)[0])) return this.iNameValuePair + .elementAt(i)[1]; + } + return pDefault; + } + + /** + * Returns the value of a numeric header field for a given name specifying a + * default. + * + * @param pName + * The name of the header field + * @param pDefault + * The value returned if no field of the given name exists + * @return The value + */ + public int getIntValue(String pName, int pDefault) { + try { + return Integer.parseInt(getValue(pName, String.valueOf(pDefault))); + } catch (Exception e) { + return pDefault; + } + } + + @Override + public String toString() { + return "raw:" + this.iRaw; + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/HttpMethod.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpMethod.java similarity index 77% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/HttpMethod.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpMethod.java index 22cd891..f5e63b4 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/HttpMethod.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpMethod.java @@ -1,120 +1,118 @@ -/* - (C) Copyright IBM Corp. 2005, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 12917 2004-11-11 thschaef HTTP Header parsing does not work for UNIX line delimitor - * 1535756 2006-08-07 lupusalex Make code warning free - * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2750520 2009-04-10 blaschke-oss Code cleanup from empty statement et al - * 3557283 2012-11-05 blaschke-oss Print full response when get EOF from CIMOM - * 2709 2013-11-13 blaschke-oss Lower the level of the EOF message to FINE - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.http; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.IOException; -import java.io.InputStream; -import java.util.logging.Level; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; - -/** - * Class HttpMethod provides a method to read a line from a given input stream - * - */ -public abstract class HttpMethod { - - /** - * Reads a line from a given input stream - * - * @param pStream - * The input stream - * @return The line - * @throws IOException - */ - public static String readLine(InputStream pStream) throws IOException { - - if (pStream == null) return null; - - char buffer[] = new char[16]; - int used = 0; - int prevChar; - boolean flag = true; - - for (; (prevChar = pStream.read()) >= 0; buffer[used++] = (char) prevChar) { - - flag = false; - - // @12917 - thschaef - // see http://www.w3.org/Protocols/HTTP/AsImplemented.html for - // details - // Lines shall be delimited by an optional carriage return followed - // by a mandatory line feed character. - // The client should not assume that the carriage return will be - // present. Lines may be of any length. - // Well-behaved servers should restrict line length to 80 characters - // excluding the CR LF pair. - - // if (prevChar == 13) continue; - if (prevChar == 10) break; - - if (used >= buffer.length) { - char tmp[] = new char[buffer.length << 1]; - System.arraycopy(buffer, 0, tmp, 0, used); - buffer = tmp; - } - } - if (flag) { - LogAndTraceBroker - .getBroker() - .trace( - Level.FINE, - "Unexpected EOF trying to read line from input stream - CIMOM closed its end of socket, check it for connection issues"); - throw new IOException("Unexpected EOF"); - } - - for (; used > 0 && buffer[used - 1] <= ' '; used--) { - // back up over blanks and non-printables at end of line - } - - return String.copyValueOf(buffer, 0, used); - } -} +/* + (C) Copyright IBM Corp. 2005, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 12917 2004-11-11 thschaef HTTP Header parsing does not work for UNIX line delimitor + * 1535756 2006-08-07 lupusalex Make code warning free + * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2750520 2009-04-10 blaschke-oss Code cleanup from empty statement et al + * 3557283 2012-11-05 blaschke-oss Print full response when get EOF from CIMOM + * 2709 2013-11-13 blaschke-oss Lower the level of the EOF message to FINE + */ + +package org.metricshub.wbem.sblim.cimclient.internal.http; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.IOException; +import java.io.InputStream; +import java.util.logging.Level; + +import org.metricshub.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; + +/** + * Class HttpMethod provides a method to read a line from a given input stream + * + */ +public abstract class HttpMethod { + + /** + * Reads a line from a given input stream + * + * @param pStream + * The input stream + * @return The line + * @throws IOException + */ + public static String readLine(InputStream pStream) throws IOException { + + if (pStream == null) return null; + + char buffer[] = new char[16]; + int used = 0; + int prevChar; + boolean flag = true; + + for (; (prevChar = pStream.read()) >= 0; buffer[used++] = (char) prevChar) { + + flag = false; + + // @12917 - thschaef + // see http://www.w3.org/Protocols/HTTP/AsImplemented.html for + // details + // Lines shall be delimited by an optional carriage return followed + // by a mandatory line feed character. + // The client should not assume that the carriage return will be + // present. Lines may be of any length. + // Well-behaved servers should restrict line length to 80 characters + // excluding the CR LF pair. + + // if (prevChar == 13) continue; + if (prevChar == 10) break; + + if (used >= buffer.length) { + char tmp[] = new char[buffer.length << 1]; + System.arraycopy(buffer, 0, tmp, 0, used); + buffer = tmp; + } + } + if (flag) { + LogAndTraceBroker + .getBroker() + .trace( + Level.FINE, + "Unexpected EOF trying to read line from input stream - CIMOM closed its end of socket, check it for connection issues"); + throw new IOException("Unexpected EOF"); + } + + for (; used > 0 && buffer[used - 1] <= ' '; used--) { + // back up over blanks and non-printables at end of line + } + + return String.copyValueOf(buffer, 0, used); + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/HttpParseException.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpParseException.java similarity index 66% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/HttpParseException.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpParseException.java index fa0e013..9735f00 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/HttpParseException.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpParseException.java @@ -1,72 +1,70 @@ -/* - (C) Copyright IBM Corp. 2005, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1535756 2006-08-07 lupusalex Make code warning free - * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.http; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -/** - * Class HttpParseException represents problems parsing http challenges - * - */ -public class HttpParseException extends HttpException { - - private static final long serialVersionUID = -6546559439537187479L; - - /** - * Ctor. - */ - public HttpParseException() { - super(); - } - - /** - * Ctor. - * - * @param pReason - * The reason - */ - public HttpParseException(String pReason) { - super(pReason); - } -} +/* + (C) Copyright IBM Corp. 2005, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1535756 2006-08-07 lupusalex Make code warning free + * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.http; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +/** + * Class HttpParseException represents problems parsing http challenges + * + */ +public class HttpParseException extends HttpException { + + private static final long serialVersionUID = -6546559439537187479L; + + /** + * Ctor. + */ + public HttpParseException() { + super(); + } + + /** + * Ctor. + * + * @param pReason + * The reason + */ + public HttpParseException(String pReason) { + super(pReason); + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/HttpServerConnection.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpServerConnection.java similarity index 89% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/HttpServerConnection.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpServerConnection.java index deb2604..f60ff10 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/HttpServerConnection.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpServerConnection.java @@ -1,444 +1,442 @@ -/* - (C) Copyright IBM Corp. 2005, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1422316 2005-05-08 lupusalex Disable delayed acknowledgment - * 1483270 2006-05-15 lupusalex Using Several Cim Clients cause an indication problem - * 1498130 2006-05-31 lupusalex Selection of xml parser on a per connection basis - * 1535756 2006-08-07 lupusalex Make code warning free - * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant - * 1649779 2007-02-01 lupusalex Indication listener threads freeze - * 1660743 2007-02-15 lupusalex SSLContext is static - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings - * 2210455 2008-10-30 blaschke-oss Enhance javadoc, fix potential null pointers - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 3027392 2010-07-09 blaschke-oss Nullcheck of value previously dereferenced - * 3206904 2011-03-11 lupusalex Indication listener deadlock causes JVM to run out sockets - * 3536399 2012-08-25 hellerda Add client/listener peer authentication properties - * 2618 2013-02-27 blaschke-oss Need to add property to disable weak cipher suites for the secure indication - * 2642 2013-05-21 blaschke-oss Seperate properties needed for cim client and listener to filter out ciphers - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.http; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.IOException; -import java.net.InetAddress; -import java.net.ServerSocket; -import java.net.Socket; -import java.net.SocketException; -import java.net.UnknownHostException; -import java.util.concurrent.ArrayBlockingQueue; -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.TimeUnit; -import java.util.logging.Level; - -import javax.net.ssl.SSLContext; -import javax.net.ssl.SSLServerSocket; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; -import org.sentrysoftware.wbem.sblim.cimclient.internal.util.ThreadPool; -import org.sentrysoftware.wbem.sblim.cimclient.internal.util.Util; -import org.sentrysoftware.wbem.sblim.cimclient.internal.util.WBEMConfiguration; - -/** - * Class HttpServerConnection implements the outer shell of a HTTP server. It - * accepts incoming connections and puts them in a queue to be serviced by an - * independent thread - * - */ -public class HttpServerConnection implements Runnable { - - private int iPort; - - private ServerSocket iServerSocket; - - private HttpConnectionHandler iHandler; - - private HttpConnectionDispatcher iDispatcher; - - private volatile boolean iClose = true; - - private String iServerName; - - private boolean iSsl; - - private Thread iRunner; - - private WBEMConfiguration iSessionProperties; - - private final int iTimeout; - - /** - * Ctor. - * - * @param pHandler - * The connection handler - * @param pLocalAddress - * The local address to bind the port to. If null the port is - * bound to all local addresses. For use on multi-homed systems - * @param pPort - * The local port. If zero any free port will be chosen. - * @param pSsl - * SSL secured connection ? - * @param pProperties - * The configuration context - * @throws IOException - */ - public HttpServerConnection(HttpConnectionHandler pHandler, String pLocalAddress, int pPort, - boolean pSsl, WBEMConfiguration pProperties) throws IOException { - - final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); - logger.entry(); - - this.iPort = pPort; - this.iHandler = pHandler; - this.iSsl = pSsl; - this.iServerName = pSsl ? "HTTPS Server" : "HTTP Server"; - this.iSessionProperties = (pProperties != null) ? pProperties : WBEMConfiguration - .getGlobalConfiguration(); - SSLContext sslContext = pSsl ? HttpSocketFactory.getInstance().getServerSSLContext( - this.iSessionProperties) : null; - this.iServerSocket = (pLocalAddress != null && pLocalAddress.length() > 0) ? HttpSocketFactory - .getInstance().getServerSocketFactory(sslContext).createServerSocket(pPort, 50, - InetAddress.getByName(pLocalAddress)) - : HttpSocketFactory.getInstance().getServerSocketFactory(sslContext) - .createServerSocket(pPort); - if (this.iServerSocket instanceof SSLServerSocket) { - if (this.iSessionProperties.getSslListenerPeerVerification().equalsIgnoreCase("ignore")) { - logger.trace(Level.FINER, "Listener peer verification: ignore"); - ((SSLServerSocket) this.iServerSocket).setNeedClientAuth(false); - } else if (this.iSessionProperties.getSslListenerPeerVerification().equalsIgnoreCase( - "accept")) { - logger.trace(Level.FINER, "Listener peer verification: accept"); - ((SSLServerSocket) this.iServerSocket).setWantClientAuth(true); - } else { - logger.trace(Level.FINER, "Listener peer verification: require"); - ((SSLServerSocket) this.iServerSocket).setNeedClientAuth(true); - } - - String disableCipherSuites = this.iSessionProperties - .getSslListenerCipherSuitesToDisable(); - if (disableCipherSuites != null) { - SSLServerSocket sslSock = (SSLServerSocket) this.iServerSocket; - String[] currentCipherSuites = sslSock.getEnabledCipherSuites(); - String[] updatedCipherSuites = Util.getFilteredStringArray(currentCipherSuites, - disableCipherSuites); - sslSock.setEnabledCipherSuites(updatedCipherSuites); - int before = currentCipherSuites.length; - int after = updatedCipherSuites.length; - if (before > 0 && after == 0) logger.trace(Level.WARNING, - "All cipher suites disabled for listener!"); - else if (before > after) logger.trace(Level.FINE, "Some (" + (before - after) - + ") cipher suites disabled for listener"); - else if (before == after) logger.trace(Level.FINER, - "No cipher suites disabled for listener"); - } - } - this.iTimeout = this.iSessionProperties.getListenerHttpTimeout(); - logger.exit(); - } - - /** - * Set the name of the thread - * - * @param pName - * The new value - */ - public void setName(String pName) { - if (this.iRunner != null) this.iRunner.setName(pName); - } - - /** - * Returns the port - * - * @return The port - */ - public int getPort() { - return this.iServerSocket.getLocalPort(); - } - - /** - * Returns the local ip address the socket is bound to - * - * @return The ip address - * @throws UnknownHostException - */ - public String getLocalIp() throws UnknownHostException { - String ip = this.iServerSocket.getInetAddress().getHostAddress(); - String localhost = InetAddress.getLocalHost().getHostAddress(); - return "0.0.0.0".equals(ip) ? localhost : ip; - } - - /** - * Returns the local hostname the socket is bound to - * - * @return The host name - * @throws UnknownHostException - */ - public String getLocalHostName() throws UnknownHostException { - String ip = this.iServerSocket.getInetAddress().getHostName(); - String localhost = InetAddress.getLocalHost().getHostName(); - return "0.0.0.0".equals(ip) ? localhost : ip; - } - - /** - * Return whether this connection is SSL secured - * - * @return true if SSL is enabled, false otherwise - */ - public boolean isSSL() { - return this.iSsl; - } - - /** - * Starts a thread that waits for incoming connections - */ - public void start() { - if (this.iClose) { - this.iClose = false; - ThreadGroup group = new ThreadGroup("CIMListener on port " + String.valueOf(this.iPort)); - this.iDispatcher = new HttpConnectionDispatcher(group, this.iHandler, new ThreadPool( - this.iSessionProperties.getListenerMinPoolSize(), this.iSessionProperties - .getListenerMaxPoolSize(), - this.iSessionProperties.getListenerBacklog(), this.iSessionProperties - .getListenerMaxIdle(), group, "Handler "), this.iSessionProperties - .getListenerMaxQueueSize()); - this.iDispatcher.start(); - this.iRunner = new Thread(group, this, this.iServerName); - this.iRunner.setDaemon(true); - - this.iRunner.start(); - } - } - - public void run() { - while (!this.iClose) { - try { - Socket socket = this.iServerSocket.accept(); - try { - socket.setTcpNoDelay(true); - socket.setSoTimeout(this.iTimeout); - } catch (IOException e) { - LogAndTraceBroker.getBroker().trace(Level.FINE, - "Exception while adjusting socket options", e); - } - boolean dispatched = this.iDispatcher.dispatch(socket); - if (!dispatched) { - MessageWriter writer = new MessageWriter(socket.getOutputStream(), false, false); - try { - writer.setMethod(new HttpServerMethod(1, 1, 503, - "Service temporarily overloaded")); - writer.getHeader().addField("Retry-After", "10"); - writer.close(); - } catch (IOException e) { - LogAndTraceBroker.getBroker().trace(Level.FINE, - "Exception while sending HTTP 503", e); - } finally { - socket.close(); - } - LogAndTraceBroker - .getBroker() - .trace(Level.FINE, - "HttpServerConnection failed to dispatch incoming connection, sent 503"); - } else { - LogAndTraceBroker.getBroker().trace(Level.FINE, - "HttpServerConnection dispatched incoming connection"); - } - } catch (Throwable t) { - if (t instanceof SocketException && this.iClose) { - break; - } - try { - LogAndTraceBroker.getBroker().trace(Level.FINE, - "Exception while waiting for incoming http connections"); - } catch (Throwable t2) { - // just give up - } - } - } - - // shutdown - - try { - LogAndTraceBroker.getBroker().trace(Level.FINE, - "Shutting down CIMListener on port " + this.iPort); - } catch (Throwable t) { - // do nothing - } - try { - // give the handlers a chance to process all already accepted - // connections before complete shutdown - Thread.sleep(5000); - } catch (InterruptedException e) { - // just ignore - } - try { - this.iDispatcher.close(); - } catch (Exception e) { - LogAndTraceBroker.getBroker().trace(Level.FINE, - "Exception while closing http connection dispatcher", e); - } - this.iDispatcher = null; - this.iRunner = null; - } - - /** - * Closes the socket and shuts down the listening threads - */ - public void close() { - if (!this.iClose) { - this.iClose = true; - try { - this.iServerSocket.close(); - this.iServerSocket = null; - } catch (Exception e) { - LogAndTraceBroker.getBroker().trace(Level.FINE, - "Exception while closing server socket", e); - } - } - } - - /** - * Class HttpConnectionDispatcher is responsible for dispatching the - * incoming connections to the handlers. It doesn't execute the handler - * directly but creates a runnable that is submitted to a thread pool which - * takes care of execution. - * - */ - private static class HttpConnectionDispatcher extends Thread { - - private BlockingQueue iConnectionPool; - - private volatile boolean iAlive = true; - - private HttpConnectionHandler iHandler; - - private ThreadPool iThreadPool; - - /** - * Ctor. - * - * @param pGroup - * The thread group to use for this thread and it's children - * @param pHandler - * The connection handler - * @param pPool - * The thread pool - * @param pQueueSize - * The fixed capacity for the queue of pending connections - */ - public HttpConnectionDispatcher(ThreadGroup pGroup, HttpConnectionHandler pHandler, - ThreadPool pPool, int pQueueSize) { - super(pGroup, "Connection Dispatcher"); - setDaemon(true); - this.iConnectionPool = new ArrayBlockingQueue(pQueueSize > 0 ? pQueueSize : 1); - this.iHandler = pHandler; - this.iThreadPool = pPool; - } - - /** - * Dispatches a connection - * - * @param pSocket - * The socket of the connection - * @return true if dispatch was successful - */ - public boolean dispatch(Socket pSocket) { - try { - return this.iConnectionPool.offer(pSocket, 20, TimeUnit.MILLISECONDS); - } catch (InterruptedException e) { - /* */ - } - return false; - } - - /** - * Gets the next pending connection - * - * @return The socket of the connection - */ - public Socket getConnection() { - try { - return this.iConnectionPool.poll(100, TimeUnit.MILLISECONDS); - } catch (InterruptedException e) { - // just ignore it, it is expected - } - return null; - } - - @Override - public void run() { - while (this.iAlive) { - try { - Socket socket = getConnection(); - if (socket != null) { - this.iThreadPool.execute(new HttpServerWorker(this.iHandler, socket)); - } - } catch (Throwable t) { - try { - LogAndTraceBroker.getBroker().trace(Level.FINE, - "Exception while submitting worker to thread pool", t); - } catch (Throwable t1) { - // forget it - } - } - } - try { - this.iHandler.close(); - } catch (Exception e) { - LogAndTraceBroker.getBroker().trace(Level.FINE, - "Exception while closing http connection handler", e); - } - try { - this.iThreadPool.shutdown(); - } catch (Exception e) { - LogAndTraceBroker.getBroker().trace(Level.FINE, - "Exception during shut down of thread pool", e); - } - } - - /** - * Closes the dispatcher - */ - public void close() { - this.iAlive = false; - } - } -} +/* + (C) Copyright IBM Corp. 2005, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1422316 2005-05-08 lupusalex Disable delayed acknowledgment + * 1483270 2006-05-15 lupusalex Using Several Cim Clients cause an indication problem + * 1498130 2006-05-31 lupusalex Selection of xml parser on a per connection basis + * 1535756 2006-08-07 lupusalex Make code warning free + * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant + * 1649779 2007-02-01 lupusalex Indication listener threads freeze + * 1660743 2007-02-15 lupusalex SSLContext is static + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings + * 2210455 2008-10-30 blaschke-oss Enhance javadoc, fix potential null pointers + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 3027392 2010-07-09 blaschke-oss Nullcheck of value previously dereferenced + * 3206904 2011-03-11 lupusalex Indication listener deadlock causes JVM to run out sockets + * 3536399 2012-08-25 hellerda Add client/listener peer authentication properties + * 2618 2013-02-27 blaschke-oss Need to add property to disable weak cipher suites for the secure indication + * 2642 2013-05-21 blaschke-oss Seperate properties needed for cim client and listener to filter out ciphers + */ + +package org.metricshub.wbem.sblim.cimclient.internal.http; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.IOException; +import java.net.InetAddress; +import java.net.ServerSocket; +import java.net.Socket; +import java.net.SocketException; +import java.net.UnknownHostException; +import java.util.concurrent.ArrayBlockingQueue; +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.TimeUnit; +import java.util.logging.Level; + +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLServerSocket; + +import org.metricshub.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; +import org.metricshub.wbem.sblim.cimclient.internal.util.ThreadPool; +import org.metricshub.wbem.sblim.cimclient.internal.util.Util; +import org.metricshub.wbem.sblim.cimclient.internal.util.WBEMConfiguration; + +/** + * Class HttpServerConnection implements the outer shell of a HTTP server. It + * accepts incoming connections and puts them in a queue to be serviced by an + * independent thread + * + */ +public class HttpServerConnection implements Runnable { + + private int iPort; + + private ServerSocket iServerSocket; + + private HttpConnectionHandler iHandler; + + private HttpConnectionDispatcher iDispatcher; + + private volatile boolean iClose = true; + + private String iServerName; + + private boolean iSsl; + + private Thread iRunner; + + private WBEMConfiguration iSessionProperties; + + private final int iTimeout; + + /** + * Ctor. + * + * @param pHandler + * The connection handler + * @param pLocalAddress + * The local address to bind the port to. If null the port is + * bound to all local addresses. For use on multi-homed systems + * @param pPort + * The local port. If zero any free port will be chosen. + * @param pSsl + * SSL secured connection ? + * @param pProperties + * The configuration context + * @throws IOException + */ + public HttpServerConnection(HttpConnectionHandler pHandler, String pLocalAddress, int pPort, + boolean pSsl, WBEMConfiguration pProperties) throws IOException { + + final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); + logger.entry(); + + this.iPort = pPort; + this.iHandler = pHandler; + this.iSsl = pSsl; + this.iServerName = pSsl ? "HTTPS Server" : "HTTP Server"; + this.iSessionProperties = (pProperties != null) ? pProperties : WBEMConfiguration + .getGlobalConfiguration(); + SSLContext sslContext = pSsl ? HttpSocketFactory.getInstance().getServerSSLContext( + this.iSessionProperties) : null; + this.iServerSocket = (pLocalAddress != null && pLocalAddress.length() > 0) ? HttpSocketFactory + .getInstance().getServerSocketFactory(sslContext).createServerSocket(pPort, 50, + InetAddress.getByName(pLocalAddress)) + : HttpSocketFactory.getInstance().getServerSocketFactory(sslContext) + .createServerSocket(pPort); + if (this.iServerSocket instanceof SSLServerSocket) { + if (this.iSessionProperties.getSslListenerPeerVerification().equalsIgnoreCase("ignore")) { + logger.trace(Level.FINER, "Listener peer verification: ignore"); + ((SSLServerSocket) this.iServerSocket).setNeedClientAuth(false); + } else if (this.iSessionProperties.getSslListenerPeerVerification().equalsIgnoreCase( + "accept")) { + logger.trace(Level.FINER, "Listener peer verification: accept"); + ((SSLServerSocket) this.iServerSocket).setWantClientAuth(true); + } else { + logger.trace(Level.FINER, "Listener peer verification: require"); + ((SSLServerSocket) this.iServerSocket).setNeedClientAuth(true); + } + + String disableCipherSuites = this.iSessionProperties + .getSslListenerCipherSuitesToDisable(); + if (disableCipherSuites != null) { + SSLServerSocket sslSock = (SSLServerSocket) this.iServerSocket; + String[] currentCipherSuites = sslSock.getEnabledCipherSuites(); + String[] updatedCipherSuites = Util.getFilteredStringArray(currentCipherSuites, + disableCipherSuites); + sslSock.setEnabledCipherSuites(updatedCipherSuites); + int before = currentCipherSuites.length; + int after = updatedCipherSuites.length; + if (before > 0 && after == 0) logger.trace(Level.WARNING, + "All cipher suites disabled for listener!"); + else if (before > after) logger.trace(Level.FINE, "Some (" + (before - after) + + ") cipher suites disabled for listener"); + else if (before == after) logger.trace(Level.FINER, + "No cipher suites disabled for listener"); + } + } + this.iTimeout = this.iSessionProperties.getListenerHttpTimeout(); + logger.exit(); + } + + /** + * Set the name of the thread + * + * @param pName + * The new value + */ + public void setName(String pName) { + if (this.iRunner != null) this.iRunner.setName(pName); + } + + /** + * Returns the port + * + * @return The port + */ + public int getPort() { + return this.iServerSocket.getLocalPort(); + } + + /** + * Returns the local ip address the socket is bound to + * + * @return The ip address + * @throws UnknownHostException + */ + public String getLocalIp() throws UnknownHostException { + String ip = this.iServerSocket.getInetAddress().getHostAddress(); + String localhost = InetAddress.getLocalHost().getHostAddress(); + return "0.0.0.0".equals(ip) ? localhost : ip; + } + + /** + * Returns the local hostname the socket is bound to + * + * @return The host name + * @throws UnknownHostException + */ + public String getLocalHostName() throws UnknownHostException { + String ip = this.iServerSocket.getInetAddress().getHostName(); + String localhost = InetAddress.getLocalHost().getHostName(); + return "0.0.0.0".equals(ip) ? localhost : ip; + } + + /** + * Return whether this connection is SSL secured + * + * @return true if SSL is enabled, false otherwise + */ + public boolean isSSL() { + return this.iSsl; + } + + /** + * Starts a thread that waits for incoming connections + */ + public void start() { + if (this.iClose) { + this.iClose = false; + ThreadGroup group = new ThreadGroup("CIMListener on port " + String.valueOf(this.iPort)); + this.iDispatcher = new HttpConnectionDispatcher(group, this.iHandler, new ThreadPool( + this.iSessionProperties.getListenerMinPoolSize(), this.iSessionProperties + .getListenerMaxPoolSize(), + this.iSessionProperties.getListenerBacklog(), this.iSessionProperties + .getListenerMaxIdle(), group, "Handler "), this.iSessionProperties + .getListenerMaxQueueSize()); + this.iDispatcher.start(); + this.iRunner = new Thread(group, this, this.iServerName); + this.iRunner.setDaemon(true); + + this.iRunner.start(); + } + } + + public void run() { + while (!this.iClose) { + try { + Socket socket = this.iServerSocket.accept(); + try { + socket.setTcpNoDelay(true); + socket.setSoTimeout(this.iTimeout); + } catch (IOException e) { + LogAndTraceBroker.getBroker().trace(Level.FINE, + "Exception while adjusting socket options", e); + } + boolean dispatched = this.iDispatcher.dispatch(socket); + if (!dispatched) { + MessageWriter writer = new MessageWriter(socket.getOutputStream(), false, false); + try { + writer.setMethod(new HttpServerMethod(1, 1, 503, + "Service temporarily overloaded")); + writer.getHeader().addField("Retry-After", "10"); + writer.close(); + } catch (IOException e) { + LogAndTraceBroker.getBroker().trace(Level.FINE, + "Exception while sending HTTP 503", e); + } finally { + socket.close(); + } + LogAndTraceBroker + .getBroker() + .trace(Level.FINE, + "HttpServerConnection failed to dispatch incoming connection, sent 503"); + } else { + LogAndTraceBroker.getBroker().trace(Level.FINE, + "HttpServerConnection dispatched incoming connection"); + } + } catch (Throwable t) { + if (t instanceof SocketException && this.iClose) { + break; + } + try { + LogAndTraceBroker.getBroker().trace(Level.FINE, + "Exception while waiting for incoming http connections"); + } catch (Throwable t2) { + // just give up + } + } + } + + // shutdown + + try { + LogAndTraceBroker.getBroker().trace(Level.FINE, + "Shutting down CIMListener on port " + this.iPort); + } catch (Throwable t) { + // do nothing + } + try { + // give the handlers a chance to process all already accepted + // connections before complete shutdown + Thread.sleep(5000); + } catch (InterruptedException e) { + // just ignore + } + try { + this.iDispatcher.close(); + } catch (Exception e) { + LogAndTraceBroker.getBroker().trace(Level.FINE, + "Exception while closing http connection dispatcher", e); + } + this.iDispatcher = null; + this.iRunner = null; + } + + /** + * Closes the socket and shuts down the listening threads + */ + public void close() { + if (!this.iClose) { + this.iClose = true; + try { + this.iServerSocket.close(); + this.iServerSocket = null; + } catch (Exception e) { + LogAndTraceBroker.getBroker().trace(Level.FINE, + "Exception while closing server socket", e); + } + } + } + + /** + * Class HttpConnectionDispatcher is responsible for dispatching the + * incoming connections to the handlers. It doesn't execute the handler + * directly but creates a runnable that is submitted to a thread pool which + * takes care of execution. + * + */ + private static class HttpConnectionDispatcher extends Thread { + + private BlockingQueue iConnectionPool; + + private volatile boolean iAlive = true; + + private HttpConnectionHandler iHandler; + + private ThreadPool iThreadPool; + + /** + * Ctor. + * + * @param pGroup + * The thread group to use for this thread and it's children + * @param pHandler + * The connection handler + * @param pPool + * The thread pool + * @param pQueueSize + * The fixed capacity for the queue of pending connections + */ + public HttpConnectionDispatcher(ThreadGroup pGroup, HttpConnectionHandler pHandler, + ThreadPool pPool, int pQueueSize) { + super(pGroup, "Connection Dispatcher"); + setDaemon(true); + this.iConnectionPool = new ArrayBlockingQueue(pQueueSize > 0 ? pQueueSize : 1); + this.iHandler = pHandler; + this.iThreadPool = pPool; + } + + /** + * Dispatches a connection + * + * @param pSocket + * The socket of the connection + * @return true if dispatch was successful + */ + public boolean dispatch(Socket pSocket) { + try { + return this.iConnectionPool.offer(pSocket, 20, TimeUnit.MILLISECONDS); + } catch (InterruptedException e) { + /* */ + } + return false; + } + + /** + * Gets the next pending connection + * + * @return The socket of the connection + */ + public Socket getConnection() { + try { + return this.iConnectionPool.poll(100, TimeUnit.MILLISECONDS); + } catch (InterruptedException e) { + // just ignore it, it is expected + } + return null; + } + + @Override + public void run() { + while (this.iAlive) { + try { + Socket socket = getConnection(); + if (socket != null) { + this.iThreadPool.execute(new HttpServerWorker(this.iHandler, socket)); + } + } catch (Throwable t) { + try { + LogAndTraceBroker.getBroker().trace(Level.FINE, + "Exception while submitting worker to thread pool", t); + } catch (Throwable t1) { + // forget it + } + } + } + try { + this.iHandler.close(); + } catch (Exception e) { + LogAndTraceBroker.getBroker().trace(Level.FINE, + "Exception while closing http connection handler", e); + } + try { + this.iThreadPool.shutdown(); + } catch (Exception e) { + LogAndTraceBroker.getBroker().trace(Level.FINE, + "Exception during shut down of thread pool", e); + } + } + + /** + * Closes the dispatcher + */ + public void close() { + this.iAlive = false; + } + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/HttpServerMethod.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpServerMethod.java similarity index 79% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/HttpServerMethod.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpServerMethod.java index 412cf78..7ebf745 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/HttpServerMethod.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpServerMethod.java @@ -1,179 +1,177 @@ -/* - (C) Copyright IBM Corp. 2005, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1535756 2006-08-07 lupusalex Make code warning free - * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.http; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.IOException; -import java.io.InputStream; -import java.net.HttpURLConnection; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.http.io.ASCIIPrintStream; - -/** - * Class HttpServerMethod is responsible for - * - */ -public class HttpServerMethod extends HttpMethod { - - private String iMethodName; - - private String iFile; - - private String iProtocol; - - private int iMinor, iMajor; - - private int iStatus; - - private String iReason; - - /** - * Ctor. - * - * @param pMajor - * Major version - * @param pMinor - * Minor version - * @param pStatus - * Status - * @param pReason - * Reason - */ - public HttpServerMethod(int pMajor, int pMinor, int pStatus, String pReason) { - this.iMinor = pMinor; - this.iMajor = pMajor; - this.iStatus = pStatus; - this.iReason = pReason; - } - - /** - * Ctor. - * - * @param pReader - * Inputstream - * @throws IOException - * @throws HttpException - */ - public HttpServerMethod(InputStream pReader) throws IOException, HttpException { - String line; - - do { - line = HttpMethod.readLine(pReader); - } while (line == null || line.length() == 0); - int next = line.indexOf(' '); - int prev = 0; - if (next > -1) { - this.iMethodName = line.substring(0, next).toUpperCase(); - if (this.iMethodName.equals("GET") && (line.indexOf(' ', next + 1) == -1)) { // Simple - // request - this.iFile = line.substring(next + 1); - } else { // FullRequest - prev = next + 1; - next = line.indexOf(' ', prev); - this.iFile = line.substring(prev, next); - - prev = next + 1; - this.iProtocol = line.substring(prev).toUpperCase(); - - prev = this.iProtocol.indexOf('/'); - next = this.iProtocol.indexOf('.', prev + 1); - try { - this.iMajor = Integer.parseInt(this.iProtocol.substring(prev + 1, next)); - this.iMinor = Integer.parseInt(this.iProtocol.substring(next + 1)); - } catch (Exception e) { - throw new HttpException(HttpURLConnection.HTTP_BAD_METHOD, "Bad method"); - } - } - } else throw new HttpException(HttpURLConnection.HTTP_BAD_METHOD, "Bad method"); - } - - /** - * Returns the major version - * - * @return The major version - */ - public int getMajorVersion() { - return this.iMajor; - } - - /** - * Returns the minor version - * - * @return The minor version - */ - public int getMinorVersion() { - return this.iMinor; - } - - /** - * Returns the method name - * - * @return The method name - */ - public String getMethodName() { - return this.iMethodName; - } - - /** - * Returns the file - * - * @return The file - */ - public String getFile() { - return this.iFile; - } - - /** - * Write to a given output stream - * - * @param pStream - * the output stream - */ - public void write(ASCIIPrintStream pStream) { - pStream.print("HTTP/" + this.iMajor + "." + this.iMinor + " " + this.iStatus + " " - + this.iReason + "\r\n"); - } -} +/* + (C) Copyright IBM Corp. 2005, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1535756 2006-08-07 lupusalex Make code warning free + * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.http; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.IOException; +import java.io.InputStream; +import java.net.HttpURLConnection; + +import org.metricshub.wbem.sblim.cimclient.internal.http.io.ASCIIPrintStream; + +/** + * Class HttpServerMethod is responsible for + * + */ +public class HttpServerMethod extends HttpMethod { + + private String iMethodName; + + private String iFile; + + private String iProtocol; + + private int iMinor, iMajor; + + private int iStatus; + + private String iReason; + + /** + * Ctor. + * + * @param pMajor + * Major version + * @param pMinor + * Minor version + * @param pStatus + * Status + * @param pReason + * Reason + */ + public HttpServerMethod(int pMajor, int pMinor, int pStatus, String pReason) { + this.iMinor = pMinor; + this.iMajor = pMajor; + this.iStatus = pStatus; + this.iReason = pReason; + } + + /** + * Ctor. + * + * @param pReader + * Inputstream + * @throws IOException + * @throws HttpException + */ + public HttpServerMethod(InputStream pReader) throws IOException, HttpException { + String line; + + do { + line = HttpMethod.readLine(pReader); + } while (line == null || line.length() == 0); + int next = line.indexOf(' '); + int prev = 0; + if (next > -1) { + this.iMethodName = line.substring(0, next).toUpperCase(); + if (this.iMethodName.equals("GET") && (line.indexOf(' ', next + 1) == -1)) { // Simple + // request + this.iFile = line.substring(next + 1); + } else { // FullRequest + prev = next + 1; + next = line.indexOf(' ', prev); + this.iFile = line.substring(prev, next); + + prev = next + 1; + this.iProtocol = line.substring(prev).toUpperCase(); + + prev = this.iProtocol.indexOf('/'); + next = this.iProtocol.indexOf('.', prev + 1); + try { + this.iMajor = Integer.parseInt(this.iProtocol.substring(prev + 1, next)); + this.iMinor = Integer.parseInt(this.iProtocol.substring(next + 1)); + } catch (Exception e) { + throw new HttpException(HttpURLConnection.HTTP_BAD_METHOD, "Bad method"); + } + } + } else throw new HttpException(HttpURLConnection.HTTP_BAD_METHOD, "Bad method"); + } + + /** + * Returns the major version + * + * @return The major version + */ + public int getMajorVersion() { + return this.iMajor; + } + + /** + * Returns the minor version + * + * @return The minor version + */ + public int getMinorVersion() { + return this.iMinor; + } + + /** + * Returns the method name + * + * @return The method name + */ + public String getMethodName() { + return this.iMethodName; + } + + /** + * Returns the file + * + * @return The file + */ + public String getFile() { + return this.iFile; + } + + /** + * Write to a given output stream + * + * @param pStream + * the output stream + */ + public void write(ASCIIPrintStream pStream) { + pStream.print("HTTP/" + this.iMajor + "." + this.iMinor + " " + this.iStatus + " " + + this.iReason + "\r\n"); + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/HttpServerWorker.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpServerWorker.java similarity index 65% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/HttpServerWorker.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpServerWorker.java index 0223773..b9a73ce 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/HttpServerWorker.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpServerWorker.java @@ -1,84 +1,82 @@ -/* - (C) Copyright IBM Corp. 2005, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1498927 2006-06-01 lupusalex Fill gaps in logging coverage - * 1535756 2006-08-07 lupusalex Make code warning free - * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.http; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.net.Socket; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; -import org.sentrysoftware.wbem.sblim.cimclient.internal.logging.Messages; - -/** - * Class HttpServerWorker forwards incoming connections to a handler - * - */ -public class HttpServerWorker implements Runnable { - - HttpConnectionHandler iHandler; - - Socket iSocket; - - /** - * Ctor. - * - * @param pHandler - * The handler - * @param pSocket - * The socket - */ - public HttpServerWorker(HttpConnectionHandler pHandler, Socket pSocket) { - this.iHandler = pHandler; - this.iSocket = pSocket; - } - - public void run() { - try { - this.iHandler.handleConnection(this.iSocket); - } catch (Exception e) { - LogAndTraceBroker.getBroker().message(Messages.HTTP_HANDLE_CONNECTION_FAILED, e); - } - } -} +/* + (C) Copyright IBM Corp. 2005, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1498927 2006-06-01 lupusalex Fill gaps in logging coverage + * 1535756 2006-08-07 lupusalex Make code warning free + * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.http; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.net.Socket; + +import org.metricshub.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; +import org.metricshub.wbem.sblim.cimclient.internal.logging.Messages; + +/** + * Class HttpServerWorker forwards incoming connections to a handler + * + */ +public class HttpServerWorker implements Runnable { + + HttpConnectionHandler iHandler; + + Socket iSocket; + + /** + * Ctor. + * + * @param pHandler + * The handler + * @param pSocket + * The socket + */ + public HttpServerWorker(HttpConnectionHandler pHandler, Socket pSocket) { + this.iHandler = pHandler; + this.iSocket = pSocket; + } + + public void run() { + try { + this.iHandler.handleConnection(this.iSocket); + } catch (Exception e) { + LogAndTraceBroker.getBroker().message(Messages.HTTP_HANDLE_CONNECTION_FAILED, e); + } + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/HttpSocketFactory.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpSocketFactory.java similarity index 91% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/HttpSocketFactory.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpSocketFactory.java index ad545b3..1cda5a7 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/HttpSocketFactory.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpSocketFactory.java @@ -1,497 +1,495 @@ -/* - (C) Copyright IBM Corp. 2005, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1498130 2006-05-31 lupusalex Selection of xml parser on a per connection basis - * 1535756 2006-08-07 lupusalex Make code warning free - * 1558663 2006-09-14 lupusalex Support custom socket factories in client connections - * 1573723 2006-10-09 lupusalex Selection of JSSE provider via properties file not feasible - * 1573723 2006-10-30 lupusalex rework: Selection of JSSE provider via properties file not feasible - * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant - * 1660743 2007-02-15 lupusalex SSLContext is static - * 1711092 2006-05-02 lupusalex Some fixes/additions of log&trace messages - * 1815707 2007-10-18 ebak TLS support - * 1815707 2007-10-30 ebak rework: TLS support - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 3001345 2010-05-18 blaschke-oss File handle leaks in HttpSocketFactory and LogAndTraceBroker - * 3027618 2010-07-14 blaschke-oss Close files/readers in finally blocks - * 3111718 2010-11-18 blaschke-oss org.sblim.cimclient SSL Code is using the wrong SSL Property - * 3536399 2012-08-25 hellerda Add client/listener peer authentication properties - * 2647 2013-07-01 blaschke-oss Add two ssl protocol properties for http server and client - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.http; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.net.Socket; -import java.security.KeyStore; -import java.security.KeyStoreException; -import java.security.NoSuchAlgorithmException; -import java.security.Principal; -import java.security.PrivateKey; -import java.security.Provider; -import java.security.Security; -import java.security.UnrecoverableKeyException; -import java.security.cert.CertificateException; -import java.security.cert.X509Certificate; -import java.util.logging.Level; - -import javax.net.ServerSocketFactory; -import javax.net.SocketFactory; -import javax.net.ssl.KeyManager; -import javax.net.ssl.KeyManagerFactory; -import javax.net.ssl.SSLContext; -import javax.net.ssl.TrustManager; -import javax.net.ssl.TrustManagerFactory; -import javax.net.ssl.X509KeyManager; -import javax.net.ssl.X509TrustManager; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; -import org.sentrysoftware.wbem.sblim.cimclient.internal.logging.Messages; -import org.sentrysoftware.wbem.sblim.cimclient.internal.util.WBEMConfiguration; - -/** - * Class HttpSocketFactory manages socket factories - * - */ -public class HttpSocketFactory { - - private static HttpSocketFactory cInstance = new HttpSocketFactory(); - - private HttpSocketFactory() { - // empty - } - - /** - * Returns the singleton instance - * - * @return The instance - */ - public static HttpSocketFactory getInstance() { - return cInstance; - } - - /** - * Returns a server socket factory - * - * @param pContext - * The corresponding SSL context or null for - * insecure connections - * - * @return The factory - */ - public ServerSocketFactory getServerSocketFactory(SSLContext pContext) { - return pContext != null ? pContext.getServerSocketFactory() : ServerSocketFactory - .getDefault(); - } - - /** - * Returns a client socket factory - * - * @param pContext - * The SSL context or null for insecure connections - * @return The factory - */ - public SocketFactory getClientSocketFactory(SSLContext pContext) { - return pContext != null ? pContext.getSocketFactory() : SocketFactory.getDefault(); - } - - /** - * Returns a SSLContext for client sockets corresponding to a given set of - * configuration properties - * - * @param pProperties - * The configuration to apply - * @return The SSL context - */ - public SSLContext getClientSSLContext(final WBEMConfiguration pProperties) { - return getSSLContext(pProperties, false); - } - - /** - * Returns a SSLContext for server sockets corresponding to a given set of - * configuration properties - * - * @param pProperties - * The configuration to apply - * @return The SSL context - */ - public SSLContext getServerSSLContext(final WBEMConfiguration pProperties) { - return getSSLContext(pProperties, true); - } - - /** - * Returns a SSLContext corresponding to a given set of configuration - * properties - * - * @param pProperties - * The configuration to apply - * @param pIsServer - * true if a server socket context is requested, - * false otherwise - * @return The SSL context - */ - private SSLContext getSSLContext(final WBEMConfiguration pProperties, boolean pIsServer) { - - final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); - logger.entry(); - - final String provider = pIsServer ? pProperties.getSslServerSocketProvider() : pProperties - .getSslSocketProvider(); - logger.trace(Level.FINER, "Loading JSSE provider:" + provider); - - final Provider securityProvider; - - try { - Class providerClass = Class.forName(provider); - securityProvider = (java.security.Provider) providerClass.newInstance(); - if (Security.getProvider(securityProvider.getName()) == null) { - Security.addProvider(securityProvider); - } - } catch (Exception e) { - logger.trace(Level.FINER, "Exception while loading JSSE provider", e); - logger.message(Messages.SSL_JSSE_PROVIDER_LOAD_FAILED, provider); - logger.exit(); - throw new RuntimeException(e); - } - - try { - KeyManager[] keyManager = loadKeystore(pProperties, securityProvider, pIsServer); - - TrustManager[] trustManager = loadTruststore(pProperties, securityProvider, pIsServer); - - String sslProtocol = pIsServer ? pProperties.getSslListenerProtocol() : pProperties - .getSslClientProtocol(); - - SSLContext sslContext = SSLContext.getInstance(sslProtocol != null ? sslProtocol - : pProperties.getSslProtocol(), securityProvider); - - sslContext.init(keyManager, trustManager, null); - - logger.exit(); - - return sslContext; - - } catch (Exception e) { - logger.trace(Level.FINER, "Exception while initializing SSL context (provider:" - + provider + ")", e); - logger.message(Messages.SSL_CONTEXT_INIT_FAILED); - logger.exit(); - return null; - } - } - - private TrustManager[] loadTruststore(final WBEMConfiguration pProperties, - final Provider pSecurityProvider, boolean pIsServer) { - - final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); - logger.entry(); - - final TrustManager[] trustAll = new X509TrustManager[] { new AllTrustManager() }; - final TrustManager[] trustNone = new X509TrustManager[] { new NoTrustManager() }; - TrustManager[] trustManager = trustNone; - - final String truststorePath = pProperties.getSslTrustStorePath(); - final char[] truststorePassword = pProperties.getSslTrustStorePassword().toCharArray(); - final String truststoreType = pProperties.getSslTrustStoreType(); - final String trustManagerAlgorithm = pProperties.getSslTrustManagerAlgorithm(); - final boolean clientPeerVerification = pProperties.getSslClientPeerVerification(); - final String listenerPeerVerification = pProperties.getSslListenerPeerVerification(); - - logger.trace(Level.FINER, "Using SSL truststore \"" + truststorePath + "\" (" - + truststoreType + "/" + trustManagerAlgorithm + ")"); - - if (pIsServer && listenerPeerVerification.equalsIgnoreCase("ignore") - || (!pIsServer && !clientPeerVerification)) { - trustManager = trustAll; - if (truststorePath == null || truststorePath.trim().length() == 0) { - logger.trace(Level.FINER, "Peer verification disabled for " - + (pIsServer ? "Listener" : "Client")); - } else { - logger.message(Messages.SSL_TRUSTSTORE_INACTIVE); - } - } else { - if (truststorePath == null || truststorePath.trim().length() == 0) { - logger.trace(Level.FINER, "Peer verification enabled for " - + (pIsServer ? "Listener" : "Client") + " but no truststore specified!"); - logger.message(Messages.SSL_TRUSTSTORE_NULL); - } else { - logger.trace(Level.FINER, "Peer verification enabled for " - + (pIsServer ? "Listener" : "Client")); - FileInputStream fis = null; - try { - final KeyStore trustStore = KeyStore.getInstance(truststoreType); - fis = new FileInputStream(truststorePath); - trustStore.load(fis, truststorePassword); - final TrustManagerFactory trustManagerFactory = TrustManagerFactory - .getInstance(trustManagerAlgorithm, pSecurityProvider); - trustManagerFactory.init(trustStore); - trustManager = trustManagerFactory.getTrustManagers(); - logger.trace(Level.FINER, "Truststore successfully loaded for " - + (pIsServer ? "Listener" : "Client")); - } catch (FileNotFoundException e) { - logger.trace(Level.FINER, "Exception while loading truststore", e); - logger.message(Messages.SSL_TRUSTSTORE_NOT_FOUND, truststorePath); - } catch (IOException e) { - logger.trace(Level.FINER, "Exception while loading truststore", e); - logger.message(Messages.SSL_TRUSTSTORE_NOT_READABLE, truststorePath); - } catch (NoSuchAlgorithmException e) { - logger.trace(Level.FINER, "Exception while loading truststore", e); - logger - .message(Messages.SSL_TRUSTSTORE_INVALID_ALGORITHM, - trustManagerAlgorithm); - } catch (CertificateException e) { - logger.trace(Level.FINER, "Exception while loading truststore", e); - logger.message(Messages.SSL_TRUSTSTORE_INVALID_CERT, truststorePath); - } catch (KeyStoreException e) { - logger.trace(Level.FINER, "Exception while loading truststore", e); - logger.message(Messages.SSL_TRUSTSTORE_INVALID, truststoreType); - } catch (Exception e) { - logger.trace(Level.FINER, "Exception while loading truststore", e); - logger.message(Messages.SSL_TRUSTSTORE_OTHER, truststorePath); - } finally { - if (fis != null) { - try { - fis.close(); - } catch (IOException e) { - logger.trace(Level.FINER, "Exception while closing truststore", e); - } - } - } - } - } - - if (trustManager == trustAll) { - logger.message(Messages.SSL_TRUSTSTORE_FALLBACK); - } else if (trustManager == trustNone) { - logger.message(Messages.SSL_TRUSTSTORE_FALLBACK_NOTRUST); - } else { - logger.message(Messages.SSL_TRUSTSTORE_ACTIVE); - } - - logger.exit(); - return trustManager; - } - - private KeyManager[] loadKeystore(final WBEMConfiguration pProperties, - final Provider pSecurityProvider, boolean pIsServer) { - - final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); - logger.entry(); - - final KeyManager[] noKeys = new KeyManager[] { new EmptyKeyManager() }; - KeyManager[] keyManager = noKeys; - - final String keystorePath = pProperties.getSslKeyStorePath(); - final char[] keystorePassword = pProperties.getSslKeyStorePassword().toCharArray(); - final String keystoreType = pProperties.getSslKeyStoreType(); - final String keyManagerAlgorithm = pProperties.getSslKeyManagerAlgorithm(); - - logger.trace(Level.FINER, "Using SSL keystore \"" + keystorePath + "\" (" + keystoreType - + "/" + keyManagerAlgorithm + ")"); - - if (keystorePath == null || keystorePath.trim().length() == 0) { - logger.trace(Level.FINER, "Keystore not specified for " - + (pIsServer ? "Listener" : "Client")); - logger.message(Messages.SSL_KEYSTORE_NULL); - } else { - logger.trace(Level.FINER, "Keystore specified and activated for " - + (pIsServer ? "Listener" : "Client")); - FileInputStream fis = null; - try { - final KeyStore keystore = KeyStore.getInstance(keystoreType); - fis = new FileInputStream(keystorePath); - keystore.load(fis, keystorePassword); - - final KeyManagerFactory keymanagerfactory = KeyManagerFactory.getInstance( - keyManagerAlgorithm, pSecurityProvider); - keymanagerfactory.init(keystore, keystorePassword); - keyManager = keymanagerfactory.getKeyManagers(); - logger.trace(Level.FINER, "Keystore successfully loaded for " - + (pIsServer ? "Listener" : "Client")); - } catch (FileNotFoundException e) { - logger.trace(Level.FINER, "Exception while loading keystore", e); - logger.message(Messages.SSL_KEYSTORE_NOT_FOUND, keystorePath); - } catch (IOException e) { - logger.trace(Level.FINER, "Exception while loading keystore", e); - logger.message(Messages.SSL_KEYSTORE_NOT_READABLE, keystorePath); - } catch (NoSuchAlgorithmException e) { - logger.trace(Level.FINER, "Exception while loading keystore", e); - logger.message(Messages.SSL_KEYSTORE_INVALID_ALGORITHM, keyManagerAlgorithm); - } catch (CertificateException e) { - logger.trace(Level.FINER, "Exception while loading keystore", e); - logger.message(Messages.SSL_KEYSTORE_INVALID_CERT, keystorePath); - } catch (UnrecoverableKeyException e) { - logger.trace(Level.FINER, "Exception while loading keystore", e); - logger.message(Messages.SSL_KEYSTORE_UNRECOVERABLE_KEY, keystorePath); - } catch (KeyStoreException e) { - logger.trace(Level.FINER, "Exception while loading keystore", e); - logger.message(Messages.SSL_KEYSTORE_INVALID, keystoreType); - } catch (Exception e) { - logger.trace(Level.FINER, "Exception while loading keystore", e); - logger.message(Messages.SSL_KEYSTORE_OTHER, keystorePath); - } finally { - if (fis != null) { - try { - fis.close(); - } catch (IOException e) { - logger.trace(Level.FINER, "Exception while closing keystore", e); - } - } - } - } - - if (keyManager == noKeys) { - logger.message(Messages.SSL_KEYSTORE_FALLBACK); - } - - logger.exit(); - return keyManager; - } - -} - -class AllTrustManager implements X509TrustManager { - - /** - * @param arg0 - * @param arg1 - */ - public void checkClientTrusted(X509Certificate[] arg0, String arg1) { - return; - } - - /** - * @param arg0 - * @param arg1 - */ - public void checkServerTrusted(X509Certificate[] arg0, String arg1) { - return; - } - - public X509Certificate[] getAcceptedIssuers() { - return null; - } -} - -class NoTrustManager implements X509TrustManager { - - /** - * @param arg0 - * @param arg1 - * @throws CertificateException - */ - public void checkClientTrusted(X509Certificate[] arg0, String arg1) throws CertificateException { - throw new CertificateException(); - } - - /** - * @param arg0 - * @param arg1 - * @throws CertificateException - */ - public void checkServerTrusted(X509Certificate[] arg0, String arg1) throws CertificateException { - throw new CertificateException(); - } - - public X509Certificate[] getAcceptedIssuers() { - return null; - } -} - -class EmptyKeyManager implements X509KeyManager { - - /** - * @param keyType - * @param issuers - * @param socket - * @return String chooseClientAlias - */ - public String chooseClientAlias(String[] keyType, Principal[] issuers, Socket socket) { - return null; - } - - /** - * @param keyType - * @param issuers - * @param socket - * @return String chooseServerAlias - */ - public String chooseServerAlias(String keyType, Principal[] issuers, Socket socket) { - return null; - } - - /** - * @param alias - * @return X509Certificate[] - */ - public X509Certificate[] getCertificateChain(String alias) { - return null; - } - - /** - * @param keyType - * @param issuers - * @return String[] - */ - public String[] getClientAliases(String keyType, Principal[] issuers) { - return null; - } - - /** - * @param alias - * @return PrivateKey - */ - public PrivateKey getPrivateKey(String alias) { - return null; - } - - /** - * @param keyType - * @param issuers - * @return String[] - */ - public String[] getServerAliases(String keyType, Principal[] issuers) { - return null; - } -} +/* + (C) Copyright IBM Corp. 2005, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1498130 2006-05-31 lupusalex Selection of xml parser on a per connection basis + * 1535756 2006-08-07 lupusalex Make code warning free + * 1558663 2006-09-14 lupusalex Support custom socket factories in client connections + * 1573723 2006-10-09 lupusalex Selection of JSSE provider via properties file not feasible + * 1573723 2006-10-30 lupusalex rework: Selection of JSSE provider via properties file not feasible + * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant + * 1660743 2007-02-15 lupusalex SSLContext is static + * 1711092 2006-05-02 lupusalex Some fixes/additions of log&trace messages + * 1815707 2007-10-18 ebak TLS support + * 1815707 2007-10-30 ebak rework: TLS support + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 3001345 2010-05-18 blaschke-oss File handle leaks in HttpSocketFactory and LogAndTraceBroker + * 3027618 2010-07-14 blaschke-oss Close files/readers in finally blocks + * 3111718 2010-11-18 blaschke-oss org.sblim.cimclient SSL Code is using the wrong SSL Property + * 3536399 2012-08-25 hellerda Add client/listener peer authentication properties + * 2647 2013-07-01 blaschke-oss Add two ssl protocol properties for http server and client + */ + +package org.metricshub.wbem.sblim.cimclient.internal.http; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.net.Socket; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.Principal; +import java.security.PrivateKey; +import java.security.Provider; +import java.security.Security; +import java.security.UnrecoverableKeyException; +import java.security.cert.CertificateException; +import java.security.cert.X509Certificate; +import java.util.logging.Level; + +import javax.net.ServerSocketFactory; +import javax.net.SocketFactory; +import javax.net.ssl.KeyManager; +import javax.net.ssl.KeyManagerFactory; +import javax.net.ssl.SSLContext; +import javax.net.ssl.TrustManager; +import javax.net.ssl.TrustManagerFactory; +import javax.net.ssl.X509KeyManager; +import javax.net.ssl.X509TrustManager; + +import org.metricshub.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; +import org.metricshub.wbem.sblim.cimclient.internal.logging.Messages; +import org.metricshub.wbem.sblim.cimclient.internal.util.WBEMConfiguration; + +/** + * Class HttpSocketFactory manages socket factories + * + */ +public class HttpSocketFactory { + + private static HttpSocketFactory cInstance = new HttpSocketFactory(); + + private HttpSocketFactory() { + // empty + } + + /** + * Returns the singleton instance + * + * @return The instance + */ + public static HttpSocketFactory getInstance() { + return cInstance; + } + + /** + * Returns a server socket factory + * + * @param pContext + * The corresponding SSL context or null for + * insecure connections + * + * @return The factory + */ + public ServerSocketFactory getServerSocketFactory(SSLContext pContext) { + return pContext != null ? pContext.getServerSocketFactory() : ServerSocketFactory + .getDefault(); + } + + /** + * Returns a client socket factory + * + * @param pContext + * The SSL context or null for insecure connections + * @return The factory + */ + public SocketFactory getClientSocketFactory(SSLContext pContext) { + return pContext != null ? pContext.getSocketFactory() : SocketFactory.getDefault(); + } + + /** + * Returns a SSLContext for client sockets corresponding to a given set of + * configuration properties + * + * @param pProperties + * The configuration to apply + * @return The SSL context + */ + public SSLContext getClientSSLContext(final WBEMConfiguration pProperties) { + return getSSLContext(pProperties, false); + } + + /** + * Returns a SSLContext for server sockets corresponding to a given set of + * configuration properties + * + * @param pProperties + * The configuration to apply + * @return The SSL context + */ + public SSLContext getServerSSLContext(final WBEMConfiguration pProperties) { + return getSSLContext(pProperties, true); + } + + /** + * Returns a SSLContext corresponding to a given set of configuration + * properties + * + * @param pProperties + * The configuration to apply + * @param pIsServer + * true if a server socket context is requested, + * false otherwise + * @return The SSL context + */ + private SSLContext getSSLContext(final WBEMConfiguration pProperties, boolean pIsServer) { + + final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); + logger.entry(); + + final String provider = pIsServer ? pProperties.getSslServerSocketProvider() : pProperties + .getSslSocketProvider(); + logger.trace(Level.FINER, "Loading JSSE provider:" + provider); + + final Provider securityProvider; + + try { + Class providerClass = Class.forName(provider); + securityProvider = (java.security.Provider) providerClass.newInstance(); + if (Security.getProvider(securityProvider.getName()) == null) { + Security.addProvider(securityProvider); + } + } catch (Exception e) { + logger.trace(Level.FINER, "Exception while loading JSSE provider", e); + logger.message(Messages.SSL_JSSE_PROVIDER_LOAD_FAILED, provider); + logger.exit(); + throw new RuntimeException(e); + } + + try { + KeyManager[] keyManager = loadKeystore(pProperties, securityProvider, pIsServer); + + TrustManager[] trustManager = loadTruststore(pProperties, securityProvider, pIsServer); + + String sslProtocol = pIsServer ? pProperties.getSslListenerProtocol() : pProperties + .getSslClientProtocol(); + + SSLContext sslContext = SSLContext.getInstance(sslProtocol != null ? sslProtocol + : pProperties.getSslProtocol(), securityProvider); + + sslContext.init(keyManager, trustManager, null); + + logger.exit(); + + return sslContext; + + } catch (Exception e) { + logger.trace(Level.FINER, "Exception while initializing SSL context (provider:" + + provider + ")", e); + logger.message(Messages.SSL_CONTEXT_INIT_FAILED); + logger.exit(); + return null; + } + } + + private TrustManager[] loadTruststore(final WBEMConfiguration pProperties, + final Provider pSecurityProvider, boolean pIsServer) { + + final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); + logger.entry(); + + final TrustManager[] trustAll = new X509TrustManager[] { new AllTrustManager() }; + final TrustManager[] trustNone = new X509TrustManager[] { new NoTrustManager() }; + TrustManager[] trustManager = trustNone; + + final String truststorePath = pProperties.getSslTrustStorePath(); + final char[] truststorePassword = pProperties.getSslTrustStorePassword().toCharArray(); + final String truststoreType = pProperties.getSslTrustStoreType(); + final String trustManagerAlgorithm = pProperties.getSslTrustManagerAlgorithm(); + final boolean clientPeerVerification = pProperties.getSslClientPeerVerification(); + final String listenerPeerVerification = pProperties.getSslListenerPeerVerification(); + + logger.trace(Level.FINER, "Using SSL truststore \"" + truststorePath + "\" (" + + truststoreType + "/" + trustManagerAlgorithm + ")"); + + if (pIsServer && listenerPeerVerification.equalsIgnoreCase("ignore") + || (!pIsServer && !clientPeerVerification)) { + trustManager = trustAll; + if (truststorePath == null || truststorePath.trim().length() == 0) { + logger.trace(Level.FINER, "Peer verification disabled for " + + (pIsServer ? "Listener" : "Client")); + } else { + logger.message(Messages.SSL_TRUSTSTORE_INACTIVE); + } + } else { + if (truststorePath == null || truststorePath.trim().length() == 0) { + logger.trace(Level.FINER, "Peer verification enabled for " + + (pIsServer ? "Listener" : "Client") + " but no truststore specified!"); + logger.message(Messages.SSL_TRUSTSTORE_NULL); + } else { + logger.trace(Level.FINER, "Peer verification enabled for " + + (pIsServer ? "Listener" : "Client")); + FileInputStream fis = null; + try { + final KeyStore trustStore = KeyStore.getInstance(truststoreType); + fis = new FileInputStream(truststorePath); + trustStore.load(fis, truststorePassword); + final TrustManagerFactory trustManagerFactory = TrustManagerFactory + .getInstance(trustManagerAlgorithm, pSecurityProvider); + trustManagerFactory.init(trustStore); + trustManager = trustManagerFactory.getTrustManagers(); + logger.trace(Level.FINER, "Truststore successfully loaded for " + + (pIsServer ? "Listener" : "Client")); + } catch (FileNotFoundException e) { + logger.trace(Level.FINER, "Exception while loading truststore", e); + logger.message(Messages.SSL_TRUSTSTORE_NOT_FOUND, truststorePath); + } catch (IOException e) { + logger.trace(Level.FINER, "Exception while loading truststore", e); + logger.message(Messages.SSL_TRUSTSTORE_NOT_READABLE, truststorePath); + } catch (NoSuchAlgorithmException e) { + logger.trace(Level.FINER, "Exception while loading truststore", e); + logger + .message(Messages.SSL_TRUSTSTORE_INVALID_ALGORITHM, + trustManagerAlgorithm); + } catch (CertificateException e) { + logger.trace(Level.FINER, "Exception while loading truststore", e); + logger.message(Messages.SSL_TRUSTSTORE_INVALID_CERT, truststorePath); + } catch (KeyStoreException e) { + logger.trace(Level.FINER, "Exception while loading truststore", e); + logger.message(Messages.SSL_TRUSTSTORE_INVALID, truststoreType); + } catch (Exception e) { + logger.trace(Level.FINER, "Exception while loading truststore", e); + logger.message(Messages.SSL_TRUSTSTORE_OTHER, truststorePath); + } finally { + if (fis != null) { + try { + fis.close(); + } catch (IOException e) { + logger.trace(Level.FINER, "Exception while closing truststore", e); + } + } + } + } + } + + if (trustManager == trustAll) { + logger.message(Messages.SSL_TRUSTSTORE_FALLBACK); + } else if (trustManager == trustNone) { + logger.message(Messages.SSL_TRUSTSTORE_FALLBACK_NOTRUST); + } else { + logger.message(Messages.SSL_TRUSTSTORE_ACTIVE); + } + + logger.exit(); + return trustManager; + } + + private KeyManager[] loadKeystore(final WBEMConfiguration pProperties, + final Provider pSecurityProvider, boolean pIsServer) { + + final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); + logger.entry(); + + final KeyManager[] noKeys = new KeyManager[] { new EmptyKeyManager() }; + KeyManager[] keyManager = noKeys; + + final String keystorePath = pProperties.getSslKeyStorePath(); + final char[] keystorePassword = pProperties.getSslKeyStorePassword().toCharArray(); + final String keystoreType = pProperties.getSslKeyStoreType(); + final String keyManagerAlgorithm = pProperties.getSslKeyManagerAlgorithm(); + + logger.trace(Level.FINER, "Using SSL keystore \"" + keystorePath + "\" (" + keystoreType + + "/" + keyManagerAlgorithm + ")"); + + if (keystorePath == null || keystorePath.trim().length() == 0) { + logger.trace(Level.FINER, "Keystore not specified for " + + (pIsServer ? "Listener" : "Client")); + logger.message(Messages.SSL_KEYSTORE_NULL); + } else { + logger.trace(Level.FINER, "Keystore specified and activated for " + + (pIsServer ? "Listener" : "Client")); + FileInputStream fis = null; + try { + final KeyStore keystore = KeyStore.getInstance(keystoreType); + fis = new FileInputStream(keystorePath); + keystore.load(fis, keystorePassword); + + final KeyManagerFactory keymanagerfactory = KeyManagerFactory.getInstance( + keyManagerAlgorithm, pSecurityProvider); + keymanagerfactory.init(keystore, keystorePassword); + keyManager = keymanagerfactory.getKeyManagers(); + logger.trace(Level.FINER, "Keystore successfully loaded for " + + (pIsServer ? "Listener" : "Client")); + } catch (FileNotFoundException e) { + logger.trace(Level.FINER, "Exception while loading keystore", e); + logger.message(Messages.SSL_KEYSTORE_NOT_FOUND, keystorePath); + } catch (IOException e) { + logger.trace(Level.FINER, "Exception while loading keystore", e); + logger.message(Messages.SSL_KEYSTORE_NOT_READABLE, keystorePath); + } catch (NoSuchAlgorithmException e) { + logger.trace(Level.FINER, "Exception while loading keystore", e); + logger.message(Messages.SSL_KEYSTORE_INVALID_ALGORITHM, keyManagerAlgorithm); + } catch (CertificateException e) { + logger.trace(Level.FINER, "Exception while loading keystore", e); + logger.message(Messages.SSL_KEYSTORE_INVALID_CERT, keystorePath); + } catch (UnrecoverableKeyException e) { + logger.trace(Level.FINER, "Exception while loading keystore", e); + logger.message(Messages.SSL_KEYSTORE_UNRECOVERABLE_KEY, keystorePath); + } catch (KeyStoreException e) { + logger.trace(Level.FINER, "Exception while loading keystore", e); + logger.message(Messages.SSL_KEYSTORE_INVALID, keystoreType); + } catch (Exception e) { + logger.trace(Level.FINER, "Exception while loading keystore", e); + logger.message(Messages.SSL_KEYSTORE_OTHER, keystorePath); + } finally { + if (fis != null) { + try { + fis.close(); + } catch (IOException e) { + logger.trace(Level.FINER, "Exception while closing keystore", e); + } + } + } + } + + if (keyManager == noKeys) { + logger.message(Messages.SSL_KEYSTORE_FALLBACK); + } + + logger.exit(); + return keyManager; + } + +} + +class AllTrustManager implements X509TrustManager { + + /** + * @param arg0 + * @param arg1 + */ + public void checkClientTrusted(X509Certificate[] arg0, String arg1) { + return; + } + + /** + * @param arg0 + * @param arg1 + */ + public void checkServerTrusted(X509Certificate[] arg0, String arg1) { + return; + } + + public X509Certificate[] getAcceptedIssuers() { + return null; + } +} + +class NoTrustManager implements X509TrustManager { + + /** + * @param arg0 + * @param arg1 + * @throws CertificateException + */ + public void checkClientTrusted(X509Certificate[] arg0, String arg1) throws CertificateException { + throw new CertificateException(); + } + + /** + * @param arg0 + * @param arg1 + * @throws CertificateException + */ + public void checkServerTrusted(X509Certificate[] arg0, String arg1) throws CertificateException { + throw new CertificateException(); + } + + public X509Certificate[] getAcceptedIssuers() { + return null; + } +} + +class EmptyKeyManager implements X509KeyManager { + + /** + * @param keyType + * @param issuers + * @param socket + * @return String chooseClientAlias + */ + public String chooseClientAlias(String[] keyType, Principal[] issuers, Socket socket) { + return null; + } + + /** + * @param keyType + * @param issuers + * @param socket + * @return String chooseServerAlias + */ + public String chooseServerAlias(String keyType, Principal[] issuers, Socket socket) { + return null; + } + + /** + * @param alias + * @return X509Certificate[] + */ + public X509Certificate[] getCertificateChain(String alias) { + return null; + } + + /** + * @param keyType + * @param issuers + * @return String[] + */ + public String[] getClientAliases(String keyType, Principal[] issuers) { + return null; + } + + /** + * @param alias + * @return PrivateKey + */ + public PrivateKey getPrivateKey(String alias) { + return null; + } + + /** + * @param keyType + * @param issuers + * @return String[] + */ + public String[] getServerAliases(String keyType, Principal[] issuers) { + return null; + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/HttpUrlConnection.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpUrlConnection.java similarity index 85% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/HttpUrlConnection.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpUrlConnection.java index 54cbcc9..b18b6e2 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/HttpUrlConnection.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpUrlConnection.java @@ -1,271 +1,269 @@ -/* - (C) Copyright IBM Corp. 2005, 2010 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1353168 2005-11-24 fiuczy Possible NullPointerExcection in HttpClient.streamFinished() - * 1488924 2006-05-15 lupusalex Intermittent connection loss - * 1535756 2006-08-07 lupusalex Make code warning free - * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 3026360 2010-07-07 blaschke-oss Handle unwritten fields - */ -package org.sentrysoftware.wbem.sblim.cimclient.internal.http; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.HttpURLConnection; -import java.net.SocketPermission; -import java.net.URI; -import java.security.Permission; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; - -/** - * Class HttpUrlConnection encapsulates a http connection - * - */ -public class HttpUrlConnection extends HttpURLConnection { - - private boolean iConnected; - - private HttpClient iHttpClient; - - protected URI iUrl; - - private HttpClientPool iHttpClientPool; - - AuthorizationHandler iAuthHandler; - - /** - * Ctor. - * - * @param pUri - * The host URI - * @param pHttpClientPool - * The client pool - * @param pAuthHandler - * The authentication handler - */ - public HttpUrlConnection(URI pUri, HttpClientPool pHttpClientPool, - AuthorizationHandler pAuthHandler) { - super(null); - this.iUrl = pUri; - this.iHttpClientPool = pHttpClientPool; - this.iAuthHandler = pAuthHandler; - // iLogger = GlobalProperties.getLogger(); - } - - @Override - public String toString() { - return "HttpUrlConnection=[url=" + this.iUrl + ",PoolSize=" - + this.iHttpClientPool.getNumberOfAvailableConnections() + "," + this.iAuthHandler - + "]"; - } - - @Override - public Permission getPermission() { - int port = this.iUrl.getPort(); - port = port < 0 ? 80 : port; - String host = this.iUrl.getHost() + ":" + port; - Permission permission = new SocketPermission(host, "connect"); - return permission; - } - - @Override - public synchronized void connect() throws IOException { - if (!this.iConnected) getClient(); - this.iHttpClient.connect(); - } - - private synchronized void getClient() { - if (this.iConnected) return; - - this.iHttpClient = HttpClient.getClient(this.iUrl, this.iHttpClientPool, this.iAuthHandler); - this.iHttpClient.reset(); - this.iConnected = true; - } - - @Override - public synchronized void setRequestMethod(String pMethod) { - if (!this.iConnected) getClient(); - this.iHttpClient.setRequestMethod(pMethod); - this.method = pMethod; - } - - @Override - public synchronized void setRequestProperty(String key, String value) { - if (!this.iConnected) getClient(); - this.iHttpClient.setRequestProperty(key, value); - } - - @Override - public synchronized void disconnect() { - LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); - logger.entry(); - - if (this.iConnected) { - this.iConnected = false; - this.iHttpClient.disconnect(); - if (this.iHttpClientPool != null) { - this.iHttpClientPool.removeConnectionFromPool(this.iHttpClient); - this.iHttpClient = null; - } - } - logger.exit(); - } - - /** - * Closes the client pool - */ - public synchronized void close() { - LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); - logger.entry(); - - if (this.iHttpClientPool != null) { - synchronized (this.iHttpClientPool) { - this.iHttpClientPool.closePool(); - this.iHttpClientPool = null; - } - } - logger.exit(); - } - - @Override - public synchronized InputStream getInputStream() throws IOException { - if (!this.iConnected) getClient(); - try { - return this.iHttpClient.getInputStream(); - } catch (RuntimeException e) { - disconnect(); - throw e; - } catch (IOException e) { - disconnect(); - throw e; - } - } - - @Override - public synchronized OutputStream getOutputStream() throws RuntimeException { - if (!this.iConnected) getClient(); - try { - return this.iHttpClient.getOutputStream(); - } catch (RuntimeException e) { - disconnect(); - throw e; - } - } - - @Override - public boolean usingProxy() { - return false; - } - - /** - * Returns the http client - * - * @return The http client - */ - public synchronized HttpClient getHttpClient() { - if (!this.iConnected) getClient(); - return this.iHttpClient; - } - - @Override - public synchronized String getHeaderField(String name) { - if (!this.iConnected) getClient(); - return this.iHttpClient.getHeaderField(name); - } - - @Override - public synchronized String getHeaderFieldKey(int index) { - if (!this.iConnected) getClient(); - return this.iHttpClient.getHeaderFieldName(index); - } - - @Override - public synchronized String getHeaderField(int index) { - if (!this.iConnected) getClient(); - return this.iHttpClient.getHeaderFieldValue(index); - } - - @Override - public synchronized String getRequestProperty(String key) { - if (!this.iConnected) getClient(); - return this.iHttpClient.getRequestProperty(key); - } - - @Override - public synchronized String getRequestMethod() { - if (!this.iConnected) getClient(); - return this.iHttpClient.getRequestMethod(); - } - - /** - * Resets the http client - */ - public synchronized void reset() { - if (!this.iConnected) getClient(); - this.iHttpClient.reset(); - } - - @Override - public synchronized int getResponseCode() throws IOException { - if (!this.iConnected) getClient(); - return this.iHttpClient.getResponseCode(); - } - - @Override - public synchronized String getResponseMessage() { - if (!this.iConnected) getClient(); - return this.iHttpClient.getResponseMessage(); - } - - /** - * Enables/Disables the use of http 1.1 - * - * @param pUse11 - * If true http 1.1 is enabled. - */ - public synchronized void useHttp11(boolean pUse11) { - if (!this.iConnected) getClient(); - this.iHttpClient.useHttp11(pUse11); - } -} +/* + (C) Copyright IBM Corp. 2005, 2010 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1353168 2005-11-24 fiuczy Possible NullPointerExcection in HttpClient.streamFinished() + * 1488924 2006-05-15 lupusalex Intermittent connection loss + * 1535756 2006-08-07 lupusalex Make code warning free + * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 3026360 2010-07-07 blaschke-oss Handle unwritten fields + */ +package org.metricshub.wbem.sblim.cimclient.internal.http; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.HttpURLConnection; +import java.net.SocketPermission; +import java.net.URI; +import java.security.Permission; + +import org.metricshub.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; + +/** + * Class HttpUrlConnection encapsulates a http connection + * + */ +public class HttpUrlConnection extends HttpURLConnection { + + private boolean iConnected; + + private HttpClient iHttpClient; + + protected URI iUrl; + + private HttpClientPool iHttpClientPool; + + AuthorizationHandler iAuthHandler; + + /** + * Ctor. + * + * @param pUri + * The host URI + * @param pHttpClientPool + * The client pool + * @param pAuthHandler + * The authentication handler + */ + public HttpUrlConnection(URI pUri, HttpClientPool pHttpClientPool, + AuthorizationHandler pAuthHandler) { + super(null); + this.iUrl = pUri; + this.iHttpClientPool = pHttpClientPool; + this.iAuthHandler = pAuthHandler; + // iLogger = GlobalProperties.getLogger(); + } + + @Override + public String toString() { + return "HttpUrlConnection=[url=" + this.iUrl + ",PoolSize=" + + this.iHttpClientPool.getNumberOfAvailableConnections() + "," + this.iAuthHandler + + "]"; + } + + @Override + public Permission getPermission() { + int port = this.iUrl.getPort(); + port = port < 0 ? 80 : port; + String host = this.iUrl.getHost() + ":" + port; + Permission permission = new SocketPermission(host, "connect"); + return permission; + } + + @Override + public synchronized void connect() throws IOException { + if (!this.iConnected) getClient(); + this.iHttpClient.connect(); + } + + private synchronized void getClient() { + if (this.iConnected) return; + + this.iHttpClient = HttpClient.getClient(this.iUrl, this.iHttpClientPool, this.iAuthHandler); + this.iHttpClient.reset(); + this.iConnected = true; + } + + @Override + public synchronized void setRequestMethod(String pMethod) { + if (!this.iConnected) getClient(); + this.iHttpClient.setRequestMethod(pMethod); + this.method = pMethod; + } + + @Override + public synchronized void setRequestProperty(String key, String value) { + if (!this.iConnected) getClient(); + this.iHttpClient.setRequestProperty(key, value); + } + + @Override + public synchronized void disconnect() { + LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); + logger.entry(); + + if (this.iConnected) { + this.iConnected = false; + this.iHttpClient.disconnect(); + if (this.iHttpClientPool != null) { + this.iHttpClientPool.removeConnectionFromPool(this.iHttpClient); + this.iHttpClient = null; + } + } + logger.exit(); + } + + /** + * Closes the client pool + */ + public synchronized void close() { + LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); + logger.entry(); + + if (this.iHttpClientPool != null) { + synchronized (this.iHttpClientPool) { + this.iHttpClientPool.closePool(); + this.iHttpClientPool = null; + } + } + logger.exit(); + } + + @Override + public synchronized InputStream getInputStream() throws IOException { + if (!this.iConnected) getClient(); + try { + return this.iHttpClient.getInputStream(); + } catch (RuntimeException e) { + disconnect(); + throw e; + } catch (IOException e) { + disconnect(); + throw e; + } + } + + @Override + public synchronized OutputStream getOutputStream() throws RuntimeException { + if (!this.iConnected) getClient(); + try { + return this.iHttpClient.getOutputStream(); + } catch (RuntimeException e) { + disconnect(); + throw e; + } + } + + @Override + public boolean usingProxy() { + return false; + } + + /** + * Returns the http client + * + * @return The http client + */ + public synchronized HttpClient getHttpClient() { + if (!this.iConnected) getClient(); + return this.iHttpClient; + } + + @Override + public synchronized String getHeaderField(String name) { + if (!this.iConnected) getClient(); + return this.iHttpClient.getHeaderField(name); + } + + @Override + public synchronized String getHeaderFieldKey(int index) { + if (!this.iConnected) getClient(); + return this.iHttpClient.getHeaderFieldName(index); + } + + @Override + public synchronized String getHeaderField(int index) { + if (!this.iConnected) getClient(); + return this.iHttpClient.getHeaderFieldValue(index); + } + + @Override + public synchronized String getRequestProperty(String key) { + if (!this.iConnected) getClient(); + return this.iHttpClient.getRequestProperty(key); + } + + @Override + public synchronized String getRequestMethod() { + if (!this.iConnected) getClient(); + return this.iHttpClient.getRequestMethod(); + } + + /** + * Resets the http client + */ + public synchronized void reset() { + if (!this.iConnected) getClient(); + this.iHttpClient.reset(); + } + + @Override + public synchronized int getResponseCode() throws IOException { + if (!this.iConnected) getClient(); + return this.iHttpClient.getResponseCode(); + } + + @Override + public synchronized String getResponseMessage() { + if (!this.iConnected) getClient(); + return this.iHttpClient.getResponseMessage(); + } + + /** + * Enables/Disables the use of http 1.1 + * + * @param pUse11 + * If true http 1.1 is enabled. + */ + public synchronized void useHttp11(boolean pUse11) { + if (!this.iConnected) getClient(); + this.iHttpClient.useHttp11(pUse11); + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/MessageReader.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/MessageReader.java similarity index 80% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/MessageReader.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/MessageReader.java index 85414d8..170e606 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/MessageReader.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/MessageReader.java @@ -1,202 +1,200 @@ -/* - (C) Copyright IBM Corp. 2005, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1535756 2006-08-07 lupusalex Make code warning free - * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 3027479 2010-07-09 blaschke-oss Dead store to local variable - * 3601894 2013-01-23 blaschke-oss Enhance HTTP and CIM-XML tracing - * 2621 2013-02-23 blaschke-oss Not all chunked input has trailers - * 2635 2013-05-16 blaschke-oss Slowloris DoS attack for CIM indication listener port - * 2655 2013-08-14 blaschke-oss Content-length must be ignored when Transfer-encoding present - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.http; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.IOException; -import java.io.InputStream; -import java.util.logging.Level; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.http.io.BoundedInputStream; -import org.sentrysoftware.wbem.sblim.cimclient.internal.http.io.ChunkedInputStream; -import org.sentrysoftware.wbem.sblim.cimclient.internal.http.io.PersistentInputStream; -import org.sentrysoftware.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; - -/** - * Class MessageReader is responsible for reading http messages - * - */ -public class MessageReader { - - HttpHeader iHeader; - - HttpServerMethod iMethod; - - private boolean iChunked = false; - - private String iEncoding = "UTF-8"; - - InputStream iContent; - - /** - * Ctor. - * - * @param pStream - * The input stream - * @param pTimeout - * The timeout for reading in entire header - * @throws IOException - * @throws HttpException - */ - public MessageReader(InputStream pStream, int pTimeout) throws IOException, HttpException { - this.iMethod = new HttpServerMethod(pStream); - this.iHeader = new HttpHeader(pStream, pTimeout); - - String encoding = this.iHeader.getField("Transfer-Encoding"); - if ((encoding != null) && (encoding.toLowerCase().endsWith("chunked"))) { - this.iChunked = true; - } - String length = this.iHeader.getField("Content-Length"); - int contentLength = -1; - if (length != null && length.length() > 0) { - try { - contentLength = Integer.parseInt(length); - } catch (Exception e) { - LogAndTraceBroker.getBroker().trace(Level.FINER, - "Exception while parsing http content-length", e); - } - } - String contentType = this.iHeader.getField("Content-Type"); - if (contentType != null) { - try { - HttpHeaderParser contentTypeHeader = new HttpHeaderParser(contentType); - encoding = contentTypeHeader.getValue("charset"); - } catch (Exception e) { - encoding = "UTF-8"; // TODO is this the default character - // encoding? - LogAndTraceBroker.getBroker().trace(Level.FINER, - "Exception while parsing http content-type", e); - } - this.iEncoding = encoding; - } - - this.iContent = new PersistentInputStream(pStream, isPersistentConnectionSupported()); - if (this.iChunked) { - this.iContent = new ChunkedInputStream(this.iContent, this.iHeader.getField("Trailer"), - "Indication Request"); - } else if (contentLength >= 0) { - this.iContent = new BoundedInputStream(this.iContent, contentLength); - } - } - - /** - * Returns the character encoding - * - * @return The character encoding - */ - public String getCharacterEncoding() { - return this.iEncoding; - } - - /** - * Returns the http header - * - * @return The http header - */ - public HttpHeader getHeader() { - return this.iHeader; - } - - /** - * Returns the http server method - * - * @return The http server method - */ - public HttpServerMethod getMethod() { - return this.iMethod; - } - - /** - * Returns the input stream - * - * @return The input stream - */ - public InputStream getInputStream() { - return this.iContent; - } - - /** - * Returns the persistent connection support state - * - * @return true if persistent connection is supported - */ - public boolean isPersistentConnectionSupported() { - String conn = this.iHeader.getField("Connection"); - if (conn != null) { - if (conn.equalsIgnoreCase("close")) return false; - if (conn.equalsIgnoreCase("Keep-Alive")) return true; - } - - return ((this.iMethod.getMajorVersion() >= 1) && (this.iMethod.getMinorVersion() >= 1)); - } - - /** - * Returns the chunking support state - * - * @return true if chunking is supported - */ - public boolean isChunkSupported() { - // TODO: make sure this is the correct way to test for chunk support - if ((this.iMethod.getMajorVersion() >= 1) && (this.iMethod.getMinorVersion() >= 1)) { - String TE; - if ((TE = this.iHeader.getField("TE")) != null && (TE.equalsIgnoreCase("trailers"))) { return true; } - } - return false; - } - - /** - * Closes the stream - * - * @throws IOException - */ - public void close() throws IOException { - this.iContent.close(); - } -} +/* + (C) Copyright IBM Corp. 2005, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1535756 2006-08-07 lupusalex Make code warning free + * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 3027479 2010-07-09 blaschke-oss Dead store to local variable + * 3601894 2013-01-23 blaschke-oss Enhance HTTP and CIM-XML tracing + * 2621 2013-02-23 blaschke-oss Not all chunked input has trailers + * 2635 2013-05-16 blaschke-oss Slowloris DoS attack for CIM indication listener port + * 2655 2013-08-14 blaschke-oss Content-length must be ignored when Transfer-encoding present + */ + +package org.metricshub.wbem.sblim.cimclient.internal.http; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.IOException; +import java.io.InputStream; +import java.util.logging.Level; + +import org.metricshub.wbem.sblim.cimclient.internal.http.io.BoundedInputStream; +import org.metricshub.wbem.sblim.cimclient.internal.http.io.ChunkedInputStream; +import org.metricshub.wbem.sblim.cimclient.internal.http.io.PersistentInputStream; +import org.metricshub.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; + +/** + * Class MessageReader is responsible for reading http messages + * + */ +public class MessageReader { + + HttpHeader iHeader; + + HttpServerMethod iMethod; + + private boolean iChunked = false; + + private String iEncoding = "UTF-8"; + + InputStream iContent; + + /** + * Ctor. + * + * @param pStream + * The input stream + * @param pTimeout + * The timeout for reading in entire header + * @throws IOException + * @throws HttpException + */ + public MessageReader(InputStream pStream, int pTimeout) throws IOException, HttpException { + this.iMethod = new HttpServerMethod(pStream); + this.iHeader = new HttpHeader(pStream, pTimeout); + + String encoding = this.iHeader.getField("Transfer-Encoding"); + if ((encoding != null) && (encoding.toLowerCase().endsWith("chunked"))) { + this.iChunked = true; + } + String length = this.iHeader.getField("Content-Length"); + int contentLength = -1; + if (length != null && length.length() > 0) { + try { + contentLength = Integer.parseInt(length); + } catch (Exception e) { + LogAndTraceBroker.getBroker().trace(Level.FINER, + "Exception while parsing http content-length", e); + } + } + String contentType = this.iHeader.getField("Content-Type"); + if (contentType != null) { + try { + HttpHeaderParser contentTypeHeader = new HttpHeaderParser(contentType); + encoding = contentTypeHeader.getValue("charset"); + } catch (Exception e) { + encoding = "UTF-8"; // TODO is this the default character + // encoding? + LogAndTraceBroker.getBroker().trace(Level.FINER, + "Exception while parsing http content-type", e); + } + this.iEncoding = encoding; + } + + this.iContent = new PersistentInputStream(pStream, isPersistentConnectionSupported()); + if (this.iChunked) { + this.iContent = new ChunkedInputStream(this.iContent, this.iHeader.getField("Trailer"), + "Indication Request"); + } else if (contentLength >= 0) { + this.iContent = new BoundedInputStream(this.iContent, contentLength); + } + } + + /** + * Returns the character encoding + * + * @return The character encoding + */ + public String getCharacterEncoding() { + return this.iEncoding; + } + + /** + * Returns the http header + * + * @return The http header + */ + public HttpHeader getHeader() { + return this.iHeader; + } + + /** + * Returns the http server method + * + * @return The http server method + */ + public HttpServerMethod getMethod() { + return this.iMethod; + } + + /** + * Returns the input stream + * + * @return The input stream + */ + public InputStream getInputStream() { + return this.iContent; + } + + /** + * Returns the persistent connection support state + * + * @return true if persistent connection is supported + */ + public boolean isPersistentConnectionSupported() { + String conn = this.iHeader.getField("Connection"); + if (conn != null) { + if (conn.equalsIgnoreCase("close")) return false; + if (conn.equalsIgnoreCase("Keep-Alive")) return true; + } + + return ((this.iMethod.getMajorVersion() >= 1) && (this.iMethod.getMinorVersion() >= 1)); + } + + /** + * Returns the chunking support state + * + * @return true if chunking is supported + */ + public boolean isChunkSupported() { + // TODO: make sure this is the correct way to test for chunk support + if ((this.iMethod.getMajorVersion() >= 1) && (this.iMethod.getMinorVersion() >= 1)) { + String TE; + if ((TE = this.iHeader.getField("TE")) != null && (TE.equalsIgnoreCase("trailers"))) { return true; } + } + return false; + } + + /** + * Closes the stream + * + * @throws IOException + */ + public void close() throws IOException { + this.iContent.close(); + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/MessageWriter.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/MessageWriter.java similarity index 79% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/MessageWriter.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/MessageWriter.java index 134847c..f9c344a 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/MessageWriter.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/MessageWriter.java @@ -1,201 +1,199 @@ -/* - (C) Copyright IBM Corp. 2005, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 17620 2005-06-29 thschaef eliminate ASCIIPrintStream1 in import statement - * 1535756 2006-08-07 lupusalex Make code warning free - * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 3304058 2011-05-20 blaschke-oss Use same date format in change history - * 3601894 2013-01-23 blaschke-oss Enhance HTTP and CIM-XML tracing - * 2620 2013-02-23 blaschke-oss Chunked output broken - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.http; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.util.logging.Level; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.http.io.ASCIIPrintStream; -import org.sentrysoftware.wbem.sblim.cimclient.internal.http.io.ChunkedOutputStream; -import org.sentrysoftware.wbem.sblim.cimclient.internal.http.io.PersistentOutputStream; -import org.sentrysoftware.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; - -/** - * Class MessageWriter is responsible for creating http messages - * - */ -public class MessageWriter { - - HttpHeader iHeader = null; - - HttpServerMethod iMethod = null; - - HttpHeader iTrailer = null; - - boolean iChunked = false; - - boolean iPersistent = false; - - ASCIIPrintStream iRealOS; - - ASCIIPrintStream iClientOS; - - ByteArrayOutputStream iBufferedOS; - - /** - * Ctor. - * - * @param pStream - * @param pPersistent - * @param pChunked - */ - public MessageWriter(OutputStream pStream, boolean pPersistent, boolean pChunked) { - this.iRealOS = new ASCIIPrintStream(pStream); - this.iChunked = pChunked; - this.iPersistent = pPersistent; - this.iBufferedOS = new ByteArrayOutputStream(); - if (pChunked) { - this.iClientOS = new ASCIIPrintStream(new ChunkedOutputStream( - new PersistentOutputStream(this.iBufferedOS, pPersistent), 512)); - } else { - this.iClientOS = new ASCIIPrintStream(new PersistentOutputStream(this.iBufferedOS, - pPersistent)); - } - this.iHeader = new HttpHeader(); - this.iMethod = new HttpServerMethod(HttpConnectionHandler.MAJOR_VERSION, - HttpConnectionHandler.MINOR_VERSION, 200, "OK"); - } - - /** - * Resets the stream - */ - public void reset() { - this.iBufferedOS.reset(); - } - - /** - * Sets the http header - * - * @param header - * The new value - */ - public void setHeader(HttpHeader header) { - this.iHeader = header; - } - - /** - * Sets the http server method - * - * @param method - * The new value - */ - public void setMethod(HttpServerMethod method) { - this.iMethod = method; - } - - /** - * Returns the http header - * - * @return The http header - */ - public HttpHeader getHeader() { - return this.iHeader; - } - - /** - * Returns the http server method - * - * @return The http server method - */ - public HttpServerMethod getMethod() { - return this.iMethod; - } - - /** - * Returns the output stream - * - * @return The output stream - */ - public ASCIIPrintStream getOutputStream() { - return this.iClientOS; - } - - /** - * Write the message and flushes the streams - * - * @throws IOException - */ - public void close() throws IOException { - this.iMethod.write(this.iRealOS); - this.iRealOS.flush(); - if (!this.iChunked) this.iHeader.removeField("Transfer-Encoding"); - else this.iHeader.addField("Transfer-Encoding", "chunked"); - if (this.iPersistent) this.iHeader.addField("Connection", "Keep-iAlive"); - else this.iHeader.addField("Connection", "close"); - - this.iHeader.addField("Content-Type", "application/xml;charset=\"utf-8\""); - if (!this.iChunked) this.iHeader.addField("Content-length", Integer - .toString(this.iBufferedOS.size())); - LogAndTraceBroker.getBroker().trace(Level.FINER, - "Indication Response HTTP Headers= " + this.iHeader.toString()); - this.iHeader.write(this.iRealOS); - this.iRealOS.flush(); - if (this.iChunked) this.iClientOS.close(); - this.iBufferedOS.writeTo(this.iRealOS); - if (this.iChunked && (this.iTrailer != null)) { - LogAndTraceBroker.getBroker().trace(Level.FINER, - "Indication Response HTTP Trailer Headers= " + this.iTrailer.toString()); - this.iTrailer.write(this.iRealOS); - } - this.iRealOS.flush(); - } - - /** - * Sets the trailer - * - * @param pTrailer - * The new value - */ - public void setTrailer(HttpHeader pTrailer) { - this.iTrailer = pTrailer; - } -} +/* + (C) Copyright IBM Corp. 2005, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 17620 2005-06-29 thschaef eliminate ASCIIPrintStream1 in import statement + * 1535756 2006-08-07 lupusalex Make code warning free + * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 3304058 2011-05-20 blaschke-oss Use same date format in change history + * 3601894 2013-01-23 blaschke-oss Enhance HTTP and CIM-XML tracing + * 2620 2013-02-23 blaschke-oss Chunked output broken + */ + +package org.metricshub.wbem.sblim.cimclient.internal.http; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.util.logging.Level; + +import org.metricshub.wbem.sblim.cimclient.internal.http.io.ASCIIPrintStream; +import org.metricshub.wbem.sblim.cimclient.internal.http.io.ChunkedOutputStream; +import org.metricshub.wbem.sblim.cimclient.internal.http.io.PersistentOutputStream; +import org.metricshub.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; + +/** + * Class MessageWriter is responsible for creating http messages + * + */ +public class MessageWriter { + + HttpHeader iHeader = null; + + HttpServerMethod iMethod = null; + + HttpHeader iTrailer = null; + + boolean iChunked = false; + + boolean iPersistent = false; + + ASCIIPrintStream iRealOS; + + ASCIIPrintStream iClientOS; + + ByteArrayOutputStream iBufferedOS; + + /** + * Ctor. + * + * @param pStream + * @param pPersistent + * @param pChunked + */ + public MessageWriter(OutputStream pStream, boolean pPersistent, boolean pChunked) { + this.iRealOS = new ASCIIPrintStream(pStream); + this.iChunked = pChunked; + this.iPersistent = pPersistent; + this.iBufferedOS = new ByteArrayOutputStream(); + if (pChunked) { + this.iClientOS = new ASCIIPrintStream(new ChunkedOutputStream( + new PersistentOutputStream(this.iBufferedOS, pPersistent), 512)); + } else { + this.iClientOS = new ASCIIPrintStream(new PersistentOutputStream(this.iBufferedOS, + pPersistent)); + } + this.iHeader = new HttpHeader(); + this.iMethod = new HttpServerMethod(HttpConnectionHandler.MAJOR_VERSION, + HttpConnectionHandler.MINOR_VERSION, 200, "OK"); + } + + /** + * Resets the stream + */ + public void reset() { + this.iBufferedOS.reset(); + } + + /** + * Sets the http header + * + * @param header + * The new value + */ + public void setHeader(HttpHeader header) { + this.iHeader = header; + } + + /** + * Sets the http server method + * + * @param method + * The new value + */ + public void setMethod(HttpServerMethod method) { + this.iMethod = method; + } + + /** + * Returns the http header + * + * @return The http header + */ + public HttpHeader getHeader() { + return this.iHeader; + } + + /** + * Returns the http server method + * + * @return The http server method + */ + public HttpServerMethod getMethod() { + return this.iMethod; + } + + /** + * Returns the output stream + * + * @return The output stream + */ + public ASCIIPrintStream getOutputStream() { + return this.iClientOS; + } + + /** + * Write the message and flushes the streams + * + * @throws IOException + */ + public void close() throws IOException { + this.iMethod.write(this.iRealOS); + this.iRealOS.flush(); + if (!this.iChunked) this.iHeader.removeField("Transfer-Encoding"); + else this.iHeader.addField("Transfer-Encoding", "chunked"); + if (this.iPersistent) this.iHeader.addField("Connection", "Keep-iAlive"); + else this.iHeader.addField("Connection", "close"); + + this.iHeader.addField("Content-Type", "application/xml;charset=\"utf-8\""); + if (!this.iChunked) this.iHeader.addField("Content-length", Integer + .toString(this.iBufferedOS.size())); + LogAndTraceBroker.getBroker().trace(Level.FINER, + "Indication Response HTTP Headers= " + this.iHeader.toString()); + this.iHeader.write(this.iRealOS); + this.iRealOS.flush(); + if (this.iChunked) this.iClientOS.close(); + this.iBufferedOS.writeTo(this.iRealOS); + if (this.iChunked && (this.iTrailer != null)) { + LogAndTraceBroker.getBroker().trace(Level.FINER, + "Indication Response HTTP Trailer Headers= " + this.iTrailer.toString()); + this.iTrailer.write(this.iRealOS); + } + this.iRealOS.flush(); + } + + /** + * Sets the trailer + * + * @param pTrailer + * The new value + */ + public void setTrailer(HttpHeader pTrailer) { + this.iTrailer = pTrailer; + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/PegasusLocalAuthInfo.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/PegasusLocalAuthInfo.java similarity index 79% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/PegasusLocalAuthInfo.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/PegasusLocalAuthInfo.java index 0d4e040..408539a 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/PegasusLocalAuthInfo.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/PegasusLocalAuthInfo.java @@ -1,182 +1,180 @@ -/* - (C) Copyright IBM Corp. 2006, 2010 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Alexander Wolf-Reber, IBM, a.wolf-reber@de.ibm.com - * - * Change History - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1516242 2006-07-05 lupusalex Support of OpenPegasus local authentication - * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant - * 1710066 2007-04-30 lupsualex LocalAuth fails for z/OS Pegasus - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors - * 3027618 2010-07-14 blaschke-oss Close files/readers in finally blocks - */ -package org.sentrysoftware.wbem.sblim.cimclient.internal.http; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.net.URI; -import java.util.logging.Level; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; -import org.sentrysoftware.wbem.sblim.cimclient.internal.logging.Messages; -import org.sentrysoftware.wbem.sblim.cimclient.internal.util.WBEMConstants; - -/** - * Implements OpenPegasus local authentication - */ -public class PegasusLocalAuthInfo extends AuthorizationInfo { - - private boolean iChallenged = false; - - /** - * Default ctor. - */ - public PegasusLocalAuthInfo() { - super(); - } - - /* - * (non-Javadoc) - * - * @see - * org.sblim.cimclient.internal.http.AuthorizationInfo#updateAuthenticationInfo - * (org.sblim.cimclient.internal.http.Challenge, java.net.URI, - * java.lang.String) - */ - /** - * @param challenge - * @param authenticate - * @param url - * @param requestMethod - */ - @Override - public void updateAuthenticationInfo(Challenge challenge, String authenticate, URI url, - String requestMethod) { - this.iChallenged = true; - this.iResponse = authenticate; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - - if (this.iChallenged && this.iResponse != null && this.iResponse.startsWith("Local ")) { - - String fileName = ""; - BufferedReader in = null; - - try { - - fileName = this.iResponse.substring(7, this.iResponse.length() - 1); - - if (fileName.length() == 0) throw new IOException( - "No local authorization file specified"); - - File authorizationFile = new File(fileName); - - if (!authorizationFile.canRead()) throw new IOException( - "Local authorization file not accessible"); - - in = WBEMConstants.Z_OS.equals(System.getProperty(WBEMConstants.OS_NAME)) ? new BufferedReader( - new InputStreamReader(new FileInputStream(authorizationFile), - WBEMConstants.ISO_8859_1)) - : new BufferedReader(new FileReader(authorizationFile)); - - StringBuffer buffer = new StringBuffer(); - String line; - - while (true) { - line = in.readLine(); - if (line == null) break; - buffer.append(line); - } - - StringBuffer header = new StringBuffer(); - header.append("Local \""); - header.append(getCredentials().getUserName()); - header.append(':'); - header.append(fileName); - header.append(':'); - header.append(buffer); - header.append('"'); - - return header.toString(); - - } catch (IOException e) { - LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); - logger.trace(Level.FINER, - "Exception while reading OpenPegasus local authorization file", e); - logger.message(Messages.HTTP_PEGASUS_LOCAL_AUTH_READ, fileName); - } finally { - if (in != null) { - try { - in.close(); - } catch (IOException e) { - LogAndTraceBroker.getBroker().trace(Level.FINER, - "Exception while closing OpenPegasus local authorization file", e); - } - } - } - } - - return "Local \"" + getCredentials().getUserName() + "\""; - } - - @Override - public String getHeaderFieldName() { - return "PegasusAuthorization"; - } - - @Override - public boolean isSentOnFirstRequest() { - return true; - } - - @Override - public boolean isKeptAlive() { - return true; - } - -} +/* + (C) Copyright IBM Corp. 2006, 2010 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Alexander Wolf-Reber, IBM, a.wolf-reber@de.ibm.com + * + * Change History + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1516242 2006-07-05 lupusalex Support of OpenPegasus local authentication + * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant + * 1710066 2007-04-30 lupsualex LocalAuth fails for z/OS Pegasus + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors + * 3027618 2010-07-14 blaschke-oss Close files/readers in finally blocks + */ +package org.metricshub.wbem.sblim.cimclient.internal.http; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.URI; +import java.util.logging.Level; + +import org.metricshub.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; +import org.metricshub.wbem.sblim.cimclient.internal.logging.Messages; +import org.metricshub.wbem.sblim.cimclient.internal.util.WBEMConstants; + +/** + * Implements OpenPegasus local authentication + */ +public class PegasusLocalAuthInfo extends AuthorizationInfo { + + private boolean iChallenged = false; + + /** + * Default ctor. + */ + public PegasusLocalAuthInfo() { + super(); + } + + /* + * (non-Javadoc) + * + * @see + * org.sblim.cimclient.internal.http.AuthorizationInfo#updateAuthenticationInfo + * (org.sblim.cimclient.internal.http.Challenge, java.net.URI, + * java.lang.String) + */ + /** + * @param challenge + * @param authenticate + * @param url + * @param requestMethod + */ + @Override + public void updateAuthenticationInfo(Challenge challenge, String authenticate, URI url, + String requestMethod) { + this.iChallenged = true; + this.iResponse = authenticate; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + + if (this.iChallenged && this.iResponse != null && this.iResponse.startsWith("Local ")) { + + String fileName = ""; + BufferedReader in = null; + + try { + + fileName = this.iResponse.substring(7, this.iResponse.length() - 1); + + if (fileName.length() == 0) throw new IOException( + "No local authorization file specified"); + + File authorizationFile = new File(fileName); + + if (!authorizationFile.canRead()) throw new IOException( + "Local authorization file not accessible"); + + in = WBEMConstants.Z_OS.equals(System.getProperty(WBEMConstants.OS_NAME)) ? new BufferedReader( + new InputStreamReader(new FileInputStream(authorizationFile), + WBEMConstants.ISO_8859_1)) + : new BufferedReader(new FileReader(authorizationFile)); + + StringBuffer buffer = new StringBuffer(); + String line; + + while (true) { + line = in.readLine(); + if (line == null) break; + buffer.append(line); + } + + StringBuffer header = new StringBuffer(); + header.append("Local \""); + header.append(getCredentials().getUserName()); + header.append(':'); + header.append(fileName); + header.append(':'); + header.append(buffer); + header.append('"'); + + return header.toString(); + + } catch (IOException e) { + LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); + logger.trace(Level.FINER, + "Exception while reading OpenPegasus local authorization file", e); + logger.message(Messages.HTTP_PEGASUS_LOCAL_AUTH_READ, fileName); + } finally { + if (in != null) { + try { + in.close(); + } catch (IOException e) { + LogAndTraceBroker.getBroker().trace(Level.FINER, + "Exception while closing OpenPegasus local authorization file", e); + } + } + } + } + + return "Local \"" + getCredentials().getUserName() + "\""; + } + + @Override + public String getHeaderFieldName() { + return "PegasusAuthorization"; + } + + @Override + public boolean isSentOnFirstRequest() { + return true; + } + + @Override + public boolean isKeptAlive() { + return true; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/WwwAuthInfo.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/WwwAuthInfo.java similarity index 90% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/WwwAuthInfo.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/WwwAuthInfo.java index c0eabdc..b9dd392 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/WwwAuthInfo.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/WwwAuthInfo.java @@ -1,361 +1,359 @@ -/* - (C) Copyright IBM Corp. 2006, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Alexander Wolf-Reber, IBM, a.wolf-reber@de.ibm.com - * - * Change History - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1536711 2006-08-15 lupusalex NullPointerException causes client call to never return - * 1516242 2006-11-27 lupusalex Support of OpenPegasus local authentication - * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant - * 1627832 2007-01-08 lupuslaex Incorrect retry behaviour on HTTP 401 - * 1892046 2008-02-13 blaschke-oss Basic/digest authentication problem for Japanese users - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2714989 2009-03-26 blaschke-oss Code cleanup from redundant null check et al - */ -package org.sentrysoftware.wbem.sblim.cimclient.internal.http; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.UnsupportedEncodingException; -import java.net.PasswordAuthentication; -import java.net.URI; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; -import java.util.Vector; - -/** - * Implements HTTP basic and digest authentication - */ -public class WwwAuthInfo extends AuthorizationInfo { - - /** - * Default ctor. - */ - public WwwAuthInfo() { - super(); - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - StringBuffer result = new StringBuffer(); - - String _nc = Long.toHexString(this.iNc); - - if (this.iScheme.equalsIgnoreCase("Digest")) { - - if (this.iRealm == null) { // support for some ICAT CIMOMs buggy - // Digest authentication - try { - MessageDigest messageDigest = null; - messageDigest = MessageDigest.getInstance("MD5"); - - messageDigest.update(getBytes((this.iCredentials != null && this.iCredentials - .getUserName() != null) ? String.valueOf(this.iCredentials - .getPassword()) : "null", "UTF-8")); - String pass = HttpClient.convertToHexString(messageDigest.digest()); - return "Digest username=" - + ((this.iCredentials != null && this.iCredentials.getUserName() != null) ? this.iCredentials - .getUserName() - : "null") + ", response=" + pass; - } catch (NoSuchAlgorithmException e) { - // TODO log - e.printStackTrace(); - } - } - - result.append(this.iScheme); - result.append(" username=\""); - result - .append((this.iCredentials != null && this.iCredentials.getUserName() != null) ? this.iCredentials - .getUserName() - : "null"); - result.append("\""); - if (this.iRealm != null) { - result.append(", realm=\""); - result.append(this.iRealm); - result.append("\""); - } - if (this.iNonce != null) { - result.append(", nonce=\""); - result.append(this.iNonce); - result.append("\""); - } - result.append(", uri=\""); - result.append(this.iUri); - result.append("\", response=\""); - result.append(this.iResponse); - result.append("\""); - // if (algorithm != null) { - // result.append(", algorithm="); - // result.append(algorithm); - // } - if (this.iCnonce != null) { - result.append(", cnonce=\""); - result.append(this.iCnonce); - result.append("\""); - } - if (this.iOpaque != null) { - result.append(", opaque=\""); - result.append(this.iOpaque); - result.append("\""); - } - if (this.iQop != null) { - result.append(", qop="); - result.append(this.iQop); - } - if (this.iNc > -1) { - result.append(", nc="); - result.append("00000000".substring(_nc.length())); - result.append(_nc); - } - } else if (this.iScheme.equalsIgnoreCase("Basic")) { - - result.append("Basic "); - - StringBuffer tmp = new StringBuffer(); - tmp - .append((this.iCredentials != null && this.iCredentials.getUserName() != null) ? this.iCredentials - .getUserName() - : "null"); - tmp.append(':'); - tmp - .append((this.iCredentials != null && this.iCredentials.getPassword() != null) ? String - .valueOf(this.iCredentials.getPassword()) - : "null"); - - result.append(BASE64Encoder.encode(getBytes(tmp.toString(), "UTF-8"))); - } - return result.toString(); - } - - /** - * Splits a comma-separated string into multiple substrings - * - * @param pLine - * The comma-separated string - * @return The array of substrings (excluding commas) - */ - public static String[] split(String pLine) { - Vector elem = new Vector(); - int start = 0; - int end; - while ((end = pLine.indexOf(',')) > -1) { - elem.add(pLine.substring(start, end)); - start = end + 1; - } - if (end < pLine.length()) elem.add(pLine.substring(start)); - String[] result = new String[elem.size()]; - elem.toArray(result); - return result; - } - - private static byte[] getBytes(String str, String encoding) { - byte[] bytes; - try { - bytes = str.getBytes(encoding); - } catch (UnsupportedEncodingException e) { - bytes = str.getBytes(); - } - return bytes; - } - - /* - * (non-Javadoc) - * - * @see - * org.sblim.cimclient.internal.http.AuthorizationInfo#updateAuthenticationInfo - * (org.sblim.cimclient.internal.http.Challenge, java.net.URI, - * java.lang.String) - */ - /** - * @param authenticate - */ - @Override - public void updateAuthenticationInfo(Challenge challenge, String authenticate, URI url, - String requestMethod) throws NoSuchAlgorithmException { - - setURI(url.getPath()); - HttpHeader params = challenge.getParams(); - - this.iScheme = challenge.getScheme(); - - if (!this.iScheme.equalsIgnoreCase("Digest")) { return; } - - this.iRealm = params.getField("realm"); - - String algorithm = params.getField("algorithm"); - String opaque = params.getField("opaque"); - String nonce = params.getField("nonce"); - String qop = params.getField("qop"); - - this.iAlgorithm = (algorithm != null) ? algorithm : this.iAlgorithm; - this.iOpaque = (opaque != null) ? opaque : this.iOpaque; - this.iNonce = (nonce != null) ? nonce : this.iNonce; - this.iQop = (qop != null) ? qop : this.iQop; - - MessageDigest messageDigest = null; - - messageDigest = MessageDigest.getInstance("MD5"); - - if (qop != null || ("md5-sess".equalsIgnoreCase(algorithm))) { - long time = System.currentTimeMillis(); - byte[] b = new byte[8]; - - b[0] = (byte) ((time >> 0) & 0xFF); - b[1] = (byte) ((time >> 8) & 0xFF); - b[2] = (byte) ((time >> 16) & 0xFF); - b[3] = (byte) ((time >> 24) & 0xFF); - b[4] = (byte) ((time >> 32) & 0xFF); - b[5] = (byte) ((time >> 40) & 0xFF); - b[6] = (byte) ((time >> 48) & 0xFF); - b[7] = (byte) ((time >> 56) & 0xFF); - - messageDigest.reset(); - messageDigest.update(b); - - this.iCnonce = HttpClient.convertToHexString(messageDigest.digest()); - } - if (qop != null) { - String[] list_qop = split(qop); - for (int i = 0; i < list_qop.length; i++) { - if (list_qop[i].equalsIgnoreCase("auth-int")) { - qop = "auth-int"; // this one has higher priority - break; - } - if ((list_qop[i].equalsIgnoreCase("auth"))) qop = "auth"; - } - setQop(qop); - } - String nc1 = params.getField("nc"); - long challengeNc = 1; - if (nc1 != null) { - try { - challengeNc = Long.parseLong(nc1, 16); - } catch (Exception e) { - // Logger logger = SessionProperties.getGlobalProperties() - // .getLogger(); - // if (logger.isLoggable(Level.WARNING)) { - // logger.log(Level.WARNING, - // "exception while parsing challenge NC", e); - // } - } - if (getNc() == challengeNc) { - setNc(++challengeNc); - } - } else { - setNc(challengeNc = 1); - } - - messageDigest.reset(); - PasswordAuthentication credentials1 = getCredentials(); - this.iA1 = credentials1.getUserName() + ":" + getRealm() + ":" - + String.valueOf(credentials1.getPassword()); - // System.out.println("Base:"+A1); - messageDigest.update(getBytes(this.iA1, "UTF-8")); - - if ("md5-sess".equalsIgnoreCase(algorithm)) { - messageDigest.update(getBytes((":" + getNonce() + ":" + getCnonce()), "UTF-8")); - - } - - byte[] digest1 = messageDigest.digest(); - String sessionKey = HttpClient.convertToHexString(digest1); - - // System.out.println("A1:"+sessionKey); - String method = requestMethod; - - // if (con instanceof HttpURLConnection) - // method = ((HttpURLConnection) con).getRequestMethod(); - - String A2 = method + ":" + getURI(); - - if ("auth-int".equalsIgnoreCase(qop)) { - messageDigest.reset(); - // messageDigest.update(readFully(con)); //TODO - messageDigest.update(new byte[] {}); // TODO this must be the - // entity body, not the - // message body - A2 = A2 + ":" + HttpClient.convertToHexString(messageDigest.digest()); - } - messageDigest.reset(); - messageDigest.update(getBytes(A2, "UTF-8")); - A2 = HttpClient.convertToHexString(messageDigest.digest()); - - messageDigest.reset(); - if (qop == null) { - messageDigest.update(getBytes((sessionKey + ":" + nonce + ":" + A2), "UTF-8")); - } else { - String _nc = Long.toHexString(challengeNc); - messageDigest.update(getBytes((sessionKey + ":" + nonce + ":" - + "00000000".substring(_nc.length()) + _nc + ":" + getCnonce() + ":" + qop - + ":" + A2), "UTF-8")); - } - this.iResponse = HttpClient.convertToHexString(messageDigest.digest()); - - // TODO handle digest-required header - } - - /* - * (non-Javadoc) - * - * @see - * org.sblim.cimclient.internal.http.AuthorizationInfo#getHeaderFieldName() - */ - @Override - public String getHeaderFieldName() { - return "Authorization"; - } - - /* - * (non-Javadoc) - * - * @see - * org.sblim.cimclient.internal.http.AuthorizationInfo#isSentOnFirstRequest - * () - */ - @Override - public boolean isSentOnFirstRequest() { - return false; - } - - @Override - public boolean isKeptAlive() { - return true; - } -} +/* + (C) Copyright IBM Corp. 2006, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Alexander Wolf-Reber, IBM, a.wolf-reber@de.ibm.com + * + * Change History + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1536711 2006-08-15 lupusalex NullPointerException causes client call to never return + * 1516242 2006-11-27 lupusalex Support of OpenPegasus local authentication + * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant + * 1627832 2007-01-08 lupuslaex Incorrect retry behaviour on HTTP 401 + * 1892046 2008-02-13 blaschke-oss Basic/digest authentication problem for Japanese users + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2714989 2009-03-26 blaschke-oss Code cleanup from redundant null check et al + */ +package org.metricshub.wbem.sblim.cimclient.internal.http; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.UnsupportedEncodingException; +import java.net.PasswordAuthentication; +import java.net.URI; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.Vector; + +/** + * Implements HTTP basic and digest authentication + */ +public class WwwAuthInfo extends AuthorizationInfo { + + /** + * Default ctor. + */ + public WwwAuthInfo() { + super(); + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + StringBuffer result = new StringBuffer(); + + String _nc = Long.toHexString(this.iNc); + + if (this.iScheme.equalsIgnoreCase("Digest")) { + + if (this.iRealm == null) { // support for some ICAT CIMOMs buggy + // Digest authentication + try { + MessageDigest messageDigest = null; + messageDigest = MessageDigest.getInstance("MD5"); + + messageDigest.update(getBytes((this.iCredentials != null && this.iCredentials + .getUserName() != null) ? String.valueOf(this.iCredentials + .getPassword()) : "null", "UTF-8")); + String pass = HttpClient.convertToHexString(messageDigest.digest()); + return "Digest username=" + + ((this.iCredentials != null && this.iCredentials.getUserName() != null) ? this.iCredentials + .getUserName() + : "null") + ", response=" + pass; + } catch (NoSuchAlgorithmException e) { + // TODO log + e.printStackTrace(); + } + } + + result.append(this.iScheme); + result.append(" username=\""); + result + .append((this.iCredentials != null && this.iCredentials.getUserName() != null) ? this.iCredentials + .getUserName() + : "null"); + result.append("\""); + if (this.iRealm != null) { + result.append(", realm=\""); + result.append(this.iRealm); + result.append("\""); + } + if (this.iNonce != null) { + result.append(", nonce=\""); + result.append(this.iNonce); + result.append("\""); + } + result.append(", uri=\""); + result.append(this.iUri); + result.append("\", response=\""); + result.append(this.iResponse); + result.append("\""); + // if (algorithm != null) { + // result.append(", algorithm="); + // result.append(algorithm); + // } + if (this.iCnonce != null) { + result.append(", cnonce=\""); + result.append(this.iCnonce); + result.append("\""); + } + if (this.iOpaque != null) { + result.append(", opaque=\""); + result.append(this.iOpaque); + result.append("\""); + } + if (this.iQop != null) { + result.append(", qop="); + result.append(this.iQop); + } + if (this.iNc > -1) { + result.append(", nc="); + result.append("00000000".substring(_nc.length())); + result.append(_nc); + } + } else if (this.iScheme.equalsIgnoreCase("Basic")) { + + result.append("Basic "); + + StringBuffer tmp = new StringBuffer(); + tmp + .append((this.iCredentials != null && this.iCredentials.getUserName() != null) ? this.iCredentials + .getUserName() + : "null"); + tmp.append(':'); + tmp + .append((this.iCredentials != null && this.iCredentials.getPassword() != null) ? String + .valueOf(this.iCredentials.getPassword()) + : "null"); + + result.append(BASE64Encoder.encode(getBytes(tmp.toString(), "UTF-8"))); + } + return result.toString(); + } + + /** + * Splits a comma-separated string into multiple substrings + * + * @param pLine + * The comma-separated string + * @return The array of substrings (excluding commas) + */ + public static String[] split(String pLine) { + Vector elem = new Vector(); + int start = 0; + int end; + while ((end = pLine.indexOf(',')) > -1) { + elem.add(pLine.substring(start, end)); + start = end + 1; + } + if (end < pLine.length()) elem.add(pLine.substring(start)); + String[] result = new String[elem.size()]; + elem.toArray(result); + return result; + } + + private static byte[] getBytes(String str, String encoding) { + byte[] bytes; + try { + bytes = str.getBytes(encoding); + } catch (UnsupportedEncodingException e) { + bytes = str.getBytes(); + } + return bytes; + } + + /* + * (non-Javadoc) + * + * @see + * org.sblim.cimclient.internal.http.AuthorizationInfo#updateAuthenticationInfo + * (org.sblim.cimclient.internal.http.Challenge, java.net.URI, + * java.lang.String) + */ + /** + * @param authenticate + */ + @Override + public void updateAuthenticationInfo(Challenge challenge, String authenticate, URI url, + String requestMethod) throws NoSuchAlgorithmException { + + setURI(url.getPath()); + HttpHeader params = challenge.getParams(); + + this.iScheme = challenge.getScheme(); + + if (!this.iScheme.equalsIgnoreCase("Digest")) { return; } + + this.iRealm = params.getField("realm"); + + String algorithm = params.getField("algorithm"); + String opaque = params.getField("opaque"); + String nonce = params.getField("nonce"); + String qop = params.getField("qop"); + + this.iAlgorithm = (algorithm != null) ? algorithm : this.iAlgorithm; + this.iOpaque = (opaque != null) ? opaque : this.iOpaque; + this.iNonce = (nonce != null) ? nonce : this.iNonce; + this.iQop = (qop != null) ? qop : this.iQop; + + MessageDigest messageDigest = null; + + messageDigest = MessageDigest.getInstance("MD5"); + + if (qop != null || ("md5-sess".equalsIgnoreCase(algorithm))) { + long time = System.currentTimeMillis(); + byte[] b = new byte[8]; + + b[0] = (byte) ((time >> 0) & 0xFF); + b[1] = (byte) ((time >> 8) & 0xFF); + b[2] = (byte) ((time >> 16) & 0xFF); + b[3] = (byte) ((time >> 24) & 0xFF); + b[4] = (byte) ((time >> 32) & 0xFF); + b[5] = (byte) ((time >> 40) & 0xFF); + b[6] = (byte) ((time >> 48) & 0xFF); + b[7] = (byte) ((time >> 56) & 0xFF); + + messageDigest.reset(); + messageDigest.update(b); + + this.iCnonce = HttpClient.convertToHexString(messageDigest.digest()); + } + if (qop != null) { + String[] list_qop = split(qop); + for (int i = 0; i < list_qop.length; i++) { + if (list_qop[i].equalsIgnoreCase("auth-int")) { + qop = "auth-int"; // this one has higher priority + break; + } + if ((list_qop[i].equalsIgnoreCase("auth"))) qop = "auth"; + } + setQop(qop); + } + String nc1 = params.getField("nc"); + long challengeNc = 1; + if (nc1 != null) { + try { + challengeNc = Long.parseLong(nc1, 16); + } catch (Exception e) { + // Logger logger = SessionProperties.getGlobalProperties() + // .getLogger(); + // if (logger.isLoggable(Level.WARNING)) { + // logger.log(Level.WARNING, + // "exception while parsing challenge NC", e); + // } + } + if (getNc() == challengeNc) { + setNc(++challengeNc); + } + } else { + setNc(challengeNc = 1); + } + + messageDigest.reset(); + PasswordAuthentication credentials1 = getCredentials(); + this.iA1 = credentials1.getUserName() + ":" + getRealm() + ":" + + String.valueOf(credentials1.getPassword()); + // System.out.println("Base:"+A1); + messageDigest.update(getBytes(this.iA1, "UTF-8")); + + if ("md5-sess".equalsIgnoreCase(algorithm)) { + messageDigest.update(getBytes((":" + getNonce() + ":" + getCnonce()), "UTF-8")); + + } + + byte[] digest1 = messageDigest.digest(); + String sessionKey = HttpClient.convertToHexString(digest1); + + // System.out.println("A1:"+sessionKey); + String method = requestMethod; + + // if (con instanceof HttpURLConnection) + // method = ((HttpURLConnection) con).getRequestMethod(); + + String A2 = method + ":" + getURI(); + + if ("auth-int".equalsIgnoreCase(qop)) { + messageDigest.reset(); + // messageDigest.update(readFully(con)); //TODO + messageDigest.update(new byte[] {}); // TODO this must be the + // entity body, not the + // message body + A2 = A2 + ":" + HttpClient.convertToHexString(messageDigest.digest()); + } + messageDigest.reset(); + messageDigest.update(getBytes(A2, "UTF-8")); + A2 = HttpClient.convertToHexString(messageDigest.digest()); + + messageDigest.reset(); + if (qop == null) { + messageDigest.update(getBytes((sessionKey + ":" + nonce + ":" + A2), "UTF-8")); + } else { + String _nc = Long.toHexString(challengeNc); + messageDigest.update(getBytes((sessionKey + ":" + nonce + ":" + + "00000000".substring(_nc.length()) + _nc + ":" + getCnonce() + ":" + qop + + ":" + A2), "UTF-8")); + } + this.iResponse = HttpClient.convertToHexString(messageDigest.digest()); + + // TODO handle digest-required header + } + + /* + * (non-Javadoc) + * + * @see + * org.sblim.cimclient.internal.http.AuthorizationInfo#getHeaderFieldName() + */ + @Override + public String getHeaderFieldName() { + return "Authorization"; + } + + /* + * (non-Javadoc) + * + * @see + * org.sblim.cimclient.internal.http.AuthorizationInfo#isSentOnFirstRequest + * () + */ + @Override + public boolean isSentOnFirstRequest() { + return false; + } + + @Override + public boolean isKeptAlive() { + return true; + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/io/ASCIIPrintStream.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/ASCIIPrintStream.java similarity index 86% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/io/ASCIIPrintStream.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/ASCIIPrintStream.java index 0558eb0..b384ecd 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/io/ASCIIPrintStream.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/ASCIIPrintStream.java @@ -1,429 +1,427 @@ -/* - (C) Copyright IBM Corp. 2005, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 18045 2005-08-10 pineiro5 Some code clean up in multiple points - * 1535756 2006-08-07 lupusalex Make code warning free - * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2714989 2009-03-26 blaschke-oss Code cleanup from redundant null check et al - */ -package org.sentrysoftware.wbem.sblim.cimclient.internal.http.io; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.BufferedWriter; -import java.io.FilterOutputStream; -import java.io.IOException; -import java.io.InterruptedIOException; -import java.io.OutputStream; -import java.io.OutputStreamWriter; - -/** - * Class ASCIIPrintStream implement a stream with ASCII charset - * - */ -public class ASCIIPrintStream extends FilterOutputStream { - - private boolean iAutoFlush = false; - - private Exception iTrouble = null; - - private BufferedWriter iTextOut; - - private ASCIIPrintStream(boolean autoFlush, OutputStream pOut) { - super(pOut); - if (pOut == null) throw new NullPointerException("Null output stream"); - this.iAutoFlush = autoFlush; - } - - /** - * Ctor. - * - * @param pStream - * The underlying stream - */ - public ASCIIPrintStream(OutputStream pStream) { - this(pStream, false); - init(new OutputStreamWriter(this)); - } - - /** - * Ctor. - * - * @param pStream - * The underlying stream - * @param pAutoFlush - * If true the stream is automatically flushed after - * write. - */ - public ASCIIPrintStream(OutputStream pStream, boolean pAutoFlush) { - this(pAutoFlush, pStream); - init(new OutputStreamWriter(this.out)); - } - - /** - * Ctor. - * - * @param pStream - * The underlying stream - * @param pAutoFlush - * If true the stream is automatically flushed after - * write. - * @param pEncoding - * Ignored - */ - public ASCIIPrintStream(OutputStream pStream, boolean pAutoFlush, String pEncoding) { - this(pStream, pAutoFlush); - } - - private void init(OutputStreamWriter osw) { - this.iTextOut = new BufferedWriter(osw); - } - - private void write(String str) { - int stringLength = str.length(); - char charArray[] = new char[stringLength]; - byte asciiArray[] = new byte[stringLength]; - str.getChars(0, stringLength, charArray, 0); - for (int i = 0; i < stringLength; i++) - asciiArray[i] = charArray[i] >= '\u0100' ? 63 : (byte) charArray[i]; - - write(asciiArray, 0, stringLength); - } - - /** - * Prints a boolean value - * - * @param pValue - * The value - */ - public void print(boolean pValue) { - write(pValue ? "true" : "false"); - } - - /** - * Prints a single character - * - * @param c - * The character - */ - public void print(char c) { - write(String.valueOf(c)); - } - - /** - * Prints an integer value - * - * @param i - * The value - */ - public void print(int i) { - write(String.valueOf(i)); - } - - /** - * Prints a long value - * - * @param l - * The value - */ - public void print(long l) { - write(String.valueOf(l)); - } - - /** - * Prints a float value - * - * @param f - * The value - */ - public void print(float f) { - write(String.valueOf(f)); - } - - /** - * Prints a double value - * - * @param d - * The value - */ - public void print(double d) { - write(String.valueOf(d)); - } - - /** - * Prints a character array - * - * @param pArray - * The array - */ - public void print(char pArray[]) { - write(String.valueOf(pArray)); - } - - /** - * Prints a string - * - * @param s - * The string - */ - public void print(String s) { - write(s == null ? "null" : s); - } - - /** - * Prints an object - * - * @param pObj - * The object - */ - public void print(Object pObj) { - write(String.valueOf(pObj)); - } - - /** - * Prints a newline - */ - public void println() { - newLine(); - } - - /** - * println - * - * @param flag - */ - public void println(boolean flag) { - synchronized (this) { - print(flag); - newLine(); - } - } - - /** - * println - * - * @param c - */ - public void println(char c) { - synchronized (this) { - print(c); - newLine(); - } - } - - /** - * println - * - * @param i - */ - public void println(int i) { - synchronized (this) { - print(i); - newLine(); - } - } - - /** - * println - * - * @param l - */ - public void println(long l) { - synchronized (this) { - print(l); - newLine(); - } - } - - /** - * println - * - * @param f - */ - public void println(float f) { - synchronized (this) { - print(f); - newLine(); - } - } - - /** - * println - * - * @param d - */ - public void println(double d) { - synchronized (this) { - print(d); - newLine(); - } - } - - /** - * println - * - * @param ac - */ - public void println(char ac[]) { - synchronized (this) { - print(ac); - newLine(); - } - } - - /** - * println - * - * @param s - */ - public void println(String s) { - synchronized (this) { - print(s); - newLine(); - } - } - - /** - * println - * - * @param obj - */ - public void println(Object obj) { - synchronized (this) { - print(obj); - newLine(); - } - } - - private void newLine() { - try { - synchronized (this) { - ensureOpen(); - this.iTextOut.newLine(); - if (this.iAutoFlush) this.out.flush(); - } - } catch (InterruptedIOException x) { - Thread.currentThread().interrupt(); - } catch (IOException x) { - this.iTrouble = x; - } - } - - @Override - public void write(byte buf[], int off, int len) { - try { - synchronized (this) { - ensureOpen(); - this.out.write(buf, off, len); - // i ++; - if (this.iAutoFlush) this.out.flush(); - } - // System.out.println("TOTAL:"+i); - } catch (InterruptedIOException x) { - Thread.currentThread().interrupt(); - } catch (IOException x) { - this.iTrouble = x; - } - } - - @Override - public void write(int b) { - try { - synchronized (this) { - ensureOpen(); - this.out.write(b); - if ((b == '\n') && this.iAutoFlush) this.out.flush(); - } - } catch (InterruptedIOException x) { - Thread.currentThread().interrupt(); - } catch (IOException x) { - this.iTrouble = x; - } - } - - protected void setError() { - // trouble = x; - } - - /** - * Returns the last exception caught - * - * @return The exception - */ - public Exception checkError() { - if (this.out != null) flush(); - return this.iTrouble; - } - - @Override - public void close() { - synchronized (this) { - if (!this.closing) { - this.closing = true; - try { - this.iTextOut.close(); - this.out.close(); - } catch (IOException x) { - this.iTrouble = x; - } - this.iTextOut = null; - // iCharOut = null; - this.out = null; - } - } - } - - @Override - public void flush() { - synchronized (this) { - try { - ensureOpen(); - this.out.flush(); - } catch (IOException x) { - this.iTrouble = x; - } - } - } - - private boolean closing = false; - - private void ensureOpen() throws IOException { - if (this.out == null) throw new IOException("Stream closed"); - } -} +/* + (C) Copyright IBM Corp. 2005, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 18045 2005-08-10 pineiro5 Some code clean up in multiple points + * 1535756 2006-08-07 lupusalex Make code warning free + * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2714989 2009-03-26 blaschke-oss Code cleanup from redundant null check et al + */ +package org.metricshub.wbem.sblim.cimclient.internal.http.io; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.BufferedWriter; +import java.io.FilterOutputStream; +import java.io.IOException; +import java.io.InterruptedIOException; +import java.io.OutputStream; +import java.io.OutputStreamWriter; + +/** + * Class ASCIIPrintStream implement a stream with ASCII charset + * + */ +public class ASCIIPrintStream extends FilterOutputStream { + + private boolean iAutoFlush = false; + + private Exception iTrouble = null; + + private BufferedWriter iTextOut; + + private ASCIIPrintStream(boolean autoFlush, OutputStream pOut) { + super(pOut); + if (pOut == null) throw new NullPointerException("Null output stream"); + this.iAutoFlush = autoFlush; + } + + /** + * Ctor. + * + * @param pStream + * The underlying stream + */ + public ASCIIPrintStream(OutputStream pStream) { + this(pStream, false); + init(new OutputStreamWriter(this)); + } + + /** + * Ctor. + * + * @param pStream + * The underlying stream + * @param pAutoFlush + * If true the stream is automatically flushed after + * write. + */ + public ASCIIPrintStream(OutputStream pStream, boolean pAutoFlush) { + this(pAutoFlush, pStream); + init(new OutputStreamWriter(this.out)); + } + + /** + * Ctor. + * + * @param pStream + * The underlying stream + * @param pAutoFlush + * If true the stream is automatically flushed after + * write. + * @param pEncoding + * Ignored + */ + public ASCIIPrintStream(OutputStream pStream, boolean pAutoFlush, String pEncoding) { + this(pStream, pAutoFlush); + } + + private void init(OutputStreamWriter osw) { + this.iTextOut = new BufferedWriter(osw); + } + + private void write(String str) { + int stringLength = str.length(); + char charArray[] = new char[stringLength]; + byte asciiArray[] = new byte[stringLength]; + str.getChars(0, stringLength, charArray, 0); + for (int i = 0; i < stringLength; i++) + asciiArray[i] = charArray[i] >= '\u0100' ? 63 : (byte) charArray[i]; + + write(asciiArray, 0, stringLength); + } + + /** + * Prints a boolean value + * + * @param pValue + * The value + */ + public void print(boolean pValue) { + write(pValue ? "true" : "false"); + } + + /** + * Prints a single character + * + * @param c + * The character + */ + public void print(char c) { + write(String.valueOf(c)); + } + + /** + * Prints an integer value + * + * @param i + * The value + */ + public void print(int i) { + write(String.valueOf(i)); + } + + /** + * Prints a long value + * + * @param l + * The value + */ + public void print(long l) { + write(String.valueOf(l)); + } + + /** + * Prints a float value + * + * @param f + * The value + */ + public void print(float f) { + write(String.valueOf(f)); + } + + /** + * Prints a double value + * + * @param d + * The value + */ + public void print(double d) { + write(String.valueOf(d)); + } + + /** + * Prints a character array + * + * @param pArray + * The array + */ + public void print(char pArray[]) { + write(String.valueOf(pArray)); + } + + /** + * Prints a string + * + * @param s + * The string + */ + public void print(String s) { + write(s == null ? "null" : s); + } + + /** + * Prints an object + * + * @param pObj + * The object + */ + public void print(Object pObj) { + write(String.valueOf(pObj)); + } + + /** + * Prints a newline + */ + public void println() { + newLine(); + } + + /** + * println + * + * @param flag + */ + public void println(boolean flag) { + synchronized (this) { + print(flag); + newLine(); + } + } + + /** + * println + * + * @param c + */ + public void println(char c) { + synchronized (this) { + print(c); + newLine(); + } + } + + /** + * println + * + * @param i + */ + public void println(int i) { + synchronized (this) { + print(i); + newLine(); + } + } + + /** + * println + * + * @param l + */ + public void println(long l) { + synchronized (this) { + print(l); + newLine(); + } + } + + /** + * println + * + * @param f + */ + public void println(float f) { + synchronized (this) { + print(f); + newLine(); + } + } + + /** + * println + * + * @param d + */ + public void println(double d) { + synchronized (this) { + print(d); + newLine(); + } + } + + /** + * println + * + * @param ac + */ + public void println(char ac[]) { + synchronized (this) { + print(ac); + newLine(); + } + } + + /** + * println + * + * @param s + */ + public void println(String s) { + synchronized (this) { + print(s); + newLine(); + } + } + + /** + * println + * + * @param obj + */ + public void println(Object obj) { + synchronized (this) { + print(obj); + newLine(); + } + } + + private void newLine() { + try { + synchronized (this) { + ensureOpen(); + this.iTextOut.newLine(); + if (this.iAutoFlush) this.out.flush(); + } + } catch (InterruptedIOException x) { + Thread.currentThread().interrupt(); + } catch (IOException x) { + this.iTrouble = x; + } + } + + @Override + public void write(byte buf[], int off, int len) { + try { + synchronized (this) { + ensureOpen(); + this.out.write(buf, off, len); + // i ++; + if (this.iAutoFlush) this.out.flush(); + } + // System.out.println("TOTAL:"+i); + } catch (InterruptedIOException x) { + Thread.currentThread().interrupt(); + } catch (IOException x) { + this.iTrouble = x; + } + } + + @Override + public void write(int b) { + try { + synchronized (this) { + ensureOpen(); + this.out.write(b); + if ((b == '\n') && this.iAutoFlush) this.out.flush(); + } + } catch (InterruptedIOException x) { + Thread.currentThread().interrupt(); + } catch (IOException x) { + this.iTrouble = x; + } + } + + protected void setError() { + // trouble = x; + } + + /** + * Returns the last exception caught + * + * @return The exception + */ + public Exception checkError() { + if (this.out != null) flush(); + return this.iTrouble; + } + + @Override + public void close() { + synchronized (this) { + if (!this.closing) { + this.closing = true; + try { + this.iTextOut.close(); + this.out.close(); + } catch (IOException x) { + this.iTrouble = x; + } + this.iTextOut = null; + // iCharOut = null; + this.out = null; + } + } + } + + @Override + public void flush() { + synchronized (this) { + try { + ensureOpen(); + this.out.flush(); + } catch (IOException x) { + this.iTrouble = x; + } + } + } + + private boolean closing = false; + + private void ensureOpen() throws IOException { + if (this.out == null) throw new IOException("Stream closed"); + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/io/BoundedInputStream.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/BoundedInputStream.java similarity index 79% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/io/BoundedInputStream.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/BoundedInputStream.java index 5d2ac61..e066d22 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/io/BoundedInputStream.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/BoundedInputStream.java @@ -1,156 +1,154 @@ -/* - (C) Copyright IBM Corp. 2005, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.http.io; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.*; - -/** - * Class BoundedInputStream implements an input stream with a maximum byte - * count. - * - */ -public class BoundedInputStream extends FilterInputStream { - - private long maxLen, used; - - private boolean closed = false; - - /** - * Ctor. Creates the stream with unlimited length. - * - * @param pStream - * The stream this one is build upon - */ - public BoundedInputStream(InputStream pStream) { - this(pStream, -1); - } - - /** - * Ctor. - * - * @param pStream - * The stream this one is build upon - * @param pMaximumLength - * The maximum number of bytes that can be read from this stream. - * A value of -1 represents unlimited mode. - */ - public BoundedInputStream(InputStream pStream, long pMaximumLength) { - super(pStream); - this.maxLen = pMaximumLength; - this.used = 0; - this.in = pStream; - } - - @Override - public int read() throws IOException { - if (this.maxLen > -1) { - if (this.used >= this.maxLen) return -1; - - int value = this.in.read(); - if (value > -1) this.used++; - return value; - } - return this.in.read(); - } - - @Override - public int read(byte buf[]) throws IOException { - return read(buf, 0, buf.length); - } - - @Override - public int read(byte buf[], int off, int len) throws IOException { - if (this.closed) throw new IOException("I/O error - the stream is closed"); - - if (this.maxLen > -1) { - if (this.used >= this.maxLen) return -1; - - long min = ((this.used + len) > this.maxLen) ? this.maxLen - this.used : len; - int total = this.in.read(buf, off, (int) min); - if (total > -1) this.used += total; - return total; - } - return this.in.read(buf, off, len); - } - - @Override - public long skip(long len) throws IOException { - if (this.maxLen > -1) { - if (len >= 0) { - long min = ((this.used + len) > this.maxLen) ? this.maxLen - this.used : len; - long total = this.in.skip(min); - if (total > -1) { - this.used += total; - } - return total; - } - return -1; - } - return this.in.skip(len); - } - - @Override - public int available() throws IOException { - if (this.maxLen > -1) { return (int) (this.maxLen - this.used); } - return this.in.available(); - } - - @Override - public synchronized void close() throws IOException { - if (this.maxLen > -1) { - if (!this.closed) { - byte[] buf = new byte[512]; - while (read(buf, 0, buf.length) > -1) { - // empty - } - this.closed = true; - } - // else - // throw new IOException(); - } else { - this.in.close(); - } - } -} +/* + (C) Copyright IBM Corp. 2005, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.http.io; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.*; + +/** + * Class BoundedInputStream implements an input stream with a maximum byte + * count. + * + */ +public class BoundedInputStream extends FilterInputStream { + + private long maxLen, used; + + private boolean closed = false; + + /** + * Ctor. Creates the stream with unlimited length. + * + * @param pStream + * The stream this one is build upon + */ + public BoundedInputStream(InputStream pStream) { + this(pStream, -1); + } + + /** + * Ctor. + * + * @param pStream + * The stream this one is build upon + * @param pMaximumLength + * The maximum number of bytes that can be read from this stream. + * A value of -1 represents unlimited mode. + */ + public BoundedInputStream(InputStream pStream, long pMaximumLength) { + super(pStream); + this.maxLen = pMaximumLength; + this.used = 0; + this.in = pStream; + } + + @Override + public int read() throws IOException { + if (this.maxLen > -1) { + if (this.used >= this.maxLen) return -1; + + int value = this.in.read(); + if (value > -1) this.used++; + return value; + } + return this.in.read(); + } + + @Override + public int read(byte buf[]) throws IOException { + return read(buf, 0, buf.length); + } + + @Override + public int read(byte buf[], int off, int len) throws IOException { + if (this.closed) throw new IOException("I/O error - the stream is closed"); + + if (this.maxLen > -1) { + if (this.used >= this.maxLen) return -1; + + long min = ((this.used + len) > this.maxLen) ? this.maxLen - this.used : len; + int total = this.in.read(buf, off, (int) min); + if (total > -1) this.used += total; + return total; + } + return this.in.read(buf, off, len); + } + + @Override + public long skip(long len) throws IOException { + if (this.maxLen > -1) { + if (len >= 0) { + long min = ((this.used + len) > this.maxLen) ? this.maxLen - this.used : len; + long total = this.in.skip(min); + if (total > -1) { + this.used += total; + } + return total; + } + return -1; + } + return this.in.skip(len); + } + + @Override + public int available() throws IOException { + if (this.maxLen > -1) { return (int) (this.maxLen - this.used); } + return this.in.available(); + } + + @Override + public synchronized void close() throws IOException { + if (this.maxLen > -1) { + if (!this.closed) { + byte[] buf = new byte[512]; + while (read(buf, 0, buf.length) > -1) { + // empty + } + this.closed = true; + } + // else + // throw new IOException(); + } else { + this.in.close(); + } + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/io/ChunkedInputStream.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/ChunkedInputStream.java similarity index 83% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/io/ChunkedInputStream.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/ChunkedInputStream.java index ae4bc6c..87b36c4 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/io/ChunkedInputStream.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/ChunkedInputStream.java @@ -1,217 +1,215 @@ -/* - (C) Copyright IBM Corp. 2005, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 13799 2004-12-07 thschaef Fixes on chunking - * 1535756 2006-08-07 lupusalex Make code warning free - * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant - * 1660575 2007-02-15 lupusalex Chunking broken on SUN JRE - * 1688273 2007-04-16 ebak Full support of HTTP trailers - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 3304058 2011-05-20 blaschke-oss Use same date format in change history - * 3557283 2012-11-05 blaschke-oss Print full response when get EOF from CIMOM - * 3601894 2013-01-23 blaschke-oss Enhance HTTP and CIM-XML tracing - * 2621 2013-02-23 blaschke-oss Not all chunked input has trailers - * 2709 2013-11-13 blaschke-oss Lower the level of the EOF message to FINE - */ -package org.sentrysoftware.wbem.sblim.cimclient.internal.http.io; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.EOFException; -import java.io.IOException; -import java.io.InputStream; -import java.util.logging.Level; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.http.HttpHeader; -import org.sentrysoftware.wbem.sblim.cimclient.internal.http.HttpMethod; -import org.sentrysoftware.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; - -/** - * Class ChunkedInputStream implements an input stream for chunked messages - * - */ -public class ChunkedInputStream extends InputStream { - - private InputStream iIn; - - private String iTrailerFields; - - private String iOrigin; - - private long iChunkSize = 0; - - private boolean iEof = false; - - private HttpHeader iTrailers = new HttpHeader(); - - private boolean iClosed = false; - - private byte[] iTmp = new byte[1]; - - /** - * Ctor. - * - * @param pStream - * The stream to create this one upon - * @param pTrailerFields - * The names of trailer fields - */ - public ChunkedInputStream(InputStream pStream, String pTrailerFields) { - this(pStream, pTrailerFields, null); - } - - /** - * Ctor. - * - * @param pStream - * The stream to create this one upon - * @param pTrailerFields - * The names of trailer fields - * @param pOrigin - * The origin of the stream (response, indication request, etc.) - */ - public ChunkedInputStream(InputStream pStream, String pTrailerFields, String pOrigin) { - this.iIn = pStream; - this.iTrailerFields = pTrailerFields; - this.iOrigin = pOrigin == null ? "Unknown" : pOrigin; - } - - @Override - public synchronized int read() throws IOException { - return (read(this.iTmp, 0, 1) > 0) ? (this.iTmp[0] & 0xFF) : -1; - } - - @Override - public synchronized int read(byte[] buf, int off, int len) throws IOException { - int total = 0; - if (this.iEof || this.iClosed) return -1; // 13799 (return -1 if closed, - // not if !closed) - - if (this.iChunkSize == 0) { - String line = HttpMethod.readLine(this.iIn); // TODO read line using - // valid character encoding - - if ("".equals(line)) { - // 13799 The chunked data is ending with - // CRLF, so the first line read after it - // results "" - line = HttpMethod.readLine(this.iIn); - // 13799 Except first chunk, the - // above only read the CRLF ! - } - // TODO - get rid of ";*" suffix - try { - this.iChunkSize = Long.parseLong(line, 16); - } catch (Exception e) { - LogAndTraceBroker.getBroker().trace(Level.FINER, - "Invalid chunk size on HTTP stream", e); - this.iEof = true; - throw new IOException("Invalid chunk size"); - } - } - if (this.iChunkSize > 0) { - total = this.iIn.read(buf, off, (this.iChunkSize < len) ? (int) this.iChunkSize - : (int) len); - if (total > 0) { - this.iChunkSize -= total; - } - if (total == -1) { - LogAndTraceBroker.getBroker().trace( - Level.FINE, - "Unexpected EOF trying to read " - + (this.iChunkSize < len ? this.iChunkSize : len) - + " bytes from HTTP chunk with remaining length of " - + this.iChunkSize); - throw new EOFException("Unexpected EOF reading chunk"); - } - } else { - // read trailer - this.iEof = true; - if (this.iTrailerFields != null && this.iTrailerFields.trim().length() > 0) { - try { - this.iTrailers = new HttpHeader(this.iIn); - // ebak: http trailers - this.iTrailers.examineTrailer(this.iOrigin); - } catch (IOException e) { - LogAndTraceBroker.getBroker().trace( - Level.FINE, - "Unexpected EOF reading trailer, expected fields were " - + this.iTrailerFields); - throw new EOFException("Unexpected EOF reading trailer"); - } - } - } - return total > 0 ? total : -1; - } - - /** - * Return the http header trailers - * - * @return The trailers - */ - public synchronized HttpHeader getTrailers() { - return this.iTrailers; - } - - @Override - public synchronized long skip(long total) throws IOException { - byte[] tmp = new byte[(int) total]; - return read(tmp, 0, (int) total); - } - - /** - * @return int - * - */ - @Override - public synchronized int available() { - return (this.iEof ? 0 : (this.iChunkSize > 0 ? (int) this.iChunkSize : 1)); - } - - @Override - public void close() throws IOException { - if (!this.iClosed) { - this.iClosed = true; - byte[] buf = new byte[512]; - while (read(buf, 0, buf.length) > -1) { - // empty - } - this.iIn.close(); - } else throw new IOException("Error while closing stream"); - } -} +/* + (C) Copyright IBM Corp. 2005, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 13799 2004-12-07 thschaef Fixes on chunking + * 1535756 2006-08-07 lupusalex Make code warning free + * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant + * 1660575 2007-02-15 lupusalex Chunking broken on SUN JRE + * 1688273 2007-04-16 ebak Full support of HTTP trailers + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 3304058 2011-05-20 blaschke-oss Use same date format in change history + * 3557283 2012-11-05 blaschke-oss Print full response when get EOF from CIMOM + * 3601894 2013-01-23 blaschke-oss Enhance HTTP and CIM-XML tracing + * 2621 2013-02-23 blaschke-oss Not all chunked input has trailers + * 2709 2013-11-13 blaschke-oss Lower the level of the EOF message to FINE + */ +package org.metricshub.wbem.sblim.cimclient.internal.http.io; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.EOFException; +import java.io.IOException; +import java.io.InputStream; +import java.util.logging.Level; + +import org.metricshub.wbem.sblim.cimclient.internal.http.HttpHeader; +import org.metricshub.wbem.sblim.cimclient.internal.http.HttpMethod; +import org.metricshub.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; + +/** + * Class ChunkedInputStream implements an input stream for chunked messages + * + */ +public class ChunkedInputStream extends InputStream { + + private InputStream iIn; + + private String iTrailerFields; + + private String iOrigin; + + private long iChunkSize = 0; + + private boolean iEof = false; + + private HttpHeader iTrailers = new HttpHeader(); + + private boolean iClosed = false; + + private byte[] iTmp = new byte[1]; + + /** + * Ctor. + * + * @param pStream + * The stream to create this one upon + * @param pTrailerFields + * The names of trailer fields + */ + public ChunkedInputStream(InputStream pStream, String pTrailerFields) { + this(pStream, pTrailerFields, null); + } + + /** + * Ctor. + * + * @param pStream + * The stream to create this one upon + * @param pTrailerFields + * The names of trailer fields + * @param pOrigin + * The origin of the stream (response, indication request, etc.) + */ + public ChunkedInputStream(InputStream pStream, String pTrailerFields, String pOrigin) { + this.iIn = pStream; + this.iTrailerFields = pTrailerFields; + this.iOrigin = pOrigin == null ? "Unknown" : pOrigin; + } + + @Override + public synchronized int read() throws IOException { + return (read(this.iTmp, 0, 1) > 0) ? (this.iTmp[0] & 0xFF) : -1; + } + + @Override + public synchronized int read(byte[] buf, int off, int len) throws IOException { + int total = 0; + if (this.iEof || this.iClosed) return -1; // 13799 (return -1 if closed, + // not if !closed) + + if (this.iChunkSize == 0) { + String line = HttpMethod.readLine(this.iIn); // TODO read line using + // valid character encoding + + if ("".equals(line)) { + // 13799 The chunked data is ending with + // CRLF, so the first line read after it + // results "" + line = HttpMethod.readLine(this.iIn); + // 13799 Except first chunk, the + // above only read the CRLF ! + } + // TODO - get rid of ";*" suffix + try { + this.iChunkSize = Long.parseLong(line, 16); + } catch (Exception e) { + LogAndTraceBroker.getBroker().trace(Level.FINER, + "Invalid chunk size on HTTP stream", e); + this.iEof = true; + throw new IOException("Invalid chunk size"); + } + } + if (this.iChunkSize > 0) { + total = this.iIn.read(buf, off, (this.iChunkSize < len) ? (int) this.iChunkSize + : (int) len); + if (total > 0) { + this.iChunkSize -= total; + } + if (total == -1) { + LogAndTraceBroker.getBroker().trace( + Level.FINE, + "Unexpected EOF trying to read " + + (this.iChunkSize < len ? this.iChunkSize : len) + + " bytes from HTTP chunk with remaining length of " + + this.iChunkSize); + throw new EOFException("Unexpected EOF reading chunk"); + } + } else { + // read trailer + this.iEof = true; + if (this.iTrailerFields != null && this.iTrailerFields.trim().length() > 0) { + try { + this.iTrailers = new HttpHeader(this.iIn); + // ebak: http trailers + this.iTrailers.examineTrailer(this.iOrigin); + } catch (IOException e) { + LogAndTraceBroker.getBroker().trace( + Level.FINE, + "Unexpected EOF reading trailer, expected fields were " + + this.iTrailerFields); + throw new EOFException("Unexpected EOF reading trailer"); + } + } + } + return total > 0 ? total : -1; + } + + /** + * Return the http header trailers + * + * @return The trailers + */ + public synchronized HttpHeader getTrailers() { + return this.iTrailers; + } + + @Override + public synchronized long skip(long total) throws IOException { + byte[] tmp = new byte[(int) total]; + return read(tmp, 0, (int) total); + } + + /** + * @return int + * + */ + @Override + public synchronized int available() { + return (this.iEof ? 0 : (this.iChunkSize > 0 ? (int) this.iChunkSize : 1)); + } + + @Override + public void close() throws IOException { + if (!this.iClosed) { + this.iClosed = true; + byte[] buf = new byte[512]; + while (read(buf, 0, buf.length) > -1) { + // empty + } + this.iIn.close(); + } else throw new IOException("Error while closing stream"); + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/io/ChunkedOutputStream.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/ChunkedOutputStream.java similarity index 77% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/io/ChunkedOutputStream.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/ChunkedOutputStream.java index 1926020..76fba9c 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/io/ChunkedOutputStream.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/ChunkedOutputStream.java @@ -1,123 +1,121 @@ -/* - (C) Copyright IBM Corp. 2005, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1535756 2006-08-07 lupusalex Make code warning free - * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2620 2013-02-23 blaschke-oss Chunked output broken - */ -package org.sentrysoftware.wbem.sblim.cimclient.internal.http.io; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.DataOutputStream; -import java.io.IOException; -import java.io.OutputStream; - -/** - * Class ChunkedOutputStream implements an output stream for chunked messages - * - */ -public class ChunkedOutputStream extends OutputStream { - - DataOutputStream iOs; - - byte[] iBuffer; - - int iUsed; - - /** - * Ctor. - * - * @param pStream - * The stream to create this one upon - * @param pBufferLength - * The buffer length. When this value is exceeded a new chunk - * will be started. - */ - public ChunkedOutputStream(OutputStream pStream, int pBufferLength) { - this.iOs = new DataOutputStream(pStream); - this.iBuffer = new byte[pBufferLength]; - this.iUsed = 0; - } - - @Override - public void close() throws IOException { - flush(); - this.iOs.writeBytes(Integer.toHexString(0) + "\r\n"); - this.iOs.flush(); - } - - @Override - public void flush() throws IOException { - if (this.iUsed > 0) { - this.iOs.writeBytes(Integer.toHexString(this.iUsed) + "\r\n"); - this.iOs.write(this.iBuffer, 0, this.iUsed); - this.iOs.writeBytes("\r\n"); - this.iOs.flush(); - } - this.iUsed = 0; - } - - /** - * @param offset - */ - @Override - public void write(byte source[], int offset, int len) throws IOException { - int copied = 0; - while (len > 0) { - int total = (this.iBuffer.length - this.iUsed < len) ? (this.iBuffer.length - this.iUsed) - : len; - if (total > 0) { - System.arraycopy(source, copied, this.iBuffer, this.iUsed, total); - len -= total; - this.iUsed += total; - copied += total; - } - if (this.iUsed == this.iBuffer.length) flush(); - } - } - - @Override - public void write(int i) throws IOException { - if (this.iBuffer.length == this.iUsed) flush(); - this.iBuffer[this.iUsed++] = (byte) (0xFF & i); - } - -} +/* + (C) Copyright IBM Corp. 2005, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1535756 2006-08-07 lupusalex Make code warning free + * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2620 2013-02-23 blaschke-oss Chunked output broken + */ +package org.metricshub.wbem.sblim.cimclient.internal.http.io; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.DataOutputStream; +import java.io.IOException; +import java.io.OutputStream; + +/** + * Class ChunkedOutputStream implements an output stream for chunked messages + * + */ +public class ChunkedOutputStream extends OutputStream { + + DataOutputStream iOs; + + byte[] iBuffer; + + int iUsed; + + /** + * Ctor. + * + * @param pStream + * The stream to create this one upon + * @param pBufferLength + * The buffer length. When this value is exceeded a new chunk + * will be started. + */ + public ChunkedOutputStream(OutputStream pStream, int pBufferLength) { + this.iOs = new DataOutputStream(pStream); + this.iBuffer = new byte[pBufferLength]; + this.iUsed = 0; + } + + @Override + public void close() throws IOException { + flush(); + this.iOs.writeBytes(Integer.toHexString(0) + "\r\n"); + this.iOs.flush(); + } + + @Override + public void flush() throws IOException { + if (this.iUsed > 0) { + this.iOs.writeBytes(Integer.toHexString(this.iUsed) + "\r\n"); + this.iOs.write(this.iBuffer, 0, this.iUsed); + this.iOs.writeBytes("\r\n"); + this.iOs.flush(); + } + this.iUsed = 0; + } + + /** + * @param offset + */ + @Override + public void write(byte source[], int offset, int len) throws IOException { + int copied = 0; + while (len > 0) { + int total = (this.iBuffer.length - this.iUsed < len) ? (this.iBuffer.length - this.iUsed) + : len; + if (total > 0) { + System.arraycopy(source, copied, this.iBuffer, this.iUsed, total); + len -= total; + this.iUsed += total; + copied += total; + } + if (this.iUsed == this.iBuffer.length) flush(); + } + } + + @Override + public void write(int i) throws IOException { + if (this.iBuffer.length == this.iUsed) flush(); + this.iBuffer[this.iUsed++] = (byte) (0xFF & i); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/io/DebugInputStream.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/DebugInputStream.java similarity index 80% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/io/DebugInputStream.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/DebugInputStream.java index c78818a..bbc3dec 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/io/DebugInputStream.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/DebugInputStream.java @@ -1,172 +1,170 @@ -/* - (C) Copyright IBM Corp. 2005, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1535756 2006-08-07 lupusalex Make code warning free - * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 3062747 2010-09-21 blaschke-oss SblimCIMClient does not log all CIM-XML responces. - * 3185833 2011-02-18 blaschke-oss missing newline when logging request/response - * 3554738 2012-08-16 blaschke-oss dump CIM xml by LogAndTraceBroker.trace() - * 3601894 2013-01-23 blaschke-oss Enhance HTTP and CIM-XML tracing - */ -package org.sentrysoftware.wbem.sblim.cimclient.internal.http.io; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.FilterInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.logging.Level; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; -import org.sentrysoftware.wbem.sblim.cimclient.internal.logging.TimeStamp; - -/** - * Class DebugInputStream is for debugging purposes - * - */ -public class DebugInputStream extends FilterInputStream { - - private byte[] iBuf; - - private boolean iBuffered; - - private int iCur = 0; - - private int iMaxLen = 0; - - private OutputStream iStream; - - private String iOrigin; - - /** - * Ctor. - * - * @param is - * @param os - */ - public DebugInputStream(InputStream is, OutputStream os) { - this(is, os, null); - } - - /** - * Ctor. - * - * @param is - * @param os - * @param pOrigin - */ - public DebugInputStream(InputStream is, OutputStream os, String pOrigin) { - super(is); - this.iBuf = new byte[512]; - this.iBuffered = false; - this.iStream = os; - this.iOrigin = pOrigin == null ? "unknown" : pOrigin; - } - - private void buffer() throws IOException { - this.iBuffered = true; - int total; - try { - while ((total = this.in.read(this.iBuf, this.iMaxLen, this.iBuf.length - this.iMaxLen)) > -1) { - this.iMaxLen += total; - if (this.iMaxLen == this.iBuf.length) { - byte b[] = new byte[this.iBuf.length << 1]; - System.arraycopy(this.iBuf, 0, b, 0, this.iBuf.length); - this.iBuf = b; - } - } - } catch (TrailerException e) { - // TrailerException indicates complete response BUT error in trailer - writeBuffer(this.iOrigin + " begin (TrailerException occurred)"); - throw e; - } - writeBuffer(this.iOrigin + " begin"); - } - - private void writeBuffer(String header) throws IOException { - StringBuilder outStr = new StringBuilder("<--- "); - outStr.append(header); - outStr.append(' '); - outStr.append(TimeStamp.formatWithMillis(System.currentTimeMillis())); - outStr.append(" ----\n"); - outStr.append(new String(this.iBuf, 0, this.iMaxLen)); - if (this.iMaxLen > 0 && this.iBuf[this.iMaxLen - 1] != '\n') outStr.append('\n'); - outStr.append("---- "); - outStr.append(this.iOrigin); - outStr.append(" end ----->\n"); - if (this.iStream != null) this.iStream.write(outStr.toString().getBytes()); - if (LogAndTraceBroker.getBroker().isLoggableCIMXMLTrace(Level.FINEST)) LogAndTraceBroker - .getBroker().traceCIMXML(Level.FINEST, outStr.toString(), false); - } - - @Override - public synchronized int read() throws IOException { - if (!this.iBuffered) buffer(); - - if (this.iCur >= this.iMaxLen) return -1; - return this.iBuf[this.iCur++]; - } - - @Override - public synchronized int read(byte b[], int off, int len) throws IOException { - if (b == null) { - throw new NullPointerException(); - } else if ((off < 0) || (off > b.length) || (len < 0) || ((off + len) > b.length) - || ((off + len) < 0)) { - throw new IndexOutOfBoundsException(); - } else if (len == 0) { return 0; } - - int c = read(); - if (c == -1) { return -1; } - b[off] = (byte) c; - - int i = 1; - for (; i < len; i++) { - c = read(); - if (c == -1) { - break; - } - if (b != null) { - b[off + i] = (byte) c; - } - } - return i; - } -} +/* + (C) Copyright IBM Corp. 2005, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1535756 2006-08-07 lupusalex Make code warning free + * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 3062747 2010-09-21 blaschke-oss SblimCIMClient does not log all CIM-XML responces. + * 3185833 2011-02-18 blaschke-oss missing newline when logging request/response + * 3554738 2012-08-16 blaschke-oss dump CIM xml by LogAndTraceBroker.trace() + * 3601894 2013-01-23 blaschke-oss Enhance HTTP and CIM-XML tracing + */ +package org.metricshub.wbem.sblim.cimclient.internal.http.io; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.FilterInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.logging.Level; + +import org.metricshub.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; +import org.metricshub.wbem.sblim.cimclient.internal.logging.TimeStamp; + +/** + * Class DebugInputStream is for debugging purposes + * + */ +public class DebugInputStream extends FilterInputStream { + + private byte[] iBuf; + + private boolean iBuffered; + + private int iCur = 0; + + private int iMaxLen = 0; + + private OutputStream iStream; + + private String iOrigin; + + /** + * Ctor. + * + * @param is + * @param os + */ + public DebugInputStream(InputStream is, OutputStream os) { + this(is, os, null); + } + + /** + * Ctor. + * + * @param is + * @param os + * @param pOrigin + */ + public DebugInputStream(InputStream is, OutputStream os, String pOrigin) { + super(is); + this.iBuf = new byte[512]; + this.iBuffered = false; + this.iStream = os; + this.iOrigin = pOrigin == null ? "unknown" : pOrigin; + } + + private void buffer() throws IOException { + this.iBuffered = true; + int total; + try { + while ((total = this.in.read(this.iBuf, this.iMaxLen, this.iBuf.length - this.iMaxLen)) > -1) { + this.iMaxLen += total; + if (this.iMaxLen == this.iBuf.length) { + byte b[] = new byte[this.iBuf.length << 1]; + System.arraycopy(this.iBuf, 0, b, 0, this.iBuf.length); + this.iBuf = b; + } + } + } catch (TrailerException e) { + // TrailerException indicates complete response BUT error in trailer + writeBuffer(this.iOrigin + " begin (TrailerException occurred)"); + throw e; + } + writeBuffer(this.iOrigin + " begin"); + } + + private void writeBuffer(String header) throws IOException { + StringBuilder outStr = new StringBuilder("<--- "); + outStr.append(header); + outStr.append(' '); + outStr.append(TimeStamp.formatWithMillis(System.currentTimeMillis())); + outStr.append(" ----\n"); + outStr.append(new String(this.iBuf, 0, this.iMaxLen)); + if (this.iMaxLen > 0 && this.iBuf[this.iMaxLen - 1] != '\n') outStr.append('\n'); + outStr.append("---- "); + outStr.append(this.iOrigin); + outStr.append(" end ----->\n"); + if (this.iStream != null) this.iStream.write(outStr.toString().getBytes()); + if (LogAndTraceBroker.getBroker().isLoggableCIMXMLTrace(Level.FINEST)) LogAndTraceBroker + .getBroker().traceCIMXML(Level.FINEST, outStr.toString(), false); + } + + @Override + public synchronized int read() throws IOException { + if (!this.iBuffered) buffer(); + + if (this.iCur >= this.iMaxLen) return -1; + return this.iBuf[this.iCur++]; + } + + @Override + public synchronized int read(byte b[], int off, int len) throws IOException { + if (b == null) { + throw new NullPointerException(); + } else if ((off < 0) || (off > b.length) || (len < 0) || ((off + len) > b.length) + || ((off + len) < 0)) { + throw new IndexOutOfBoundsException(); + } else if (len == 0) { return 0; } + + int c = read(); + if (c == -1) { return -1; } + b[off] = (byte) c; + + int i = 1; + for (; i < len; i++) { + c = read(); + if (c == -1) { + break; + } + if (b != null) { + b[off + i] = (byte) c; + } + } + return i; + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/io/KeepAliveInputStream.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/KeepAliveInputStream.java similarity index 73% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/io/KeepAliveInputStream.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/KeepAliveInputStream.java index 429df74..ff7ff91 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/io/KeepAliveInputStream.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/KeepAliveInputStream.java @@ -1,119 +1,117 @@ -/* - (C) Copyright IBM Corp. 2005, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1535756 2006-08-07 lupusalex Make code warning free - * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ -package org.sentrysoftware.wbem.sblim.cimclient.internal.http.io; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.FilterInputStream; -import java.io.IOException; -import java.io.InputStream; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.http.HttpClient; - -/** - * Class KeepAliveInputStream implements an input stream for connections that - * keep iAlive after a request is completed - * - */ -public class KeepAliveInputStream extends FilterInputStream { - - private HttpClient iClient; - - /** - * Ctor. - * - * @param pStream - * The underlying stream - * @param pClient - * The associated client. - */ - public KeepAliveInputStream(InputStream pStream, HttpClient pClient) { - super(pStream); - this.iClient = pClient; - } - - @Override - public int read() throws IOException { - int i = super.read(); - if (i == -1 && this.iClient != null) { - this.iClient.streamFinished(); - this.iClient = null; - } - return i; - } - - @Override - public int read(byte buf[]) throws IOException { - return read(buf, 0, buf.length); - } - - @Override - public int read(byte buf[], int off, int len) throws IOException { - int i = super.read(buf, off, len); - if (i == -1 && this.iClient != null) { - this.iClient.streamFinished(); - this.iClient = null; - } - return i; - } - - @Override - public long skip(long len) throws IOException { - long i = super.skip(len); - - if (i == -1 && this.iClient != null) { - this.iClient.streamFinished(); - this.iClient = null; - } - return i; - } - - @Override - public void close() throws IOException { - super.close(); - if (this.iClient != null) { - this.iClient.streamFinished(); - this.iClient = null; - } - } -} +/* + (C) Copyright IBM Corp. 2005, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1535756 2006-08-07 lupusalex Make code warning free + * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ +package org.metricshub.wbem.sblim.cimclient.internal.http.io; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.FilterInputStream; +import java.io.IOException; +import java.io.InputStream; + +import org.metricshub.wbem.sblim.cimclient.internal.http.HttpClient; + +/** + * Class KeepAliveInputStream implements an input stream for connections that + * keep iAlive after a request is completed + * + */ +public class KeepAliveInputStream extends FilterInputStream { + + private HttpClient iClient; + + /** + * Ctor. + * + * @param pStream + * The underlying stream + * @param pClient + * The associated client. + */ + public KeepAliveInputStream(InputStream pStream, HttpClient pClient) { + super(pStream); + this.iClient = pClient; + } + + @Override + public int read() throws IOException { + int i = super.read(); + if (i == -1 && this.iClient != null) { + this.iClient.streamFinished(); + this.iClient = null; + } + return i; + } + + @Override + public int read(byte buf[]) throws IOException { + return read(buf, 0, buf.length); + } + + @Override + public int read(byte buf[], int off, int len) throws IOException { + int i = super.read(buf, off, len); + if (i == -1 && this.iClient != null) { + this.iClient.streamFinished(); + this.iClient = null; + } + return i; + } + + @Override + public long skip(long len) throws IOException { + long i = super.skip(len); + + if (i == -1 && this.iClient != null) { + this.iClient.streamFinished(); + this.iClient = null; + } + return i; + } + + @Override + public void close() throws IOException { + super.close(); + if (this.iClient != null) { + this.iClient.streamFinished(); + this.iClient = null; + } + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/io/PersistentInputStream.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/PersistentInputStream.java similarity index 72% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/io/PersistentInputStream.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/PersistentInputStream.java index cc269ae..ebff1d6 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/io/PersistentInputStream.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/PersistentInputStream.java @@ -1,93 +1,91 @@ -/* - (C) Copyright IBM Corp. 2005, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1535756 2006-08-07 lupusalex Make code warning free - * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ -package org.sentrysoftware.wbem.sblim.cimclient.internal.http.io; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.FilterInputStream; -import java.io.IOException; -import java.io.InputStream; - -/** - * Class PersistentInputStream implements an input stream for which close() can - * be disabled. - * - */ -public class PersistentInputStream extends FilterInputStream { - - boolean iClosable = false; - - boolean iClosed = false; - - /** - * Ctor. - * - * @param pStream - * The underlying stream - */ - public PersistentInputStream(InputStream pStream) { - this(pStream, false); - } - - /** - * Ctor. - * - * @param pStream - * The underlying stream - * @param pClosable - * If false this stream will ignore calls to the - * close() method. - */ - public PersistentInputStream(InputStream pStream, boolean pClosable) { - super(pStream); - this.iClosable = pClosable; - } - - @Override - public synchronized void close() throws IOException { - if (!this.iClosed) { - this.iClosed = true; - if (this.iClosable) this.in.close(); - } else throw new IOException("Error while closing the input stream. It was already closed"); - } -} +/* + (C) Copyright IBM Corp. 2005, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1535756 2006-08-07 lupusalex Make code warning free + * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ +package org.metricshub.wbem.sblim.cimclient.internal.http.io; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.FilterInputStream; +import java.io.IOException; +import java.io.InputStream; + +/** + * Class PersistentInputStream implements an input stream for which close() can + * be disabled. + * + */ +public class PersistentInputStream extends FilterInputStream { + + boolean iClosable = false; + + boolean iClosed = false; + + /** + * Ctor. + * + * @param pStream + * The underlying stream + */ + public PersistentInputStream(InputStream pStream) { + this(pStream, false); + } + + /** + * Ctor. + * + * @param pStream + * The underlying stream + * @param pClosable + * If false this stream will ignore calls to the + * close() method. + */ + public PersistentInputStream(InputStream pStream, boolean pClosable) { + super(pStream); + this.iClosable = pClosable; + } + + @Override + public synchronized void close() throws IOException { + if (!this.iClosed) { + this.iClosed = true; + if (this.iClosable) this.in.close(); + } else throw new IOException("Error while closing the input stream. It was already closed"); + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/io/PersistentOutputStream.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/PersistentOutputStream.java similarity index 72% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/io/PersistentOutputStream.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/PersistentOutputStream.java index 6a9209c..16fe80b 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/io/PersistentOutputStream.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/PersistentOutputStream.java @@ -1,92 +1,90 @@ -/* - (C) Copyright IBM Corp. 2005, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1535756 2006-08-07 lupusalex Make code warning free - * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ -package org.sentrysoftware.wbem.sblim.cimclient.internal.http.io; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.FilterOutputStream; -import java.io.IOException; -import java.io.OutputStream; - -/** - * Class PersistentOutputStream implements an output stream for which close() - * can be disabled. - */ -public class PersistentOutputStream extends FilterOutputStream { - - boolean iClosable = false; - - boolean iClosed = false; - - /** - * Ctor. - * - * @param pStream - * The underlying stream - */ - public PersistentOutputStream(OutputStream pStream) { - this(pStream, false); - } - - /** - * Ctor. - * - * @param pStream - * The underlying stream - * @param pClosable - * If false this stream will ignore calls to the - * close() method. - */ - public PersistentOutputStream(OutputStream pStream, boolean pClosable) { - super(pStream); - this.iClosable = pClosable; - } - - @Override - public synchronized void close() throws IOException { - if (!this.iClosed) { - this.iClosed = true; - if (this.iClosable) this.out.close(); - } else throw new IOException("Error while closing the Output stream. It was already closed"); - } -} +/* + (C) Copyright IBM Corp. 2005, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1535756 2006-08-07 lupusalex Make code warning free + * 1565892 2006-11-28 lupusalex Make SBLIM client JSR48 compliant + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ +package org.metricshub.wbem.sblim.cimclient.internal.http.io; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.FilterOutputStream; +import java.io.IOException; +import java.io.OutputStream; + +/** + * Class PersistentOutputStream implements an output stream for which close() + * can be disabled. + */ +public class PersistentOutputStream extends FilterOutputStream { + + boolean iClosable = false; + + boolean iClosed = false; + + /** + * Ctor. + * + * @param pStream + * The underlying stream + */ + public PersistentOutputStream(OutputStream pStream) { + this(pStream, false); + } + + /** + * Ctor. + * + * @param pStream + * The underlying stream + * @param pClosable + * If false this stream will ignore calls to the + * close() method. + */ + public PersistentOutputStream(OutputStream pStream, boolean pClosable) { + super(pStream); + this.iClosable = pClosable; + } + + @Override + public synchronized void close() throws IOException { + if (!this.iClosed) { + this.iClosed = true; + if (this.iClosable) this.out.close(); + } else throw new IOException("Error while closing the Output stream. It was already closed"); + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/io/TrailerException.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/TrailerException.java similarity index 66% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/io/TrailerException.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/TrailerException.java index 02ef4cf..8c606f3 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/io/TrailerException.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/TrailerException.java @@ -1,81 +1,78 @@ -/* - (C) Copyright IBM Corp. 2006, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, ebak@de.ibm.com - * - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1688273 2007-04-16 ebak Full support of HTTP trailers - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.http.io; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.wbem.WBEMException; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.util.WBEMConstants; - -/** - * TrailerException is thrown by ChunkedInputStream when it receives a http - * trailer which contains the following entries: CIMStatusCode, - * CIMStatusCodeDescription. These http trailer entries are known to be used by - * Pegasus CIMOM. - */ -public class TrailerException extends RuntimeException { - - private static final long serialVersionUID = 4355341648542585509L; - - private WBEMException iWBEMException; - - /** - * Ctor. - * - * @param pException - * The contained WBEMException - */ - public TrailerException(WBEMException pException) { - super(WBEMConstants.HTTP_TRAILER_STATUS_CODE + ":" + pException.getID() + " " - + WBEMConstants.HTTP_TRAILER_STATUS_DESCRIPTION + ":" + pException.getMessage()); - this.iWBEMException = pException; - } - - /** - * getWBEMException - * - * @return WBEMException - */ - public WBEMException getWBEMException() { - return this.iWBEMException; - } - -} +/* + (C) Copyright IBM Corp. 2006, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, ebak@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1688273 2007-04-16 ebak Full support of HTTP trailers + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.http.io; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.wbem.WBEMException; +import org.metricshub.wbem.sblim.cimclient.internal.util.WBEMConstants; + +/** + * TrailerException is thrown by ChunkedInputStream when it receives a http + * trailer which contains the following entries: CIMStatusCode, + * CIMStatusCodeDescription. These http trailer entries are known to be used by + * Pegasus CIMOM. + */ +public class TrailerException extends RuntimeException { + + private static final long serialVersionUID = 4355341648542585509L; + + private WBEMException iWBEMException; + + /** + * Ctor. + * + * @param pException + * The contained WBEMException + */ + public TrailerException(WBEMException pException) { + super(WBEMConstants.HTTP_TRAILER_STATUS_CODE + ":" + pException.getID() + " " + + WBEMConstants.HTTP_TRAILER_STATUS_DESCRIPTION + ":" + pException.getMessage()); + this.iWBEMException = pException; + } + + /** + * getWBEMException + * + * @return WBEMException + */ + public WBEMException getWBEMException() { + return this.iWBEMException; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/io/package.html b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/package.html similarity index 100% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/io/package.html rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/package.html diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/package.html b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/package.html similarity index 100% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/http/package.html rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/package.html diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/logging/LogAndTraceBroker.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/logging/LogAndTraceBroker.java similarity index 93% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/logging/LogAndTraceBroker.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/logging/LogAndTraceBroker.java index ee5664f..470b218 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/logging/LogAndTraceBroker.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/logging/LogAndTraceBroker.java @@ -1,957 +1,955 @@ -/* - (C) Copyright IBM Corp. 2006, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Alexander Wolf-Reber, IBM, a.wolf-reber@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1565892 2006-11-14 lupusalex Make SBLIM client JSR48 compliant - * 1711092 2006-05-02 lupusalex Some fixes/additions of log&trace messages - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors - * 3001345 2010-05-18 blaschke-oss File handle leaks in HttpSocketFactory and LogAndTraceBroker - * 3027618 2010-07-14 blaschke-oss Close files/readers in finally blocks - * 3154232 2011-01-13 blaschke-oss EmbeddedObject misspelled in javadoc - * 3252669 2011-03-28 blaschke-oss setXmlTraceStream blindly closes previous stream - * 3400209 2011-08-31 blaschke-oss Highlighted Static Analysis (PMD) issues - * 3469018 2012-01-03 blaschke-oss Properties not passed to CIMIndicationHandler - * 3484014 2012-02-03 blaschke-oss Add LogAndTraceBroker.isLoggable for message/trace - * 3489638 2012-02-28 blaschke-oss PERF: Bottleneck in LogAndTraceBroker.java - getCaller() - * 3554738 2012-08-16 blaschke-oss dump CIM xml by LogAndTraceBroker.trace() - * 3576396 2012-10-11 blaschke-oss Improve logging of config file name - * 3596303 2013-01-04 blaschke-oss windows http response WWW-Authenticate: Negotiate fails - * 2652 2013-07-26 blaschke-oss LogAndTraceBroker.setXmlTraceStream should not close previous stream - * 2651 2013-07-31 blaschke-oss IOException when tracing the cimxml - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.logging; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.List; -import java.util.Properties; -import java.util.logging.ConsoleHandler; -import java.util.logging.FileHandler; -import java.util.logging.Handler; -import java.util.logging.Level; -import java.util.logging.LogRecord; -import java.util.logging.Logger; - -import org.sentrysoftware.wbem.sblim.cimclient.CIMXMLTraceListener; -import org.sentrysoftware.wbem.sblim.cimclient.LogAndTraceManager; -import org.sentrysoftware.wbem.sblim.cimclient.LogListener; -import org.sentrysoftware.wbem.sblim.cimclient.TraceListener; -import org.sentrysoftware.wbem.sblim.cimclient.WBEMConfigurationProperties; -import org.sentrysoftware.wbem.sblim.cimclient.internal.util.WBEMConfiguration; -import org.sentrysoftware.wbem.sblim.cimclient.internal.util.WBEMConstants; - -/** - * Class LogAndTraceBroker is the central class that implements the logging and - * tracing of the CIM Client. It manages the collections of the internal log and - * trace listeners. It sets up the application independent logging. It provides - * the API to send log and trace messages and forwards them to the appropriate - * listeners. - * - */ -public class LogAndTraceBroker { - - private static final String TRACE_LOGGER = "org.sentrysoftware.wbem.sblim.cimclient.trace"; - - private static final String FILE_LOGGER = "org.sentrysoftware.wbem.sblim.cimclient.file"; - - private static final String CONSOLE_LOGGER = "org.sentrysoftware.wbem.sblim.cimclient.console"; - - private static LogAndTraceBroker cBroker = new LogAndTraceBroker(); - - /** - * Returns the singleton instance of the broker - * - * @return The broker instance - */ - public static LogAndTraceBroker getBroker() { - return cBroker; - } - - /** - * Returns if the logging framework has been initialized. This method is - * used by the WBEMConfiguration class to determine if the - * logging is already up. The WBEMConfiguration is initialized - * before the logging, so methods in this class cannot assume the logging to - * be up and running. - * - * @return true if the logging is up, false - * otherwise - */ - public static boolean isLoggingStarted() { - return cBroker != null; - } - - private volatile ArrayList iLogListeners; - - private volatile ArrayList iTraceListeners; - - private volatile ArrayList iCIMXMLTraceListeners; - - private String iProductName = "SBLIM CIM Client for Java"; - - private String iCopyright = "COPYRIGHT (C) 2006, 2013 IBM Corp."; - - private String iVersion = "?"; - - private String iBuildDate = "?"; - - private String iBuildTime = "?"; - - private OutputStream iXmlTraceStream = null; - - private OutputStream iXmlTraceFile = null; - - private final String iTHIS_CLASS = this.getClass().getName(); - - private final String iTHROWABLE = Throwable.class.getName(); - - private int iInternalLevelConsole = Level.OFF.intValue(); - - private int iInternalLevelLogFile = Level.OFF.intValue(); - - private int iInternalLevelTraceFile = Level.OFF.intValue(); - - private LogListener iInternalListenerLogConsole = null; - - private LogListener iInternalListenerLogFile = null; - - private TraceListener iInternalListenerTraceConsole = null; - - private TraceListener iInternalListenerTraceFile = null; - - private int iNumInternalLogListeners = 0; - - private int iNumExternalLogListeners = 0; - - private int iNumInternalTraceListeners = 0; - - private int iNumExternalTraceListeners = 0; - - private LogAndTraceBroker() { - this.iLogListeners = new ArrayList(); - this.iTraceListeners = new ArrayList(); - this.iCIMXMLTraceListeners = new ArrayList(); - loadVersionTxt(); - registerInternalListeners(); - initXmlTraceFile(); - } - - @Override - protected void finalize() throws Throwable { - try { - if (this.iXmlTraceFile != null && (!this.iXmlTraceFile.equals(System.out)) - && (!this.iXmlTraceFile.equals(System.err))) this.iXmlTraceFile.close(); - } catch (IOException e) { - // bad luck - } finally { - this.iXmlTraceFile = null; - super.finalize(); - } - } - - /** - * Registers the listeners for our internal loggers - */ - public void registerInternalListeners() { - try { - Level level = WBEMConfiguration.getGlobalConfiguration().getLogConsoleLevel(); - String type = WBEMConfiguration.getGlobalConfiguration().getLogConsoleType(); - if (level.intValue() < Level.OFF.intValue() && WBEMConstants.MESSAGE.equals(type)) { - final Logger logger = Logger.getLogger(CONSOLE_LOGGER); - final Handler handler = new ConsoleHandler(); - handler.setFormatter(new LogFormatter()); - handler.setLevel(level); - logger.addHandler(handler); - logger.setLevel(level); - logger.setUseParentHandlers(false); - this.iInternalLevelConsole = level.intValue(); - if (this.iInternalListenerLogConsole != null) removeLogListener(this.iInternalListenerLogConsole); - this.iInternalListenerLogConsole = new LogListener() { - - public void log(Level pLevel, String pMessageKey, String pMessage, - Object[] pParameters) { - LogRecord record = new LogRecord(pLevel, pMessageKey + " " + pMessage); - record.setParameters(pParameters); - logger.log(record); - } - }; - addLogListener(this.iInternalListenerLogConsole); - } - } catch (Exception e) { - // Don't crash for logging - } - try { - Level level = WBEMConfiguration.getGlobalConfiguration().getLogFileLevel(); - String location = WBEMConfiguration.getGlobalConfiguration().getLogFileLocation(); - int size = WBEMConfiguration.getGlobalConfiguration().getLogFileSizeLimit(); - int count = WBEMConfiguration.getGlobalConfiguration().getLogFileCount(); - if (level.intValue() < Level.OFF.intValue()) { - final Logger logger = Logger.getLogger(FILE_LOGGER); - final Handler handler = new FileHandler(location, size, count); - handler.setFormatter(new LogFormatter()); - handler.setLevel(level); - logger.addHandler(handler); - logger.setLevel(level); - logger.setUseParentHandlers(false); - this.iInternalLevelLogFile = level.intValue(); - if (this.iInternalListenerLogFile != null) removeLogListener(this.iInternalListenerLogFile); - this.iInternalListenerLogFile = new LogListener() { - - public void log(Level pLevel, String pMessageKey, String pMessage, - Object[] pParameters) { - LogRecord record = new LogRecord(pLevel, pMessageKey + " " + pMessage); - record.setParameters(pParameters); - logger.log(record); - } - }; - addLogListener(this.iInternalListenerLogFile); - } - } catch (Exception e) { - // Don't crash for logging - } - try { - Level level = WBEMConfiguration.getGlobalConfiguration().getLogConsoleLevel(); - String type = WBEMConfiguration.getGlobalConfiguration().getLogConsoleType(); - if (level.intValue() < Level.OFF.intValue() && WBEMConstants.TRACE.equals(type)) { - final Logger logger = Logger.getLogger(CONSOLE_LOGGER); - final Handler handler = new ConsoleHandler(); - handler.setFormatter(new TraceFormatter()); - handler.setLevel(level); - logger.addHandler(handler); - logger.setLevel(level); - logger.setUseParentHandlers(false); - this.iInternalLevelConsole = level.intValue(); - if (this.iInternalListenerTraceConsole != null) removeTraceListener(this.iInternalListenerTraceConsole); - this.iInternalListenerTraceConsole = new TraceListener() { - - public void trace(Level pLevel, StackTraceElement pOrigin, String pMessage) { - LogRecord record = new LogRecord(pLevel, pMessage); - record.setSourceMethodName(String.valueOf(pOrigin)); - logger.log(record); - } - - public void trace(Level pLevel, StackTraceElement pOrigin, String pMessage, - Throwable pThrown) { - LogRecord record = new LogRecord(pLevel, pMessage); - record.setSourceMethodName(String.valueOf(pOrigin)); - record.setThrown(pThrown); - logger.log(record); - } - }; - addTraceListener(this.iInternalListenerTraceConsole); - } - } catch (Exception e) { - // Don't crash for logging - } - try { - Level level = WBEMConfiguration.getGlobalConfiguration().getTraceFileLevel(); - String location = WBEMConfiguration.getGlobalConfiguration().getTraceFileLocation(); - int size = WBEMConfiguration.getGlobalConfiguration().getTraceFileSizeLimit(); - int count = WBEMConfiguration.getGlobalConfiguration().getTraceFileCount(); - if (level.intValue() < Level.OFF.intValue()) { - final Logger logger = Logger.getLogger(TRACE_LOGGER); - final Handler handler = new FileHandler(location, size, count); - handler.setFormatter(new TraceFormatter()); - handler.setLevel(level); - logger.addHandler(handler); - logger.setLevel(level); - logger.setUseParentHandlers(false); - this.iInternalLevelTraceFile = level.intValue(); - if (this.iInternalListenerTraceFile != null) removeTraceListener(this.iInternalListenerTraceFile); - this.iInternalListenerTraceFile = new TraceListener() { - - public void trace(Level pLevel, StackTraceElement pOrigin, String pMessage) { - LogRecord record = new LogRecord(pLevel, pMessage); - record.setSourceMethodName(String.valueOf(pOrigin)); - logger.log(record); - } - - public void trace(Level pLevel, StackTraceElement pOrigin, String pMessage, - Throwable pThrown) { - LogRecord record = new LogRecord(pLevel, pMessage); - record.setSourceMethodName(String.valueOf(pOrigin)); - record.setThrown(pThrown); - logger.log(record); - } - }; - addTraceListener(this.iInternalListenerTraceFile); - } - } catch (Exception e) { - // Don't crash for logging - } - } - - /** - * Adds a listener for log messages. The listener will be notified of any - * log event. Uses copy on write to ensure concurrent read access. - * - * @param pListener - * The listener - */ - public synchronized void addLogListener(LogListener pListener) { - if (pListener == null) return; - sendGreetings(pListener); - ArrayList newListeners = new ArrayList(this.iLogListeners); - newListeners.add(pListener); - this.iLogListeners = newListeners; - - if ((this.iInternalListenerLogFile != null && this.iInternalListenerLogFile - .equals(pListener)) - || (this.iInternalListenerLogConsole != null && this.iInternalListenerLogConsole - .equals(pListener))) { - this.iNumInternalLogListeners++; - } else { - this.iNumExternalLogListeners++; - } - } - - private void loadVersionTxt() { - InputStream is = null; - try { - Properties version = new Properties(); - is = LogAndTraceManager.class.getResourceAsStream("version.txt"); - version.load(is); - this.iProductName = version.getProperty("PRODUCTNAME"); - this.iCopyright = version.getProperty("COPYRIGHT"); - this.iVersion = version.getProperty("VERSION"); - this.iBuildDate = version.getProperty("BUILDDATE"); - this.iBuildTime = version.getProperty("BUILDTIME"); - } catch (Exception e) { - // nothing to do - } finally { - if (is != null) { - try { - is.close(); - } catch (IOException e) { - // nothing ro do - } - } - } - } - - private void sendGreetings(LogListener pListener) { - - pListener.log(MessageLoader.getLevel(Messages.GREETING), Messages.GREETING, MessageLoader - .getLocalizedMessage(Messages.GREETING), new Object[] { this.iProductName, - this.iCopyright }); - pListener.log(MessageLoader.getLevel(Messages.RELEASE), Messages.RELEASE, MessageLoader - .getLocalizedMessage(Messages.RELEASE), new Object[] { this.iVersion, - this.iBuildDate, this.iBuildTime }); - pListener.log(MessageLoader.getLevel(Messages.OS), Messages.OS, MessageLoader - .getLocalizedMessage(Messages.OS), new Object[] { System.getProperty("os.name"), - System.getProperty("os.version"), System.getProperty("os.arch") }); - pListener.log(MessageLoader.getLevel(Messages.JRE), Messages.JRE, MessageLoader - .getLocalizedMessage(Messages.JRE), new Object[] { - System.getProperty("java.version"), System.getProperty("java.vendor") }); - pListener.log(MessageLoader.getLevel(Messages.JVM), Messages.JVM, MessageLoader - .getLocalizedMessage(Messages.JVM), new Object[] { - System.getProperty("java.vm.name"), System.getProperty("java.vm.version"), - System.getProperty("java.vm.vendor") }); - pListener.log(MessageLoader.getLevel(Messages.CONFIGURATION_URL), - Messages.CONFIGURATION_URL, MessageLoader - .getLocalizedMessage(Messages.CONFIGURATION_URL), - new Object[] { WBEMConfiguration.getActiveConfigFullURL() }); - if (!WBEMConfiguration.isConfigurationLoadSuccessful()) { - pListener.log(MessageLoader.getLevel(Messages.CONFIGURATION_LOAD_FAILED), - Messages.CONFIGURATION_LOAD_FAILED, MessageLoader - .getLocalizedMessage(Messages.CONFIGURATION_LOAD_FAILED), - (Object[]) null); - if (WBEMConfiguration.getConfigurationLoadException() != null) { - pListener.log(MessageLoader.getLevel(Messages.EXCEPTION_DURING_CONFIGURATION_LOAD), - Messages.EXCEPTION_DURING_CONFIGURATION_LOAD, MessageLoader - .getLocalizedMessage(Messages.EXCEPTION_DURING_CONFIGURATION_LOAD), - new Object[] { WBEMConfiguration.getConfigurationLoadException() - .getMessage() }); - } - } - } - - private void sendGreetings(TraceListener pListener) { - StackTraceElement origin = new Throwable().getStackTrace()[0]; - pListener.trace(MessageLoader.getLevel(Messages.GREETING), origin, MessageFormat.format( - MessageLoader.getMessage(Messages.GREETING), new Object[] { this.iProductName, - this.iCopyright })); - pListener.trace(MessageLoader.getLevel(Messages.RELEASE), origin, MessageFormat.format( - MessageLoader.getMessage(Messages.RELEASE), new Object[] { this.iVersion, - this.iBuildDate, this.iBuildTime })); - pListener.trace(MessageLoader.getLevel(Messages.OS), origin, MessageFormat.format( - MessageLoader.getMessage(Messages.OS), new Object[] { - System.getProperty("os.name"), System.getProperty("os.version"), - System.getProperty("os.arch") })); - pListener.trace(MessageLoader.getLevel(Messages.JRE), origin, MessageFormat.format( - MessageLoader.getMessage(Messages.JRE), new Object[] { - System.getProperty("java.version"), System.getProperty("java.vendor") })); - pListener.trace(MessageLoader.getLevel(Messages.JVM), origin, MessageFormat.format( - MessageLoader.getMessage(Messages.JVM), new Object[] { - System.getProperty("java.vm.name"), System.getProperty("java.vm.version"), - System.getProperty("java.vm.vendor") })); - pListener.trace(MessageLoader.getLevel(Messages.CONFIGURATION_URL), origin, MessageFormat - .format(MessageLoader.getMessage(Messages.CONFIGURATION_URL), - new Object[] { WBEMConfiguration.getActiveConfigURL() })); - if (!WBEMConfiguration.isConfigurationLoadSuccessful()) { - pListener.trace(MessageLoader.getLevel(Messages.CONFIGURATION_LOAD_FAILED), origin, - MessageLoader.getMessage(Messages.CONFIGURATION_LOAD_FAILED)); - if (WBEMConfiguration.getConfigurationLoadException() != null) { - pListener.trace(MessageLoader - .getLevel(Messages.EXCEPTION_DURING_CONFIGURATION_LOAD), origin, - MessageLoader.getMessage(Messages.EXCEPTION_DURING_CONFIGURATION_LOAD), - WBEMConfiguration.getConfigurationLoadException()); - } - } - } - - /** - * Remove a listener. This listener will not be notified of log events - * anymore. - * - * @param pListener - * The listener - */ - public synchronized void removeLogListener(LogListener pListener) { - ArrayList newListeners = new ArrayList(this.iLogListeners); - if (!newListeners.remove(pListener)) return; - this.iLogListeners = newListeners; - - if (this.iInternalListenerLogFile != null - && this.iInternalListenerLogFile.equals(pListener)) { - // Removing internal log listener for file - this.iInternalListenerLogFile = null; - this.iNumInternalLogListeners--; - } else if (this.iInternalListenerLogConsole != null - && this.iInternalListenerLogConsole.equals(pListener)) { - // Removing internal log listener for console - this.iInternalListenerLogConsole = null; - this.iNumInternalLogListeners--; - } else { - // Removing user log listener - this.iNumExternalLogListeners--; - } - } - - /** - * Removes all listeners. Caution this will also remove the internal console - * and file loggers. - */ - public synchronized void clearLogListeners() { - this.iLogListeners = new ArrayList(); - removeHandlers(Logger.getLogger(CONSOLE_LOGGER)); - removeHandlers(Logger.getLogger(FILE_LOGGER)); - - this.iInternalListenerLogFile = null; - this.iInternalListenerLogConsole = null; - this.iNumInternalLogListeners = 0; - this.iNumExternalLogListeners = 0; - } - - /** - * Gets the registered log listeners including the internal console and file - * loggers. - * - * @return The list of listeners - */ - public List getLogListeners() { - return this.iLogListeners; - } - - /** - * Adds a listener for log messages. The listener will be notified of any - * trace event. - * - * @param pListener - * The listener - */ - public synchronized void addTraceListener(TraceListener pListener) { - if (pListener == null) return; - sendGreetings(pListener); - ArrayList newListeners = new ArrayList(this.iTraceListeners); - newListeners.add(pListener); - this.iTraceListeners = newListeners; - - if ((this.iInternalListenerTraceFile != null && this.iInternalListenerTraceFile - .equals(pListener)) - || (this.iInternalListenerTraceConsole != null && this.iInternalListenerTraceConsole - .equals(pListener))) { - this.iNumInternalTraceListeners++; - } else { - this.iNumExternalTraceListeners++; - } - } - - /** - * Removes a listener. This listener will not be notified of trace events - * anymore. - * - * @param pListener - * The listener - */ - public synchronized void removeTraceListener(TraceListener pListener) { - ArrayList newListeners = new ArrayList(this.iTraceListeners); - if (!newListeners.remove(pListener)) return; - this.iTraceListeners = newListeners; - - if (this.iInternalListenerTraceFile != null - && this.iInternalListenerTraceFile.equals(pListener)) { - // Removing internal tracelistener for file - this.iInternalListenerTraceFile = null; - this.iNumInternalTraceListeners--; - } else if (this.iInternalListenerTraceConsole != null - && this.iInternalListenerTraceConsole.equals(pListener)) { - // Removing internal trace listener for console - this.iInternalListenerTraceConsole = null; - this.iNumInternalTraceListeners--; - } else { - // Removing user trace listener - this.iNumExternalTraceListeners--; - } - } - - /** - * Removes all listeners. Caution this will also remove the internal trace - * file listener. - */ - public synchronized void clearTraceListeners() { - this.iTraceListeners = new ArrayList(); - removeHandlers(Logger.getLogger(TRACE_LOGGER)); - - this.iInternalListenerTraceFile = null; - this.iInternalListenerTraceConsole = null; - this.iNumInternalTraceListeners = 0; - this.iNumExternalTraceListeners = 0; - } - - /** - * Gets the registered trace listeners including the internal console and - * file loggers. - * - * @return A list of listeners - */ - public List getTraceListeners() { - return this.iTraceListeners; - } - - /** - * Adds a listener for CIM-XML trace messages. The listener will be notified - * of any CIM-XML trace event. - * - * @param pListener - * The listener - */ - public synchronized void addCIMXMLTraceListener(CIMXMLTraceListener pListener) { - if (pListener == null) return; - ArrayList newListeners = new ArrayList( - this.iCIMXMLTraceListeners); - newListeners.add(pListener); - this.iCIMXMLTraceListeners = newListeners; - } - - /** - * Removes a CIM-XML trace listener. This listener will not be notified of - * CIM-XML trace events anymore. - * - * @param pListener - * The listener - */ - public synchronized void removeCIMXMLTraceListener(CIMXMLTraceListener pListener) { - ArrayList newListeners = new ArrayList( - this.iCIMXMLTraceListeners); - if (!newListeners.remove(pListener)) return; - this.iCIMXMLTraceListeners = newListeners; - } - - /** - * Removes all CIM-XML trace listeners. - */ - public synchronized void clearCIMXMLTraceListeners() { - if (this.iCIMXMLTraceListeners.size() > 0) this.iCIMXMLTraceListeners = new ArrayList(); - } - - /** - * Gets the registered CIM-XML trace listeners. - * - * @return A list of listeners - */ - public List getCIMXMLTraceListeners() { - return this.iCIMXMLTraceListeners; - } - - /** - * Forwards a log/trace message to the registered log&trace listeners. - * - * @param pKey - * The message identifier. - */ - public void message(String pKey) { - message(pKey, (Object[]) null); - } - - /** - * Forwards a log/trace message to the registered log&trace listeners. - * - * @param pKey - * The message identifier. - * @param pParameter - * The parameter for the message - */ - public void message(String pKey, Object pParameter) { - message(pKey, new Object[] { pParameter }); - } - - /** - * Forwards a log/trace message to the registered log&trace listeners. - * - * @param pKey - * The message identifier. - * @param pParameters - * The parameters for the message - */ - public void message(String pKey, Object[] pParameters) { - try { - final String message = MessageLoader.getMessage(pKey); - final String localMessage = MessageLoader.getLocalizedMessage(pKey); - final Level level = MessageLoader.getLevel(pKey); - if (isLoggableTrace(level)) { - final List traceListeners = getTraceListeners(); - StackTraceElement caller = getCaller(); - for (int i = 0; i < traceListeners.size(); ++i) { - traceListeners.get(i).trace(level, caller, - pKey + " " + MessageFormat.format(message, pParameters)); - } - } - final List logListeners = getLogListeners(); - for (int i = 0; i < logListeners.size(); ++i) { - logListeners.get(i).log(level, pKey, localMessage, pParameters); - } - } catch (Exception e) { - // don't crash for logging - } - } - - /** - * Forwards a trace message to the registered trace listeners. - * - * @param pLevel - * One of the three message level identifiers FINE, FINER and - * FINEST - * @param pMessage - * The message text - */ - public void trace(Level pLevel, String pMessage) { - try { - if (isLoggableTrace(pLevel)) { - final List traceListeners = getTraceListeners(); - StackTraceElement caller = getCaller(); - for (int i = 0; i < traceListeners.size(); ++i) { - traceListeners.get(i).trace(pLevel, caller, pMessage); - } - } - } catch (Exception e) { - // don't crash for logging - } - } - - /** - * Forwards a trace message to the registered trace listeners. - * - * @param pLevel - * One of the three message level identifiers FINE, FINER and - * FINEST - * @param pMessage - * The message text - * @param pThrown - * The throwable associated with the message - */ - public void trace(Level pLevel, String pMessage, Throwable pThrown) { - try { - if (isLoggableTrace(pLevel)) { - final List traceListeners = getTraceListeners(); - StackTraceElement caller = getCaller(); - for (int i = 0; i < traceListeners.size(); ++i) { - traceListeners.get(i).trace(pLevel, caller, pMessage, pThrown); - } - } - } catch (Exception e) { - // don't crash for logging - } - } - - /** - * Forwards a CIM-XML trace message to the registered CIM-XML trace - * listeners. - * - * @param pLevel - * One of the message level identifiers, e.g. FINE - * @param pMessage - * The CIM-XML message text - * @param pOutgoing - * true if CIM-XML is outgoing (being sent from - * client to server), false if CIM-XML is incoming - * (being sent from server to client) - */ - public void traceCIMXML(Level pLevel, String pMessage, boolean pOutgoing) { - try { - if (this.iCIMXMLTraceListeners.size() > 0) { - final List traceListeners = getCIMXMLTraceListeners(); - for (int i = 0; i < traceListeners.size(); ++i) { - traceListeners.get(i).traceCIMXML(pLevel, pMessage, pOutgoing); - } - } - } catch (Exception e) { - // don't crash for logging - } - } - - /** - * Forwards a method entry message to the registered trace listeners. - */ - public void entry() { - trace(Level.FINEST, "Entering method"); - } - - /** - * Forwards a method exit message to the registered trace listeners. - */ - public void exit() { - trace(Level.FINEST, "Exiting method"); - } - - /** - * Returns the output stream to which all CIM-XML traffic (outgoing & - * incoming) will be copied for debugging purposes. - * - * @return The output stream. A null value means that CIM-XML - * debugging is disabled - */ - public OutputStream getXmlTraceStream() { - return this.iXmlTraceStream; - } - - /** - * Sets an output stream to which all CIM-XML traffic (outgoing & - * incoming) will be copied for debugging purposes. - * - * @param pStream - * The output stream. A null value means that - * CIM-XML debugging is disabled. - */ - public void setXmlTraceStream(OutputStream pStream) { - this.iXmlTraceStream = pStream; - } - - /* - * Initializes the CIM-XML trace file (sblim.wbem.cimxmlTraceStream) during - * initialization of LogAndTraceBroker - the trace file is used if CIM-XML - * tracing is enabled (sblim.wbem.cimxmlTracing=true) but there is no - * CIM-XML trace stream set via setXmlTraceStream() - */ - private void initXmlTraceFile() { - try { - if (WBEMConfiguration.getGlobalConfiguration().isCimXmlTracingEnabled()) { - String filename = WBEMConfiguration.getGlobalConfiguration().getCimXmlTraceStream(); - if (filename != null && filename.length() > 0 && this.iXmlTraceFile == null - && getXmlTraceStream() == null) { - if (filename.equalsIgnoreCase("System.out")) { - this.iXmlTraceFile = System.out; - } else if (filename.equalsIgnoreCase("System.err")) { - this.iXmlTraceFile = System.err; - } else { - try { - this.iXmlTraceFile = new FileOutputStream(filename); - } catch (IOException e) { - trace(Level.FINE, "Unable to open " - + WBEMConfigurationProperties.CIMXML_TRACE_STREAM + "=" - + filename, e); - } - } - setXmlTraceStream(this.iXmlTraceFile); - } - } - } catch (Exception e) { - // Don't crash for logging - } - } - - /** - * Analyzes the stack trace and determines from where the - * LogAndTraceBroker was called. - * - * @return First StackTraceElement outside the - * LogAndTraceBroker - */ - private StackTraceElement getCaller() { - StackTraceElement[] stack = (new Throwable()).getStackTrace(); - for (int i = 0; i < stack.length; ++i) { - StackTraceElement frame = stack[i]; - String cname = frame.getClassName(); - if (!this.iTHIS_CLASS.equals(cname) && !this.iTHROWABLE.equals(cname)) { return frame; } - } - return null; - } - - /** - * Removes all handlers from a logger - * - * @param pLogger - * The logger - */ - private void removeHandlers(Logger pLogger) { - Handler[] handlers = pLogger.getHandlers(); - for (int i = 0; i < handlers.length; ++i) { - pLogger.removeHandler(handlers[i]); - handlers[i].close(); - } - } - - /** - * Checks whether there are trace listeners installed that will log a trace - * message with the specified level. Use this method to determine if a - * trace() method call could result in logging before preparing the - * information to be logged. For example: - * - *
      -	 *     if (logger.isLoggableTrace(Level.WARNING) {
      -	 *         // Prepare info for logging
      -	 *         logger.trace(Level.WARNING, ...
      -	 * 
      - * - * @param pLevel - * The Level of the trace message. - * @return true if trace message could be logged, - * false otherwise. - */ - public boolean isLoggableTrace(Level pLevel) { - // If there are no trace listeners or specified level is OFF, message - // will not be logged - if (this.iTraceListeners.size() == 0 || pLevel.intValue() == Level.OFF.intValue()) return false; - - // If there are external trace listeners, message could be logged (user - // can alter level at will, so we do not know what it is) - if (this.iNumExternalTraceListeners > 0) return true; - - // If there are internal trace listeners, determine if message will be - // logged - if (this.iNumInternalTraceListeners > 0) { - int level = Level.OFF.intValue(); - if (this.iInternalListenerTraceFile != null) { - level = this.iInternalLevelTraceFile; - } - if (this.iInternalListenerTraceConsole != null && level > this.iInternalLevelConsole) { - level = this.iInternalLevelConsole; - } - return level <= pLevel.intValue(); - } - - return true; - } - - /** - * Checks whether there are log listeners installed that will log a message - * with the specified level. Use this method to determine if a message() - * method call could result in logging before preparing the information to - * be logged. For example: - * - *
      -	 *     if (logger.isLoggableMessage(Level.WARNING) {
      -	 *         // Prepare info for logging
      -	 *         logger.message(Level.WARNING, ...
      -	 * 
      - * - * @param pLevel - * The Level of the message. - * @return true if message could be logged, false - * otherwise. - */ - public boolean isLoggableMessage(Level pLevel) { - // If message is traceable, message could be logged - if (isLoggableTrace(pLevel)) return true; - - // If there are no log listeners or specified level is OFF, message - // will not be logged - if (this.iLogListeners.size() == 0 || pLevel.intValue() == Level.OFF.intValue()) return false; - - // If there are external log listeners, message could be logged (user - // can alter level at will, so we do not know what it is) - if (this.iNumExternalLogListeners > 0) return true; - - // If there are internal log listeners, determine if message will be - // logged - if (this.iNumInternalLogListeners > 0) { - int level = Level.OFF.intValue(); - if (this.iInternalListenerLogFile != null) { - level = this.iInternalLevelLogFile; - } - if (this.iInternalListenerLogConsole != null && level > this.iInternalLevelConsole) { - level = this.iInternalLevelConsole; - } - return level <= pLevel.intValue(); - } - - return true; - } - - /** - * Checks whether there are CIM-XML trace listeners installed that will log - * a CIM-XML trace message. Use this method to determine if a trace() method - * call could result in logging before preparing the information to be - * logged. For example: - * - *
      -	 *     if (logger.isLoggableCIMXMLTrace(Level.FINEST) {
      -	 *         // Prepare info for logging
      -	 *         logger.traceCIMXML(Level.FINEST, ...
      -	 * 
      - * - * @param pLevel - * The Level of the trace message. - * @return true if CIM-XML trace message could be logged, - * false otherwise. - */ - public boolean isLoggableCIMXMLTrace(Level pLevel) { - // If there are no CIM-XML trace listeners or specified level is OFF, - // message will not be logged - if (this.iCIMXMLTraceListeners.size() == 0 || pLevel.intValue() == Level.OFF.intValue()) return false; - - return true; - } -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Alexander Wolf-Reber, IBM, a.wolf-reber@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1565892 2006-11-14 lupusalex Make SBLIM client JSR48 compliant + * 1711092 2006-05-02 lupusalex Some fixes/additions of log&trace messages + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors + * 3001345 2010-05-18 blaschke-oss File handle leaks in HttpSocketFactory and LogAndTraceBroker + * 3027618 2010-07-14 blaschke-oss Close files/readers in finally blocks + * 3154232 2011-01-13 blaschke-oss EmbeddedObject misspelled in javadoc + * 3252669 2011-03-28 blaschke-oss setXmlTraceStream blindly closes previous stream + * 3400209 2011-08-31 blaschke-oss Highlighted Static Analysis (PMD) issues + * 3469018 2012-01-03 blaschke-oss Properties not passed to CIMIndicationHandler + * 3484014 2012-02-03 blaschke-oss Add LogAndTraceBroker.isLoggable for message/trace + * 3489638 2012-02-28 blaschke-oss PERF: Bottleneck in LogAndTraceBroker.java - getCaller() + * 3554738 2012-08-16 blaschke-oss dump CIM xml by LogAndTraceBroker.trace() + * 3576396 2012-10-11 blaschke-oss Improve logging of config file name + * 3596303 2013-01-04 blaschke-oss windows http response WWW-Authenticate: Negotiate fails + * 2652 2013-07-26 blaschke-oss LogAndTraceBroker.setXmlTraceStream should not close previous stream + * 2651 2013-07-31 blaschke-oss IOException when tracing the cimxml + */ + +package org.metricshub.wbem.sblim.cimclient.internal.logging; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; +import java.util.logging.ConsoleHandler; +import java.util.logging.FileHandler; +import java.util.logging.Handler; +import java.util.logging.Level; +import java.util.logging.LogRecord; +import java.util.logging.Logger; + +import org.metricshub.wbem.sblim.cimclient.LogAndTraceManager; +import org.metricshub.wbem.sblim.cimclient.WBEMConfigurationProperties; +import org.metricshub.wbem.sblim.cimclient.internal.util.WBEMConfiguration; +import org.metricshub.wbem.sblim.cimclient.internal.util.WBEMConstants; +import org.metricshub.wbem.sblim.cimclient.CIMXMLTraceListener; +import org.metricshub.wbem.sblim.cimclient.LogListener; +import org.metricshub.wbem.sblim.cimclient.TraceListener; + +/** + * Class LogAndTraceBroker is the central class that implements the logging and + * tracing of the CIM Client. It manages the collections of the internal log and + * trace listeners. It sets up the application independent logging. It provides + * the API to send log and trace messages and forwards them to the appropriate + * listeners. + * + */ +public class LogAndTraceBroker { + + private static final String TRACE_LOGGER = "org.metricshub.wbem.sblim.cimclient.trace"; + + private static final String FILE_LOGGER = "org.metricshub.wbem.sblim.cimclient.file"; + + private static final String CONSOLE_LOGGER = "org.metricshub.wbem.sblim.cimclient.console"; + + private static LogAndTraceBroker cBroker = new LogAndTraceBroker(); + + /** + * Returns the singleton instance of the broker + * + * @return The broker instance + */ + public static LogAndTraceBroker getBroker() { + return cBroker; + } + + /** + * Returns if the logging framework has been initialized. This method is + * used by the WBEMConfiguration class to determine if the + * logging is already up. The WBEMConfiguration is initialized + * before the logging, so methods in this class cannot assume the logging to + * be up and running. + * + * @return true if the logging is up, false + * otherwise + */ + public static boolean isLoggingStarted() { + return cBroker != null; + } + + private volatile ArrayList iLogListeners; + + private volatile ArrayList iTraceListeners; + + private volatile ArrayList iCIMXMLTraceListeners; + + private String iProductName = "SBLIM CIM Client for Java"; + + private String iCopyright = "COPYRIGHT (C) 2006, 2013 IBM Corp."; + + private String iVersion = "?"; + + private String iBuildDate = "?"; + + private String iBuildTime = "?"; + + private OutputStream iXmlTraceStream = null; + + private OutputStream iXmlTraceFile = null; + + private final String iTHIS_CLASS = this.getClass().getName(); + + private final String iTHROWABLE = Throwable.class.getName(); + + private int iInternalLevelConsole = Level.OFF.intValue(); + + private int iInternalLevelLogFile = Level.OFF.intValue(); + + private int iInternalLevelTraceFile = Level.OFF.intValue(); + + private LogListener iInternalListenerLogConsole = null; + + private LogListener iInternalListenerLogFile = null; + + private TraceListener iInternalListenerTraceConsole = null; + + private TraceListener iInternalListenerTraceFile = null; + + private int iNumInternalLogListeners = 0; + + private int iNumExternalLogListeners = 0; + + private int iNumInternalTraceListeners = 0; + + private int iNumExternalTraceListeners = 0; + + private LogAndTraceBroker() { + this.iLogListeners = new ArrayList(); + this.iTraceListeners = new ArrayList(); + this.iCIMXMLTraceListeners = new ArrayList(); + loadVersionTxt(); + registerInternalListeners(); + initXmlTraceFile(); + } + + @Override + protected void finalize() throws Throwable { + try { + if (this.iXmlTraceFile != null && (!this.iXmlTraceFile.equals(System.out)) + && (!this.iXmlTraceFile.equals(System.err))) this.iXmlTraceFile.close(); + } catch (IOException e) { + // bad luck + } finally { + this.iXmlTraceFile = null; + super.finalize(); + } + } + + /** + * Registers the listeners for our internal loggers + */ + public void registerInternalListeners() { + try { + Level level = WBEMConfiguration.getGlobalConfiguration().getLogConsoleLevel(); + String type = WBEMConfiguration.getGlobalConfiguration().getLogConsoleType(); + if (level.intValue() < Level.OFF.intValue() && WBEMConstants.MESSAGE.equals(type)) { + final Logger logger = Logger.getLogger(CONSOLE_LOGGER); + final Handler handler = new ConsoleHandler(); + handler.setFormatter(new LogFormatter()); + handler.setLevel(level); + logger.addHandler(handler); + logger.setLevel(level); + logger.setUseParentHandlers(false); + this.iInternalLevelConsole = level.intValue(); + if (this.iInternalListenerLogConsole != null) removeLogListener(this.iInternalListenerLogConsole); + this.iInternalListenerLogConsole = new LogListener() { + + public void log(Level pLevel, String pMessageKey, String pMessage, + Object[] pParameters) { + LogRecord record = new LogRecord(pLevel, pMessageKey + " " + pMessage); + record.setParameters(pParameters); + logger.log(record); + } + }; + addLogListener(this.iInternalListenerLogConsole); + } + } catch (Exception e) { + // Don't crash for logging + } + try { + Level level = WBEMConfiguration.getGlobalConfiguration().getLogFileLevel(); + String location = WBEMConfiguration.getGlobalConfiguration().getLogFileLocation(); + int size = WBEMConfiguration.getGlobalConfiguration().getLogFileSizeLimit(); + int count = WBEMConfiguration.getGlobalConfiguration().getLogFileCount(); + if (level.intValue() < Level.OFF.intValue()) { + final Logger logger = Logger.getLogger(FILE_LOGGER); + final Handler handler = new FileHandler(location, size, count); + handler.setFormatter(new LogFormatter()); + handler.setLevel(level); + logger.addHandler(handler); + logger.setLevel(level); + logger.setUseParentHandlers(false); + this.iInternalLevelLogFile = level.intValue(); + if (this.iInternalListenerLogFile != null) removeLogListener(this.iInternalListenerLogFile); + this.iInternalListenerLogFile = new LogListener() { + + public void log(Level pLevel, String pMessageKey, String pMessage, + Object[] pParameters) { + LogRecord record = new LogRecord(pLevel, pMessageKey + " " + pMessage); + record.setParameters(pParameters); + logger.log(record); + } + }; + addLogListener(this.iInternalListenerLogFile); + } + } catch (Exception e) { + // Don't crash for logging + } + try { + Level level = WBEMConfiguration.getGlobalConfiguration().getLogConsoleLevel(); + String type = WBEMConfiguration.getGlobalConfiguration().getLogConsoleType(); + if (level.intValue() < Level.OFF.intValue() && WBEMConstants.TRACE.equals(type)) { + final Logger logger = Logger.getLogger(CONSOLE_LOGGER); + final Handler handler = new ConsoleHandler(); + handler.setFormatter(new TraceFormatter()); + handler.setLevel(level); + logger.addHandler(handler); + logger.setLevel(level); + logger.setUseParentHandlers(false); + this.iInternalLevelConsole = level.intValue(); + if (this.iInternalListenerTraceConsole != null) removeTraceListener(this.iInternalListenerTraceConsole); + this.iInternalListenerTraceConsole = new TraceListener() { + + public void trace(Level pLevel, StackTraceElement pOrigin, String pMessage) { + LogRecord record = new LogRecord(pLevel, pMessage); + record.setSourceMethodName(String.valueOf(pOrigin)); + logger.log(record); + } + + public void trace(Level pLevel, StackTraceElement pOrigin, String pMessage, + Throwable pThrown) { + LogRecord record = new LogRecord(pLevel, pMessage); + record.setSourceMethodName(String.valueOf(pOrigin)); + record.setThrown(pThrown); + logger.log(record); + } + }; + addTraceListener(this.iInternalListenerTraceConsole); + } + } catch (Exception e) { + // Don't crash for logging + } + try { + Level level = WBEMConfiguration.getGlobalConfiguration().getTraceFileLevel(); + String location = WBEMConfiguration.getGlobalConfiguration().getTraceFileLocation(); + int size = WBEMConfiguration.getGlobalConfiguration().getTraceFileSizeLimit(); + int count = WBEMConfiguration.getGlobalConfiguration().getTraceFileCount(); + if (level.intValue() < Level.OFF.intValue()) { + final Logger logger = Logger.getLogger(TRACE_LOGGER); + final Handler handler = new FileHandler(location, size, count); + handler.setFormatter(new TraceFormatter()); + handler.setLevel(level); + logger.addHandler(handler); + logger.setLevel(level); + logger.setUseParentHandlers(false); + this.iInternalLevelTraceFile = level.intValue(); + if (this.iInternalListenerTraceFile != null) removeTraceListener(this.iInternalListenerTraceFile); + this.iInternalListenerTraceFile = new TraceListener() { + + public void trace(Level pLevel, StackTraceElement pOrigin, String pMessage) { + LogRecord record = new LogRecord(pLevel, pMessage); + record.setSourceMethodName(String.valueOf(pOrigin)); + logger.log(record); + } + + public void trace(Level pLevel, StackTraceElement pOrigin, String pMessage, + Throwable pThrown) { + LogRecord record = new LogRecord(pLevel, pMessage); + record.setSourceMethodName(String.valueOf(pOrigin)); + record.setThrown(pThrown); + logger.log(record); + } + }; + addTraceListener(this.iInternalListenerTraceFile); + } + } catch (Exception e) { + // Don't crash for logging + } + } + + /** + * Adds a listener for log messages. The listener will be notified of any + * log event. Uses copy on write to ensure concurrent read access. + * + * @param pListener + * The listener + */ + public synchronized void addLogListener(LogListener pListener) { + if (pListener == null) return; + sendGreetings(pListener); + ArrayList newListeners = new ArrayList(this.iLogListeners); + newListeners.add(pListener); + this.iLogListeners = newListeners; + + if ((this.iInternalListenerLogFile != null && this.iInternalListenerLogFile + .equals(pListener)) + || (this.iInternalListenerLogConsole != null && this.iInternalListenerLogConsole + .equals(pListener))) { + this.iNumInternalLogListeners++; + } else { + this.iNumExternalLogListeners++; + } + } + + private void loadVersionTxt() { + InputStream is = null; + try { + Properties version = new Properties(); + is = LogAndTraceManager.class.getResourceAsStream("version.txt"); + version.load(is); + this.iProductName = version.getProperty("PRODUCTNAME"); + this.iCopyright = version.getProperty("COPYRIGHT"); + this.iVersion = version.getProperty("VERSION"); + this.iBuildDate = version.getProperty("BUILDDATE"); + this.iBuildTime = version.getProperty("BUILDTIME"); + } catch (Exception e) { + // nothing to do + } finally { + if (is != null) { + try { + is.close(); + } catch (IOException e) { + // nothing ro do + } + } + } + } + + private void sendGreetings(LogListener pListener) { + + pListener.log(MessageLoader.getLevel(Messages.GREETING), Messages.GREETING, MessageLoader + .getLocalizedMessage(Messages.GREETING), new Object[] { this.iProductName, + this.iCopyright }); + pListener.log(MessageLoader.getLevel(Messages.RELEASE), Messages.RELEASE, MessageLoader + .getLocalizedMessage(Messages.RELEASE), new Object[] { this.iVersion, + this.iBuildDate, this.iBuildTime }); + pListener.log(MessageLoader.getLevel(Messages.OS), Messages.OS, MessageLoader + .getLocalizedMessage(Messages.OS), new Object[] { System.getProperty("os.name"), + System.getProperty("os.version"), System.getProperty("os.arch") }); + pListener.log(MessageLoader.getLevel(Messages.JRE), Messages.JRE, MessageLoader + .getLocalizedMessage(Messages.JRE), new Object[] { + System.getProperty("java.version"), System.getProperty("java.vendor") }); + pListener.log(MessageLoader.getLevel(Messages.JVM), Messages.JVM, MessageLoader + .getLocalizedMessage(Messages.JVM), new Object[] { + System.getProperty("java.vm.name"), System.getProperty("java.vm.version"), + System.getProperty("java.vm.vendor") }); + pListener.log(MessageLoader.getLevel(Messages.CONFIGURATION_URL), + Messages.CONFIGURATION_URL, MessageLoader + .getLocalizedMessage(Messages.CONFIGURATION_URL), + new Object[] { WBEMConfiguration.getActiveConfigFullURL() }); + if (!WBEMConfiguration.isConfigurationLoadSuccessful()) { + pListener.log(MessageLoader.getLevel(Messages.CONFIGURATION_LOAD_FAILED), + Messages.CONFIGURATION_LOAD_FAILED, MessageLoader + .getLocalizedMessage(Messages.CONFIGURATION_LOAD_FAILED), + (Object[]) null); + if (WBEMConfiguration.getConfigurationLoadException() != null) { + pListener.log(MessageLoader.getLevel(Messages.EXCEPTION_DURING_CONFIGURATION_LOAD), + Messages.EXCEPTION_DURING_CONFIGURATION_LOAD, MessageLoader + .getLocalizedMessage(Messages.EXCEPTION_DURING_CONFIGURATION_LOAD), + new Object[] { WBEMConfiguration.getConfigurationLoadException() + .getMessage() }); + } + } + } + + private void sendGreetings(TraceListener pListener) { + StackTraceElement origin = new Throwable().getStackTrace()[0]; + pListener.trace(MessageLoader.getLevel(Messages.GREETING), origin, MessageFormat.format( + MessageLoader.getMessage(Messages.GREETING), new Object[] { this.iProductName, + this.iCopyright })); + pListener.trace(MessageLoader.getLevel(Messages.RELEASE), origin, MessageFormat.format( + MessageLoader.getMessage(Messages.RELEASE), new Object[] { this.iVersion, + this.iBuildDate, this.iBuildTime })); + pListener.trace(MessageLoader.getLevel(Messages.OS), origin, MessageFormat.format( + MessageLoader.getMessage(Messages.OS), new Object[] { + System.getProperty("os.name"), System.getProperty("os.version"), + System.getProperty("os.arch") })); + pListener.trace(MessageLoader.getLevel(Messages.JRE), origin, MessageFormat.format( + MessageLoader.getMessage(Messages.JRE), new Object[] { + System.getProperty("java.version"), System.getProperty("java.vendor") })); + pListener.trace(MessageLoader.getLevel(Messages.JVM), origin, MessageFormat.format( + MessageLoader.getMessage(Messages.JVM), new Object[] { + System.getProperty("java.vm.name"), System.getProperty("java.vm.version"), + System.getProperty("java.vm.vendor") })); + pListener.trace(MessageLoader.getLevel(Messages.CONFIGURATION_URL), origin, MessageFormat + .format(MessageLoader.getMessage(Messages.CONFIGURATION_URL), + new Object[] { WBEMConfiguration.getActiveConfigURL() })); + if (!WBEMConfiguration.isConfigurationLoadSuccessful()) { + pListener.trace(MessageLoader.getLevel(Messages.CONFIGURATION_LOAD_FAILED), origin, + MessageLoader.getMessage(Messages.CONFIGURATION_LOAD_FAILED)); + if (WBEMConfiguration.getConfigurationLoadException() != null) { + pListener.trace(MessageLoader + .getLevel(Messages.EXCEPTION_DURING_CONFIGURATION_LOAD), origin, + MessageLoader.getMessage(Messages.EXCEPTION_DURING_CONFIGURATION_LOAD), + WBEMConfiguration.getConfigurationLoadException()); + } + } + } + + /** + * Remove a listener. This listener will not be notified of log events + * anymore. + * + * @param pListener + * The listener + */ + public synchronized void removeLogListener(LogListener pListener) { + ArrayList newListeners = new ArrayList(this.iLogListeners); + if (!newListeners.remove(pListener)) return; + this.iLogListeners = newListeners; + + if (this.iInternalListenerLogFile != null + && this.iInternalListenerLogFile.equals(pListener)) { + // Removing internal log listener for file + this.iInternalListenerLogFile = null; + this.iNumInternalLogListeners--; + } else if (this.iInternalListenerLogConsole != null + && this.iInternalListenerLogConsole.equals(pListener)) { + // Removing internal log listener for console + this.iInternalListenerLogConsole = null; + this.iNumInternalLogListeners--; + } else { + // Removing user log listener + this.iNumExternalLogListeners--; + } + } + + /** + * Removes all listeners. Caution this will also remove the internal console + * and file loggers. + */ + public synchronized void clearLogListeners() { + this.iLogListeners = new ArrayList(); + removeHandlers(Logger.getLogger(CONSOLE_LOGGER)); + removeHandlers(Logger.getLogger(FILE_LOGGER)); + + this.iInternalListenerLogFile = null; + this.iInternalListenerLogConsole = null; + this.iNumInternalLogListeners = 0; + this.iNumExternalLogListeners = 0; + } + + /** + * Gets the registered log listeners including the internal console and file + * loggers. + * + * @return The list of listeners + */ + public List getLogListeners() { + return this.iLogListeners; + } + + /** + * Adds a listener for log messages. The listener will be notified of any + * trace event. + * + * @param pListener + * The listener + */ + public synchronized void addTraceListener(TraceListener pListener) { + if (pListener == null) return; + sendGreetings(pListener); + ArrayList newListeners = new ArrayList(this.iTraceListeners); + newListeners.add(pListener); + this.iTraceListeners = newListeners; + + if ((this.iInternalListenerTraceFile != null && this.iInternalListenerTraceFile + .equals(pListener)) + || (this.iInternalListenerTraceConsole != null && this.iInternalListenerTraceConsole + .equals(pListener))) { + this.iNumInternalTraceListeners++; + } else { + this.iNumExternalTraceListeners++; + } + } + + /** + * Removes a listener. This listener will not be notified of trace events + * anymore. + * + * @param pListener + * The listener + */ + public synchronized void removeTraceListener(TraceListener pListener) { + ArrayList newListeners = new ArrayList(this.iTraceListeners); + if (!newListeners.remove(pListener)) return; + this.iTraceListeners = newListeners; + + if (this.iInternalListenerTraceFile != null + && this.iInternalListenerTraceFile.equals(pListener)) { + // Removing internal tracelistener for file + this.iInternalListenerTraceFile = null; + this.iNumInternalTraceListeners--; + } else if (this.iInternalListenerTraceConsole != null + && this.iInternalListenerTraceConsole.equals(pListener)) { + // Removing internal trace listener for console + this.iInternalListenerTraceConsole = null; + this.iNumInternalTraceListeners--; + } else { + // Removing user trace listener + this.iNumExternalTraceListeners--; + } + } + + /** + * Removes all listeners. Caution this will also remove the internal trace + * file listener. + */ + public synchronized void clearTraceListeners() { + this.iTraceListeners = new ArrayList(); + removeHandlers(Logger.getLogger(TRACE_LOGGER)); + + this.iInternalListenerTraceFile = null; + this.iInternalListenerTraceConsole = null; + this.iNumInternalTraceListeners = 0; + this.iNumExternalTraceListeners = 0; + } + + /** + * Gets the registered trace listeners including the internal console and + * file loggers. + * + * @return A list of listeners + */ + public List getTraceListeners() { + return this.iTraceListeners; + } + + /** + * Adds a listener for CIM-XML trace messages. The listener will be notified + * of any CIM-XML trace event. + * + * @param pListener + * The listener + */ + public synchronized void addCIMXMLTraceListener(CIMXMLTraceListener pListener) { + if (pListener == null) return; + ArrayList newListeners = new ArrayList( + this.iCIMXMLTraceListeners); + newListeners.add(pListener); + this.iCIMXMLTraceListeners = newListeners; + } + + /** + * Removes a CIM-XML trace listener. This listener will not be notified of + * CIM-XML trace events anymore. + * + * @param pListener + * The listener + */ + public synchronized void removeCIMXMLTraceListener(CIMXMLTraceListener pListener) { + ArrayList newListeners = new ArrayList( + this.iCIMXMLTraceListeners); + if (!newListeners.remove(pListener)) return; + this.iCIMXMLTraceListeners = newListeners; + } + + /** + * Removes all CIM-XML trace listeners. + */ + public synchronized void clearCIMXMLTraceListeners() { + if (this.iCIMXMLTraceListeners.size() > 0) this.iCIMXMLTraceListeners = new ArrayList(); + } + + /** + * Gets the registered CIM-XML trace listeners. + * + * @return A list of listeners + */ + public List getCIMXMLTraceListeners() { + return this.iCIMXMLTraceListeners; + } + + /** + * Forwards a log/trace message to the registered log&trace listeners. + * + * @param pKey + * The message identifier. + */ + public void message(String pKey) { + message(pKey, (Object[]) null); + } + + /** + * Forwards a log/trace message to the registered log&trace listeners. + * + * @param pKey + * The message identifier. + * @param pParameter + * The parameter for the message + */ + public void message(String pKey, Object pParameter) { + message(pKey, new Object[] { pParameter }); + } + + /** + * Forwards a log/trace message to the registered log&trace listeners. + * + * @param pKey + * The message identifier. + * @param pParameters + * The parameters for the message + */ + public void message(String pKey, Object[] pParameters) { + try { + final String message = MessageLoader.getMessage(pKey); + final String localMessage = MessageLoader.getLocalizedMessage(pKey); + final Level level = MessageLoader.getLevel(pKey); + if (isLoggableTrace(level)) { + final List traceListeners = getTraceListeners(); + StackTraceElement caller = getCaller(); + for (int i = 0; i < traceListeners.size(); ++i) { + traceListeners.get(i).trace(level, caller, + pKey + " " + MessageFormat.format(message, pParameters)); + } + } + final List logListeners = getLogListeners(); + for (int i = 0; i < logListeners.size(); ++i) { + logListeners.get(i).log(level, pKey, localMessage, pParameters); + } + } catch (Exception e) { + // don't crash for logging + } + } + + /** + * Forwards a trace message to the registered trace listeners. + * + * @param pLevel + * One of the three message level identifiers FINE, FINER and + * FINEST + * @param pMessage + * The message text + */ + public void trace(Level pLevel, String pMessage) { + try { + if (isLoggableTrace(pLevel)) { + final List traceListeners = getTraceListeners(); + StackTraceElement caller = getCaller(); + for (int i = 0; i < traceListeners.size(); ++i) { + traceListeners.get(i).trace(pLevel, caller, pMessage); + } + } + } catch (Exception e) { + // don't crash for logging + } + } + + /** + * Forwards a trace message to the registered trace listeners. + * + * @param pLevel + * One of the three message level identifiers FINE, FINER and + * FINEST + * @param pMessage + * The message text + * @param pThrown + * The throwable associated with the message + */ + public void trace(Level pLevel, String pMessage, Throwable pThrown) { + try { + if (isLoggableTrace(pLevel)) { + final List traceListeners = getTraceListeners(); + StackTraceElement caller = getCaller(); + for (int i = 0; i < traceListeners.size(); ++i) { + traceListeners.get(i).trace(pLevel, caller, pMessage, pThrown); + } + } + } catch (Exception e) { + // don't crash for logging + } + } + + /** + * Forwards a CIM-XML trace message to the registered CIM-XML trace + * listeners. + * + * @param pLevel + * One of the message level identifiers, e.g. FINE + * @param pMessage + * The CIM-XML message text + * @param pOutgoing + * true if CIM-XML is outgoing (being sent from + * client to server), false if CIM-XML is incoming + * (being sent from server to client) + */ + public void traceCIMXML(Level pLevel, String pMessage, boolean pOutgoing) { + try { + if (this.iCIMXMLTraceListeners.size() > 0) { + final List traceListeners = getCIMXMLTraceListeners(); + for (int i = 0; i < traceListeners.size(); ++i) { + traceListeners.get(i).traceCIMXML(pLevel, pMessage, pOutgoing); + } + } + } catch (Exception e) { + // don't crash for logging + } + } + + /** + * Forwards a method entry message to the registered trace listeners. + */ + public void entry() { + trace(Level.FINEST, "Entering method"); + } + + /** + * Forwards a method exit message to the registered trace listeners. + */ + public void exit() { + trace(Level.FINEST, "Exiting method"); + } + + /** + * Returns the output stream to which all CIM-XML traffic (outgoing & + * incoming) will be copied for debugging purposes. + * + * @return The output stream. A null value means that CIM-XML + * debugging is disabled + */ + public OutputStream getXmlTraceStream() { + return this.iXmlTraceStream; + } + + /** + * Sets an output stream to which all CIM-XML traffic (outgoing & + * incoming) will be copied for debugging purposes. + * + * @param pStream + * The output stream. A null value means that + * CIM-XML debugging is disabled. + */ + public void setXmlTraceStream(OutputStream pStream) { + this.iXmlTraceStream = pStream; + } + + /* + * Initializes the CIM-XML trace file (sblim.wbem.cimxmlTraceStream) during + * initialization of LogAndTraceBroker - the trace file is used if CIM-XML + * tracing is enabled (sblim.wbem.cimxmlTracing=true) but there is no + * CIM-XML trace stream set via setXmlTraceStream() + */ + private void initXmlTraceFile() { + try { + if (WBEMConfiguration.getGlobalConfiguration().isCimXmlTracingEnabled()) { + String filename = WBEMConfiguration.getGlobalConfiguration().getCimXmlTraceStream(); + if (filename != null && filename.length() > 0 && this.iXmlTraceFile == null + && getXmlTraceStream() == null) { + if (filename.equalsIgnoreCase("System.out")) { + this.iXmlTraceFile = System.out; + } else if (filename.equalsIgnoreCase("System.err")) { + this.iXmlTraceFile = System.err; + } else { + try { + this.iXmlTraceFile = new FileOutputStream(filename); + } catch (IOException e) { + trace(Level.FINE, "Unable to open " + + WBEMConfigurationProperties.CIMXML_TRACE_STREAM + "=" + + filename, e); + } + } + setXmlTraceStream(this.iXmlTraceFile); + } + } + } catch (Exception e) { + // Don't crash for logging + } + } + + /** + * Analyzes the stack trace and determines from where the + * LogAndTraceBroker was called. + * + * @return First StackTraceElement outside the + * LogAndTraceBroker + */ + private StackTraceElement getCaller() { + StackTraceElement[] stack = (new Throwable()).getStackTrace(); + for (int i = 0; i < stack.length; ++i) { + StackTraceElement frame = stack[i]; + String cname = frame.getClassName(); + if (!this.iTHIS_CLASS.equals(cname) && !this.iTHROWABLE.equals(cname)) { return frame; } + } + return null; + } + + /** + * Removes all handlers from a logger + * + * @param pLogger + * The logger + */ + private void removeHandlers(Logger pLogger) { + Handler[] handlers = pLogger.getHandlers(); + for (int i = 0; i < handlers.length; ++i) { + pLogger.removeHandler(handlers[i]); + handlers[i].close(); + } + } + + /** + * Checks whether there are trace listeners installed that will log a trace + * message with the specified level. Use this method to determine if a + * trace() method call could result in logging before preparing the + * information to be logged. For example: + * + *
      +	 *     if (logger.isLoggableTrace(Level.WARNING) {
      +	 *         // Prepare info for logging
      +	 *         logger.trace(Level.WARNING, ...
      +	 * 
      + * + * @param pLevel + * The Level of the trace message. + * @return true if trace message could be logged, + * false otherwise. + */ + public boolean isLoggableTrace(Level pLevel) { + // If there are no trace listeners or specified level is OFF, message + // will not be logged + if (this.iTraceListeners.size() == 0 || pLevel.intValue() == Level.OFF.intValue()) return false; + + // If there are external trace listeners, message could be logged (user + // can alter level at will, so we do not know what it is) + if (this.iNumExternalTraceListeners > 0) return true; + + // If there are internal trace listeners, determine if message will be + // logged + if (this.iNumInternalTraceListeners > 0) { + int level = Level.OFF.intValue(); + if (this.iInternalListenerTraceFile != null) { + level = this.iInternalLevelTraceFile; + } + if (this.iInternalListenerTraceConsole != null && level > this.iInternalLevelConsole) { + level = this.iInternalLevelConsole; + } + return level <= pLevel.intValue(); + } + + return true; + } + + /** + * Checks whether there are log listeners installed that will log a message + * with the specified level. Use this method to determine if a message() + * method call could result in logging before preparing the information to + * be logged. For example: + * + *
      +	 *     if (logger.isLoggableMessage(Level.WARNING) {
      +	 *         // Prepare info for logging
      +	 *         logger.message(Level.WARNING, ...
      +	 * 
      + * + * @param pLevel + * The Level of the message. + * @return true if message could be logged, false + * otherwise. + */ + public boolean isLoggableMessage(Level pLevel) { + // If message is traceable, message could be logged + if (isLoggableTrace(pLevel)) return true; + + // If there are no log listeners or specified level is OFF, message + // will not be logged + if (this.iLogListeners.size() == 0 || pLevel.intValue() == Level.OFF.intValue()) return false; + + // If there are external log listeners, message could be logged (user + // can alter level at will, so we do not know what it is) + if (this.iNumExternalLogListeners > 0) return true; + + // If there are internal log listeners, determine if message will be + // logged + if (this.iNumInternalLogListeners > 0) { + int level = Level.OFF.intValue(); + if (this.iInternalListenerLogFile != null) { + level = this.iInternalLevelLogFile; + } + if (this.iInternalListenerLogConsole != null && level > this.iInternalLevelConsole) { + level = this.iInternalLevelConsole; + } + return level <= pLevel.intValue(); + } + + return true; + } + + /** + * Checks whether there are CIM-XML trace listeners installed that will log + * a CIM-XML trace message. Use this method to determine if a trace() method + * call could result in logging before preparing the information to be + * logged. For example: + * + *
      +	 *     if (logger.isLoggableCIMXMLTrace(Level.FINEST) {
      +	 *         // Prepare info for logging
      +	 *         logger.traceCIMXML(Level.FINEST, ...
      +	 * 
      + * + * @param pLevel + * The Level of the trace message. + * @return true if CIM-XML trace message could be logged, + * false otherwise. + */ + public boolean isLoggableCIMXMLTrace(Level pLevel) { + // If there are no CIM-XML trace listeners or specified level is OFF, + // message will not be logged + if (this.iCIMXMLTraceListeners.size() == 0 || pLevel.intValue() == Level.OFF.intValue()) return false; + + return true; + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/logging/LogFormatter.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/logging/LogFormatter.java similarity index 71% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/logging/LogFormatter.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/logging/LogFormatter.java index 5933868..b088ed4 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/logging/LogFormatter.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/logging/LogFormatter.java @@ -1,84 +1,82 @@ -/* - (C) Copyright IBM Corp. 2006, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Alexander Wolf-Reber, IBM, a.wolf-reber@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1565892 2006-11-15 lupusalex Make SBLIM client JSR48 compliant - * 1745282 2007-06-29 ebak Uniform time stamps for log files - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.logging; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.text.MessageFormat; -import java.util.logging.Formatter; -import java.util.logging.LogRecord; - -/** - * Class LogFormatter implements the formatting algorithm for our console log. - * - */ -public class LogFormatter extends Formatter { - - private final String iLineSeparator = System.getProperty("line.separator"); - - /** - * Ctor. - */ - public LogFormatter() { - super(); - } - - /* - * (non-Javadoc) - * - * @see java.util.logging.Formatter#format(java.util.logging.LogRecord) - */ - @Override - public String format(LogRecord pRecord) { - StringBuffer buffer = new StringBuffer(); - buffer.append(TimeStamp.format(pRecord.getMillis())); - buffer.append(" >"); - buffer.append(String.valueOf(pRecord.getThreadID())); - buffer.append("< "); - // buffer.append(iLineSeparator); - buffer.append(pRecord.getLevel().getName()); - buffer.append(": "); - buffer.append(MessageFormat.format(pRecord.getMessage(), pRecord.getParameters())); - buffer.append(this.iLineSeparator); - return buffer.toString(); - } -} +/* + (C) Copyright IBM Corp. 2006, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Alexander Wolf-Reber, IBM, a.wolf-reber@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1565892 2006-11-15 lupusalex Make SBLIM client JSR48 compliant + * 1745282 2007-06-29 ebak Uniform time stamps for log files + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.logging; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.text.MessageFormat; +import java.util.logging.Formatter; +import java.util.logging.LogRecord; + +/** + * Class LogFormatter implements the formatting algorithm for our console log. + * + */ +public class LogFormatter extends Formatter { + + private final String iLineSeparator = System.getProperty("line.separator"); + + /** + * Ctor. + */ + public LogFormatter() { + super(); + } + + /* + * (non-Javadoc) + * + * @see java.util.logging.Formatter#format(java.util.logging.LogRecord) + */ + @Override + public String format(LogRecord pRecord) { + StringBuffer buffer = new StringBuffer(); + buffer.append(TimeStamp.format(pRecord.getMillis())); + buffer.append(" >"); + buffer.append(String.valueOf(pRecord.getThreadID())); + buffer.append("< "); + // buffer.append(iLineSeparator); + buffer.append(pRecord.getLevel().getName()); + buffer.append(": "); + buffer.append(MessageFormat.format(pRecord.getMessage(), pRecord.getParameters())); + buffer.append(this.iLineSeparator); + return buffer.toString(); + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/logging/MessageLoader.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/logging/MessageLoader.java similarity index 79% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/logging/MessageLoader.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/logging/MessageLoader.java index 0af851c..51eb83a 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/logging/MessageLoader.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/logging/MessageLoader.java @@ -1,140 +1,138 @@ -/* - (C) Copyright IBM Corp. 2006, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Alexander Wolf-Reber, IBM, a.wolf-reber@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1565892 2006-11-14 lupusalex Make SBLIM client JSR48 compliant - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2787464 2009-05-05 blaschke-oss lang exception in Chinese env with Java client 2.0.7 - */ -package org.sentrysoftware.wbem.sblim.cimclient.internal.logging; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.Locale; -import java.util.MissingResourceException; -import java.util.ResourceBundle; -import java.util.logging.Level; - -/** - * Class MessageLoader encapsulates the access to the resource file containing - * log messages. - * - */ -public final class MessageLoader { - - private static final String BUNDLE_NAME = "org.sblim.cimclient.internal.logging.messages"; //$NON-NLS-1$ - - private static final ResourceBundle RESOURCE_BUNDLE_LOCAL - /* = ResourceBundle.getBundle(BUNDLE_NAME, Locale.getDefault()) */; - - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME, - Locale.ENGLISH); - - /* - * Use English if default locale not supported (doing it here handles - * exception, assigning above does not) - */ - static { - ResourceBundle bundleLocal; - try { - bundleLocal = ResourceBundle.getBundle(BUNDLE_NAME, Locale.getDefault()); - } catch (MissingResourceException e) { - bundleLocal = RESOURCE_BUNDLE; - } - RESOURCE_BUNDLE_LOCAL = bundleLocal; - } - - private MessageLoader() { - // prevent instantiation - } - - /** - * Returns the English message for a given key. - * - * @param pKey - * The key - * @return The message - */ - public static String getMessage(String pKey) { - try { - return RESOURCE_BUNDLE.getString(pKey); - } catch (MissingResourceException e) { - return '!' + pKey + '!'; - } - } - - /** - * Returns the localized message for a given key. - * - * @param pKey - * The key - * @return The message - */ - public static String getLocalizedMessage(String pKey) { - try { - return RESOURCE_BUNDLE_LOCAL.getString(pKey); - } catch (MissingResourceException e) { - return '!' + pKey + '!'; - } - } - - /** - * Returns the level of a given message id based on the naming convention. - * The convention is: - * CIM<unique 4 digit id><level token>, e.g. - * CIM1234S. Valid level tokens are S, W, I and - * C for SEVERE, WARNING, INFO and - * CONFIG respectively. - * - * @param pKey - * The message id - * @return The level - */ - public static Level getLevel(String pKey) { - char level = pKey.charAt(pKey.length() - 1); - switch (level) { - case 'S': - return Level.SEVERE; - case 'W': - return Level.WARNING; - case 'I': - return Level.INFO; - case 'C': - return Level.CONFIG; - default: - return null; - } - } -} +/* + (C) Copyright IBM Corp. 2006, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Alexander Wolf-Reber, IBM, a.wolf-reber@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1565892 2006-11-14 lupusalex Make SBLIM client JSR48 compliant + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2787464 2009-05-05 blaschke-oss lang exception in Chinese env with Java client 2.0.7 + */ +package org.metricshub.wbem.sblim.cimclient.internal.logging; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.Locale; +import java.util.MissingResourceException; +import java.util.ResourceBundle; +import java.util.logging.Level; + +/** + * Class MessageLoader encapsulates the access to the resource file containing + * log messages. + * + */ +public final class MessageLoader { + + private static final String BUNDLE_NAME = "org.sblim.cimclient.internal.logging.messages"; //$NON-NLS-1$ + + private static final ResourceBundle RESOURCE_BUNDLE_LOCAL + /* = ResourceBundle.getBundle(BUNDLE_NAME, Locale.getDefault()) */; + + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME, + Locale.ENGLISH); + + /* + * Use English if default locale not supported (doing it here handles + * exception, assigning above does not) + */ + static { + ResourceBundle bundleLocal; + try { + bundleLocal = ResourceBundle.getBundle(BUNDLE_NAME, Locale.getDefault()); + } catch (MissingResourceException e) { + bundleLocal = RESOURCE_BUNDLE; + } + RESOURCE_BUNDLE_LOCAL = bundleLocal; + } + + private MessageLoader() { + // prevent instantiation + } + + /** + * Returns the English message for a given key. + * + * @param pKey + * The key + * @return The message + */ + public static String getMessage(String pKey) { + try { + return RESOURCE_BUNDLE.getString(pKey); + } catch (MissingResourceException e) { + return '!' + pKey + '!'; + } + } + + /** + * Returns the localized message for a given key. + * + * @param pKey + * The key + * @return The message + */ + public static String getLocalizedMessage(String pKey) { + try { + return RESOURCE_BUNDLE_LOCAL.getString(pKey); + } catch (MissingResourceException e) { + return '!' + pKey + '!'; + } + } + + /** + * Returns the level of a given message id based on the naming convention. + * The convention is: + * CIM<unique 4 digit id><level token>, e.g. + * CIM1234S. Valid level tokens are S, W, I and + * C for SEVERE, WARNING, INFO and + * CONFIG respectively. + * + * @param pKey + * The message id + * @return The level + */ + public static Level getLevel(String pKey) { + char level = pKey.charAt(pKey.length() - 1); + switch (level) { + case 'S': + return Level.SEVERE; + case 'W': + return Level.WARNING; + case 'I': + return Level.INFO; + case 'C': + return Level.CONFIG; + default: + return null; + } + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/logging/Messages.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/logging/Messages.java similarity index 82% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/logging/Messages.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/logging/Messages.java index 3efa689..203e35f 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/logging/Messages.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/logging/Messages.java @@ -1,252 +1,250 @@ -/* - (C) Copyright IBM Corp. 2006, 2012 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Alexander Wolf-Reber, IBM, a.wolf-reber@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1565892 2006-11-16 lupusalex Make SBLIM client JSR48 compliant - * 1711092 2006-05-02 lupusalex Some fixes/additions of log&trace messages - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 3536399 2012-08-25 hellerda Add client/listener peer authentication properties - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.logging; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -/** - * Interface Messages holds the constants for the message keys. - * - */ -public interface Messages { - - /** - * GREETING - */ - public String GREETING = "CIM0001I"; - - /** - * RELEASE - */ - public String RELEASE = "CIM0002I"; - - /** - * OS - */ - public String OS = "CIM0003I"; - - /** - * JRE - */ - public String JRE = "CIM0004I"; - - /** - * JVM - */ - public String JVM = "CIM0005I"; - - /** - * CONFIGURATION_URL - */ - public String CONFIGURATION_URL = "CIM1001C"; - - /** - * CONFIGURATION_LOAD_FAILED - */ - public String CONFIGURATION_LOAD_FAILED = "CIM1002C"; - - /** - * EXCEPTION_DURING_CONFIGURATION_LOAD - */ - public String EXCEPTION_DURING_CONFIGURATION_LOAD = "CIM1003S"; - - /** - * INVALID_KEY_IN_CONFIG_FILE - */ - public String INVALID_KEY_IN_CONFIG_FILE = "CIM1004W"; - - /** - * HTTP_PROXY_AUTH_UNSUPPORTED - */ - public String HTTP_PROXY_AUTH_UNSUPPORTED = "CIM2001S"; - - /** - * HTTP_CONNECTION_FAILED - */ - public String HTTP_CONNECTION_FAILED = "CIM2002W"; - - /** - * HTTP_NO_SOCKET_FACTORY - */ - public String HTTP_NO_SOCKET_FACTORY = "CIM2003S"; - - /** - * HTTP_AUTH_MODULE_INVALID - */ - public String HTTP_AUTH_MODULE_INVALID = "CIM2004S"; - - /** - * HTTP_INVALID_HEADER - */ - public String HTTP_INVALID_HEADER = "CIM2005W"; - - /** - * HTTP_HANDLE_CONNECTION_FAILED - */ - public String HTTP_HANDLE_CONNECTION_FAILED = "CIM2006S"; - - /** - * HTTP_PEGASUS_LOCAL_AUTH_READ - */ - public String HTTP_PEGASUS_LOCAL_AUTH_READ = "CIM2007S"; - - /** - * SSL_JSSE_PROVIDER_LOAD_FAILED - */ - public String SSL_JSSE_PROVIDER_LOAD_FAILED = "CIM2100S"; - - /** - * SSL_KEYSTORE_NOT_FOUND - */ - public String SSL_KEYSTORE_NOT_FOUND = "CIM2101C"; - - /** - * SSL_KEYSTORE_NOT_READABLE - */ - public String SSL_KEYSTORE_NOT_READABLE = "CIM2102W"; - - /** - * SSL_KEYSTORE_INVALID_CERT - */ - public String SSL_KEYSTORE_INVALID_CERT = "CIM2103W"; - - /** - * SSL_KEYSTORE_UNRECOVERABLE_KEY - */ - public String SSL_KEYSTORE_UNRECOVERABLE_KEY = "CIM2104W"; - - /** - * SSL_KEYSTORE_INVALID - */ - public String SSL_KEYSTORE_INVALID = "CIM2105W"; - - /** - * SSL_KEYSTORE_OTHER - */ - public String SSL_KEYSTORE_OTHER = "CIM2106W"; - - /** - * SSL_KEYSTORE_FALLBACK - */ - public String SSL_KEYSTORE_FALLBACK = "CIM2107C"; - - /** - * SSL_CONTEXT_INIT_FAILED - */ - public String SSL_CONTEXT_INIT_FAILED = "CIM2301S"; - - /** - * SSL_KEYSTORE_INVALID_ALGORITHM - */ - public String SSL_KEYSTORE_INVALID_ALGORITHM = "CIM2108W"; - - /** - * SSL_KEYSTORE_NULL - */ - public String SSL_KEYSTORE_NULL = "CIM2110C"; - - /** - * SSL_TRUSTSTORE_NOT_FOUND - */ - public String SSL_TRUSTSTORE_NOT_FOUND = "CIM2201C"; - - /** - * SSL_TRUSTSTORE_NOT_READABLE - */ - public String SSL_TRUSTSTORE_NOT_READABLE = "CIM2202W"; - - /** - * SSL_TRUSTSTORE_INVALID_CERT - */ - public String SSL_TRUSTSTORE_INVALID_CERT = "CIM2203W"; - - /** - * SSL_TRUSTSTORE_INVALID - */ - public String SSL_TRUSTSTORE_INVALID = "CIM2205W"; - - /** - * SSL_TRUSTSTORE_OTHER - */ - public String SSL_TRUSTSTORE_OTHER = "CIM2206W"; - - /** - * SSL_TRUSTSTORE_FALLBACK - */ - public String SSL_TRUSTSTORE_FALLBACK = "CIM2207C"; - - /** - * SSL_TRUSTSTORE_INVALID_ALGORITHM - */ - public String SSL_TRUSTSTORE_INVALID_ALGORITHM = "CIM2208W"; - - /** - * SSL_TRUSTSTORE_ACTIVE - */ - public String SSL_TRUSTSTORE_ACTIVE = "CIM2209C"; - - /** - * SSL_TRUSTSTORE_NULL - */ - public String SSL_TRUSTSTORE_NULL = "CIM2210C"; - - /** - * SSL_TRUSTSTORE_INACTIVE - */ - public String SSL_TRUSTSTORE_INACTIVE = "CIM2211W"; - - /** - * SSL_TRUSTSTORE_FALLBACK_NOTRUST - */ - public String SSL_TRUSTSTORE_FALLBACK_NOTRUST = "CIM2212W"; - - /** - * CIM_XMLHELPER_FAILED - */ - public String CIM_XMLHELPER_FAILED = "CIM3000S"; - - /** - * TEST_MESSAGE - */ - public String TEST_MESSAGE = "CIM9999S"; -} +/* + (C) Copyright IBM Corp. 2006, 2012 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Alexander Wolf-Reber, IBM, a.wolf-reber@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1565892 2006-11-16 lupusalex Make SBLIM client JSR48 compliant + * 1711092 2006-05-02 lupusalex Some fixes/additions of log&trace messages + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 3536399 2012-08-25 hellerda Add client/listener peer authentication properties + */ + +package org.metricshub.wbem.sblim.cimclient.internal.logging; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +/** + * Interface Messages holds the constants for the message keys. + * + */ +public interface Messages { + + /** + * GREETING + */ + public String GREETING = "CIM0001I"; + + /** + * RELEASE + */ + public String RELEASE = "CIM0002I"; + + /** + * OS + */ + public String OS = "CIM0003I"; + + /** + * JRE + */ + public String JRE = "CIM0004I"; + + /** + * JVM + */ + public String JVM = "CIM0005I"; + + /** + * CONFIGURATION_URL + */ + public String CONFIGURATION_URL = "CIM1001C"; + + /** + * CONFIGURATION_LOAD_FAILED + */ + public String CONFIGURATION_LOAD_FAILED = "CIM1002C"; + + /** + * EXCEPTION_DURING_CONFIGURATION_LOAD + */ + public String EXCEPTION_DURING_CONFIGURATION_LOAD = "CIM1003S"; + + /** + * INVALID_KEY_IN_CONFIG_FILE + */ + public String INVALID_KEY_IN_CONFIG_FILE = "CIM1004W"; + + /** + * HTTP_PROXY_AUTH_UNSUPPORTED + */ + public String HTTP_PROXY_AUTH_UNSUPPORTED = "CIM2001S"; + + /** + * HTTP_CONNECTION_FAILED + */ + public String HTTP_CONNECTION_FAILED = "CIM2002W"; + + /** + * HTTP_NO_SOCKET_FACTORY + */ + public String HTTP_NO_SOCKET_FACTORY = "CIM2003S"; + + /** + * HTTP_AUTH_MODULE_INVALID + */ + public String HTTP_AUTH_MODULE_INVALID = "CIM2004S"; + + /** + * HTTP_INVALID_HEADER + */ + public String HTTP_INVALID_HEADER = "CIM2005W"; + + /** + * HTTP_HANDLE_CONNECTION_FAILED + */ + public String HTTP_HANDLE_CONNECTION_FAILED = "CIM2006S"; + + /** + * HTTP_PEGASUS_LOCAL_AUTH_READ + */ + public String HTTP_PEGASUS_LOCAL_AUTH_READ = "CIM2007S"; + + /** + * SSL_JSSE_PROVIDER_LOAD_FAILED + */ + public String SSL_JSSE_PROVIDER_LOAD_FAILED = "CIM2100S"; + + /** + * SSL_KEYSTORE_NOT_FOUND + */ + public String SSL_KEYSTORE_NOT_FOUND = "CIM2101C"; + + /** + * SSL_KEYSTORE_NOT_READABLE + */ + public String SSL_KEYSTORE_NOT_READABLE = "CIM2102W"; + + /** + * SSL_KEYSTORE_INVALID_CERT + */ + public String SSL_KEYSTORE_INVALID_CERT = "CIM2103W"; + + /** + * SSL_KEYSTORE_UNRECOVERABLE_KEY + */ + public String SSL_KEYSTORE_UNRECOVERABLE_KEY = "CIM2104W"; + + /** + * SSL_KEYSTORE_INVALID + */ + public String SSL_KEYSTORE_INVALID = "CIM2105W"; + + /** + * SSL_KEYSTORE_OTHER + */ + public String SSL_KEYSTORE_OTHER = "CIM2106W"; + + /** + * SSL_KEYSTORE_FALLBACK + */ + public String SSL_KEYSTORE_FALLBACK = "CIM2107C"; + + /** + * SSL_CONTEXT_INIT_FAILED + */ + public String SSL_CONTEXT_INIT_FAILED = "CIM2301S"; + + /** + * SSL_KEYSTORE_INVALID_ALGORITHM + */ + public String SSL_KEYSTORE_INVALID_ALGORITHM = "CIM2108W"; + + /** + * SSL_KEYSTORE_NULL + */ + public String SSL_KEYSTORE_NULL = "CIM2110C"; + + /** + * SSL_TRUSTSTORE_NOT_FOUND + */ + public String SSL_TRUSTSTORE_NOT_FOUND = "CIM2201C"; + + /** + * SSL_TRUSTSTORE_NOT_READABLE + */ + public String SSL_TRUSTSTORE_NOT_READABLE = "CIM2202W"; + + /** + * SSL_TRUSTSTORE_INVALID_CERT + */ + public String SSL_TRUSTSTORE_INVALID_CERT = "CIM2203W"; + + /** + * SSL_TRUSTSTORE_INVALID + */ + public String SSL_TRUSTSTORE_INVALID = "CIM2205W"; + + /** + * SSL_TRUSTSTORE_OTHER + */ + public String SSL_TRUSTSTORE_OTHER = "CIM2206W"; + + /** + * SSL_TRUSTSTORE_FALLBACK + */ + public String SSL_TRUSTSTORE_FALLBACK = "CIM2207C"; + + /** + * SSL_TRUSTSTORE_INVALID_ALGORITHM + */ + public String SSL_TRUSTSTORE_INVALID_ALGORITHM = "CIM2208W"; + + /** + * SSL_TRUSTSTORE_ACTIVE + */ + public String SSL_TRUSTSTORE_ACTIVE = "CIM2209C"; + + /** + * SSL_TRUSTSTORE_NULL + */ + public String SSL_TRUSTSTORE_NULL = "CIM2210C"; + + /** + * SSL_TRUSTSTORE_INACTIVE + */ + public String SSL_TRUSTSTORE_INACTIVE = "CIM2211W"; + + /** + * SSL_TRUSTSTORE_FALLBACK_NOTRUST + */ + public String SSL_TRUSTSTORE_FALLBACK_NOTRUST = "CIM2212W"; + + /** + * CIM_XMLHELPER_FAILED + */ + public String CIM_XMLHELPER_FAILED = "CIM3000S"; + + /** + * TEST_MESSAGE + */ + public String TEST_MESSAGE = "CIM9999S"; +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/logging/TimeStamp.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/logging/TimeStamp.java similarity index 77% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/logging/TimeStamp.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/logging/TimeStamp.java index 9f1303b..1ff1b6e 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/logging/TimeStamp.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/logging/TimeStamp.java @@ -1,120 +1,118 @@ -/* - (C) Copyright IBM Corp. 2006, 2010 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, IBM, ebak@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1745282 2007-06-29 ebak Uniform time stamps for log files - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 3062747 2010-09-21 blaschke-oss SblimCIMClient does not log all CIM-XML responces. - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.logging; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.Calendar; - -/** - * Class TimeStamp is responsible for building uniform date/time strings for - * logging and tracing. - * - */ -public class TimeStamp { - - private static String pad(int pDigits, int pNum) { - String str = Integer.toString(pNum); - int len = Math.max(pDigits, str.length()); - char[] cA = new char[len]; - int paddingDigits = pDigits - str.length(); - int dIdx = 0; - while (dIdx < paddingDigits) - cA[dIdx++] = '0'; - int sIdx = 0; - while (dIdx < len) - cA[dIdx++] = str.charAt(sIdx++); - return new String(cA); - } - - /** - * formatWorker - * - * @param pMillis - * - total milliseconds - * @param pIncludeMillis - * - include milliseconds in String - * @return formatted date/time String. ( YYYY.MM.DD HH:mm:SS[.sss] ) - */ - private static String formatWorker(long pMillis, boolean pIncludeMillis) { - Calendar cal = Calendar.getInstance(); - cal.setTimeInMillis(pMillis); - StringBuilder sb = new StringBuilder(Integer.toString(cal.get(Calendar.YEAR))); - sb.append('.'); - sb.append(pad(2, cal.get(Calendar.MONTH) + 1)); - sb.append('.'); - sb.append(pad(2, cal.get(Calendar.DAY_OF_MONTH))); - sb.append(' '); - sb.append(pad(2, cal.get(Calendar.HOUR_OF_DAY))); - sb.append(':'); - sb.append(pad(2, cal.get(Calendar.MINUTE))); - sb.append(':'); - sb.append(pad(2, cal.get(Calendar.SECOND))); - if (pIncludeMillis) { - sb.append('.'); - sb.append(pad(3, cal.get(Calendar.MILLISECOND))); - } - return sb.toString(); - } - - /** - * format - * - * @param pMillis - * - total milliseconds - * @return formatted date/time String. ( YYYY.MM.DD HH:mm:SS ) - */ - public static String format(long pMillis) { - return formatWorker(pMillis, false); - } - - /** - * formatWithMillis - * - * @param pMillis - * - total milliseconds - * @return formatted date/time String. ( YYYY.MM.DD HH:mm:SS.sss ) - */ - public static String formatWithMillis(long pMillis) { - return formatWorker(pMillis, true); - } -} +/* + (C) Copyright IBM Corp. 2006, 2010 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, IBM, ebak@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1745282 2007-06-29 ebak Uniform time stamps for log files + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 3062747 2010-09-21 blaschke-oss SblimCIMClient does not log all CIM-XML responces. + */ + +package org.metricshub.wbem.sblim.cimclient.internal.logging; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.Calendar; + +/** + * Class TimeStamp is responsible for building uniform date/time strings for + * logging and tracing. + * + */ +public class TimeStamp { + + private static String pad(int pDigits, int pNum) { + String str = Integer.toString(pNum); + int len = Math.max(pDigits, str.length()); + char[] cA = new char[len]; + int paddingDigits = pDigits - str.length(); + int dIdx = 0; + while (dIdx < paddingDigits) + cA[dIdx++] = '0'; + int sIdx = 0; + while (dIdx < len) + cA[dIdx++] = str.charAt(sIdx++); + return new String(cA); + } + + /** + * formatWorker + * + * @param pMillis + * - total milliseconds + * @param pIncludeMillis + * - include milliseconds in String + * @return formatted date/time String. ( YYYY.MM.DD HH:mm:SS[.sss] ) + */ + private static String formatWorker(long pMillis, boolean pIncludeMillis) { + Calendar cal = Calendar.getInstance(); + cal.setTimeInMillis(pMillis); + StringBuilder sb = new StringBuilder(Integer.toString(cal.get(Calendar.YEAR))); + sb.append('.'); + sb.append(pad(2, cal.get(Calendar.MONTH) + 1)); + sb.append('.'); + sb.append(pad(2, cal.get(Calendar.DAY_OF_MONTH))); + sb.append(' '); + sb.append(pad(2, cal.get(Calendar.HOUR_OF_DAY))); + sb.append(':'); + sb.append(pad(2, cal.get(Calendar.MINUTE))); + sb.append(':'); + sb.append(pad(2, cal.get(Calendar.SECOND))); + if (pIncludeMillis) { + sb.append('.'); + sb.append(pad(3, cal.get(Calendar.MILLISECOND))); + } + return sb.toString(); + } + + /** + * format + * + * @param pMillis + * - total milliseconds + * @return formatted date/time String. ( YYYY.MM.DD HH:mm:SS ) + */ + public static String format(long pMillis) { + return formatWorker(pMillis, false); + } + + /** + * formatWithMillis + * + * @param pMillis + * - total milliseconds + * @return formatted date/time String. ( YYYY.MM.DD HH:mm:SS.sss ) + */ + public static String formatWithMillis(long pMillis) { + return formatWorker(pMillis, true); + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/logging/TraceFormatter.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/logging/TraceFormatter.java similarity index 74% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/logging/TraceFormatter.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/logging/TraceFormatter.java index 5a7b49d..04ca2fa 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/logging/TraceFormatter.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/logging/TraceFormatter.java @@ -1,95 +1,93 @@ -/* - (C) Copyright IBM Corp. 2006, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Alexander Wolf-Reber, IBM, a.wolf-reber@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1565892 2006-11-15 lupusalex Make SBLIM client JSR48 compliant - * 1745282 2007-06-29 ebak Uniform time stamps for log files - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.logging; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.PrintWriter; -import java.io.StringWriter; -import java.util.logging.Formatter; -import java.util.logging.LogRecord; - -/** - * Class TraceFormatter implements the formatting algorithm for our console log. - * - */ -public class TraceFormatter extends Formatter { - - private final String iLineSeparator = System.getProperty("line.separator"); - - /** - * Ctor. - */ - public TraceFormatter() { - super(); - } - - /* - * (non-Javadoc) - * - * @see java.util.logging.Formatter#format(java.util.logging.LogRecord) - */ - @Override - public String format(LogRecord pRecord) { - StringBuffer buffer = new StringBuffer(); - buffer.append(TimeStamp.format(pRecord.getMillis())); - buffer.append(" >"); - buffer.append(String.valueOf(pRecord.getThreadID())); - buffer.append("< "); - buffer.append(pRecord.getSourceMethodName()); - buffer.append(this.iLineSeparator); - buffer.append(pRecord.getLevel().getName()); - buffer.append(": "); - buffer.append(pRecord.getMessage()); - buffer.append(this.iLineSeparator); - if (pRecord.getThrown() != null) { - buffer.append("---> "); - StringWriter stringWriter = new StringWriter(); - PrintWriter printWriter = new PrintWriter(stringWriter); - pRecord.getThrown().printStackTrace(printWriter); - printWriter.close(); - buffer.append(stringWriter.toString()); - buffer.append(this.iLineSeparator); - } - return buffer.toString(); - } -} +/* + (C) Copyright IBM Corp. 2006, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Alexander Wolf-Reber, IBM, a.wolf-reber@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1565892 2006-11-15 lupusalex Make SBLIM client JSR48 compliant + * 1745282 2007-06-29 ebak Uniform time stamps for log files + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.logging; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.logging.Formatter; +import java.util.logging.LogRecord; + +/** + * Class TraceFormatter implements the formatting algorithm for our console log. + * + */ +public class TraceFormatter extends Formatter { + + private final String iLineSeparator = System.getProperty("line.separator"); + + /** + * Ctor. + */ + public TraceFormatter() { + super(); + } + + /* + * (non-Javadoc) + * + * @see java.util.logging.Formatter#format(java.util.logging.LogRecord) + */ + @Override + public String format(LogRecord pRecord) { + StringBuffer buffer = new StringBuffer(); + buffer.append(TimeStamp.format(pRecord.getMillis())); + buffer.append(" >"); + buffer.append(String.valueOf(pRecord.getThreadID())); + buffer.append("< "); + buffer.append(pRecord.getSourceMethodName()); + buffer.append(this.iLineSeparator); + buffer.append(pRecord.getLevel().getName()); + buffer.append(": "); + buffer.append(pRecord.getMessage()); + buffer.append(this.iLineSeparator); + if (pRecord.getThrown() != null) { + buffer.append("---> "); + StringWriter stringWriter = new StringWriter(); + PrintWriter printWriter = new PrintWriter(stringWriter); + pRecord.getThrown().printStackTrace(printWriter); + printWriter.close(); + buffer.append(stringWriter.toString()); + buffer.append(this.iLineSeparator); + } + return buffer.toString(); + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/logging/package.html b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/logging/package.html similarity index 100% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/logging/package.html rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/logging/package.html diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/package.html b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/package.html similarity index 100% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/package.html rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/package.html diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/pullparser/XMLPullParser.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/pullparser/XMLPullParser.java similarity index 93% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/pullparser/XMLPullParser.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/pullparser/XMLPullParser.java index 2bc3239..c1a810c 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/pullparser/XMLPullParser.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/pullparser/XMLPullParser.java @@ -1,1272 +1,1270 @@ -/* - XMLPullParser.java - - (C) Copyright IBM Corp. 2005, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 18274 2005-09-12 fiuczy String values get corrupted by CIM client - * 1535756 2006-08-07 lupusalex Make code warning free - * 1663270 2007-02-19 ebak Minor performance problems - * 1708584 2007-04-27 ebak CloseableIterator might not clean up streams - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2714989 2009-03-26 blaschke-oss Code cleanup from redundant null check et al - * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors - * 3001359 2010-05-18 blaschke-oss XMLPullParser.CharString equals() method broken - * 3019252 2010-06-21 blaschke-oss Methods concatenate strings using + in a loop - * 3026316 2010-07-07 blaschke-oss XMLPullParser unused fields - * 3026417 2010-07-07 blaschke-oss XMLAttributeValue does not use iHash field - * 3028518 2010-07-14 blaschke-oss Additional StringBuilder use - * 3048749 2010-08-20 blaschke-oss Hex digit parsing logic error in XMLPullParser - * 3304058 2011-05-20 blaschke-oss Use same date format in change history - * 2639 2013-05-11 blaschke-oss CDATA parsing broken in PULL parser - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.pullparser; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.IOException; -import java.io.Reader; -import java.util.ArrayList; -import java.util.logging.Level; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.sax.XMLDefaultHandlerImpl; -import org.sentrysoftware.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; -import org.xml.sax.Attributes; - -/** - * Class XMLPullParser is responsible for XML parsing. - * - */ -public class XMLPullParser { - - /** - * Class XMLAttributes is an Attributes implementation. - */ - class XMLAttributes implements Attributes { - - public int getIndex(String qName) { - /* - * ebak: this is not good, since this Vector contains - * XMLAttributeValues return iAttributeNames.indexOf(qName); - */ - for (int i = 0; i < XMLPullParser.this.iAttributeNames.size(); i++) { - XMLAttributeValue xmlAttrValue = XMLPullParser.this.iAttributeNames.get(i); - if (qName.equals(xmlAttrValue.toString())) return i; - } - return -1; - } - - /** - * @param uri - * @param localName - * @return int getIndex - */ - public int getIndex(String uri, String localName) { - return 0; - } - - public int getLength() { - return XMLPullParser.this.iTotalAttributes; - } - - /** - * @param index - * @return String getLocalName - */ - public String getLocalName(int index) { - return EMPTY; - } - - public String getQName(int index) { - return XMLPullParser.this.iAttributeNames.get(index).getText(); - } - - /** - * @param index - * @return String getType - */ - public String getType(int index) { - return EMPTY; - } - - /** - * @param qName - * @return String getType - */ - public String getType(String qName) { - return EMPTY; - } - - /** - * @param uri - * @param localName - * @return String getType - */ - public String getType(String uri, String localName) { - return EMPTY; - } - - /** - * @param index - * @return String getURI - */ - public String getURI(int index) { - return EMPTY; - } - - public String getValue(int index) { - return XMLPullParser.this.iAttributeValues.get(index).getText(); - } - - public String getValue(String qName) { - /* - * ebak: the implementation have to return null if the attribute not - * found ebak: indexOf not good here, because iAttributeNames - * doesn't contain Strings - */ - int idx = getIndex(qName); - if (idx < 0) return null; - return getValue(idx); - } - - /** - * @param uri - * @param localName - * @return String getType - */ - public String getValue(String uri, String localName) { - return EMPTY; - } - } - - class XMLAttributeValue { - - int iCurrentPos; - - int iBegin, iLen; - - String iText; - - private boolean iTranslate; - - /** - * Ctor. - * - * @param begin - * @param len - * @param translate - */ - public XMLAttributeValue(int begin, int len, boolean translate) { - this.iBegin = begin; - this.iLen = len; - this.iTranslate = translate; - } - - /** - * Ctor. - * - * @param begin - * @param len - */ - public XMLAttributeValue(int begin, int len) { - this.iBegin = begin; - this.iLen = len; - this.iTranslate = true; - } - - /** - * getText - * - * @return String - */ - public String getText() { - if (this.iText == null) { - if (this.iTranslate) { - try { - // Integer hashKey = new Integer(hash); - // text = (String)stringTable.get(hashKey); - // text = null; - // if (text == null) { - this.iText = _getChars(); - // stringTable.put(hashKey, text); - // } else { - // // System.out.println("Found:"+text); - // cnt++; - // } - } catch (Exception e) { - LogAndTraceBroker.getBroker().trace(Level.WARNING, - "exception while decoding CHARACTERS XML", e); - this.iText = new String(XMLPullParser.this.iBufferChar, this.iBegin, - this.iLen); - } - } else { - // Integer hashKey = new Integer(hash); - // text = (String)stringTable.get(hashKey); - // text = null; - // if (text == null) { - this.iText = new String(XMLPullParser.this.iBufferChar, this.iBegin, this.iLen); - // stringTable.put(hashKey, text); - // } else { - // // System.out.println("Found:"+text); - // cnt++; - // } - } - } - return this.iText; - } - - // public void setTranslate(boolean translate) { - // this.translate = translate; - // } - - /** - * init - * - * @param begin - * @param len - */ - public void init(int begin, int len) { - this.iBegin = begin; - this.iLen = len; - this.iText = null; - } - - /** - * setTranslate - * - * @param translate - */ - public void setTranslate(boolean translate) { - this.iTranslate = translate; - } - - @Override - public String toString() { - return getText(); - } - - protected String _getChars() throws XMLPullParserException { - StringBuffer attributeValue = new StringBuffer(); - int last = this.iBegin + this.iLen; - char ch; - // char prevCh = '\0'; //18274 - for (this.iCurrentPos = this.iBegin; this.iCurrentPos < last; this.iCurrentPos++) { - ch = XMLPullParser.this.iBufferChar[this.iCurrentPos]; - if (ch == '&') { - // try { - // System.out.println(_currentPos); - int ref = parseReference(); - - if (ref > -1) attributeValue.append((char) ref); - // } - // catch (Exception e) { - // e.printStackTrace(); - // } - // } else if (ch == '\t' - // || ch == '\r' - // || ch == '\n') { - // - // if (ch != '\n' || prevCh != '\r'){ - // attributeValue.append(' '); - // } - } else { - attributeValue.append(ch); - } - // prevCh = ch; //18274 - } - return attributeValue.toString(); - } - - protected int parseReference() throws XMLPullParserException { - this.iCurrentPos++; - char ch1 = XMLPullParser.this.iBufferChar[this.iCurrentPos++]; - if (ch1 == '#') { - ch1 = XMLPullParser.this.iBufferChar[this.iCurrentPos++]; - if (ch1 == 'x') { - int value = 0; - do { - ch1 = XMLPullParser.this.iBufferChar[this.iCurrentPos++]; - if (ch1 >= '0' && ch1 <= '9') value = value * 16 + (ch1 - '0'); - else if (ch1 >= 'A' && ch1 <= 'F' || ch1 >= 'a' && ch1 <= 'f') value = value - * 16 + (Character.toUpperCase(ch1) - 'A' + 10); - else if (ch1 == ';') break; - else throw new XMLPullParserException( - "invalid character while parsing hex encoded number " + escape(ch1)); - } while (true); - this.iCurrentPos--; // 18274 - return (char) value; - } - int value = 0; - if (ch1 >= '0' && ch1 <= '9') { - do { - if (ch1 >= '0' && ch1 <= '9') { - value = value * 10 + (ch1 - '0'); - ch1 = XMLPullParser.this.iBufferChar[this.iCurrentPos++]; - } else if (ch1 == ';') break; - else throw new XMLPullParserException( - "invalid character while parsing decimal encoded number: " - + escape(ch1)); - } while (true); - this.iCurrentPos--; // 18274 - return (char) value; - } - throw new XMLPullParserException("invalid number format"); - } - int startPos = this.iCurrentPos - 1; - if (isValidStartElementNameChar(ch1)) { - do { - ch1 = XMLPullParser.this.iBufferChar[this.iCurrentPos++]; - if (ch1 == ';') break; - if (!isValidElementNameChar(ch1)) throw new XMLPullParserException( - "invalid reference character " + escape(ch1)); - } while (true); - } else { - throw new XMLPullParserException( - "expected valid name start character for value reference"); - } - this.iCurrentPos--; - ch1 = XMLPullParser.this.iBufferChar[startPos]; - char ch2 = XMLPullParser.this.iBufferChar[startPos + 1]; - char ch3 = XMLPullParser.this.iBufferChar[startPos + 2]; - - if (ch1 == 'l' && ch2 == 't' && ch3 == ';') { - return '<'; - } else if (ch1 == 'g' && ch2 == 't' && ch3 == ';') { - return '>'; - } else { - char ch4 = XMLPullParser.this.iBufferChar[startPos + 3]; - if (ch1 == 'a' && ch2 == 'm' && ch3 == 'p' && ch4 == ';') { return '&'; } - char ch5 = XMLPullParser.this.iBufferChar[startPos + 4]; - if (ch1 == 'a' && ch2 == 'p' && ch3 == 'o' && ch4 == 's' && ch5 == ';') { - return '\''; - } else if (ch1 == 'q' && ch2 == 'u' && ch3 == 'o' && ch4 == 't' && ch5 == ';') { - return '\"'; - } else { - // TODO return reference - } - } - return -1; - } - } - - /** - * ATTRIBUTE - */ - public static final int ATTRIBUTE = 10; - - /** - * CDATA - */ - public static final int CDATA = 12; - - /** - * CHARACTERS - */ - public static final int CHARACTERS = 4; - - /** - * COMMENT - */ - public static final int COMMENT = 5; - - /** - * DTD - */ - public static final int DTD = 11; - - /** - * EMPTY - */ - public static final String EMPTY = ""; - - /** - * END_DOCUMENT - */ - public static final int END_DOCUMENT = 8; - - /** - * END_ELEMENT - */ - public static final int END_ELEMENT = 2; - - /** - * ENTITY_DECLARATION - */ - public static final int ENTITY_DECLARATION = 15; - - /** - * ENTITY_REFERENCE - */ - public static final int ENTITY_REFERENCE = 9; - - /** - * NAMESPACE - */ - public static final int NAMESPACE = 13; - - /** - * NOTATION_DECLARATION - */ - public static final int NOTATION_DECLARATION = 14; - - /** - * PROCESSING_INSTRUCTION - */ - public static final int PROCESSING_INSTRUCTION = 3; - - /** - * SPACE - */ - public static final int SPACE = 6; - - /** - * START_DOCUMENT - */ - public static final int START_DOCUMENT = 7; - - /** - * START_ELEMENT - */ - public static final int START_ELEMENT = 1; - - /** - * main - * - * @param args - */ - public static void main(String[] args) { - // this did testing - } - - // TODO: ebak: this function seems to be wrong, because "synchronizes" to - // IRETURNVALUE - /** - * next - * - * @param reader - * @param parserHdlr - * @return boolean - * @throws Exception - */ - public static boolean next(XMLPullParser reader, XMLDefaultHandlerImpl parserHdlr) - throws Exception { - while (reader.hasNext()) { - int event = reader.next(); - switch (event) { - case START_ELEMENT: - parserHdlr.startElement(EMPTY, EMPTY, reader.getElementName(), reader - .getAttributes()); - break; - case END_ELEMENT: - parserHdlr.endElement(EMPTY, EMPTY, reader.getElementName()); - - String lastElementName = null; - if (reader.getElementNames().size() > 0) { - ArrayList elementNames = reader.getElementNames(); - lastElementName = elementNames.get(elementNames.size() - 1); - } - - if (lastElementName != null && lastElementName.equalsIgnoreCase("IRETURNVALUE")) { return true; } - break; - case CHARACTERS: - char[] buf = reader.getText().toCharArray(); - parserHdlr.characters(buf, 0, buf.length); - break; - case END_DOCUMENT: - return false; - } - } - return false; - } - - ArrayList iAttributeNames = new ArrayList(); - - Attributes iAttributes; - - ArrayList iAttributeValues = new ArrayList(); - - char[] iBufferChar = null; - - XMLAttributeValue iCharacters; - - boolean iClosingElementNamePending; - - int iColNumber = 1; - - int iCurrentPosition = 0; - - int iCurrentState = 0; - - String iElementName; - - ArrayList iElementNames = new ArrayList(); - - int iEndCharacters; - - int iFinishChar = 0; - - Reader iInstream; - - /* - * ebak: implement close - */ - boolean iClosed; - - int iLineNumber = 1; - - boolean iSeenEpilog; - - boolean iSeenProlog; - - int iStartCharacters; - - int iTotalAttributes; - - /** - * Ctor. - * - * @param in - */ - public XMLPullParser(Reader in) { - this.iInstream = in; - reset(); - } - - /** - * close - * - * @throws IOException - */ - public void close() throws IOException { - if (this.iClosed) return; - this.iClosed = true; - this.iInstream.close(); - } - - /** - * getAttributes - * - * @return Attributes - */ - public Attributes getAttributes() { - if (this.iCurrentState != START_ELEMENT) return null; - - if (this.iAttributes == null) { - this.iAttributes = new XMLAttributes(); - } - return this.iAttributes; - } - - /** - * getElementName - * - * @return String - */ - public String getElementName() { - return this.iElementName; - } - - /** - * getElementNames - * - * @return Vector - */ - public ArrayList getElementNames() { - return this.iElementNames; - } - - /** - * getLevel - * - * @return int - */ - public int getLevel() { - return this.iElementNames.size(); - } - - /** - * getText - * - * @return String - */ - public String getText() { - String result = null; - if (this.iCurrentState == CHARACTERS && this.iCharacters != null) { return this.iCharacters - .getText(); } - return result; - } - - /** - * hasNext - * - * @return boolean - */ - public boolean hasNext() { - return !this.iClosed && this.iCurrentState != END_DOCUMENT; - } - - /** - * next - * - * @return int - * @throws IOException - */ - public int next() throws IOException { - char ch; - resetAttributes(); - ensureCapacity(); - if (this.iClosingElementNamePending) { - this.iClosingElementNamePending = false; - this.iElementNames.remove(this.iElementNames.size() - 1); - this.iCurrentState = END_ELEMENT; - return this.iCurrentState; - } - do { - ch = (char) getNextCharCheckingEOF(); - if (ch == '<') { - ch = (char) getNextChar(); - if (ch == '?') { - if (this.iSeenProlog) { throw new XMLPullParserException( - "The processing instruction target matching \"[xX][mM][lL]\" is not allowed."); } - this.iSeenProlog = true; - parsePI(); - ch = (char) getNextChar(); - ch = skipOptionalSpaces(ch); - if (ch != '<') throw new XMLPullParserException(this, - "Content is not allowed in prolog."); - goBack(); - - this.iCurrentState = START_DOCUMENT; - return this.iCurrentState; - } else if (ch == '!') { - ch = (char) getNextChar(); - if (ch == '-') { - parseComment(); - - this.iCurrentState = COMMENT; - return this.iCurrentState; - } else if (ch == '[') { - parseCDATA(); - this.iCurrentState = CHARACTERS; - return this.iCurrentState; - } else throw new XMLPullParserException(this, "unexpected char " + escape(ch)); - } else if (ch == '/') { - parseEndElement(); - this.iCurrentState = END_ELEMENT; - return this.iCurrentState; - } else if (ch == '&') { - parseUnknown(); - } else if (isValidStartElementNameChar(ch)) { - if (!this.iSeenProlog) { - this.iSeenProlog = true; - this.iCurrentState = START_DOCUMENT; - goBack(); - goBack(); - return this.iCurrentState; - } - parseStartElement(ch); - this.iCurrentState = START_ELEMENT; - return this.iCurrentState; - } else { - throw new XMLPullParserException(this, "unexpected char " + escape(ch)); - } - } else { - this.iStartCharacters = this.iCurrentPosition - 1; - boolean amp = false; - // int hash = 0; - // int n = 0; - do { - // n = (n+1)&15; - // hash = hash*primes[n]+ch; - - ch = (char) getNextCharCheckingEOF(); - if (ch == (char) -1) { - if (this.iElementNames.size() != 0) throw new XMLPullParserException(this, - "unexpected EOF "); - - this.iCurrentState = END_DOCUMENT; - return this.iCurrentState; - } else if (ch == '\r' || ch == '\n') { /* :) */} else { - if (!isSpace(ch) && ch != '<' && this.iElementNames.size() == 0) { - if (!this.iSeenProlog) throw new XMLPullParserException(this, - "Content is not allowed in trailing section."); - throw new XMLPullParserException(this, - "Content is not allowed in trailing section."); - } - } - amp = false; - if (ch == '&') { - amp = true; - int i = parseReference(); - ch = (char) (i & 0xFFFF); - } - } while (ch != '<' || amp); - this.iEndCharacters = this.iCurrentPosition; - goBack(); - if (this.iElementNames.size() > 0) { - if (this.iCharacters == null) this.iCharacters = new XMLAttributeValue( - this.iStartCharacters, this.iEndCharacters - this.iStartCharacters - 1); - else { - this.iCharacters.init(this.iStartCharacters, this.iEndCharacters - - this.iStartCharacters - 1); - this.iCharacters.setTranslate(true); - } - - this.iCurrentState = CHARACTERS; - return this.iCurrentState; - } - } - } while (true); - } - - /** - * reset - */ - public void reset() { - this.iSeenProlog = true; - this.iCurrentState = 0; - this.iClosingElementNamePending = false; - this.iColNumber = 1; - this.iLineNumber = 1; - this.iElementName = null; - this.iElementNames.clear(); - this.iAttributeNames.clear(); - this.iAttributeValues.clear(); - this.iAttributes = null; - - this.iStartCharacters = 0; - this.iEndCharacters = 0; - - this.iTotalAttributes = 0; - this.iSeenProlog = false; - this.iSeenEpilog = false; - } - - @Override - public String toString() { - switch (this.iCurrentState) { - case START_ELEMENT: { - StringBuilder sb = new StringBuilder("START ELEM: <"); - sb.append(this.iElementName); - if (this.iAttributeNames.size() > 0) { - sb.append(" "); - for (int i = 0; i < this.iAttributeNames.size(); i++) { - sb.append(this.iAttributeNames.get(i)); - sb.append("=\""); - sb.append(this.iAttributeValues.get(i)); - sb.append("\" "); - } - } - sb.append(">"); - return sb.toString(); - } - case END_ELEMENT: { - String s = "END ELEM: "; - return s; - } - case CHARACTERS: { - return "CHARACTERS: \"" + getText(); // .replaceAll("\n", - // "\\\\n").replaceAll("\r", - // "\\\\r").replaceAll("\t", - // "\\\\t")+"\""; - } - } - return "UNKOWN"; - } - - protected char _getNextChar() { - return (char) -1; - } - - protected void addAttribute(int begName, int lenName, int begValue, int lenValue) { - if (this.iAttributeNames.size() > this.iTotalAttributes) { - XMLAttributeValue attribute = this.iAttributeValues.get(this.iTotalAttributes); - XMLAttributeValue name = this.iAttributeNames.get(this.iTotalAttributes); - this.iTotalAttributes++; - attribute.init(begValue, lenValue); - attribute.setTranslate(true); - name.init(begName, lenName); - name.setTranslate(false); - } else { - XMLAttributeValue attribute = new XMLAttributeValue(begValue, lenValue); - XMLAttributeValue name = new XMLAttributeValue(begName, lenName, false); - this.iTotalAttributes++; - this.iAttributeNames.add(name); - this.iAttributeValues.add(attribute); - } - } - - protected void ensureCapacity() { - if (this.iBufferChar == null) this.iBufferChar = new char[1024]; - - if (this.iCurrentPosition >= (8 * this.iBufferChar.length) / 10) { - System.arraycopy(this.iBufferChar, this.iCurrentPosition, this.iBufferChar, 0, - this.iFinishChar - this.iCurrentPosition); - this.iFinishChar -= this.iCurrentPosition; - this.iCurrentPosition = 0; - } - } - - protected String escape(char ch) { - String result; - if (ch == '\n') result = "\'\\n\'"; - if (ch == '\r') result = "\'\\r\'"; - if (ch == '\t') result = "\'\\t\'"; - if (ch == '\'') result = "\'\\'\'"; - if (ch > '\177' || ch < ' ') result = "\'\\u" + Integer.toHexString(ch) + "\'"; - else result = "\'" + ch + "\'"; - return result; - } - - protected int getChar() throws IOException { - if (this.iFinishChar <= this.iCurrentPosition) { - if (this.iBufferChar == null) { - this.iBufferChar = new char[1024]; - } else if (this.iFinishChar >= this.iBufferChar.length) { - char[] tmp = this.iBufferChar; - this.iBufferChar = new char[this.iBufferChar.length << 1]; - System.arraycopy(tmp, 0, this.iBufferChar, 0, tmp.length); - } - - int total = this.iInstream.read(this.iBufferChar, this.iFinishChar, - this.iBufferChar.length - this.iFinishChar); - - if (total <= 0) { return -1; } - this.iFinishChar += total; - } - return this.iBufferChar[this.iCurrentPosition++]; - } - - protected int getNextChar() throws IOException { - int ch; - - if (this.iFinishChar <= this.iCurrentPosition) { - ch = getChar(); - } else ch = this.iBufferChar[this.iCurrentPosition++]; - - if (ch == -1) throw new XMLPullParserException(this, "unexpected end of document"); - if (ch == '\n') { - this.iLineNumber++; - this.iColNumber = 1; - } else this.iColNumber++; - - return (char) ch; - } - - protected int getNextCharCheckingEOF() throws IOException { - int ch; - - if (this.iFinishChar <= this.iCurrentPosition) { - ch = getChar(); - } else ch = this.iBufferChar[this.iCurrentPosition++]; - - if (ch == '\n') { - this.iLineNumber++; - this.iColNumber = 1; - } else this.iColNumber++; - - return (char) ch; - } - - protected void goBack() { - this.iCurrentPosition--; - if (this.iColNumber > 1) { - this.iColNumber--; - } - } - - protected boolean isSpace(char ch) { - return ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t'; - } - - protected boolean isValidElementNameChar(char ch) { - return (ch < 256 && (ch >= 'A' && ch <= 'Z' || ch >= 'a' && ch <= 'z' || ch == '_' - || ch == ':' || ch == '-' || ch == '.' || ch >= '0' && ch <= '9' || ch == '\267')) - || ch >= '\300' - && ch <= '\u02FF' - || ch >= '\u0370' - && ch <= '\u037D' - || ch >= '\u0300' - && ch <= '\u036F' - || ch >= '\u037F' - && ch <= '\u2027' - || ch >= '\u202A' && ch <= '\u218F' || ch >= '\u2800' && ch <= '\uFFEF'; - // return isValidStartElementNameChar(ch) - // || (ch < 256 && (ch == '-' - // || ch == '.' - // || ch >= '0' && ch <= '9' - // || ch == '\267')) - // || ch >= '\u0300' && ch <= '\u036F' - // || ch >= '\u0400' && ch <= '\u2027' - // || ch >= '\u202A' && ch <= '\u218F' - // || ch >= '\u2800' && ch <= '\uFFEF'; - } - - protected boolean isValidStartElementNameChar(char ch) { - return (ch < 256 && (ch >= 'A' && ch <= 'Z' || ch >= 'a' && ch <= 'z' || ch == '_' || ch == ':')) - || (ch >= '\300' && ch <= '\u02FF' || ch >= '\u0370' && ch <= '\u037D' - || ch >= '\u037F' && ch <= '\u0400' || ch >= '\u0400' && ch <= '\u2027' - || ch >= '\u202A' && ch <= '\u218F' || ch >= '\u2800' && ch <= '\uFFEF'); - } - - protected void parseAttribute(char ch) throws IOException { - int startAttributeName = this.iCurrentPosition - 1; - int endAttributeName; - // int hash = 0; - // int n = 0; - do { - // n = (n+1)&15; - // hash = hash*primes[n]+ch; - - ch = (char) getNextChar(); - } while (isValidElementNameChar(ch)); - endAttributeName = this.iCurrentPosition; - // String attributeName = new String(bufferChar, startAttributeName, - // endAttributeName - startAttributeName-1); - // attributeNames.add(attributeName); - - ch = skipOptionalSpaces(ch); - - if (ch != '=') throw new XMLPullParserException(this, "missing character \'=\'instead " - + escape(ch) + " was found "); - - ch = (char) getNextChar(); - ch = skipOptionalSpaces(ch); - - char delimiter; - if (ch != '\"' && ch != '\'') throw new XMLPullParserException(this, - "missing character \'\"\' or \'\'\' instead " + escape(ch) + " was found "); - delimiter = ch; - - // StringBuffer attributeValue = new StringBuffer(); - int startAttributeValue = this.iCurrentPosition; - char prevCh = '\0'; - // int hashvalue = 0; - // n = 0; - do { - // n = (n+1)&15; - // hashvalue = hashvalue *primes[n] +ch; - - ch = (char) getNextChar(); - if (ch == delimiter) break; - else if (ch == '<' || ch == '>') throw new XMLPullParserException(this, - "illegal character " + escape(ch)); - else if (ch == '&') { - int ref = parseReference(); - ch = (char) (ref & 0xffff); - // attributeValue.append((char)ref); - } else if (ch == '\t' || ch == '\r' || ch == '\n') { - - if (ch != '\n' || prevCh != '\r') { - // attributeValue.append(' '); - } - } else { - // attributeValue.append(ch); - } - prevCh = ch; - } while (true); - int endAttributeValue = this.iCurrentPosition; - // attributeValues.add(attributeValue.toString()); - addAttribute(startAttributeName, endAttributeName - startAttributeName - 1, - startAttributeValue, endAttributeValue - startAttributeValue - 1); - - return; - } - - protected int parseCDATA() throws IOException { - char ch; - - if ((char) getNextChar() != 'C' || (char) getNextChar() != 'D' - || (char) getNextChar() != 'A' || (char) getNextChar() != 'T' - || (char) getNextChar() != 'A' || (char) getNextChar() != '[') throw new XMLPullParserException( - "CDATA must start with \"' && doubleBraket) { - break; - } else { - braketFound = false; - doubleBraket = false; - } - if (ch == (char) -1) throw new XMLPullParserException( - "XML document structures must start and end within the same entity."); - } while (true); - - int endCharacter = this.iCurrentPosition - 3; - - this.iCharacters.setTranslate(false); - this.iCharacters.init(startCharacter, endCharacter - startCharacter); - - return -1; - } - - protected int parseComment() throws IOException { - char ch; - ch = (char) getNextChar(); - if (ch != '-') throw new XMLPullParserException("Comment must start with \"\n"); - if (this.iConfiguration.isCimXmlTracingEnabled() && debugStream != null) debugStream - .write(resultStr.toString().getBytes()); - if (LogAndTraceBroker.getBroker().isLoggableCIMXMLTrace(Level.FINEST)) logger - .traceCIMXML(Level.FINEST, resultStr.toString(), false); - } - } - } while (retries-- > 0); - - // Benchmark.stopTransportTimer(); - - // Look for CIM error and description, include in exception if exists - String errorCIM = connection.getHeaderField("CIMError"); - String errorDescriptionCIM = null; - if (errorCIM != null) { - logger.trace(Level.FINER, "Found CIMError field with value \"" + errorCIM + "\""); - - errorDescriptionCIM = connection.getHeaderField("CIMErrorDescription"); - if (errorDescriptionCIM != null) { - try { - errorDescriptionCIM = URLDecoder.decode(errorDescriptionCIM, "UTF-8"); - } catch (Exception e) { - errorDescriptionCIM = null; - } - logger.trace(Level.FINER, "Found CIMErrorDescription field with value \"" - + errorDescriptionCIM + "\""); - } - } - - // Look for OpenPegasus error details, decode and include in exception - // if it exists - String errorOP = connection.getHeaderField("PGErrorDetail"); - if (errorOP != null) { - try { - errorOP = URLDecoder.decode(errorOP, "UTF-8"); - } catch (Exception e) { - errorOP = null; - } - logger.trace(Level.FINER, "Found PGErrorDetail field with value \"" + errorOP + "\""); - } - - // Look for SFCB error details, decode and include in exception - // if it exists - String errorSFCB = connection.getHeaderField("SFCBErrorDetail"); - if (errorSFCB != null) { - try { - errorSFCB = URLDecoder.decode(errorSFCB, "UTF-8"); - } catch (Exception e) { - errorSFCB = null; - } - logger.trace(Level.FINER, "Found SFCBErrorDetail field with value \"" + errorSFCB - + "\""); - } - - // If CIMErrorDescription present, format of WBEMException is: - // - // HTTP StatusCode - ReasonPhrase (CIMError: "ErrorString", - // CIMErrorDescription: "ErrorString") - // - // Otherwise, format of WBEMException message is: - // - // HTTP StatusCode - ReasonPhrase (CIMError: "ErrorString", OpenPegasus - // Error: "ErrorString", SFCB Error: "ErrorString") - // - // For example: - // HTTP 503 - Service Unavailable (SFCB Error: - // "Max Session Limit Exceeded") - StringBuffer errorMsg = new StringBuffer("HTTP "); - errorMsg.append(connection.getResponseCode()); - errorMsg.append(" - "); - errorMsg.append(connection.getResponseMessage()); - if (errorCIM != null && errorDescriptionCIM != null) { - errorMsg.append(" (CIMError: \""); - errorMsg.append(errorCIM); - errorMsg.append("\", CIMErrorDescription: \""); - errorMsg.append(errorDescriptionCIM); - errorMsg.append("\")"); - } else if (errorCIM != null || errorOP != null || errorSFCB != null) { - errorMsg.append(" ("); - if (errorCIM != null) { - errorMsg.append("CIMError: \""); - errorMsg.append(errorCIM); - errorMsg.append('"'); - } - if (errorOP != null) { - if (errorCIM != null) errorMsg.append(", "); - errorMsg.append("OpenPegasus Error: \""); - errorMsg.append(errorOP); - errorMsg.append('"'); - } - if (errorSFCB != null) { - if (errorCIM != null || errorOP != null) errorMsg.append(", "); - errorMsg.append("SFCB Error: \""); - errorMsg.append(errorSFCB); - errorMsg.append('"'); - } - errorMsg.append(')'); - } - - connection.disconnect(); - - throw new WBEMException(exceptionNum, errorMsg.toString()); - } - - private HttpUrlConnection newConnection(boolean pIsIndication, URI pRecipient, - HttpClientPool pClientPool, String pCimMethod, HttpHeader pHeader, boolean pUseMPost) { - - final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); - logger.entry(); - - HttpUrlConnection connection = new HttpUrlConnection(pRecipient, pClientPool, - this.iAuthorizationHandler); - if (pUseMPost) { - connection.setRequestMethod(WBEMConstants.HTTP_MPOST); - } else connection.setRequestMethod(WBEMConstants.HTTP_POST); - connection.useHttp11("1.1".equals(this.iConfiguration.getHttpVersion())); - - String firstLocaleStr = this.iLocales[0].getLanguage(); - if (this.iLocales[0].getCountry().length() > 0) firstLocaleStr = firstLocaleStr + '-' - + this.iLocales[0].getCountry(); - StringBuilder restLocaleStrBld = new StringBuilder(""); - for (int i = 1; i < this.iLocales.length; i++) { - if (this.iLocales[i] != null && this.iLocales[i].getLanguage().length() > 0) { - restLocaleStrBld.append(", "); - restLocaleStrBld.append(this.iLocales[i].getLanguage()); - if (this.iLocales[i].getCountry().length() > 0) { - restLocaleStrBld.append('-'); - restLocaleStrBld.append(this.iLocales[i].getCountry()); - } - } - } - - connection.setDoOutput(true); - connection.setDoInput(true); - connection.setRequestProperty("Content-type", "application/xml; charset=\"utf-8\""); - connection.setRequestProperty("Accept", "text/html, text/xml, application/xml"); - connection.setRequestProperty("Cache-Control", "no-cache"); - connection.setRequestProperty("Content-Language", firstLocaleStr); - connection.setRequestProperty("Accept-Language", firstLocaleStr - + restLocaleStrBld.toString() + ", *"); - if (this.iAuthorization != null) connection.setRequestProperty("Authorization", - this.iAuthorization); - - String prefix = ""; - if (connection.getRequestMethod().equalsIgnoreCase(WBEMConstants.HTTP_MPOST)) { - String ns = getNextNs(); - connection.setRequestProperty("Man", "http://www.dmtf.org/cim/mapping/http/v1.0;ns=" - + ns); - prefix = ns + "-"; - } - connection.setRequestProperty(prefix + "CIMProtocolVersion", "1.0"); - - if (pIsIndication) { - try { - connection.setRequestProperty("CIMExport", HttpHeader.encode("MethodRequest", - "UTF-8", "US-ASCII")); - connection.setRequestProperty("CIMExportMethod", HttpHeader.encode( - "ExportIndication", "UTF-8", "US-ASCII")); - } catch (UnsupportedEncodingException e) { - logger.trace(Level.FINE, "Exception while encoding http header", e); - connection.setRequestProperty("CIMExport", "MethodRequest"); - connection.setRequestProperty("CIMExportMethod", "ExportIndication"); - } - } else { - connection.setRequestProperty(prefix + "CIMOperation", "MethodCall"); - try { - connection.setRequestProperty(prefix + "CIMMethod", HttpHeader.encode(pCimMethod, - "UTF-8", "US-ASCII")); - } catch (UnsupportedEncodingException e) { - logger.trace(Level.FINE, "Exception while encoding http header", e); - connection.setRequestProperty(prefix + "CIMMethod", pCimMethod); - } - } - Iterator> iter = pHeader.iterator(); - while (iter.hasNext()) { - Entry entry = iter.next(); - connection.setRequestProperty(prefix + entry.getKey().toString(), entry.getValue() - .toString()); - } - - logger.exit(); - return connection; - } - - private String getNextNs() { - this.iNsCounter = (this.iNsCounter < 99) ? ++this.iNsCounter : 10; - return String.valueOf(this.iNsCounter); - } - - private HttpHeader parseHeaders(URLConnection pConnection) { - String man = pConnection.getHeaderField("Man"); - String opt = pConnection.getHeaderField("Opt"); - HttpHeader headers = new HttpHeader(); - int i; - String ns = null; - - HttpHeaderParser manOptHeader = null; - if (man != null && man.length() > 0) manOptHeader = new HttpHeaderParser(man); - else if (opt != null && opt.length() > 0) manOptHeader = new HttpHeaderParser(opt); - if (manOptHeader != null) ns = manOptHeader.getValue("ns"); - - if (ns != null) { - i = 0; - String key; - while ((key = pConnection.getHeaderFieldKey(++i)) != null) { - if (key.startsWith(ns + "-")) headers.addParsedField(key.substring(3), pConnection - .getHeaderField(i)); - else headers.addParsedField(key, pConnection.getHeaderField(i)); - } - } else { - i = 0; - String key; - while ((key = pConnection.getHeaderFieldKey(++i)) != null) { - headers.addParsedField(key, pConnection.getHeaderField(i)); - } - } - - return headers; - } - - private String getCharacterSet(HttpHeader pHeader) { - String contentType = pHeader.getField("Content-type"); - String charset = "UTF-8"; - if (contentType != null && contentType.length() > 0) { - HttpHeaderParser contentTypeHeader = new HttpHeaderParser(contentType); - charset = contentTypeHeader.getValue("charset", charset); - } - return charset; - } - - /** - * getIterator : get generic CloseableIterator - * - * @param - * : Type Parameter - * @param pStream - * : Input Stream Reader - * @param pPath - * : CIMObjectPath - * @return generic CloseableIterator - * @throws IOException - * @throws SAXException - * @throws ParserConfigurationException - * @throws WBEMException - */ - - // :TODO : try to find solution of "unchecked" warning - @SuppressWarnings("unchecked") - private CloseableIterator getIterator(InputStreamReader pStream, CIMObjectPath pPath) - throws IOException, SAXException, ParserConfigurationException, WBEMException { - - String parser = this.iConfiguration.getCimXmlParser(); - - CloseableIterator iter = null; - - if (WBEMConstants.SAX.equals(parser)) { - iter = new CloseableIteratorSAX(pStream, pPath); - } else if (WBEMConstants.PULL.equals(parser)) { - iter = new CloseableIteratorPULL(pStream, pPath); - } else if (WBEMConstants.DOM.equals(parser)) { - iter = new CloseableIteratorDOM(pStream, pPath); - } else { - throw new IllegalArgumentException("Invalid CIM-XML parser configured (\"" + parser - + "\") "); - } - try { - // check for CIMExceptions - iter.hasNext(); - return (CloseableIterator) iter; - } catch (RuntimeException e) { - iter.close(); - if (e.getCause() != null && e.getCause() instanceof WBEMException) { throw (WBEMException) e - .getCause(); } - throw e; - } - } - - private EnumerateResponse getEnumerateResponse(InputStreamReader pStream, - CIMObjectPath pPath) throws IOException, SAXException, ParserConfigurationException, - WBEMException { - - String parser = this.iConfiguration.getCimXmlParser(); - - if (WBEMConstants.SAX.equals(parser)) return new EnumerateResponseSAX(pStream, pPath) - .getEnumResponse(); - else if (WBEMConstants.PULL.equals(parser)) return new EnumerateResponsePULL(pStream, - pPath).getEnumResponse(); - else if (WBEMConstants.DOM.equals(parser)) return new EnumerateResponseDOM(pStream, - pPath).getEnumResponse(); - - throw new IllegalArgumentException("Invalid CIM-XML parser configured (\"" + parser - + "\") "); - } - - private CIMResponse getSingleResponse(InputStreamReader pStream, CIMObjectPath pLocalPath) - throws WBEMException { - final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - Document dom; - try { - // Using factory get an instance of document builder - DocumentBuilder db = dbf.newDocumentBuilder(); - // parse using builder to get DOM representation of the XML file - dom = db.parse(new InputSource(pStream)); - } catch (TrailerException e) { - throw e.getWBEMException(); - } catch (Exception e) { - String msg = "Exception occurred during DOM parsing!"; - logger.trace(Level.SEVERE, msg, e); - throw new WBEMException(WBEMException.CIM_ERR_FAILED, msg, null, e); - } - CIMXMLParserImpl.setLocalObjectPath(pLocalPath); - CIMMessage cimMsg; - try { - cimMsg = CIMXMLParserImpl.parseCIM(dom.getDocumentElement()); - } catch (CIMXMLParseException e) { - String msg = "Exception occurred during parseCIM!"; - logger.trace(Level.SEVERE, msg, e); - throw new WBEMException(WBEMException.CIM_ERR_FAILED, msg, null, e); - } - if (!(cimMsg instanceof CIMResponse)) { - String msg = "CIM message must be response!"; - logger.trace(Level.SEVERE, msg); - throw new WBEMException(msg); - } - return (CIMResponse) cimMsg; - } - - public Properties getLocalProperties() { - return this.iConfiguration.getLocalProperties(); - } - - public void setLocalProperties(Properties pProperties) { - this.iConfiguration.setLocalProperties(pProperties); - } - - public void setLocalProperty(String pKey, String pValue) { - this.iConfiguration.setLocalProperty(pKey, pValue); - } - - private synchronized void checkState() throws IllegalStateException { - if (this.iInitialized && !this.iClosed) return; - String state = this.iClosed ? "closed." : "not initialized."; - LogAndTraceBroker.getBroker().trace(Level.FINE, "Illegal state for operation: " + state); - throw new IllegalStateException("WBEMClient is " + state); - } - - public EnumerateResponse associatorPaths(CIMObjectPath pObjectName, - String pAssociationClass, String pResultClass, String pRole, String pResultRole, - String pFilterQueryLanguage, String pFilterQuery, UnsignedInteger32 pTimeout, - boolean pContinueOnError, UnsignedInteger32 pMaxObjects) throws WBEMException { - - final String operation = "OpenAssociatorInstancePaths"; - final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); - logger.entry(); - - checkState(); - - try { - if (pObjectName == null || pObjectName.getNamespace() == null - || pObjectName.getObjectName() == null) { throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } - - HttpHeader hh = new HttpHeader(); - hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", - "US-ASCII")); - - Document doc = this.iXmlHelper.newDocument(); - - this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper - .OpenAssociatorInstancePaths_request(doc, pObjectName, pAssociationClass, - pResultClass, pRole, pResultRole, pFilterQueryLanguage, pFilterQuery, - pTimeout, pContinueOnError, pMaxObjects)); - - InputStreamReader is = transmitRequest(operation, hh, doc); - - EnumerateResponse enumResp = getEnumerateResponse(is, pObjectName); - return enumResp; - - } catch (WBEMException e) { - logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); - throw e; - } catch (Exception e) { - if (e.getCause() != null && e.getCause() instanceof WBEMException) { - logger - .trace(Level.FINE, operation + " request resulted in CIM Error", e - .getCause()); - throw (WBEMException) e.getCause(); - } - logger.trace(Level.FINE, operation + " request failed", e); - throw new WBEMException(WBEMException.CIM_ERR_FAILED, null, null, e); - } finally { - logger.exit(); - } - } - - public EnumerateResponse associators(CIMObjectPath pObjectName, - String pAssocClass, String pResultClass, String pRole, String pResultRole, - boolean pIncludeClassOrigin, String[] pPropertyList, String pFilterQueryLanguage, - String pFilterQuery, UnsignedInteger32 pTimeout, boolean pContinueOnError, - UnsignedInteger32 pMaxObjects) throws WBEMException { - - final String operation = "OpenAssociatorInstances"; - final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); - logger.entry(); - - checkState(); - - try { - if (pObjectName == null || pObjectName.getNamespace() == null - || pObjectName.getObjectName() == null) { throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } - - HttpHeader hh = new HttpHeader(); - hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", - "US-ASCII")); - - Document doc = this.iXmlHelper.newDocument(); - - this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.OpenAssociatorInstances_request( - doc, pObjectName, pAssocClass, pResultClass, pRole, pResultRole, - pIncludeClassOrigin, pPropertyList, pFilterQueryLanguage, pFilterQuery, - pTimeout, pContinueOnError, pMaxObjects)); - - InputStreamReader is = transmitRequest(operation, hh, doc); - - EnumerateResponse enumResp = getEnumerateResponse(is, pObjectName); - return enumResp; - - } catch (WBEMException e) { - logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); - throw e; - } catch (Exception e) { - if (e.getCause() != null && e.getCause() instanceof WBEMException) { - logger - .trace(Level.FINE, operation + " request resulted in CIM Error", e - .getCause()); - throw (WBEMException) e.getCause(); - } - logger.trace(Level.FINE, operation + " request failed", e); - throw new WBEMException(WBEMException.CIM_ERR_FAILED, null, null, e); - } finally { - logger.exit(); - } - } - - public void closeEnumeration(CIMObjectPath pObjectName, String pEnumerationContext) - throws WBEMException { - - final String operation = "CloseEnumeration"; - final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); - logger.entry(); - - checkState(); - - try { - if (pObjectName == null || pObjectName.getNamespace() == null - || pObjectName.getObjectName() == null) { throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } - - HttpHeader hh = new HttpHeader(); - hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", - "US-ASCII")); - - Document doc = this.iXmlHelper.newDocument(); - - this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.CloseEnumeration_request(doc, - pObjectName, pEnumerationContext)); - - InputStreamReader is = transmitRequest(operation, hh, doc); - - CloseableIterator iter = getIterator(is, pObjectName); - - // Check for exceptions - try { - iter.hasNext(); - } finally { - iter.close(); - } - } catch (WBEMException e) { - logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); - throw e; - } catch (Exception e) { - if (e.getCause() != null && e.getCause() instanceof WBEMException) { - logger - .trace(Level.FINE, operation + " request resulted in CIM Error", e - .getCause()); - throw (WBEMException) e.getCause(); - } - logger.trace(Level.FINE, operation + " request failed", e); - throw new WBEMException(WBEMException.CIM_ERR_FAILED, null, null, e); - } finally { - logger.exit(); - } - - } - - public EnumerateResponse enumerateInstancePaths(CIMObjectPath pObjectName, - String pFilterQueryLanguage, String pFilterQuery, UnsignedInteger32 pTimeout, - boolean pContinueOnError, UnsignedInteger32 pMaxObjects) throws WBEMException { - - final String operation = "OpenEnumerateInstancePaths"; - final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); - logger.entry(); - - checkState(); - - try { - if (pObjectName == null || pObjectName.getNamespace() == null - || pObjectName.getObjectName() == null) { throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } - - HttpHeader hh = new HttpHeader(); - hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", - "US-ASCII")); - - Document doc = this.iXmlHelper.newDocument(); - - this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper - .OpenEnumerateInstancePaths_request(doc, pObjectName, pFilterQueryLanguage, - pFilterQuery, pTimeout, pContinueOnError, pMaxObjects)); - - InputStreamReader is = transmitRequest(operation, hh, doc); - - EnumerateResponse enumResp = getEnumerateResponse(is, pObjectName); - return enumResp; - - } catch (WBEMException e) { - logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); - throw e; - } catch (Exception e) { - if (e.getCause() != null && e.getCause() instanceof WBEMException) { - logger - .trace(Level.FINE, operation + " request resulted in CIM Error", e - .getCause()); - throw (WBEMException) e.getCause(); - } - logger.trace(Level.FINE, operation + " request failed", e); - throw new WBEMException(WBEMException.CIM_ERR_FAILED, null, null, e); - } finally { - logger.exit(); - } - } - - public EnumerateResponse enumerateInstances(CIMObjectPath pObjectName, - boolean pDeepInheritance, boolean pIncludeClassOrigin, String[] pPropertyList, - String pFilterQueryLanguage, String pFilterQuery, UnsignedInteger32 pTimeout, - boolean pContinueOnError, UnsignedInteger32 pMaxObjects) throws WBEMException { - - final String operation = "OpenEnumerateInstances"; - final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); - logger.entry(); - - checkState(); - - try { - if (pObjectName == null || pObjectName.getNamespace() == null - || pObjectName.getObjectName() == null) { throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } - - HttpHeader hh = new HttpHeader(); - hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", - "US-ASCII")); - - Document doc = this.iXmlHelper.newDocument(); - - this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.OpenEnumerateInstances_request( - doc, pObjectName, pDeepInheritance, pIncludeClassOrigin, pPropertyList, - pFilterQueryLanguage, pFilterQuery, pTimeout, pContinueOnError, pMaxObjects)); - - InputStreamReader is = transmitRequest(operation, hh, doc); - EnumerateResponse enumResp = getEnumerateResponse(is, pObjectName); - return enumResp; - - } catch (WBEMException e) { - logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); - throw e; - } catch (Exception e) { - if (e.getCause() != null && e.getCause() instanceof WBEMException) { - logger - .trace(Level.FINE, operation + " request resulted in CIM Error", e - .getCause()); - throw (WBEMException) e.getCause(); - } - logger.trace(Level.FINE, operation + " request failed", e); - throw new WBEMException(WBEMException.CIM_ERR_FAILED, null, null, e); - } finally { - logger.exit(); - } - } - - // not supported yet - public UnsignedInteger64 enumerationCount(CIMObjectPath pObjectName, String pEnumerationContext) - throws WBEMException { - final String operation = "EnumerationCount"; - final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); - logger.entry(); - - checkState(); - - try { - if (pObjectName == null || pObjectName.getNamespace() == null - || pObjectName.getObjectName() == null) { throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } - - HttpHeader hh = new HttpHeader(); - hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", - "US-ASCII")); - - Document doc = this.iXmlHelper.newDocument(); - - this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.EnumerationCount_request(doc, - pObjectName, pEnumerationContext)); - - InputStreamReader is = transmitRequest(operation, hh, doc); - // Currently this is not supported by server. Server returns - // error : "CIM_ERR_NOT_SUPPORTED" - // This error is caught by parser and exception is thrown - - getEnumerateResponse(is, pObjectName); - // Error mentioned above will go away if server starts to support - // EnumerationCount, we need to update code i.e. remove exception - // and return UnsignedInteger64 - - // this exception will be thrown only if server starts to support - // enumerationCount - throw new WBEMException(operation + " is currently not supported by client"); - - } catch (WBEMException e) { - logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); - throw e; - } catch (Exception e) { - if (e.getCause() != null && e.getCause() instanceof WBEMException) { - logger - .trace(Level.FINE, operation + " request resulted in CIM Error", e - .getCause()); - throw (WBEMException) e.getCause(); - } - logger.trace(Level.FINE, operation + " request failed", e); - throw new WBEMException(WBEMException.CIM_ERR_FAILED, null, null, e); - } finally { - logger.exit(); - } - } - - public EnumerateResponse execQueryInstances(CIMObjectPath pObjectName, - String pFilterQuery, String pFilterQueryLanguage, boolean pReturnQueryResultClass, - UnsignedInteger32 pTimeout, boolean pContinueOnError, UnsignedInteger32 pMaxObjects, - CIMClass pQueryResultClass) throws WBEMException { - - final String operation = "OpenQueryInstances"; - final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); - logger.entry(); - - checkState(); - - try { - if (pObjectName == null || pObjectName.getNamespace() == null - || pObjectName.getObjectName() == null) { throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } - - HttpHeader hh = new HttpHeader(); - hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", - "US-ASCII")); - - Document doc = this.iXmlHelper.newDocument(); - - this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.OpenQueryInstances_request(doc, - pObjectName, pFilterQuery, pFilterQueryLanguage, pReturnQueryResultClass, - pTimeout, pContinueOnError, pMaxObjects, pQueryResultClass)); - - InputStreamReader is = transmitRequest(operation, hh, doc); - EnumerateResponse enumResp = getEnumerateResponse(is, pObjectName); - return enumResp; - - } catch (WBEMException e) { - logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); - throw e; - } catch (Exception e) { - if (e.getCause() != null && e.getCause() instanceof WBEMException) { - logger - .trace(Level.FINE, operation + " request resulted in CIM Error", e - .getCause()); - throw (WBEMException) e.getCause(); - } - logger.trace(Level.FINE, operation + " request failed", e); - throw new WBEMException(WBEMException.CIM_ERR_FAILED, null, null, e); - } finally { - logger.exit(); - } - } - - public EnumerateResponse getInstancePaths(CIMObjectPath pObjectName, - String pContext, UnsignedInteger32 pMaxObjects) throws WBEMException { - - final String operation = "PullInstancePaths"; - final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); - logger.entry(); - - checkState(); - - try { - if (pObjectName == null || pObjectName.getNamespace() == null - || pObjectName.getObjectName() == null) { throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } - - HttpHeader hh = new HttpHeader(); - hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", - "US-ASCII")); - - Document doc = this.iXmlHelper.newDocument(); - - this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.PullInstancePaths_request(doc, - pObjectName, pContext, pMaxObjects)); - - InputStreamReader is = transmitRequest(operation, hh, doc); - EnumerateResponse enumResp = getEnumerateResponse(is, pObjectName); - return enumResp; - - } catch (WBEMException e) { - logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); - throw e; - } catch (Exception e) { - if (e.getCause() != null && e.getCause() instanceof WBEMException) { - logger - .trace(Level.FINE, operation + " request resulted in CIM Error", e - .getCause()); - throw (WBEMException) e.getCause(); - } - logger.trace(Level.FINE, operation + " request failed", e); - throw new WBEMException(WBEMException.CIM_ERR_FAILED, null, null, e); - } finally { - logger.exit(); - } - } - - public EnumerateResponse getInstances(CIMObjectPath pObjectName, String pContext, - UnsignedInteger32 pMaxObjects) throws WBEMException { - - final String operation = "PullInstances"; - final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); - logger.entry(); - - checkState(); - - try { - if (pObjectName == null || pObjectName.getNamespace() == null - || pObjectName.getObjectName() == null) { throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } - - HttpHeader hh = new HttpHeader(); - hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", - "US-ASCII")); - - Document doc = this.iXmlHelper.newDocument(); - - this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.PullInstances_request(doc, - pObjectName, pContext, pMaxObjects)); - - InputStreamReader is = transmitRequest(operation, hh, doc); - EnumerateResponse enumResp = getEnumerateResponse(is, pObjectName); - return enumResp; - - } catch (WBEMException e) { - logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); - throw e; - } catch (Exception e) { - if (e.getCause() != null && e.getCause() instanceof WBEMException) { - logger - .trace(Level.FINE, operation + " request resulted in CIM Error", e - .getCause()); - throw (WBEMException) e.getCause(); - } - logger.trace(Level.FINE, operation + " request failed", e); - throw new WBEMException(WBEMException.CIM_ERR_FAILED, null, null, e); - } finally { - logger.exit(); - } - } - - public EnumerateResponse getInstancesWithPath(CIMObjectPath pObjectName, - String pContext, UnsignedInteger32 pMaxObjects) throws WBEMException { - - final String operation = "PullInstancesWithPath"; - final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); - logger.entry(); - - checkState(); - - try { - if (pObjectName == null || pObjectName.getNamespace() == null - || pObjectName.getObjectName() == null) { throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } - - HttpHeader hh = new HttpHeader(); - hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", - "US-ASCII")); - - Document doc = this.iXmlHelper.newDocument(); - - this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.PullInstancesWithPath_request( - doc, pObjectName, pContext, pMaxObjects)); - - InputStreamReader is = transmitRequest(operation, hh, doc); - EnumerateResponse enumResp = getEnumerateResponse(is, pObjectName); - return enumResp; - - } catch (WBEMException e) { - logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); - throw e; - } catch (Exception e) { - if (e.getCause() != null && e.getCause() instanceof WBEMException) { - logger - .trace(Level.FINE, operation + " request resulted in CIM Error", e - .getCause()); - throw (WBEMException) e.getCause(); - } - logger.trace(Level.FINE, operation + " request failed", e); - throw new WBEMException(WBEMException.CIM_ERR_FAILED, null, null, e); - } finally { - logger.exit(); - } - } - - public EnumerateResponse referencePaths(CIMObjectPath pObjectName, - String pResultClass, String pRole, String pFilterQueryLanguage, String pFilterQuery, - UnsignedInteger32 pTimeout, boolean pContinueOnError, UnsignedInteger32 pMaxObjects) - throws WBEMException { - - final String operation = "OpenReferenceInstancePaths"; - final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); - logger.entry(); - - checkState(); - - try { - if (pObjectName == null || pObjectName.getNamespace() == null - || pObjectName.getObjectName() == null) { throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } - - HttpHeader hh = new HttpHeader(); - hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", - "US-ASCII")); - - Document doc = this.iXmlHelper.newDocument(); - - this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper - .OpenReferenceInstancePaths_request(doc, pObjectName, pResultClass, pRole, - pFilterQueryLanguage, pFilterQuery, pTimeout, pContinueOnError, - pMaxObjects)); - - InputStreamReader is = transmitRequest(operation, hh, doc); - EnumerateResponse enumResp = getEnumerateResponse(is, pObjectName); - return enumResp; - - } catch (WBEMException e) { - logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); - throw e; - } catch (Exception e) { - if (e.getCause() != null && e.getCause() instanceof WBEMException) { - logger - .trace(Level.FINE, operation + " request resulted in CIM Error", e - .getCause()); - throw (WBEMException) e.getCause(); - } - logger.trace(Level.FINE, operation + " request failed", e); - throw new WBEMException(WBEMException.CIM_ERR_FAILED, null, null, e); - } finally { - logger.exit(); - } - } - - public EnumerateResponse references(CIMObjectPath pObjectName, - String pResultClass, String pRole, boolean pIncludeClassOrigin, String[] pPropertyList, - String pFilterQueryLanguage, String pFilterQuery, UnsignedInteger32 pTimeout, - boolean pContinueOnError, UnsignedInteger32 pMaxObjects) throws WBEMException { - - final String operation = "OpenReferenceInstances"; - final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); - logger.entry(); - - checkState(); - - try { - - if (pObjectName == null || pObjectName.getNamespace() == null - || pObjectName.getObjectName() == null) { throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } - - HttpHeader hh = new HttpHeader(); - hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", - "US-ASCII")); - - Document doc = this.iXmlHelper.newDocument(); - - this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.OpenReferenceInstances_request( - doc, pObjectName, pResultClass, pRole, pIncludeClassOrigin, pPropertyList, - pFilterQueryLanguage, pFilterQuery, pTimeout, pContinueOnError, pMaxObjects)); - - InputStreamReader is = transmitRequest(operation, hh, doc); - EnumerateResponse enumResp = getEnumerateResponse(is, pObjectName); - return enumResp; - - } catch (WBEMException e) { - logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); - throw e; - } catch (Exception e) { - if (e.getCause() != null && e.getCause() instanceof WBEMException) { - logger - .trace(Level.FINE, operation + " request resulted in CIM Error", e - .getCause()); - throw (WBEMException) e.getCause(); - } - logger.trace(Level.FINE, operation + " request failed", e); - throw new WBEMException(WBEMException.CIM_ERR_FAILED, null, null, e); - } finally { - logger.exit(); - } - } - - private InputStreamReader transmitIndicationRequest(URI pRecipient, HttpClientPool pClientPool, - HttpHeader pHeader, Document pDocument) throws IOException, ProtocolException, - WBEMException { - return transmitRequestWorker(true, pRecipient, pClientPool, null, pHeader, pDocument); - } - - public boolean sendIndication(URI pRecipient, CIMInstance pIndication) throws WBEMException { - final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); - logger.entry(); - - checkState(); - - try { - if (pRecipient == null || pRecipient.getScheme() == null - || pRecipient.getHost() == null || pRecipient.getPort() <= 0) { throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, - "Invalid recipient URI, must contain valid scheme://host:port"); } - - if (!pRecipient.getScheme().equalsIgnoreCase(WBEMConstants.HTTP) - && !pRecipient.getScheme().equalsIgnoreCase(WBEMConstants.HTTPS)) throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid scheme " - + pRecipient.getScheme() + ", must be http or https"); - - if (pIndication == null) { throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid indication, must not be null"); } - - logger.trace(Level.FINER, "Attempting to send following indication to " - + pRecipient.toString() + ":\n" + pIndication.toString()); - - HttpHeader hh = new HttpHeader(); - - Document doc = this.iXmlHelper.newDocument(); - - this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.sendIndication_request(doc, - pIndication)); - - HttpClientPool indPool = new HttpClientPool(this.iConfiguration); - - InputStreamReader is = transmitIndicationRequest(pRecipient, indPool, hh, doc); - - boolean success = false; - if (is != null) { - CIMResponse response = getSingleResponse(is, null); - success = response != null && response.isSuccessful(); - } - - indPool.closePool(); - - return success; - } catch (WBEMException e) { - logger.trace(Level.FINE, "Sending indication resulted in CIM Error", e); - throw e; - } catch (Exception e) { - if (e.getCause() != null && e.getCause() instanceof WBEMException) { - logger.trace(Level.FINE, "Sending indication resulted in CIM Error", e.getCause()); - throw (WBEMException) e.getCause(); - } - logger.trace(Level.FINE, "Sending indication failed", e); - throw new WBEMException(WBEMException.CIM_ERR_FAILED, null, null, e); - } finally { - logger.exit(); - } - } -} +/* + (C) Copyright IBM Corp. 2006, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Alexander Wolf-Reber, a.wolf-reber@de.ibm.com + * + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1565892 2006-11-08 lupusalex Make SBLIM client JSR48 compliant + * 1688273 2007-04-16 ebak Full support of HTTP trailers + * 1702832 2007-04-18 lupusalex WBEMClientCIMXL.setCustomSocketFactory() not implemented + * 1686000 2007-04-19 ebak modifyInstance() missing from WBEMClient + * 1714184 2007-05-07 lupusalex FVT: NPE on WBEMClientCIMXML.init() + * 1715053 2007-05-08 lupusalex FVT: No forced retry on HTTP 501/510 + * 1714853 2007-05-08 lupusalex Inexplicit error when operation is invoked on closed client + * 1714902 2007-05-08 lupusalex Threading related weak spots + * 1715482 2007-05-10 lupusalex CIM_ERR_FAILED thrown when access denied + * 1736318 2007-06-13 lupusalex Wrong object path in HTTP header + * 1737141 2007-06-18 ebak Sync up with JSR48 evolution + * 1741654 2007-08-22 ebak Header mismatch error on ModifyInstance + * 1949000 2008-04-24 blaschke-oss setLocales() is empty + * 1963762 2008-05-14 blaschke-oss connection leak in WBEMClientCIMXML + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2002599 2008-07-05 raman_arora M-POST not supported in java-client + * 2034342 2008-07-31 blaschke-oss HttpClient not closed on cimclient close + * 2087975 2008-09-03 blaschke-oss can't set the pPropagated in WBEMClient.enumerateClasses() + * 2382763 2008-12-03 blaschke-oss HTTP header field Accept-Language does not include * + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors + * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics + * 2845211 2009-08-27 raman_arora Pull Enumeration Feature (SAX Parser) + * 2860081 2009-09-17 raman_arora Pull Enumeration Feature (DOM Parser) + * 2846231 2009-09-23 rgummada connection failure on CIMOM w/o user/pw + * 2865222 2009-09-29 raman_arora enumerateQualifierTypes shouldn't require a class name + * 2858933 2009-10-12 raman_arora JSR48 new APIs: associatorClasses & associatorInstances + * 2884718 2009-10-23 blaschke-oss Merge JSR48 and SBLIM client properties + * 2878054 2009-10-25 raman_arora Pull Enumeration Feature (PULL Parser) + * 2888774 2009-10-29 raman_arora support POST retry on HTTP error 505 + * 2886829 2009-11-18 raman_arora JSR48 new APIs: referenceClasses & referenceInstances + * 2909941 2010-01-06 blaschke-oss RequestStateChange gives wrong exception/error id + * 2930341 2010-01-12 blaschke-oss Sync up WBEMClientConstants with JSR48 1.0.0 + * 2913938 2010-02-17 blaschke-oss Duplicate CIM requests with identical message ID + * 2961592 2010-03-01 blaschke-oss Remove WBEMClient.setLocales() UnsupportedOperationException + * 2964463 2010-03-08 blaschke-oss WBEMClient.initialize() throws wrong exception + * 2942520 2010-03-08 blaschke-oss IPv6 link local address with scope_id including a dot not supported + * 3019252 2010-06-21 blaschke-oss Methods concatenate strings using + in a loop + * 3028518 2010-07-14 blaschke-oss Additional StringBuilder use + * 3185833 2011-02-18 blaschke-oss missing newline when logging request/response + * 3197423 2011-03-02 blaschke-oss Server authentication with PegasusLocalAuthInfo failing + * 3277928 2011-04-06 blaschke-oss CIM-XML tracing cannot be enabled in the field + * 3423064 2011-10-13 blaschke-oss Add UpdateExpiredPassword Header for Reqs from Java Client + * 3496355 2012-03-02 blaschke-oss JSR48 1.0.0: add new WBEMClientConstants + * 3514537 2012-04-03 blaschke-oss TCK: execQueryInstances requires boolean, not Boolean + * 3514685 2012-04-03 blaschke-oss TCK: getProperty must return default values + * 3515180 2012-04-05 blaschke-oss JSR48 log dir/file should handle UNIX/Win separators + * 3516848 2012-04-11 blaschke-oss enumerateNamespaces() method to WBEMClient + * 3521119 2012-04-24 blaschke-oss JSR48 1.0.0: remove CIMObjectPath 2/3/4-parm ctors + * 3521328 2012-04-25 blaschke-oss JSR48 1.0.0: remove WBEMClient associators and references + * 3522904 2012-05-02 blaschke-oss Add new API WBEMClientSBLIM.isActive() + * 3521157 2012-05-10 blaschke-oss JSR48 1.0.0: PROP_ENABLE_*_LOGGING is Level, not 0/1 + * 3525914 2012-05-11 blaschke-oss TCK: SetPropertyTest.testSetProperty failing + * 3545797 2012-07-19 blaschke-oss Support new error code of SFCB + * 3553858 2012-08-06 blaschke-oss Append duplicate HTTP header fields instead of replace + * 3554738 2012-08-16 blaschke-oss dump CIM xml by LogAndTraceBroker.trace() + * 3601894 2013-01-23 blaschke-oss Enhance HTTP and CIM-XML tracing + * 2614 2013-02-21 blaschke-oss Remove redundant code in transmitRequest + * 2616 2013-02-23 blaschke-oss Add new API WBEMClientSBLIM.sendIndication() + * 2651 2013-07-31 blaschke-oss IOException when tracing the cimxml + * 2662 2013-09-10 blaschke-oss Need the specific SSLHandshakeException during the cim call + * 2594 2013-11-30 blaschke-oss CR28: Support CIMErrorDescription HTTP field + */ +package org.metricshub.wbem.sblim.cimclient.internal.wbem; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.UnsupportedEncodingException; +import java.net.HttpURLConnection; +import java.net.PasswordAuthentication; +import java.net.ProtocolException; +import java.net.SocketException; +import java.net.SocketTimeoutException; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.URLConnection; +import java.net.URLDecoder; +import java.net.UnknownHostException; +import java.security.Principal; +import java.util.Iterator; +import java.util.List; +import java.util.Locale; +import java.util.Properties; +import java.util.Map.Entry; +import java.util.logging.Level; + +import org.metricshub.wbem.javax.cim.CIMArgument; +import org.metricshub.wbem.javax.cim.CIMClass; +import org.metricshub.wbem.javax.cim.CIMInstance; +import org.metricshub.wbem.javax.cim.CIMObjectPath; +import org.metricshub.wbem.javax.cim.CIMQualifierType; +import org.metricshub.wbem.javax.wbem.CloseableIterator; +import org.metricshub.wbem.javax.wbem.WBEMException; +import org.metricshub.wbem.javax.wbem.client.EnumerateResponse; +import org.metricshub.wbem.javax.wbem.client.PasswordCredential; +import org.metricshub.wbem.javax.wbem.client.RoleCredential; +import org.metricshub.wbem.javax.wbem.client.WBEMClient; +import org.metricshub.wbem.sblim.cimclient.WBEMClientSBLIM; +import org.metricshub.wbem.sblim.cimclient.WBEMConfigurationProperties; +import org.metricshub.wbem.sblim.cimclient.internal.cim.CIMHelper; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.CIMClientXML_HelperImpl; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.CIMResponse; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.CIMXMLParserImpl; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXHelper; +import org.metricshub.wbem.sblim.cimclient.internal.http.AuthorizationInfo; +import org.metricshub.wbem.sblim.cimclient.internal.http.HttpClientPool; +import org.metricshub.wbem.sblim.cimclient.internal.http.HttpHeader; +import org.metricshub.wbem.sblim.cimclient.internal.http.HttpHeaderParser; +import org.metricshub.wbem.sblim.cimclient.internal.http.HttpUrlConnection; +import org.metricshub.wbem.sblim.cimclient.internal.http.HttpHeader.HeaderEntry; +import org.metricshub.wbem.sblim.cimclient.internal.http.io.DebugInputStream; +import org.metricshub.wbem.sblim.cimclient.internal.http.io.TrailerException; +import org.metricshub.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; +import org.metricshub.wbem.sblim.cimclient.internal.logging.Messages; +import org.metricshub.wbem.sblim.cimclient.internal.logging.TimeStamp; +import org.metricshub.wbem.sblim.cimclient.internal.util.MOF; +import org.metricshub.wbem.sblim.cimclient.internal.util.WBEMConfiguration; +import org.metricshub.wbem.sblim.cimclient.internal.util.WBEMConfigurationDefaults; +import org.metricshub.wbem.javax.cim.UnsignedInteger32; +import org.metricshub.wbem.javax.cim.UnsignedInteger64; +import javax.net.SocketFactory; +import javax.net.ssl.SSLHandshakeException; +import javax.security.auth.Subject; + +import org.metricshub.wbem.javax.wbem.client.WBEMClientConstants; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.CIMMessage; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.CIMXMLParseException; +import org.metricshub.wbem.sblim.cimclient.internal.http.AuthorizationHandler; +import org.metricshub.wbem.sblim.cimclient.internal.util.WBEMConstants; +import org.w3c.dom.Document; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; + +/** + * The WBEMClientCIMXML is a implementation of the + * javax.wbem.client.WBEMClient interface for the CIM-XML protocol + * including the extensions of the + * org.metricshub.wbem.sblim.cimclient.WBEMClientSBLIM interface. + * + * @see WBEMClient + * @see WBEMClientSBLIM + */ +public class WBEMClientCIMXML implements WBEMClientSBLIM { + + private final WBEMConfiguration iConfiguration = new WBEMConfiguration(new Properties()); + + private Locale[] iLocales; // final + + private HttpClientPool iHttpClientPool; // final + + private URI iUri; // final + + private AuthorizationHandler iAuthorizationHandler; // final + + private CIMClientXML_HelperImpl iXmlHelper; // final + + private volatile String iAuthorization; + + private volatile int iNsCounter = 10; + + private volatile boolean iMPostFailed = false; + + private volatile long iMPostFailTime = 0; + + private volatile long iCurrentTime = 0; + + private volatile boolean iInitialized = false; + + private volatile boolean iClosed = false; + + private String iInteropNamespace = null; + + /** + * Ctor. + */ + public WBEMClientCIMXML() { + super(); + } + + private synchronized void initializeClient(URI pUri, Subject pSubject, Locale[] pLocales) + throws IllegalArgumentException { + + if (this.iInitialized) throw new IllegalStateException("WBEMClient is already initialized"); + + final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); + logger.entry(); + + try { + this.iHttpClientPool = new HttpClientPool(this.iConfiguration); + this.iLocales = (pLocales != null && pLocales.length > 0) ? pLocales + : WBEMConstants.DEFAULT_LOCALES; + this.iUri = pUri; + + AuthorizationInfo authInfo = AuthorizationInfo.createAuthorizationInfo( + this.iConfiguration.getHttpAuthenticationModule(), Boolean.FALSE, this.iUri + .getHost(), this.iUri.getPort(), null, null, null); + + Principal principal = (pSubject != null && pSubject.getPrincipals() != null && !pSubject + .getPrincipals().isEmpty()) ? (Principal) pSubject.getPrincipals().iterator() + .next() : null; + Object credential = (pSubject != null && pSubject.getPrivateCredentials() != null + && !pSubject.getPrivateCredentials().isEmpty() ? pSubject + .getPrivateCredentials().iterator().next() : null); + + boolean defaultAuthEnabled = WBEMConfiguration.getGlobalConfiguration() + .isDefaultAuthorizationEnabled(); + + String user = (principal != null) ? principal.getName() : ""; + String password = (credential != null && credential instanceof PasswordCredential) ? new String( + ((PasswordCredential) credential).getUserPassword()) + : ((credential != null && credential instanceof RoleCredential) ? new String( + ((RoleCredential) credential).getCredential()) : ""); + + if (defaultAuthEnabled && (user == null || user.length() == 0) + && password.length() == 0) { + logger.trace(Level.FINER, + "Principal and Credential not set - using default authorization!"); + + user = WBEMConfiguration.getGlobalConfiguration().getDefaultPrincipal(); + password = WBEMConfiguration.getGlobalConfiguration().getDefaultCredentials(); + } + + authInfo.setCredentials(new PasswordAuthentication(user, password.toCharArray())); + this.iAuthorizationHandler = new AuthorizationHandler(); + this.iAuthorizationHandler.addAuthorizationInfo(authInfo); + + try { + this.iXmlHelper = new CIMClientXML_HelperImpl(); + } catch (ParserConfigurationException e) { + logger + .trace(Level.FINE, "Exception while instantiating CIMClientXML_HelperImpl", + e); + logger.message(Messages.CIM_XMLHELPER_FAILED); + throw new RuntimeException(e); + } + + this.iInitialized = true; + + } finally { + logger.exit(); + } + } + + public void initialize(CIMObjectPath pName, Subject pSubject, Locale[] pLocales) + throws IllegalArgumentException, WBEMException { + + final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); + logger.entry(); + + try { + final URI uri; + + if (pName == null || pName.getHost() == null || pName.getHost().length() == 0) { throw new IllegalArgumentException( + "Empty host path"); } + if (pName.getScheme() == null || pName.getScheme().length() == 0) { throw new IllegalArgumentException( + "Empty scheme"); } + if (!pName.getScheme().equalsIgnoreCase(WBEMConstants.HTTP) + && !pName.getScheme().equalsIgnoreCase(WBEMConstants.HTTPS)) { throw new IllegalArgumentException( + "Protocol not supported"); } + + try { + uri = CIMHelper.createCimomUri(pName); + } catch (URISyntaxException e) { + throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "Malformed URI"); + } + + initializeClient(uri, pSubject, pLocales); + } finally { + logger.exit(); + } + } + + public void initialize(URI pUri, Subject pSubject, Locale[] pLocales) + throws IllegalArgumentException, WBEMException { + + final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); + logger.entry(); + + try { + final URI uri; + + if (pUri == null || pUri.getHost() == null || pUri.getHost().length() == 0) { throw new IllegalArgumentException( + "Empty host path"); } + if (pUri.getScheme() == null || pUri.getScheme().length() == 0) { throw new IllegalArgumentException( + "Empty scheme"); } + if (!pUri.getScheme().equalsIgnoreCase(WBEMConstants.HTTP) + && !pUri.getScheme().equalsIgnoreCase(WBEMConstants.HTTPS)) { throw new IllegalArgumentException( + "Protocol not supported"); } + + try { + uri = CIMHelper.createCimomUri(pUri); + } catch (URISyntaxException e) { + throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "Malformed URI"); + } + + initializeClient(uri, pSubject, pLocales); + } finally { + logger.exit(); + } + } + + public Properties getProperties() { + return this.iConfiguration.getDomainProperties(); + } + + private int getLastSeparator(String path) { + if (path == null) return -1; + + int last = -1; + int sepUnix = path.lastIndexOf('/'); + int sepWin = path.lastIndexOf('\\'); + + if (sepUnix != -1 && sepWin != -1) { + last = sepUnix > sepWin ? sepUnix : sepWin; + } else if (sepUnix != -1) { + last = sepUnix; + } else if (sepWin != -1) { + last = sepWin; + } + return last; + } + + public String getProperty(String pKey) { + if (pKey.startsWith("javax.wbem.")) { + // Process JSR48 properties + if (pKey.equals(WBEMClientConstants.PROP_ENABLE_CONSOLE_LOGGING)) { + return this.iConfiguration.getLogConsoleLevel().getName(); + } else if (pKey.equals(WBEMClientConstants.PROP_ENABLE_FILE_LOGGING)) { + return this.iConfiguration.getLogFileLevel().getName(); + } else if (pKey.equals(WBEMClientConstants.PROP_LOG_BYTE_LIMIT)) { + return Integer.toString(this.iConfiguration.getLogFileSizeLimit()); + } else if (pKey.equals(WBEMClientConstants.PROP_LOG_DIR)) { + String SblimKey = this.iConfiguration.getLogFileLocation(); + if (SblimKey == null) return null; + int lastSep = getLastSeparator(SblimKey); + return lastSep == -1 ? null : SblimKey.substring(0, lastSep); + } else if (pKey.equals(WBEMClientConstants.PROP_LOG_FILENAME)) { + String SblimKey = this.iConfiguration.getLogFileLocation(); + if (SblimKey == null) return null; + int lastSep = getLastSeparator(SblimKey); + return lastSep == -1 ? SblimKey : SblimKey.substring(lastSep + 1); + } else if (pKey.equals(WBEMClientConstants.PROP_LOG_NUM_FILES)) { + return Integer.toString(this.iConfiguration.getLogFileCount()); + } else if (pKey.equals(WBEMClientConstants.PROP_TIMEOUT)) { + return Integer.toString(this.iConfiguration.getHttpTimeout()); + } else if (pKey.equals(WBEMClientConstants.PROPERTY_WBEM_CHUNKING)) { + return this.iConfiguration.isHttpChunked() ? "1" : "0"; + } else if (pKey.equals(WBEMClientConstants.PROP_CLIENT_KEYSTORE)) { + return this.iConfiguration.getSslKeyStorePath(); + } else if (pKey.equals(WBEMClientConstants.PROP_CLIENT_KEYSTORE_PASSWORD)) { + return this.iConfiguration.getSslKeyStorePassword(); + } else if (pKey.equals(WBEMClientConstants.PROP_CLIENT_TRUSTSTORE)) { + return this.iConfiguration.getSslTrustStorePath(); + } else { + return null; + } + } + return this.iConfiguration.getDomainProperty(pKey); + + } + + public void setProperties(Properties pProperties) { + this.iConfiguration.setDomainProperties(pProperties); + } + + public void setProperty(String pKey, String pValue) { + if (pKey.startsWith("javax.wbem.")) { + // Process JSR48 properties + if (pKey.equals(WBEMClientConstants.PROP_ENABLE_CONSOLE_LOGGING)) { + this.iConfiguration.setDomainProperty( + WBEMConfigurationProperties.LOG_CONSOLE_LEVEL, pValue); + } else if (pKey.equals(WBEMClientConstants.PROP_ENABLE_FILE_LOGGING)) { + this.iConfiguration.setDomainProperty(WBEMConfigurationProperties.LOG_FILE_LEVEL, + pValue); + } else if (pKey.equals(WBEMClientConstants.PROP_LOG_BYTE_LIMIT)) { + this.iConfiguration.setDomainProperty( + WBEMConfigurationProperties.LOG_FILE_SIZE_LIMIT, pValue); + } else if (pKey.equals(WBEMClientConstants.PROP_LOG_DIR)) { + StringBuffer NewSblimLog = new StringBuffer(pValue != null ? pValue : ""); + if (NewSblimLog.length() > 0 + && NewSblimLog.charAt(NewSblimLog.length() - 1) != File.separatorChar) { + NewSblimLog.append(File.separator); + } + + String CurSblimLog = this.iConfiguration + .getDomainProperty(WBEMConfigurationProperties.LOG_FILE_LOCATION); + if (CurSblimLog == null) { + CurSblimLog = WBEMConfigurationDefaults.LOG_FILE_LOCATION; + } + + int i = getLastSeparator(CurSblimLog); + if (i == -1) { + NewSblimLog.append(CurSblimLog); + } else { + NewSblimLog.append(CurSblimLog.substring(i + 1)); + } + + this.iConfiguration.setDomainProperty( + WBEMConfigurationProperties.LOG_FILE_LOCATION, NewSblimLog.toString()); + } else if (pKey.equals(WBEMClientConstants.PROP_LOG_FILENAME)) { + StringBuffer NewSblimLog = new StringBuffer(pValue != null ? pValue : ""); + + String CurSblimLog = this.iConfiguration + .getDomainProperty(WBEMConfigurationProperties.LOG_FILE_LOCATION); + if (CurSblimLog != null) { + int i = getLastSeparator(CurSblimLog); + if (i != -1) { + NewSblimLog.insert(0, CurSblimLog.substring(0, i + 1)); + } + } + + this.iConfiguration.setDomainProperty( + WBEMConfigurationProperties.LOG_FILE_LOCATION, NewSblimLog.toString()); + } else if (pKey.equals(WBEMClientConstants.PROP_LOG_NUM_FILES)) { + this.iConfiguration.setDomainProperty(WBEMConfigurationProperties.LOG_FILE_COUNT, + pValue); + } else if (pKey.equals(WBEMClientConstants.PROP_TIMEOUT)) { + this.iConfiguration.setDomainProperty(WBEMConfigurationProperties.HTTP_TIMEOUT, + pValue); + } else if (pKey.equals(WBEMClientConstants.PROPERTY_WBEM_CHUNKING)) { + this.iConfiguration.setDomainProperty( + WBEMConfigurationProperties.HTTP_USE_CHUNKING, pValue.equals("0") ? "false" + : "true"); + } else if (pKey.equals(WBEMClientConstants.PROP_CLIENT_KEYSTORE)) { + this.iConfiguration.setDomainProperty(WBEMConfigurationProperties.KEYSTORE_PATH, + pValue); + } else if (pKey.equals(WBEMClientConstants.PROP_CLIENT_KEYSTORE_PASSWORD)) { + this.iConfiguration.setDomainProperty( + WBEMConfigurationProperties.KEYSTORE_PASSWORD, pValue); + } else if (pKey.equals(WBEMClientConstants.PROP_CLIENT_TRUSTSTORE)) { + this.iConfiguration.setDomainProperty(WBEMConfigurationProperties.TRUSTSTORE_PATH, + pValue); + } else { + throw new IllegalArgumentException(pKey); + } + } else { + this.iConfiguration.setDomainProperty(pKey, pValue); + } + } + + public CloseableIterator associatorNames(CIMObjectPath pObjectName, + String pAssociationClass, String pResultClass, String pRole, String pResultRole) + throws WBEMException { + + final String operation = "AssociatorNames"; + final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); + logger.entry(); + + checkState(); + + try { + + if (pObjectName == null || pObjectName.getNamespace() == null + || pObjectName.getObjectName() == null) { throw new WBEMException( + WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + + HttpHeader hh = new HttpHeader(); + hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", + "US-ASCII")); + + Document doc = this.iXmlHelper.newDocument(); + + this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.associatorNames_request(doc, + pObjectName, pAssociationClass, pResultClass, pRole, pResultRole)); + + InputStreamReader is = transmitRequest("AssociatorNames", hh, doc); + + CloseableIterator iter = getIterator(is, pObjectName); + return iter; + + } catch (WBEMException e) { + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); + throw e; + } catch (Exception e) { + if (e.getCause() != null && e.getCause() instanceof WBEMException) { + logger + .trace(Level.FINE, operation + " request resulted in CIM Error", e + .getCause()); + throw (WBEMException) e.getCause(); + } + logger.trace(Level.FINE, operation + " request failed", e); + throw new WBEMException(WBEMException.CIM_ERR_FAILED, null, null, e); + } finally { + logger.exit(); + } + } + + public CloseableIterator associatorClasses(CIMObjectPath pObjectName, + String pAssociationClass, String pResultClass, String pRole, String pResultRole, + boolean pIncludeQualifiers, boolean pIncludeClassOrigin, String[] pPropertyList) + throws WBEMException { + final String operation = "AssociatorClasses"; + final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); + logger.entry(); + + checkState(); + + try { + + if (pObjectName == null || pObjectName.getNamespace() == null + || pObjectName.getObjectName() == null) { throw new WBEMException( + WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + + HttpHeader hh = new HttpHeader(); + hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", + "US-ASCII")); + + Document doc = this.iXmlHelper.newDocument(); + this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.associatorClasses_request(doc, + pObjectName, pAssociationClass, pResultClass, pRole, pResultRole, + pIncludeQualifiers, pIncludeClassOrigin, pPropertyList)); + + InputStreamReader is = transmitRequest("Associators", hh, doc); + + CloseableIterator iter = getIterator(is, pObjectName); + + return iter; + + } catch (WBEMException e) { + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); + throw e; + } catch (Exception e) { + if (e.getCause() != null && e.getCause() instanceof WBEMException) { + logger + .trace(Level.FINE, operation + " request resulted in CIM Error", e + .getCause()); + throw (WBEMException) e.getCause(); + } + logger.trace(Level.FINE, operation + " request failed", e); + throw new WBEMException(WBEMException.CIM_ERR_FAILED, null, null, e); + } finally { + logger.exit(); + } + } + + public CloseableIterator associatorInstances(CIMObjectPath pObjectName, + String pAssociationClass, String pResultClass, String pRole, String pResultRole, + boolean pIncludeClassOrigin, String[] pPropertyList) throws WBEMException { + final String operation = "AssociatorInstances"; + final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); + logger.entry(); + + checkState(); + + try { + + if (pObjectName == null || pObjectName.getNamespace() == null + || pObjectName.getObjectName() == null) { throw new WBEMException( + WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + + HttpHeader hh = new HttpHeader(); + hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", + "US-ASCII")); + + Document doc = this.iXmlHelper.newDocument(); + this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.associatorInstances_request(doc, + pObjectName, pAssociationClass, pResultClass, pRole, pResultRole, + pIncludeClassOrigin, pPropertyList)); + + InputStreamReader is = transmitRequest("Associators", hh, doc); + + CloseableIterator iter = getIterator(is, pObjectName); + return iter; + + } catch (WBEMException e) { + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); + throw e; + } catch (Exception e) { + if (e.getCause() != null && e.getCause() instanceof WBEMException) { + logger + .trace(Level.FINE, operation + " request resulted in CIM Error", e + .getCause()); + throw (WBEMException) e.getCause(); + } + logger.trace(Level.FINE, operation + " request failed", e); + throw new WBEMException(WBEMException.CIM_ERR_FAILED, null, null, e); + } finally { + logger.exit(); + } + } + + public synchronized void close() { + final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); + logger.entry(); + try { + checkState(); + if (this.iHttpClientPool != null) { + this.iHttpClientPool.closePool(); + } + } finally { + this.iClosed = true; + logger.exit(); + } + } + + public void createClass(CIMClass pClass) throws WBEMException { + + final String operation = "CreateClass"; + final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); + logger.entry(); + + checkState(); + + try { + + if (pClass == null || pClass.getObjectPath() == null + || pClass.getObjectPath().getNamespace() == null) { throw new WBEMException( + WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + + HttpHeader hh = new HttpHeader(); + hh.addField("CIMObject", HttpHeader.encode(pClass.getObjectPath().getNamespace(), + "UTF-8", "US-ASCII")); + + Document doc = this.iXmlHelper.newDocument(); + this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.createClass_request(doc, pClass + .getObjectPath(), pClass)); + + InputStreamReader is = transmitRequest("CreateClass", hh, doc); + + CloseableIterator iter = getIterator(is, pClass.getObjectPath()); + try { + iter.hasNext(); + } finally { + iter.close(); + } + + } catch (WBEMException e) { + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); + throw e; + } catch (Exception e) { + if (e.getCause() != null && e.getCause() instanceof WBEMException) { + logger + .trace(Level.FINE, operation + " request resulted in CIM Error", e + .getCause()); + throw (WBEMException) e.getCause(); + } + logger.trace(Level.FINE, operation + " request failed", e); + throw new WBEMException(WBEMException.CIM_ERR_FAILED, null, null, e); + } finally { + logger.exit(); + } + } + + public CIMObjectPath createInstance(CIMInstance pInstance) throws WBEMException { + + final String operation = "CreateInstance"; + final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); + logger.entry(); + + checkState(); + + try { + if (pInstance == null || pInstance.getObjectPath() == null + || pInstance.getObjectPath().getNamespace() == null) { throw new WBEMException( + WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + + HttpHeader hh = new HttpHeader(); + hh.addField("CIMObject", HttpHeader.encode(pInstance.getObjectPath().getNamespace(), + "UTF-8", "US-ASCII")); + + Document doc = this.iXmlHelper.newDocument(); + this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.createInstance_request(doc, + pInstance.getObjectPath(), pInstance)); + + InputStreamReader is = transmitRequest("CreateInstance", hh, doc); + + CloseableIterator iter = getIterator(is, pInstance.getObjectPath()); + try { + if (iter.hasNext()) { return (CIMObjectPath) iter.next(); } + } finally { + iter.close(); + } + + return null; + + } catch (WBEMException e) { + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); + throw e; + } catch (Exception e) { + if (e.getCause() != null && e.getCause() instanceof WBEMException) { + logger + .trace(Level.FINE, operation + " request resulted in CIM Error", e + .getCause()); + throw (WBEMException) e.getCause(); + } + logger.trace(Level.FINE, operation + " request failed", e); + throw new WBEMException(WBEMException.CIM_ERR_FAILED, null, null, e); + } finally { + logger.exit(); + } + } + + public void deleteClass(CIMObjectPath pPath) throws WBEMException { + + final String operation = "DeleteClass"; + final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); + logger.entry(); + + checkState(); + + try { + if (pPath == null || pPath.getNamespace() == null || pPath.getObjectName() == null) { throw new WBEMException( + WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + + HttpHeader hh = new HttpHeader(); + hh.addField("CIMObject", HttpHeader.encode(pPath.getNamespace(), "UTF-8", "US-ASCII")); + + Document doc = this.iXmlHelper.newDocument(); + this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.deleteClass_request(doc, pPath)); + + InputStreamReader is = transmitRequest("DeleteClass", hh, doc); + + CloseableIterator iter = getIterator(is, pPath); + try { + iter.hasNext(); + } finally { + iter.close(); + } + + return; + + } catch (WBEMException e) { + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); + throw e; + } catch (Exception e) { + if (e.getCause() != null && e.getCause() instanceof WBEMException) { + logger + .trace(Level.FINE, operation + " request resulted in CIM Error", e + .getCause()); + throw (WBEMException) e.getCause(); + } + logger.trace(Level.FINE, operation + " request failed", e); + throw new WBEMException(WBEMException.CIM_ERR_FAILED, null, null, e); + } finally { + logger.exit(); + } + } + + public void deleteInstance(CIMObjectPath pPath) throws WBEMException { + + final String operation = "DeleteInstance"; + final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); + logger.entry(); + + checkState(); + + try { + if (pPath == null || pPath.getNamespace() == null || pPath.getObjectName() == null) { throw new WBEMException( + WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + + HttpHeader hh = new HttpHeader(); + hh.addField("CIMObject", HttpHeader.encode(pPath.getNamespace(), "UTF-8", "US-ASCII")); + + Document doc = this.iXmlHelper.newDocument(); + + this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper + .deleteInstance_request(doc, pPath)); + + InputStreamReader is = transmitRequest("DeleteInstance", hh, doc); + + CloseableIterator iter = getIterator(is, pPath); + try { + iter.hasNext(); + } finally { + iter.close(); + } + + return; + + } catch (WBEMException e) { + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); + throw e; + } catch (Exception e) { + if (e.getCause() != null && e.getCause() instanceof WBEMException) { + logger + .trace(Level.FINE, operation + " request resulted in CIM Error", e + .getCause()); + throw (WBEMException) e.getCause(); + } + logger.trace(Level.FINE, operation + " request failed", e); + throw new WBEMException(WBEMException.CIM_ERR_FAILED, null, null, e); + } finally { + logger.exit(); + } + } + + public void deleteQualifierType(CIMObjectPath pPath) throws WBEMException { + + final String operation = "DeleteQualifierType"; + final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); + logger.entry(); + + checkState(); + + try { + if (pPath == null || pPath.getNamespace() == null || pPath.getObjectName() == null) { throw new WBEMException( + WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + + HttpHeader hh = new HttpHeader(); + hh.addField("CIMObject", HttpHeader.encode(pPath.getNamespace(), "UTF-8", "US-ASCII")); + + Document doc = this.iXmlHelper.newDocument(); + this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.deleteQualifierType_request(doc, + pPath)); + + InputStreamReader is = transmitRequest("DeleteQualifierType", hh, doc); + + CloseableIterator iter = getIterator(is, pPath); + try { + iter.hasNext(); + } finally { + iter.close(); + } + + return; + + } catch (WBEMException e) { + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); + throw e; + } catch (Exception e) { + if (e.getCause() != null && e.getCause() instanceof WBEMException) { + logger + .trace(Level.FINE, operation + " request resulted in CIM Error", e + .getCause()); + throw (WBEMException) e.getCause(); + } + logger.trace(Level.FINE, operation + " request failed", e); + throw new WBEMException(WBEMException.CIM_ERR_FAILED, null, null, e); + } finally { + logger.exit(); + } + } + + public CloseableIterator enumerateClassNames(CIMObjectPath pPath, boolean pDeep) + throws WBEMException { + + final String operation = "EnumerateClassNames"; + final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); + logger.entry(); + + checkState(); + + try { + if (pPath == null || pPath.getNamespace() == null) { throw new WBEMException( + WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + + HttpHeader hh = new HttpHeader(); + hh.addField("CIMObject", HttpHeader.encode(pPath.getNamespace(), "UTF-8", "US-ASCII")); + + Document doc = this.iXmlHelper.newDocument(); + this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.enumerateClassNames_request(doc, + pPath, pDeep)); + + InputStreamReader is = transmitRequest("EnumerateClassNames", hh, doc); + + CloseableIterator iter = getIterator(is, pPath); + return iter; + + } catch (WBEMException e) { + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); + throw e; + } catch (Exception e) { + if (e.getCause() != null && e.getCause() instanceof WBEMException) { + logger + .trace(Level.FINE, operation + " request resulted in CIM Error", e + .getCause()); + throw (WBEMException) e.getCause(); + } + logger.trace(Level.FINE, operation + " request failed", e); + throw new WBEMException(WBEMException.CIM_ERR_FAILED, null, null, e); + } finally { + logger.exit(); + } + } + + public CloseableIterator enumerateClasses(CIMObjectPath pPath, boolean pDeep, + boolean pPropagated, boolean pIncludeQualifiers, boolean pIncludeClassOrigin) + throws WBEMException { + + final String operation = "EnumerateClasses"; + final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); + logger.entry(); + + checkState(); + + try { + if (pPath == null || pPath.getNamespace() == null) { throw new WBEMException( + WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + + HttpHeader hh = new HttpHeader(); + hh.addField("CIMObject", HttpHeader.encode(pPath.getNamespace(), "UTF-8", "US-ASCII")); + + Document doc = this.iXmlHelper.newDocument(); + this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.enumerateClasses_request(doc, + pPath, pDeep, pPropagated, pIncludeQualifiers, pIncludeClassOrigin)); + + InputStreamReader is = transmitRequest("EnumerateClasses", hh, doc); + + CloseableIterator iter = getIterator(is, pPath); + return iter; + + } catch (WBEMException e) { + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); + throw e; + } catch (Exception e) { + if (e.getCause() != null && e.getCause() instanceof WBEMException) { + logger + .trace(Level.FINE, operation + " request resulted in CIM Error", e + .getCause()); + throw (WBEMException) e.getCause(); + } + logger.trace(Level.FINE, operation + " request failed", e); + throw new WBEMException(WBEMException.CIM_ERR_FAILED, null, null, e); + } finally { + logger.exit(); + } + } + + public CloseableIterator enumerateInstanceNames(CIMObjectPath pPath) + throws WBEMException { + + final String operation = "EnumerateInstanceNames"; + final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); + logger.entry(); + + checkState(); + + try { + if (pPath == null || pPath.getNamespace() == null || pPath.getObjectName() == null) { throw new WBEMException( + WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + + HttpHeader hh = new HttpHeader(); + hh.addField("CIMObject", HttpHeader.encode(pPath.getNamespace(), "UTF-8", "US-ASCII")); + + Document doc = this.iXmlHelper.newDocument(); + this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.enumerateInstanceNames_request( + doc, pPath)); + + InputStreamReader is = transmitRequest("EnumerateInstanceNames", hh, doc); + + CloseableIterator iter = getIterator(is, pPath); + return iter; + + } catch (WBEMException e) { + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); + throw e; + } catch (Exception e) { + if (e.getCause() != null && e.getCause() instanceof WBEMException) { + logger + .trace(Level.FINE, operation + " request resulted in CIM Error", e + .getCause()); + throw (WBEMException) e.getCause(); + } + logger.trace(Level.FINE, operation + " request failed", e); + throw new WBEMException(WBEMException.CIM_ERR_FAILED, null, null, e); + } finally { + logger.exit(); + } + } + + public CloseableIterator enumerateInstances(CIMObjectPath pPath, boolean pDeep, + boolean pPropagated, boolean pIncludeClassOrigin, String[] pPropertyList) + throws WBEMException { + + final String operation = "EnumerateInstances"; + final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); + logger.entry(); + + checkState(); + + try { + if (pPath == null || pPath.getNamespace() == null || pPath.getObjectName() == null) { throw new WBEMException( + WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + + HttpHeader hh = new HttpHeader(); + hh.addField("CIMObject", HttpHeader.encode(pPath.getNamespace(), "UTF-8", "US-ASCII")); + + Document doc = this.iXmlHelper.newDocument(); + this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.enumerateInstances_request(doc, + pPath, pDeep, pPropagated, false, pIncludeClassOrigin, pPropertyList)); + + InputStreamReader is = transmitRequest("EnumerateInstances", hh, doc); + + CloseableIterator iter = getIterator(is, pPath); + return iter; + + } catch (WBEMException e) { + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); + throw e; + } catch (Exception e) { + if (e.getCause() != null && e.getCause() instanceof WBEMException) { + logger + .trace(Level.FINE, operation + " request resulted in CIM Error", e + .getCause()); + throw (WBEMException) e.getCause(); + } + logger.trace(Level.FINE, operation + " request failed", e); + throw new WBEMException(WBEMException.CIM_ERR_FAILED, null, null, e); + } finally { + logger.exit(); + } + } + + // DSP1033 states that CIMOMs shall include an Interop Namespace and that + // the name of this Interop Namespace shall be either "interop" (preferred) + // or "root/interop" while OpenPegasus 2.11 and earlier implemented + // "root/PG_InterOp" prior to adopting DSP1033. + private static final String[] InteropNamespaces = { "interop", "root/interop", + "root/PG_InterOp" }; + + private CloseableIterator enumerateNamespace(String pNamespace) { + if (pNamespace != null && pNamespace.trim().length() > 0) { + try { + CloseableIterator result = enumerateInstanceNames(new CIMObjectPath( + null, null, null, pNamespace, "CIM_Namespace", null)); + if (result != null) return result; + } catch (Exception e) { + // namespace may not exist + } + } + return null; + } + + public CloseableIterator enumerateNamespaces(String pNamespace) + throws WBEMException { + CloseableIterator result; + + // First, try the user's specified namespace (if any) + if (pNamespace != null && pNamespace.trim().length() > 0) { + result = enumerateNamespace(pNamespace); + if (result != null) return result; + } + + // Second, try the saved interop namespace (if any) + if (this.iInteropNamespace != null) { + result = enumerateNamespace(this.iInteropNamespace); + if (result != null) return result; + this.iInteropNamespace = null; + } + + // Finally, try the default interop namespace names + for (int i = 0; i < InteropNamespaces.length; i++) { + result = enumerateNamespace(InteropNamespaces[i]); + if (result != null) { + if (this.iInteropNamespace == null) this.iInteropNamespace = InteropNamespaces[i]; + return result; + } + } + + throw new WBEMException(WBEMException.CIM_ERR_FAILED, + "Interop namespaces do not exist, CIMOM may not support DSP1033"); + } + + public CloseableIterator> enumerateQualifierTypes(CIMObjectPath pPath) + throws WBEMException { + + final String operation = "EnumerateQualifiers"; + final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); + logger.entry(); + + checkState(); + + try { + // enumerateQualifierTypes does not need class name, as it lists all + // qualifiers in namespace + if (pPath == null || pPath.getNamespace() == null) { throw new WBEMException( + WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + + HttpHeader hh = new HttpHeader(); + hh.addField("CIMObject", HttpHeader.encode(pPath.getNamespace(), "UTF-8", "US-ASCII")); + + Document doc = this.iXmlHelper.newDocument(); + this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.enumQualifierTypes_request(doc, + pPath)); + + InputStreamReader is = transmitRequest("EnumerateQualifiers", hh, doc); + + CloseableIterator> iter = getIterator(is, pPath); + return iter; + + } catch (WBEMException e) { + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); + throw e; + } catch (Exception e) { + if (e.getCause() != null && e.getCause() instanceof WBEMException) { + logger + .trace(Level.FINE, operation + " request resulted in CIM Error", e + .getCause()); + throw (WBEMException) e.getCause(); + } + logger.trace(Level.FINE, operation + " request failed", e); + throw new WBEMException(WBEMException.CIM_ERR_FAILED, null, null, e); + } finally { + logger.exit(); + } + } + + public CloseableIterator execQuery(CIMObjectPath pPath, String pQuery, + String pQueryLanguage) throws WBEMException { + + final String operation = "ExecQuery"; + final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); + logger.entry(); + + checkState(); + + try { + if (pPath == null || pPath.getNamespace() == null) { throw new WBEMException( + WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + + HttpHeader hh = new HttpHeader(); + hh.addField("CIMObject", HttpHeader.encode(pPath.getNamespace(), "UTF-8", "US-ASCII")); + + Document doc = this.iXmlHelper.newDocument(); + this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.execQuery_request(doc, pPath, + pQuery, pQueryLanguage)); + + InputStreamReader is = transmitRequest("ExecQuery", hh, doc); + + CloseableIterator iter = getIterator(is, pPath); + return iter; + + } catch (WBEMException e) { + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); + throw e; + } catch (Exception e) { + if (e.getCause() != null && e.getCause() instanceof WBEMException) { + logger + .trace(Level.FINE, operation + " request resulted in CIM Error", e + .getCause()); + throw (WBEMException) e.getCause(); + } + logger.trace(Level.FINE, operation + " request failed", e); + throw new WBEMException(WBEMException.CIM_ERR_FAILED, null, null, e); + } finally { + logger.exit(); + } + } + + public CIMClass getClass(CIMObjectPath pName, boolean pPropagated, boolean pIncludeQualifiers, + boolean pIncludeClassOrigin, String[] pPropertyList) throws WBEMException { + + final String operation = "GetClass"; + final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); + logger.entry(); + + checkState(); + + try { + if (pName == null || pName.getNamespace() == null || pName.getObjectName() == null) { throw new WBEMException( + WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + + HttpHeader hh = new HttpHeader(); + hh.addField("CIMObject", HttpHeader.encode(pName.getNamespace(), "UTF-8", "US-ASCII")); + + Document doc = this.iXmlHelper.newDocument(); + this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.getClass_request(doc, pName, + pPropagated, pIncludeQualifiers, pIncludeClassOrigin, pPropertyList)); + + InputStreamReader is = transmitRequest("GetClass", hh, doc); + + CloseableIterator iter = getIterator(is, pName); + try { + if (iter.hasNext()) { return (CIMClass) iter.next(); } + } finally { + iter.close(); + } + + return null; + + } catch (WBEMException e) { + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); + throw e; + } catch (Exception e) { + if (e.getCause() != null && e.getCause() instanceof WBEMException) { + logger + .trace(Level.FINE, operation + " request resulted in CIM Error", e + .getCause()); + throw (WBEMException) e.getCause(); + } + logger.trace(Level.FINE, operation + " request failed", e); + throw new WBEMException(WBEMException.CIM_ERR_FAILED, null, null, e); + } finally { + logger.exit(); + } + } + + public CIMInstance getInstance(CIMObjectPath pName, boolean pPropagated, + boolean pIncludeClassOrigin, String[] pPropertyList) throws WBEMException { + + final String operation = "GetInstance"; + final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); + logger.entry(); + + checkState(); + + try { + if (pName == null || pName.getNamespace() == null || pName.getObjectName() == null) { throw new WBEMException( + WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + + HttpHeader hh = new HttpHeader(); + hh.addField("CIMObject", HttpHeader.encode(pName.getNamespace(), "UTF-8", "US-ASCII")); + + Document doc = this.iXmlHelper.newDocument(); + this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.getInstance_request(doc, pName, + pPropagated, false, pIncludeClassOrigin, pPropertyList)); + + InputStreamReader is = transmitRequest("GetInstance", hh, doc); + + CloseableIterator iter = getIterator(is, pName); + try { + if (iter.hasNext()) { + CIMInstance result = (CIMInstance) iter.next(); + return new CIMInstance(pName, result.getProperties()); + } + } finally { + iter.close(); + } + + return null; + + } catch (WBEMException e) { + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); + throw e; + } catch (Exception e) { + if (e.getCause() != null && e.getCause() instanceof WBEMException) { + logger + .trace(Level.FINE, operation + " request resulted in CIM Error", e + .getCause()); + throw (WBEMException) e.getCause(); + } + logger.trace(Level.FINE, operation + " request failed", e); + throw new WBEMException(WBEMException.CIM_ERR_FAILED, null, null, e); + } finally { + logger.exit(); + } + } + + public CIMQualifierType getQualifierType(CIMObjectPath pName) throws WBEMException { + + final String operation = "GetQualifier"; + final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); + logger.entry(); + + checkState(); + + try { + if (pName == null || pName.getNamespace() == null || pName.getObjectName() == null) { throw new WBEMException( + WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + + HttpHeader hh = new HttpHeader(); + hh.addField("CIMObject", HttpHeader.encode(pName.getNamespace(), "UTF-8", "US-ASCII")); + + Document doc = this.iXmlHelper.newDocument(); + this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.getQualifier_request(doc, pName, + pName.getObjectName())); + + InputStreamReader is = transmitRequest("GetQualifier", hh, doc); + + CloseableIterator iter = getIterator(is, pName); + try { + if (iter.hasNext()) { return (CIMQualifierType) iter.next(); } + } finally { + iter.close(); + } + + return null; + + } catch (WBEMException e) { + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); + throw e; + } catch (Exception e) { + if (e.getCause() != null && e.getCause() instanceof WBEMException) { + logger + .trace(Level.FINE, operation + " request resulted in CIM Error", e + .getCause()); + throw (WBEMException) e.getCause(); + } + logger.trace(Level.FINE, operation + " request failed", e); + throw new WBEMException(WBEMException.CIM_ERR_FAILED, null, null, e); + } finally { + logger.exit(); + } + } + + public Object invokeMethod(CIMObjectPath pName, String pMethodName, + CIMArgument[] pInputArguments, CIMArgument[] pOutputArguments) + throws WBEMException { + + final String operation = "InvokeMethod"; + final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); + logger.entry(); + + checkState(); + + try { + if (pName == null || pName.getNamespace() == null || pName.getObjectName() == null) { throw new WBEMException( + WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + + HttpHeader hh = new HttpHeader(); + hh.addField("CIMObject", HttpHeader.encode(MOF.objectHandle(pName, false, true), + "UTF-8", "US-ASCII")); + + // sfcb needs pragma set for UpdateExpiredPassword call + if (pMethodName != null && pMethodName.equalsIgnoreCase("UpdateExpiredPassword")) hh + .addField("Pragma", "UpdateExpiredPassword"); + + Document doc = this.iXmlHelper.newDocument(); + this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.invokeMethod_request(doc, pName, + pMethodName, pInputArguments)); + + InputStreamReader is = transmitRequest(pMethodName, hh, doc); + + CIMResponse response = null; + String parser = this.iConfiguration.getCimXmlParser(); + // TODO: set the local namespace for parsers + if (WBEMConstants.SAX.equals(parser) || WBEMConstants.PULL.equals(parser)) { return SAXHelper + .parseInvokeMethodResponse(is, pOutputArguments, null); } + // DOM parser + response = getSingleResponse(is, null); + response.checkError(); + List resultSet = response.getFirstReturnValue(); + + Object rc = resultSet.size() > 0 ? resultSet.get(0) : null; + + List outParamValues = response.getParamValues(); + if (pOutputArguments != null && outParamValues != null) { + Iterator itr = outParamValues.iterator(); + for (int i = 0; i < pOutputArguments.length; i++) + if (itr.hasNext()) { + pOutputArguments[i] = (CIMArgument) itr.next(); + } else { + break; + } + } + return rc; + } catch (WBEMException e) { + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); + throw e; + } catch (Exception e) { + if (e.getCause() != null && e.getCause() instanceof WBEMException) { + logger + .trace(Level.FINE, operation + " request resulted in CIM Error", e + .getCause()); + throw (WBEMException) e.getCause(); + } + logger.trace(Level.FINE, operation + " request failed", e); + throw new WBEMException(WBEMException.CIM_ERR_FAILED, null, null, e); + } finally { + logger.exit(); + } + } + + public boolean isActive() { + return this.iInitialized && !this.iClosed; + } + + public void modifyClass(CIMClass pClass) throws WBEMException { + + final String operation = "ModifyClass"; + final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); + logger.entry(); + + checkState(); + + try { + if (pClass == null || pClass.getObjectPath() == null + || pClass.getObjectPath().getNamespace() == null + || pClass.getObjectPath().getObjectName() == null) { throw new WBEMException( + WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + + HttpHeader hh = new HttpHeader(); + hh.addField("CIMObject", HttpHeader.encode(pClass.getObjectPath().getNamespace(), + "UTF-8", "US-ASCII")); + + Document doc = this.iXmlHelper.newDocument(); + this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.setClass_request(doc, pClass + .getObjectPath(), pClass)); + + InputStreamReader is = transmitRequest("ModifyClass", hh, doc); + + CloseableIterator iter = getIterator(is, pClass.getObjectPath()); + try { + iter.hasNext(); + } finally { + iter.close(); + } + + return; + + } catch (WBEMException e) { + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); + throw e; + } catch (Exception e) { + if (e.getCause() != null && e.getCause() instanceof WBEMException) { + logger + .trace(Level.FINE, operation + " request resulted in CIM Error", e + .getCause()); + throw (WBEMException) e.getCause(); + } + logger.trace(Level.FINE, operation + " request failed", e); + throw new WBEMException(WBEMException.CIM_ERR_FAILED, null, null, e); + } finally { + logger.exit(); + } + } + + public void modifyInstance(CIMInstance pInst, String[] pPropertyList) throws WBEMException { + final String operation = "ModifyInstance"; + final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); + logger.entry(); + checkState(); + if (pInst == null || pInst.getObjectPath() == null + || pInst.getObjectPath().getNamespace() == null + || pInst.getObjectPath().getObjectName() == null) { throw new WBEMException( + WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + final CIMObjectPath path = pInst.getObjectPath(); + try { + HttpHeader hh = new HttpHeader(); + hh.addField("CIMObject", HttpHeader.encode(path.getNamespace(), "UTF-8", "US-ASCII")); + + Document doc = this.iXmlHelper.newDocument(); + this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.setInstance_request(doc, path, + pInst, true, pPropertyList)); + InputStreamReader is = transmitRequest(operation, hh, doc); + + CloseableIterator iter = getIterator(is, path); + try { + iter.hasNext(); + } finally { + iter.close(); + } + return; + } catch (WBEMException e) { + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); + throw e; + } catch (Exception e) { + if (e.getCause() != null && e.getCause() instanceof WBEMException) { + logger + .trace(Level.FINE, operation + " request resulted in CIM Error", e + .getCause()); + throw (WBEMException) e.getCause(); + } + logger.trace(Level.FINE, operation + " request failed", e); + throw new WBEMException(WBEMException.CIM_ERR_FAILED, null, null, e); + } finally { + logger.exit(); + } + } + + public CloseableIterator referenceClasses(CIMObjectPath pObjectName, + String pResultClass, String pRole, boolean pIncludeQualifiers, + boolean pIncludeClassOrigin, String[] pPropertyList) throws WBEMException { + + final String operation = "ReferenceClasses"; + final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); + logger.entry(); + + checkState(); + + try { + if (pObjectName == null || pObjectName.getNamespace() == null + || pObjectName.getObjectName() == null) { throw new WBEMException( + WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + + HttpHeader hh = new HttpHeader(); + hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", + "US-ASCII")); + + Document doc = this.iXmlHelper.newDocument(); + this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.referenceClasses_request(doc, + pObjectName, pResultClass, pRole, pIncludeQualifiers, pIncludeClassOrigin, + pPropertyList)); + + InputStreamReader is = transmitRequest("References", hh, doc); + + return getIterator(is, pObjectName); + + } catch (WBEMException e) { + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); + throw e; + } catch (Exception e) { + if (e.getCause() != null && e.getCause() instanceof WBEMException) { + logger + .trace(Level.FINE, operation + " request resulted in CIM Error", e + .getCause()); + throw (WBEMException) e.getCause(); + } + logger.trace(Level.FINE, operation + " request failed", e); + throw new WBEMException(WBEMException.CIM_ERR_FAILED, null, null, e); + } finally { + logger.exit(); + } + } + + public CloseableIterator referenceInstances(CIMObjectPath pObjectName, + String pResultClass, String pRole, boolean pIncludeClassOrigin, String[] pPropertyList) + throws WBEMException { + + final String operation = "ReferenceInstances"; + final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); + logger.entry(); + + checkState(); + + try { + if (pObjectName == null || pObjectName.getNamespace() == null + || pObjectName.getObjectName() == null) { throw new WBEMException( + WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + + HttpHeader hh = new HttpHeader(); + hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", + "US-ASCII")); + + Document doc = this.iXmlHelper.newDocument(); + this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.referenceInstances_request(doc, + pObjectName, pResultClass, pRole, pIncludeClassOrigin, pPropertyList)); + + InputStreamReader is = transmitRequest("References", hh, doc); + + return getIterator(is, pObjectName); + + } catch (WBEMException e) { + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); + throw e; + } catch (Exception e) { + if (e.getCause() != null && e.getCause() instanceof WBEMException) { + logger + .trace(Level.FINE, operation + " request resulted in CIM Error", e + .getCause()); + throw (WBEMException) e.getCause(); + } + logger.trace(Level.FINE, operation + " request failed", e); + throw new WBEMException(WBEMException.CIM_ERR_FAILED, null, null, e); + } finally { + logger.exit(); + } + } + + public CloseableIterator referenceNames(CIMObjectPath pObjectName, + String pResultClass, String pRole) throws WBEMException { + + final String operation = "ReferenceNames"; + final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); + logger.entry(); + + checkState(); + + try { + if (pObjectName == null || pObjectName.getNamespace() == null + || pObjectName.getObjectName() == null) { throw new WBEMException( + WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + + HttpHeader hh = new HttpHeader(); + hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", + "US-ASCII")); + + Document doc = this.iXmlHelper.newDocument(); + this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.referenceNames_request(doc, + pObjectName, pResultClass, pRole)); + + InputStreamReader is = transmitRequest("ReferenceNames", hh, doc); + + CloseableIterator iter = getIterator(is, pObjectName); + return iter; + + } catch (WBEMException e) { + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); + throw e; + } catch (Exception e) { + if (e.getCause() != null && e.getCause() instanceof WBEMException) { + logger + .trace(Level.FINE, operation + " request resulted in CIM Error", e + .getCause()); + throw (WBEMException) e.getCause(); + } + logger.trace(Level.FINE, operation + " request failed", e); + throw new WBEMException(WBEMException.CIM_ERR_FAILED, null, null, e); + } finally { + logger.exit(); + } + } + + public void setLocales(Locale[] pLocales) { + this.iLocales = (pLocales != null && pLocales.length > 0) ? pLocales + : WBEMConstants.DEFAULT_LOCALES; + } + + public void setQualifierType(CIMQualifierType pQualifierType) throws WBEMException { + + final String operation = "SetQualifierType"; + final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); + logger.entry(); + + checkState(); + + try { + if (pQualifierType == null || pQualifierType.getObjectPath() == null + || pQualifierType.getObjectPath().getNamespace() == null + || pQualifierType.getObjectPath().getObjectName() == null) { throw new WBEMException( + WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + + HttpHeader hh = new HttpHeader(); + hh.addField("CIMObject", HttpHeader.encode(pQualifierType.getObjectPath() + .getNamespace(), "UTF-8", "US-ASCII")); + + Document doc = this.iXmlHelper.newDocument(); + this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.setQualifierType_request(doc, + pQualifierType.getObjectPath(), pQualifierType)); + + InputStreamReader is = transmitRequest("SetQualifierType", hh, doc); + + CloseableIterator iter = getIterator(is, pQualifierType.getObjectPath()); + try { + iter.hasNext(); + } finally { + iter.close(); + } + + return; + + } catch (WBEMException e) { + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); + throw e; + } catch (Exception e) { + if (e.getCause() != null && e.getCause() instanceof WBEMException) { + logger + .trace(Level.FINE, operation + " request resulted in CIM Error", e + .getCause()); + throw (WBEMException) e.getCause(); + } + logger.trace(Level.FINE, operation + " request failed", e); + throw new WBEMException(WBEMException.CIM_ERR_FAILED, null, null, e); + } finally { + logger.exit(); + } + } + + public SocketFactory getCustomSocketFactory() { + return this.iConfiguration.getCustomSocketFactory(); + } + + public void setCustomSocketFactory(SocketFactory pFactory) throws UnsupportedOperationException { + this.iConfiguration.setCustomSocketFactory(pFactory); + } + + private String getHttpErrorString(int pStatusCode) { + switch (pStatusCode) { + case 400: + return "400 - BAD REQUEST"; + case 401: + return "401 - UNAUTHORIZED"; + case 403: + return "403 - FORBIDDEN"; + case 405: + return "405 - METHOD NOT ALLOWED"; + case 407: + return "407 - PROXY AUTHENTICATION REQUIRED"; + } + return null; + } + + private InputStreamReader transmitRequest(String pCimMethod, HttpHeader pHeader, + Document pDocument) throws IOException, ProtocolException, WBEMException { + return transmitRequestWorker(false, this.iUri, this.iHttpClientPool, pCimMethod, pHeader, + pDocument); + } + + /* + * Worker for both transmitRequest() (pIsIndication == false) and + * transmitIndicationRequest() (pIsIndication == true). + */ + private InputStreamReader transmitRequestWorker(boolean pIsIndication, URI pRecipient, + HttpClientPool pClientPool, String pCimMethod, HttpHeader pHeader, Document pDocument) + throws IOException, ProtocolException, WBEMException { + + final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); + logger.entry(); + + HttpUrlConnection connection = null; + int exceptionNum = WBEMException.CIM_ERR_FAILED; + + // retry HTTP MPOST only if failure is more than 24 hours old + if (this.iMPostFailed && !pIsIndication) { + this.iCurrentTime = System.currentTimeMillis(); + if ((this.iCurrentTime - this.iMPostFailTime) > 24 * 60 * 60 * 1000) this.iMPostFailed = false; + } + boolean useMPost = this.iMPostFailed || pIsIndication ? false : this.iConfiguration + .isHttpMPost(); + int retries = this.iConfiguration.getHttpConnectRetriesCount(); + do { + logger.trace(Level.FINE, "Attempting to connect.. number of attempts left:" + retries); + + // Disconnect existing connection to prevent object leak + if (connection != null) { + connection.disconnect(); + } + connection = newConnection(pIsIndication, pRecipient, pClientPool, pCimMethod, pHeader, + useMPost); + try { + logger.trace(Level.FINE, "Connecting..."); + connection.connect(); + } catch (UnknownHostException e) { + throw new WBEMException(WBEMException.CIM_ERR_FAILED, "Unknown host", null, e); + } catch (SocketException e) { + throw new WBEMException(WBEMException.CIM_ERR_FAILED, "Unable to connect", null, e); + } catch (SSLHandshakeException e) { + throw new WBEMException(WBEMException.CIM_ERR_FAILED, "SSL handshake exception", + null, e); + } + + OutputStream os = connection.getOutputStream(); + + if (this.iConfiguration.isCimXmlTracingEnabled() + || LogAndTraceBroker.getBroker().isLoggableCIMXMLTrace(Level.FINEST)) { + OutputStream pos = new ByteArrayOutputStream(); + CIMClientXML_HelperImpl.dumpDocument(pos, pDocument, + pIsIndication ? "indication request" : "request"); + OutputStream debugStream = LogAndTraceBroker.getBroker().getXmlTraceStream(); + if (this.iConfiguration.isCimXmlTracingEnabled() && debugStream != null) debugStream + .write(pos.toString().getBytes()); + if (LogAndTraceBroker.getBroker().isLoggableCIMXMLTrace(Level.FINEST)) logger + .traceCIMXML(Level.FINEST, pos.toString(), true); + } + CIMClientXML_HelperImpl.serialize(os, pDocument); + os.flush(); + os.close(); + + int resultCode = 200; + try { + resultCode = connection.getResponseCode(); + } catch (SocketException e) { + connection.disconnect(); + throw new WBEMException(WBEMException.CIM_ERR_FAILED, "Unable to connect", null, e); + } catch (SocketTimeoutException e) { + connection.disconnect(); + throw new WBEMException(WBEMException.CIM_ERR_FAILED, "Connection timed out", null, + e); + } catch (SSLHandshakeException e) { + connection.disconnect(); + throw new WBEMException(WBEMException.CIM_ERR_FAILED, "SSL handshake exception", + null, e); + } + + HttpHeader headers = parseHeaders(connection); + String auth = connection.getRequestProperty("Authorization"); + if (auth != null) { + this.iAuthorization = auth; + } + + exceptionNum = WBEMException.CIM_ERR_FAILED; + + switch (resultCode) { + case HttpURLConnection.HTTP_OK: // 200 + + if (this.iConfiguration.isHttpContentLengthRetryEnabled()) { + String contentLengthField = headers.getField("Content-length"); + if (contentLengthField != null && contentLengthField.trim().length() > 0) { + int contentLength = Integer.parseInt(contentLengthField); + int lengthToCheck = this.iConfiguration.getHttpContentLengthThreshold(); + + if (contentLength < lengthToCheck) { + logger.trace(Level.FINE, "Content Length below " + lengthToCheck + + ", retrying"); + break; + } + } + } + + String charset = getCharacterSet(headers); + + InputStream is = connection.getInputStream(); + OutputStream debugStream = LogAndTraceBroker.getBroker().getXmlTraceStream(); + if ((this.iConfiguration.isCimXmlTracingEnabled() && debugStream != null) + || LogAndTraceBroker.getBroker().isLoggableCIMXMLTrace(Level.FINEST)) { + is = new DebugInputStream(is, debugStream, + pIsIndication ? "indication response" : "response"); + } + + return new InputStreamReader(is, charset); + + case HttpURLConnection.HTTP_NOT_IMPLEMENTED: // 501 + // TODO if there is an error with the default xml + // encoder/decoder, load the correct version + // The problem is that the CIMOM does not return the DTD + // version, CIM version or Protocol Version + // that is expecting + String cimProtocolVersion = headers.getField("CIMProtocolVersion"); + if (cimProtocolVersion == null && headers.getField("CIMError") == null + && useMPost) { + logger + .trace(Level.FINER, + "Received HTTP Error 501 - NOT IMPLEMENTED with M-POST, falling back to POST"); + this.iMPostFailTime = System.currentTimeMillis(); + useMPost = false; + this.iMPostFailed = true; + ++retries; + break; + } + + logger.trace(Level.FINER, + "Received HTTP Error 501 - NOT IMPLEMENTED, skipping retries"); + retries = 0; + break; + + case HttpURLConnection.HTTP_BAD_REQUEST: // 400 + case HttpURLConnection.HTTP_FORBIDDEN: // 403 + case HttpURLConnection.HTTP_BAD_METHOD: // 405 + logger.trace(Level.FINER, "Received HTTP Error " + + getHttpErrorString(resultCode) + ", skipping retries"); + retries = 0; + break; + + case HttpURLConnection.HTTP_UNAUTHORIZED: // 401 + case HttpURLConnection.HTTP_PROXY_AUTH: // 407 + logger.trace(Level.FINER, "Received HTTP Error " + + getHttpErrorString(resultCode) + ", skipping retries"); + exceptionNum = WBEMException.CIM_ERR_ACCESS_DENIED; + retries = 0; + break; + + default: + if (useMPost) { + logger.trace(Level.FINER, "Received HTTP Error " + resultCode + + " with M-POST, falling back to POST"); + this.iMPostFailTime = System.currentTimeMillis(); + useMPost = false; + this.iMPostFailed = true; + ++retries; + } else { + logger.trace(Level.FINER, "Received HTTP Error " + resultCode + + ", retrying"); + } + } + + // Log HTTP error in XML trace if we are going to retry request + // (this means there is no response and no exception to indicate + // result of current request, which makes it look like the client is + // sending multiple requests without any response) + if (retries > 0) { + OutputStream debugStream = LogAndTraceBroker.getBroker().getXmlTraceStream(); + if ((this.iConfiguration.isCimXmlTracingEnabled() && debugStream != null) + || LogAndTraceBroker.getBroker().isLoggableCIMXMLTrace(Level.FINEST)) { + StringBuilder resultStr = new StringBuilder("<--- error response begin "); + resultStr.append(TimeStamp.formatWithMillis(System.currentTimeMillis())); + resultStr.append(" ----\nHTTP "); + resultStr.append(resultCode); + resultStr.append(' '); + resultStr.append(connection.getResponseMessage()); + resultStr.append(" (retrying request)\n---- error response end ----->\n"); + if (this.iConfiguration.isCimXmlTracingEnabled() && debugStream != null) debugStream + .write(resultStr.toString().getBytes()); + if (LogAndTraceBroker.getBroker().isLoggableCIMXMLTrace(Level.FINEST)) logger + .traceCIMXML(Level.FINEST, resultStr.toString(), false); + } + } + } while (retries-- > 0); + + // Benchmark.stopTransportTimer(); + + // Look for CIM error and description, include in exception if exists + String errorCIM = connection.getHeaderField("CIMError"); + String errorDescriptionCIM = null; + if (errorCIM != null) { + logger.trace(Level.FINER, "Found CIMError field with value \"" + errorCIM + "\""); + + errorDescriptionCIM = connection.getHeaderField("CIMErrorDescription"); + if (errorDescriptionCIM != null) { + try { + errorDescriptionCIM = URLDecoder.decode(errorDescriptionCIM, "UTF-8"); + } catch (Exception e) { + errorDescriptionCIM = null; + } + logger.trace(Level.FINER, "Found CIMErrorDescription field with value \"" + + errorDescriptionCIM + "\""); + } + } + + // Look for OpenPegasus error details, decode and include in exception + // if it exists + String errorOP = connection.getHeaderField("PGErrorDetail"); + if (errorOP != null) { + try { + errorOP = URLDecoder.decode(errorOP, "UTF-8"); + } catch (Exception e) { + errorOP = null; + } + logger.trace(Level.FINER, "Found PGErrorDetail field with value \"" + errorOP + "\""); + } + + // Look for SFCB error details, decode and include in exception + // if it exists + String errorSFCB = connection.getHeaderField("SFCBErrorDetail"); + if (errorSFCB != null) { + try { + errorSFCB = URLDecoder.decode(errorSFCB, "UTF-8"); + } catch (Exception e) { + errorSFCB = null; + } + logger.trace(Level.FINER, "Found SFCBErrorDetail field with value \"" + errorSFCB + + "\""); + } + + // If CIMErrorDescription present, format of WBEMException is: + // + // HTTP StatusCode - ReasonPhrase (CIMError: "ErrorString", + // CIMErrorDescription: "ErrorString") + // + // Otherwise, format of WBEMException message is: + // + // HTTP StatusCode - ReasonPhrase (CIMError: "ErrorString", OpenPegasus + // Error: "ErrorString", SFCB Error: "ErrorString") + // + // For example: + // HTTP 503 - Service Unavailable (SFCB Error: + // "Max Session Limit Exceeded") + StringBuffer errorMsg = new StringBuffer("HTTP "); + errorMsg.append(connection.getResponseCode()); + errorMsg.append(" - "); + errorMsg.append(connection.getResponseMessage()); + if (errorCIM != null && errorDescriptionCIM != null) { + errorMsg.append(" (CIMError: \""); + errorMsg.append(errorCIM); + errorMsg.append("\", CIMErrorDescription: \""); + errorMsg.append(errorDescriptionCIM); + errorMsg.append("\")"); + } else if (errorCIM != null || errorOP != null || errorSFCB != null) { + errorMsg.append(" ("); + if (errorCIM != null) { + errorMsg.append("CIMError: \""); + errorMsg.append(errorCIM); + errorMsg.append('"'); + } + if (errorOP != null) { + if (errorCIM != null) errorMsg.append(", "); + errorMsg.append("OpenPegasus Error: \""); + errorMsg.append(errorOP); + errorMsg.append('"'); + } + if (errorSFCB != null) { + if (errorCIM != null || errorOP != null) errorMsg.append(", "); + errorMsg.append("SFCB Error: \""); + errorMsg.append(errorSFCB); + errorMsg.append('"'); + } + errorMsg.append(')'); + } + + connection.disconnect(); + + throw new WBEMException(exceptionNum, errorMsg.toString()); + } + + private HttpUrlConnection newConnection(boolean pIsIndication, URI pRecipient, + HttpClientPool pClientPool, String pCimMethod, HttpHeader pHeader, boolean pUseMPost) { + + final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); + logger.entry(); + + HttpUrlConnection connection = new HttpUrlConnection(pRecipient, pClientPool, + this.iAuthorizationHandler); + if (pUseMPost) { + connection.setRequestMethod(WBEMConstants.HTTP_MPOST); + } else connection.setRequestMethod(WBEMConstants.HTTP_POST); + connection.useHttp11("1.1".equals(this.iConfiguration.getHttpVersion())); + + String firstLocaleStr = this.iLocales[0].getLanguage(); + if (this.iLocales[0].getCountry().length() > 0) firstLocaleStr = firstLocaleStr + '-' + + this.iLocales[0].getCountry(); + StringBuilder restLocaleStrBld = new StringBuilder(""); + for (int i = 1; i < this.iLocales.length; i++) { + if (this.iLocales[i] != null && this.iLocales[i].getLanguage().length() > 0) { + restLocaleStrBld.append(", "); + restLocaleStrBld.append(this.iLocales[i].getLanguage()); + if (this.iLocales[i].getCountry().length() > 0) { + restLocaleStrBld.append('-'); + restLocaleStrBld.append(this.iLocales[i].getCountry()); + } + } + } + + connection.setDoOutput(true); + connection.setDoInput(true); + connection.setRequestProperty("Content-type", "application/xml; charset=\"utf-8\""); + connection.setRequestProperty("Accept", "text/html, text/xml, application/xml"); + connection.setRequestProperty("Cache-Control", "no-cache"); + connection.setRequestProperty("Content-Language", firstLocaleStr); + connection.setRequestProperty("Accept-Language", firstLocaleStr + + restLocaleStrBld.toString() + ", *"); + if (this.iAuthorization != null) connection.setRequestProperty("Authorization", + this.iAuthorization); + + String prefix = ""; + if (connection.getRequestMethod().equalsIgnoreCase(WBEMConstants.HTTP_MPOST)) { + String ns = getNextNs(); + connection.setRequestProperty("Man", "http://www.dmtf.org/cim/mapping/http/v1.0;ns=" + + ns); + prefix = ns + "-"; + } + connection.setRequestProperty(prefix + "CIMProtocolVersion", "1.0"); + + if (pIsIndication) { + try { + connection.setRequestProperty("CIMExport", HttpHeader.encode("MethodRequest", + "UTF-8", "US-ASCII")); + connection.setRequestProperty("CIMExportMethod", HttpHeader.encode( + "ExportIndication", "UTF-8", "US-ASCII")); + } catch (UnsupportedEncodingException e) { + logger.trace(Level.FINE, "Exception while encoding http header", e); + connection.setRequestProperty("CIMExport", "MethodRequest"); + connection.setRequestProperty("CIMExportMethod", "ExportIndication"); + } + } else { + connection.setRequestProperty(prefix + "CIMOperation", "MethodCall"); + try { + connection.setRequestProperty(prefix + "CIMMethod", HttpHeader.encode(pCimMethod, + "UTF-8", "US-ASCII")); + } catch (UnsupportedEncodingException e) { + logger.trace(Level.FINE, "Exception while encoding http header", e); + connection.setRequestProperty(prefix + "CIMMethod", pCimMethod); + } + } + Iterator> iter = pHeader.iterator(); + while (iter.hasNext()) { + Entry entry = iter.next(); + connection.setRequestProperty(prefix + entry.getKey().toString(), entry.getValue() + .toString()); + } + + logger.exit(); + return connection; + } + + private String getNextNs() { + this.iNsCounter = (this.iNsCounter < 99) ? ++this.iNsCounter : 10; + return String.valueOf(this.iNsCounter); + } + + private HttpHeader parseHeaders(URLConnection pConnection) { + String man = pConnection.getHeaderField("Man"); + String opt = pConnection.getHeaderField("Opt"); + HttpHeader headers = new HttpHeader(); + int i; + String ns = null; + + HttpHeaderParser manOptHeader = null; + if (man != null && man.length() > 0) manOptHeader = new HttpHeaderParser(man); + else if (opt != null && opt.length() > 0) manOptHeader = new HttpHeaderParser(opt); + if (manOptHeader != null) ns = manOptHeader.getValue("ns"); + + if (ns != null) { + i = 0; + String key; + while ((key = pConnection.getHeaderFieldKey(++i)) != null) { + if (key.startsWith(ns + "-")) headers.addParsedField(key.substring(3), pConnection + .getHeaderField(i)); + else headers.addParsedField(key, pConnection.getHeaderField(i)); + } + } else { + i = 0; + String key; + while ((key = pConnection.getHeaderFieldKey(++i)) != null) { + headers.addParsedField(key, pConnection.getHeaderField(i)); + } + } + + return headers; + } + + private String getCharacterSet(HttpHeader pHeader) { + String contentType = pHeader.getField("Content-type"); + String charset = "UTF-8"; + if (contentType != null && contentType.length() > 0) { + HttpHeaderParser contentTypeHeader = new HttpHeaderParser(contentType); + charset = contentTypeHeader.getValue("charset", charset); + } + return charset; + } + + /** + * getIterator : get generic CloseableIterator + * + * @param + * : Type Parameter + * @param pStream + * : Input Stream Reader + * @param pPath + * : CIMObjectPath + * @return generic CloseableIterator + * @throws IOException + * @throws SAXException + * @throws ParserConfigurationException + * @throws WBEMException + */ + + // :TODO : try to find solution of "unchecked" warning + @SuppressWarnings("unchecked") + private CloseableIterator getIterator(InputStreamReader pStream, CIMObjectPath pPath) + throws IOException, SAXException, ParserConfigurationException, WBEMException { + + String parser = this.iConfiguration.getCimXmlParser(); + + CloseableIterator iter = null; + + if (WBEMConstants.SAX.equals(parser)) { + iter = new CloseableIteratorSAX(pStream, pPath); + } else if (WBEMConstants.PULL.equals(parser)) { + iter = new CloseableIteratorPULL(pStream, pPath); + } else if (WBEMConstants.DOM.equals(parser)) { + iter = new CloseableIteratorDOM(pStream, pPath); + } else { + throw new IllegalArgumentException("Invalid CIM-XML parser configured (\"" + parser + + "\") "); + } + try { + // check for CIMExceptions + iter.hasNext(); + return (CloseableIterator) iter; + } catch (RuntimeException e) { + iter.close(); + if (e.getCause() != null && e.getCause() instanceof WBEMException) { throw (WBEMException) e + .getCause(); } + throw e; + } + } + + private EnumerateResponse getEnumerateResponse(InputStreamReader pStream, + CIMObjectPath pPath) throws IOException, SAXException, ParserConfigurationException, + WBEMException { + + String parser = this.iConfiguration.getCimXmlParser(); + + if (WBEMConstants.SAX.equals(parser)) return new EnumerateResponseSAX(pStream, pPath) + .getEnumResponse(); + else if (WBEMConstants.PULL.equals(parser)) return new EnumerateResponsePULL(pStream, + pPath).getEnumResponse(); + else if (WBEMConstants.DOM.equals(parser)) return new EnumerateResponseDOM(pStream, + pPath).getEnumResponse(); + + throw new IllegalArgumentException("Invalid CIM-XML parser configured (\"" + parser + + "\") "); + } + + private CIMResponse getSingleResponse(InputStreamReader pStream, CIMObjectPath pLocalPath) + throws WBEMException { + final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + Document dom; + try { + // Using factory get an instance of document builder + DocumentBuilder db = dbf.newDocumentBuilder(); + // parse using builder to get DOM representation of the XML file + dom = db.parse(new InputSource(pStream)); + } catch (TrailerException e) { + throw e.getWBEMException(); + } catch (Exception e) { + String msg = "Exception occurred during DOM parsing!"; + logger.trace(Level.SEVERE, msg, e); + throw new WBEMException(WBEMException.CIM_ERR_FAILED, msg, null, e); + } + CIMXMLParserImpl.setLocalObjectPath(pLocalPath); + CIMMessage cimMsg; + try { + cimMsg = CIMXMLParserImpl.parseCIM(dom.getDocumentElement()); + } catch (CIMXMLParseException e) { + String msg = "Exception occurred during parseCIM!"; + logger.trace(Level.SEVERE, msg, e); + throw new WBEMException(WBEMException.CIM_ERR_FAILED, msg, null, e); + } + if (!(cimMsg instanceof CIMResponse)) { + String msg = "CIM message must be response!"; + logger.trace(Level.SEVERE, msg); + throw new WBEMException(msg); + } + return (CIMResponse) cimMsg; + } + + public Properties getLocalProperties() { + return this.iConfiguration.getLocalProperties(); + } + + public void setLocalProperties(Properties pProperties) { + this.iConfiguration.setLocalProperties(pProperties); + } + + public void setLocalProperty(String pKey, String pValue) { + this.iConfiguration.setLocalProperty(pKey, pValue); + } + + private synchronized void checkState() throws IllegalStateException { + if (this.iInitialized && !this.iClosed) return; + String state = this.iClosed ? "closed." : "not initialized."; + LogAndTraceBroker.getBroker().trace(Level.FINE, "Illegal state for operation: " + state); + throw new IllegalStateException("WBEMClient is " + state); + } + + public EnumerateResponse associatorPaths(CIMObjectPath pObjectName, + String pAssociationClass, String pResultClass, String pRole, String pResultRole, + String pFilterQueryLanguage, String pFilterQuery, UnsignedInteger32 pTimeout, + boolean pContinueOnError, UnsignedInteger32 pMaxObjects) throws WBEMException { + + final String operation = "OpenAssociatorInstancePaths"; + final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); + logger.entry(); + + checkState(); + + try { + if (pObjectName == null || pObjectName.getNamespace() == null + || pObjectName.getObjectName() == null) { throw new WBEMException( + WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + + HttpHeader hh = new HttpHeader(); + hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", + "US-ASCII")); + + Document doc = this.iXmlHelper.newDocument(); + + this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper + .OpenAssociatorInstancePaths_request(doc, pObjectName, pAssociationClass, + pResultClass, pRole, pResultRole, pFilterQueryLanguage, pFilterQuery, + pTimeout, pContinueOnError, pMaxObjects)); + + InputStreamReader is = transmitRequest(operation, hh, doc); + + EnumerateResponse enumResp = getEnumerateResponse(is, pObjectName); + return enumResp; + + } catch (WBEMException e) { + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); + throw e; + } catch (Exception e) { + if (e.getCause() != null && e.getCause() instanceof WBEMException) { + logger + .trace(Level.FINE, operation + " request resulted in CIM Error", e + .getCause()); + throw (WBEMException) e.getCause(); + } + logger.trace(Level.FINE, operation + " request failed", e); + throw new WBEMException(WBEMException.CIM_ERR_FAILED, null, null, e); + } finally { + logger.exit(); + } + } + + public EnumerateResponse associators(CIMObjectPath pObjectName, + String pAssocClass, String pResultClass, String pRole, String pResultRole, + boolean pIncludeClassOrigin, String[] pPropertyList, String pFilterQueryLanguage, + String pFilterQuery, UnsignedInteger32 pTimeout, boolean pContinueOnError, + UnsignedInteger32 pMaxObjects) throws WBEMException { + + final String operation = "OpenAssociatorInstances"; + final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); + logger.entry(); + + checkState(); + + try { + if (pObjectName == null || pObjectName.getNamespace() == null + || pObjectName.getObjectName() == null) { throw new WBEMException( + WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + + HttpHeader hh = new HttpHeader(); + hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", + "US-ASCII")); + + Document doc = this.iXmlHelper.newDocument(); + + this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.OpenAssociatorInstances_request( + doc, pObjectName, pAssocClass, pResultClass, pRole, pResultRole, + pIncludeClassOrigin, pPropertyList, pFilterQueryLanguage, pFilterQuery, + pTimeout, pContinueOnError, pMaxObjects)); + + InputStreamReader is = transmitRequest(operation, hh, doc); + + EnumerateResponse enumResp = getEnumerateResponse(is, pObjectName); + return enumResp; + + } catch (WBEMException e) { + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); + throw e; + } catch (Exception e) { + if (e.getCause() != null && e.getCause() instanceof WBEMException) { + logger + .trace(Level.FINE, operation + " request resulted in CIM Error", e + .getCause()); + throw (WBEMException) e.getCause(); + } + logger.trace(Level.FINE, operation + " request failed", e); + throw new WBEMException(WBEMException.CIM_ERR_FAILED, null, null, e); + } finally { + logger.exit(); + } + } + + public void closeEnumeration(CIMObjectPath pObjectName, String pEnumerationContext) + throws WBEMException { + + final String operation = "CloseEnumeration"; + final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); + logger.entry(); + + checkState(); + + try { + if (pObjectName == null || pObjectName.getNamespace() == null + || pObjectName.getObjectName() == null) { throw new WBEMException( + WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + + HttpHeader hh = new HttpHeader(); + hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", + "US-ASCII")); + + Document doc = this.iXmlHelper.newDocument(); + + this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.CloseEnumeration_request(doc, + pObjectName, pEnumerationContext)); + + InputStreamReader is = transmitRequest(operation, hh, doc); + + CloseableIterator iter = getIterator(is, pObjectName); + + // Check for exceptions + try { + iter.hasNext(); + } finally { + iter.close(); + } + } catch (WBEMException e) { + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); + throw e; + } catch (Exception e) { + if (e.getCause() != null && e.getCause() instanceof WBEMException) { + logger + .trace(Level.FINE, operation + " request resulted in CIM Error", e + .getCause()); + throw (WBEMException) e.getCause(); + } + logger.trace(Level.FINE, operation + " request failed", e); + throw new WBEMException(WBEMException.CIM_ERR_FAILED, null, null, e); + } finally { + logger.exit(); + } + + } + + public EnumerateResponse enumerateInstancePaths(CIMObjectPath pObjectName, + String pFilterQueryLanguage, String pFilterQuery, UnsignedInteger32 pTimeout, + boolean pContinueOnError, UnsignedInteger32 pMaxObjects) throws WBEMException { + + final String operation = "OpenEnumerateInstancePaths"; + final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); + logger.entry(); + + checkState(); + + try { + if (pObjectName == null || pObjectName.getNamespace() == null + || pObjectName.getObjectName() == null) { throw new WBEMException( + WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + + HttpHeader hh = new HttpHeader(); + hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", + "US-ASCII")); + + Document doc = this.iXmlHelper.newDocument(); + + this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper + .OpenEnumerateInstancePaths_request(doc, pObjectName, pFilterQueryLanguage, + pFilterQuery, pTimeout, pContinueOnError, pMaxObjects)); + + InputStreamReader is = transmitRequest(operation, hh, doc); + + EnumerateResponse enumResp = getEnumerateResponse(is, pObjectName); + return enumResp; + + } catch (WBEMException e) { + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); + throw e; + } catch (Exception e) { + if (e.getCause() != null && e.getCause() instanceof WBEMException) { + logger + .trace(Level.FINE, operation + " request resulted in CIM Error", e + .getCause()); + throw (WBEMException) e.getCause(); + } + logger.trace(Level.FINE, operation + " request failed", e); + throw new WBEMException(WBEMException.CIM_ERR_FAILED, null, null, e); + } finally { + logger.exit(); + } + } + + public EnumerateResponse enumerateInstances(CIMObjectPath pObjectName, + boolean pDeepInheritance, boolean pIncludeClassOrigin, String[] pPropertyList, + String pFilterQueryLanguage, String pFilterQuery, UnsignedInteger32 pTimeout, + boolean pContinueOnError, UnsignedInteger32 pMaxObjects) throws WBEMException { + + final String operation = "OpenEnumerateInstances"; + final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); + logger.entry(); + + checkState(); + + try { + if (pObjectName == null || pObjectName.getNamespace() == null + || pObjectName.getObjectName() == null) { throw new WBEMException( + WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + + HttpHeader hh = new HttpHeader(); + hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", + "US-ASCII")); + + Document doc = this.iXmlHelper.newDocument(); + + this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.OpenEnumerateInstances_request( + doc, pObjectName, pDeepInheritance, pIncludeClassOrigin, pPropertyList, + pFilterQueryLanguage, pFilterQuery, pTimeout, pContinueOnError, pMaxObjects)); + + InputStreamReader is = transmitRequest(operation, hh, doc); + EnumerateResponse enumResp = getEnumerateResponse(is, pObjectName); + return enumResp; + + } catch (WBEMException e) { + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); + throw e; + } catch (Exception e) { + if (e.getCause() != null && e.getCause() instanceof WBEMException) { + logger + .trace(Level.FINE, operation + " request resulted in CIM Error", e + .getCause()); + throw (WBEMException) e.getCause(); + } + logger.trace(Level.FINE, operation + " request failed", e); + throw new WBEMException(WBEMException.CIM_ERR_FAILED, null, null, e); + } finally { + logger.exit(); + } + } + + // not supported yet + public UnsignedInteger64 enumerationCount(CIMObjectPath pObjectName, String pEnumerationContext) + throws WBEMException { + final String operation = "EnumerationCount"; + final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); + logger.entry(); + + checkState(); + + try { + if (pObjectName == null || pObjectName.getNamespace() == null + || pObjectName.getObjectName() == null) { throw new WBEMException( + WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + + HttpHeader hh = new HttpHeader(); + hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", + "US-ASCII")); + + Document doc = this.iXmlHelper.newDocument(); + + this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.EnumerationCount_request(doc, + pObjectName, pEnumerationContext)); + + InputStreamReader is = transmitRequest(operation, hh, doc); + // Currently this is not supported by server. Server returns + // error : "CIM_ERR_NOT_SUPPORTED" + // This error is caught by parser and exception is thrown + + getEnumerateResponse(is, pObjectName); + // Error mentioned above will go away if server starts to support + // EnumerationCount, we need to update code i.e. remove exception + // and return UnsignedInteger64 + + // this exception will be thrown only if server starts to support + // enumerationCount + throw new WBEMException(operation + " is currently not supported by client"); + + } catch (WBEMException e) { + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); + throw e; + } catch (Exception e) { + if (e.getCause() != null && e.getCause() instanceof WBEMException) { + logger + .trace(Level.FINE, operation + " request resulted in CIM Error", e + .getCause()); + throw (WBEMException) e.getCause(); + } + logger.trace(Level.FINE, operation + " request failed", e); + throw new WBEMException(WBEMException.CIM_ERR_FAILED, null, null, e); + } finally { + logger.exit(); + } + } + + public EnumerateResponse execQueryInstances(CIMObjectPath pObjectName, + String pFilterQuery, String pFilterQueryLanguage, boolean pReturnQueryResultClass, + UnsignedInteger32 pTimeout, boolean pContinueOnError, UnsignedInteger32 pMaxObjects, + CIMClass pQueryResultClass) throws WBEMException { + + final String operation = "OpenQueryInstances"; + final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); + logger.entry(); + + checkState(); + + try { + if (pObjectName == null || pObjectName.getNamespace() == null + || pObjectName.getObjectName() == null) { throw new WBEMException( + WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + + HttpHeader hh = new HttpHeader(); + hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", + "US-ASCII")); + + Document doc = this.iXmlHelper.newDocument(); + + this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.OpenQueryInstances_request(doc, + pObjectName, pFilterQuery, pFilterQueryLanguage, pReturnQueryResultClass, + pTimeout, pContinueOnError, pMaxObjects, pQueryResultClass)); + + InputStreamReader is = transmitRequest(operation, hh, doc); + EnumerateResponse enumResp = getEnumerateResponse(is, pObjectName); + return enumResp; + + } catch (WBEMException e) { + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); + throw e; + } catch (Exception e) { + if (e.getCause() != null && e.getCause() instanceof WBEMException) { + logger + .trace(Level.FINE, operation + " request resulted in CIM Error", e + .getCause()); + throw (WBEMException) e.getCause(); + } + logger.trace(Level.FINE, operation + " request failed", e); + throw new WBEMException(WBEMException.CIM_ERR_FAILED, null, null, e); + } finally { + logger.exit(); + } + } + + public EnumerateResponse getInstancePaths(CIMObjectPath pObjectName, + String pContext, UnsignedInteger32 pMaxObjects) throws WBEMException { + + final String operation = "PullInstancePaths"; + final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); + logger.entry(); + + checkState(); + + try { + if (pObjectName == null || pObjectName.getNamespace() == null + || pObjectName.getObjectName() == null) { throw new WBEMException( + WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + + HttpHeader hh = new HttpHeader(); + hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", + "US-ASCII")); + + Document doc = this.iXmlHelper.newDocument(); + + this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.PullInstancePaths_request(doc, + pObjectName, pContext, pMaxObjects)); + + InputStreamReader is = transmitRequest(operation, hh, doc); + EnumerateResponse enumResp = getEnumerateResponse(is, pObjectName); + return enumResp; + + } catch (WBEMException e) { + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); + throw e; + } catch (Exception e) { + if (e.getCause() != null && e.getCause() instanceof WBEMException) { + logger + .trace(Level.FINE, operation + " request resulted in CIM Error", e + .getCause()); + throw (WBEMException) e.getCause(); + } + logger.trace(Level.FINE, operation + " request failed", e); + throw new WBEMException(WBEMException.CIM_ERR_FAILED, null, null, e); + } finally { + logger.exit(); + } + } + + public EnumerateResponse getInstances(CIMObjectPath pObjectName, String pContext, + UnsignedInteger32 pMaxObjects) throws WBEMException { + + final String operation = "PullInstances"; + final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); + logger.entry(); + + checkState(); + + try { + if (pObjectName == null || pObjectName.getNamespace() == null + || pObjectName.getObjectName() == null) { throw new WBEMException( + WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + + HttpHeader hh = new HttpHeader(); + hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", + "US-ASCII")); + + Document doc = this.iXmlHelper.newDocument(); + + this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.PullInstances_request(doc, + pObjectName, pContext, pMaxObjects)); + + InputStreamReader is = transmitRequest(operation, hh, doc); + EnumerateResponse enumResp = getEnumerateResponse(is, pObjectName); + return enumResp; + + } catch (WBEMException e) { + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); + throw e; + } catch (Exception e) { + if (e.getCause() != null && e.getCause() instanceof WBEMException) { + logger + .trace(Level.FINE, operation + " request resulted in CIM Error", e + .getCause()); + throw (WBEMException) e.getCause(); + } + logger.trace(Level.FINE, operation + " request failed", e); + throw new WBEMException(WBEMException.CIM_ERR_FAILED, null, null, e); + } finally { + logger.exit(); + } + } + + public EnumerateResponse getInstancesWithPath(CIMObjectPath pObjectName, + String pContext, UnsignedInteger32 pMaxObjects) throws WBEMException { + + final String operation = "PullInstancesWithPath"; + final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); + logger.entry(); + + checkState(); + + try { + if (pObjectName == null || pObjectName.getNamespace() == null + || pObjectName.getObjectName() == null) { throw new WBEMException( + WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + + HttpHeader hh = new HttpHeader(); + hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", + "US-ASCII")); + + Document doc = this.iXmlHelper.newDocument(); + + this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.PullInstancesWithPath_request( + doc, pObjectName, pContext, pMaxObjects)); + + InputStreamReader is = transmitRequest(operation, hh, doc); + EnumerateResponse enumResp = getEnumerateResponse(is, pObjectName); + return enumResp; + + } catch (WBEMException e) { + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); + throw e; + } catch (Exception e) { + if (e.getCause() != null && e.getCause() instanceof WBEMException) { + logger + .trace(Level.FINE, operation + " request resulted in CIM Error", e + .getCause()); + throw (WBEMException) e.getCause(); + } + logger.trace(Level.FINE, operation + " request failed", e); + throw new WBEMException(WBEMException.CIM_ERR_FAILED, null, null, e); + } finally { + logger.exit(); + } + } + + public EnumerateResponse referencePaths(CIMObjectPath pObjectName, + String pResultClass, String pRole, String pFilterQueryLanguage, String pFilterQuery, + UnsignedInteger32 pTimeout, boolean pContinueOnError, UnsignedInteger32 pMaxObjects) + throws WBEMException { + + final String operation = "OpenReferenceInstancePaths"; + final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); + logger.entry(); + + checkState(); + + try { + if (pObjectName == null || pObjectName.getNamespace() == null + || pObjectName.getObjectName() == null) { throw new WBEMException( + WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + + HttpHeader hh = new HttpHeader(); + hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", + "US-ASCII")); + + Document doc = this.iXmlHelper.newDocument(); + + this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper + .OpenReferenceInstancePaths_request(doc, pObjectName, pResultClass, pRole, + pFilterQueryLanguage, pFilterQuery, pTimeout, pContinueOnError, + pMaxObjects)); + + InputStreamReader is = transmitRequest(operation, hh, doc); + EnumerateResponse enumResp = getEnumerateResponse(is, pObjectName); + return enumResp; + + } catch (WBEMException e) { + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); + throw e; + } catch (Exception e) { + if (e.getCause() != null && e.getCause() instanceof WBEMException) { + logger + .trace(Level.FINE, operation + " request resulted in CIM Error", e + .getCause()); + throw (WBEMException) e.getCause(); + } + logger.trace(Level.FINE, operation + " request failed", e); + throw new WBEMException(WBEMException.CIM_ERR_FAILED, null, null, e); + } finally { + logger.exit(); + } + } + + public EnumerateResponse references(CIMObjectPath pObjectName, + String pResultClass, String pRole, boolean pIncludeClassOrigin, String[] pPropertyList, + String pFilterQueryLanguage, String pFilterQuery, UnsignedInteger32 pTimeout, + boolean pContinueOnError, UnsignedInteger32 pMaxObjects) throws WBEMException { + + final String operation = "OpenReferenceInstances"; + final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); + logger.entry(); + + checkState(); + + try { + + if (pObjectName == null || pObjectName.getNamespace() == null + || pObjectName.getObjectName() == null) { throw new WBEMException( + WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + + HttpHeader hh = new HttpHeader(); + hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", + "US-ASCII")); + + Document doc = this.iXmlHelper.newDocument(); + + this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.OpenReferenceInstances_request( + doc, pObjectName, pResultClass, pRole, pIncludeClassOrigin, pPropertyList, + pFilterQueryLanguage, pFilterQuery, pTimeout, pContinueOnError, pMaxObjects)); + + InputStreamReader is = transmitRequest(operation, hh, doc); + EnumerateResponse enumResp = getEnumerateResponse(is, pObjectName); + return enumResp; + + } catch (WBEMException e) { + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); + throw e; + } catch (Exception e) { + if (e.getCause() != null && e.getCause() instanceof WBEMException) { + logger + .trace(Level.FINE, operation + " request resulted in CIM Error", e + .getCause()); + throw (WBEMException) e.getCause(); + } + logger.trace(Level.FINE, operation + " request failed", e); + throw new WBEMException(WBEMException.CIM_ERR_FAILED, null, null, e); + } finally { + logger.exit(); + } + } + + private InputStreamReader transmitIndicationRequest(URI pRecipient, HttpClientPool pClientPool, + HttpHeader pHeader, Document pDocument) throws IOException, ProtocolException, + WBEMException { + return transmitRequestWorker(true, pRecipient, pClientPool, null, pHeader, pDocument); + } + + public boolean sendIndication(URI pRecipient, CIMInstance pIndication) throws WBEMException { + final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); + logger.entry(); + + checkState(); + + try { + if (pRecipient == null || pRecipient.getScheme() == null + || pRecipient.getHost() == null || pRecipient.getPort() <= 0) { throw new WBEMException( + WBEMException.CIM_ERR_INVALID_PARAMETER, + "Invalid recipient URI, must contain valid scheme://host:port"); } + + if (!pRecipient.getScheme().equalsIgnoreCase(WBEMConstants.HTTP) + && !pRecipient.getScheme().equalsIgnoreCase(WBEMConstants.HTTPS)) throw new WBEMException( + WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid scheme " + + pRecipient.getScheme() + ", must be http or https"); + + if (pIndication == null) { throw new WBEMException( + WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid indication, must not be null"); } + + logger.trace(Level.FINER, "Attempting to send following indication to " + + pRecipient.toString() + ":\n" + pIndication.toString()); + + HttpHeader hh = new HttpHeader(); + + Document doc = this.iXmlHelper.newDocument(); + + this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.sendIndication_request(doc, + pIndication)); + + HttpClientPool indPool = new HttpClientPool(this.iConfiguration); + + InputStreamReader is = transmitIndicationRequest(pRecipient, indPool, hh, doc); + + boolean success = false; + if (is != null) { + CIMResponse response = getSingleResponse(is, null); + success = response != null && response.isSuccessful(); + } + + indPool.closePool(); + + return success; + } catch (WBEMException e) { + logger.trace(Level.FINE, "Sending indication resulted in CIM Error", e); + throw e; + } catch (Exception e) { + if (e.getCause() != null && e.getCause() instanceof WBEMException) { + logger.trace(Level.FINE, "Sending indication resulted in CIM Error", e.getCause()); + throw (WBEMException) e.getCause(); + } + logger.trace(Level.FINE, "Sending indication failed", e); + throw new WBEMException(WBEMException.CIM_ERR_FAILED, null, null, e); + } finally { + logger.exit(); + } + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/indications/CIMEvent.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/indications/CIMEvent.java similarity index 75% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/indications/CIMEvent.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/indications/CIMEvent.java index 5b5fce7..4b3845a 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/indications/CIMEvent.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/indications/CIMEvent.java @@ -1,133 +1,131 @@ -/* - CIMEvent.java - - (C) Copyright IBM Corp. 2005, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------ - * 17931 2005-07-28 thschaef Add InetAddress field - * + constructor and getter - * 1535756 2006-08-07 lupusalex Make code warning free - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.indications; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.net.InetAddress; - -import org.sentrysoftware.wbem.javax.cim.CIMInstance; - -/** - * Class CIMEvent is required for indication handling. - * - */ -public class CIMEvent { - - protected CIMInstance iIndication; - - protected String iID; - - protected InetAddress iInetAddress = null; - - /** - * Ctor. - * - * @param pIndication - */ - public CIMEvent(CIMInstance pIndication) { - this(pIndication, null); - } - - /** - * Ctor. - * - * @param pIndication - * @param id - */ - public CIMEvent(CIMInstance pIndication, String id) { - this.iIndication = pIndication; - this.iID = id; - } - - /** - * Constructor that takes the CIMInstance of the indication, the id as well - * as the InetAddress of the remote machine. - * - * @param pIndication - * The indication instance - * @param pId - * The id - * @param pInetAddress - * The address - */ - public CIMEvent(CIMInstance pIndication, String pId, InetAddress pInetAddress) { - this.iIndication = pIndication; - this.iID = pId; - this.iInetAddress = pInetAddress; - } - - /** - * This method returns the InetAddress of the machine that hosts the CIM - * Agent that sent the indication. Be aware the remote machine could have - * multiple network adapters - thus the result can be ambiguous. - * - * @return The InetAddress of the remote machine - */ - public InetAddress getInetAddress() { - return this.iInetAddress; - } - - /** - * getIndication - * - * @return CIMInstance - */ - public CIMInstance getIndication() { - return this.iIndication; - } - - /** - * getID - * - * @return String - */ - public String getID() { - return this.iID; - } -} +/* + CIMEvent.java + + (C) Copyright IBM Corp. 2005, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------ + * 17931 2005-07-28 thschaef Add InetAddress field + * + constructor and getter + * 1535756 2006-08-07 lupusalex Make code warning free + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.wbem.indications; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.net.InetAddress; + +import org.metricshub.wbem.javax.cim.CIMInstance; + +/** + * Class CIMEvent is required for indication handling. + * + */ +public class CIMEvent { + + protected CIMInstance iIndication; + + protected String iID; + + protected InetAddress iInetAddress = null; + + /** + * Ctor. + * + * @param pIndication + */ + public CIMEvent(CIMInstance pIndication) { + this(pIndication, null); + } + + /** + * Ctor. + * + * @param pIndication + * @param id + */ + public CIMEvent(CIMInstance pIndication, String id) { + this.iIndication = pIndication; + this.iID = id; + } + + /** + * Constructor that takes the CIMInstance of the indication, the id as well + * as the InetAddress of the remote machine. + * + * @param pIndication + * The indication instance + * @param pId + * The id + * @param pInetAddress + * The address + */ + public CIMEvent(CIMInstance pIndication, String pId, InetAddress pInetAddress) { + this.iIndication = pIndication; + this.iID = pId; + this.iInetAddress = pInetAddress; + } + + /** + * This method returns the InetAddress of the machine that hosts the CIM + * Agent that sent the indication. Be aware the remote machine could have + * multiple network adapters - thus the result can be ambiguous. + * + * @return The InetAddress of the remote machine + */ + public InetAddress getInetAddress() { + return this.iInetAddress; + } + + /** + * getIndication + * + * @return CIMInstance + */ + public CIMInstance getIndication() { + return this.iIndication; + } + + /** + * getID + * + * @return String + */ + public String getID() { + return this.iID; + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/indications/CIMEventDispatcher.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/indications/CIMEventDispatcher.java similarity index 83% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/indications/CIMEventDispatcher.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/indications/CIMEventDispatcher.java index 811e56d..c6ff246 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/indications/CIMEventDispatcher.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/indications/CIMEventDispatcher.java @@ -1,209 +1,206 @@ -/* - CIMEventDispatcher.java - - (C) Copyright IBM Corp. 2005, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1498927 2006-06-01 lupusalex Fill gaps in logging coverage - * 1535756 2006-08-07 lupusalex Make code warning free - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 3477087 2012-01-23 blaschke-oss Need Access to an Indication Sender's IP Address - * 2628 2013-03-26 blaschke-oss Limit size of LinkedList of CIMEvents to be dispatched - */ -package org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.indications; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.EventListener; -import java.util.LinkedList; -import java.util.logging.Level; - -import org.sentrysoftware.wbem.javax.wbem.listener.IndicationListener; - -import org.sentrysoftware.wbem.sblim.cimclient.IndicationListenerSBLIM; -import org.sentrysoftware.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; - -/** - * Class CIMEventDispatcher is required for indication handling. - * - */ -public class CIMEventDispatcher extends Thread { - - protected LinkedList iEventQueue = new LinkedList(); - - protected EventListener iListener = null; - - private boolean iAlive = true; - - private int iMaxEvents = 0; - - private LogAndTraceBroker iLogger = LogAndTraceBroker.getBroker(); - - /** - * Construct a CIMEventDispatcher object which distributes CIMEvents to the - * appropriate CIMListener. The EventListener must be an instance of - * IndicationListener or IndicationListenerSBLIM. - * - * @param pListener - * The CIMListener (IndicationListener or - * IndicationListenerSBLIM) which receives the CIMEvents to be - * dispatched. - */ - public CIMEventDispatcher(EventListener pListener) { - this(pListener, 0); - } - - /** - * Construct a CIMEventDispatcher object which distributes CIMEvents to the - * appropriate CIMListener. The EventListener must be an instance of - * IndicationListener or IndicationListenerSBLIM. - * - * @param pListener - * The CIMListener (IndicationListener or - * IndicationListenerSBLIM) which receives the CIMEvents to be - * dispatched. - * @param pMaxEvents - * The maximum number of CIMEvents waiting to be dispatched. - */ - public CIMEventDispatcher(EventListener pListener, int pMaxEvents) { - if (!(pListener instanceof IndicationListener) - && !(pListener instanceof IndicationListenerSBLIM)) throw new IllegalArgumentException( - "Listener must be instance of IndicationListener or IndicationListenerSBLIM"); - this.iListener = pListener; - this.iMaxEvents = pMaxEvents; - setDaemon(true); - setName("CIMEventDispatcher"); - start(); - } - - /** - * Propagates the CIMEvent to the event consumers. - * - * @param pEvent - * The CIMEvent to be dispatched. - */ - public synchronized void dispatchEvent(CIMEvent pEvent) { - - if (pEvent != null) { - if (this.iMaxEvents > 0) { - int size = this.iEventQueue.size(); - if (size >= this.iMaxEvents) { - for (int i = size - this.iMaxEvents + 1; i > 0; i--) { - CIMEvent event = this.iEventQueue.remove(0); - this.iLogger.trace(Level.FINE, "Deleted CIMEvent (id=" + event.getID() - + ") from the queue (maximum size of " + this.iMaxEvents - + " reached)"); - } - } - } - this.iEventQueue.add(pEvent); - this.iLogger.trace(Level.FINE, "Added CIMEvent (id=" + pEvent.getID() - + ") to the queue (" + this.iEventQueue.size() + " elements total)"); - notify(); - } else { - this.iLogger.trace(Level.WARNING, "CIMEvent to dispatch was null"); - } - } - - /** - * Starts the dispatching engine of the CIMEventDispatcher. - * - */ - public synchronized void startup() { - this.iAlive = true; - start(); - } - - /** - * Stops the dispatching of events. - */ - public synchronized void kill() { - this.iAlive = false; - notify(); - } - - /** - * close - */ - public synchronized void close() { - kill(); - } - - private synchronized CIMEvent getEvent() { - CIMEvent event = null; - while (event == null) { - try { - if (this.iEventQueue.size() == 0) wait(); - } catch (InterruptedException e) { /**/} - if (!this.iAlive) break; - if (this.iEventQueue.size() > 0) { - event = this.iEventQueue.remove(0); - this.iLogger.trace(Level.FINER, "Removed CIMEvent (id=" + event.getID() - + ") from the queue (" + this.iEventQueue.size() + " elements left)"); - } - } - return event; - } - - @Override - public void run() { - while (this.iAlive) { - try { - CIMEvent event = getEvent(); - if (event != null) { - this.iLogger.trace(Level.FINER, "Processing CIMEvent (id=" + event.getID() - + ")"); - try { - if (this.iListener instanceof IndicationListener) ((IndicationListener) this.iListener) - .indicationOccured(event.getID(), event.getIndication()); - else // if instanceof IndicationListenerSBLIM) - ((IndicationListenerSBLIM) this.iListener).indicationOccured(event.getID(), - event.getIndication(), event.getInetAddress()); - } catch (Throwable t) { - this.iLogger.trace(Level.FINE, "Exception caught in listener (" - + this.iListener.getClass().getName() - + ") while processing CIMEvent", t); - } - } - } catch (Throwable t) { - this.iLogger.trace(Level.FINE, "Exception in event dispatcher loop", t); - } - } - } -} +/* + CIMEventDispatcher.java + + (C) Copyright IBM Corp. 2005, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1498927 2006-06-01 lupusalex Fill gaps in logging coverage + * 1535756 2006-08-07 lupusalex Make code warning free + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 3477087 2012-01-23 blaschke-oss Need Access to an Indication Sender's IP Address + * 2628 2013-03-26 blaschke-oss Limit size of LinkedList of CIMEvents to be dispatched + */ +package org.metricshub.wbem.sblim.cimclient.internal.wbem.indications; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.EventListener; +import java.util.LinkedList; +import java.util.logging.Level; + +import org.metricshub.wbem.javax.wbem.listener.IndicationListener; +import org.metricshub.wbem.sblim.cimclient.IndicationListenerSBLIM; +import org.metricshub.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; + +/** + * Class CIMEventDispatcher is required for indication handling. + * + */ +public class CIMEventDispatcher extends Thread { + + protected LinkedList iEventQueue = new LinkedList(); + + protected EventListener iListener = null; + + private boolean iAlive = true; + + private int iMaxEvents = 0; + + private LogAndTraceBroker iLogger = LogAndTraceBroker.getBroker(); + + /** + * Construct a CIMEventDispatcher object which distributes CIMEvents to the + * appropriate CIMListener. The EventListener must be an instance of + * IndicationListener or IndicationListenerSBLIM. + * + * @param pListener + * The CIMListener (IndicationListener or + * IndicationListenerSBLIM) which receives the CIMEvents to be + * dispatched. + */ + public CIMEventDispatcher(EventListener pListener) { + this(pListener, 0); + } + + /** + * Construct a CIMEventDispatcher object which distributes CIMEvents to the + * appropriate CIMListener. The EventListener must be an instance of + * IndicationListener or IndicationListenerSBLIM. + * + * @param pListener + * The CIMListener (IndicationListener or + * IndicationListenerSBLIM) which receives the CIMEvents to be + * dispatched. + * @param pMaxEvents + * The maximum number of CIMEvents waiting to be dispatched. + */ + public CIMEventDispatcher(EventListener pListener, int pMaxEvents) { + if (!(pListener instanceof IndicationListener) + && !(pListener instanceof IndicationListenerSBLIM)) throw new IllegalArgumentException( + "Listener must be instance of IndicationListener or IndicationListenerSBLIM"); + this.iListener = pListener; + this.iMaxEvents = pMaxEvents; + setDaemon(true); + setName("CIMEventDispatcher"); + start(); + } + + /** + * Propagates the CIMEvent to the event consumers. + * + * @param pEvent + * The CIMEvent to be dispatched. + */ + public synchronized void dispatchEvent(CIMEvent pEvent) { + + if (pEvent != null) { + if (this.iMaxEvents > 0) { + int size = this.iEventQueue.size(); + if (size >= this.iMaxEvents) { + for (int i = size - this.iMaxEvents + 1; i > 0; i--) { + CIMEvent event = this.iEventQueue.remove(0); + this.iLogger.trace(Level.FINE, "Deleted CIMEvent (id=" + event.getID() + + ") from the queue (maximum size of " + this.iMaxEvents + + " reached)"); + } + } + } + this.iEventQueue.add(pEvent); + this.iLogger.trace(Level.FINE, "Added CIMEvent (id=" + pEvent.getID() + + ") to the queue (" + this.iEventQueue.size() + " elements total)"); + notify(); + } else { + this.iLogger.trace(Level.WARNING, "CIMEvent to dispatch was null"); + } + } + + /** + * Starts the dispatching engine of the CIMEventDispatcher. + * + */ + public synchronized void startup() { + this.iAlive = true; + start(); + } + + /** + * Stops the dispatching of events. + */ + public synchronized void kill() { + this.iAlive = false; + notify(); + } + + /** + * close + */ + public synchronized void close() { + kill(); + } + + private synchronized CIMEvent getEvent() { + CIMEvent event = null; + while (event == null) { + try { + if (this.iEventQueue.size() == 0) wait(); + } catch (InterruptedException e) { /**/} + if (!this.iAlive) break; + if (this.iEventQueue.size() > 0) { + event = this.iEventQueue.remove(0); + this.iLogger.trace(Level.FINER, "Removed CIMEvent (id=" + event.getID() + + ") from the queue (" + this.iEventQueue.size() + " elements left)"); + } + } + return event; + } + + @Override + public void run() { + while (this.iAlive) { + try { + CIMEvent event = getEvent(); + if (event != null) { + this.iLogger.trace(Level.FINER, "Processing CIMEvent (id=" + event.getID() + + ")"); + try { + if (this.iListener instanceof IndicationListener) ((IndicationListener) this.iListener) + .indicationOccured(event.getID(), event.getIndication()); + else // if instanceof IndicationListenerSBLIM) + ((IndicationListenerSBLIM) this.iListener).indicationOccured(event.getID(), + event.getIndication(), event.getInetAddress()); + } catch (Throwable t) { + this.iLogger.trace(Level.FINE, "Exception caught in listener (" + + this.iListener.getClass().getName() + + ") while processing CIMEvent", t); + } + } + } catch (Throwable t) { + this.iLogger.trace(Level.FINE, "Exception in event dispatcher loop", t); + } + } + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/indications/CIMIndicationHandler.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/indications/CIMIndicationHandler.java similarity index 89% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/indications/CIMIndicationHandler.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/indications/CIMIndicationHandler.java index bb955c2..f8a507f 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/indications/CIMIndicationHandler.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/indications/CIMIndicationHandler.java @@ -1,830 +1,829 @@ -/* - (C) Copyright IBM Corp. 2005, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 17931 2005-07-28 thschaef Add InetAddress to CIM Event - * 1438152 2006-05-15 lupusalex Wrong message ID in ExportResponseMessage - * 1498938 2006-06-01 lupusalex Multiple events in single cim-xml request are not handled - * 1498130 2006-05-31 lupusalex Selection of xml parser on a per connection basis - * 1535756 2006-08-07 lupusalex Make code warning free - * 1565892 2006-11-16 lupusalex Make SBLIM client JSR48 compliant - * 1656285 2007-02-12 ebak IndicationHandler does not accept non-Integer message ID - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2714989 2009-03-26 blaschke-oss Code cleanup from redundant null check et al - * 2901216 2009-12-01 blaschke-oss lost IndicationURL for IndcationListener.indicationOccured - * 3185818 2011-02-18 blaschke-oss indicationOccured URL incorrect - * 3186176 2011-02-18 blaschke-oss XML response for indication not traced - * 3185763 2011-02-25 blaschke-oss Reliable indication support - Phase 1 - * 3288721 2011-05-20 blaschke-oss Need the function of indication reordering - * 3304058 2011-05-20 blaschke-oss Use same date format in change history - * 3304953 2011-05-20 blaschke-oss Indication URL mapped to lower case - * 3374206 2011-07-22 blaschke-oss NullPointerException caused by Indication - * 3376657 2011-07-24 blaschke-oss Get reliable indication properties once - * 3390724 2011-08-12 blaschke-oss Problem with Reliable Indication support in the Listener - * 3459036 2011-12-13 blaschke-oss Linked list for RI queue not efficient for many LDs - * 3485074 2012-02-06 blaschke-oss An Indication trace request - * 3484022 2012-02-08 blaschke-oss Turn reliable indication mode on and off based on SC/SN - * 3492214 2012-02-23 blaschke-oss Add a SenderIPAddress property indications - * 3513228 2012-04-23 blaschke-oss Reliable Indications support can create lots of threads - * 3553858 2012-08-06 blaschke-oss Append duplicate HTTP header fields instead of replace - * 3554738 2012-08-16 blaschke-oss dump CIM xml by LogAndTraceBroker.trace() - * 3601894 2013-01-23 blaschke-oss Enhance HTTP and CIM-XML tracing - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.indications; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.net.InetAddress; -import java.util.ArrayList; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.Map; -import java.util.Set; -import java.util.Vector; -import java.util.Map.Entry; -import java.util.logging.Level; - -import org.sentrysoftware.wbem.javax.cim.CIMDataType; -import org.sentrysoftware.wbem.javax.cim.CIMInstance; -import org.sentrysoftware.wbem.javax.cim.CIMProperty; -import org.sentrysoftware.wbem.javax.wbem.WBEMException; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.ParserConfigurationException; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.CIMClientXML_HelperImpl; -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.CIMRequest; -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.CIMXMLBuilderImpl; -import org.sentrysoftware.wbem.sblim.cimclient.internal.cimxml.CIMXMLParserImpl; -import org.sentrysoftware.wbem.sblim.cimclient.internal.http.HttpContentHandler; -import org.sentrysoftware.wbem.sblim.cimclient.internal.http.HttpException; -import org.sentrysoftware.wbem.sblim.cimclient.internal.http.HttpHeader; -import org.sentrysoftware.wbem.sblim.cimclient.internal.http.HttpHeaderParser; -import org.sentrysoftware.wbem.sblim.cimclient.internal.http.MessageReader; -import org.sentrysoftware.wbem.sblim.cimclient.internal.http.MessageWriter; -import org.sentrysoftware.wbem.sblim.cimclient.internal.http.HttpHeader.HeaderEntry; -import org.sentrysoftware.wbem.sblim.cimclient.internal.http.io.DebugInputStream; -import org.sentrysoftware.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; -import org.sentrysoftware.wbem.sblim.cimclient.internal.util.WBEMConfiguration; -import org.sentrysoftware.wbem.sblim.cimclient.internal.util.WBEMConfigurationDefaults; -import org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.CIMError; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.xml.sax.InputSource; - -/** - * Handles the HTTP connections, providing the necessary interfaces for - * CIMListener server. - */ -public class CIMIndicationHandler extends HttpContentHandler { - - /** - * DataManager is responsible for background processing of the - * reliable indication queue and cache. - */ - private class DataManager extends Thread { - - private boolean iAlive = true; - - private LinkedList iLinkedList; - - private Hashtable iHashTable; - - public DataManager(LinkedList pServerList) { - this.iLinkedList = pServerList; - this.iHashTable = null; - setDaemon(true); - } - - public DataManager(Hashtable pServerTable) { - this.iLinkedList = null; - this.iHashTable = pServerTable; - setDaemon(true); - } - - @Override - public void run() { - while (this.iAlive) { - try { - if (this.iLinkedList != null) { - ServerListEntry entry; - Iterator iterator; - - iterator = this.iLinkedList.iterator(); - while (iterator.hasNext()) { - entry = iterator.next(); - IndicationServer server = entry.getIndicationServer(); - if (server != null) { - ReliableIndicationHandler handler = server.getRIHandler(); - if (handler != null) { - handler.processAll(); - } - } - } - } else if (this.iHashTable != null) { - Map.Entry entry; - Iterator> iterator; - - Set> set = this.iHashTable - .entrySet(); - if (set != null) { - iterator = set.iterator(); - while (iterator.hasNext()) { - entry = iterator.next(); - IndicationServer server = entry.getValue(); - if (server != null) { - ReliableIndicationHandler handler = server.getRIHandler(); - if (handler != null) { - handler.processAll(); - } - } - } - } - } - sleep(1000); - } catch (Throwable t) { - // Expected, ignore and try again - } - } - } - - public void stopRun() { - this.iAlive = false; - } - } - - /** - * IndicationServer represents an entry in the linked list or - * hash table of servers handled by this CIMIndicationHandler - * instance. Each entry in the list/table will have a unique - * serverIP/destinationURL pair along with its own - * ReliableIndicationHandler. This is done to handle multiple - * contexts from the same server. - * - * NOTE: Multiple contexts from the same server will not be handled - * correctly if the user creates multiple - * CIM_ListenerDestination instances with the same - * Destination property. While this is poor programming - * practice (two different instances with same pertinent information), the - * real issue is that there is no way for the Client to differentiate - * between a context switch and two different contexts if the - * serverIP/destinationURL are the same. This issue it is not covered by - * DSP1054 1.2. - */ - private class IndicationServer { - - private boolean iRIInitialized = false; - - private ReliableIndicationHandler iRIHandler; - - public IndicationServer() { - // initialize() does the work - } - - public void initialize(ReliableIndicationHandler pRIHandler) { - this.iRIInitialized = true; - this.iRIHandler = pRIHandler; - } - - public boolean isInitialized() { - return this.iRIInitialized; - } - - public ReliableIndicationHandler getRIHandler() { - return this.iRIHandler; - } - } - - /** - * ServerListEntry represents a physical entry within the - * linked list. An IndicationServer instance is extracted from - * the linked list by proceeding through each entry in the linked list - * looking for the corresponding server IP and destination URL. - */ - private class ServerListEntry { - - private InetAddress iInetAddress; - - private String iDestinationUrl; - - private IndicationServer iIndicationServer; - - public ServerListEntry(InetAddress pInetAddress, String pDestinationUrl) { - this.iInetAddress = pInetAddress; - this.iDestinationUrl = pDestinationUrl; - this.iIndicationServer = new IndicationServer(); - } - - public InetAddress getInetAddress() { - return this.iInetAddress; - } - - public String getDestinationUrl() { - return this.iDestinationUrl; - } - - public IndicationServer getIndicationServer() { - return this.iIndicationServer; - } - } - - /** - * ServerTableEntry represents a physical key within the hash - * table while the corresponding IndicationServer is the value - * associated with the key. The hash table key is comprised of a server IP - * and destination URL. - */ - private class ServerTableEntry { - - private InetAddress iInetAddress; - - private String iDestinationUrl; - - public ServerTableEntry(InetAddress pInetAddress, String pDestinationUrl) { - this.iInetAddress = pInetAddress; - this.iDestinationUrl = pDestinationUrl; - } - - public InetAddress getInetAddress() { - return this.iInetAddress; - } - - public String getDestinationUrl() { - return this.iDestinationUrl; - } - - @Override - public boolean equals(Object pObj) { - if (!(pObj instanceof ServerTableEntry)) return false; - ServerTableEntry that = (ServerTableEntry) pObj; - if (this.iInetAddress.equals(that.getInetAddress()) - && this.iDestinationUrl.equalsIgnoreCase(that.getDestinationUrl())) return true; - return false; - } - - @Override - public int hashCode() { - return (this.iInetAddress.hashCode()) ^ (this.iDestinationUrl.hashCode()); - } - } - - private CIMEventDispatcher iDispatcher = null; - - private int iMessageId = 0; - - private LogAndTraceBroker iLogger = LogAndTraceBroker.getBroker(); - - private WBEMConfiguration iSessionProperties; - - private boolean iReliableIndicationsDisabled = true; - - private int iHashtableCapacity = 0; // 0 -> linked list, >0 -> hash table - - private LinkedList iServerList; - - private Hashtable iServerTable; - - private String iIndicationTraceClass; - - private String iIndicationTraceProperties[]; - - private boolean iAddSenderIPAddress; - - private DataManager iDataManagerThread; - - /** - * Ctor. - * - * @param pDispatcher - */ - public CIMIndicationHandler(CIMEventDispatcher pDispatcher) { - this(pDispatcher, null); - } - - /** - * Ctor. - * - * @param pDispatcher - * @param pProperties - */ - public CIMIndicationHandler(CIMEventDispatcher pDispatcher, WBEMConfiguration pProperties) { - this.iDispatcher = pDispatcher; - this.iSessionProperties = (pProperties != null) ? pProperties : WBEMConfiguration - .getGlobalConfiguration(); - this.iReliableIndicationsDisabled = !this.iSessionProperties.isReliableIndicationEnabled(); - - // Initialize reliable indication support - if (!this.iReliableIndicationsDisabled) { - this.iHashtableCapacity = this.iSessionProperties - .getReliableIndicationHashtableCapacity(); - - // Validate ReliableIndicationHashtableCapacity property - if (this.iHashtableCapacity < 0 || this.iHashtableCapacity > 25000) { - this.iLogger.trace(Level.FINE, "ReliableIndicationHashtableCapacity of " - + this.iHashtableCapacity + " outside range, using default value"); - - this.iHashtableCapacity = Integer.valueOf( - WBEMConfigurationDefaults.LISTENER_RELIABLE_INDICATION_HASHTABLE_CAPACITY) - .intValue(); - } - - if (this.iHashtableCapacity == 0) { - this.iServerList = new LinkedList(); - this.iDataManagerThread = new DataManager(this.iServerList); - } else { - this.iServerTable = new Hashtable( - this.iHashtableCapacity); - this.iDataManagerThread = new DataManager(this.iServerTable); - } - - this.iDataManagerThread.start(); - } - - // Initialize indication trace, if any - String filter = this.iSessionProperties.getListenerIndicationTraceFilter(); - if (filter != null && filter.trim().length() > 0) { - // Format: [class:]property[,property]* - String properties; - - int colon = filter.indexOf(':'); - if (colon == -1) { - this.iIndicationTraceClass = null; - properties = filter; - } else { - this.iIndicationTraceClass = filter.substring(0, colon).trim().toLowerCase(); - properties = filter.substring(colon + 1).trim(); - } - - String[] props = properties.split(","); - if (props != null && props.length > 0) { - ArrayList a = new ArrayList(); - - for (int i = 0; i < props.length; i++) { - String prop = props[i].trim().toLowerCase(); - if (prop != null && prop.length() > 0) { - a.add(prop); - } - } - - if (a.size() > 0) { - this.iIndicationTraceProperties = a.toArray(new String[0]); - - if (this.iLogger.isLoggableTrace(Level.INFO)) { - StringBuilder msg = new StringBuilder( - "Indication trace enabled: class filter="); - - if (this.iIndicationTraceClass != null) { - msg.append("\""); - msg.append(this.iIndicationTraceClass); - msg.append("\""); - } else { - msg.append(""); - } - msg.append(", properties="); - for (int i = 0; i < this.iIndicationTraceProperties.length; i++) { - if (i > 0) msg.append(","); - msg.append("\""); - msg.append(this.iIndicationTraceProperties[i]); - msg.append("\""); - } - this.iLogger.trace(Level.INFO, msg.toString()); - } - } else { - this.iIndicationTraceProperties = null; - } - } - } - - this.iAddSenderIPAddress = this.iSessionProperties.getListenerAddSenderIPAddress(); - } - - @Override - protected void finalize() throws Throwable { - try { - close(); - } finally { - super.finalize(); - } - } - - @Override - public void close() { - if (this.iDataManagerThread != null) { - this.iDataManagerThread.stopRun(); - this.iDataManagerThread = null; - } - if (this.iDispatcher != null) { - this.iDispatcher.close(); - this.iDispatcher = null; - } - } - - /** - * getMsgID - * - * @return int - */ - public synchronized int getMsgID() { - this.iMessageId++; - if (this.iMessageId > 1000000) this.iMessageId = 0; - return this.iMessageId; - } - - private static HttpHeader processHeader(HttpHeader pHeader, MessageWriter pWriter) - throws HttpException { - - HttpHeader header = processHttpExtensions(pHeader); - String cimExport = header.getField("CIMExport"); - String cimOperation = header.getField("CIMOperation"); - - if (cimOperation != null && !"METHODCALL".equalsIgnoreCase(cimOperation)) { - pWriter.getHeader().addField("CIMError", "unsupported-operation"); - throw new HttpException(400, "Bad Request"); - } - if (cimExport != null && !"METHODREQUEST".equalsIgnoreCase(cimExport) - && !"EXPORTMETHODCALL".equalsIgnoreCase(cimExport)) { - pWriter.getHeader().addField("CIMError", "unsupported-operation"); - throw new HttpException(400, "Bad Request"); - } - if (cimOperation == null && cimExport == null) { - // TODO: verify the status returned by the server for this - // situation, is not defined on the spec - pWriter.getHeader().addField("CIMError", "unsupported-operation"); - throw new HttpException(400, "Bad Request"); - } - - return header; - } - - @Override - public void handleContent(MessageReader pReader, MessageWriter pWriter, - InetAddress pInetAddress, String pLocalAddress) throws HttpException, IOException { - - CIMError error = null; - - // TODO validate CIMHeaders! - HttpHeader inputHeader = pReader.getHeader(); - inputHeader = processHeader(inputHeader, pWriter); - LogAndTraceBroker.getBroker().trace(Level.FINER, - "Indication Request HTTP Headers= " + inputHeader.toString()); - String cimMethod = inputHeader.getField("CIMMethod"); - String cimExport = inputHeader.getField("CIMExport"); - - CIMRequest request = null; - CIMClientXML_HelperImpl xmlHelper = null; - - try { - xmlHelper = new CIMClientXML_HelperImpl(); - } catch (ParserConfigurationException e1) { - IOException e = new IOException("ParserConfigurationException"); - e.initCause(e1); - throw e; - } - - InputStream inputstream = null; - if ((this.iSessionProperties.isCimXmlTracingEnabled() && LogAndTraceBroker.getBroker() - .getXmlTraceStream() != null) - || LogAndTraceBroker.getBroker().isLoggableCIMXMLTrace(Level.FINEST)) { - inputstream = new DebugInputStream(pReader.getInputStream(), LogAndTraceBroker - .getBroker().getXmlTraceStream(), "indication request"); - } else { - inputstream = pReader.getInputStream(); - } - - request = parseDocument(xmlHelper, pReader, inputstream); - - if (request == null) throw new HttpException(400, "Bad Request"); - - if ((cimExport == null && !cimMethod.equalsIgnoreCase("Indication")) - || !request.isCIMExport()) { throw new HttpException(400, "Bad Request"); } - - error = dispatchIndications(pReader, pInetAddress, pLocalAddress, request); - - buildResponse(xmlHelper, pWriter, request, error); - } - - private CIMRequest parseDocument(CIMClientXML_HelperImpl xmlHelper, MessageReader pReader, - InputStream inputstream) throws HttpException { - - // TODO: integrate SAX parser and DOM parser - - Document doc = null; - try { - - doc = xmlHelper.parse(new InputSource(new InputStreamReader(inputstream, pReader - .getCharacterEncoding()))); - Element rootE = doc.getDocumentElement(); - return (CIMRequest) CIMXMLParserImpl.parseCIM(rootE); - } catch (Exception e) { - this.iLogger.trace(Level.WARNING, "exception while parsing the XML with DOM parser", e); - throw new HttpException(400, "Bad Request"); - } - } - - /** - * Returns the corresponding indication server if the server is already - * present in the linked list, otherwise appends the server to the linked - * list and returns the new entry. - * - * @param pInetAddress - * Address of indication server. - * @param pDestinationUrl - * Destination URL of indication. - * @return IndicationServer with given address. - */ - private IndicationServer getIndicationServerFromList(InetAddress pInetAddress, - String pDestinationUrl) { - ServerListEntry entry; - Iterator iterator = this.iServerList.iterator(); - while (iterator.hasNext()) { - entry = iterator.next(); - if (entry.getInetAddress().equals(pInetAddress) - && entry.getDestinationUrl().equalsIgnoreCase(pDestinationUrl)) return entry - .getIndicationServer(); - } - entry = new ServerListEntry(pInetAddress, pDestinationUrl); - this.iServerList.add(entry); - this.iLogger.trace(Level.FINE, "Creating reliable indication handler for server IP " - + entry.getInetAddress().toString() + ", destination URL " - + entry.getDestinationUrl() + " in linked list"); - - return entry.getIndicationServer(); - } - - /** - * Returns the corresponding indication server if the server is already - * present in the hash table, otherwise adds the server to the hash table - * and returns the new entry. - * - * @param pInetAddress - * Address of indication server. - * @param pDestinationUrl - * Destination URL of indication. - * @return IndicationServer with given address. - */ - private IndicationServer getIndicationServerFromTable(InetAddress pInetAddress, - String pDestinationUrl) { - ServerTableEntry key; - IndicationServer server; - - key = new ServerTableEntry(pInetAddress, pDestinationUrl); - server = this.iServerTable.get(key); - if (server == null) { - server = new IndicationServer(); - this.iServerTable.put(key, server); - this.iLogger.trace(Level.FINE, "Creating reliable indication handler for server IP " - + key.getInetAddress().toString() + ", destination URL " - + key.getDestinationUrl() + " in hash table"); - } - return server; - } - - /** - * deliverIndication handles reliable indications and returns a boolean - * indicating whether the indication should be delivered or not - * - * @param pIndication - * Indication. - * @param pId - * Indication destination URL. - * @param pInetAddress - * Indication server IP. - * @return true if indication should be delivered, - * false if ReliableIndicationHandler will - * deliver indication - */ - private synchronized boolean deliverIndication(CIMInstance pIndication, String pId, - InetAddress pInetAddress) { - IndicationServer server; - - // Each serverIP/destinationURL pair needs its own - // ReliableIndicationHandler in order to handle multiple contexts - if (this.iHashtableCapacity == 0) { - server = getIndicationServerFromList(pInetAddress, pId); - } else { - server = getIndicationServerFromTable(pInetAddress, pId); - } - - // Initialize if not yet done so - if (!server.isInitialized()) { - // Validate DeliveryRetryAttempts property - long attempts = this.iSessionProperties.getListenerDeliveryRetryAttempts(); - if (attempts <= 0 || attempts > 1000) { - this.iLogger.trace(Level.FINE, "DeliveryRetryAttempts of " + attempts - + " outside range, using default value"); - - attempts = Long.valueOf(WBEMConfigurationDefaults.LISTENER_DELIVERY_RETRY_ATTEMPTS) - .longValue(); - } - - // Validate DeliveryRetryInterval property - long interval = this.iSessionProperties.getListenerDeliveryRetryInterval(); - if (interval <= 0 || interval > 86400) { - this.iLogger.trace(Level.FINE, "DeliveryRetryInterval of " + interval - + " outside range, using default value"); - - interval = Long.valueOf(WBEMConfigurationDefaults.LISTENER_DELIVERY_RETRY_INTERVAL) - .longValue(); - } - - // Create new ReliableIndicationHandler for this - // CIMIndicationHandler - server.initialize(new ReliableIndicationHandler(this.iDispatcher, attempts * interval - * 10 * 1000)); - - this.iLogger - .trace(Level.FINE, "Reliable indication support enabled for IP " - + pInetAddress.getHostAddress() + " and URL " + pId - + ", DeliveryRetryAttempts=" + attempts + ", DeliveryRetryInterval=" - + interval); - } - - // Let ReliableIndicationHandler deliver it - server.getRIHandler().handleIndication(pIndication, pId, pInetAddress); - return false; - } - - private CIMError dispatchIndications(MessageReader pReader, InetAddress pInetAddress, - String pLocalAddress, CIMRequest request) { - try { - Vector paramValue = request.getParamValue(); - Iterator iter = paramValue.iterator(); - while (iter.hasNext()) { - Object cimEvent = iter.next(); - if (cimEvent instanceof CIMInstance) { - CIMInstance indicationInst = (CIMInstance) cimEvent; - - String path = pReader.getMethod().getFile(); - String id; - - if (path == null) { - id = pLocalAddress + "/"; - } else if (path.equalsIgnoreCase("/cimom")) { - id = path; - } else if (path.length() < 4 || !path.regionMatches(true, 0, "http", 0, 4)) { - if (path.startsWith("/")) { - id = pLocalAddress + path; - } else { - id = pLocalAddress + "/" + path; - } - } else /* path.startsWith("http") */{ - id = path; - } - - // Add SenderIPAddress property if enabled - if (this.iAddSenderIPAddress) { - int size = indicationInst.getPropertyCount(); - CIMProperty props[] = new CIMProperty[size + 1]; - for (int i = 0; i < size; i++) - props[i] = indicationInst.getProperty(i); - props[size] = new CIMProperty("SBLIMJCC_SenderIPAddress", - CIMDataType.STRING_T, pInetAddress.getHostAddress()); - indicationInst = new CIMInstance(indicationInst.getObjectPath(), props); - } - - // Do any user-requested indication tracing here - if (this.iIndicationTraceProperties != null - && this.iLogger.isLoggableTrace(Level.FINE) - && (this.iIndicationTraceClass == null || indicationInst.getClassName() - .toLowerCase().indexOf(this.iIndicationTraceClass) != -1)) { - StringBuilder msg = new StringBuilder("Received indication "); - msg.append(indicationInst.getClassName()); - msg.append(" from IP="); - String inet = pInetAddress.getHostAddress(); - msg.append(inet != null ? inet : ""); - msg.append(" to URL="); - msg.append(id); - msg.append(" with properties:"); - for (int i = 0; i < this.iIndicationTraceProperties.length; i++) { - msg.append(" "); - CIMProperty prop = indicationInst - .getProperty(this.iIndicationTraceProperties[i]); - if (prop == null) { - msg.append(this.iIndicationTraceProperties[i]); - msg.append(" not a property;"); - } else { - Object value = prop.getValue(); - if (value == null) { - msg.append(prop.getName()); - msg.append(" = ;"); - } else { - msg.append(prop.toString().trim()); - } - } - } - this.iLogger.trace(Level.FINE, msg.toString()); - } - - if (this.iReliableIndicationsDisabled - || deliverIndication(indicationInst, id, pInetAddress)) { - this.iDispatcher.dispatchEvent(new CIMEvent(indicationInst, id, - pInetAddress)); - } - } - } - return null; - } catch (Exception e) { - return new CIMError(new WBEMException(WBEMException.CIM_ERR_FAILED, "CIM_ERR_FAILED", - null, e)); - } - } - - private void buildResponse(CIMClientXML_HelperImpl xmlHelper, MessageWriter pWriter, - CIMRequest request, CIMError error) throws HttpException, IOException { - Document responseDoc = null; - try { - DocumentBuilder docBuilder = xmlHelper.getDocumentBuilder(); - responseDoc = docBuilder.newDocument(); - CIMXMLBuilderImpl.createIndication_response(responseDoc, request.getId(), error); - - } catch (Exception e) { - // TODO: check this error code, may not be appropriate - throw new HttpException(400, "Bad Request"); - } - if (this.iSessionProperties.isCimXmlTracingEnabled() - || this.iLogger.isLoggableCIMXMLTrace(Level.FINEST)) { - OutputStream pos = new ByteArrayOutputStream(); - CIMClientXML_HelperImpl.dumpDocument(pos, responseDoc, "indication response"); - OutputStream debugStream = this.iLogger.getXmlTraceStream(); - if (this.iSessionProperties.isCimXmlTracingEnabled() && debugStream != null) debugStream - .write(pos.toString().getBytes()); - if (this.iLogger.isLoggableCIMXMLTrace(Level.FINEST)) this.iLogger.traceCIMXML( - Level.FINEST, pos.toString(), true); - } - CIMClientXML_HelperImpl.serialize(pWriter.getOutputStream(), responseDoc); - pWriter.getHeader().addField("CIMExport", "MethodResponse"); - } - - private static HttpHeader processHttpExtensions(HttpHeader pOriginalHeader) { - String man = pOriginalHeader.getField("Man"); - String opt = pOriginalHeader.getField("Opt"); - HttpHeader headers = new HttpHeader(); - String ns = null; - - HttpHeaderParser manOptHeader = null; - if (man != null && man.length() > 0) manOptHeader = new HttpHeaderParser(man); - else if (opt != null && opt.length() > 0) manOptHeader = new HttpHeaderParser(opt); - if (manOptHeader != null) ns = manOptHeader.getValue("ns"); - - if (ns != null) { - - Iterator> iter = pOriginalHeader.iterator(); - String key; - while (iter.hasNext()) { - Entry entry = iter.next(); - if (entry != null) { - key = entry.getKey().toString(); - if (key.startsWith(ns + "-")) headers.addParsedField(key.substring(3), entry - .getValue().toString()); - else headers.addParsedField(key, entry.getValue().toString()); - } - } - } else { - headers = pOriginalHeader; - } - - return headers; - } - -} +/* + (C) Copyright IBM Corp. 2005, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 17931 2005-07-28 thschaef Add InetAddress to CIM Event + * 1438152 2006-05-15 lupusalex Wrong message ID in ExportResponseMessage + * 1498938 2006-06-01 lupusalex Multiple events in single cim-xml request are not handled + * 1498130 2006-05-31 lupusalex Selection of xml parser on a per connection basis + * 1535756 2006-08-07 lupusalex Make code warning free + * 1565892 2006-11-16 lupusalex Make SBLIM client JSR48 compliant + * 1656285 2007-02-12 ebak IndicationHandler does not accept non-Integer message ID + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2714989 2009-03-26 blaschke-oss Code cleanup from redundant null check et al + * 2901216 2009-12-01 blaschke-oss lost IndicationURL for IndcationListener.indicationOccured + * 3185818 2011-02-18 blaschke-oss indicationOccured URL incorrect + * 3186176 2011-02-18 blaschke-oss XML response for indication not traced + * 3185763 2011-02-25 blaschke-oss Reliable indication support - Phase 1 + * 3288721 2011-05-20 blaschke-oss Need the function of indication reordering + * 3304058 2011-05-20 blaschke-oss Use same date format in change history + * 3304953 2011-05-20 blaschke-oss Indication URL mapped to lower case + * 3374206 2011-07-22 blaschke-oss NullPointerException caused by Indication + * 3376657 2011-07-24 blaschke-oss Get reliable indication properties once + * 3390724 2011-08-12 blaschke-oss Problem with Reliable Indication support in the Listener + * 3459036 2011-12-13 blaschke-oss Linked list for RI queue not efficient for many LDs + * 3485074 2012-02-06 blaschke-oss An Indication trace request + * 3484022 2012-02-08 blaschke-oss Turn reliable indication mode on and off based on SC/SN + * 3492214 2012-02-23 blaschke-oss Add a SenderIPAddress property indications + * 3513228 2012-04-23 blaschke-oss Reliable Indications support can create lots of threads + * 3553858 2012-08-06 blaschke-oss Append duplicate HTTP header fields instead of replace + * 3554738 2012-08-16 blaschke-oss dump CIM xml by LogAndTraceBroker.trace() + * 3601894 2013-01-23 blaschke-oss Enhance HTTP and CIM-XML tracing + */ + +package org.metricshub.wbem.sblim.cimclient.internal.wbem.indications; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.net.InetAddress; +import java.util.ArrayList; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.Map; +import java.util.Set; +import java.util.Vector; +import java.util.Map.Entry; +import java.util.logging.Level; + +import org.metricshub.wbem.javax.cim.CIMDataType; +import org.metricshub.wbem.javax.cim.CIMInstance; +import org.metricshub.wbem.javax.wbem.WBEMException; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.CIMClientXML_HelperImpl; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.CIMRequest; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.CIMXMLBuilderImpl; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.CIMXMLParserImpl; +import org.metricshub.wbem.sblim.cimclient.internal.http.HttpHeader; +import org.metricshub.wbem.sblim.cimclient.internal.http.HttpHeaderParser; +import org.metricshub.wbem.sblim.cimclient.internal.http.MessageReader; +import org.metricshub.wbem.sblim.cimclient.internal.http.MessageWriter; +import org.metricshub.wbem.sblim.cimclient.internal.http.HttpHeader.HeaderEntry; +import org.metricshub.wbem.sblim.cimclient.internal.http.io.DebugInputStream; +import org.metricshub.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; +import org.metricshub.wbem.sblim.cimclient.internal.util.WBEMConfiguration; +import org.metricshub.wbem.sblim.cimclient.internal.util.WBEMConfigurationDefaults; +import org.metricshub.wbem.sblim.cimclient.internal.wbem.CIMError; +import org.metricshub.wbem.javax.cim.CIMProperty; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.ParserConfigurationException; + +import org.metricshub.wbem.sblim.cimclient.internal.http.HttpContentHandler; +import org.metricshub.wbem.sblim.cimclient.internal.http.HttpException; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.xml.sax.InputSource; + +/** + * Handles the HTTP connections, providing the necessary interfaces for + * CIMListener server. + */ +public class CIMIndicationHandler extends HttpContentHandler { + + /** + * DataManager is responsible for background processing of the + * reliable indication queue and cache. + */ + private class DataManager extends Thread { + + private boolean iAlive = true; + + private LinkedList iLinkedList; + + private Hashtable iHashTable; + + public DataManager(LinkedList pServerList) { + this.iLinkedList = pServerList; + this.iHashTable = null; + setDaemon(true); + } + + public DataManager(Hashtable pServerTable) { + this.iLinkedList = null; + this.iHashTable = pServerTable; + setDaemon(true); + } + + @Override + public void run() { + while (this.iAlive) { + try { + if (this.iLinkedList != null) { + ServerListEntry entry; + Iterator iterator; + + iterator = this.iLinkedList.iterator(); + while (iterator.hasNext()) { + entry = iterator.next(); + IndicationServer server = entry.getIndicationServer(); + if (server != null) { + ReliableIndicationHandler handler = server.getRIHandler(); + if (handler != null) { + handler.processAll(); + } + } + } + } else if (this.iHashTable != null) { + Map.Entry entry; + Iterator> iterator; + + Set> set = this.iHashTable + .entrySet(); + if (set != null) { + iterator = set.iterator(); + while (iterator.hasNext()) { + entry = iterator.next(); + IndicationServer server = entry.getValue(); + if (server != null) { + ReliableIndicationHandler handler = server.getRIHandler(); + if (handler != null) { + handler.processAll(); + } + } + } + } + } + sleep(1000); + } catch (Throwable t) { + // Expected, ignore and try again + } + } + } + + public void stopRun() { + this.iAlive = false; + } + } + + /** + * IndicationServer represents an entry in the linked list or + * hash table of servers handled by this CIMIndicationHandler + * instance. Each entry in the list/table will have a unique + * serverIP/destinationURL pair along with its own + * ReliableIndicationHandler. This is done to handle multiple + * contexts from the same server. + * + * NOTE: Multiple contexts from the same server will not be handled + * correctly if the user creates multiple + * CIM_ListenerDestination instances with the same + * Destination property. While this is poor programming + * practice (two different instances with same pertinent information), the + * real issue is that there is no way for the Client to differentiate + * between a context switch and two different contexts if the + * serverIP/destinationURL are the same. This issue it is not covered by + * DSP1054 1.2. + */ + private class IndicationServer { + + private boolean iRIInitialized = false; + + private ReliableIndicationHandler iRIHandler; + + public IndicationServer() { + // initialize() does the work + } + + public void initialize(ReliableIndicationHandler pRIHandler) { + this.iRIInitialized = true; + this.iRIHandler = pRIHandler; + } + + public boolean isInitialized() { + return this.iRIInitialized; + } + + public ReliableIndicationHandler getRIHandler() { + return this.iRIHandler; + } + } + + /** + * ServerListEntry represents a physical entry within the + * linked list. An IndicationServer instance is extracted from + * the linked list by proceeding through each entry in the linked list + * looking for the corresponding server IP and destination URL. + */ + private class ServerListEntry { + + private InetAddress iInetAddress; + + private String iDestinationUrl; + + private IndicationServer iIndicationServer; + + public ServerListEntry(InetAddress pInetAddress, String pDestinationUrl) { + this.iInetAddress = pInetAddress; + this.iDestinationUrl = pDestinationUrl; + this.iIndicationServer = new IndicationServer(); + } + + public InetAddress getInetAddress() { + return this.iInetAddress; + } + + public String getDestinationUrl() { + return this.iDestinationUrl; + } + + public IndicationServer getIndicationServer() { + return this.iIndicationServer; + } + } + + /** + * ServerTableEntry represents a physical key within the hash + * table while the corresponding IndicationServer is the value + * associated with the key. The hash table key is comprised of a server IP + * and destination URL. + */ + private class ServerTableEntry { + + private InetAddress iInetAddress; + + private String iDestinationUrl; + + public ServerTableEntry(InetAddress pInetAddress, String pDestinationUrl) { + this.iInetAddress = pInetAddress; + this.iDestinationUrl = pDestinationUrl; + } + + public InetAddress getInetAddress() { + return this.iInetAddress; + } + + public String getDestinationUrl() { + return this.iDestinationUrl; + } + + @Override + public boolean equals(Object pObj) { + if (!(pObj instanceof ServerTableEntry)) return false; + ServerTableEntry that = (ServerTableEntry) pObj; + if (this.iInetAddress.equals(that.getInetAddress()) + && this.iDestinationUrl.equalsIgnoreCase(that.getDestinationUrl())) return true; + return false; + } + + @Override + public int hashCode() { + return (this.iInetAddress.hashCode()) ^ (this.iDestinationUrl.hashCode()); + } + } + + private CIMEventDispatcher iDispatcher = null; + + private int iMessageId = 0; + + private LogAndTraceBroker iLogger = LogAndTraceBroker.getBroker(); + + private WBEMConfiguration iSessionProperties; + + private boolean iReliableIndicationsDisabled = true; + + private int iHashtableCapacity = 0; // 0 -> linked list, >0 -> hash table + + private LinkedList iServerList; + + private Hashtable iServerTable; + + private String iIndicationTraceClass; + + private String iIndicationTraceProperties[]; + + private boolean iAddSenderIPAddress; + + private DataManager iDataManagerThread; + + /** + * Ctor. + * + * @param pDispatcher + */ + public CIMIndicationHandler(CIMEventDispatcher pDispatcher) { + this(pDispatcher, null); + } + + /** + * Ctor. + * + * @param pDispatcher + * @param pProperties + */ + public CIMIndicationHandler(CIMEventDispatcher pDispatcher, WBEMConfiguration pProperties) { + this.iDispatcher = pDispatcher; + this.iSessionProperties = (pProperties != null) ? pProperties : WBEMConfiguration + .getGlobalConfiguration(); + this.iReliableIndicationsDisabled = !this.iSessionProperties.isReliableIndicationEnabled(); + + // Initialize reliable indication support + if (!this.iReliableIndicationsDisabled) { + this.iHashtableCapacity = this.iSessionProperties + .getReliableIndicationHashtableCapacity(); + + // Validate ReliableIndicationHashtableCapacity property + if (this.iHashtableCapacity < 0 || this.iHashtableCapacity > 25000) { + this.iLogger.trace(Level.FINE, "ReliableIndicationHashtableCapacity of " + + this.iHashtableCapacity + " outside range, using default value"); + + this.iHashtableCapacity = Integer.valueOf( + WBEMConfigurationDefaults.LISTENER_RELIABLE_INDICATION_HASHTABLE_CAPACITY) + .intValue(); + } + + if (this.iHashtableCapacity == 0) { + this.iServerList = new LinkedList(); + this.iDataManagerThread = new DataManager(this.iServerList); + } else { + this.iServerTable = new Hashtable( + this.iHashtableCapacity); + this.iDataManagerThread = new DataManager(this.iServerTable); + } + + this.iDataManagerThread.start(); + } + + // Initialize indication trace, if any + String filter = this.iSessionProperties.getListenerIndicationTraceFilter(); + if (filter != null && filter.trim().length() > 0) { + // Format: [class:]property[,property]* + String properties; + + int colon = filter.indexOf(':'); + if (colon == -1) { + this.iIndicationTraceClass = null; + properties = filter; + } else { + this.iIndicationTraceClass = filter.substring(0, colon).trim().toLowerCase(); + properties = filter.substring(colon + 1).trim(); + } + + String[] props = properties.split(","); + if (props != null && props.length > 0) { + ArrayList a = new ArrayList(); + + for (int i = 0; i < props.length; i++) { + String prop = props[i].trim().toLowerCase(); + if (prop != null && prop.length() > 0) { + a.add(prop); + } + } + + if (a.size() > 0) { + this.iIndicationTraceProperties = a.toArray(new String[0]); + + if (this.iLogger.isLoggableTrace(Level.INFO)) { + StringBuilder msg = new StringBuilder( + "Indication trace enabled: class filter="); + + if (this.iIndicationTraceClass != null) { + msg.append("\""); + msg.append(this.iIndicationTraceClass); + msg.append("\""); + } else { + msg.append(""); + } + msg.append(", properties="); + for (int i = 0; i < this.iIndicationTraceProperties.length; i++) { + if (i > 0) msg.append(","); + msg.append("\""); + msg.append(this.iIndicationTraceProperties[i]); + msg.append("\""); + } + this.iLogger.trace(Level.INFO, msg.toString()); + } + } else { + this.iIndicationTraceProperties = null; + } + } + } + + this.iAddSenderIPAddress = this.iSessionProperties.getListenerAddSenderIPAddress(); + } + + @Override + protected void finalize() throws Throwable { + try { + close(); + } finally { + super.finalize(); + } + } + + @Override + public void close() { + if (this.iDataManagerThread != null) { + this.iDataManagerThread.stopRun(); + this.iDataManagerThread = null; + } + if (this.iDispatcher != null) { + this.iDispatcher.close(); + this.iDispatcher = null; + } + } + + /** + * getMsgID + * + * @return int + */ + public synchronized int getMsgID() { + this.iMessageId++; + if (this.iMessageId > 1000000) this.iMessageId = 0; + return this.iMessageId; + } + + private static HttpHeader processHeader(HttpHeader pHeader, MessageWriter pWriter) + throws HttpException { + + HttpHeader header = processHttpExtensions(pHeader); + String cimExport = header.getField("CIMExport"); + String cimOperation = header.getField("CIMOperation"); + + if (cimOperation != null && !"METHODCALL".equalsIgnoreCase(cimOperation)) { + pWriter.getHeader().addField("CIMError", "unsupported-operation"); + throw new HttpException(400, "Bad Request"); + } + if (cimExport != null && !"METHODREQUEST".equalsIgnoreCase(cimExport) + && !"EXPORTMETHODCALL".equalsIgnoreCase(cimExport)) { + pWriter.getHeader().addField("CIMError", "unsupported-operation"); + throw new HttpException(400, "Bad Request"); + } + if (cimOperation == null && cimExport == null) { + // TODO: verify the status returned by the server for this + // situation, is not defined on the spec + pWriter.getHeader().addField("CIMError", "unsupported-operation"); + throw new HttpException(400, "Bad Request"); + } + + return header; + } + + @Override + public void handleContent(MessageReader pReader, MessageWriter pWriter, + InetAddress pInetAddress, String pLocalAddress) throws HttpException, IOException { + + CIMError error = null; + + // TODO validate CIMHeaders! + HttpHeader inputHeader = pReader.getHeader(); + inputHeader = processHeader(inputHeader, pWriter); + LogAndTraceBroker.getBroker().trace(Level.FINER, + "Indication Request HTTP Headers= " + inputHeader.toString()); + String cimMethod = inputHeader.getField("CIMMethod"); + String cimExport = inputHeader.getField("CIMExport"); + + CIMRequest request = null; + CIMClientXML_HelperImpl xmlHelper = null; + + try { + xmlHelper = new CIMClientXML_HelperImpl(); + } catch (ParserConfigurationException e1) { + IOException e = new IOException("ParserConfigurationException"); + e.initCause(e1); + throw e; + } + + InputStream inputstream = null; + if ((this.iSessionProperties.isCimXmlTracingEnabled() && LogAndTraceBroker.getBroker() + .getXmlTraceStream() != null) + || LogAndTraceBroker.getBroker().isLoggableCIMXMLTrace(Level.FINEST)) { + inputstream = new DebugInputStream(pReader.getInputStream(), LogAndTraceBroker + .getBroker().getXmlTraceStream(), "indication request"); + } else { + inputstream = pReader.getInputStream(); + } + + request = parseDocument(xmlHelper, pReader, inputstream); + + if (request == null) throw new HttpException(400, "Bad Request"); + + if ((cimExport == null && !cimMethod.equalsIgnoreCase("Indication")) + || !request.isCIMExport()) { throw new HttpException(400, "Bad Request"); } + + error = dispatchIndications(pReader, pInetAddress, pLocalAddress, request); + + buildResponse(xmlHelper, pWriter, request, error); + } + + private CIMRequest parseDocument(CIMClientXML_HelperImpl xmlHelper, MessageReader pReader, + InputStream inputstream) throws HttpException { + + // TODO: integrate SAX parser and DOM parser + + Document doc = null; + try { + + doc = xmlHelper.parse(new InputSource(new InputStreamReader(inputstream, pReader + .getCharacterEncoding()))); + Element rootE = doc.getDocumentElement(); + return (CIMRequest) CIMXMLParserImpl.parseCIM(rootE); + } catch (Exception e) { + this.iLogger.trace(Level.WARNING, "exception while parsing the XML with DOM parser", e); + throw new HttpException(400, "Bad Request"); + } + } + + /** + * Returns the corresponding indication server if the server is already + * present in the linked list, otherwise appends the server to the linked + * list and returns the new entry. + * + * @param pInetAddress + * Address of indication server. + * @param pDestinationUrl + * Destination URL of indication. + * @return IndicationServer with given address. + */ + private IndicationServer getIndicationServerFromList(InetAddress pInetAddress, + String pDestinationUrl) { + ServerListEntry entry; + Iterator iterator = this.iServerList.iterator(); + while (iterator.hasNext()) { + entry = iterator.next(); + if (entry.getInetAddress().equals(pInetAddress) + && entry.getDestinationUrl().equalsIgnoreCase(pDestinationUrl)) return entry + .getIndicationServer(); + } + entry = new ServerListEntry(pInetAddress, pDestinationUrl); + this.iServerList.add(entry); + this.iLogger.trace(Level.FINE, "Creating reliable indication handler for server IP " + + entry.getInetAddress().toString() + ", destination URL " + + entry.getDestinationUrl() + " in linked list"); + + return entry.getIndicationServer(); + } + + /** + * Returns the corresponding indication server if the server is already + * present in the hash table, otherwise adds the server to the hash table + * and returns the new entry. + * + * @param pInetAddress + * Address of indication server. + * @param pDestinationUrl + * Destination URL of indication. + * @return IndicationServer with given address. + */ + private IndicationServer getIndicationServerFromTable(InetAddress pInetAddress, + String pDestinationUrl) { + ServerTableEntry key; + IndicationServer server; + + key = new ServerTableEntry(pInetAddress, pDestinationUrl); + server = this.iServerTable.get(key); + if (server == null) { + server = new IndicationServer(); + this.iServerTable.put(key, server); + this.iLogger.trace(Level.FINE, "Creating reliable indication handler for server IP " + + key.getInetAddress().toString() + ", destination URL " + + key.getDestinationUrl() + " in hash table"); + } + return server; + } + + /** + * deliverIndication handles reliable indications and returns a boolean + * indicating whether the indication should be delivered or not + * + * @param pIndication + * Indication. + * @param pId + * Indication destination URL. + * @param pInetAddress + * Indication server IP. + * @return true if indication should be delivered, + * false if ReliableIndicationHandler will + * deliver indication + */ + private synchronized boolean deliverIndication(CIMInstance pIndication, String pId, + InetAddress pInetAddress) { + IndicationServer server; + + // Each serverIP/destinationURL pair needs its own + // ReliableIndicationHandler in order to handle multiple contexts + if (this.iHashtableCapacity == 0) { + server = getIndicationServerFromList(pInetAddress, pId); + } else { + server = getIndicationServerFromTable(pInetAddress, pId); + } + + // Initialize if not yet done so + if (!server.isInitialized()) { + // Validate DeliveryRetryAttempts property + long attempts = this.iSessionProperties.getListenerDeliveryRetryAttempts(); + if (attempts <= 0 || attempts > 1000) { + this.iLogger.trace(Level.FINE, "DeliveryRetryAttempts of " + attempts + + " outside range, using default value"); + + attempts = Long.valueOf(WBEMConfigurationDefaults.LISTENER_DELIVERY_RETRY_ATTEMPTS) + .longValue(); + } + + // Validate DeliveryRetryInterval property + long interval = this.iSessionProperties.getListenerDeliveryRetryInterval(); + if (interval <= 0 || interval > 86400) { + this.iLogger.trace(Level.FINE, "DeliveryRetryInterval of " + interval + + " outside range, using default value"); + + interval = Long.valueOf(WBEMConfigurationDefaults.LISTENER_DELIVERY_RETRY_INTERVAL) + .longValue(); + } + + // Create new ReliableIndicationHandler for this + // CIMIndicationHandler + server.initialize(new ReliableIndicationHandler(this.iDispatcher, attempts * interval + * 10 * 1000)); + + this.iLogger + .trace(Level.FINE, "Reliable indication support enabled for IP " + + pInetAddress.getHostAddress() + " and URL " + pId + + ", DeliveryRetryAttempts=" + attempts + ", DeliveryRetryInterval=" + + interval); + } + + // Let ReliableIndicationHandler deliver it + server.getRIHandler().handleIndication(pIndication, pId, pInetAddress); + return false; + } + + private CIMError dispatchIndications(MessageReader pReader, InetAddress pInetAddress, + String pLocalAddress, CIMRequest request) { + try { + Vector paramValue = request.getParamValue(); + Iterator iter = paramValue.iterator(); + while (iter.hasNext()) { + Object cimEvent = iter.next(); + if (cimEvent instanceof CIMInstance) { + CIMInstance indicationInst = (CIMInstance) cimEvent; + + String path = pReader.getMethod().getFile(); + String id; + + if (path == null) { + id = pLocalAddress + "/"; + } else if (path.equalsIgnoreCase("/cimom")) { + id = path; + } else if (path.length() < 4 || !path.regionMatches(true, 0, "http", 0, 4)) { + if (path.startsWith("/")) { + id = pLocalAddress + path; + } else { + id = pLocalAddress + "/" + path; + } + } else /* path.startsWith("http") */{ + id = path; + } + + // Add SenderIPAddress property if enabled + if (this.iAddSenderIPAddress) { + int size = indicationInst.getPropertyCount(); + CIMProperty props[] = new CIMProperty[size + 1]; + for (int i = 0; i < size; i++) + props[i] = indicationInst.getProperty(i); + props[size] = new CIMProperty("SBLIMJCC_SenderIPAddress", + CIMDataType.STRING_T, pInetAddress.getHostAddress()); + indicationInst = new CIMInstance(indicationInst.getObjectPath(), props); + } + + // Do any user-requested indication tracing here + if (this.iIndicationTraceProperties != null + && this.iLogger.isLoggableTrace(Level.FINE) + && (this.iIndicationTraceClass == null || indicationInst.getClassName() + .toLowerCase().indexOf(this.iIndicationTraceClass) != -1)) { + StringBuilder msg = new StringBuilder("Received indication "); + msg.append(indicationInst.getClassName()); + msg.append(" from IP="); + String inet = pInetAddress.getHostAddress(); + msg.append(inet != null ? inet : ""); + msg.append(" to URL="); + msg.append(id); + msg.append(" with properties:"); + for (int i = 0; i < this.iIndicationTraceProperties.length; i++) { + msg.append(" "); + CIMProperty prop = indicationInst + .getProperty(this.iIndicationTraceProperties[i]); + if (prop == null) { + msg.append(this.iIndicationTraceProperties[i]); + msg.append(" not a property;"); + } else { + Object value = prop.getValue(); + if (value == null) { + msg.append(prop.getName()); + msg.append(" = ;"); + } else { + msg.append(prop.toString().trim()); + } + } + } + this.iLogger.trace(Level.FINE, msg.toString()); + } + + if (this.iReliableIndicationsDisabled + || deliverIndication(indicationInst, id, pInetAddress)) { + this.iDispatcher.dispatchEvent(new CIMEvent(indicationInst, id, + pInetAddress)); + } + } + } + return null; + } catch (Exception e) { + return new CIMError(new WBEMException(WBEMException.CIM_ERR_FAILED, "CIM_ERR_FAILED", + null, e)); + } + } + + private void buildResponse(CIMClientXML_HelperImpl xmlHelper, MessageWriter pWriter, + CIMRequest request, CIMError error) throws HttpException, IOException { + Document responseDoc = null; + try { + DocumentBuilder docBuilder = xmlHelper.getDocumentBuilder(); + responseDoc = docBuilder.newDocument(); + CIMXMLBuilderImpl.createIndication_response(responseDoc, request.getId(), error); + + } catch (Exception e) { + // TODO: check this error code, may not be appropriate + throw new HttpException(400, "Bad Request"); + } + if (this.iSessionProperties.isCimXmlTracingEnabled() + || this.iLogger.isLoggableCIMXMLTrace(Level.FINEST)) { + OutputStream pos = new ByteArrayOutputStream(); + CIMClientXML_HelperImpl.dumpDocument(pos, responseDoc, "indication response"); + OutputStream debugStream = this.iLogger.getXmlTraceStream(); + if (this.iSessionProperties.isCimXmlTracingEnabled() && debugStream != null) debugStream + .write(pos.toString().getBytes()); + if (this.iLogger.isLoggableCIMXMLTrace(Level.FINEST)) this.iLogger.traceCIMXML( + Level.FINEST, pos.toString(), true); + } + CIMClientXML_HelperImpl.serialize(pWriter.getOutputStream(), responseDoc); + pWriter.getHeader().addField("CIMExport", "MethodResponse"); + } + + private static HttpHeader processHttpExtensions(HttpHeader pOriginalHeader) { + String man = pOriginalHeader.getField("Man"); + String opt = pOriginalHeader.getField("Opt"); + HttpHeader headers = new HttpHeader(); + String ns = null; + + HttpHeaderParser manOptHeader = null; + if (man != null && man.length() > 0) manOptHeader = new HttpHeaderParser(man); + else if (opt != null && opt.length() > 0) manOptHeader = new HttpHeaderParser(opt); + if (manOptHeader != null) ns = manOptHeader.getValue("ns"); + + if (ns != null) { + + Iterator> iter = pOriginalHeader.iterator(); + String key; + while (iter.hasNext()) { + Entry entry = iter.next(); + if (entry != null) { + key = entry.getKey().toString(); + if (key.startsWith(ns + "-")) headers.addParsedField(key.substring(3), entry + .getValue().toString()); + else headers.addParsedField(key, entry.getValue().toString()); + } + } + } else { + headers = pOriginalHeader; + } + + return headers; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/indications/RIHandlerTest.txt b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/indications/RIHandlerTest.txt similarity index 100% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/indications/RIHandlerTest.txt rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/indications/RIHandlerTest.txt diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/indications/ReliableIndicationHandler.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/indications/ReliableIndicationHandler.java similarity index 92% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/indications/ReliableIndicationHandler.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/indications/ReliableIndicationHandler.java index 2c8ec62..25522eb 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/indications/ReliableIndicationHandler.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/indications/ReliableIndicationHandler.java @@ -1,661 +1,658 @@ -/* - (C) Copyright IBM Corp. 2011, 2012 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Dave Blaschke, IBM, blaschke@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 3288721 2011-05-20 blaschke-oss Need the function of indication reordering - * 3376657 2011-07-24 blaschke-oss Get reliable indication properties once - * 3484022 2012-02-08 blaschke-oss Turn reliable indication mode on and off based on SC/SN - * 3513228 2012-04-23 blaschke-oss Reliable Indications support can create lots of threads - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.indications; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.net.InetAddress; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.logging.Level; - -import org.sentrysoftware.wbem.javax.cim.CIMInstance; -import org.sentrysoftware.wbem.javax.cim.CIMProperty; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; - -/** - * ReliableIndicationHandler is responsible for determining when to - * dispatch reliable indications, which includes queuing unexpected indications, - * caching all indications for the duration of their sequence identifier - * lifetime, and logging missing, duplicate and out-of-order indications. This - * functionality is based on the changes first introduced by DSP1054 v1.1. - * - * The handleIndication, areAllEmpty and - * processAll methods need to be synchronized because they are the - * entry points into ReliableIndicationHandler - the first is the - * public entry point that needs to be passed each and every reliable - * indication, the other two are only called by the DataManager thread and hence - * protected. All of the private methods are only called from one of the three - * synchronized methods. - * - * NOTE: ReliableIndicationHandler does NOT contain any logic for - * handling sequence number wrapping. It was deemed unnecessary because of the - * performance impact to each and every indication for a VERY rare occurrence: - * sequence numbers are longs (signed 64-bit integers) that are are supposed to - * start at 0, so even if the listener handled 1,000,00 indications per second, - * it would take over 292,471 years for the sequence number to wrap. - */ -public class ReliableIndicationHandler { - - /** - * ReliableIndication represents an entry in the indication - * delivery queue, and contains all the information required to manage and - * dispatch the indication. Entries in the queue are stored in order of - * increasing sequence number and are dispatched when the missing - * indication(s) arrive or their sequence identifier lifetime expires. Only - * one sequence context can be in the queue at any one time. - */ - private class ReliableIndication { - - private long iDiscardTime; - - private String iId; - - private CIMInstance iIndication; - - private InetAddress iInetAddress; - - private long iSequenceNumber; - - public ReliableIndication(CIMInstance pIndication, long pSequenceNumber, long pDiscardTime, - String pId, InetAddress pInetAddress) { - this.iIndication = pIndication; - this.iSequenceNumber = pSequenceNumber; - this.iDiscardTime = pDiscardTime; - this.iId = pId; - this.iInetAddress = pInetAddress; - } - - public long getDiscardTime() { - return this.iDiscardTime; - } - - public String getId() { - return this.iId; - } - - public CIMInstance getIndication() { - return this.iIndication; - } - - public InetAddress getInetAddress() { - return this.iInetAddress; - } - - public long getSequenceNumber() { - return this.iSequenceNumber; - } - } - - /** - * CacheEntry represents an entry in the sequence identifier - * cache. The sequence identifier is comprised of the sequence context and - * sequence number, and must be cached for the duration of the sequence - * identifier lifetime. Entries in the cache are stored in order of - * increasing discard time. - */ - private class CacheEntry { - - private String iSeqContext; - - private long iSeqNumber; - - private long iDiscardTime; - - public CacheEntry(String pSequenceContext, long pSequenceNumber, long pDiscardTime) { - this.iSeqContext = pSequenceContext; - this.iSeqNumber = pSequenceNumber; - this.iDiscardTime = pDiscardTime; - } - - public long getDiscardTime() { - return this.iDiscardTime; - } - - public String getSequenceContext() { - return this.iSeqContext; - } - - public long getSequenceNumber() { - return this.iSeqNumber; - } - } - - private LinkedList iQueue = new LinkedList(); - - private LinkedList iCache = new LinkedList(); - - private CIMEventDispatcher iDispatcher; - - private LogAndTraceBroker iLogger = LogAndTraceBroker.getBroker(); - - private long iIndentifierLifetime; - - // private long iLastArrivalTime; - - private String iLastSequenceContext; - - private Long iLastSequenceNumber; - - private long iExpectedSequenceNumber = 0; - - private boolean iIsFirstIndication = true; - - /** - * Constructs a ReliableIndicationHandler instance that uses - * the specified event dispatcher and sequence identifier lifetime to handle - * reliable indications. - * - * @param pDispatcher - * CIMEventDispatcher that does the actual - * indication dispatching. - * @param pIdentiferLifetime - * Sequence identifier lifetime. - */ - public ReliableIndicationHandler(CIMEventDispatcher pDispatcher, long pIdentiferLifetime) { - this.iDispatcher = pDispatcher; - this.iIndentifierLifetime = pIdentiferLifetime; - } - - /** - * Adds a reliable indication to the indication delivery queue. - * - * @param pIndication - * Reliable indication to be queued for delivery. - */ - private void addToQueue(ReliableIndication pIndication) { - int size = this.iQueue.size(); - - if ((size == 0) - || (this.iQueue.getLast().getSequenceNumber()) < pIndication.getSequenceNumber()) { - this.iQueue.addLast(pIndication); - } else { - int i; - for (i = size - 1; i >= 0; i--) { - ReliableIndication indication = this.iQueue.get(i); - if (indication.getSequenceNumber() < pIndication.getSequenceNumber()) { - this.iQueue.add(i + 1, pIndication); - // printQueue(); - processQueue(); - return; - } - } - this.iQueue.addFirst(pIndication); - } - - // printQueue(); - // Process queue if there are two or more entries - if (size > 0) processQueue(); - } - - /** - * Delivers all reliable indications in the indication delivery queue. - */ - private void flushQueue() { - if (this.iQueue.isEmpty()) return; - for (int i = this.iQueue.size() - 1; i >= 0; i--) { - ReliableIndication indication = this.iQueue.removeFirst(); - logMissingQueueEntries(indication.getSequenceNumber()); - - this.iDispatcher.dispatchEvent(new CIMEvent(indication.getIndication(), indication - .getId(), indication.getInetAddress())); - - this.iExpectedSequenceNumber = indication.getSequenceNumber() + 1; - } - } - - /** - * Determines if the indication delivery queue is empty. - * - * @return true if indication delivery queue is empty, - * false otherwise. - */ - private boolean isQueueEmpty() { - return this.iQueue.isEmpty(); - } - - /** - * Logs any missing reliable indications at the front of the indication - * delivery queue. - * - * @param pSequenceNumber - * Sequence number of first indication present in delivery queue. - */ - private void logMissingQueueEntries(long pSequenceNumber) { - if (pSequenceNumber > this.iExpectedSequenceNumber) { - for (long l = this.iExpectedSequenceNumber; l < pSequenceNumber; l++) { - this.iLogger.trace(Level.FINE, "Missing indication #" + l + " detected"); - } - } - } - - /** - * Prints all reliable indications in the indication delivery queue. - */ - // private void printQueue() { - // System.out.println("ReliableInidcation queue >"); - // for (int i = 0; i < this.iQueue.size(); i++) { - // ReliableIndication indication = this.iQueue.get(i); - // System.out.println(" Q[" + i + "]: " + indication.getSequenceNumber() + - // "@" - // + indication.getDiscardTime()); - // } - // } - /* */ - - /** - * Processes the indication delivery queue and dispatches all reliable - * indications whose sequence identifier lifetime has expired or whose - * sequence numbers are in the expected order. - */ - private void processQueue() { - if (this.iQueue.isEmpty()) return; - long currentTime = System.currentTimeMillis(); - - ReliableIndication indication = this.iQueue.getFirst(); - - // First dispatch all indications whose lifetimes have expired - while (indication.getDiscardTime() <= currentTime) { - indication = this.iQueue.removeFirst(); - logMissingQueueEntries(indication.getSequenceNumber()); - - this.iDispatcher.dispatchEvent(new CIMEvent(indication.getIndication(), indication - .getId(), indication.getInetAddress())); - - this.iExpectedSequenceNumber = indication.getSequenceNumber() + 1; - - if (this.iQueue.isEmpty()) return; - indication = this.iQueue.getFirst(); - } - - // Second dispatch all indications that are in the expected order - while (indication.getSequenceNumber() == this.iExpectedSequenceNumber) { - indication = this.iQueue.removeFirst(); - - this.iDispatcher.dispatchEvent(new CIMEvent(indication.getIndication(), indication - .getId(), indication.getInetAddress())); - - this.iExpectedSequenceNumber++; - - if (this.iQueue.isEmpty()) return; - indication = this.iQueue.getFirst(); - } - } - - /** - * Adds a reliable indication to the sequence identifier cache. - * - * @param pSequenceContext - * Sequence context of reliable indication to be cached. - * @param pSequenceNumber - * Sequence number of reliable indication to be cached. - * @param pDiscardTime - * Sequence identifier lifetime expiration time. - */ - private void addToCache(String pSequenceContext, long pSequenceNumber, long pDiscardTime) { - CacheEntry newEntry = new CacheEntry(pSequenceContext, pSequenceNumber, pDiscardTime); - int size = this.iCache.size(); - - if ((size == 0) || (this.iCache.getLast().getDiscardTime() <= pDiscardTime)) { - this.iCache.addLast(newEntry); - } else { - int i; - for (i = size - 1; i >= 0; i--) { - CacheEntry entry = this.iCache.get(i); - if (entry.getDiscardTime() <= pDiscardTime) { - this.iCache.add(i + 1, newEntry); - // printCache(); - return; - } - } - this.iCache.addFirst(newEntry); - } - - // printCache(); - } - - /** - * Removes all entries in the sequence identifier cache. - */ - // private void flushCache() { - // this.iCache.clear(); - // } - /* */ - - /** - * Determines if the sequence identifier cache is empty. - * - * @return true if sequence identifier cache is empty, - * false otherwise. - */ - private boolean isCacheEmpty() { - return this.iCache.isEmpty(); - } - - /** - * Determines if the sequence context is in the sequence identifier cache. - * - * @param pSequenceContext - * Sequence context to look for. - * @return true if sequence context is in sequence identifier - * cache, false otherwise. - */ - private boolean isInCache(String pSequenceContext) { - if (this.iCache.isEmpty()) return false; - Iterator iterator = this.iCache.iterator(); - while (iterator.hasNext()) { - if (iterator.next().getSequenceContext().compareTo(pSequenceContext) == 0) return true; - } - return false; - } - - /** - * Determines if the sequence identifier (context and number) is in the - * sequence identifier cache. - * - * @param pSequenceContext - * Sequence context to look for. - * @param pSequenceNumber - * Sequence number to look for. - * @return true if sequence identifier is in sequence - * identifier cache, false otherwise. - */ - private boolean isInCache(String pSequenceContext, long pSequenceNumber) { - if (this.iCache.isEmpty()) return false; - Iterator iterator = this.iCache.iterator(); - while (iterator.hasNext()) { - CacheEntry entry = iterator.next(); - if ((entry.getSequenceContext().compareTo(pSequenceContext) == 0) - && (entry.getSequenceNumber() == pSequenceNumber)) return true; - } - return false; - } - - /** - * Prints all entries in the sequence identifier cache. - */ - // private void printCache() { - // System.out.println("ReliableIndication cache >"); - // for (int i = 0; i < this.iCache.size(); i++) { - // CacheEntry entry = this.iCache.get(i); - // System.out.println(" C[" + i + "]: " + entry.getSequenceContext() + "," - // + entry.getSequenceNumber() + "@" + entry.getDiscardTime()); - // } - // } - /* */ - - /** - * Processes the sequence identifier cache and removes all entries whose - * sequence identifier lifetime has expired. - */ - private void processCache() { - if (this.iCache.isEmpty()) return; - long currentTime = System.currentTimeMillis(); - - for (int i = this.iCache.size() - 1; i >= 0; i--) { - if (this.iCache.getFirst().getDiscardTime() > currentTime) break; - this.iCache.removeFirst(); - } - } - - /** - * Determines if both the indication delivery queue and sequence identifier - * cache are empty. - * - * @return true if both the indication delivery queue and - * sequence identifier cache are empty, false - * otherwise. - */ - protected synchronized boolean areAllEmpty() { - return isCacheEmpty() && isQueueEmpty(); - } - - /** - * Flushes both the indication delivery queue and sequence identifier cache. - */ - // private void flushAll() { - // flushQueue(); - // flushCache(); - // } - /* */ - - /** - * Processes both the indication delivery queue and sequence identifier - * cache. - */ - protected synchronized void processAll() { - processQueue(); - processCache(); - } - - /** - * Main worker routine for ReliableIndicationHandler. The - * indication is either sent directly to the CIMEventDispatcher - * or placed in the indication delivery queue to be dispatched later. All - * reliable indications are placed in the sequence identifier cache. - * - * @param pIndication - * Indication. - * @param pId - * Indication destination URL. - * @param pInetAddress - * Indication server IP. - */ - public synchronized void handleIndication(CIMInstance pIndication, String pId, - InetAddress pInetAddress) { - // Get current time - long arrivalTime = System.currentTimeMillis(); - - // Get reliable indication properties from indication - CIMProperty seqCtxProp = pIndication.getProperty("SequenceContext"); - CIMProperty seqNumProp = pIndication.getProperty("SequenceNumber"); - - // At this point indication is reliable or not reliable - - // Indication is not reliable, handle appropriately and deliver - if (seqCtxProp == null || seqNumProp == null || seqCtxProp.getValue() == null - || seqNumProp.getValue() == null) { - // Handle switch from reliable to not reliable - if (this.iLastSequenceContext != null) { - // Deliver all enqueued indications from previous context - flushQueue(); - - this.iLastSequenceContext = null; - this.iLastSequenceNumber = null; - } - - // Deliver indication - this.iDispatcher.dispatchEvent(new CIMEvent(pIndication, pId, pInetAddress)); - this.iIsFirstIndication = false; - return; - } - - // At this point indication is reliable - - // Initial indication arrived, save knowledge about sequence identifier - // and deliver - if (this.iIsFirstIndication) { - // Remember sequence context/number and arrival time - this.iLastSequenceContext = (String) seqCtxProp.getValue(); - this.iLastSequenceNumber = (Long) seqNumProp.getValue(); - this.iExpectedSequenceNumber = this.iLastSequenceNumber.longValue() + 1; - // this.iLastArrivalTime = arrivalTime; - - // Cache sequence identifier - addToCache(this.iLastSequenceContext, this.iLastSequenceNumber.longValue(), arrivalTime - + this.iIndentifierLifetime); - - // Deliver indication - this.iDispatcher.dispatchEvent(new CIMEvent(pIndication, pId, pInetAddress)); - this.iIsFirstIndication = false; - return; - } - - // At this point indication is reliable and previous indication was - // reliable - - String seqCtx = (String) seqCtxProp.getValue(); - Long seqNum = (Long) seqNumProp.getValue(); - long seqNumVal = seqNum.longValue(); - - // Indication arrived after sequence identifier lifetime of previous - // indication expired, discard knowledge about previous sequence - // identifier and deliver - // if (arrivalTime > (this.iLastArrivalTime + - // this.iIndentifierLifetime)) { - // this.iLogger.trace(Level.FINE, - // "Discarding knowledge of previous sequence identifier because lifetime expired"); - - // Nothing should be cached or enqueued at this point - // flushAll(); - - // Remember sequence context/number and arrival time - // this.iLastSequenceContext = seqCtx; - // this.iLastSequenceNumber = seqNum; - // this.iExpectedSequenceNumber = seqNumVal + 1; - // this.iLastArrivalTime = arrivalTime; - - // Cache sequence identifier - // addToCache(seqCtx, seqNumVal, arrivalTime + - // this.iIndentifierLifetime); - - // Deliver indication - // this.iDispatcher.dispatchEvent(new CIMEvent(pIndication, pId, - // pInetAddress)); - // return; - // } - - // Indication arrived with different sequence context than expected - if (this.iLastSequenceContext == null || seqCtx.compareTo(this.iLastSequenceContext) != 0) { - // Cached sequence context indicates this indication arrived - // out-of-order from previous context, log and ignore - if (isInCache(seqCtx)) { - this.iLogger.trace(Level.FINE, "Out-of-order indication #" + seqNumVal - + " received from previous context; indication ignored, logged: " - + pIndication.toString()); - - return; - } - - this.iLogger.trace(Level.FINE, - "Discarding knowledge of previous sequence identifier because context changed"); - - // Deliver all enqueued indications from previous context - flushQueue(); - - // Remember sequence context and arrival time, sequence number - // should be zero - this.iLastSequenceContext = seqCtx; - this.iLastSequenceNumber = Long.valueOf(0); - this.iExpectedSequenceNumber = 1; - // this.iLastArrivalTime = arrivalTime; - - // Cache sequence identifier - addToCache(seqCtx, seqNumVal, arrivalTime + this.iIndentifierLifetime); - - // Expected sequence number, go ahead and deliver - if (seqNumVal == 0) { - this.iDispatcher.dispatchEvent(new CIMEvent(pIndication, pId, pInetAddress)); - return; - } - - // Unexpected (non-zero) sequence number, enqueue - this.iLastSequenceNumber = Long.valueOf(-1); - this.iExpectedSequenceNumber = 0; - addToQueue(new ReliableIndication(pIndication, seqNumVal, arrivalTime - + this.iIndentifierLifetime, pId, pInetAddress)); - - return; - } - - // Indication arrived with expected sequence number, go ahead and - // deliver - if (seqNumVal == this.iExpectedSequenceNumber) { - // Remember sequence context/number and arrival time - this.iLastSequenceNumber = seqNum; - this.iExpectedSequenceNumber = seqNumVal + 1; - // this.iLastArrivalTime = arrivalTime; - - // Cache sequence identifier - addToCache(seqCtx, seqNumVal, arrivalTime + this.iIndentifierLifetime); - - // Deliver indication - this.iDispatcher.dispatchEvent(new CIMEvent(pIndication, pId, pInetAddress)); - - return; - } - - // Duplicate indication arrived, log and ignore - if (isInCache(seqCtx, seqNumVal)) { - this.iLogger.trace(Level.FINE, "Duplicate indication #" + seqNumVal - + " received; indication ignored"); - - // Cache sequence identifier (duplicate entries okay and much easier - // than deleting/adding or moving) - addToCache(seqCtx, seqNumVal, arrivalTime + this.iIndentifierLifetime); - - return; - } - - // Out-of-order indication arrived, log and ignore - if (seqNumVal < this.iExpectedSequenceNumber) { - this.iLogger.trace(Level.FINE, "Out-of-order indication #" + seqNumVal + " received (#" - + this.iExpectedSequenceNumber + " expected); indication ignored, logged: " - + pIndication.toString()); - - // Cache sequence identifier - addToCache(seqCtx, seqNumVal, arrivalTime + this.iIndentifierLifetime); - - return; - } - - // Indication with higher sequence number than expected received, cache - // and enqueue it - addToCache(seqCtx, seqNumVal, arrivalTime + this.iIndentifierLifetime); - addToQueue(new ReliableIndication(pIndication, seqNumVal, arrivalTime - + this.iIndentifierLifetime, pId, pInetAddress)); - - return; - } -} +/* + (C) Copyright IBM Corp. 2011, 2012 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Dave Blaschke, IBM, blaschke@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 3288721 2011-05-20 blaschke-oss Need the function of indication reordering + * 3376657 2011-07-24 blaschke-oss Get reliable indication properties once + * 3484022 2012-02-08 blaschke-oss Turn reliable indication mode on and off based on SC/SN + * 3513228 2012-04-23 blaschke-oss Reliable Indications support can create lots of threads + */ + +package org.metricshub.wbem.sblim.cimclient.internal.wbem.indications; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.net.InetAddress; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.logging.Level; + +import org.metricshub.wbem.javax.cim.CIMInstance; +import org.metricshub.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; +import org.metricshub.wbem.javax.cim.CIMProperty; + +/** + * ReliableIndicationHandler is responsible for determining when to + * dispatch reliable indications, which includes queuing unexpected indications, + * caching all indications for the duration of their sequence identifier + * lifetime, and logging missing, duplicate and out-of-order indications. This + * functionality is based on the changes first introduced by DSP1054 v1.1. + * + * The handleIndication, areAllEmpty and + * processAll methods need to be synchronized because they are the + * entry points into ReliableIndicationHandler - the first is the + * public entry point that needs to be passed each and every reliable + * indication, the other two are only called by the DataManager thread and hence + * protected. All of the private methods are only called from one of the three + * synchronized methods. + * + * NOTE: ReliableIndicationHandler does NOT contain any logic for + * handling sequence number wrapping. It was deemed unnecessary because of the + * performance impact to each and every indication for a VERY rare occurrence: + * sequence numbers are longs (signed 64-bit integers) that are are supposed to + * start at 0, so even if the listener handled 1,000,00 indications per second, + * it would take over 292,471 years for the sequence number to wrap. + */ +public class ReliableIndicationHandler { + + /** + * ReliableIndication represents an entry in the indication + * delivery queue, and contains all the information required to manage and + * dispatch the indication. Entries in the queue are stored in order of + * increasing sequence number and are dispatched when the missing + * indication(s) arrive or their sequence identifier lifetime expires. Only + * one sequence context can be in the queue at any one time. + */ + private class ReliableIndication { + + private long iDiscardTime; + + private String iId; + + private CIMInstance iIndication; + + private InetAddress iInetAddress; + + private long iSequenceNumber; + + public ReliableIndication(CIMInstance pIndication, long pSequenceNumber, long pDiscardTime, + String pId, InetAddress pInetAddress) { + this.iIndication = pIndication; + this.iSequenceNumber = pSequenceNumber; + this.iDiscardTime = pDiscardTime; + this.iId = pId; + this.iInetAddress = pInetAddress; + } + + public long getDiscardTime() { + return this.iDiscardTime; + } + + public String getId() { + return this.iId; + } + + public CIMInstance getIndication() { + return this.iIndication; + } + + public InetAddress getInetAddress() { + return this.iInetAddress; + } + + public long getSequenceNumber() { + return this.iSequenceNumber; + } + } + + /** + * CacheEntry represents an entry in the sequence identifier + * cache. The sequence identifier is comprised of the sequence context and + * sequence number, and must be cached for the duration of the sequence + * identifier lifetime. Entries in the cache are stored in order of + * increasing discard time. + */ + private class CacheEntry { + + private String iSeqContext; + + private long iSeqNumber; + + private long iDiscardTime; + + public CacheEntry(String pSequenceContext, long pSequenceNumber, long pDiscardTime) { + this.iSeqContext = pSequenceContext; + this.iSeqNumber = pSequenceNumber; + this.iDiscardTime = pDiscardTime; + } + + public long getDiscardTime() { + return this.iDiscardTime; + } + + public String getSequenceContext() { + return this.iSeqContext; + } + + public long getSequenceNumber() { + return this.iSeqNumber; + } + } + + private LinkedList iQueue = new LinkedList(); + + private LinkedList iCache = new LinkedList(); + + private CIMEventDispatcher iDispatcher; + + private LogAndTraceBroker iLogger = LogAndTraceBroker.getBroker(); + + private long iIndentifierLifetime; + + // private long iLastArrivalTime; + + private String iLastSequenceContext; + + private Long iLastSequenceNumber; + + private long iExpectedSequenceNumber = 0; + + private boolean iIsFirstIndication = true; + + /** + * Constructs a ReliableIndicationHandler instance that uses + * the specified event dispatcher and sequence identifier lifetime to handle + * reliable indications. + * + * @param pDispatcher + * CIMEventDispatcher that does the actual + * indication dispatching. + * @param pIdentiferLifetime + * Sequence identifier lifetime. + */ + public ReliableIndicationHandler(CIMEventDispatcher pDispatcher, long pIdentiferLifetime) { + this.iDispatcher = pDispatcher; + this.iIndentifierLifetime = pIdentiferLifetime; + } + + /** + * Adds a reliable indication to the indication delivery queue. + * + * @param pIndication + * Reliable indication to be queued for delivery. + */ + private void addToQueue(ReliableIndication pIndication) { + int size = this.iQueue.size(); + + if ((size == 0) + || (this.iQueue.getLast().getSequenceNumber()) < pIndication.getSequenceNumber()) { + this.iQueue.addLast(pIndication); + } else { + int i; + for (i = size - 1; i >= 0; i--) { + ReliableIndication indication = this.iQueue.get(i); + if (indication.getSequenceNumber() < pIndication.getSequenceNumber()) { + this.iQueue.add(i + 1, pIndication); + // printQueue(); + processQueue(); + return; + } + } + this.iQueue.addFirst(pIndication); + } + + // printQueue(); + // Process queue if there are two or more entries + if (size > 0) processQueue(); + } + + /** + * Delivers all reliable indications in the indication delivery queue. + */ + private void flushQueue() { + if (this.iQueue.isEmpty()) return; + for (int i = this.iQueue.size() - 1; i >= 0; i--) { + ReliableIndication indication = this.iQueue.removeFirst(); + logMissingQueueEntries(indication.getSequenceNumber()); + + this.iDispatcher.dispatchEvent(new CIMEvent(indication.getIndication(), indication + .getId(), indication.getInetAddress())); + + this.iExpectedSequenceNumber = indication.getSequenceNumber() + 1; + } + } + + /** + * Determines if the indication delivery queue is empty. + * + * @return true if indication delivery queue is empty, + * false otherwise. + */ + private boolean isQueueEmpty() { + return this.iQueue.isEmpty(); + } + + /** + * Logs any missing reliable indications at the front of the indication + * delivery queue. + * + * @param pSequenceNumber + * Sequence number of first indication present in delivery queue. + */ + private void logMissingQueueEntries(long pSequenceNumber) { + if (pSequenceNumber > this.iExpectedSequenceNumber) { + for (long l = this.iExpectedSequenceNumber; l < pSequenceNumber; l++) { + this.iLogger.trace(Level.FINE, "Missing indication #" + l + " detected"); + } + } + } + + /** + * Prints all reliable indications in the indication delivery queue. + */ + // private void printQueue() { + // System.out.println("ReliableInidcation queue >"); + // for (int i = 0; i < this.iQueue.size(); i++) { + // ReliableIndication indication = this.iQueue.get(i); + // System.out.println(" Q[" + i + "]: " + indication.getSequenceNumber() + + // "@" + // + indication.getDiscardTime()); + // } + // } + /* */ + + /** + * Processes the indication delivery queue and dispatches all reliable + * indications whose sequence identifier lifetime has expired or whose + * sequence numbers are in the expected order. + */ + private void processQueue() { + if (this.iQueue.isEmpty()) return; + long currentTime = System.currentTimeMillis(); + + ReliableIndication indication = this.iQueue.getFirst(); + + // First dispatch all indications whose lifetimes have expired + while (indication.getDiscardTime() <= currentTime) { + indication = this.iQueue.removeFirst(); + logMissingQueueEntries(indication.getSequenceNumber()); + + this.iDispatcher.dispatchEvent(new CIMEvent(indication.getIndication(), indication + .getId(), indication.getInetAddress())); + + this.iExpectedSequenceNumber = indication.getSequenceNumber() + 1; + + if (this.iQueue.isEmpty()) return; + indication = this.iQueue.getFirst(); + } + + // Second dispatch all indications that are in the expected order + while (indication.getSequenceNumber() == this.iExpectedSequenceNumber) { + indication = this.iQueue.removeFirst(); + + this.iDispatcher.dispatchEvent(new CIMEvent(indication.getIndication(), indication + .getId(), indication.getInetAddress())); + + this.iExpectedSequenceNumber++; + + if (this.iQueue.isEmpty()) return; + indication = this.iQueue.getFirst(); + } + } + + /** + * Adds a reliable indication to the sequence identifier cache. + * + * @param pSequenceContext + * Sequence context of reliable indication to be cached. + * @param pSequenceNumber + * Sequence number of reliable indication to be cached. + * @param pDiscardTime + * Sequence identifier lifetime expiration time. + */ + private void addToCache(String pSequenceContext, long pSequenceNumber, long pDiscardTime) { + CacheEntry newEntry = new CacheEntry(pSequenceContext, pSequenceNumber, pDiscardTime); + int size = this.iCache.size(); + + if ((size == 0) || (this.iCache.getLast().getDiscardTime() <= pDiscardTime)) { + this.iCache.addLast(newEntry); + } else { + int i; + for (i = size - 1; i >= 0; i--) { + CacheEntry entry = this.iCache.get(i); + if (entry.getDiscardTime() <= pDiscardTime) { + this.iCache.add(i + 1, newEntry); + // printCache(); + return; + } + } + this.iCache.addFirst(newEntry); + } + + // printCache(); + } + + /** + * Removes all entries in the sequence identifier cache. + */ + // private void flushCache() { + // this.iCache.clear(); + // } + /* */ + + /** + * Determines if the sequence identifier cache is empty. + * + * @return true if sequence identifier cache is empty, + * false otherwise. + */ + private boolean isCacheEmpty() { + return this.iCache.isEmpty(); + } + + /** + * Determines if the sequence context is in the sequence identifier cache. + * + * @param pSequenceContext + * Sequence context to look for. + * @return true if sequence context is in sequence identifier + * cache, false otherwise. + */ + private boolean isInCache(String pSequenceContext) { + if (this.iCache.isEmpty()) return false; + Iterator iterator = this.iCache.iterator(); + while (iterator.hasNext()) { + if (iterator.next().getSequenceContext().compareTo(pSequenceContext) == 0) return true; + } + return false; + } + + /** + * Determines if the sequence identifier (context and number) is in the + * sequence identifier cache. + * + * @param pSequenceContext + * Sequence context to look for. + * @param pSequenceNumber + * Sequence number to look for. + * @return true if sequence identifier is in sequence + * identifier cache, false otherwise. + */ + private boolean isInCache(String pSequenceContext, long pSequenceNumber) { + if (this.iCache.isEmpty()) return false; + Iterator iterator = this.iCache.iterator(); + while (iterator.hasNext()) { + CacheEntry entry = iterator.next(); + if ((entry.getSequenceContext().compareTo(pSequenceContext) == 0) + && (entry.getSequenceNumber() == pSequenceNumber)) return true; + } + return false; + } + + /** + * Prints all entries in the sequence identifier cache. + */ + // private void printCache() { + // System.out.println("ReliableIndication cache >"); + // for (int i = 0; i < this.iCache.size(); i++) { + // CacheEntry entry = this.iCache.get(i); + // System.out.println(" C[" + i + "]: " + entry.getSequenceContext() + "," + // + entry.getSequenceNumber() + "@" + entry.getDiscardTime()); + // } + // } + /* */ + + /** + * Processes the sequence identifier cache and removes all entries whose + * sequence identifier lifetime has expired. + */ + private void processCache() { + if (this.iCache.isEmpty()) return; + long currentTime = System.currentTimeMillis(); + + for (int i = this.iCache.size() - 1; i >= 0; i--) { + if (this.iCache.getFirst().getDiscardTime() > currentTime) break; + this.iCache.removeFirst(); + } + } + + /** + * Determines if both the indication delivery queue and sequence identifier + * cache are empty. + * + * @return true if both the indication delivery queue and + * sequence identifier cache are empty, false + * otherwise. + */ + protected synchronized boolean areAllEmpty() { + return isCacheEmpty() && isQueueEmpty(); + } + + /** + * Flushes both the indication delivery queue and sequence identifier cache. + */ + // private void flushAll() { + // flushQueue(); + // flushCache(); + // } + /* */ + + /** + * Processes both the indication delivery queue and sequence identifier + * cache. + */ + protected synchronized void processAll() { + processQueue(); + processCache(); + } + + /** + * Main worker routine for ReliableIndicationHandler. The + * indication is either sent directly to the CIMEventDispatcher + * or placed in the indication delivery queue to be dispatched later. All + * reliable indications are placed in the sequence identifier cache. + * + * @param pIndication + * Indication. + * @param pId + * Indication destination URL. + * @param pInetAddress + * Indication server IP. + */ + public synchronized void handleIndication(CIMInstance pIndication, String pId, + InetAddress pInetAddress) { + // Get current time + long arrivalTime = System.currentTimeMillis(); + + // Get reliable indication properties from indication + CIMProperty seqCtxProp = pIndication.getProperty("SequenceContext"); + CIMProperty seqNumProp = pIndication.getProperty("SequenceNumber"); + + // At this point indication is reliable or not reliable + + // Indication is not reliable, handle appropriately and deliver + if (seqCtxProp == null || seqNumProp == null || seqCtxProp.getValue() == null + || seqNumProp.getValue() == null) { + // Handle switch from reliable to not reliable + if (this.iLastSequenceContext != null) { + // Deliver all enqueued indications from previous context + flushQueue(); + + this.iLastSequenceContext = null; + this.iLastSequenceNumber = null; + } + + // Deliver indication + this.iDispatcher.dispatchEvent(new CIMEvent(pIndication, pId, pInetAddress)); + this.iIsFirstIndication = false; + return; + } + + // At this point indication is reliable + + // Initial indication arrived, save knowledge about sequence identifier + // and deliver + if (this.iIsFirstIndication) { + // Remember sequence context/number and arrival time + this.iLastSequenceContext = (String) seqCtxProp.getValue(); + this.iLastSequenceNumber = (Long) seqNumProp.getValue(); + this.iExpectedSequenceNumber = this.iLastSequenceNumber.longValue() + 1; + // this.iLastArrivalTime = arrivalTime; + + // Cache sequence identifier + addToCache(this.iLastSequenceContext, this.iLastSequenceNumber.longValue(), arrivalTime + + this.iIndentifierLifetime); + + // Deliver indication + this.iDispatcher.dispatchEvent(new CIMEvent(pIndication, pId, pInetAddress)); + this.iIsFirstIndication = false; + return; + } + + // At this point indication is reliable and previous indication was + // reliable + + String seqCtx = (String) seqCtxProp.getValue(); + Long seqNum = (Long) seqNumProp.getValue(); + long seqNumVal = seqNum.longValue(); + + // Indication arrived after sequence identifier lifetime of previous + // indication expired, discard knowledge about previous sequence + // identifier and deliver + // if (arrivalTime > (this.iLastArrivalTime + + // this.iIndentifierLifetime)) { + // this.iLogger.trace(Level.FINE, + // "Discarding knowledge of previous sequence identifier because lifetime expired"); + + // Nothing should be cached or enqueued at this point + // flushAll(); + + // Remember sequence context/number and arrival time + // this.iLastSequenceContext = seqCtx; + // this.iLastSequenceNumber = seqNum; + // this.iExpectedSequenceNumber = seqNumVal + 1; + // this.iLastArrivalTime = arrivalTime; + + // Cache sequence identifier + // addToCache(seqCtx, seqNumVal, arrivalTime + + // this.iIndentifierLifetime); + + // Deliver indication + // this.iDispatcher.dispatchEvent(new CIMEvent(pIndication, pId, + // pInetAddress)); + // return; + // } + + // Indication arrived with different sequence context than expected + if (this.iLastSequenceContext == null || seqCtx.compareTo(this.iLastSequenceContext) != 0) { + // Cached sequence context indicates this indication arrived + // out-of-order from previous context, log and ignore + if (isInCache(seqCtx)) { + this.iLogger.trace(Level.FINE, "Out-of-order indication #" + seqNumVal + + " received from previous context; indication ignored, logged: " + + pIndication.toString()); + + return; + } + + this.iLogger.trace(Level.FINE, + "Discarding knowledge of previous sequence identifier because context changed"); + + // Deliver all enqueued indications from previous context + flushQueue(); + + // Remember sequence context and arrival time, sequence number + // should be zero + this.iLastSequenceContext = seqCtx; + this.iLastSequenceNumber = Long.valueOf(0); + this.iExpectedSequenceNumber = 1; + // this.iLastArrivalTime = arrivalTime; + + // Cache sequence identifier + addToCache(seqCtx, seqNumVal, arrivalTime + this.iIndentifierLifetime); + + // Expected sequence number, go ahead and deliver + if (seqNumVal == 0) { + this.iDispatcher.dispatchEvent(new CIMEvent(pIndication, pId, pInetAddress)); + return; + } + + // Unexpected (non-zero) sequence number, enqueue + this.iLastSequenceNumber = Long.valueOf(-1); + this.iExpectedSequenceNumber = 0; + addToQueue(new ReliableIndication(pIndication, seqNumVal, arrivalTime + + this.iIndentifierLifetime, pId, pInetAddress)); + + return; + } + + // Indication arrived with expected sequence number, go ahead and + // deliver + if (seqNumVal == this.iExpectedSequenceNumber) { + // Remember sequence context/number and arrival time + this.iLastSequenceNumber = seqNum; + this.iExpectedSequenceNumber = seqNumVal + 1; + // this.iLastArrivalTime = arrivalTime; + + // Cache sequence identifier + addToCache(seqCtx, seqNumVal, arrivalTime + this.iIndentifierLifetime); + + // Deliver indication + this.iDispatcher.dispatchEvent(new CIMEvent(pIndication, pId, pInetAddress)); + + return; + } + + // Duplicate indication arrived, log and ignore + if (isInCache(seqCtx, seqNumVal)) { + this.iLogger.trace(Level.FINE, "Duplicate indication #" + seqNumVal + + " received; indication ignored"); + + // Cache sequence identifier (duplicate entries okay and much easier + // than deleting/adding or moving) + addToCache(seqCtx, seqNumVal, arrivalTime + this.iIndentifierLifetime); + + return; + } + + // Out-of-order indication arrived, log and ignore + if (seqNumVal < this.iExpectedSequenceNumber) { + this.iLogger.trace(Level.FINE, "Out-of-order indication #" + seqNumVal + " received (#" + + this.iExpectedSequenceNumber + " expected); indication ignored, logged: " + + pIndication.toString()); + + // Cache sequence identifier + addToCache(seqCtx, seqNumVal, arrivalTime + this.iIndentifierLifetime); + + return; + } + + // Indication with higher sequence number than expected received, cache + // and enqueue it + addToCache(seqCtx, seqNumVal, arrivalTime + this.iIndentifierLifetime); + addToQueue(new ReliableIndication(pIndication, seqNumVal, arrivalTime + + this.iIndentifierLifetime, pId, pInetAddress)); + + return; + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/indications/package.html b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/indications/package.html similarity index 100% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/indications/package.html rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/indications/package.html diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMAssociatorNamesOp.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMAssociatorNamesOp.java similarity index 72% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMAssociatorNamesOp.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMAssociatorNamesOp.java index e844142..9ce5a38 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMAssociatorNamesOp.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMAssociatorNamesOp.java @@ -1,122 +1,120 @@ -/* - CIMAssociatorNamesOp.java - - (C) Copyright IBM Corp. 2005, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1535756 2006-08-07 lupusalex Make code warning free - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.operations; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; - -/** - * @author Roberto - * - * To change the template for this generated type comment go to - * Window>Preferences>Java>Code Generation>Code and Comments - */ -public class CIMAssociatorNamesOp extends CIMOperation { - - protected String iAssociationClass; - - protected String iResultClass; - - protected String iRole; - - protected String iResultRole; - - /** - * Ctor. - * - * @param pObjectName - * @param pAssociationClass - * @param pResultClass - * @param pRole - * @param pResultRole - */ - public CIMAssociatorNamesOp(CIMObjectPath pObjectName, String pAssociationClass, - String pResultClass, String pRole, String pResultRole) { - - this.iMethodCall = "AssociatorNames"; - this.iObjectName = pObjectName; - this.iAssociationClass = pAssociationClass; - this.iResultClass = pResultClass; - this.iRole = pRole; - } - - /** - * Returns the association class name - * - * @return The association class name - */ - public String getAssocClass() { - return this.iAssociationClass; - } - - /** - * Returns the result class name - * - * @return The result class name - */ - public String getResultClass() { - return this.iResultClass; - } - - /** - * Returns the result role - * - * @return The result role - */ - public String getResultRole() { - return this.iResultRole; - } - - /** - * Returns the role - * - * @return The role - */ - public String getRole() { - return this.iRole; - } - -} +/* + CIMAssociatorNamesOp.java + + (C) Copyright IBM Corp. 2005, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1535756 2006-08-07 lupusalex Make code warning free + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.wbem.operations; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMObjectPath; + +/** + * @author Roberto + * + * To change the template for this generated type comment go to + * Window>Preferences>Java>Code Generation>Code and Comments + */ +public class CIMAssociatorNamesOp extends CIMOperation { + + protected String iAssociationClass; + + protected String iResultClass; + + protected String iRole; + + protected String iResultRole; + + /** + * Ctor. + * + * @param pObjectName + * @param pAssociationClass + * @param pResultClass + * @param pRole + * @param pResultRole + */ + public CIMAssociatorNamesOp(CIMObjectPath pObjectName, String pAssociationClass, + String pResultClass, String pRole, String pResultRole) { + + this.iMethodCall = "AssociatorNames"; + this.iObjectName = pObjectName; + this.iAssociationClass = pAssociationClass; + this.iResultClass = pResultClass; + this.iRole = pRole; + } + + /** + * Returns the association class name + * + * @return The association class name + */ + public String getAssocClass() { + return this.iAssociationClass; + } + + /** + * Returns the result class name + * + * @return The result class name + */ + public String getResultClass() { + return this.iResultClass; + } + + /** + * Returns the result role + * + * @return The result role + */ + public String getResultRole() { + return this.iResultRole; + } + + /** + * Returns the role + * + * @return The role + */ + public String getRole() { + return this.iRole; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMAssociatorsOp.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMAssociatorsOp.java similarity index 76% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMAssociatorsOp.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMAssociatorsOp.java index 5fe4e4d..7620e9d 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMAssociatorsOp.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMAssociatorsOp.java @@ -1,160 +1,158 @@ -/* - CIMAssociatorsOp.java - - (C) Copyright IBM Corp. 2005, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1535756 2006-08-07 lupusalex Make code warning free - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.operations; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; - -/** - * Class CIMAssociatorsOp - * - */ -public class CIMAssociatorsOp extends CIMOperation { - - protected String iAssociationClass; - - protected String iResultClass; - - protected String iRole; - - protected String iResultRole; - - protected boolean iIncludeQualifiers; - - protected boolean iIncludeClassOrigin; - - protected String[] iPropertyList; - - /** - * Ctor. - * - * @param pObjectName - * @param pAssociationClass - * @param pResultClass - * @param pRole - * @param pResultRole - * @param pIncludeQualifiers - * @param pIncludeClassOrigin - * @param pPropertyList - */ - public CIMAssociatorsOp(CIMObjectPath pObjectName, String pAssociationClass, - String pResultClass, String pRole, String pResultRole, boolean pIncludeQualifiers, - boolean pIncludeClassOrigin, String[] pPropertyList) { - - this.iMethodCall = "Associators"; - this.iObjectName = pObjectName; - this.iAssociationClass = pAssociationClass; - this.iResultClass = pResultClass; - this.iRole = pRole; - this.iIncludeClassOrigin = pIncludeClassOrigin; - this.iIncludeQualifiers = pIncludeQualifiers; - this.iPropertyList = pPropertyList; - } - - /** - * Returns the association class - * - * @return The association class - */ - public String getAssocClass() { - return this.iAssociationClass; - } - - /** - * Returns if includeQualifiers is set - * - * @return The value of includeClassOrigin - */ - public boolean isIncludeClassOrigin() { - return this.iIncludeClassOrigin; - } - - /** - * Returns if includeQualifiers is set - * - * @return The value of includeClassOrigin - */ - public boolean isIncludeQualifiers() { - return this.iIncludeQualifiers; - } - - /** - * Returns the property list - * - * @return The property list - */ - public String[] getPropertyList() { - return this.iPropertyList; - } - - /** - * Returns the result class - * - * @return The result class - */ - public String getResultClass() { - return this.iResultClass; - } - - /** - * Returns the result role - * - * @return The result role - */ - public String getResultRole() { - return this.iResultRole; - } - - /** - * Returns the role - * - * @return The role - */ - public String getRole() { - return this.iRole; - } - -} +/* + CIMAssociatorsOp.java + + (C) Copyright IBM Corp. 2005, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1535756 2006-08-07 lupusalex Make code warning free + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.wbem.operations; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMObjectPath; + +/** + * Class CIMAssociatorsOp + * + */ +public class CIMAssociatorsOp extends CIMOperation { + + protected String iAssociationClass; + + protected String iResultClass; + + protected String iRole; + + protected String iResultRole; + + protected boolean iIncludeQualifiers; + + protected boolean iIncludeClassOrigin; + + protected String[] iPropertyList; + + /** + * Ctor. + * + * @param pObjectName + * @param pAssociationClass + * @param pResultClass + * @param pRole + * @param pResultRole + * @param pIncludeQualifiers + * @param pIncludeClassOrigin + * @param pPropertyList + */ + public CIMAssociatorsOp(CIMObjectPath pObjectName, String pAssociationClass, + String pResultClass, String pRole, String pResultRole, boolean pIncludeQualifiers, + boolean pIncludeClassOrigin, String[] pPropertyList) { + + this.iMethodCall = "Associators"; + this.iObjectName = pObjectName; + this.iAssociationClass = pAssociationClass; + this.iResultClass = pResultClass; + this.iRole = pRole; + this.iIncludeClassOrigin = pIncludeClassOrigin; + this.iIncludeQualifiers = pIncludeQualifiers; + this.iPropertyList = pPropertyList; + } + + /** + * Returns the association class + * + * @return The association class + */ + public String getAssocClass() { + return this.iAssociationClass; + } + + /** + * Returns if includeQualifiers is set + * + * @return The value of includeClassOrigin + */ + public boolean isIncludeClassOrigin() { + return this.iIncludeClassOrigin; + } + + /** + * Returns if includeQualifiers is set + * + * @return The value of includeClassOrigin + */ + public boolean isIncludeQualifiers() { + return this.iIncludeQualifiers; + } + + /** + * Returns the property list + * + * @return The property list + */ + public String[] getPropertyList() { + return this.iPropertyList; + } + + /** + * Returns the result class + * + * @return The result class + */ + public String getResultClass() { + return this.iResultClass; + } + + /** + * Returns the result role + * + * @return The result role + */ + public String getResultRole() { + return this.iResultRole; + } + + /** + * Returns the role + * + * @return The role + */ + public String getRole() { + return this.iRole; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMCreateClassOp.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMCreateClassOp.java similarity index 63% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMCreateClassOp.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMCreateClassOp.java index 0838f1b..626b73e 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMCreateClassOp.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMCreateClassOp.java @@ -1,80 +1,78 @@ -/* - CIMCreateClassOp.java - - (C) Copyright IBM Corp. 2005, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1535756 2006-08-07 lupusalex Make code warning free - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.operations; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMClass; -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; - -/** - * CIMCreateClassOp - * - */ -public class CIMCreateClassOp extends CIMOperation { - - protected CIMClass iCimClass; - - /** - * Ctor. - * - * @param pObjectName - * @param pCimClass - */ - public CIMCreateClassOp(CIMObjectPath pObjectName, CIMClass pCimClass) { - this.iMethodCall = "CreateClass"; - this.iObjectName = pObjectName; - this.iCimClass = pCimClass; - } - - /** - * Returns the CIM class - * - * @return The CIM class - */ - public CIMClass getCimClass() { - return this.iCimClass; - } -} +/* + CIMCreateClassOp.java + + (C) Copyright IBM Corp. 2005, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1535756 2006-08-07 lupusalex Make code warning free + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.wbem.operations; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMClass; +import org.metricshub.wbem.javax.cim.CIMObjectPath; + +/** + * CIMCreateClassOp + * + */ +public class CIMCreateClassOp extends CIMOperation { + + protected CIMClass iCimClass; + + /** + * Ctor. + * + * @param pObjectName + * @param pCimClass + */ + public CIMCreateClassOp(CIMObjectPath pObjectName, CIMClass pCimClass) { + this.iMethodCall = "CreateClass"; + this.iObjectName = pObjectName; + this.iCimClass = pCimClass; + } + + /** + * Returns the CIM class + * + * @return The CIM class + */ + public CIMClass getCimClass() { + return this.iCimClass; + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMCreateInstanceOp.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMCreateInstanceOp.java similarity index 63% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMCreateInstanceOp.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMCreateInstanceOp.java index 664a50b..d58ac30 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMCreateInstanceOp.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMCreateInstanceOp.java @@ -1,81 +1,79 @@ -/* - CIMCreateInstanceOp.java - - (C) Copyright IBM Corp. 2005, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1535756 2006-08-07 lupusalex Make code warning free - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.operations; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMInstance; -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; - -/** - * CIMCreateInstanceOp - * - */ -public class CIMCreateInstanceOp extends CIMOperation { - - protected CIMInstance iInstance; - - /** - * Ctor. - * - * @param pObjectName - * @param pInstance - */ - public CIMCreateInstanceOp(CIMObjectPath pObjectName, CIMInstance pInstance) { - this.iMethodCall = "CreateInstance"; - this.iObjectName = pObjectName; - this.iInstance = pInstance; - } - - /** - * Returns the instance - * - * @return The instance - */ - public CIMInstance getInstance() { - return this.iInstance; - } - -} +/* + CIMCreateInstanceOp.java + + (C) Copyright IBM Corp. 2005, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1535756 2006-08-07 lupusalex Make code warning free + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.wbem.operations; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMInstance; +import org.metricshub.wbem.javax.cim.CIMObjectPath; + +/** + * CIMCreateInstanceOp + * + */ +public class CIMCreateInstanceOp extends CIMOperation { + + protected CIMInstance iInstance; + + /** + * Ctor. + * + * @param pObjectName + * @param pInstance + */ + public CIMCreateInstanceOp(CIMObjectPath pObjectName, CIMInstance pInstance) { + this.iMethodCall = "CreateInstance"; + this.iObjectName = pObjectName; + this.iInstance = pInstance; + } + + /** + * Returns the instance + * + * @return The instance + */ + public CIMInstance getInstance() { + return this.iInstance; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMCreateNameSpaceOp.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMCreateNameSpaceOp.java similarity index 63% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMCreateNameSpaceOp.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMCreateNameSpaceOp.java index 86e6e25..11c5c41 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMCreateNameSpaceOp.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMCreateNameSpaceOp.java @@ -1,64 +1,62 @@ -/* - CIMCreateNameSpaceOp.java - - (C) Copyright IBM Corp. 2005, 2010 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1535756 2006-08-07 lupusalex Make code warning free - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 3001357 2010-05-18 blaschke-oss CIMDeleteNameSpaceOp name clash - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.operations; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -/** - * CIMCreateNameSpaceOp - * - */ -public class CIMCreateNameSpaceOp extends CIMOperation { - - /** - * Ctor. - * - * @param pNamespace - */ - public CIMCreateNameSpaceOp(String pNamespace) { - this.iNameSpace = pNamespace; - } -} +/* + CIMCreateNameSpaceOp.java + + (C) Copyright IBM Corp. 2005, 2010 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1535756 2006-08-07 lupusalex Make code warning free + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 3001357 2010-05-18 blaschke-oss CIMDeleteNameSpaceOp name clash + */ + +package org.metricshub.wbem.sblim.cimclient.internal.wbem.operations; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +/** + * CIMCreateNameSpaceOp + * + */ +public class CIMCreateNameSpaceOp extends CIMOperation { + + /** + * Ctor. + * + * @param pNamespace + */ + public CIMCreateNameSpaceOp(String pNamespace) { + this.iNameSpace = pNamespace; + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMCreateQualifierTypeOp.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMCreateQualifierTypeOp.java similarity index 65% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMCreateQualifierTypeOp.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMCreateQualifierTypeOp.java index 8283c2c..dd501a1 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMCreateQualifierTypeOp.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMCreateQualifierTypeOp.java @@ -1,82 +1,80 @@ -/* - CIMCreateQualifierTypeOp.java - - (C) Copyright IBM Corp. 2005, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1535756 2006-08-07 lupusalex Make code warning free - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.operations; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; -import org.sentrysoftware.wbem.javax.cim.CIMQualifierType; - -/** - * CIMCreateQualifierTypeOp - * - */ -public class CIMCreateQualifierTypeOp extends CIMOperation { - - protected CIMQualifierType iQualifierType; - - /** - * Ctor. - * - * @param pObjectName - * @param pQualifierType - */ - public CIMCreateQualifierTypeOp(CIMObjectPath pObjectName, CIMQualifierType pQualifierType) { - this.iMethodCall = "CreateQualifier"; - this.iObjectName = pObjectName; - this.iQualifierType = pQualifierType; - } - - /** - * Returns the qualifier type - * - * @return The qualifier type - */ - public CIMQualifierType getQualifierType() { - return this.iQualifierType; - } - -} +/* + CIMCreateQualifierTypeOp.java + + (C) Copyright IBM Corp. 2005, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1535756 2006-08-07 lupusalex Make code warning free + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics + */ + +package org.metricshub.wbem.sblim.cimclient.internal.wbem.operations; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMObjectPath; +import org.metricshub.wbem.javax.cim.CIMQualifierType; + +/** + * CIMCreateQualifierTypeOp + * + */ +public class CIMCreateQualifierTypeOp extends CIMOperation { + + protected CIMQualifierType iQualifierType; + + /** + * Ctor. + * + * @param pObjectName + * @param pQualifierType + */ + public CIMCreateQualifierTypeOp(CIMObjectPath pObjectName, CIMQualifierType pQualifierType) { + this.iMethodCall = "CreateQualifier"; + this.iObjectName = pObjectName; + this.iQualifierType = pQualifierType; + } + + /** + * Returns the qualifier type + * + * @return The qualifier type + */ + public CIMQualifierType getQualifierType() { + return this.iQualifierType; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMDeleteClassOp.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMDeleteClassOp.java similarity index 61% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMDeleteClassOp.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMDeleteClassOp.java index 583e7ee..3a8ce82 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMDeleteClassOp.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMDeleteClassOp.java @@ -1,66 +1,64 @@ -/* - CIMDeleteClassOp.java - - (C) Copyright IBM Corp. 2005, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1535756 2006-08-07 lupusalex Make code warning free - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.operations; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; - -/** - * CIMDeleteClassOp - * - */ -public class CIMDeleteClassOp extends CIMOperation { - - /** - * Ctor. - * - * @param pObjectName - */ - public CIMDeleteClassOp(CIMObjectPath pObjectName) { - this.iMethodCall = "DeleteClass"; - this.iObjectName = pObjectName; - } -} +/* + CIMDeleteClassOp.java + + (C) Copyright IBM Corp. 2005, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1535756 2006-08-07 lupusalex Make code warning free + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.wbem.operations; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMObjectPath; + +/** + * CIMDeleteClassOp + * + */ +public class CIMDeleteClassOp extends CIMOperation { + + /** + * Ctor. + * + * @param pObjectName + */ + public CIMDeleteClassOp(CIMObjectPath pObjectName) { + this.iMethodCall = "DeleteClass"; + this.iObjectName = pObjectName; + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMDeleteInstanceOp.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMDeleteInstanceOp.java similarity index 61% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMDeleteInstanceOp.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMDeleteInstanceOp.java index 94d5e86..f6fb378 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMDeleteInstanceOp.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMDeleteInstanceOp.java @@ -1,66 +1,64 @@ -/* - CIMDeleteInstanceOp.java - - (C) Copyright IBM Corp. 2005, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1535756 2006-08-07 lupusalex Make code warning free - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.operations; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; - -/** - * CIMDeleteInstanceOp - * - */ -public class CIMDeleteInstanceOp extends CIMOperation { - - /** - * Ctor. - * - * @param pObjectName - */ - public CIMDeleteInstanceOp(CIMObjectPath pObjectName) { - this.iMethodCall = "DeleteInstance"; - this.iObjectName = pObjectName; - } -} +/* + CIMDeleteInstanceOp.java + + (C) Copyright IBM Corp. 2005, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1535756 2006-08-07 lupusalex Make code warning free + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.wbem.operations; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMObjectPath; + +/** + * CIMDeleteInstanceOp + * + */ +public class CIMDeleteInstanceOp extends CIMOperation { + + /** + * Ctor. + * + * @param pObjectName + */ + public CIMDeleteInstanceOp(CIMObjectPath pObjectName) { + this.iMethodCall = "DeleteInstance"; + this.iObjectName = pObjectName; + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMDeleteNameSpaceOp.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMDeleteNameSpaceOp.java similarity index 64% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMDeleteNameSpaceOp.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMDeleteNameSpaceOp.java index 48f8daa..083f619 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMDeleteNameSpaceOp.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMDeleteNameSpaceOp.java @@ -1,66 +1,64 @@ -/* - CIMDeleteNameSpaceOp.java - - (C) Copyright IBM Corp. 2005, 2012 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1535756 2006-08-07 lupusalex Make code warning free - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 3001357 2010-05-18 blaschke-oss CIMDeleteNameSpaceOp name clash - * 3525145 2012-05-09 blaschke-oss Remove CIMDeleteNameSpaceOp.getNamespace - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.operations; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -/** - * CIMDeleteNameSpaceOp - * - */ -public class CIMDeleteNameSpaceOp extends CIMOperation { - - /** - * Ctor. - * - * @param pNamespace - */ - public CIMDeleteNameSpaceOp(String pNamespace) { - this.iNameSpace = pNamespace; - } - -} +/* + CIMDeleteNameSpaceOp.java + + (C) Copyright IBM Corp. 2005, 2012 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1535756 2006-08-07 lupusalex Make code warning free + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 3001357 2010-05-18 blaschke-oss CIMDeleteNameSpaceOp name clash + * 3525145 2012-05-09 blaschke-oss Remove CIMDeleteNameSpaceOp.getNamespace + */ + +package org.metricshub.wbem.sblim.cimclient.internal.wbem.operations; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +/** + * CIMDeleteNameSpaceOp + * + */ +public class CIMDeleteNameSpaceOp extends CIMOperation { + + /** + * Ctor. + * + * @param pNamespace + */ + public CIMDeleteNameSpaceOp(String pNamespace) { + this.iNameSpace = pNamespace; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMDeleteQualifierTypeOp.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMDeleteQualifierTypeOp.java similarity index 62% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMDeleteQualifierTypeOp.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMDeleteQualifierTypeOp.java index 80261fe..936bd83 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMDeleteQualifierTypeOp.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMDeleteQualifierTypeOp.java @@ -1,66 +1,64 @@ -/* - CIMDeleteQualifierTypeOp.java - - (C) Copyright IBM Corp. 2005, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1535756 2006-08-07 lupusalex Make code warning free - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.operations; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; - -/** - * CIMDeleteQualifierTypeOp - * - */ -public class CIMDeleteQualifierTypeOp extends CIMOperation { - - /** - * Ctor. - * - * @param pObjectName - */ - public CIMDeleteQualifierTypeOp(CIMObjectPath pObjectName) { - this.iMethodCall = "DeleteQualifier"; - this.iObjectName = pObjectName; - } -} +/* + CIMDeleteQualifierTypeOp.java + + (C) Copyright IBM Corp. 2005, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1535756 2006-08-07 lupusalex Make code warning free + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.wbem.operations; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMObjectPath; + +/** + * CIMDeleteQualifierTypeOp + * + */ +public class CIMDeleteQualifierTypeOp extends CIMOperation { + + /** + * Ctor. + * + * @param pObjectName + */ + public CIMDeleteQualifierTypeOp(CIMObjectPath pObjectName) { + this.iMethodCall = "DeleteQualifier"; + this.iObjectName = pObjectName; + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumClassNamesOp.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumClassNamesOp.java similarity index 64% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumClassNamesOp.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumClassNamesOp.java index 1da8049..bd666a9 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumClassNamesOp.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumClassNamesOp.java @@ -1,80 +1,78 @@ -/* - CIMEnumClassNamesOp.java - - (C) Copyright IBM Corp. 2005, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1535756 2006-08-07 lupusalex Make code warning free - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.operations; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; - -/** - * CIMEnumClassNamesOp - * - */ -public class CIMEnumClassNamesOp extends CIMOperation { - - protected boolean iDeep; - - /** - * Ctor. - * - * @param objectName - * @param deep - */ - public CIMEnumClassNamesOp(CIMObjectPath objectName, boolean deep) { - this.iMethodCall = "EnumerateClassNames"; - this.iObjectName = objectName; - this.iDeep = deep; - } - - /** - * Returns deep - * - * @return The value of deep - */ - public boolean isDeep() { - return this.iDeep; - } - -} +/* + CIMEnumClassNamesOp.java + + (C) Copyright IBM Corp. 2005, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1535756 2006-08-07 lupusalex Make code warning free + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.wbem.operations; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMObjectPath; + +/** + * CIMEnumClassNamesOp + * + */ +public class CIMEnumClassNamesOp extends CIMOperation { + + protected boolean iDeep; + + /** + * Ctor. + * + * @param objectName + * @param deep + */ + public CIMEnumClassNamesOp(CIMObjectPath objectName, boolean deep) { + this.iMethodCall = "EnumerateClassNames"; + this.iObjectName = objectName; + this.iDeep = deep; + } + + /** + * Returns deep + * + * @return The value of deep + */ + public boolean isDeep() { + return this.iDeep; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumClassesOp.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumClassesOp.java similarity index 72% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumClassesOp.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumClassesOp.java index 92c2210..1f4a83f 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumClassesOp.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumClassesOp.java @@ -1,120 +1,118 @@ -/* - CIMEnumClassesOp.java - - (C) Copyright IBM Corp. 2005, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1535756 2006-08-07 lupusalex Make code warning free - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.operations; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; - -/** - * CIMEnumClassesOp - * - */ -public class CIMEnumClassesOp extends CIMOperation { - - protected boolean iDeep; - - protected boolean iLocalOnly; - - protected boolean iIncludeQualifiers; - - protected boolean iIncludeClassOrigin; - - /** - * Ctor. - * - * @param pObjectName - * @param pDeep - * @param pLocalOnly - * @param pIncludeQualifiers - * @param pIncludeClassOrigin - */ - public CIMEnumClassesOp(CIMObjectPath pObjectName, boolean pDeep, boolean pLocalOnly, - boolean pIncludeQualifiers, boolean pIncludeClassOrigin) { - this.iMethodCall = "EnumerateClasses"; - this.iObjectName = pObjectName; - this.iDeep = pDeep; - this.iLocalOnly = pLocalOnly; - this.iIncludeClassOrigin = pIncludeClassOrigin; - this.iIncludeQualifiers = pIncludeQualifiers; - } - - /** - * Returns if deep is set - * - * @return The value of deep - */ - public boolean isDeep() { - return this.iDeep; - } - - /** - * Returns if includeClassOrigin is set - * - * @return The value of includeClassOrigin - */ - public boolean isIncludeClassOrigin() { - return this.iIncludeClassOrigin; - } - - /** - * Returns if includeQualifiers is set - * - * @return The value of includeQualifiers - */ - public boolean isIncludeQualifiers() { - return this.iIncludeQualifiers; - } - - /** - * Returns if localOnly is set - * - * @return The value of localOnly - */ - public boolean isLocalOnly() { - return this.iLocalOnly; - } - -} +/* + CIMEnumClassesOp.java + + (C) Copyright IBM Corp. 2005, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1535756 2006-08-07 lupusalex Make code warning free + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.wbem.operations; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMObjectPath; + +/** + * CIMEnumClassesOp + * + */ +public class CIMEnumClassesOp extends CIMOperation { + + protected boolean iDeep; + + protected boolean iLocalOnly; + + protected boolean iIncludeQualifiers; + + protected boolean iIncludeClassOrigin; + + /** + * Ctor. + * + * @param pObjectName + * @param pDeep + * @param pLocalOnly + * @param pIncludeQualifiers + * @param pIncludeClassOrigin + */ + public CIMEnumClassesOp(CIMObjectPath pObjectName, boolean pDeep, boolean pLocalOnly, + boolean pIncludeQualifiers, boolean pIncludeClassOrigin) { + this.iMethodCall = "EnumerateClasses"; + this.iObjectName = pObjectName; + this.iDeep = pDeep; + this.iLocalOnly = pLocalOnly; + this.iIncludeClassOrigin = pIncludeClassOrigin; + this.iIncludeQualifiers = pIncludeQualifiers; + } + + /** + * Returns if deep is set + * + * @return The value of deep + */ + public boolean isDeep() { + return this.iDeep; + } + + /** + * Returns if includeClassOrigin is set + * + * @return The value of includeClassOrigin + */ + public boolean isIncludeClassOrigin() { + return this.iIncludeClassOrigin; + } + + /** + * Returns if includeQualifiers is set + * + * @return The value of includeQualifiers + */ + public boolean isIncludeQualifiers() { + return this.iIncludeQualifiers; + } + + /** + * Returns if localOnly is set + * + * @return The value of localOnly + */ + public boolean isLocalOnly() { + return this.iLocalOnly; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumInstanceNamesOp.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumInstanceNamesOp.java similarity index 62% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumInstanceNamesOp.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumInstanceNamesOp.java index 3df329f..272ca83 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumInstanceNamesOp.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumInstanceNamesOp.java @@ -1,66 +1,64 @@ -/* - CIMEnumInstanceNamesOp.java - - (C) Copyright IBM Corp. 2005, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1535756 2006-08-07 lupusalex Make code warning free - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.operations; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; - -/** - * CIMEnumInstanceNamesOp - * - */ -public class CIMEnumInstanceNamesOp extends CIMOperation { - - /** - * Ctor. - * - * @param objectName - */ - public CIMEnumInstanceNamesOp(CIMObjectPath objectName) { - this.iMethodCall = "EnumerateInstanceNames"; - this.iObjectName = objectName; - } -} +/* + CIMEnumInstanceNamesOp.java + + (C) Copyright IBM Corp. 2005, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1535756 2006-08-07 lupusalex Make code warning free + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.wbem.operations; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMObjectPath; + +/** + * CIMEnumInstanceNamesOp + * + */ +public class CIMEnumInstanceNamesOp extends CIMOperation { + + /** + * Ctor. + * + * @param objectName + */ + public CIMEnumInstanceNamesOp(CIMObjectPath objectName) { + this.iMethodCall = "EnumerateInstanceNames"; + this.iObjectName = objectName; + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumInstancesOp.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumInstancesOp.java similarity index 74% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumInstancesOp.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumInstancesOp.java index 14c5bd6..883015a 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumInstancesOp.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumInstancesOp.java @@ -1,133 +1,131 @@ -/* - CIMEnumInstancesOp.java - - (C) Copyright IBM Corp. 2005, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1535756 2006-08-07 lupusalex Make code warning free - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.operations; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; - -/** - * CIMEnumInstancesOp - * - */ -public class CIMEnumInstancesOp extends CIMOperation { - - protected boolean iDeep; - - protected boolean iLocalOnly; - - protected boolean iIncludeQualifiers; - - protected boolean iIncludeClassOrigin; - - protected String[] iPropertyList; - - /** - * Ctor. - * - * @param objectName - * @param deep - * @param localOnly - * @param includeQualifiers - * @param includeClassOrigin - * @param propertyList - */ - public CIMEnumInstancesOp(CIMObjectPath objectName, boolean deep, boolean localOnly, - boolean includeQualifiers, boolean includeClassOrigin, String[] propertyList) { - this.iMethodCall = "EnumerateInstances"; - this.iObjectName = objectName; - this.iDeep = deep; - this.iLocalOnly = localOnly; - this.iIncludeClassOrigin = includeClassOrigin; - this.iIncludeQualifiers = includeQualifiers; - this.iPropertyList = propertyList; - } - - /** - * Returns deep - * - * @return The value of deep. - */ - public boolean isDeep() { - return this.iDeep; - } - - /** - * Returns includeClassOrigin - * - * @return The value of includeClassOrigin. - */ - public boolean isIncludeClassOrigin() { - return this.iIncludeClassOrigin; - } - - /** - * Returns includeQualifiers - * - * @return The value of includeQualifiers. - */ - public boolean isIncludeQualifiers() { - return this.iIncludeQualifiers; - } - - /** - * Returns localOnly - * - * @return The value of localOnly. - */ - public boolean isLocalOnly() { - return this.iLocalOnly; - } - - /** - * Returns propertyList - * - * @return The value of propertyList. - */ - public String[] getPropertyList() { - return this.iPropertyList; - } - -} +/* + CIMEnumInstancesOp.java + + (C) Copyright IBM Corp. 2005, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1535756 2006-08-07 lupusalex Make code warning free + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.wbem.operations; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMObjectPath; + +/** + * CIMEnumInstancesOp + * + */ +public class CIMEnumInstancesOp extends CIMOperation { + + protected boolean iDeep; + + protected boolean iLocalOnly; + + protected boolean iIncludeQualifiers; + + protected boolean iIncludeClassOrigin; + + protected String[] iPropertyList; + + /** + * Ctor. + * + * @param objectName + * @param deep + * @param localOnly + * @param includeQualifiers + * @param includeClassOrigin + * @param propertyList + */ + public CIMEnumInstancesOp(CIMObjectPath objectName, boolean deep, boolean localOnly, + boolean includeQualifiers, boolean includeClassOrigin, String[] propertyList) { + this.iMethodCall = "EnumerateInstances"; + this.iObjectName = objectName; + this.iDeep = deep; + this.iLocalOnly = localOnly; + this.iIncludeClassOrigin = includeClassOrigin; + this.iIncludeQualifiers = includeQualifiers; + this.iPropertyList = propertyList; + } + + /** + * Returns deep + * + * @return The value of deep. + */ + public boolean isDeep() { + return this.iDeep; + } + + /** + * Returns includeClassOrigin + * + * @return The value of includeClassOrigin. + */ + public boolean isIncludeClassOrigin() { + return this.iIncludeClassOrigin; + } + + /** + * Returns includeQualifiers + * + * @return The value of includeQualifiers. + */ + public boolean isIncludeQualifiers() { + return this.iIncludeQualifiers; + } + + /** + * Returns localOnly + * + * @return The value of localOnly. + */ + public boolean isLocalOnly() { + return this.iLocalOnly; + } + + /** + * Returns propertyList + * + * @return The value of propertyList. + */ + public String[] getPropertyList() { + return this.iPropertyList; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumNameSpaceOp.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumNameSpaceOp.java similarity index 64% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumNameSpaceOp.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumNameSpaceOp.java index a940053..aec5631 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumNameSpaceOp.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumNameSpaceOp.java @@ -1,65 +1,63 @@ -/* - CIMEnumNameSpaceOp.java - - (C) Copyright IBM Corp. 2005, 2010 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1535756 2006-08-07 lupusalex Make code warning free - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 3001357 2010-05-18 blaschke-oss CIMDeleteNameSpaceOp name clash - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.operations; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -/** - * CIMEnumNameSpaceOp - * - */ -public class CIMEnumNameSpaceOp extends CIMOperation { - - /** - * Ctor. - * - * @param pNamespace - */ - public CIMEnumNameSpaceOp(String pNamespace) { - this.iMethodCall = "EnumNameSpace"; - this.iNameSpace = pNamespace; - } -} +/* + CIMEnumNameSpaceOp.java + + (C) Copyright IBM Corp. 2005, 2010 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1535756 2006-08-07 lupusalex Make code warning free + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 3001357 2010-05-18 blaschke-oss CIMDeleteNameSpaceOp name clash + */ + +package org.metricshub.wbem.sblim.cimclient.internal.wbem.operations; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +/** + * CIMEnumNameSpaceOp + * + */ +public class CIMEnumNameSpaceOp extends CIMOperation { + + /** + * Ctor. + * + * @param pNamespace + */ + public CIMEnumNameSpaceOp(String pNamespace) { + this.iMethodCall = "EnumNameSpace"; + this.iNameSpace = pNamespace; + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumQualifierTypesOp.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumQualifierTypesOp.java similarity index 62% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumQualifierTypesOp.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumQualifierTypesOp.java index 9b1554b..adadda4 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumQualifierTypesOp.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumQualifierTypesOp.java @@ -1,66 +1,64 @@ -/* - CIMEnumQualifierTypesOp.java - - (C) Copyright IBM Corp. 2005, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1535756 2006-08-07 lupusalex Make code warning free - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.operations; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; - -/** - * CIMEnumQualifierTypesOp - * - */ -public class CIMEnumQualifierTypesOp extends CIMOperation { - - /** - * Ctor. - * - * @param pObjectName - */ - public CIMEnumQualifierTypesOp(CIMObjectPath pObjectName) { - this.iMethodCall = "EnumerateQualifiers"; - this.iObjectName = pObjectName; - } -} +/* + CIMEnumQualifierTypesOp.java + + (C) Copyright IBM Corp. 2005, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1535756 2006-08-07 lupusalex Make code warning free + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.wbem.operations; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMObjectPath; + +/** + * CIMEnumQualifierTypesOp + * + */ +public class CIMEnumQualifierTypesOp extends CIMOperation { + + /** + * Ctor. + * + * @param pObjectName + */ + public CIMEnumQualifierTypesOp(CIMObjectPath pObjectName) { + this.iMethodCall = "EnumerateQualifiers"; + this.iObjectName = pObjectName; + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMExecQueryOp.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMExecQueryOp.java similarity index 67% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMExecQueryOp.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMExecQueryOp.java index bf05624..126446d 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMExecQueryOp.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMExecQueryOp.java @@ -1,93 +1,91 @@ -/* - CIMExecQueryOp.java - - (C) Copyright IBM Corp. 2005, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1535756 2006-08-07 lupusalex Make code warning free - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.operations; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; - -/** - * CIMExecQueryOp - * - */ -public class CIMExecQueryOp extends CIMOperation { - - protected String iQuery; - - protected String iQueryLanguage; - - /** - * Ctor. - * - * @param objectName - * @param query - * @param queryLanguage - */ - public CIMExecQueryOp(CIMObjectPath objectName, String query, String queryLanguage) { - this.iMethodCall = "ExecQuery"; - this.iObjectName = objectName; - this.iQuery = query; - this.iQueryLanguage = queryLanguage; - } - - /** - * Returns query - * - * @return The value of query. - */ - public String getQuery() { - return this.iQuery; - } - - /** - * Returns queryLanguage - * - * @return The value of queryLanguage. - */ - public String getQueryLanguage() { - return this.iQueryLanguage; - } - -} +/* + CIMExecQueryOp.java + + (C) Copyright IBM Corp. 2005, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1535756 2006-08-07 lupusalex Make code warning free + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.wbem.operations; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMObjectPath; + +/** + * CIMExecQueryOp + * + */ +public class CIMExecQueryOp extends CIMOperation { + + protected String iQuery; + + protected String iQueryLanguage; + + /** + * Ctor. + * + * @param objectName + * @param query + * @param queryLanguage + */ + public CIMExecQueryOp(CIMObjectPath objectName, String query, String queryLanguage) { + this.iMethodCall = "ExecQuery"; + this.iObjectName = objectName; + this.iQuery = query; + this.iQueryLanguage = queryLanguage; + } + + /** + * Returns query + * + * @return The value of query. + */ + public String getQuery() { + return this.iQuery; + } + + /** + * Returns queryLanguage + * + * @return The value of queryLanguage. + */ + public String getQueryLanguage() { + return this.iQueryLanguage; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMGetClassOp.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMGetClassOp.java similarity index 73% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMGetClassOp.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMGetClassOp.java index 3cf683b..bcd3dcf 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMGetClassOp.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMGetClassOp.java @@ -1,121 +1,119 @@ -/* - CIMGetClassOp.java - - (C) Copyright IBM Corp. 2005, 2012 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1535756 2006-08-07 lupusalex Make code warning free - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 3525150 2012-05-09 blaschke-oss Remove CIMGetClassOp.getPropertyLis - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.operations; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; - -/** - * CIMGetClassOp - * - */ -public class CIMGetClassOp extends CIMSingleResultOperation { - - protected boolean iLocalOnly; - - protected boolean iIncludeQualifiers; - - protected boolean iIncludeClassOrigin; - - protected String[] iPropertyList; - - /** - * Ctor. - * - * @param pObjectName - * @param pLocalOnly - * @param pIncludeQualifiers - * @param pIncludeClassOrigin - * @param pPropertyList - */ - public CIMGetClassOp(CIMObjectPath pObjectName, boolean pLocalOnly, boolean pIncludeQualifiers, - boolean pIncludeClassOrigin, String[] pPropertyList) { - - this.iMethodCall = "GetClass"; - this.iObjectName = pObjectName; - this.iLocalOnly = pLocalOnly; - this.iIncludeClassOrigin = pIncludeClassOrigin; - this.iIncludeQualifiers = pIncludeQualifiers; - } - - /** - * Returns includeClassOrigin - * - * @return The value of includeClassOrigin. - */ - public boolean isIncludeClassOrigin() { - return this.iIncludeClassOrigin; - } - - /** - * Returns includeQualifiers - * - * @return The value of includeQualifiers. - */ - public boolean isIncludeQualifiers() { - return this.iIncludeQualifiers; - } - - /** - * Returns localOnly - * - * @return The value of localOnly. - */ - public boolean isLocalOnly() { - return this.iLocalOnly; - } - - /** - * Returns propertyList - * - * @return The value of propertyList. - */ - public String[] getPropertyList() { - return this.iPropertyList; - } - -} +/* + CIMGetClassOp.java + + (C) Copyright IBM Corp. 2005, 2012 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1535756 2006-08-07 lupusalex Make code warning free + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 3525150 2012-05-09 blaschke-oss Remove CIMGetClassOp.getPropertyLis + */ + +package org.metricshub.wbem.sblim.cimclient.internal.wbem.operations; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMObjectPath; + +/** + * CIMGetClassOp + * + */ +public class CIMGetClassOp extends CIMSingleResultOperation { + + protected boolean iLocalOnly; + + protected boolean iIncludeQualifiers; + + protected boolean iIncludeClassOrigin; + + protected String[] iPropertyList; + + /** + * Ctor. + * + * @param pObjectName + * @param pLocalOnly + * @param pIncludeQualifiers + * @param pIncludeClassOrigin + * @param pPropertyList + */ + public CIMGetClassOp(CIMObjectPath pObjectName, boolean pLocalOnly, boolean pIncludeQualifiers, + boolean pIncludeClassOrigin, String[] pPropertyList) { + + this.iMethodCall = "GetClass"; + this.iObjectName = pObjectName; + this.iLocalOnly = pLocalOnly; + this.iIncludeClassOrigin = pIncludeClassOrigin; + this.iIncludeQualifiers = pIncludeQualifiers; + } + + /** + * Returns includeClassOrigin + * + * @return The value of includeClassOrigin. + */ + public boolean isIncludeClassOrigin() { + return this.iIncludeClassOrigin; + } + + /** + * Returns includeQualifiers + * + * @return The value of includeQualifiers. + */ + public boolean isIncludeQualifiers() { + return this.iIncludeQualifiers; + } + + /** + * Returns localOnly + * + * @return The value of localOnly. + */ + public boolean isLocalOnly() { + return this.iLocalOnly; + } + + /** + * Returns propertyList + * + * @return The value of propertyList. + */ + public String[] getPropertyList() { + return this.iPropertyList; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMGetInstanceOp.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMGetInstanceOp.java similarity index 73% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMGetInstanceOp.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMGetInstanceOp.java index c35ba7e..f65275f 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMGetInstanceOp.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMGetInstanceOp.java @@ -1,120 +1,118 @@ -/* - CIMGetInstanceOp.java - - (C) Copyright IBM Corp. 2005, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1535756 2006-08-07 lupusalex Make code warning free - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.operations; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; - -/** - * CIMGetInstanceOp - * - */ -public class CIMGetInstanceOp extends CIMSingleResultOperation { - - protected boolean iLocalOnly; - - protected boolean iIncludeQualifiers; - - protected boolean iIncludeClassOrigin; - - protected String[] iPropertyList; - - /** - * Ctor. - * - * @param pObjectName - * @param pLocalOnly - * @param pIncludeQualifiers - * @param pIncludeClassOrigin - * @param pPropertyList - */ - public CIMGetInstanceOp(CIMObjectPath pObjectName, boolean pLocalOnly, - boolean pIncludeQualifiers, boolean pIncludeClassOrigin, String[] pPropertyList) { - - this.iMethodCall = "GetInstance"; - this.iObjectName = pObjectName; - this.iLocalOnly = pLocalOnly; - this.iIncludeClassOrigin = pIncludeClassOrigin; - this.iIncludeQualifiers = pIncludeQualifiers; - this.iPropertyList = pPropertyList; - } - - /** - * Returns includeClassOrigin - * - * @return The value of includeClassOrigin. - */ - public boolean isIncludeClassOrigin() { - return this.iIncludeClassOrigin; - } - - /** - * Returns includeQualifiers - * - * @return The value of includeQualifiers. - */ - public boolean isIncludeQualifiers() { - return this.iIncludeQualifiers; - } - - /** - * Returns localOnly - * - * @return The value of localOnly. - */ - public boolean isLocalOnly() { - return this.iLocalOnly; - } - - /** - * Returns propertyList - * - * @return The value of propertyList. - */ - public String[] getPropertyList() { - return this.iPropertyList; - } -} +/* + CIMGetInstanceOp.java + + (C) Copyright IBM Corp. 2005, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1535756 2006-08-07 lupusalex Make code warning free + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.wbem.operations; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMObjectPath; + +/** + * CIMGetInstanceOp + * + */ +public class CIMGetInstanceOp extends CIMSingleResultOperation { + + protected boolean iLocalOnly; + + protected boolean iIncludeQualifiers; + + protected boolean iIncludeClassOrigin; + + protected String[] iPropertyList; + + /** + * Ctor. + * + * @param pObjectName + * @param pLocalOnly + * @param pIncludeQualifiers + * @param pIncludeClassOrigin + * @param pPropertyList + */ + public CIMGetInstanceOp(CIMObjectPath pObjectName, boolean pLocalOnly, + boolean pIncludeQualifiers, boolean pIncludeClassOrigin, String[] pPropertyList) { + + this.iMethodCall = "GetInstance"; + this.iObjectName = pObjectName; + this.iLocalOnly = pLocalOnly; + this.iIncludeClassOrigin = pIncludeClassOrigin; + this.iIncludeQualifiers = pIncludeQualifiers; + this.iPropertyList = pPropertyList; + } + + /** + * Returns includeClassOrigin + * + * @return The value of includeClassOrigin. + */ + public boolean isIncludeClassOrigin() { + return this.iIncludeClassOrigin; + } + + /** + * Returns includeQualifiers + * + * @return The value of includeQualifiers. + */ + public boolean isIncludeQualifiers() { + return this.iIncludeQualifiers; + } + + /** + * Returns localOnly + * + * @return The value of localOnly. + */ + public boolean isLocalOnly() { + return this.iLocalOnly; + } + + /** + * Returns propertyList + * + * @return The value of propertyList. + */ + public String[] getPropertyList() { + return this.iPropertyList; + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMGetPropertyOp.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMGetPropertyOp.java similarity index 65% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMGetPropertyOp.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMGetPropertyOp.java index 94a7696..929594f 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMGetPropertyOp.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMGetPropertyOp.java @@ -1,80 +1,78 @@ -/* - CIMGetPropertyOp.java - - (C) Copyright IBM Corp. 2005, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1535756 2006-08-07 lupusalex Make code warning free - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.operations; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; - -/** - * CIMGetPropertyOp - * - */ -public class CIMGetPropertyOp extends CIMSingleResultOperation { - - protected String iPropertyName; - - /** - * Ctor. - * - * @param pObjectName - * @param pPropertyName - */ - public CIMGetPropertyOp(CIMObjectPath pObjectName, String pPropertyName) { - this.iMethodCall = "GetProperty"; - this.iObjectName = pObjectName; - this.iPropertyName = pPropertyName; - } - - /** - * Returns propertyName - * - * @return The value of propertyName. - */ - public String getPropertyName() { - return this.iPropertyName; - } - -} +/* + CIMGetPropertyOp.java + + (C) Copyright IBM Corp. 2005, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1535756 2006-08-07 lupusalex Make code warning free + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.wbem.operations; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMObjectPath; + +/** + * CIMGetPropertyOp + * + */ +public class CIMGetPropertyOp extends CIMSingleResultOperation { + + protected String iPropertyName; + + /** + * Ctor. + * + * @param pObjectName + * @param pPropertyName + */ + public CIMGetPropertyOp(CIMObjectPath pObjectName, String pPropertyName) { + this.iMethodCall = "GetProperty"; + this.iObjectName = pObjectName; + this.iPropertyName = pPropertyName; + } + + /** + * Returns propertyName + * + * @return The value of propertyName. + */ + public String getPropertyName() { + return this.iPropertyName; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMGetQualifierTypeOp.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMGetQualifierTypeOp.java similarity index 65% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMGetQualifierTypeOp.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMGetQualifierTypeOp.java index 1730fe5..b4176d9 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMGetQualifierTypeOp.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMGetQualifierTypeOp.java @@ -1,80 +1,78 @@ -/* - CIMGetQualifierTypeOp.java - - (C) Copyright IBM Corp. 2005, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1535756 2006-08-07 lupusalex Make code warning free - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.operations; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; - -/** - * CIMGetQualifierTypeOp - * - */ -public class CIMGetQualifierTypeOp extends CIMSingleResultOperation { - - protected String iQualifierType; - - /** - * Ctor. - * - * @param pObjectName - * @param pQualifierType - */ - public CIMGetQualifierTypeOp(CIMObjectPath pObjectName, String pQualifierType) { - this.iMethodCall = "GetQualifierType"; - this.iObjectName = pObjectName; - this.iQualifierType = pQualifierType; - } - - /** - * Returns qualifierType - * - * @return The value of qualifierType. - */ - public String getQualifierType() { - return this.iQualifierType; - } - -} +/* + CIMGetQualifierTypeOp.java + + (C) Copyright IBM Corp. 2005, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1535756 2006-08-07 lupusalex Make code warning free + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.wbem.operations; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMObjectPath; + +/** + * CIMGetQualifierTypeOp + * + */ +public class CIMGetQualifierTypeOp extends CIMSingleResultOperation { + + protected String iQualifierType; + + /** + * Ctor. + * + * @param pObjectName + * @param pQualifierType + */ + public CIMGetQualifierTypeOp(CIMObjectPath pObjectName, String pQualifierType) { + this.iMethodCall = "GetQualifierType"; + this.iObjectName = pObjectName; + this.iQualifierType = pQualifierType; + } + + /** + * Returns qualifierType + * + * @return The value of qualifierType. + */ + public String getQualifierType() { + return this.iQualifierType; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMInvokeMethodOp.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMInvokeMethodOp.java similarity index 69% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMInvokeMethodOp.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMInvokeMethodOp.java index 897c171..ac5f8d0 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMInvokeMethodOp.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMInvokeMethodOp.java @@ -1,109 +1,107 @@ -/* - CIMInvokeMethodOp.java - - (C) Copyright IBM Corp. 2005, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1535756 2006-08-07 lupusalex Make code warning free - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.operations; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMArgument; -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; - -/** - * CIMInvokeMethodOp - * - */ -public class CIMInvokeMethodOp extends CIMOperation { - - protected String iMethodName; - - protected CIMArgument[] iInParams; - - protected CIMArgument[] iOutParams; - - /** - * Ctor. - * - * @param pObjectName - * @param pMethodName - * @param pInParams - * @param pOutParams - */ - public CIMInvokeMethodOp(CIMObjectPath pObjectName, String pMethodName, - CIMArgument[] pInParams, CIMArgument[] pOutParams) { - this.iMethodCall = "InvokeMethod"; - this.iObjectName = pObjectName; - this.iMethodName = pMethodName; - this.iInParams = pInParams; - this.iOutParams = pOutParams; - } - - /** - * Returns inParameters - * - * @return The value of inParameters. - */ - public CIMArgument[] getInParams() { - return this.iInParams; - } - - /** - * Returns methodName - * - * @return The value of methodName. - */ - public String getMethodName() { - return this.iMethodName; - } - - /** - * Returns outParameters - * - * @return The value of outParameters. - */ - public CIMArgument[] getOutParams() { - return this.iOutParams; - } - -} +/* + CIMInvokeMethodOp.java + + (C) Copyright IBM Corp. 2005, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1535756 2006-08-07 lupusalex Make code warning free + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics + */ + +package org.metricshub.wbem.sblim.cimclient.internal.wbem.operations; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMArgument; +import org.metricshub.wbem.javax.cim.CIMObjectPath; + +/** + * CIMInvokeMethodOp + * + */ +public class CIMInvokeMethodOp extends CIMOperation { + + protected String iMethodName; + + protected CIMArgument[] iInParams; + + protected CIMArgument[] iOutParams; + + /** + * Ctor. + * + * @param pObjectName + * @param pMethodName + * @param pInParams + * @param pOutParams + */ + public CIMInvokeMethodOp(CIMObjectPath pObjectName, String pMethodName, + CIMArgument[] pInParams, CIMArgument[] pOutParams) { + this.iMethodCall = "InvokeMethod"; + this.iObjectName = pObjectName; + this.iMethodName = pMethodName; + this.iInParams = pInParams; + this.iOutParams = pOutParams; + } + + /** + * Returns inParameters + * + * @return The value of inParameters. + */ + public CIMArgument[] getInParams() { + return this.iInParams; + } + + /** + * Returns methodName + * + * @return The value of methodName. + */ + public String getMethodName() { + return this.iMethodName; + } + + /** + * Returns outParameters + * + * @return The value of outParameters. + */ + public CIMArgument[] getOutParams() { + return this.iOutParams; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMOperation.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMOperation.java similarity index 71% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMOperation.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMOperation.java index b1cfae4..b119a50 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMOperation.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMOperation.java @@ -1,133 +1,131 @@ -/* - CIMOperation.java - - (C) Copyright IBM Corp. 2005, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1535756 2006-08-07 lupusalex Make code warning free - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.operations; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; -import org.sentrysoftware.wbem.javax.wbem.WBEMException; - -/** - * CIMOperation - * - */ -public abstract class CIMOperation { - - protected CIMObjectPath iObjectName; - - protected String iNameSpace; - - protected String iMethodCall; - - protected Object iResult; - - /** - * Returns the object name - * - * @return The object name - */ - public CIMObjectPath getObjectName() { - return this.iObjectName; - } - - /** - * Returns the namespace - * - * @return The namespace - */ - public String getNameSpace() { - return this.iNameSpace; - } - - /** - * Sets the namespace - * - * @param pNamespace - * The namespace - */ - public void setNameSpace(String pNamespace) { - this.iNameSpace = pNamespace; - } - - /** - * Returns the method call - * - * @return The method call - */ - public String getMethodCall() { - return this.iMethodCall; - } - - /** - * Returns if an (uncaught) exception occurred - * - * @return true if an (uncaught) exception occurred, - * false otherwise - */ - public boolean isException() { - return (this.iResult instanceof Exception); - } - - /** - * Returns the result of the operation - * - * @return The result - * @throws WBEMException - */ - public Object getResult() throws WBEMException { - if (this.iResult instanceof WBEMException) throw (WBEMException) this.iResult; - return this.iResult; - } - - /** - * Sets the operation result - * - * @param pResult - * The result - */ - public void setResult(Object pResult) { - this.iResult = pResult; - } -} +/* + CIMOperation.java + + (C) Copyright IBM Corp. 2005, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1535756 2006-08-07 lupusalex Make code warning free + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.wbem.operations; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMObjectPath; +import org.metricshub.wbem.javax.wbem.WBEMException; + +/** + * CIMOperation + * + */ +public abstract class CIMOperation { + + protected CIMObjectPath iObjectName; + + protected String iNameSpace; + + protected String iMethodCall; + + protected Object iResult; + + /** + * Returns the object name + * + * @return The object name + */ + public CIMObjectPath getObjectName() { + return this.iObjectName; + } + + /** + * Returns the namespace + * + * @return The namespace + */ + public String getNameSpace() { + return this.iNameSpace; + } + + /** + * Sets the namespace + * + * @param pNamespace + * The namespace + */ + public void setNameSpace(String pNamespace) { + this.iNameSpace = pNamespace; + } + + /** + * Returns the method call + * + * @return The method call + */ + public String getMethodCall() { + return this.iMethodCall; + } + + /** + * Returns if an (uncaught) exception occurred + * + * @return true if an (uncaught) exception occurred, + * false otherwise + */ + public boolean isException() { + return (this.iResult instanceof Exception); + } + + /** + * Returns the result of the operation + * + * @return The result + * @throws WBEMException + */ + public Object getResult() throws WBEMException { + if (this.iResult instanceof WBEMException) throw (WBEMException) this.iResult; + return this.iResult; + } + + /** + * Sets the operation result + * + * @param pResult + * The result + */ + public void setResult(Object pResult) { + this.iResult = pResult; + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMReferenceNamesOp.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMReferenceNamesOp.java similarity index 67% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMReferenceNamesOp.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMReferenceNamesOp.java index d7cbbac..a00bda6 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMReferenceNamesOp.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMReferenceNamesOp.java @@ -1,93 +1,91 @@ -/* - CIMReferenceNamesOp.java - - (C) Copyright IBM Corp. 2005, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1535756 2006-08-07 lupusalex Make code warning free - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.operations; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; - -/** - * CIMReferenceNamesOp - * - */ -public class CIMReferenceNamesOp extends CIMOperation { - - protected String iResultClass; - - protected String iResultRole; - - /** - * Ctor. - * - * @param pObjectName - * @param pResultClass - * @param pRole - */ - public CIMReferenceNamesOp(CIMObjectPath pObjectName, String pResultClass, String pRole) { - this.iMethodCall = "ReferenceNames"; - this.iObjectName = pObjectName; - this.iResultClass = pResultClass; - this.iResultRole = pRole; - } - - /** - * Returns resultClass - * - * @return The value of resultClass. - */ - public String getResultClass() { - return this.iResultClass; - } - - /** - * Returns resultRole - * - * @return The value of resultRole. - */ - public String getResultRole() { - return this.iResultRole; - } - -} +/* + CIMReferenceNamesOp.java + + (C) Copyright IBM Corp. 2005, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1535756 2006-08-07 lupusalex Make code warning free + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.wbem.operations; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMObjectPath; + +/** + * CIMReferenceNamesOp + * + */ +public class CIMReferenceNamesOp extends CIMOperation { + + protected String iResultClass; + + protected String iResultRole; + + /** + * Ctor. + * + * @param pObjectName + * @param pResultClass + * @param pRole + */ + public CIMReferenceNamesOp(CIMObjectPath pObjectName, String pResultClass, String pRole) { + this.iMethodCall = "ReferenceNames"; + this.iObjectName = pObjectName; + this.iResultClass = pResultClass; + this.iResultRole = pRole; + } + + /** + * Returns resultClass + * + * @return The value of resultClass. + */ + public String getResultClass() { + return this.iResultClass; + } + + /** + * Returns resultRole + * + * @return The value of resultRole. + */ + public String getResultRole() { + return this.iResultRole; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMReferencesOp.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMReferencesOp.java similarity index 73% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMReferencesOp.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMReferencesOp.java index 8350e91..89f4fd5 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMReferencesOp.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMReferencesOp.java @@ -1,132 +1,130 @@ -/* - CIMReferencesOp.java - - (C) Copyright IBM Corp. 2005, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1535756 2006-08-07 lupusalex Make code warning free - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.operations; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; - -/** - * CIMReferencesOp - * - */ -public class CIMReferencesOp extends CIMOperation { - - protected String iResultClass; - - protected String iRole; - - protected boolean iIncludeQualifiers; - - protected boolean iIncludeClassOrigin; - - protected String[] iPropertyList; - - /** - * Ctor. - * - * @param pObjectName - * @param pResultClass - * @param pRole - * @param pIncludeQualifiers - * @param pIncludeClassOrigin - * @param pPropertyList - */ - public CIMReferencesOp(CIMObjectPath pObjectName, String pResultClass, String pRole, - boolean pIncludeQualifiers, boolean pIncludeClassOrigin, String[] pPropertyList) { - this.iMethodCall = "References"; - this.iObjectName = pObjectName; - this.iResultClass = pResultClass; - this.iRole = pRole; - this.iIncludeQualifiers = pIncludeQualifiers; - this.iIncludeClassOrigin = pIncludeClassOrigin; - } - - /** - * Returns includeClassOrigin - * - * @return The value of includeClassOrigin. - */ - public boolean isIncludeClassOrigin() { - return this.iIncludeClassOrigin; - } - - /** - * Returns includeQualifiers - * - * @return The value of includeQualifiers. - */ - public boolean isIncludeQualifiers() { - return this.iIncludeQualifiers; - } - - /** - * Returns propertyList - * - * @return The value of propertyList. - */ - public String[] getPropertyList() { - return this.iPropertyList; - } - - /** - * Returns resultClass - * - * @return The value of resultClass. - */ - public String getResultClass() { - return this.iResultClass; - } - - /** - * Returns role - * - * @return The value of role. - */ - public String getRole() { - return this.iRole; - } - -} +/* + CIMReferencesOp.java + + (C) Copyright IBM Corp. 2005, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1535756 2006-08-07 lupusalex Make code warning free + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.wbem.operations; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMObjectPath; + +/** + * CIMReferencesOp + * + */ +public class CIMReferencesOp extends CIMOperation { + + protected String iResultClass; + + protected String iRole; + + protected boolean iIncludeQualifiers; + + protected boolean iIncludeClassOrigin; + + protected String[] iPropertyList; + + /** + * Ctor. + * + * @param pObjectName + * @param pResultClass + * @param pRole + * @param pIncludeQualifiers + * @param pIncludeClassOrigin + * @param pPropertyList + */ + public CIMReferencesOp(CIMObjectPath pObjectName, String pResultClass, String pRole, + boolean pIncludeQualifiers, boolean pIncludeClassOrigin, String[] pPropertyList) { + this.iMethodCall = "References"; + this.iObjectName = pObjectName; + this.iResultClass = pResultClass; + this.iRole = pRole; + this.iIncludeQualifiers = pIncludeQualifiers; + this.iIncludeClassOrigin = pIncludeClassOrigin; + } + + /** + * Returns includeClassOrigin + * + * @return The value of includeClassOrigin. + */ + public boolean isIncludeClassOrigin() { + return this.iIncludeClassOrigin; + } + + /** + * Returns includeQualifiers + * + * @return The value of includeQualifiers. + */ + public boolean isIncludeQualifiers() { + return this.iIncludeQualifiers; + } + + /** + * Returns propertyList + * + * @return The value of propertyList. + */ + public String[] getPropertyList() { + return this.iPropertyList; + } + + /** + * Returns resultClass + * + * @return The value of resultClass. + */ + public String getResultClass() { + return this.iResultClass; + } + + /** + * Returns role + * + * @return The value of role. + */ + public String getRole() { + return this.iRole; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMSetClassOp.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMSetClassOp.java similarity index 63% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMSetClassOp.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMSetClassOp.java index ec1c93a..2f00ca6 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMSetClassOp.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMSetClassOp.java @@ -1,81 +1,79 @@ -/* - CIMSetClassOp.java - - (C) Copyright IBM Corp. 2005, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1535756 2006-08-07 lupusalex Make code warning free - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.operations; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMClass; -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; - -/** - * CIMSetClassOp - * - */ -public class CIMSetClassOp extends CIMOperation { - - protected CIMClass iCimClass; - - /** - * Ctor. - * - * @param objectName - * @param cimClass - */ - public CIMSetClassOp(CIMObjectPath objectName, CIMClass cimClass) { - this.iMethodCall = "SetClass"; - this.iObjectName = objectName; - this.iCimClass = cimClass; - } - - /** - * Returns cimClass - * - * @return The value of cimClass. - */ - public CIMClass getCimClass() { - return this.iCimClass; - } - -} +/* + CIMSetClassOp.java + + (C) Copyright IBM Corp. 2005, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1535756 2006-08-07 lupusalex Make code warning free + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.wbem.operations; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMClass; +import org.metricshub.wbem.javax.cim.CIMObjectPath; + +/** + * CIMSetClassOp + * + */ +public class CIMSetClassOp extends CIMOperation { + + protected CIMClass iCimClass; + + /** + * Ctor. + * + * @param objectName + * @param cimClass + */ + public CIMSetClassOp(CIMObjectPath objectName, CIMClass cimClass) { + this.iMethodCall = "SetClass"; + this.iObjectName = objectName; + this.iCimClass = cimClass; + } + + /** + * Returns cimClass + * + * @return The value of cimClass. + */ + public CIMClass getCimClass() { + return this.iCimClass; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMSetInstanceOp.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMSetInstanceOp.java similarity index 69% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMSetInstanceOp.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMSetInstanceOp.java index 25925b2..8e6adf5 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMSetInstanceOp.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMSetInstanceOp.java @@ -1,108 +1,106 @@ -/* - CIMSetInstanceOp.java - - (C) Copyright IBM Corp. 2005, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1535756 2006-08-07 lupusalex Make code warning free - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.operations; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMInstance; -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; - -/** - * CIMSetInstanceOp - * - */ -public class CIMSetInstanceOp extends CIMOperation { - - protected CIMInstance iInstance; - - protected boolean iIncludeQualifiers; - - protected String[] iPropertyList; - - /** - * Ctor. - * - * @param objectName - * @param instance - * @param includeQualifiers - * @param propertyList - */ - public CIMSetInstanceOp(CIMObjectPath objectName, CIMInstance instance, - boolean includeQualifiers, String[] propertyList) { - this.iMethodCall = "SetInstance"; - this.iObjectName = objectName; - this.iInstance = instance; - this.iIncludeQualifiers = includeQualifiers; - this.iPropertyList = propertyList; - } - - /** - * Returns includeQualifiers - * - * @return The value of includeQualifiers. - */ - public boolean isIncludeQualifiers() { - return this.iIncludeQualifiers; - } - - /** - * Returns instance - * - * @return The value of instance. - */ - public CIMInstance getInstance() { - return this.iInstance; - } - - /** - * Returns propertyList - * - * @return The value of propertyList. - */ - public String[] getPropertyList() { - return this.iPropertyList; - } - -} +/* + CIMSetInstanceOp.java + + (C) Copyright IBM Corp. 2005, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1535756 2006-08-07 lupusalex Make code warning free + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.wbem.operations; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMInstance; +import org.metricshub.wbem.javax.cim.CIMObjectPath; + +/** + * CIMSetInstanceOp + * + */ +public class CIMSetInstanceOp extends CIMOperation { + + protected CIMInstance iInstance; + + protected boolean iIncludeQualifiers; + + protected String[] iPropertyList; + + /** + * Ctor. + * + * @param objectName + * @param instance + * @param includeQualifiers + * @param propertyList + */ + public CIMSetInstanceOp(CIMObjectPath objectName, CIMInstance instance, + boolean includeQualifiers, String[] propertyList) { + this.iMethodCall = "SetInstance"; + this.iObjectName = objectName; + this.iInstance = instance; + this.iIncludeQualifiers = includeQualifiers; + this.iPropertyList = propertyList; + } + + /** + * Returns includeQualifiers + * + * @return The value of includeQualifiers. + */ + public boolean isIncludeQualifiers() { + return this.iIncludeQualifiers; + } + + /** + * Returns instance + * + * @return The value of instance. + */ + public CIMInstance getInstance() { + return this.iInstance; + } + + /** + * Returns propertyList + * + * @return The value of propertyList. + */ + public String[] getPropertyList() { + return this.iPropertyList; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMSetPropertyOp.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMSetPropertyOp.java similarity index 67% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMSetPropertyOp.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMSetPropertyOp.java index 34318a6..0d329dd 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMSetPropertyOp.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMSetPropertyOp.java @@ -1,93 +1,91 @@ -/* - CIMSetPropertyOp.java - - (C) Copyright IBM Corp. 2005, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1535756 2006-08-07 lupusalex Make code warning free - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.operations; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; - -/** - * CIMSetPropertyOp - * - */ -public class CIMSetPropertyOp extends CIMOperation { - - protected String iPropertyName; - - protected Object iCimValue; - - /** - * Ctor. - * - * @param objectName - * @param propertyName - * @param cimValue - */ - public CIMSetPropertyOp(CIMObjectPath objectName, String propertyName, Object cimValue) { - this.iMethodCall = "SetProperty"; - this.iObjectName = objectName; - this.iCimValue = cimValue; - this.iPropertyName = propertyName; - } - - /** - * Returns cimValue - * - * @return The value of cimValue. - */ - public Object getCimValue() { - return this.iCimValue; - } - - /** - * Returns propertyName - * - * @return The value of propertyName. - */ - public String getPropertyName() { - return this.iPropertyName; - } - -} +/* + CIMSetPropertyOp.java + + (C) Copyright IBM Corp. 2005, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1535756 2006-08-07 lupusalex Make code warning free + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.wbem.operations; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMObjectPath; + +/** + * CIMSetPropertyOp + * + */ +public class CIMSetPropertyOp extends CIMOperation { + + protected String iPropertyName; + + protected Object iCimValue; + + /** + * Ctor. + * + * @param objectName + * @param propertyName + * @param cimValue + */ + public CIMSetPropertyOp(CIMObjectPath objectName, String propertyName, Object cimValue) { + this.iMethodCall = "SetProperty"; + this.iObjectName = objectName; + this.iCimValue = cimValue; + this.iPropertyName = propertyName; + } + + /** + * Returns cimValue + * + * @return The value of cimValue. + */ + public Object getCimValue() { + return this.iCimValue; + } + + /** + * Returns propertyName + * + * @return The value of propertyName. + */ + public String getPropertyName() { + return this.iPropertyName; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMSetQualifierTypeOp.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMSetQualifierTypeOp.java similarity index 65% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMSetQualifierTypeOp.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMSetQualifierTypeOp.java index 7b7ca7f..9bbb945 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMSetQualifierTypeOp.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMSetQualifierTypeOp.java @@ -1,82 +1,80 @@ -/* - CIMSetQualifierTypeOp.java - - (C) Copyright IBM Corp. 2005, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1535756 2006-08-07 lupusalex Make code warning free - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.operations; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; -import org.sentrysoftware.wbem.javax.cim.CIMQualifierType; - -/** - * CIMSetQualifierTypeOp - * - */ -public class CIMSetQualifierTypeOp extends CIMOperation { - - protected CIMQualifierType iQualifierType; - - /** - * Ctor. - * - * @param objectName - * @param qualifierType - */ - public CIMSetQualifierTypeOp(CIMObjectPath objectName, CIMQualifierType qualifierType) { - this.iMethodCall = "SetQualifierTypeOp"; - this.iObjectName = objectName; - this.iQualifierType = qualifierType; - } - - /** - * Returns qualifierType - * - * @return The value of qualifierType. - */ - public CIMQualifierType getQualifierType() { - return this.iQualifierType; - } - -} +/* + CIMSetQualifierTypeOp.java + + (C) Copyright IBM Corp. 2005, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1535756 2006-08-07 lupusalex Make code warning free + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics + */ + +package org.metricshub.wbem.sblim.cimclient.internal.wbem.operations; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.javax.cim.CIMObjectPath; +import org.metricshub.wbem.javax.cim.CIMQualifierType; + +/** + * CIMSetQualifierTypeOp + * + */ +public class CIMSetQualifierTypeOp extends CIMOperation { + + protected CIMQualifierType iQualifierType; + + /** + * Ctor. + * + * @param objectName + * @param qualifierType + */ + public CIMSetQualifierTypeOp(CIMObjectPath objectName, CIMQualifierType qualifierType) { + this.iMethodCall = "SetQualifierTypeOp"; + this.iObjectName = objectName; + this.iQualifierType = qualifierType; + } + + /** + * Returns qualifierType + * + * @return The value of qualifierType. + */ + public CIMQualifierType getQualifierType() { + return this.iQualifierType; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMSingleResultOperation.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMSingleResultOperation.java similarity index 66% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMSingleResultOperation.java rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMSingleResultOperation.java index fdc3bf3..eae45e8 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/CIMSingleResultOperation.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMSingleResultOperation.java @@ -1,72 +1,70 @@ -/* - CIMSingleResultOperation.java - - (C) Copyright IBM Corp. 2005, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1535756 2006-08-07 lupusalex Make code warning free - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - */ - -package org.sentrysoftware.wbem.sblim.cimclient.internal.wbem.operations; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.Vector; - -import org.sentrysoftware.wbem.javax.wbem.WBEMException; - -/** - * CIMSingleResultOperation - * - */ -abstract public class CIMSingleResultOperation extends CIMOperation { - - /* - * (non-Javadoc) - * - * @see org.sblim.wbem.client.operations.CIMOperation#getResult() - */ - @Override - public Object getResult() throws WBEMException { - if (this.iResult instanceof Exception) throw (WBEMException) this.iResult; - if (this.iResult instanceof Vector && ((Vector) this.iResult).size() > 0) return ((Vector) this.iResult) - .elementAt(0); - return null; - } -} +/* + CIMSingleResultOperation.java + + (C) Copyright IBM Corp. 2005, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1535756 2006-08-07 lupusalex Make code warning free + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + */ + +package org.metricshub.wbem.sblim.cimclient.internal.wbem.operations; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.Vector; + +import org.metricshub.wbem.javax.wbem.WBEMException; + +/** + * CIMSingleResultOperation + * + */ +abstract public class CIMSingleResultOperation extends CIMOperation { + + /* + * (non-Javadoc) + * + * @see org.sblim.wbem.client.operations.CIMOperation#getResult() + */ + @Override + public Object getResult() throws WBEMException { + if (this.iResult instanceof Exception) throw (WBEMException) this.iResult; + if (this.iResult instanceof Vector && ((Vector) this.iResult).size() > 0) return ((Vector) this.iResult) + .elementAt(0); + return null; + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/package.html b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/package.html similarity index 100% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/operations/package.html rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/package.html diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/package.html b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/package.html similarity index 100% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/internal/wbem/package.html rename to src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/package.html diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/cimclient/package.html b/src/main/java/org/metricshub/wbem/sblim/cimclient/package.html similarity index 100% rename from src/main/java/org/sentrysoftware/wbem/sblim/cimclient/package.html rename to src/main/java/org/metricshub/wbem/sblim/cimclient/package.html diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/slp/Advertiser.java b/src/main/java/org/metricshub/wbem/sblim/slp/Advertiser.java similarity index 83% rename from src/main/java/org/sentrysoftware/wbem/sblim/slp/Advertiser.java rename to src/main/java/org/metricshub/wbem/sblim/slp/Advertiser.java index 9ee106f..2ed1dd1 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/slp/Advertiser.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/Advertiser.java @@ -1,130 +1,128 @@ -/* - ServiceType.java - - (C) Copyright IBM Corp. 2005, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1516246 2006-07-22 lupusalex Integrate SLP client code - * 1804402 2007-09-28 ebak IPv6 ready SLP - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - */ - -package org.sentrysoftware.wbem.sblim.slp; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.Locale; -import java.util.Vector; - -/** - * The Advertiser is the SA interface, allowing clients to register new service - * instances with SLP, to change the attributes of existing services, and to - * deregister service instances. New registrations and modifications of - * attributes are made in the language locale with which the Advertiser was - * created, deregistrations of service instances are made for all locales. - */ -public interface Advertiser { - - /** - * Return the language locale with which this object was created. - * - * @return The locale - */ - public abstract Locale getLocale(); - - /** - * Register a new service with SLP having the given attributes. The API - * library is required to perform the operation in all scopes obtained - * through configuration. - * - * @param pURL - * The URL for the service. - * @param pAttributes - * A vector of ServiceLocationAttribute objects describing the - * service. - * @throws ServiceLocationException - */ - public abstract void register(ServiceURL pURL, Vector pAttributes) - throws ServiceLocationException; - - /** - * Deregister a service from the SLP framework. This has the effect of - * deregistering the service from every language locale. The API library is - * required to perform the operation in all scopes obtained through - * configuration. - * - * @param pURL - * The URL for the service. - * @throws ServiceLocationException - */ - public abstract void deregister(ServiceURL pURL) throws ServiceLocationException; - - /** - * Update the registration by adding the given attributes. The API library - * is required to perform the operation in all scopes obtained through - * configuration. - * - * @param pURL - * The URL for the service. - * @param pAttributes - * A Vector of ServiceLocationAttribute objects to add to the - * existing registration. Use an empty vector to update the URL - * alone. May not be null. - * @throws ServiceLocationException - */ - public abstract void addAttributes(ServiceURL pURL, Vector pAttributes) - throws ServiceLocationException; - - /** - * Delete the attributes from a URL for the locale with which the Advertiser - * was created. The API library is required to perform the operation in all - * scopes obtained through configuration. - * - * @param pURL - * The URL for the service. - * @param pAttributeIds - * A vector of Strings indicating the ids of the attributes to - * remove. The strings may be attribute ids or they may be - * wildcard patterns to match ids. See [7] for the syntax of - * wildcard patterns. The strings may include SLP reserved - * characters, they will be escaped by the API before - * transmission. May not be the empty vector or null. - * @throws ServiceLocationException - */ - public abstract void deleteAttributes(ServiceURL pURL, Vector pAttributeIds) - throws ServiceLocationException; -} +/* + ServiceType.java + + (C) Copyright IBM Corp. 2005, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1516246 2006-07-22 lupusalex Integrate SLP client code + * 1804402 2007-09-28 ebak IPv6 ready SLP + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + */ + +package org.metricshub.wbem.sblim.slp; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.Locale; +import java.util.Vector; + +/** + * The Advertiser is the SA interface, allowing clients to register new service + * instances with SLP, to change the attributes of existing services, and to + * deregister service instances. New registrations and modifications of + * attributes are made in the language locale with which the Advertiser was + * created, deregistrations of service instances are made for all locales. + */ +public interface Advertiser { + + /** + * Return the language locale with which this object was created. + * + * @return The locale + */ + public abstract Locale getLocale(); + + /** + * Register a new service with SLP having the given attributes. The API + * library is required to perform the operation in all scopes obtained + * through configuration. + * + * @param pURL + * The URL for the service. + * @param pAttributes + * A vector of ServiceLocationAttribute objects describing the + * service. + * @throws ServiceLocationException + */ + public abstract void register(ServiceURL pURL, Vector pAttributes) + throws ServiceLocationException; + + /** + * Deregister a service from the SLP framework. This has the effect of + * deregistering the service from every language locale. The API library is + * required to perform the operation in all scopes obtained through + * configuration. + * + * @param pURL + * The URL for the service. + * @throws ServiceLocationException + */ + public abstract void deregister(ServiceURL pURL) throws ServiceLocationException; + + /** + * Update the registration by adding the given attributes. The API library + * is required to perform the operation in all scopes obtained through + * configuration. + * + * @param pURL + * The URL for the service. + * @param pAttributes + * A Vector of ServiceLocationAttribute objects to add to the + * existing registration. Use an empty vector to update the URL + * alone. May not be null. + * @throws ServiceLocationException + */ + public abstract void addAttributes(ServiceURL pURL, Vector pAttributes) + throws ServiceLocationException; + + /** + * Delete the attributes from a URL for the locale with which the Advertiser + * was created. The API library is required to perform the operation in all + * scopes obtained through configuration. + * + * @param pURL + * The URL for the service. + * @param pAttributeIds + * A vector of Strings indicating the ids of the attributes to + * remove. The strings may be attribute ids or they may be + * wildcard patterns to match ids. See [7] for the syntax of + * wildcard patterns. The strings may include SLP reserved + * characters, they will be escaped by the API before + * transmission. May not be the empty vector or null. + * @throws ServiceLocationException + */ + public abstract void deleteAttributes(ServiceURL pURL, Vector pAttributeIds) + throws ServiceLocationException; +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/slp/Locator.java b/src/main/java/org/metricshub/wbem/sblim/slp/Locator.java similarity index 91% rename from src/main/java/org/sentrysoftware/wbem/sblim/slp/Locator.java rename to src/main/java/org/metricshub/wbem/sblim/slp/Locator.java index 9b4b861..3babc9a 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/slp/Locator.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/Locator.java @@ -1,278 +1,276 @@ -/* - ServiceType.java - - (C) Copyright IBM Corp. 2005, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1516246 2006-07-22 lupusalex Integrate SLP client code - * 1804402 2007-09-28 ebak IPv6 ready SLP - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - */ - -package org.sentrysoftware.wbem.sblim.slp; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.net.InetAddress; -import java.util.Locale; -import java.util.Vector; - -/** - * The Locator is the UA interface, allowing clients to query the SLP framework - * about existing service types, services instances, and about the attributes of - * an existing service instance or service type. Queries for services and - * attributes are made in the locale with which the Locator was created, queries - * for service types are independent of locale. - */ -public interface Locator { - - /** - * Return the language locale with which this object was created. - * - * @return The locale - */ - public abstract Locale getLocale(); - - /** - * Returns an enumeration of ServiceType objects giving known service types - * for the given scopes and given naming authority. If no service types are - * found, an empty enumeration is returned. - * - * @param pNamingAuthority - * The naming authority. Use "" for the default naming authority - * and "*" for all naming authorities. - * @param pScopes - * A Vector of scope names. The vector should be selected from - * the results of a findScopes() API invocation. Use "DEFAULT" - * for the default scope. - * @return The enumeration - * @throws ServiceLocationException - */ - public abstract ServiceLocationEnumeration findServiceTypes(String pNamingAuthority, - Vector pScopes) throws ServiceLocationException; - - /** - * Returns an enumeration of ServiceType objects giving known service types - * for the given scopes and given naming authority. If no service types are - * found, an empty enumeration is returned.
      - *
      - * This method is not part of the RFC 2614 interface definition. - * - * @param pNamingAuthority - * The naming authority. Use "" for the default naming authority - * and "*" for all naming authorities. - * @param pScopes - * A Vector of scope names. The vector should be selected from - * the results of a findScopes() API invocation. Use "DEFAULT" - * for the default scope. - * @param pDirectoryAgent - * A vector of InetAddress that specify the directory agents to - * look for. - * - * @return The enumeration - * @throws ServiceLocationException - */ - public abstract ServiceLocationEnumeration findServiceTypes(String pNamingAuthority, - Vector pScopes, Vector pDirectoryAgent) - throws ServiceLocationException; - - /** - * Returns a vector of ServiceURL objects for services matching the query, - * and having a matching type in the given scopes. If no services are found, - * an empty enumeration is returned. - * - * @param pType - * The SLP service type of the service. - * @param pScopes - * A Vector of scope names. The vector should be selected from - * the results of a findScopes() API invocation. Use "DEFAULT" - * for the default scope. - * @param pSearchFilter - * An LDAPv3 [4] string encoded query. If the filter is empty, - * i.e. "", all services of the requested type in the specified - * scopes are returned. SLP reserved characters must be escaped - * in the query. Use ServiceLocationAttribute.escapeId() and - * ServiceLocationAttribute.escapeValue() to construct the query. - * - * @return The enumeration - * @throws ServiceLocationException - */ - public abstract ServiceLocationEnumeration findServices(ServiceType pType, - Vector pScopes, String pSearchFilter) throws ServiceLocationException; - - /** - * Returns a vector of ServiceURL objects for services matching the query, - * and having a matching type in the given scopes. If no services are found, - * an empty enumeration is returned.
      - *
      - * This method is not part of the RFC 2614 interface definition. - * - * @param pType - * The SLP service type of the service. - * @param pScopes - * A Vector of scope names. The vector should be selected from - * the results of a findScopes() API invocation. Use "DEFAULT" - * for the default scope. - * @param pSearchFilter - * An LDAPv3 [4] string encoded query. If the filter is empty, - * i.e. "", all services of the requested type in the specified - * scopes are returned. SLP reserved characters must be escaped - * in the query. Use ServiceLocationAttribute.escapeId() and - * ServiceLocationAttribute.escapeValue() to construct the query. - * @param pDirectoryAgents - * A vector of InetAddress that specify the directory agents to - * look for. - * - * @return The enumeration - * @throws ServiceLocationException - */ - public abstract ServiceLocationEnumeration findServices(ServiceType pType, - Vector pScopes, String pSearchFilter, Vector pDirectoryAgents) - throws ServiceLocationException; - - /** - * For the URL and scope, return a Vector of ServiceLocationAttribute - * objects whose ids match the String patterns in the attributeIds Vector. - * The request is made in the language locale of the Locator. If no - * attributes match, an empty enumeration is returned. - * - * @param URL - * The URL for which the attributes are desired. - * @param scopes - * A Vector of scope names. The vector should be selected from - * the results of a findScopes() API invocation. Use "DEFAULT" - * for the default scope. - * @param attributeIds - * A Vector of String patterns identifying the desired - * attributes. An empty vector means return all attributes. As - * described in [7], the patterns may include wildcard to match - * substrings. The strings may include SLP reserved characters, - * they will be escaped by the API before transmission. - * @return The enumeration - * @throws ServiceLocationException - */ - public abstract ServiceLocationEnumeration findAttributes(ServiceURL URL, - Vector scopes, Vector attributeIds) throws ServiceLocationException; - - /** - * For the URL and scope, return a Vector of ServiceLocationAttribute - * objects whose ids match the String patterns in the attributeIds Vector. - * The request is made in the language locale of the Locator. If no - * attributes match, an empty enumeration is returned.
      - *
      - * This method is not part of the RFC 2614 interface definition. - * - * @param pURL - * The URL for which the attributes are desired. - * @param pScopes - * A Vector of scope names. The vector should be selected from - * the results of a findScopes() API invocation. Use "DEFAULT" - * for the default scope. - * @param pAttributeIds - * A Vector of String patterns identifying the desired - * attributes. An empty vector means return all attributes. As - * described in [7], the patterns may include wildcard to match - * substrings. The strings may include SLP reserved characters, - * they will be escaped by the API before transmission. - * @param pDirectoryAgents - * A vector of InetAddress that specify the directory agents to - * look for. - * @return The enumeration - * @throws ServiceLocationException - * - */ - public abstract ServiceLocationEnumeration findAttributes(ServiceURL pURL, - Vector pScopes, Vector pAttributeIds, - Vector pDirectoryAgents) throws ServiceLocationException; - - /** - * For the type and scope, return a Vector of all ServiceLocationAttribute - * objects whose ids match the String patterns in the attributeIds Vector - * regardless of the Locator's locale. The request is made independent of - * language locale. If no attributes are found, an empty vector is returned. - * - * @param pType - * The service type. - * @param pScopes - * A Vector of scope names. The vector should be selected from - * the results of a findScopes() API invocation. Use "DEFAULT" - * for the default scope. - * @param pAttributeIds - * A Vector of String patterns identifying the desired - * attributes. An empty vector means return all attributes. As - * described in [7], the patterns may include wildcard to match - * all prefixes or suffixes. The patterns may include SLP - * reserved characters, they will be escaped by the API before - * transmission. - * @return The enumeration - * @throws ServiceLocationException - */ - public abstract ServiceLocationEnumeration findAttributes(ServiceType pType, - Vector pScopes, Vector pAttributeIds) throws ServiceLocationException; - - /** - * For the type and scope, return a Vector of all ServiceLocationAttribute - * objects whose ids match the String patterns in the attributeIds Vector - * regardless of the Locator's locale. The request is made independent of - * language locale. If no attributes are found, an empty vector is returned.
      - *
      - * This method is not part of the RFC 2614 interface definition. - * - * @param pType - * The service type. - * @param pScopes - * A Vector of scope names. The vector should be selected from - * the results of a findScopes() API invocation. Use "DEFAULT" - * for the default scope. - * @param pAttributeIds - * A Vector of String patterns identifying the desired - * attributes. An empty vector means return all attributes. As - * described in [7], the patterns may include wildcard to match - * all prefixes or suffixes. The patterns may include SLP - * reserved characters, they will be escaped by the API before - * transmission. - * @param pDirectoryAgents - * A vector of InetAddress that specify the directory agents to - * look for. - * @return The enumeration - * @throws ServiceLocationException - */ - public abstract ServiceLocationEnumeration findAttributes(ServiceType pType, - Vector pScopes, Vector pAttributeIds, - Vector pDirectoryAgents) throws ServiceLocationException; - -} +/* + ServiceType.java + + (C) Copyright IBM Corp. 2005, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1516246 2006-07-22 lupusalex Integrate SLP client code + * 1804402 2007-09-28 ebak IPv6 ready SLP + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + */ + +package org.metricshub.wbem.sblim.slp; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.net.InetAddress; +import java.util.Locale; +import java.util.Vector; + +/** + * The Locator is the UA interface, allowing clients to query the SLP framework + * about existing service types, services instances, and about the attributes of + * an existing service instance or service type. Queries for services and + * attributes are made in the locale with which the Locator was created, queries + * for service types are independent of locale. + */ +public interface Locator { + + /** + * Return the language locale with which this object was created. + * + * @return The locale + */ + public abstract Locale getLocale(); + + /** + * Returns an enumeration of ServiceType objects giving known service types + * for the given scopes and given naming authority. If no service types are + * found, an empty enumeration is returned. + * + * @param pNamingAuthority + * The naming authority. Use "" for the default naming authority + * and "*" for all naming authorities. + * @param pScopes + * A Vector of scope names. The vector should be selected from + * the results of a findScopes() API invocation. Use "DEFAULT" + * for the default scope. + * @return The enumeration + * @throws ServiceLocationException + */ + public abstract ServiceLocationEnumeration findServiceTypes(String pNamingAuthority, + Vector pScopes) throws ServiceLocationException; + + /** + * Returns an enumeration of ServiceType objects giving known service types + * for the given scopes and given naming authority. If no service types are + * found, an empty enumeration is returned.
      + *
      + * This method is not part of the RFC 2614 interface definition. + * + * @param pNamingAuthority + * The naming authority. Use "" for the default naming authority + * and "*" for all naming authorities. + * @param pScopes + * A Vector of scope names. The vector should be selected from + * the results of a findScopes() API invocation. Use "DEFAULT" + * for the default scope. + * @param pDirectoryAgent + * A vector of InetAddress that specify the directory agents to + * look for. + * + * @return The enumeration + * @throws ServiceLocationException + */ + public abstract ServiceLocationEnumeration findServiceTypes(String pNamingAuthority, + Vector pScopes, Vector pDirectoryAgent) + throws ServiceLocationException; + + /** + * Returns a vector of ServiceURL objects for services matching the query, + * and having a matching type in the given scopes. If no services are found, + * an empty enumeration is returned. + * + * @param pType + * The SLP service type of the service. + * @param pScopes + * A Vector of scope names. The vector should be selected from + * the results of a findScopes() API invocation. Use "DEFAULT" + * for the default scope. + * @param pSearchFilter + * An LDAPv3 [4] string encoded query. If the filter is empty, + * i.e. "", all services of the requested type in the specified + * scopes are returned. SLP reserved characters must be escaped + * in the query. Use ServiceLocationAttribute.escapeId() and + * ServiceLocationAttribute.escapeValue() to construct the query. + * + * @return The enumeration + * @throws ServiceLocationException + */ + public abstract ServiceLocationEnumeration findServices(ServiceType pType, + Vector pScopes, String pSearchFilter) throws ServiceLocationException; + + /** + * Returns a vector of ServiceURL objects for services matching the query, + * and having a matching type in the given scopes. If no services are found, + * an empty enumeration is returned.
      + *
      + * This method is not part of the RFC 2614 interface definition. + * + * @param pType + * The SLP service type of the service. + * @param pScopes + * A Vector of scope names. The vector should be selected from + * the results of a findScopes() API invocation. Use "DEFAULT" + * for the default scope. + * @param pSearchFilter + * An LDAPv3 [4] string encoded query. If the filter is empty, + * i.e. "", all services of the requested type in the specified + * scopes are returned. SLP reserved characters must be escaped + * in the query. Use ServiceLocationAttribute.escapeId() and + * ServiceLocationAttribute.escapeValue() to construct the query. + * @param pDirectoryAgents + * A vector of InetAddress that specify the directory agents to + * look for. + * + * @return The enumeration + * @throws ServiceLocationException + */ + public abstract ServiceLocationEnumeration findServices(ServiceType pType, + Vector pScopes, String pSearchFilter, Vector pDirectoryAgents) + throws ServiceLocationException; + + /** + * For the URL and scope, return a Vector of ServiceLocationAttribute + * objects whose ids match the String patterns in the attributeIds Vector. + * The request is made in the language locale of the Locator. If no + * attributes match, an empty enumeration is returned. + * + * @param URL + * The URL for which the attributes are desired. + * @param scopes + * A Vector of scope names. The vector should be selected from + * the results of a findScopes() API invocation. Use "DEFAULT" + * for the default scope. + * @param attributeIds + * A Vector of String patterns identifying the desired + * attributes. An empty vector means return all attributes. As + * described in [7], the patterns may include wildcard to match + * substrings. The strings may include SLP reserved characters, + * they will be escaped by the API before transmission. + * @return The enumeration + * @throws ServiceLocationException + */ + public abstract ServiceLocationEnumeration findAttributes(ServiceURL URL, + Vector scopes, Vector attributeIds) throws ServiceLocationException; + + /** + * For the URL and scope, return a Vector of ServiceLocationAttribute + * objects whose ids match the String patterns in the attributeIds Vector. + * The request is made in the language locale of the Locator. If no + * attributes match, an empty enumeration is returned.
      + *
      + * This method is not part of the RFC 2614 interface definition. + * + * @param pURL + * The URL for which the attributes are desired. + * @param pScopes + * A Vector of scope names. The vector should be selected from + * the results of a findScopes() API invocation. Use "DEFAULT" + * for the default scope. + * @param pAttributeIds + * A Vector of String patterns identifying the desired + * attributes. An empty vector means return all attributes. As + * described in [7], the patterns may include wildcard to match + * substrings. The strings may include SLP reserved characters, + * they will be escaped by the API before transmission. + * @param pDirectoryAgents + * A vector of InetAddress that specify the directory agents to + * look for. + * @return The enumeration + * @throws ServiceLocationException + * + */ + public abstract ServiceLocationEnumeration findAttributes(ServiceURL pURL, + Vector pScopes, Vector pAttributeIds, + Vector pDirectoryAgents) throws ServiceLocationException; + + /** + * For the type and scope, return a Vector of all ServiceLocationAttribute + * objects whose ids match the String patterns in the attributeIds Vector + * regardless of the Locator's locale. The request is made independent of + * language locale. If no attributes are found, an empty vector is returned. + * + * @param pType + * The service type. + * @param pScopes + * A Vector of scope names. The vector should be selected from + * the results of a findScopes() API invocation. Use "DEFAULT" + * for the default scope. + * @param pAttributeIds + * A Vector of String patterns identifying the desired + * attributes. An empty vector means return all attributes. As + * described in [7], the patterns may include wildcard to match + * all prefixes or suffixes. The patterns may include SLP + * reserved characters, they will be escaped by the API before + * transmission. + * @return The enumeration + * @throws ServiceLocationException + */ + public abstract ServiceLocationEnumeration findAttributes(ServiceType pType, + Vector pScopes, Vector pAttributeIds) throws ServiceLocationException; + + /** + * For the type and scope, return a Vector of all ServiceLocationAttribute + * objects whose ids match the String patterns in the attributeIds Vector + * regardless of the Locator's locale. The request is made independent of + * language locale. If no attributes are found, an empty vector is returned.
      + *
      + * This method is not part of the RFC 2614 interface definition. + * + * @param pType + * The service type. + * @param pScopes + * A Vector of scope names. The vector should be selected from + * the results of a findScopes() API invocation. Use "DEFAULT" + * for the default scope. + * @param pAttributeIds + * A Vector of String patterns identifying the desired + * attributes. An empty vector means return all attributes. As + * described in [7], the patterns may include wildcard to match + * all prefixes or suffixes. The patterns may include SLP + * reserved characters, they will be escaped by the API before + * transmission. + * @param pDirectoryAgents + * A vector of InetAddress that specify the directory agents to + * look for. + * @return The enumeration + * @throws ServiceLocationException + */ + public abstract ServiceLocationEnumeration findAttributes(ServiceType pType, + Vector pScopes, Vector pAttributeIds, + Vector pDirectoryAgents) throws ServiceLocationException; + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/slp/SLPConfigProperties.java b/src/main/java/org/metricshub/wbem/sblim/slp/SLPConfigProperties.java similarity index 93% rename from src/main/java/org/sentrysoftware/wbem/sblim/slp/SLPConfigProperties.java rename to src/main/java/org/metricshub/wbem/sblim/slp/SLPConfigProperties.java index 5e60dab..ef7c238 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/slp/SLPConfigProperties.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/SLPConfigProperties.java @@ -1,461 +1,459 @@ -/* - SLPConfigProperties.java - - (C) Copyright IBM Corp. 2006, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Alexander Wolf-Reber, IBM, a.wolf-reber@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1535793 2006-09-19 lupusalex Fix&Integrate CIM&SLP configuration classes - * 1911400 2008-03-10 blaschks-oss Source RPM file on SourceForge is broken - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors - * 2907527 2009-12-02 blaschke-oss Fix SLP properties issues - */ - -package org.sentrysoftware.wbem.sblim.slp; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -/** - * The interface SLPConfigProperties holds string constants for the - * configuration properties of the SLP package. To set a property call - * System.setProperty(name, value). Note that these properties have - * global VM scope. - * - */ -public interface SLPConfigProperties { - - /** - * A URL string giving the location of the SLP config file.
      - *
      - * By default the SLP client looks for - *
        - *
      • file:sblim-slp-client2.properties
      • - *
      • file:%USER_HOME%/sblim-slp-client2.properties
      • - *
      • file:/etc/java/sblim-slp-client2.properties
      • - *
      • file:/etc/sblim-slp-client2.properties
      • - *
      - * The first file found will be used. The default search list is not applied - * if this property is set, even if the given URL does not exist.
      - *
      - * SBLIM specific extension to RFC 2614 - */ - public static final String NET_SLP_CONFIG_URL = "net.slp.configURL"; - - /** - * A 16 bit positive integer giving the number of seconds the DA url - * lifetime should exceed the discovery interval.
      - *
      - * Default is 900 seconds (15 minutes).
      - *
      - * SBLIM specific extension to RFC 2614 - */ - public static final String NET_SLP_DA_ACTIVE_DISCOVERY_GRANULARITY = "net.slp.DAActiveDiscoveryGranularity"; - - /** - * A 16 bit positive integer giving the number of seconds between DA active - * discovery queries.
      - *
      - * Default is 900 seconds (15 minutes).
      - *
      - * If the property is set to zero, active discovery is turned off. This is - * useful when the DAs available are explicitly restricted to those obtained - * from DHCP or the net.slp.DAAddresses property. - */ - public static final String NET_SLP_DA_ACTIVE_DISCOVERY_INTERVAL = "net.slp.DAActiveDiscoveryInterval"; - - /** - * A value-list of IP addresses or DNS resolvable host names giving the - * SLPv2 DAs to use for statically configured UAs and SAs. Ignored by DAs - * (unless the DA is also an SA server).
      - *
      - * Default is none.
      - *
      - * The following grammar describes the property: - *

      - * - * addr-list = addr / addr "," addr-list
      - * addr = fqdn / hostnumber
      - * fqdn = ALPHA / ALPHA *[ anum / "-" ] anum
      - * anum = ALPHA / DIGIT
      - * hostnumber = 1*3DIGIT 3("." 1*3DIGIT)
      - *
      - *

      - * An example is:
      - *

      - * - * sawah,mandi,sambal - * - *

      - * IP addresses can be used instead of host names in networks where DNS is - * not deployed, but network administrators are reminded that using IP - * addresses will complicate machine renumbering, since the SLP - * configuration property files in statically configured networks will have - * to be changed. Similarly, if host names are used, implementors must be - * careful that a name service is available before SLP starts, in other - * words, SLP cannot be used to find the name service.
      - */ - public static final String NET_SLP_DA_ADDRESSES = "net.slp.DAAddresses"; - - /** - * A comma-separated list of parenthesized attribute/value list pairs that - * the DA must advertise in DAAdverts. The property must be in the SLP - * attribute list wire format, including escapes for reserved characters.
      - *
      - * Not evaluated by SBLIM SLP client - */ - public static final String NET_SLP_DA_ATTRIBUTES = "net.slp.DAAttributes"; - - /** - * A value-list of 32 bit integers used as timeouts, in milliseconds, to - * implement the multicast convergence algorithm during active DA discovery. - * Each value specifies the time to wait before sending the next request, or - * until nothing new has been learned from two successive requests.
      - *
      - * Default is: 200,200,200,200,300,400. - */ - public static final String NET_SLP_DA_DISCOVERY_TIMEOUTS = "net.slp.DADiscoveryTimeouts"; - - /** - * A 32 bit integer giving the number of seconds for the DA heartbeat. - * Ignored if isDA is false.
      - *
      - * Default is 10800 seconds (3 hours).
      - *
      - * Not evaluated by SBLIM SLP client - */ - public static final String NET_SLP_DA_HEARTBEAT = "net.slp.DAHeartbeat"; - - /** - * A value-list of 32 bit integers used as timeouts, in milliseconds, to - * implement unicast datagram transmission to DAs. The nth value gives the - * time to block waiting for a reply on the nth try to contact the DA.
      - *
      - * Default is: 100,200,300 - */ - public static final String NET_SLP_DATAGRAM_TIMEOUTS = "net.slp.datagramTimeouts"; - - /** - * Value-list of strings giving the IP addresses of network interfaces on - * which the DA or SA should listen on port 427 for multicast, unicast UDP, - * and TCP messages.
      - *
      - * Default is empty, i.e. use the default network interface.
      - *
      - * The grammar for this property is: - *

      - * - * addr-list = hostnumber / hostnumber "," addr-list
      - * hostnumber = 1*3DIGIT 3("." 1*3DIGIT) - *
      - *

      - * An example is: - *

      - * 195.42.42.42,195.42.142.1,195.42.120.1 - *

      - * The example machine has three interfaces on which the DA should listen. - * Note that since this property only takes IP addresses, it will need to be - * changed if the network is renumbered. - */ - public static final String NET_SLP_INTERFACES = "net.slp.interfaces"; - - /** - * A boolean indicating if broadcast should be used instead of multicast.
      - *
      - * Default is false. - */ - public static final String NET_SLP_IS_BROADCAST_ONLY = "net.slp.isBroadcastOnly"; - - /** - * A boolean indicating if the SLP server is to act as a DA. If - * false, run as a SA.
      - *
      - * Default is false. - */ - public static final String NET_SLP_IS_DA = "net.slp.isDA"; - - /** - * A RFC 1766 Language Tag for the language locale. Setting this property - * causes the property value to become the default locale for SLP messages. - * This property is also used for SA and DA configuration.
      - *
      - * Default is en.
      - *
      - * Not evaluated by SBLIM SLP client - */ - public static final String NET_SLP_LOCALE = "net.slp.locale"; - - /** - * A 32 bit integer giving the maximum number of results to accumulate and - * return for a synchronous request before the timeout, or the maximum - * number of results to return through a callback if the request results are - * reported asynchronously.
      - * Positive integers and -1 are legal values. If -1, indicates that all - * results should be returned.
      - *
      - * Default value is 2147483647 (2^31 - 1)
      - * SBLIM specific: RFC 2614 recommendation is -1.
      - *
      - * DAs and SAs always return all results that match the request. This - * configuration value applies only to UAs, that filter incoming results and - * only return as many values as net.slp.maxResults indicates. - */ - public static final String NET_SLP_MAX_RESULTS = "net.slp.maxResults"; - - /** - * A 16 bit integer giving the network packet MTU, in bytes. This is the - * maximum size of any datagram to send, but the implementation might - * receive a larger datagram. The maximum size includes IP, and UDP or TCP - * headers.
      - *
      - * Default is 1400. - */ - public static final String NET_SLP_MTU = "net.slp.MTU"; - - /** - * A 32 bit integer giving the maximum amount of time to perform multicast, - * in milliseconds.
      - *
      - * Default is 2000 ms. - */ - public static final String NET_SLP_MULTICAST_MAXIMUM_WAIT = "net.slp.multicastMaximumWait"; - - /** - * A value-list of 32 bit integers used as timeouts, in milliseconds, to - * implement the multicast convergence algorithm. Each value specifies the - * time to wait before sending the next request, or until nothing new has - * been learned from two successive requests.
      - *
      - * Default is: 200, 200, 200, 200, 300, 400
      - * SBLIM specific: RFC 2614 recommendation is - * 3000,3000,3000,3000,3000.
      - *
      - * In a fast network the aggressive values of 1000,1250,1500,2000,4000 allow - * better performance.
      - *
      - * Note that the net.slp.DADiscoveryTimeouts property must be used for - * active DA discovery. - */ - public static final String NET_SLP_MULTICAST_TIMEOUTS = "net.slp.multicastTimeouts"; - - /** - * A positive integer less than or equal to 255, giving the multicast TTL.
      - *
      - * Default is 255. - */ - public static final String NET_SLP_MULTICAST_TTL = "net.slp.multicastTTL"; - - /** - * A boolean indicating whether passive DA detection should be used.
      - *
      - * Default is true.
      - *
      - * Not evaluated by SBLIM SLP client - */ - public static final String NET_SLP_PASSIVE_DA_DETECTION = "net.slp.passiveDADetection"; - - /** - * A 16 bit integer giving the port used for listening.
      - *
      - * Default is 427. - */ - public static final String NET_SLP_PORT = "net.slp.port"; - - /** - * A boolean indicating whether IPv6 addresses should be used.
      - *
      - * Default is true. - */ - public static final String NET_SLP_USEIPV6 = "net.slp.useipv6"; - - /** - * A boolean indicating whether IPv4 addresses should be used.
      - *
      - * Default is true. - */ - public static final String NET_SLP_USEIPV4 = "net.slp.useipv4"; - - /** - * A 32 bit integer giving the maximum value for all random wait parameters, - * in milliseconds.
      - *
      - * Default is 1000 ms.
      - *
      - * Not evaluated by SBLIM SLP client - */ - public static final String NET_SLP_RANDOM_WAIT_BOUND = "net.slp.randomWaitBound"; - - /** - * A comma-separated list of parenthesized attribute/value list pairs that - * the SA must advertise in SAAdverts. The property must be in the SLP - * attribute list wire format, including escapes for reserved characters.
      - *
      - * Not evaluated by SBLIM SLP client - */ - public static final String NET_SLP_SA_ATTRIBUTES = "net.slp.SAAttributes"; - - /** - * A value-list of strings indicating the scopes that are only applied to - * SAs. In contradiction the "net.slp.useScopes" specifies the scope for UAs - * and SAs.
      - *
      - * SBLIM specific extension to RFC 2614 - */ - public static final String NET_SLP_SAONLY_SCOPES = "net.slp.SAOnlyScopes"; - - /** - * A comma-separated list of parenthesized attribute/value list pairs that - * the SA must advertise in SAAdverts. The property must be in the SLP - * attribute list wire format, including escapes for reserved characters.
      - *
      - * Not evaluated by SBLIM SLP client - */ - public static final String NET_SLP_SECURITY_ENABLED = "net.slp.securityEnabled"; - - /** - * A string containing a URL pointing to a document containing serialized - * registrations that should be processed when the DA or SA server starts - * up.
      - *
      - * Default is none.
      - *
      - * Not evaluated by SBLIM SLP client - */ - public static final String NET_SLP_SERIALIZED_REG_URL = "net.slp.serializedRegUrl"; - - /** - * A 32 bit integer giving the server socket queue length for SAs/DAs.
      - *
      - * Default is 10.
      - *
      - * SBLIM specific extension to RFC 2614 - * - */ - public static final String NET_SLP_SERVER_SOCKET_QUEUE_LENGTH = "net.slp.serverSocketQueueLength"; - - /** - * A 32 bit integer giving the TCP timeout in milliseconds.
      - *
      - * The default is 20000 ms.
      - *
      - * SBLIM specific extension to RFC 2614 - * - */ - public static final String NET_SLP_TCPTIMEOUT = "net.slp.TCPTimeout"; - - /** - * A boolean controlling printing of messages about traffic with DAs.
      - *
      - * Default is false.
      - *
      - * Not evaluated by SBLIM SLP client - */ - public static final String NET_SLP_TRACE_DA_TRAFFIC = "net.slp.traceDATraffic"; - - /** - * A boolean controlling printing details when a SLP message is dropped for - * any reason.
      - *
      - * Default is false.
      - *
      - * Not evaluated by SBLIM SLP client - */ - public static final String NET_SLP_TRACE_DROP = "net.slp.traceDrop"; - - /** - * A boolean controlling printing of details on SLP messages. The fields in - * all incoming messages and outgoing replies are printed.
      - *
      - * Default is false. - */ - public static final String NET_SLP_TRACE_MSG = "net.slp.traceMsg"; - - /** - * A boolean controlling dumps of all registered services upon registration - * and deregistration. If true, the contents of the DA or SA server are - * dumped after a registration or deregistration occurs.
      - *
      - * Default is false.
      - *
      - * Not evaluated by SBLIM SLP client - */ - public static final String NET_SLP_TRACE_REG = "net.slp.traceReg"; - - /** - * A value-list of service type names. In the absence of any DAs, UAs - * perform SA discovery for finding scopes. These SA discovery requests may - * contain a request for service types as an attribute.
      - *
      - * The API implementation will use the service type names supplied by this - * property to discover only those SAs (and their scopes) which support the - * desired service type or types. For example, if net.slp.typeHint is set to - * "service:imap,service:pop3" then SA discovery requests will include the - * search filter:
      - *
      - * (|(service-type=service:imap)(service-type=service:pop3))
      - *
      - * - * The API library can also use unicast to contact the discovered SAs for - * subsequent requests for these service types, to optimize network access.
      - *
      - * Not evaluated by SBLIM SLP client - */ - public static final String NET_SLP_TYPE_HINT = "net.slp.typeHint"; - - /** - * A value-list of strings indicating the only scopes a UA or SA is allowed - * to use when making requests or registering, or the scopes a DA must - * support.
      - * If not present for the DA and SA, then in the absence of scope - * information from DHCP, the default scope "DEFAULT" is used. If not - * present for the UA, and there is no scope information available from - * DHCP, then the user scoping model is in force.
      - * Active and passive DA discovery or SA discovery are used for scope - * discovery, and the scope "DEFAULT" is used if no other information is - * available.
      - * If a DA or SA gets another scope in a request, a SCOPE_NOT_SUPPORTED - * error should be returned, unless the request was multicast, in which case - * it should be dropped. If a DA gets another scope in a registration, a - * SCOPE_NOT_SUPPORTED error must be returned. - */ - public static final String NET_SLP_USE_SCOPES = "net.slp.useScopes"; - - /** - * Trace level. Can be ALL, INFO, WARNING, ERROR, OFF
      - *
      - * Not evaluated by SBLIM SLP client - */ - public static final String NET_SLP_TRC_LEVEL = "net.slp.trc.level"; - -} +/* + SLPConfigProperties.java + + (C) Copyright IBM Corp. 2006, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Alexander Wolf-Reber, IBM, a.wolf-reber@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1535793 2006-09-19 lupusalex Fix&Integrate CIM&SLP configuration classes + * 1911400 2008-03-10 blaschks-oss Source RPM file on SourceForge is broken + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors + * 2907527 2009-12-02 blaschke-oss Fix SLP properties issues + */ + +package org.metricshub.wbem.sblim.slp; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +/** + * The interface SLPConfigProperties holds string constants for the + * configuration properties of the SLP package. To set a property call + * System.setProperty(name, value). Note that these properties have + * global VM scope. + * + */ +public interface SLPConfigProperties { + + /** + * A URL string giving the location of the SLP config file.
      + *
      + * By default the SLP client looks for + *
        + *
      • file:sblim-slp-client2.properties
      • + *
      • file:%USER_HOME%/sblim-slp-client2.properties
      • + *
      • file:/etc/java/sblim-slp-client2.properties
      • + *
      • file:/etc/sblim-slp-client2.properties
      • + *
      + * The first file found will be used. The default search list is not applied + * if this property is set, even if the given URL does not exist.
      + *
      + * SBLIM specific extension to RFC 2614 + */ + public static final String NET_SLP_CONFIG_URL = "net.slp.configURL"; + + /** + * A 16 bit positive integer giving the number of seconds the DA url + * lifetime should exceed the discovery interval.
      + *
      + * Default is 900 seconds (15 minutes).
      + *
      + * SBLIM specific extension to RFC 2614 + */ + public static final String NET_SLP_DA_ACTIVE_DISCOVERY_GRANULARITY = "net.slp.DAActiveDiscoveryGranularity"; + + /** + * A 16 bit positive integer giving the number of seconds between DA active + * discovery queries.
      + *
      + * Default is 900 seconds (15 minutes).
      + *
      + * If the property is set to zero, active discovery is turned off. This is + * useful when the DAs available are explicitly restricted to those obtained + * from DHCP or the net.slp.DAAddresses property. + */ + public static final String NET_SLP_DA_ACTIVE_DISCOVERY_INTERVAL = "net.slp.DAActiveDiscoveryInterval"; + + /** + * A value-list of IP addresses or DNS resolvable host names giving the + * SLPv2 DAs to use for statically configured UAs and SAs. Ignored by DAs + * (unless the DA is also an SA server).
      + *
      + * Default is none.
      + *
      + * The following grammar describes the property: + *

      + * + * addr-list = addr / addr "," addr-list
      + * addr = fqdn / hostnumber
      + * fqdn = ALPHA / ALPHA *[ anum / "-" ] anum
      + * anum = ALPHA / DIGIT
      + * hostnumber = 1*3DIGIT 3("." 1*3DIGIT)
      + *
      + *

      + * An example is:
      + *

      + * + * sawah,mandi,sambal + * + *

      + * IP addresses can be used instead of host names in networks where DNS is + * not deployed, but network administrators are reminded that using IP + * addresses will complicate machine renumbering, since the SLP + * configuration property files in statically configured networks will have + * to be changed. Similarly, if host names are used, implementors must be + * careful that a name service is available before SLP starts, in other + * words, SLP cannot be used to find the name service.
      + */ + public static final String NET_SLP_DA_ADDRESSES = "net.slp.DAAddresses"; + + /** + * A comma-separated list of parenthesized attribute/value list pairs that + * the DA must advertise in DAAdverts. The property must be in the SLP + * attribute list wire format, including escapes for reserved characters.
      + *
      + * Not evaluated by SBLIM SLP client + */ + public static final String NET_SLP_DA_ATTRIBUTES = "net.slp.DAAttributes"; + + /** + * A value-list of 32 bit integers used as timeouts, in milliseconds, to + * implement the multicast convergence algorithm during active DA discovery. + * Each value specifies the time to wait before sending the next request, or + * until nothing new has been learned from two successive requests.
      + *
      + * Default is: 200,200,200,200,300,400. + */ + public static final String NET_SLP_DA_DISCOVERY_TIMEOUTS = "net.slp.DADiscoveryTimeouts"; + + /** + * A 32 bit integer giving the number of seconds for the DA heartbeat. + * Ignored if isDA is false.
      + *
      + * Default is 10800 seconds (3 hours).
      + *
      + * Not evaluated by SBLIM SLP client + */ + public static final String NET_SLP_DA_HEARTBEAT = "net.slp.DAHeartbeat"; + + /** + * A value-list of 32 bit integers used as timeouts, in milliseconds, to + * implement unicast datagram transmission to DAs. The nth value gives the + * time to block waiting for a reply on the nth try to contact the DA.
      + *
      + * Default is: 100,200,300 + */ + public static final String NET_SLP_DATAGRAM_TIMEOUTS = "net.slp.datagramTimeouts"; + + /** + * Value-list of strings giving the IP addresses of network interfaces on + * which the DA or SA should listen on port 427 for multicast, unicast UDP, + * and TCP messages.
      + *
      + * Default is empty, i.e. use the default network interface.
      + *
      + * The grammar for this property is: + *

      + * + * addr-list = hostnumber / hostnumber "," addr-list
      + * hostnumber = 1*3DIGIT 3("." 1*3DIGIT) + *
      + *

      + * An example is: + *

      + * 195.42.42.42,195.42.142.1,195.42.120.1 + *

      + * The example machine has three interfaces on which the DA should listen. + * Note that since this property only takes IP addresses, it will need to be + * changed if the network is renumbered. + */ + public static final String NET_SLP_INTERFACES = "net.slp.interfaces"; + + /** + * A boolean indicating if broadcast should be used instead of multicast.
      + *
      + * Default is false. + */ + public static final String NET_SLP_IS_BROADCAST_ONLY = "net.slp.isBroadcastOnly"; + + /** + * A boolean indicating if the SLP server is to act as a DA. If + * false, run as a SA.
      + *
      + * Default is false. + */ + public static final String NET_SLP_IS_DA = "net.slp.isDA"; + + /** + * A RFC 1766 Language Tag for the language locale. Setting this property + * causes the property value to become the default locale for SLP messages. + * This property is also used for SA and DA configuration.
      + *
      + * Default is en.
      + *
      + * Not evaluated by SBLIM SLP client + */ + public static final String NET_SLP_LOCALE = "net.slp.locale"; + + /** + * A 32 bit integer giving the maximum number of results to accumulate and + * return for a synchronous request before the timeout, or the maximum + * number of results to return through a callback if the request results are + * reported asynchronously.
      + * Positive integers and -1 are legal values. If -1, indicates that all + * results should be returned.
      + *
      + * Default value is 2147483647 (2^31 - 1)
      + * SBLIM specific: RFC 2614 recommendation is -1.
      + *
      + * DAs and SAs always return all results that match the request. This + * configuration value applies only to UAs, that filter incoming results and + * only return as many values as net.slp.maxResults indicates. + */ + public static final String NET_SLP_MAX_RESULTS = "net.slp.maxResults"; + + /** + * A 16 bit integer giving the network packet MTU, in bytes. This is the + * maximum size of any datagram to send, but the implementation might + * receive a larger datagram. The maximum size includes IP, and UDP or TCP + * headers.
      + *
      + * Default is 1400. + */ + public static final String NET_SLP_MTU = "net.slp.MTU"; + + /** + * A 32 bit integer giving the maximum amount of time to perform multicast, + * in milliseconds.
      + *
      + * Default is 2000 ms. + */ + public static final String NET_SLP_MULTICAST_MAXIMUM_WAIT = "net.slp.multicastMaximumWait"; + + /** + * A value-list of 32 bit integers used as timeouts, in milliseconds, to + * implement the multicast convergence algorithm. Each value specifies the + * time to wait before sending the next request, or until nothing new has + * been learned from two successive requests.
      + *
      + * Default is: 200, 200, 200, 200, 300, 400
      + * SBLIM specific: RFC 2614 recommendation is + * 3000,3000,3000,3000,3000.
      + *
      + * In a fast network the aggressive values of 1000,1250,1500,2000,4000 allow + * better performance.
      + *
      + * Note that the net.slp.DADiscoveryTimeouts property must be used for + * active DA discovery. + */ + public static final String NET_SLP_MULTICAST_TIMEOUTS = "net.slp.multicastTimeouts"; + + /** + * A positive integer less than or equal to 255, giving the multicast TTL.
      + *
      + * Default is 255. + */ + public static final String NET_SLP_MULTICAST_TTL = "net.slp.multicastTTL"; + + /** + * A boolean indicating whether passive DA detection should be used.
      + *
      + * Default is true.
      + *
      + * Not evaluated by SBLIM SLP client + */ + public static final String NET_SLP_PASSIVE_DA_DETECTION = "net.slp.passiveDADetection"; + + /** + * A 16 bit integer giving the port used for listening.
      + *
      + * Default is 427. + */ + public static final String NET_SLP_PORT = "net.slp.port"; + + /** + * A boolean indicating whether IPv6 addresses should be used.
      + *
      + * Default is true. + */ + public static final String NET_SLP_USEIPV6 = "net.slp.useipv6"; + + /** + * A boolean indicating whether IPv4 addresses should be used.
      + *
      + * Default is true. + */ + public static final String NET_SLP_USEIPV4 = "net.slp.useipv4"; + + /** + * A 32 bit integer giving the maximum value for all random wait parameters, + * in milliseconds.
      + *
      + * Default is 1000 ms.
      + *
      + * Not evaluated by SBLIM SLP client + */ + public static final String NET_SLP_RANDOM_WAIT_BOUND = "net.slp.randomWaitBound"; + + /** + * A comma-separated list of parenthesized attribute/value list pairs that + * the SA must advertise in SAAdverts. The property must be in the SLP + * attribute list wire format, including escapes for reserved characters.
      + *
      + * Not evaluated by SBLIM SLP client + */ + public static final String NET_SLP_SA_ATTRIBUTES = "net.slp.SAAttributes"; + + /** + * A value-list of strings indicating the scopes that are only applied to + * SAs. In contradiction the "net.slp.useScopes" specifies the scope for UAs + * and SAs.
      + *
      + * SBLIM specific extension to RFC 2614 + */ + public static final String NET_SLP_SAONLY_SCOPES = "net.slp.SAOnlyScopes"; + + /** + * A comma-separated list of parenthesized attribute/value list pairs that + * the SA must advertise in SAAdverts. The property must be in the SLP + * attribute list wire format, including escapes for reserved characters.
      + *
      + * Not evaluated by SBLIM SLP client + */ + public static final String NET_SLP_SECURITY_ENABLED = "net.slp.securityEnabled"; + + /** + * A string containing a URL pointing to a document containing serialized + * registrations that should be processed when the DA or SA server starts + * up.
      + *
      + * Default is none.
      + *
      + * Not evaluated by SBLIM SLP client + */ + public static final String NET_SLP_SERIALIZED_REG_URL = "net.slp.serializedRegUrl"; + + /** + * A 32 bit integer giving the server socket queue length for SAs/DAs.
      + *
      + * Default is 10.
      + *
      + * SBLIM specific extension to RFC 2614 + * + */ + public static final String NET_SLP_SERVER_SOCKET_QUEUE_LENGTH = "net.slp.serverSocketQueueLength"; + + /** + * A 32 bit integer giving the TCP timeout in milliseconds.
      + *
      + * The default is 20000 ms.
      + *
      + * SBLIM specific extension to RFC 2614 + * + */ + public static final String NET_SLP_TCPTIMEOUT = "net.slp.TCPTimeout"; + + /** + * A boolean controlling printing of messages about traffic with DAs.
      + *
      + * Default is false.
      + *
      + * Not evaluated by SBLIM SLP client + */ + public static final String NET_SLP_TRACE_DA_TRAFFIC = "net.slp.traceDATraffic"; + + /** + * A boolean controlling printing details when a SLP message is dropped for + * any reason.
      + *
      + * Default is false.
      + *
      + * Not evaluated by SBLIM SLP client + */ + public static final String NET_SLP_TRACE_DROP = "net.slp.traceDrop"; + + /** + * A boolean controlling printing of details on SLP messages. The fields in + * all incoming messages and outgoing replies are printed.
      + *
      + * Default is false. + */ + public static final String NET_SLP_TRACE_MSG = "net.slp.traceMsg"; + + /** + * A boolean controlling dumps of all registered services upon registration + * and deregistration. If true, the contents of the DA or SA server are + * dumped after a registration or deregistration occurs.
      + *
      + * Default is false.
      + *
      + * Not evaluated by SBLIM SLP client + */ + public static final String NET_SLP_TRACE_REG = "net.slp.traceReg"; + + /** + * A value-list of service type names. In the absence of any DAs, UAs + * perform SA discovery for finding scopes. These SA discovery requests may + * contain a request for service types as an attribute.
      + *
      + * The API implementation will use the service type names supplied by this + * property to discover only those SAs (and their scopes) which support the + * desired service type or types. For example, if net.slp.typeHint is set to + * "service:imap,service:pop3" then SA discovery requests will include the + * search filter:
      + *
      + * (|(service-type=service:imap)(service-type=service:pop3))
      + *
      + * + * The API library can also use unicast to contact the discovered SAs for + * subsequent requests for these service types, to optimize network access.
      + *
      + * Not evaluated by SBLIM SLP client + */ + public static final String NET_SLP_TYPE_HINT = "net.slp.typeHint"; + + /** + * A value-list of strings indicating the only scopes a UA or SA is allowed + * to use when making requests or registering, or the scopes a DA must + * support.
      + * If not present for the DA and SA, then in the absence of scope + * information from DHCP, the default scope "DEFAULT" is used. If not + * present for the UA, and there is no scope information available from + * DHCP, then the user scoping model is in force.
      + * Active and passive DA discovery or SA discovery are used for scope + * discovery, and the scope "DEFAULT" is used if no other information is + * available.
      + * If a DA or SA gets another scope in a request, a SCOPE_NOT_SUPPORTED + * error should be returned, unless the request was multicast, in which case + * it should be dropped. If a DA gets another scope in a registration, a + * SCOPE_NOT_SUPPORTED error must be returned. + */ + public static final String NET_SLP_USE_SCOPES = "net.slp.useScopes"; + + /** + * Trace level. Can be ALL, INFO, WARNING, ERROR, OFF
      + *
      + * Not evaluated by SBLIM SLP client + */ + public static final String NET_SLP_TRC_LEVEL = "net.slp.trc.level"; + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/slp/ServiceLocationAttribute.java b/src/main/java/org/metricshub/wbem/sblim/slp/ServiceLocationAttribute.java similarity index 90% rename from src/main/java/org/sentrysoftware/wbem/sblim/slp/ServiceLocationAttribute.java rename to src/main/java/org/metricshub/wbem/sblim/slp/ServiceLocationAttribute.java index 9bfe79a..4fcb435 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/slp/ServiceLocationAttribute.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/ServiceLocationAttribute.java @@ -1,406 +1,404 @@ -/* - ServiceLocationAttribute.java - - (C) Copyright IBM Corp. 2005, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1516246 2006-07-22 lupusalex Integrate SLP client code - * 1678915 2007-03-27 lupusalex Integrated WBEM service discovery via SLP - * 1804402 2007-09-28 ebak IPv6 ready SLP - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2795671 2009-05-22 raman_arora Add Type to Comparable - * 2797696 2009-05-27 raman_arora Input files use unsafe operations - * 2823494 2009-08-03 rgummada Change Boolean constructor to static - * 3022519 2010-06-30 blaschke-oss ServiceLocationAttribute.equals() compares same array - * 3022524 2010-06-30 blaschke-oss iSortedValueEntries not serializable in Serializable class - * 3023349 2010-07-02 blaschke-oss SLP uses # constructor instead of valueOf - * 2650 2013-07-18 blaschke-oss SLP opaque value handling incorrect - */ - -package org.sentrysoftware.wbem.sblim.slp; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.sblim.cimclient.GenericExts; -import org.sentrysoftware.wbem.sblim.slp.internal.AttributeHandler; -import org.sentrysoftware.wbem.sblim.slp.internal.Convert; -import org.sentrysoftware.wbem.sblim.slp.internal.SLPString; - -import java.io.ByteArrayOutputStream; -import java.io.Serializable; -import java.util.Arrays; -import java.util.StringTokenizer; -import java.util.Vector; - - -/** - * Service location attribute - */ -public class ServiceLocationAttribute implements Serializable { - - private static final long serialVersionUID = -6753246108754657715L; - - private Vector iValues; - - private String iId; - - /** - * Construct a service location attribute. Errors in the id or values vector - * result in an IllegalArgumentException. - * - * @param pId - * The attribute name. The String can consist of any Unicode - * character. - * @param pValues - * A Vector of one or more attribute values. Vector contents must - * be uniform in type and one of Integer, String, Boolean, or - * byte[]. If the attribute is a keyword attribute, then the - * parameter should be null. String values can consist of any - * Unicode character. - */ - public ServiceLocationAttribute(String pId, Vector pValues) { - this.iId = pId; - if (pValues != null && pValues.size() > 0) { - this.iValues = GenericExts.cloneVector(pValues); - } - } - - /** - * Construct a service location attribute from a String. - * - * @param pString - * The string to parse - * @throws ServiceLocationException - * When the string parsing failed - */ - public ServiceLocationAttribute(String pString) throws ServiceLocationException { - if (pString == null || pString.length() == 0) throw new ServiceLocationException( - ServiceLocationException.PARSE_ERROR, - "Empty or null String is not good for this constructor!"); - - if (pString.startsWith("(") && pString.endsWith(")")) { - int equalPos = pString.indexOf('='); - if (equalPos < 0) throw new ServiceLocationException( - ServiceLocationException.PARSE_ERROR, "Missing '=' from attribute string: " - + pString); - this.iId = Convert.unescape(pString.substring(1, equalPos)); - if (this.iId.length() == 0) throw new ServiceLocationException( - ServiceLocationException.PARSE_ERROR, - "Empty attribute ID in attribute string: " + pString); - String valueString = pString.substring(equalPos + 1, pString.length() - 1); - - parseValueString(valueString); - - } else { - if (pString.indexOf('(') >= 0 || pString.indexOf(')') >= 0) throw new ServiceLocationException( - ServiceLocationException.PARSE_ERROR); - this.iId = Convert.unescape(pString); - this.iValues = null; - } - } - - /** - * Returns an escaped version of the id parameter, suitable for inclusion in - * a query. Any reserved characters as specified in [7] are escaped using - * UTF-8 encoding. If any characters in the tag are illegal, throws - * IllegalArgumentException. - * - * @param pId - * The attribute id to escape. ServiceLocationException is thrown - * if any characters are illegal for an attribute tag. - * @return The escaped version - */ - public static String escapeId(String pId) { - return Convert.escape(pId, Convert.ATTR_RESERVED); - } - - /** - * Returns a String containing the escaped value parameter as a string, - * suitable for inclusion in a query. If the parameter is a string, any - * reserved characters as specified in [7] are escaped using UTF-8 encoding. - * If the parameter is a byte array, then the escaped string begins with the - * nonUTF-8 sequence `\ff` and the rest of the string consists of the - * escaped bytes, which is the encoding for opaque. If the value parameter - * is a Boolean or Integer, then the returned string contains the object - * converted into a string. If the value is any type other than String, - * Integer, Boolean or byte[], an IllegalArgumentException is thrown. - * - * @param pValue - * The attribute value to be converted into a string and escaped. - * @return The escaped value - */ - public static String escapeValue(Object pValue) { - return AttributeHandler.escapeValue(pValue); - } - - /** - * Returns a cloned vector of attribute values, or null if the attribute is - * a keyword attribute. If the attribute is single-valued, then the vector - * contains only one object. - * - * @return The value vector - * - */ - public Vector getValues() { - if (this.iValues != null) return GenericExts.cloneVector(this.iValues); - return this.iValues; - } - - /** - * Returns the attribute's name. - * - * @return The name (id) - */ - public String getId() { - return this.iId; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#equals(java.lang.Object) - * - * Overrides Object.equals(). Two attributes are equal if their identifiers - * are equal and their value vectors contain the same number of equal values - * as determined by the Object equals() method. Values having byte[] type - * are equal if the contents of all byte arrays in both attribute vectors - * match. Note that the SLP string matching algorithm [7] MUST NOT be used - * for comparing attribute identifiers or string values. - */ - @Override - public boolean equals(Object obj) { - if (obj == this) return true; - if (!(obj instanceof ServiceLocationAttribute)) return false; - - ServiceLocationAttribute that = (ServiceLocationAttribute) obj; - if (!that.getId().equalsIgnoreCase(this.iId)) return false; - - Vector thatValues = that.iValues; - if (this.iValues == null) return thatValues == null; - if (thatValues == null) return false; - if (this.iValues.size() != thatValues.size()) return false; - - ValueEntry[] thisEntries = getSortedValueEntries(); - ValueEntry[] thatEntries = that.getSortedValueEntries(); - - return Arrays.equals(thisEntries, thatEntries); - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - * - * Overrides Object.toString(). The string returned contains a formatted - * representation of the attribute, giving the attribute's id, values, and - * the Java type of the values. The returned string is suitable for - * debugging purposes, but is not in SLP wire format. - */ - @Override - public String toString() { - StringBuffer stringbuffer = new StringBuffer("("); - stringbuffer.append(this.iId); - if (this.iValues != null) { - stringbuffer.append("="); - int size = this.iValues.size(); - for (int i = 0; i < size; i++) { - Object obj = this.iValues.elementAt(i); - if (i > 0) { - stringbuffer.append(","); - } - if (obj instanceof byte[]) obj = AttributeHandler.mkOpaqueStr((byte[]) obj); - stringbuffer.append(obj.toString()); - } - - } - stringbuffer.append(")"); - return stringbuffer.toString(); - } - - private int iHashCode = 0; - - private void incHashCode(int pHashCode) { - this.iHashCode *= 31; - this.iHashCode += pHashCode; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#hashCode() - * - * Overrides Object.hashCode(). Hashes on the attribute's identifier. - */ - @Override - public int hashCode() { - if (this.iHashCode == 0) { - this.iHashCode = this.iId.hashCode(); - if (this.iValues != null) { - ValueEntry[] valueEntries = getSortedValueEntries(); - for (int i = 0; i < valueEntries.length; i++) - incHashCode(valueEntries[i].hashCode()); - } - } - return this.iHashCode; - } - - private void parseValueString(String pStr) throws ServiceLocationException { - StringTokenizer tokenizer = new StringTokenizer(pStr, ","); - this.iValues = new Vector(); - while (tokenizer.hasMoreElements()) { - String valueStr = tokenizer.nextToken(); - Object value; - try { - int intVal = Integer.parseInt(valueStr); - value = Integer.valueOf(intVal); - } catch (NumberFormatException e) { - if ("TRUE".equalsIgnoreCase(valueStr)) { - value = Boolean.TRUE; - } else if ("FALSE".equalsIgnoreCase(valueStr)) { - value = Boolean.FALSE; - } else if (valueStr.startsWith("\\FF")) { - value = parseOpaqueStr(valueStr); - } else { - value = Convert.unescape(valueStr); - } - } - this.iValues.add(value); - } - } - - private static byte[] parseOpaqueStr(String pStr) throws ServiceLocationException { - if (pStr.length() == 3) throw new ServiceLocationException( - ServiceLocationException.PARSE_ERROR, - "There must be at least three characters after \\FF in opaque string!" + " pStr=" - + pStr); - - ByteArrayOutputStream oStr = new ByteArrayOutputStream(); - int pos = 3; // skip "\\FF" - int left; - while ((left = pStr.length() - pos) > 0) { - if (left < 3) throw new ServiceLocationException(ServiceLocationException.PARSE_ERROR, - "Number of characters must be multiple of three after \\FF in opaque string!" - + " pStr=" + pStr); - if (pStr.charAt(pos) != '\\') throw new ServiceLocationException( - ServiceLocationException.PARSE_ERROR, - "Hex value must be preceded by \\ in opaque string!" + " pStr=" + pStr); - String hexStr = pStr.substring(pos + 1, pos + 3); - pos += 3; - try { - oStr.write(Integer.parseInt(hexStr, 16)); - } catch (NumberFormatException e) { - throw new ServiceLocationException(ServiceLocationException.PARSE_ERROR, - "Failed to parse hex value: " + hexStr + " in opaque string: " + pStr - + " !"); - } - } - return oStr.toByteArray(); - } - - static class ValueEntry implements Comparable { - - /** - * iStr - */ - public String iStr; - - /** - * iValue - */ - public Object iValue; - - public int compareTo(ValueEntry o) { - ValueEntry that = o; - return this.iStr.compareTo(that.iStr); - } - - @Override - public boolean equals(Object pObj) { - if (this == pObj) return true; - if (!(pObj instanceof ValueEntry)) return false; - ValueEntry that = (ValueEntry) pObj; - if (this.iValue == null) return that.iValue == null; - if (that.iValue == null) return false; - if (!this.iValue.getClass().equals(that.iValue.getClass())) return false; - if (this.iValue instanceof byte[]) return Arrays.equals((byte[]) this.iValue, - (byte[]) that.iValue); - if (this.iValue instanceof String) return this.iStr.equals(that.iStr); - return this.iValue.equals(that.iValue); - } - - @Override - public int hashCode() { - return this.iStr == null ? 1 : this.iStr.hashCode(); - } - - } - - private transient ValueEntry[] iSortedValueEntries; - - /** - * Used for equals check and hashCode calculation. - * - * @param pAttrib - * @return attribute values in unified order, which is : values are sorted - * by theirs toString(). - */ - private ValueEntry[] getSortedValueEntries() { - if (this.iValues == null) return null; - if (this.iSortedValueEntries != null) return this.iSortedValueEntries; - this.iSortedValueEntries = new ValueEntry[this.iValues.size()]; - for (int i = 0; i < this.iValues.size(); i++) { - ValueEntry entry = new ValueEntry(); - this.iSortedValueEntries[i] = entry; - Object value = this.iValues.get(i); - entry.iValue = value; - if (value == null) { - entry.iStr = ""; - } else { - if (value instanceof String) { - entry.iStr = SLPString.unify((String) value); - } else if (value instanceof byte[]) { - entry.iStr = AttributeHandler.mkOpaqueStr((byte[]) value); - } else { - entry.iStr = value.toString(); - } - } - } - Arrays.sort(this.iSortedValueEntries); - return this.iSortedValueEntries; - } - -} +/* + ServiceLocationAttribute.java + + (C) Copyright IBM Corp. 2005, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1516246 2006-07-22 lupusalex Integrate SLP client code + * 1678915 2007-03-27 lupusalex Integrated WBEM service discovery via SLP + * 1804402 2007-09-28 ebak IPv6 ready SLP + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2795671 2009-05-22 raman_arora Add Type to Comparable + * 2797696 2009-05-27 raman_arora Input files use unsafe operations + * 2823494 2009-08-03 rgummada Change Boolean constructor to static + * 3022519 2010-06-30 blaschke-oss ServiceLocationAttribute.equals() compares same array + * 3022524 2010-06-30 blaschke-oss iSortedValueEntries not serializable in Serializable class + * 3023349 2010-07-02 blaschke-oss SLP uses # constructor instead of valueOf + * 2650 2013-07-18 blaschke-oss SLP opaque value handling incorrect + */ + +package org.metricshub.wbem.sblim.slp; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.ByteArrayOutputStream; +import java.io.Serializable; +import java.util.Arrays; +import java.util.StringTokenizer; +import java.util.Vector; + +import org.metricshub.wbem.sblim.cimclient.GenericExts; +import org.metricshub.wbem.sblim.slp.internal.AttributeHandler; +import org.metricshub.wbem.sblim.slp.internal.Convert; +import org.metricshub.wbem.sblim.slp.internal.SLPString; + + +/** + * Service location attribute + */ +public class ServiceLocationAttribute implements Serializable { + + private static final long serialVersionUID = -6753246108754657715L; + + private Vector iValues; + + private String iId; + + /** + * Construct a service location attribute. Errors in the id or values vector + * result in an IllegalArgumentException. + * + * @param pId + * The attribute name. The String can consist of any Unicode + * character. + * @param pValues + * A Vector of one or more attribute values. Vector contents must + * be uniform in type and one of Integer, String, Boolean, or + * byte[]. If the attribute is a keyword attribute, then the + * parameter should be null. String values can consist of any + * Unicode character. + */ + public ServiceLocationAttribute(String pId, Vector pValues) { + this.iId = pId; + if (pValues != null && pValues.size() > 0) { + this.iValues = GenericExts.cloneVector(pValues); + } + } + + /** + * Construct a service location attribute from a String. + * + * @param pString + * The string to parse + * @throws ServiceLocationException + * When the string parsing failed + */ + public ServiceLocationAttribute(String pString) throws ServiceLocationException { + if (pString == null || pString.length() == 0) throw new ServiceLocationException( + ServiceLocationException.PARSE_ERROR, + "Empty or null String is not good for this constructor!"); + + if (pString.startsWith("(") && pString.endsWith(")")) { + int equalPos = pString.indexOf('='); + if (equalPos < 0) throw new ServiceLocationException( + ServiceLocationException.PARSE_ERROR, "Missing '=' from attribute string: " + + pString); + this.iId = Convert.unescape(pString.substring(1, equalPos)); + if (this.iId.length() == 0) throw new ServiceLocationException( + ServiceLocationException.PARSE_ERROR, + "Empty attribute ID in attribute string: " + pString); + String valueString = pString.substring(equalPos + 1, pString.length() - 1); + + parseValueString(valueString); + + } else { + if (pString.indexOf('(') >= 0 || pString.indexOf(')') >= 0) throw new ServiceLocationException( + ServiceLocationException.PARSE_ERROR); + this.iId = Convert.unescape(pString); + this.iValues = null; + } + } + + /** + * Returns an escaped version of the id parameter, suitable for inclusion in + * a query. Any reserved characters as specified in [7] are escaped using + * UTF-8 encoding. If any characters in the tag are illegal, throws + * IllegalArgumentException. + * + * @param pId + * The attribute id to escape. ServiceLocationException is thrown + * if any characters are illegal for an attribute tag. + * @return The escaped version + */ + public static String escapeId(String pId) { + return Convert.escape(pId, Convert.ATTR_RESERVED); + } + + /** + * Returns a String containing the escaped value parameter as a string, + * suitable for inclusion in a query. If the parameter is a string, any + * reserved characters as specified in [7] are escaped using UTF-8 encoding. + * If the parameter is a byte array, then the escaped string begins with the + * nonUTF-8 sequence `\ff` and the rest of the string consists of the + * escaped bytes, which is the encoding for opaque. If the value parameter + * is a Boolean or Integer, then the returned string contains the object + * converted into a string. If the value is any type other than String, + * Integer, Boolean or byte[], an IllegalArgumentException is thrown. + * + * @param pValue + * The attribute value to be converted into a string and escaped. + * @return The escaped value + */ + public static String escapeValue(Object pValue) { + return AttributeHandler.escapeValue(pValue); + } + + /** + * Returns a cloned vector of attribute values, or null if the attribute is + * a keyword attribute. If the attribute is single-valued, then the vector + * contains only one object. + * + * @return The value vector + * + */ + public Vector getValues() { + if (this.iValues != null) return GenericExts.cloneVector(this.iValues); + return this.iValues; + } + + /** + * Returns the attribute's name. + * + * @return The name (id) + */ + public String getId() { + return this.iId; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#equals(java.lang.Object) + * + * Overrides Object.equals(). Two attributes are equal if their identifiers + * are equal and their value vectors contain the same number of equal values + * as determined by the Object equals() method. Values having byte[] type + * are equal if the contents of all byte arrays in both attribute vectors + * match. Note that the SLP string matching algorithm [7] MUST NOT be used + * for comparing attribute identifiers or string values. + */ + @Override + public boolean equals(Object obj) { + if (obj == this) return true; + if (!(obj instanceof ServiceLocationAttribute)) return false; + + ServiceLocationAttribute that = (ServiceLocationAttribute) obj; + if (!that.getId().equalsIgnoreCase(this.iId)) return false; + + Vector thatValues = that.iValues; + if (this.iValues == null) return thatValues == null; + if (thatValues == null) return false; + if (this.iValues.size() != thatValues.size()) return false; + + ValueEntry[] thisEntries = getSortedValueEntries(); + ValueEntry[] thatEntries = that.getSortedValueEntries(); + + return Arrays.equals(thisEntries, thatEntries); + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + * + * Overrides Object.toString(). The string returned contains a formatted + * representation of the attribute, giving the attribute's id, values, and + * the Java type of the values. The returned string is suitable for + * debugging purposes, but is not in SLP wire format. + */ + @Override + public String toString() { + StringBuffer stringbuffer = new StringBuffer("("); + stringbuffer.append(this.iId); + if (this.iValues != null) { + stringbuffer.append("="); + int size = this.iValues.size(); + for (int i = 0; i < size; i++) { + Object obj = this.iValues.elementAt(i); + if (i > 0) { + stringbuffer.append(","); + } + if (obj instanceof byte[]) obj = AttributeHandler.mkOpaqueStr((byte[]) obj); + stringbuffer.append(obj.toString()); + } + + } + stringbuffer.append(")"); + return stringbuffer.toString(); + } + + private int iHashCode = 0; + + private void incHashCode(int pHashCode) { + this.iHashCode *= 31; + this.iHashCode += pHashCode; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#hashCode() + * + * Overrides Object.hashCode(). Hashes on the attribute's identifier. + */ + @Override + public int hashCode() { + if (this.iHashCode == 0) { + this.iHashCode = this.iId.hashCode(); + if (this.iValues != null) { + ValueEntry[] valueEntries = getSortedValueEntries(); + for (int i = 0; i < valueEntries.length; i++) + incHashCode(valueEntries[i].hashCode()); + } + } + return this.iHashCode; + } + + private void parseValueString(String pStr) throws ServiceLocationException { + StringTokenizer tokenizer = new StringTokenizer(pStr, ","); + this.iValues = new Vector(); + while (tokenizer.hasMoreElements()) { + String valueStr = tokenizer.nextToken(); + Object value; + try { + int intVal = Integer.parseInt(valueStr); + value = Integer.valueOf(intVal); + } catch (NumberFormatException e) { + if ("TRUE".equalsIgnoreCase(valueStr)) { + value = Boolean.TRUE; + } else if ("FALSE".equalsIgnoreCase(valueStr)) { + value = Boolean.FALSE; + } else if (valueStr.startsWith("\\FF")) { + value = parseOpaqueStr(valueStr); + } else { + value = Convert.unescape(valueStr); + } + } + this.iValues.add(value); + } + } + + private static byte[] parseOpaqueStr(String pStr) throws ServiceLocationException { + if (pStr.length() == 3) throw new ServiceLocationException( + ServiceLocationException.PARSE_ERROR, + "There must be at least three characters after \\FF in opaque string!" + " pStr=" + + pStr); + + ByteArrayOutputStream oStr = new ByteArrayOutputStream(); + int pos = 3; // skip "\\FF" + int left; + while ((left = pStr.length() - pos) > 0) { + if (left < 3) throw new ServiceLocationException(ServiceLocationException.PARSE_ERROR, + "Number of characters must be multiple of three after \\FF in opaque string!" + + " pStr=" + pStr); + if (pStr.charAt(pos) != '\\') throw new ServiceLocationException( + ServiceLocationException.PARSE_ERROR, + "Hex value must be preceded by \\ in opaque string!" + " pStr=" + pStr); + String hexStr = pStr.substring(pos + 1, pos + 3); + pos += 3; + try { + oStr.write(Integer.parseInt(hexStr, 16)); + } catch (NumberFormatException e) { + throw new ServiceLocationException(ServiceLocationException.PARSE_ERROR, + "Failed to parse hex value: " + hexStr + " in opaque string: " + pStr + + " !"); + } + } + return oStr.toByteArray(); + } + + static class ValueEntry implements Comparable { + + /** + * iStr + */ + public String iStr; + + /** + * iValue + */ + public Object iValue; + + public int compareTo(ValueEntry o) { + ValueEntry that = o; + return this.iStr.compareTo(that.iStr); + } + + @Override + public boolean equals(Object pObj) { + if (this == pObj) return true; + if (!(pObj instanceof ValueEntry)) return false; + ValueEntry that = (ValueEntry) pObj; + if (this.iValue == null) return that.iValue == null; + if (that.iValue == null) return false; + if (!this.iValue.getClass().equals(that.iValue.getClass())) return false; + if (this.iValue instanceof byte[]) return Arrays.equals((byte[]) this.iValue, + (byte[]) that.iValue); + if (this.iValue instanceof String) return this.iStr.equals(that.iStr); + return this.iValue.equals(that.iValue); + } + + @Override + public int hashCode() { + return this.iStr == null ? 1 : this.iStr.hashCode(); + } + + } + + private transient ValueEntry[] iSortedValueEntries; + + /** + * Used for equals check and hashCode calculation. + * + * @param pAttrib + * @return attribute values in unified order, which is : values are sorted + * by theirs toString(). + */ + private ValueEntry[] getSortedValueEntries() { + if (this.iValues == null) return null; + if (this.iSortedValueEntries != null) return this.iSortedValueEntries; + this.iSortedValueEntries = new ValueEntry[this.iValues.size()]; + for (int i = 0; i < this.iValues.size(); i++) { + ValueEntry entry = new ValueEntry(); + this.iSortedValueEntries[i] = entry; + Object value = this.iValues.get(i); + entry.iValue = value; + if (value == null) { + entry.iStr = ""; + } else { + if (value instanceof String) { + entry.iStr = SLPString.unify((String) value); + } else if (value instanceof byte[]) { + entry.iStr = AttributeHandler.mkOpaqueStr((byte[]) value); + } else { + entry.iStr = value.toString(); + } + } + } + Arrays.sort(this.iSortedValueEntries); + return this.iSortedValueEntries; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/slp/ServiceLocationAttributeDescriptor.java b/src/main/java/org/metricshub/wbem/sblim/slp/ServiceLocationAttributeDescriptor.java similarity index 82% rename from src/main/java/org/sentrysoftware/wbem/sblim/slp/ServiceLocationAttributeDescriptor.java rename to src/main/java/org/metricshub/wbem/sblim/slp/ServiceLocationAttributeDescriptor.java index 4d2e5a9..b5b0029 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/slp/ServiceLocationAttributeDescriptor.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/ServiceLocationAttributeDescriptor.java @@ -1,166 +1,164 @@ -/* - ServiceLocationAttributeDescriptor.java - - (C) Copyright IBM Corp. 2005, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1516246 2006-07-22 lupusalex Integrate SLP client code - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - */ - -package org.sentrysoftware.wbem.sblim.slp; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.Enumeration; - -/** - * The ServiceLocationAttributeDescriptor interface provides introspection on a - * template attribute definition (see RFC 2609). Classes implementing the - * ServiceLocationAttributeDescriptor interface return information on a - * particular service location attribute definition from the service template. - * This information is primarily for GUI tools. Programmatic attribute - * verification should be done through the ServiceLocationAttributeVerifier. - * - */ -public interface ServiceLocationAttributeDescriptor { - - /** - * Return a String containing the attribute's id. - * - * @return The id - */ - public abstract String getId(); - - /** - * Returns a String containing the fully package-qualified Java type of the - * attribute. SLP types are translated into Java types as follows:
      - *
      - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
      SLPJava
      STRING"java.lang.String"
      INTEGER"java.lang.Integer"
      BOOLEAN"java.lang.Boolean"
      OPAQUE"[B" (byte[])
      KEYWORD"" (empty string)
      - * - * @return The Java type - */ - public abstract String getValueType(); - - /** - * Return a String containing the attribute's help text. - * - * @return The description - */ - public abstract String getDescription(); - - /** - * Return an Enumeration of allowed values for the attribute type. For - * keyword attributes returns null. For no allowed values (i.e. - * unrestricted) returns an empty Enumeration. - * - * @return The allowed values - */ - public abstract Enumeration getAllowedValues(); - - /** - * Return an Enumeration of default values for the attribute type. For - * keyword attributes returns null. For no allowed values (i.e. - * unrestricted) returns an empty Enumeration. - * - * @return The default values - */ - public abstract Enumeration getDefaultValues(); - - /** - * Returns true if the "X" flag is set, indicating that the attribute should - * be included in an any Locator.findServices() request search filter. - * - * @return true if "X" is set, false otherwise - */ - public abstract boolean getRequiresExplicitMatch(); - - /** - * Returns true if the "M" flag is set. - * - * @return true if "M" is set, false otherwise - */ - public abstract boolean getIsMultivalued(); - - /** - * Returns true if the "O"" flag is set. - * - * @return true if "O" is set, false otherwise - */ - public abstract boolean getIsOptional(); - - /** - * Returns true if the "L" flag is set. - * - * @return true if "L" is set, false otherwise - */ - public abstract boolean getIsLiteral(); - - /** - * Returns true if the attribute is a keyword attribute. - * - * @return true if the attribute is a keyword, - * false otherwise - */ - public abstract boolean getIsKeyword(); - -} +/* + ServiceLocationAttributeDescriptor.java + + (C) Copyright IBM Corp. 2005, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1516246 2006-07-22 lupusalex Integrate SLP client code + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + */ + +package org.metricshub.wbem.sblim.slp; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.Enumeration; + +/** + * The ServiceLocationAttributeDescriptor interface provides introspection on a + * template attribute definition (see RFC 2609). Classes implementing the + * ServiceLocationAttributeDescriptor interface return information on a + * particular service location attribute definition from the service template. + * This information is primarily for GUI tools. Programmatic attribute + * verification should be done through the ServiceLocationAttributeVerifier. + * + */ +public interface ServiceLocationAttributeDescriptor { + + /** + * Return a String containing the attribute's id. + * + * @return The id + */ + public abstract String getId(); + + /** + * Returns a String containing the fully package-qualified Java type of the + * attribute. SLP types are translated into Java types as follows:
      + *
      + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
      SLPJava
      STRING"java.lang.String"
      INTEGER"java.lang.Integer"
      BOOLEAN"java.lang.Boolean"
      OPAQUE"[B" (byte[])
      KEYWORD"" (empty string)
      + * + * @return The Java type + */ + public abstract String getValueType(); + + /** + * Return a String containing the attribute's help text. + * + * @return The description + */ + public abstract String getDescription(); + + /** + * Return an Enumeration of allowed values for the attribute type. For + * keyword attributes returns null. For no allowed values (i.e. + * unrestricted) returns an empty Enumeration. + * + * @return The allowed values + */ + public abstract Enumeration getAllowedValues(); + + /** + * Return an Enumeration of default values for the attribute type. For + * keyword attributes returns null. For no allowed values (i.e. + * unrestricted) returns an empty Enumeration. + * + * @return The default values + */ + public abstract Enumeration getDefaultValues(); + + /** + * Returns true if the "X" flag is set, indicating that the attribute should + * be included in an any Locator.findServices() request search filter. + * + * @return true if "X" is set, false otherwise + */ + public abstract boolean getRequiresExplicitMatch(); + + /** + * Returns true if the "M" flag is set. + * + * @return true if "M" is set, false otherwise + */ + public abstract boolean getIsMultivalued(); + + /** + * Returns true if the "O"" flag is set. + * + * @return true if "O" is set, false otherwise + */ + public abstract boolean getIsOptional(); + + /** + * Returns true if the "L" flag is set. + * + * @return true if "L" is set, false otherwise + */ + public abstract boolean getIsLiteral(); + + /** + * Returns true if the attribute is a keyword attribute. + * + * @return true if the attribute is a keyword, + * false otherwise + */ + public abstract boolean getIsKeyword(); + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/slp/ServiceLocationAttributeVerifier.java b/src/main/java/org/metricshub/wbem/sblim/slp/ServiceLocationAttributeVerifier.java similarity index 83% rename from src/main/java/org/sentrysoftware/wbem/sblim/slp/ServiceLocationAttributeVerifier.java rename to src/main/java/org/metricshub/wbem/sblim/slp/ServiceLocationAttributeVerifier.java index 34e63cf..c9431b0 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/slp/ServiceLocationAttributeVerifier.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/ServiceLocationAttributeVerifier.java @@ -1,155 +1,153 @@ -/* - ServiceLocationAttributeVerifier.java - - (C) Copyright IBM Corp. 2005, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1516246 2006-07-22 lupusalex Integrate SLP client code - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - */ - -package org.sentrysoftware.wbem.sblim.slp; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.Enumeration; -import java.util.Locale; -import java.util.Vector; - -/** - * The ServiceLocationAttributeVerifier provides access to service templates. - * Classes implementing this interface parse SLP template definitions, provide - * information on attribute definitions for service types, and verify whether a - * ServiceLocationAttribute object matches a template for a particular service - * type. Clients obtain ServiceLocationAttributeVerifier objects for specific - * SLP service types through the TemplateRegistry. - * - * - */ -public interface ServiceLocationAttributeVerifier { - - /** - * Returns the SLP service type for which this is the verifier. - * - * @return The service type - */ - public abstract ServiceType getServiceType(); - - /** - * Return the language locale of the template. - * - * @return The locale - */ - public abstract Locale getLocale(); - - /** - * Return the template version number identifier. - * - * @return The version - */ - public abstract String getVersion(); - - /** - * Return the URL syntax expression for the service: URL. - * - * @return The url syntax - */ - public abstract String getURLSyntax(); - - /** - * Return the descriptive help text for the template. - * - * @return The description - */ - public abstract String getDescription(); - - /** - * Return the ServiceLocationAttributeDescriptor for the attribute having - * the named id. If no such attribute exists in this template, return null. - * This method is primarily for GUI tools to display attribute information. - * Programmatic verification of attributes should use the verifyAttribute() - * method. - * - * @param pAttributeId - * The attribute id - * @return The descriptor - */ - public abstract ServiceLocationAttributeDescriptor getAttributeDescriptor(String pAttributeId); - - /** - * Returns an Enumeration allowing introspection on the attribute definition - * in the service template. The Enumeration returns - * ServiceLocationAttributeDescriptor objects for the attributes. This - * method is primarily for GUI tools to display attribute information. - * Programmatic verification of attributes should use the verifyAttribute() - * method. - * - * @return Enumeration of attribute descriptors - */ - public abstract Enumeration getAttributeDescriptors(); - - /** - * Verify that the attribute matches the template definition. If the - * attribute doesn't match, ServiceLocationException is thrown with the - * error code as ServiceLocationException.PARSE_ERROR. - * - * @param pAttribute - * The ServiceLocationAttribute object to be verified. - * @throws ServiceLocationException - * if validation failed - * - */ - public abstract void verifyAttribute(ServiceLocationAttribute pAttribute) - throws ServiceLocationException; - - /** - * Verify that the Vector of ServiceLocationAttribute objects matches the - * template for this service type. The vector must contain all the required - * attributes, and all attributes must match their template definitions. If - * the attributes don't match, ServiceLocationException is thrown with the - * error code as ServiceLocationException.PARSE_ERROR - * - * @param pAttributeVector - * A Vector of ServiceLocationAttribute objects for the - * registration. - * @throws ServiceLocationException - * if attributes don't match - */ - public abstract void verifyRegistration(Vector pAttributeVector) - throws ServiceLocationException; - -} +/* + ServiceLocationAttributeVerifier.java + + (C) Copyright IBM Corp. 2005, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1516246 2006-07-22 lupusalex Integrate SLP client code + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + */ + +package org.metricshub.wbem.sblim.slp; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.Enumeration; +import java.util.Locale; +import java.util.Vector; + +/** + * The ServiceLocationAttributeVerifier provides access to service templates. + * Classes implementing this interface parse SLP template definitions, provide + * information on attribute definitions for service types, and verify whether a + * ServiceLocationAttribute object matches a template for a particular service + * type. Clients obtain ServiceLocationAttributeVerifier objects for specific + * SLP service types through the TemplateRegistry. + * + * + */ +public interface ServiceLocationAttributeVerifier { + + /** + * Returns the SLP service type for which this is the verifier. + * + * @return The service type + */ + public abstract ServiceType getServiceType(); + + /** + * Return the language locale of the template. + * + * @return The locale + */ + public abstract Locale getLocale(); + + /** + * Return the template version number identifier. + * + * @return The version + */ + public abstract String getVersion(); + + /** + * Return the URL syntax expression for the service: URL. + * + * @return The url syntax + */ + public abstract String getURLSyntax(); + + /** + * Return the descriptive help text for the template. + * + * @return The description + */ + public abstract String getDescription(); + + /** + * Return the ServiceLocationAttributeDescriptor for the attribute having + * the named id. If no such attribute exists in this template, return null. + * This method is primarily for GUI tools to display attribute information. + * Programmatic verification of attributes should use the verifyAttribute() + * method. + * + * @param pAttributeId + * The attribute id + * @return The descriptor + */ + public abstract ServiceLocationAttributeDescriptor getAttributeDescriptor(String pAttributeId); + + /** + * Returns an Enumeration allowing introspection on the attribute definition + * in the service template. The Enumeration returns + * ServiceLocationAttributeDescriptor objects for the attributes. This + * method is primarily for GUI tools to display attribute information. + * Programmatic verification of attributes should use the verifyAttribute() + * method. + * + * @return Enumeration of attribute descriptors + */ + public abstract Enumeration getAttributeDescriptors(); + + /** + * Verify that the attribute matches the template definition. If the + * attribute doesn't match, ServiceLocationException is thrown with the + * error code as ServiceLocationException.PARSE_ERROR. + * + * @param pAttribute + * The ServiceLocationAttribute object to be verified. + * @throws ServiceLocationException + * if validation failed + * + */ + public abstract void verifyAttribute(ServiceLocationAttribute pAttribute) + throws ServiceLocationException; + + /** + * Verify that the Vector of ServiceLocationAttribute objects matches the + * template for this service type. The vector must contain all the required + * attributes, and all attributes must match their template definitions. If + * the attributes don't match, ServiceLocationException is thrown with the + * error code as ServiceLocationException.PARSE_ERROR + * + * @param pAttributeVector + * A Vector of ServiceLocationAttribute objects for the + * registration. + * @throws ServiceLocationException + * if attributes don't match + */ + public abstract void verifyRegistration(Vector pAttributeVector) + throws ServiceLocationException; + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/slp/ServiceLocationEnumeration.java b/src/main/java/org/metricshub/wbem/sblim/slp/ServiceLocationEnumeration.java similarity index 77% rename from src/main/java/org/sentrysoftware/wbem/sblim/slp/ServiceLocationEnumeration.java rename to src/main/java/org/metricshub/wbem/sblim/slp/ServiceLocationEnumeration.java index a42bfb6..8045954 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/slp/ServiceLocationEnumeration.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/ServiceLocationEnumeration.java @@ -1,92 +1,90 @@ -/* - ServiceLocationEnumeration.java - - (C) Copyright IBM Corp. 2005, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1516246 2006-07-22 lupusalex Integrate SLP client code - * 1949918 2008-04-08 raman_arora Malformed service URL crashes SLP discovery - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - */ - -package org.sentrysoftware.wbem.sblim.slp; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.Enumeration; -import java.util.NoSuchElementException; - -/** - * The ServiceLocationEnumeration class is the return type for all Locator SLP - * operations. The Java API library may implement this class to block until - * results are available from the SLP operation, so that the client can achieve - * asynchronous operation by retrieving results from the enumeration in a - * separate thread. Clients use the superclass nextElement() method if they are - * unconcerned with SLP exceptions (this method will never ever throw one). - */ -public interface ServiceLocationEnumeration extends Enumeration { - - /** - * Return the next value or block until it becomes available. - * - * @return The next value - * @throws ServiceLocationException - * Thrown if the SLP operation encounters an error. - * @throws NoSuchElementException - * If there are no more elements to return. - */ - public abstract Object next() throws ServiceLocationException, NoSuchElementException; - - /** - * @return next Object in Exception table - * @throws NoSuchElementException - * - * This in internal implementation to get list of all exceptions - * thrown/caught by parser This can throw RuntimeExceptions. - * They can be ignored or used for analysis. - * - * use hasNextException to check whether there exists another - * element in Exception table - */ - public abstract Object nextException() throws NoSuchElementException; - - /** - * @return true if there exists another element in Exception table - * - */ - public abstract boolean hasMoreExceptions(); -} +/* + ServiceLocationEnumeration.java + + (C) Copyright IBM Corp. 2005, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1516246 2006-07-22 lupusalex Integrate SLP client code + * 1949918 2008-04-08 raman_arora Malformed service URL crashes SLP discovery + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + */ + +package org.metricshub.wbem.sblim.slp; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.Enumeration; +import java.util.NoSuchElementException; + +/** + * The ServiceLocationEnumeration class is the return type for all Locator SLP + * operations. The Java API library may implement this class to block until + * results are available from the SLP operation, so that the client can achieve + * asynchronous operation by retrieving results from the enumeration in a + * separate thread. Clients use the superclass nextElement() method if they are + * unconcerned with SLP exceptions (this method will never ever throw one). + */ +public interface ServiceLocationEnumeration extends Enumeration { + + /** + * Return the next value or block until it becomes available. + * + * @return The next value + * @throws ServiceLocationException + * Thrown if the SLP operation encounters an error. + * @throws NoSuchElementException + * If there are no more elements to return. + */ + public abstract Object next() throws ServiceLocationException, NoSuchElementException; + + /** + * @return next Object in Exception table + * @throws NoSuchElementException + * + * This in internal implementation to get list of all exceptions + * thrown/caught by parser This can throw RuntimeExceptions. + * They can be ignored or used for analysis. + * + * use hasNextException to check whether there exists another + * element in Exception table + */ + public abstract Object nextException() throws NoSuchElementException; + + /** + * @return true if there exists another element in Exception table + * + */ + public abstract boolean hasMoreExceptions(); +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/slp/ServiceLocationException.java b/src/main/java/org/metricshub/wbem/sblim/slp/ServiceLocationException.java similarity index 86% rename from src/main/java/org/sentrysoftware/wbem/sblim/slp/ServiceLocationException.java rename to src/main/java/org/metricshub/wbem/sblim/slp/ServiceLocationException.java index 71ae593..30c126d 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/slp/ServiceLocationException.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/ServiceLocationException.java @@ -1,262 +1,260 @@ -/* - ServiceLocationException.java - - (C) Copyright IBM Corp. 2005, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1516246 2006-07-22 lupusalex Integrate SLP client code - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.slp; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -/** - * The ServiceLocationException class is thrown by all methods when exceptional - * conditions occur in the SLP framework. The error code property determines the - * exact nature of the condition, and an optional message may provide more - * information. - */ -public class ServiceLocationException extends Exception { - - private static final long serialVersionUID = 6414188770647750627L; - - /** - * OK - */ - public static final short OK = 0; - - /** - * There is data for the service type in the scope in the AttrRqst or - * SrvRqst, but not in the requested language. - */ - public static final short LANGUAGE_NOT_SUPPORTED = 1; - - /** - * The message fails to obey SLP syntax. - */ - public static final short PARSE_ERROR = 2; - - /** - * The SrvReg has problems -- e.g., a zero lifetime or an omitted Language - * Tag. - */ - public static final short INVALID_REGISTRATION = 3; - - /** - * The SLP message did not include a scope in its supported by - * the SA or DA. - */ - public static final short SCOPE_NOT_SUPPORTED = 4; - - /** - * The DA or SA receives a request for an unsupported SLP SPI. - */ - public static final short AUTHENTICATION_UNKNOWN = 5; - - /** - * The DA expected URL and ATTR authentication in the SrvReg and did not - * receive it. - */ - public static final short AUTHENTICATION_ABSENT = 6; - - /** - * The DA detected an authentication error in an Authentication block. - */ - public static final short AUTHENTICATION_FAILED = 7; - - /** - * Unsupported version number in message header. - */ - public static final short VERSION_NOT_SUPPORTED = 9; - - /** - * The DA (or SA) is too sick to respond. - */ - public static final short INTERNAL_ERROR = 10; - - /** - * UA or SA SHOULD retry, using exponential back off. - */ - public static final short DA_BUSY = 11; - - /** - * The DA (or SA) received an unknown option from the mandatory range (see - * section 9.1). - */ - public static final short OPTION_NOT_SUPPORTED = 12; - - /** - * The DA received a SrvReg without FRESH set, for an unregistered service - * or with inconsistent Service Types. - */ - public static final short INVALID_UPDATE = 13; - - /** - * The SA received an AttrRqst or SrvTypeRqst and does not support it. - */ - public static final short REQUEST_NOT_SUPPORTED = 14; - - /** - * The SA sent a SrvReg or partial SrvDereg to a DA more frequently than the - * DA's min-refresh-interval. - */ - public static final short REFRESH_REJECTED = 15; - - /** - * NOT_IMPLEMENTED - */ - public static final short NOT_IMPLEMENTED = 16; - - /** - * NETWORK_INIT_FAILED - */ - public static final short NETWORK_INIT_FAILED = 17; - - /** - * NETWORK_TIMED_OUT - */ - public static final short NETWORK_TIMED_OUT = 18; - - /** - * NETWORK_ERROR - */ - public static final short NETWORK_ERROR = 19; - - /** - * INTERNAL_SYSTEM_ERROR - */ - public static final short INTERNAL_SYSTEM_ERROR = 20; - - /** - * TYPE_ERROR - */ - public static final short TYPE_ERROR = 21; - - /** - * BUFFER_OVERFLOW - */ - public static final short BUFFER_OVERFLOW = 22; - - /** - * PREVIOUS_RESPONDER_OVERFLOW - */ - public static final short PREVIOUS_RESPONDER_OVERFLOW = 100; - - private static final String[] ERROR_MESSAGES = { "OK", "LANGUAGE_NOT_SUPPORTED", "PARSE_ERROR", - "INVALID_REGISTRATION", "SCOPE_NOT_SUPPORTED", "AUTHENTICATION_UNKNOWN", - "AUTHENTICATION_ABSENT", "AUTHENTICATION_FAILED", "", "VERSION_NOT_SUPPORTED", - "INTERNAL_ERROR", "DA_BUSY", "OPTION_NOT_SUPPORTED", "INVALID_UPDATE", - "REQUEST_NOT_SUPPORTED", "REFRESH_REJECTED", "NOT_IMPLEMENTED", "NETWORK_INIT_FAILED", - "NETWORK_TIMED_OUT", "NETWORK_ERROR", "INTERNAL_SYSTEM_ERROR", "TYPE_ERROR", - "BUFFER_OVERFLOW" }; - - private short iErrorCode; - - /** - * Ctor. - * - * @param pErrorCode - * One of the ec constants in this class - */ - public ServiceLocationException(short pErrorCode) { - super(ERROR_MESSAGES[pErrorCode]); - this.iErrorCode = pErrorCode; - } - - /** - * Ctor. - * - * @param pErrorCode - * One of the ec constants in this class - * @param pCause - * The cause - */ - public ServiceLocationException(short pErrorCode, Throwable pCause) { - super(ERROR_MESSAGES[pErrorCode], pCause); - this.iErrorCode = pErrorCode; - } - - /** - * Ctor. - * - * @param pErrorCode - * One of the ec constants in this class - * @param pMessage - * A more specific message - * @param pCause - * - */ - public ServiceLocationException(short pErrorCode, String pMessage, Throwable pCause) { - super(ERROR_MESSAGES[pErrorCode] + "(" + pMessage + ")", pCause); - this.iErrorCode = pErrorCode; - } - - /** - * Ctor. - * - * @param pErrorCode - * One of the error code constants in this class - * @param pMessage - * A more specific message - */ - public ServiceLocationException(short pErrorCode, String pMessage) { - this(pErrorCode, pMessage, null); - } - - /** - * Return the error code. The error code takes on one of the static field - * values. - * - * @return The error code - */ - public short getErrorCode() { - return this.iErrorCode; - } - - /** - * Gets the message associated to this exception. - * - * @return The message - */ - @Override - public String getMessage() { - if (getCause() == null) { return super.getMessage(); } - return super.getMessage() + "; nested exception is: \n\t" + getCause().toString(); - } - -} +/* + ServiceLocationException.java + + (C) Copyright IBM Corp. 2005, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1516246 2006-07-22 lupusalex Integrate SLP client code + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.slp; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +/** + * The ServiceLocationException class is thrown by all methods when exceptional + * conditions occur in the SLP framework. The error code property determines the + * exact nature of the condition, and an optional message may provide more + * information. + */ +public class ServiceLocationException extends Exception { + + private static final long serialVersionUID = 6414188770647750627L; + + /** + * OK + */ + public static final short OK = 0; + + /** + * There is data for the service type in the scope in the AttrRqst or + * SrvRqst, but not in the requested language. + */ + public static final short LANGUAGE_NOT_SUPPORTED = 1; + + /** + * The message fails to obey SLP syntax. + */ + public static final short PARSE_ERROR = 2; + + /** + * The SrvReg has problems -- e.g., a zero lifetime or an omitted Language + * Tag. + */ + public static final short INVALID_REGISTRATION = 3; + + /** + * The SLP message did not include a scope in its supported by + * the SA or DA. + */ + public static final short SCOPE_NOT_SUPPORTED = 4; + + /** + * The DA or SA receives a request for an unsupported SLP SPI. + */ + public static final short AUTHENTICATION_UNKNOWN = 5; + + /** + * The DA expected URL and ATTR authentication in the SrvReg and did not + * receive it. + */ + public static final short AUTHENTICATION_ABSENT = 6; + + /** + * The DA detected an authentication error in an Authentication block. + */ + public static final short AUTHENTICATION_FAILED = 7; + + /** + * Unsupported version number in message header. + */ + public static final short VERSION_NOT_SUPPORTED = 9; + + /** + * The DA (or SA) is too sick to respond. + */ + public static final short INTERNAL_ERROR = 10; + + /** + * UA or SA SHOULD retry, using exponential back off. + */ + public static final short DA_BUSY = 11; + + /** + * The DA (or SA) received an unknown option from the mandatory range (see + * section 9.1). + */ + public static final short OPTION_NOT_SUPPORTED = 12; + + /** + * The DA received a SrvReg without FRESH set, for an unregistered service + * or with inconsistent Service Types. + */ + public static final short INVALID_UPDATE = 13; + + /** + * The SA received an AttrRqst or SrvTypeRqst and does not support it. + */ + public static final short REQUEST_NOT_SUPPORTED = 14; + + /** + * The SA sent a SrvReg or partial SrvDereg to a DA more frequently than the + * DA's min-refresh-interval. + */ + public static final short REFRESH_REJECTED = 15; + + /** + * NOT_IMPLEMENTED + */ + public static final short NOT_IMPLEMENTED = 16; + + /** + * NETWORK_INIT_FAILED + */ + public static final short NETWORK_INIT_FAILED = 17; + + /** + * NETWORK_TIMED_OUT + */ + public static final short NETWORK_TIMED_OUT = 18; + + /** + * NETWORK_ERROR + */ + public static final short NETWORK_ERROR = 19; + + /** + * INTERNAL_SYSTEM_ERROR + */ + public static final short INTERNAL_SYSTEM_ERROR = 20; + + /** + * TYPE_ERROR + */ + public static final short TYPE_ERROR = 21; + + /** + * BUFFER_OVERFLOW + */ + public static final short BUFFER_OVERFLOW = 22; + + /** + * PREVIOUS_RESPONDER_OVERFLOW + */ + public static final short PREVIOUS_RESPONDER_OVERFLOW = 100; + + private static final String[] ERROR_MESSAGES = { "OK", "LANGUAGE_NOT_SUPPORTED", "PARSE_ERROR", + "INVALID_REGISTRATION", "SCOPE_NOT_SUPPORTED", "AUTHENTICATION_UNKNOWN", + "AUTHENTICATION_ABSENT", "AUTHENTICATION_FAILED", "", "VERSION_NOT_SUPPORTED", + "INTERNAL_ERROR", "DA_BUSY", "OPTION_NOT_SUPPORTED", "INVALID_UPDATE", + "REQUEST_NOT_SUPPORTED", "REFRESH_REJECTED", "NOT_IMPLEMENTED", "NETWORK_INIT_FAILED", + "NETWORK_TIMED_OUT", "NETWORK_ERROR", "INTERNAL_SYSTEM_ERROR", "TYPE_ERROR", + "BUFFER_OVERFLOW" }; + + private short iErrorCode; + + /** + * Ctor. + * + * @param pErrorCode + * One of the ec constants in this class + */ + public ServiceLocationException(short pErrorCode) { + super(ERROR_MESSAGES[pErrorCode]); + this.iErrorCode = pErrorCode; + } + + /** + * Ctor. + * + * @param pErrorCode + * One of the ec constants in this class + * @param pCause + * The cause + */ + public ServiceLocationException(short pErrorCode, Throwable pCause) { + super(ERROR_MESSAGES[pErrorCode], pCause); + this.iErrorCode = pErrorCode; + } + + /** + * Ctor. + * + * @param pErrorCode + * One of the ec constants in this class + * @param pMessage + * A more specific message + * @param pCause + * + */ + public ServiceLocationException(short pErrorCode, String pMessage, Throwable pCause) { + super(ERROR_MESSAGES[pErrorCode] + "(" + pMessage + ")", pCause); + this.iErrorCode = pErrorCode; + } + + /** + * Ctor. + * + * @param pErrorCode + * One of the error code constants in this class + * @param pMessage + * A more specific message + */ + public ServiceLocationException(short pErrorCode, String pMessage) { + this(pErrorCode, pMessage, null); + } + + /** + * Return the error code. The error code takes on one of the static field + * values. + * + * @return The error code + */ + public short getErrorCode() { + return this.iErrorCode; + } + + /** + * Gets the message associated to this exception. + * + * @return The message + */ + @Override + public String getMessage() { + if (getCause() == null) { return super.getMessage(); } + return super.getMessage() + "; nested exception is: \n\t" + getCause().toString(); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/slp/ServiceLocationManager.java b/src/main/java/org/metricshub/wbem/sblim/slp/ServiceLocationManager.java similarity index 78% rename from src/main/java/org/sentrysoftware/wbem/sblim/slp/ServiceLocationManager.java rename to src/main/java/org/metricshub/wbem/sblim/slp/ServiceLocationManager.java index 5ab9b3d..5964a43 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/slp/ServiceLocationManager.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/ServiceLocationManager.java @@ -1,122 +1,120 @@ -/* - ServiceLocationManager.java - - (C) Copyright IBM Corp. 2005, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1516246 2006-07-22 lupusalex Integrate SLP client code - * 1535756 2006-08-08 lupusalex Make code warning free - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - */ - -package org.sentrysoftware.wbem.sblim.slp; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.Locale; -import java.util.Vector; - -import org.sentrysoftware.wbem.sblim.slp.internal.AdvertiserImpl; -import org.sentrysoftware.wbem.sblim.slp.internal.ua.LocatorImpl; - -/** - * The ServiceLocationManager manages access to the service location framework. - * Clients obtain the Locator and Advertiser objects for UA and SA, and a Vector - * of known scope names from the ServiceLocationManager. - * - */ -public class ServiceLocationManager { - - /** - * Returns the maximum across all DAs of the min-refresh-interval attribute. - * This value satisfies the advertised refresh interval bounds for all DAs, - * and, if used by the SA, assures that no refresh registration will be - * rejected. If no DA advertises a min-refresh-interval attribute, a value - * of 0 is returned. - * - * Not yet implemented - * - * @return The minimum refresh interval - * @throws ServiceLocationException - */ - public static int getRefreshInterval() throws ServiceLocationException { - throw new ServiceLocationException(ServiceLocationException.NOT_IMPLEMENTED); - } - - /** - * Returns an List of strings with all available scope names. The list of - * scopes comes from a variety of sources, see Section 2.1 for the scope - * discovery algorithm. There is always at least one string in the Vector, - * the default scope, "DEFAULT". - * - * Not yet implemented - * - * @return A Vector containing the scopes - * @throws ServiceLocationException - */ - public static Vector findScopes() throws ServiceLocationException { - throw new ServiceLocationException(ServiceLocationException.NOT_IMPLEMENTED); - } - - /** - * Return a Locator object for the given language locale. If the - * implementation does not support UA functionality, returns null. - * - * @param pLocale - * The language locale of the Locator. The default SLP locale is - * used if null. - * @return The Locator - */ - public static Locator getLocator(Locale pLocale) { - return new LocatorImpl(pLocale); - } - - /** - * Return an Advertiser object for the given language locale. If the - * implementation does not support SA functionality, returns null. - * - * @param pLocale - * The language locale of the Advertiser. The default SLP locale - * is used if null. - * @return The advertiser - */ - public static Advertiser getAdvertiser(Locale pLocale) { - return new AdvertiserImpl(pLocale); - } - -} +/* + ServiceLocationManager.java + + (C) Copyright IBM Corp. 2005, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1516246 2006-07-22 lupusalex Integrate SLP client code + * 1535756 2006-08-08 lupusalex Make code warning free + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + */ + +package org.metricshub.wbem.sblim.slp; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.Locale; +import java.util.Vector; + +import org.metricshub.wbem.sblim.slp.internal.AdvertiserImpl; +import org.metricshub.wbem.sblim.slp.internal.ua.LocatorImpl; + +/** + * The ServiceLocationManager manages access to the service location framework. + * Clients obtain the Locator and Advertiser objects for UA and SA, and a Vector + * of known scope names from the ServiceLocationManager. + * + */ +public class ServiceLocationManager { + + /** + * Returns the maximum across all DAs of the min-refresh-interval attribute. + * This value satisfies the advertised refresh interval bounds for all DAs, + * and, if used by the SA, assures that no refresh registration will be + * rejected. If no DA advertises a min-refresh-interval attribute, a value + * of 0 is returned. + * + * Not yet implemented + * + * @return The minimum refresh interval + * @throws ServiceLocationException + */ + public static int getRefreshInterval() throws ServiceLocationException { + throw new ServiceLocationException(ServiceLocationException.NOT_IMPLEMENTED); + } + + /** + * Returns an List of strings with all available scope names. The list of + * scopes comes from a variety of sources, see Section 2.1 for the scope + * discovery algorithm. There is always at least one string in the Vector, + * the default scope, "DEFAULT". + * + * Not yet implemented + * + * @return A Vector containing the scopes + * @throws ServiceLocationException + */ + public static Vector findScopes() throws ServiceLocationException { + throw new ServiceLocationException(ServiceLocationException.NOT_IMPLEMENTED); + } + + /** + * Return a Locator object for the given language locale. If the + * implementation does not support UA functionality, returns null. + * + * @param pLocale + * The language locale of the Locator. The default SLP locale is + * used if null. + * @return The Locator + */ + public static Locator getLocator(Locale pLocale) { + return new LocatorImpl(pLocale); + } + + /** + * Return an Advertiser object for the given language locale. If the + * implementation does not support SA functionality, returns null. + * + * @param pLocale + * The language locale of the Advertiser. The default SLP locale + * is used if null. + * @return The advertiser + */ + public static Advertiser getAdvertiser(Locale pLocale) { + return new AdvertiserImpl(pLocale); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/slp/ServiceType.java b/src/main/java/org/metricshub/wbem/sblim/slp/ServiceType.java similarity index 88% rename from src/main/java/org/sentrysoftware/wbem/sblim/slp/ServiceType.java rename to src/main/java/org/metricshub/wbem/sblim/slp/ServiceType.java index ed67ccc..1844899 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/slp/ServiceType.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/ServiceType.java @@ -1,271 +1,269 @@ -/* - ServiceType.java - - (C) Copyright IBM Corp. 2005, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1516246 2006-07-22 lupusalex Integrate SLP client code - * 1804402 2007-09-28 ebak IPv6 ready SLP - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.slp; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.Serializable; -import java.util.NoSuchElementException; -import java.util.StringTokenizer; - -/** - * The ServiceType object models the SLP service type. It parses a string based - * service type specifier into its various components, and contains property - * accessors to return the components. URL schemes, protocol service types, and - * abstract service types are all handled. - */ -public class ServiceType implements Serializable { - - private static final long serialVersionUID = -4850546870881037017L; - - private boolean iIsServiceURL = true; - - private String iPrincipleType = ""; - - private String iAbstractType = ""; - - private String iNamingAuthority = ""; - - /** - * - * Constructs a service type object from the service type specifier. Throws - * IllegalArgumentException if the type name is syntactically incorrect. - * - * @param pType - * The service type name as a String. If the service type is from - * a service: URL, the "service:" prefix must be intact. - */ - public ServiceType(String pType) { - parse(pType); - } - - /** - * Returns true if the type name contains the "service:" prefix. - * - * @return true if the type name contains the "service:" prefix - */ - public boolean isServiceURL() { - return this.iIsServiceURL; - } - - /** - * Returns true if the type name is for an abstract type. - * - * @return true if the type name is for an abstract type - */ - public boolean isAbstractType() { - return this.iAbstractType.length() > 0; - } - - /** - * Returns true if the naming authority is the default, i.e. is the empty - * string. - * - * @return true if the naming authority is the default, i.e. is - * the empty string - */ - public boolean isNADefault() { - return this.iNamingAuthority.length() <= 0; - } - - /** - * Returns the concrete type name in an abstract type, or the empty string - * if the service type is not abstract. For example, if the type name is - * "service:printing:ipp", the method returns "ipp". If the type name is - * "service:ftp", the method returns "". - * - * @return true if the service type is not abstract - */ - public String getConcreteTypeName() { - return this.iAbstractType; - } - - /** - * Returns the abstract type name for an abstract type, the protocol name in - * a protocol type, or the URL scheme for a generic URL. For example, in the - * abstract type name "service:printing:ipp", the method returns "printing". - * In the protocol type name "service:ftp", the method returns "ftp". - * - * @return The principle type name - */ - public String getPrincipleTypeName() { - return this.iPrincipleType; - } - - /** - * If the type is an abstract type, returns the fully formatted abstract - * type name including the "service:" and naming authority but without the - * concrete type name or intervening colon. If not an abstract type, returns - * the empty string. For example, in the abstract type name - * "service:printing:ipp", the method returns "service:printing". - * - * @return The abstract type name - */ - public String getAbstractTypeName() { - if (isAbstractType()) return "service:" + this.iPrincipleType - + (this.iNamingAuthority.length() <= 0 ? "" : "." + this.iNamingAuthority); - return ""; - } - - /** - * Return the naming authority name, or the empty string if the naming - * authority is the default. - * - * @return The naming authority - */ - public String getNamingAuthority() { - return this.iNamingAuthority; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#equals(java.lang.Object) - * - * Overrides Object.equals(). The two objects are equal if they are both - * ServiceType objects and the components of both are equal. - */ - @Override - public boolean equals(Object obj) { - if (obj == this) return true; - if (!(obj instanceof ServiceType)) return false; - - ServiceType servicetype = (ServiceType) obj; - return this.iIsServiceURL == servicetype.iIsServiceURL - && this.iPrincipleType.equals(servicetype.iPrincipleType) - && this.iAbstractType.equals(servicetype.iAbstractType) - && this.iNamingAuthority.equals(servicetype.iNamingAuthority); - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - * - * Returns the fully formatted type name, including the "service:" if the - * type was originally from a service: URL. - */ - @Override - public String toString() { - // TODO: clean up this - return (this.iIsServiceURL ? "service:" : "") + this.iPrincipleType - + (this.iNamingAuthority.length() <= 0 ? "" : "." + this.iNamingAuthority) - + (this.iAbstractType.length() <= 0 ? "" : ":" + this.iAbstractType); - } - - private int iHashCode = 0; - - /* - * (non-Javadoc) - * - * @see java.lang.Object#hashCode() - * - * Overrides Object.hashCode(). Hashes on the string value of the "service" - * prefix, naming authority, if any, abstract and concrete type names for - * abstract types, protocol type name for protocol types, and URL scheme for - * generic URLs. - */ - @Override - public int hashCode() { - if (this.iHashCode == 0) this.iHashCode = toString().hashCode(); - return this.iHashCode; - } - - private void parse(String pString) { - StringTokenizer st = new StringTokenizer(pString, ":.", true); - while (true) { - try { - - String token = st.nextToken(); - if (token.equals(":") || token.equals(".")) continue; - - if (!token.equalsIgnoreCase("service")) { - this.iIsServiceURL = false; - do { - this.iPrincipleType = this.iPrincipleType + token.toLowerCase(); - if (!st.hasMoreTokens()) break; - token = st.nextToken(); - } while (true); - - validateTypeComponent(this.iPrincipleType); - if (!st.hasMoreTokens()) return; - continue; - } - token = st.nextToken(); - if (!token.equals(":")) continue; - this.iPrincipleType = st.nextToken().toLowerCase(); - validateTypeComponent(this.iPrincipleType); - - if (!st.hasMoreTokens()) return; - token = st.nextToken(); - if (token.equals(".")) { - token = st.nextToken(); - validateTypeComponent(token); - if (token.equalsIgnoreCase("iana")) continue; - this.iNamingAuthority = token.toLowerCase(); - if (!st.hasMoreTokens()) return; - token = st.nextToken(); - } - if (token.equals(":")) { - String abstractTypeToken = st.nextToken(); - validateTypeComponent(abstractTypeToken); - this.iAbstractType = abstractTypeToken.toLowerCase(); - if (!st.hasMoreTokens()) return; - } - } catch (NoSuchElementException e) { - throw new IllegalArgumentException(e.getMessage()); - } - } - } - - private static void validateTypeComponent(String str) { - int length = str.length(); - - for (int pos = 0; pos < length; pos++) { - char ch = str.charAt(pos); - if (!Character.isLetterOrDigit(ch) && ch != '+' && ch != '-') { throw new IllegalArgumentException(); } - } - } -} +/* + ServiceType.java + + (C) Copyright IBM Corp. 2005, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1516246 2006-07-22 lupusalex Integrate SLP client code + * 1804402 2007-09-28 ebak IPv6 ready SLP + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.slp; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.Serializable; +import java.util.NoSuchElementException; +import java.util.StringTokenizer; + +/** + * The ServiceType object models the SLP service type. It parses a string based + * service type specifier into its various components, and contains property + * accessors to return the components. URL schemes, protocol service types, and + * abstract service types are all handled. + */ +public class ServiceType implements Serializable { + + private static final long serialVersionUID = -4850546870881037017L; + + private boolean iIsServiceURL = true; + + private String iPrincipleType = ""; + + private String iAbstractType = ""; + + private String iNamingAuthority = ""; + + /** + * + * Constructs a service type object from the service type specifier. Throws + * IllegalArgumentException if the type name is syntactically incorrect. + * + * @param pType + * The service type name as a String. If the service type is from + * a service: URL, the "service:" prefix must be intact. + */ + public ServiceType(String pType) { + parse(pType); + } + + /** + * Returns true if the type name contains the "service:" prefix. + * + * @return true if the type name contains the "service:" prefix + */ + public boolean isServiceURL() { + return this.iIsServiceURL; + } + + /** + * Returns true if the type name is for an abstract type. + * + * @return true if the type name is for an abstract type + */ + public boolean isAbstractType() { + return this.iAbstractType.length() > 0; + } + + /** + * Returns true if the naming authority is the default, i.e. is the empty + * string. + * + * @return true if the naming authority is the default, i.e. is + * the empty string + */ + public boolean isNADefault() { + return this.iNamingAuthority.length() <= 0; + } + + /** + * Returns the concrete type name in an abstract type, or the empty string + * if the service type is not abstract. For example, if the type name is + * "service:printing:ipp", the method returns "ipp". If the type name is + * "service:ftp", the method returns "". + * + * @return true if the service type is not abstract + */ + public String getConcreteTypeName() { + return this.iAbstractType; + } + + /** + * Returns the abstract type name for an abstract type, the protocol name in + * a protocol type, or the URL scheme for a generic URL. For example, in the + * abstract type name "service:printing:ipp", the method returns "printing". + * In the protocol type name "service:ftp", the method returns "ftp". + * + * @return The principle type name + */ + public String getPrincipleTypeName() { + return this.iPrincipleType; + } + + /** + * If the type is an abstract type, returns the fully formatted abstract + * type name including the "service:" and naming authority but without the + * concrete type name or intervening colon. If not an abstract type, returns + * the empty string. For example, in the abstract type name + * "service:printing:ipp", the method returns "service:printing". + * + * @return The abstract type name + */ + public String getAbstractTypeName() { + if (isAbstractType()) return "service:" + this.iPrincipleType + + (this.iNamingAuthority.length() <= 0 ? "" : "." + this.iNamingAuthority); + return ""; + } + + /** + * Return the naming authority name, or the empty string if the naming + * authority is the default. + * + * @return The naming authority + */ + public String getNamingAuthority() { + return this.iNamingAuthority; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#equals(java.lang.Object) + * + * Overrides Object.equals(). The two objects are equal if they are both + * ServiceType objects and the components of both are equal. + */ + @Override + public boolean equals(Object obj) { + if (obj == this) return true; + if (!(obj instanceof ServiceType)) return false; + + ServiceType servicetype = (ServiceType) obj; + return this.iIsServiceURL == servicetype.iIsServiceURL + && this.iPrincipleType.equals(servicetype.iPrincipleType) + && this.iAbstractType.equals(servicetype.iAbstractType) + && this.iNamingAuthority.equals(servicetype.iNamingAuthority); + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + * + * Returns the fully formatted type name, including the "service:" if the + * type was originally from a service: URL. + */ + @Override + public String toString() { + // TODO: clean up this + return (this.iIsServiceURL ? "service:" : "") + this.iPrincipleType + + (this.iNamingAuthority.length() <= 0 ? "" : "." + this.iNamingAuthority) + + (this.iAbstractType.length() <= 0 ? "" : ":" + this.iAbstractType); + } + + private int iHashCode = 0; + + /* + * (non-Javadoc) + * + * @see java.lang.Object#hashCode() + * + * Overrides Object.hashCode(). Hashes on the string value of the "service" + * prefix, naming authority, if any, abstract and concrete type names for + * abstract types, protocol type name for protocol types, and URL scheme for + * generic URLs. + */ + @Override + public int hashCode() { + if (this.iHashCode == 0) this.iHashCode = toString().hashCode(); + return this.iHashCode; + } + + private void parse(String pString) { + StringTokenizer st = new StringTokenizer(pString, ":.", true); + while (true) { + try { + + String token = st.nextToken(); + if (token.equals(":") || token.equals(".")) continue; + + if (!token.equalsIgnoreCase("service")) { + this.iIsServiceURL = false; + do { + this.iPrincipleType = this.iPrincipleType + token.toLowerCase(); + if (!st.hasMoreTokens()) break; + token = st.nextToken(); + } while (true); + + validateTypeComponent(this.iPrincipleType); + if (!st.hasMoreTokens()) return; + continue; + } + token = st.nextToken(); + if (!token.equals(":")) continue; + this.iPrincipleType = st.nextToken().toLowerCase(); + validateTypeComponent(this.iPrincipleType); + + if (!st.hasMoreTokens()) return; + token = st.nextToken(); + if (token.equals(".")) { + token = st.nextToken(); + validateTypeComponent(token); + if (token.equalsIgnoreCase("iana")) continue; + this.iNamingAuthority = token.toLowerCase(); + if (!st.hasMoreTokens()) return; + token = st.nextToken(); + } + if (token.equals(":")) { + String abstractTypeToken = st.nextToken(); + validateTypeComponent(abstractTypeToken); + this.iAbstractType = abstractTypeToken.toLowerCase(); + if (!st.hasMoreTokens()) return; + } + } catch (NoSuchElementException e) { + throw new IllegalArgumentException(e.getMessage()); + } + } + } + + private static void validateTypeComponent(String str) { + int length = str.length(); + + for (int pos = 0; pos < length; pos++) { + char ch = str.charAt(pos); + if (!Character.isLetterOrDigit(ch) && ch != '+' && ch != '-') { throw new IllegalArgumentException(); } + } + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/slp/ServiceURL.java b/src/main/java/org/metricshub/wbem/sblim/slp/ServiceURL.java similarity index 89% rename from src/main/java/org/sentrysoftware/wbem/sblim/slp/ServiceURL.java rename to src/main/java/org/metricshub/wbem/sblim/slp/ServiceURL.java index d9d1370..1a12cde 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/slp/ServiceURL.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/ServiceURL.java @@ -1,341 +1,339 @@ -/* - ServiceURL.java - - (C) Copyright IBM Corp. 2005, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1516246 2006-07-22 lupusalex Integrate SLP client code - * 1804402 2007-09-28 ebak IPv6 ready SLP - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.slp; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.Serializable; - -/** - * The ServiceURL object models the advertised SLP service URL. It can be either - * a service: URL or a regular URL. These objects are returned from service - * lookup requests, and describe the registered services. This class should be a - * subclass of java.net.URL but can't since that class is final. - */ -public class ServiceURL implements Serializable { - - private static final long serialVersionUID = 8998115518853094365L; - - /** - * Indicates that no port information is required or was returned for this - * URL. - */ - public static final int NO_PORT = 0; - - /** - * Indicates that the URL has a zero lifetime. This value is never returned - * from the API, but can be used to create a ServiceURL object to - * deregister, delete attributes, or find attributes. - */ - public static final int LIFETIME_NONE = 0; - - /** - * The default URL lifetime (3 hours) in seconds. - */ - public static final int LIFETIME_DEFAULT = 10800; - - /** - * The maximum URL lifetime (about 18 hours) in seconds. - */ - public static final int LIFETIME_MAXIMUM = 65535; - - /** - * Indicates that the API implementation should continuously re-register the - * URL until the application exits. - */ - public static final int LIFETIME_PERMANENT = -1; - - static final int PORT_MAXIMUM = 65535; - - private ServiceType iServiceType = null; - - private String iTransport = null; - - private String iHost = null; - - private int iPort = 0; - - private String iURLPath = null; - - private int iLifetime = LIFETIME_DEFAULT; - - /** - * Construct a service URL object having the specified lifetime. - * - * @param pServiceURL - * The URL as a string. Must be either a service: URL or a valid - * generic URL according to RFC 2396 [2]. - * @param pLifetime - * The service advertisement lifetime in seconds. This value may - * be either between LIFETIME_NONE and LIFETIME_MAXIMUM or - * LIFETIME_PERMANENT. - */ - public ServiceURL(String pServiceURL, int pLifetime) { - - if (pLifetime > LIFETIME_MAXIMUM || pLifetime < LIFETIME_PERMANENT) throw new IllegalArgumentException( - "lifetime:" + pLifetime); - - for (int i = 0; i < pServiceURL.length(); i++) { - char c = pServiceURL.charAt(i); - if ("/:-.%_\'*()$!,+\\;@?&=[]".indexOf(c) == -1 && !Character.isLetterOrDigit(c)) { throw new IllegalArgumentException( - "invalid character: '" + c + "' on string \"" + pServiceURL + "\""); } - } - - parseURL(pServiceURL); - - this.iLifetime = (pLifetime == LIFETIME_PERMANENT) ? LIFETIME_MAXIMUM : pLifetime; - } - - /** - * Returns the service type object representing the service type name of the - * URL. - * - * @return The service type - */ - public ServiceType getServiceType() { - return this.iServiceType; - } - - /** - * Set the service type name to the object. Ignored if the URL is a service: - * URL. - * - * @param pServicetype - * The service type object. - */ - public void setServiceType(ServiceType pServicetype) { - if (!this.iServiceType.isServiceURL()) this.iServiceType = pServicetype; - } - - /** - * Get the network layer transport identifier. If the transport is IP, an - * empty string, "", is returned. - * - * @return The NLT identifier - */ - public String getTransport() { - // FIXME What the hell is it? - return ""; - } - - /** - * Returns the host identifier. For IP, this will be the machine name or IP - * address. - * - * @return The host - */ - public String getHost() { - return this.iHost; - } - - /** - * Returns the port number, if any. For non-IP transports, always returns - * NO_PORT. - * - * @return The port - */ - public int getPort() { - return this.iPort; - } - - /** - * Returns the URL path description, if any. - * - * @return The URL path - */ - public String getURLPath() { - return this.iURLPath; - } - - /** - * Returns the service advertisement lifetime. This will be a positive int - * between LIFETIME_NONE and LIFETIME_MAXIMUM. - * - * @return The lifetime - */ - public int getLifetime() { - return this.iLifetime; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#equals(java.lang.Object) - * - * Compares the object to the ServiceURL and returns true if the two are the - * same. Two ServiceURL objects are equal if their current service types - * match and they have the same host, port, transport, and URL path. - */ - @Override - public boolean equals(Object obj) { - if (obj == this) return true; - if (!(obj instanceof ServiceURL)) return false; - - ServiceURL that = (ServiceURL) obj; - - return equalObjs(this.iServiceType, that.iServiceType) - && equalStrs(this.iTransport, that.iTransport) && equalStrs(this.iHost, that.iHost) - && this.iPort == that.iPort; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - * - * Returns a formatted string with the URL. Overrides Object.toString(). The - * returned URL has the original service type or URL scheme, not the current - * service type. - */ - @Override - public String toString() { - StringBuffer buf = new StringBuffer(); - if (this.iServiceType != null) buf.append(this.iServiceType); - if (this.iURLPath != null) { - if (buf.length() > 0) buf.append("://"); - buf.append(this.iURLPath); - } - return buf.toString(); - } - - private int iHashCode = 0; - - /* - * (non-Javadoc) - * - * @see java.lang.Object#hashCode() - * - * Overrides Object.hashCode(). Hashes on the current service type, - * transport, host, port, and URL part. !! in this case toString() must not - * contain the lifeTime - */ - @Override - public int hashCode() { - if (this.iHashCode == 0) { - this.iHashCode = toString().hashCode(); - } - return this.iHashCode; - } - - private static final String DELIM = "://"; - - /** - *
      -	 * service: URL or URL
      -	 * 
      -	 * "service:" srvtype "://" addrspec
      -	 * "service:" abstract-type ":" concrete-type> "://" addrspecc
      -	 * 
      -	 * addrspesc  = ( hostName / IPv4Address / IPv6Address ) [ ":" port ]
      -	 * 
      - * - * @param pUrlString - * @throws IllegalArgumentException - */ - private void parseURL(String pUrlStr) throws IllegalArgumentException { - int srvTypeEndIdx = pUrlStr.indexOf(DELIM); - String addrStr; - if (srvTypeEndIdx >= 0) { - this.iServiceType = new ServiceType(pUrlStr.substring(0, srvTypeEndIdx)); - addrStr = pUrlStr.substring(srvTypeEndIdx + DELIM.length()); - } else { - if (pUrlStr.startsWith("service:")) { - this.iServiceType = new ServiceType(pUrlStr); - addrStr = null; - } else { - addrStr = pUrlStr; - } - } - if (addrStr == null) return; - this.iURLPath = addrStr; - if (addrStr.charAt(0) == '[') { - parseIPv6Address(addrStr); - } else { - parseIPv4Address(addrStr); - } - } - - private void parseIPv6Address(String pAddrStr) throws IllegalArgumentException { - int hostEndIdx = pAddrStr.indexOf(']'); - if (hostEndIdx < 0) throw new IllegalArgumentException("']' is not found for IPv6 address"); - int colonIdx = hostEndIdx + 1; - this.iHost = pAddrStr.substring(0, colonIdx); - if (colonIdx < pAddrStr.length()) { - if (pAddrStr.charAt(colonIdx) != ':') throw new IllegalArgumentException( - "':' expected in \"" + pAddrStr + "\" at position " + colonIdx + " !"); - parsePort(pAddrStr.substring(colonIdx + 1), pAddrStr); - } - } - - private void parseIPv4Address(String pAddrStr) { - int colonIdx = pAddrStr.indexOf(':'); - if (colonIdx > 0) { - this.iHost = pAddrStr.substring(0, colonIdx); - parsePort(pAddrStr.substring(colonIdx + 1), pAddrStr); - } else { - this.iHost = pAddrStr; - } - } - - private void parsePort(String pPortStr, String pAddrStr) throws IllegalArgumentException { - try { - this.iPort = Integer.parseInt(pPortStr); - } catch (NumberFormatException e) { - throw new IllegalArgumentException("Port field : " + pPortStr + " in " + pAddrStr - + " is invalid!"); - } - } - - private static boolean equalObjs(Object pThis, Object pThat) { - return pThis == null ? pThat == null : pThis.equals(pThat); - } - - private static boolean equalStrs(String pThis, String pThat) { - return (pThis == null || pThis.length() == 0) ? (pThat == null || pThat.length() == 0) - : pThis.equals(pThat); - } - -} +/* + ServiceURL.java + + (C) Copyright IBM Corp. 2005, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1516246 2006-07-22 lupusalex Integrate SLP client code + * 1804402 2007-09-28 ebak IPv6 ready SLP + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.slp; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.Serializable; + +/** + * The ServiceURL object models the advertised SLP service URL. It can be either + * a service: URL or a regular URL. These objects are returned from service + * lookup requests, and describe the registered services. This class should be a + * subclass of java.net.URL but can't since that class is final. + */ +public class ServiceURL implements Serializable { + + private static final long serialVersionUID = 8998115518853094365L; + + /** + * Indicates that no port information is required or was returned for this + * URL. + */ + public static final int NO_PORT = 0; + + /** + * Indicates that the URL has a zero lifetime. This value is never returned + * from the API, but can be used to create a ServiceURL object to + * deregister, delete attributes, or find attributes. + */ + public static final int LIFETIME_NONE = 0; + + /** + * The default URL lifetime (3 hours) in seconds. + */ + public static final int LIFETIME_DEFAULT = 10800; + + /** + * The maximum URL lifetime (about 18 hours) in seconds. + */ + public static final int LIFETIME_MAXIMUM = 65535; + + /** + * Indicates that the API implementation should continuously re-register the + * URL until the application exits. + */ + public static final int LIFETIME_PERMANENT = -1; + + static final int PORT_MAXIMUM = 65535; + + private ServiceType iServiceType = null; + + private String iTransport = null; + + private String iHost = null; + + private int iPort = 0; + + private String iURLPath = null; + + private int iLifetime = LIFETIME_DEFAULT; + + /** + * Construct a service URL object having the specified lifetime. + * + * @param pServiceURL + * The URL as a string. Must be either a service: URL or a valid + * generic URL according to RFC 2396 [2]. + * @param pLifetime + * The service advertisement lifetime in seconds. This value may + * be either between LIFETIME_NONE and LIFETIME_MAXIMUM or + * LIFETIME_PERMANENT. + */ + public ServiceURL(String pServiceURL, int pLifetime) { + + if (pLifetime > LIFETIME_MAXIMUM || pLifetime < LIFETIME_PERMANENT) throw new IllegalArgumentException( + "lifetime:" + pLifetime); + + for (int i = 0; i < pServiceURL.length(); i++) { + char c = pServiceURL.charAt(i); + if ("/:-.%_\'*()$!,+\\;@?&=[]".indexOf(c) == -1 && !Character.isLetterOrDigit(c)) { throw new IllegalArgumentException( + "invalid character: '" + c + "' on string \"" + pServiceURL + "\""); } + } + + parseURL(pServiceURL); + + this.iLifetime = (pLifetime == LIFETIME_PERMANENT) ? LIFETIME_MAXIMUM : pLifetime; + } + + /** + * Returns the service type object representing the service type name of the + * URL. + * + * @return The service type + */ + public ServiceType getServiceType() { + return this.iServiceType; + } + + /** + * Set the service type name to the object. Ignored if the URL is a service: + * URL. + * + * @param pServicetype + * The service type object. + */ + public void setServiceType(ServiceType pServicetype) { + if (!this.iServiceType.isServiceURL()) this.iServiceType = pServicetype; + } + + /** + * Get the network layer transport identifier. If the transport is IP, an + * empty string, "", is returned. + * + * @return The NLT identifier + */ + public String getTransport() { + // FIXME What the hell is it? + return ""; + } + + /** + * Returns the host identifier. For IP, this will be the machine name or IP + * address. + * + * @return The host + */ + public String getHost() { + return this.iHost; + } + + /** + * Returns the port number, if any. For non-IP transports, always returns + * NO_PORT. + * + * @return The port + */ + public int getPort() { + return this.iPort; + } + + /** + * Returns the URL path description, if any. + * + * @return The URL path + */ + public String getURLPath() { + return this.iURLPath; + } + + /** + * Returns the service advertisement lifetime. This will be a positive int + * between LIFETIME_NONE and LIFETIME_MAXIMUM. + * + * @return The lifetime + */ + public int getLifetime() { + return this.iLifetime; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#equals(java.lang.Object) + * + * Compares the object to the ServiceURL and returns true if the two are the + * same. Two ServiceURL objects are equal if their current service types + * match and they have the same host, port, transport, and URL path. + */ + @Override + public boolean equals(Object obj) { + if (obj == this) return true; + if (!(obj instanceof ServiceURL)) return false; + + ServiceURL that = (ServiceURL) obj; + + return equalObjs(this.iServiceType, that.iServiceType) + && equalStrs(this.iTransport, that.iTransport) && equalStrs(this.iHost, that.iHost) + && this.iPort == that.iPort; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + * + * Returns a formatted string with the URL. Overrides Object.toString(). The + * returned URL has the original service type or URL scheme, not the current + * service type. + */ + @Override + public String toString() { + StringBuffer buf = new StringBuffer(); + if (this.iServiceType != null) buf.append(this.iServiceType); + if (this.iURLPath != null) { + if (buf.length() > 0) buf.append("://"); + buf.append(this.iURLPath); + } + return buf.toString(); + } + + private int iHashCode = 0; + + /* + * (non-Javadoc) + * + * @see java.lang.Object#hashCode() + * + * Overrides Object.hashCode(). Hashes on the current service type, + * transport, host, port, and URL part. !! in this case toString() must not + * contain the lifeTime + */ + @Override + public int hashCode() { + if (this.iHashCode == 0) { + this.iHashCode = toString().hashCode(); + } + return this.iHashCode; + } + + private static final String DELIM = "://"; + + /** + *
      +	 * service: URL or URL
      +	 * 
      +	 * "service:" srvtype "://" addrspec
      +	 * "service:" abstract-type ":" concrete-type> "://" addrspecc
      +	 * 
      +	 * addrspesc  = ( hostName / IPv4Address / IPv6Address ) [ ":" port ]
      +	 * 
      + * + * @param pUrlString + * @throws IllegalArgumentException + */ + private void parseURL(String pUrlStr) throws IllegalArgumentException { + int srvTypeEndIdx = pUrlStr.indexOf(DELIM); + String addrStr; + if (srvTypeEndIdx >= 0) { + this.iServiceType = new ServiceType(pUrlStr.substring(0, srvTypeEndIdx)); + addrStr = pUrlStr.substring(srvTypeEndIdx + DELIM.length()); + } else { + if (pUrlStr.startsWith("service:")) { + this.iServiceType = new ServiceType(pUrlStr); + addrStr = null; + } else { + addrStr = pUrlStr; + } + } + if (addrStr == null) return; + this.iURLPath = addrStr; + if (addrStr.charAt(0) == '[') { + parseIPv6Address(addrStr); + } else { + parseIPv4Address(addrStr); + } + } + + private void parseIPv6Address(String pAddrStr) throws IllegalArgumentException { + int hostEndIdx = pAddrStr.indexOf(']'); + if (hostEndIdx < 0) throw new IllegalArgumentException("']' is not found for IPv6 address"); + int colonIdx = hostEndIdx + 1; + this.iHost = pAddrStr.substring(0, colonIdx); + if (colonIdx < pAddrStr.length()) { + if (pAddrStr.charAt(colonIdx) != ':') throw new IllegalArgumentException( + "':' expected in \"" + pAddrStr + "\" at position " + colonIdx + " !"); + parsePort(pAddrStr.substring(colonIdx + 1), pAddrStr); + } + } + + private void parseIPv4Address(String pAddrStr) { + int colonIdx = pAddrStr.indexOf(':'); + if (colonIdx > 0) { + this.iHost = pAddrStr.substring(0, colonIdx); + parsePort(pAddrStr.substring(colonIdx + 1), pAddrStr); + } else { + this.iHost = pAddrStr; + } + } + + private void parsePort(String pPortStr, String pAddrStr) throws IllegalArgumentException { + try { + this.iPort = Integer.parseInt(pPortStr); + } catch (NumberFormatException e) { + throw new IllegalArgumentException("Port field : " + pPortStr + " in " + pAddrStr + + " is invalid!"); + } + } + + private static boolean equalObjs(Object pThis, Object pThat) { + return pThis == null ? pThat == null : pThis.equals(pThat); + } + + private static boolean equalStrs(String pThis, String pThat) { + return (pThis == null || pThis.length() == 0) ? (pThat == null || pThat.length() == 0) + : pThis.equals(pThat); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/slp/TemplateRegistry.java b/src/main/java/org/metricshub/wbem/sblim/slp/TemplateRegistry.java similarity index 83% rename from src/main/java/org/sentrysoftware/wbem/sblim/slp/TemplateRegistry.java rename to src/main/java/org/metricshub/wbem/sblim/slp/TemplateRegistry.java index 07338e5..f31836a 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/slp/TemplateRegistry.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/TemplateRegistry.java @@ -1,143 +1,141 @@ -/* - TemplateRegistry.java - - (C) Copyright IBM Corp. 2005, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1516246 2006-07-22 lupusalex Integrate SLP client code - * 1535756 2006-08-08 lupusalex Make code warning free - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.slp; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.Locale; - -/** - * Subclasses of the TemplateRegistry abstract class provide access to service - * location templates [8]. Classes implementing TemplateRegistry perform a - * variety of functions. They manage the registration and access of service type - * template documents. They create attribute verifiers from service templates, - * for verification of attributes and introspection on template documents. Note - * that clients of the Advertiser are not required to verify attributes before - * registering (though they may get a TYPE_ERROR if the implementation supports - * type checking and there is a mismatch with the template). - * - */ -public abstract class TemplateRegistry { - - /** - * Returns the distinguished TemplateRegistry object for performing - * operations on and with service templates. Returns null if the - * implementation doesn't support TemplateRegistry functionality. - * - * Not yet implemented - * - * @return The template registry - */ - public static TemplateRegistry getTemplateRegistry() { - throw new RuntimeException("not implemented"); - } - - /** - * Register the service template with the template registry. - * - * @param pType - * The service type. - * @param pDocumentURL - * A string containing the URL of the template document. May not - * be the empty string. - * @param pLocale - * A Locale object containing the language locale of the - * template. - * @param pVersion - * The version number identifier of template document. - * @throws ServiceLocationException - */ - public abstract void registerServiceTemplate(ServiceType pType, String pDocumentURL, - Locale pLocale, String pVersion) throws ServiceLocationException; - - /** - * Deregister the template for the service type. - * - * @param pType - * The service type. - * @param pLocale - * A Locale object containing the language locale of the - * template. - * @param pVersion - * A String containing the version number. Use null to indicate - * the latest version. - * @throws ServiceLocationException - */ - public abstract void deregisterServiceTemplate(ServiceType pType, Locale pLocale, - String pVersion) throws ServiceLocationException; - - /** - * Returns the URL for the template document. - * - * @param pType - * The service type. - * @param pLocale - * A Locale object containing the language locale of the - * template. - * @param pVersion - * A String containing the version number. Use null to indicate - * the latest version. - * @return The URL - * @throws ServiceLocationException - */ - public abstract String findTemplateURL(ServiceType pType, Locale pLocale, String pVersion) - throws ServiceLocationException; - - /** - * Reads the template document URL and returns an attribute verifier for the - * service type. The attribute verifier can be used for verifying that - * registration attributes match the template, and for introspection on the - * template definition. - * - * @param pDocumentURL - * A String containing the template document's URL. May not be - * the empty string. - * @return The verifier - * @throws ServiceLocationException - */ - public abstract ServiceLocationAttributeVerifier attributeVerifier(String pDocumentURL) - throws ServiceLocationException; - -} +/* + TemplateRegistry.java + + (C) Copyright IBM Corp. 2005, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1516246 2006-07-22 lupusalex Integrate SLP client code + * 1535756 2006-08-08 lupusalex Make code warning free + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.slp; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.Locale; + +/** + * Subclasses of the TemplateRegistry abstract class provide access to service + * location templates [8]. Classes implementing TemplateRegistry perform a + * variety of functions. They manage the registration and access of service type + * template documents. They create attribute verifiers from service templates, + * for verification of attributes and introspection on template documents. Note + * that clients of the Advertiser are not required to verify attributes before + * registering (though they may get a TYPE_ERROR if the implementation supports + * type checking and there is a mismatch with the template). + * + */ +public abstract class TemplateRegistry { + + /** + * Returns the distinguished TemplateRegistry object for performing + * operations on and with service templates. Returns null if the + * implementation doesn't support TemplateRegistry functionality. + * + * Not yet implemented + * + * @return The template registry + */ + public static TemplateRegistry getTemplateRegistry() { + throw new RuntimeException("not implemented"); + } + + /** + * Register the service template with the template registry. + * + * @param pType + * The service type. + * @param pDocumentURL + * A string containing the URL of the template document. May not + * be the empty string. + * @param pLocale + * A Locale object containing the language locale of the + * template. + * @param pVersion + * The version number identifier of template document. + * @throws ServiceLocationException + */ + public abstract void registerServiceTemplate(ServiceType pType, String pDocumentURL, + Locale pLocale, String pVersion) throws ServiceLocationException; + + /** + * Deregister the template for the service type. + * + * @param pType + * The service type. + * @param pLocale + * A Locale object containing the language locale of the + * template. + * @param pVersion + * A String containing the version number. Use null to indicate + * the latest version. + * @throws ServiceLocationException + */ + public abstract void deregisterServiceTemplate(ServiceType pType, Locale pLocale, + String pVersion) throws ServiceLocationException; + + /** + * Returns the URL for the template document. + * + * @param pType + * The service type. + * @param pLocale + * A Locale object containing the language locale of the + * template. + * @param pVersion + * A String containing the version number. Use null to indicate + * the latest version. + * @return The URL + * @throws ServiceLocationException + */ + public abstract String findTemplateURL(ServiceType pType, Locale pLocale, String pVersion) + throws ServiceLocationException; + + /** + * Reads the template document URL and returns an attribute verifier for the + * service type. The attribute verifier can be used for verifying that + * registration attributes match the template, and for introspection on the + * template definition. + * + * @param pDocumentURL + * A String containing the template document's URL. May not be + * the empty string. + * @return The verifier + * @throws ServiceLocationException + */ + public abstract ServiceLocationAttributeVerifier attributeVerifier(String pDocumentURL) + throws ServiceLocationException; + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/AdvertiserImpl.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/AdvertiserImpl.java similarity index 75% rename from src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/AdvertiserImpl.java rename to src/main/java/org/metricshub/wbem/sblim/slp/internal/AdvertiserImpl.java index 8ec0d2f..b015014 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/AdvertiserImpl.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/AdvertiserImpl.java @@ -1,186 +1,185 @@ -/* - (C) Copyright IBM Corp. 2007, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, IBM, ebak@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1804402 2007-09-28 ebak IPv6 ready SLP - * 1804402 2007-11-10 ebak IPv6 ready SLP - revision 4 - * 1892103 2008-02-15 ebak SLP improvements - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - */ - -package org.sentrysoftware.wbem.sblim.slp.internal; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.sblim.slp.Advertiser; -import org.sentrysoftware.wbem.sblim.slp.ServiceLocationAttribute; -import org.sentrysoftware.wbem.sblim.slp.ServiceLocationException; -import org.sentrysoftware.wbem.sblim.slp.ServiceURL; -import org.sentrysoftware.wbem.sblim.slp.internal.msg.MsgFactory; -import org.sentrysoftware.wbem.sblim.slp.internal.msg.SLPMessage; -import org.sentrysoftware.wbem.sblim.slp.internal.msg.ServiceAcknowledgment; -import org.sentrysoftware.wbem.sblim.slp.internal.msg.ServiceDeregistration; -import org.sentrysoftware.wbem.sblim.slp.internal.msg.ServiceRegistration; -import org.sentrysoftware.wbem.sblim.slp.internal.msg.Util; - -import java.io.IOException; -import java.net.DatagramPacket; -import java.net.DatagramSocket; -import java.net.InetAddress; -import java.net.SocketTimeoutException; -import java.util.ArrayList; -import java.util.List; -import java.util.Locale; -import java.util.Vector; - - - -/** - * AdvertiserImpl - * - */ -public class AdvertiserImpl implements Advertiser { - - private Locale iLocale; - - private String iLangTag; - - private List iDefScopeList; - - private final int iMaxDatagramSize = SLPConfig.getGlobalCfg().getMTU(); - - private final byte[] iInBuf = new byte[this.iMaxDatagramSize]; - - private final int[] iTimeOuts = SLPConfig.getGlobalCfg().getDatagramTimeouts(); - - private boolean iUseV6 = Net.hasIPv6() && SLPConfig.getGlobalCfg().useIPv6(); - - /** - * Ctor. - * - * @param pLocale - */ - public AdvertiserImpl(Locale pLocale) { - this.iLocale = pLocale; - this.iLangTag = Util.getLangTag(this.iLocale); - this.iDefScopeList = new ArrayList(); - this.iDefScopeList.add(SLPDefaults.DEFAULT_SCOPE); - } - - /** - * @param pURL - * @param pAttributes - * @throws ServiceLocationException - */ - public void addAttributes(ServiceURL pURL, Vector pAttributes) - throws ServiceLocationException { - throw new ServiceLocationException(ServiceLocationException.NOT_IMPLEMENTED); - } - - /** - * @param pURL - * @param pAttributeIds - * @throws ServiceLocationException - */ - public void deleteAttributes(ServiceURL pURL, Vector pAttributeIds) - throws ServiceLocationException { - throw new ServiceLocationException(ServiceLocationException.NOT_IMPLEMENTED); - } - - public void deregister(ServiceURL pURL) throws ServiceLocationException { - sendMessage(new ServiceDeregistration(this.iLangTag, this.iDefScopeList, pURL, null)); - } - - public Locale getLocale() { - return this.iLocale; - } - - public void register(ServiceURL pURL, Vector pAttributes) - throws ServiceLocationException { - sendMessage(new ServiceRegistration(this.iLangTag, pURL, this.iDefScopeList, pAttributes, - null)); - - } - - private void sendMessage(SLPMessage pMsg) throws ServiceLocationException { - try { - int res = unicast(pMsg); - if (res != ServiceLocationException.OK) throw new ServiceLocationException((short) res); - TRC.debug("service registered"); - } catch (IOException e) { - throw new ServiceLocationException(ServiceLocationException.NETWORK_ERROR, e); - } - } - - private int unicast(SLPMessage pMsg) throws ServiceLocationException, IOException { - DatagramSocket dgSocket = new DatagramSocket(); - try { - byte[] reqBytes = pMsg.serialize(false, true, false); - InetAddress loopback = this.iUseV6 ? SLPConfig.getLoopbackV6() : SLPConfig - .getLoopbackV4(); - TRC.debug("loopback:" + loopback); - - DatagramPacket outPacket = new DatagramPacket(reqBytes, reqBytes.length, loopback, - SLPConfig.getGlobalCfg().getPort()); - DatagramPacket inPacket = new DatagramPacket(this.iInBuf, this.iInBuf.length); - - int timeOutIdx = 0; - while (timeOutIdx < this.iTimeOuts.length) { - TRC.debug("sending : " + pMsg); - dgSocket.send(outPacket); - dgSocket.setSoTimeout(this.iTimeOuts[timeOutIdx++]); - try { - dgSocket.receive(inPacket); - } catch (SocketTimeoutException e) { - TRC.debug("receive time out"); - continue; - } - SLPMessage msg = MsgFactory.parse(inPacket); - TRC.debug("expected: " + pMsg.getXID() + ", received : " + msg); - if (msg instanceof ServiceAcknowledgment) { - ServiceAcknowledgment ack = (ServiceAcknowledgment) msg; - if (ack.getXID() == pMsg.getXID()) return ack.getErrorCode(); - } - TRC.debug("ignoring :" + msg); - } - } finally { - dgSocket.close(); - } - TRC.warning("registration failed"); - return ServiceLocationException.INVALID_REGISTRATION; - } - -} +/* + (C) Copyright IBM Corp. 2007, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, IBM, ebak@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1804402 2007-09-28 ebak IPv6 ready SLP + * 1804402 2007-11-10 ebak IPv6 ready SLP - revision 4 + * 1892103 2008-02-15 ebak SLP improvements + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + */ + +package org.metricshub.wbem.sblim.slp.internal; + +import org.metricshub.wbem.sblim.slp.ServiceLocationAttribute; +import org.metricshub.wbem.sblim.slp.ServiceURL; +import org.metricshub.wbem.sblim.slp.internal.msg.MsgFactory; +import org.metricshub.wbem.sblim.slp.internal.msg.SLPMessage; +import org.metricshub.wbem.sblim.slp.internal.msg.ServiceAcknowledgment; +import org.metricshub.wbem.sblim.slp.internal.msg.ServiceDeregistration; +import org.metricshub.wbem.sblim.slp.internal.msg.ServiceRegistration; +import org.metricshub.wbem.sblim.slp.internal.msg.Util; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.sblim.slp.Advertiser; +import org.metricshub.wbem.sblim.slp.ServiceLocationException; + +import java.io.IOException; +import java.net.DatagramPacket; +import java.net.DatagramSocket; +import java.net.InetAddress; +import java.net.SocketTimeoutException; +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; +import java.util.Vector; + + + +/** + * AdvertiserImpl + * + */ +public class AdvertiserImpl implements Advertiser { + + private Locale iLocale; + + private String iLangTag; + + private List iDefScopeList; + + private final int iMaxDatagramSize = SLPConfig.getGlobalCfg().getMTU(); + + private final byte[] iInBuf = new byte[this.iMaxDatagramSize]; + + private final int[] iTimeOuts = SLPConfig.getGlobalCfg().getDatagramTimeouts(); + + private boolean iUseV6 = Net.hasIPv6() && SLPConfig.getGlobalCfg().useIPv6(); + + /** + * Ctor. + * + * @param pLocale + */ + public AdvertiserImpl(Locale pLocale) { + this.iLocale = pLocale; + this.iLangTag = Util.getLangTag(this.iLocale); + this.iDefScopeList = new ArrayList(); + this.iDefScopeList.add(SLPDefaults.DEFAULT_SCOPE); + } + + /** + * @param pURL + * @param pAttributes + * @throws ServiceLocationException + */ + public void addAttributes(ServiceURL pURL, Vector pAttributes) + throws ServiceLocationException { + throw new ServiceLocationException(ServiceLocationException.NOT_IMPLEMENTED); + } + + /** + * @param pURL + * @param pAttributeIds + * @throws ServiceLocationException + */ + public void deleteAttributes(ServiceURL pURL, Vector pAttributeIds) + throws ServiceLocationException { + throw new ServiceLocationException(ServiceLocationException.NOT_IMPLEMENTED); + } + + public void deregister(ServiceURL pURL) throws ServiceLocationException { + sendMessage(new ServiceDeregistration(this.iLangTag, this.iDefScopeList, pURL, null)); + } + + public Locale getLocale() { + return this.iLocale; + } + + public void register(ServiceURL pURL, Vector pAttributes) + throws ServiceLocationException { + sendMessage(new ServiceRegistration(this.iLangTag, pURL, this.iDefScopeList, pAttributes, + null)); + + } + + private void sendMessage(SLPMessage pMsg) throws ServiceLocationException { + try { + int res = unicast(pMsg); + if (res != ServiceLocationException.OK) throw new ServiceLocationException((short) res); + TRC.debug("service registered"); + } catch (IOException e) { + throw new ServiceLocationException(ServiceLocationException.NETWORK_ERROR, e); + } + } + + private int unicast(SLPMessage pMsg) throws ServiceLocationException, IOException { + DatagramSocket dgSocket = new DatagramSocket(); + try { + byte[] reqBytes = pMsg.serialize(false, true, false); + InetAddress loopback = this.iUseV6 ? SLPConfig.getLoopbackV6() : SLPConfig + .getLoopbackV4(); + TRC.debug("loopback:" + loopback); + + DatagramPacket outPacket = new DatagramPacket(reqBytes, reqBytes.length, loopback, + SLPConfig.getGlobalCfg().getPort()); + DatagramPacket inPacket = new DatagramPacket(this.iInBuf, this.iInBuf.length); + + int timeOutIdx = 0; + while (timeOutIdx < this.iTimeOuts.length) { + TRC.debug("sending : " + pMsg); + dgSocket.send(outPacket); + dgSocket.setSoTimeout(this.iTimeOuts[timeOutIdx++]); + try { + dgSocket.receive(inPacket); + } catch (SocketTimeoutException e) { + TRC.debug("receive time out"); + continue; + } + SLPMessage msg = MsgFactory.parse(inPacket); + TRC.debug("expected: " + pMsg.getXID() + ", received : " + msg); + if (msg instanceof ServiceAcknowledgment) { + ServiceAcknowledgment ack = (ServiceAcknowledgment) msg; + if (ack.getXID() == pMsg.getXID()) return ack.getErrorCode(); + } + TRC.debug("ignoring :" + msg); + } + } finally { + dgSocket.close(); + } + TRC.warning("registration failed"); + return ServiceLocationException.INVALID_REGISTRATION; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/AttributeHandler.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/AttributeHandler.java similarity index 79% rename from src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/AttributeHandler.java rename to src/main/java/org/metricshub/wbem/sblim/slp/internal/AttributeHandler.java index e8e5aba..36ff919 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/AttributeHandler.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/AttributeHandler.java @@ -1,129 +1,127 @@ -/* - (C) Copyright IBM Corp. 2007, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, IBM, ebak@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1804402 2007-09-28 ebak IPv6 ready SLP - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2650 2013-07-18 blaschke-oss SLP opaque value handling incorrect - */ - -package org.sentrysoftware.wbem.sblim.slp.internal; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.Iterator; -import java.util.Vector; - -import org.sentrysoftware.wbem.sblim.slp.ServiceLocationAttribute; - -/** - * AttributeHandler - * - */ -public class AttributeHandler { - - /* - * attr-list = attribute / attribute `,' attr-list attribute = `(' attr-tag - * `=' attr-val-list `)' / attr-tag attr-val-list = attr-val / attr-val `,' - * attr-val-list attr-tag = 1*safe-tag attr-val = intval / strval / boolval - * / opaque intval = [-]1*DIGIT strval = 1*safe-val boolval = "true" / - * "false" opaque = "\FF" 1*escape-val safe-val = ; Any character except - * reserved. safe-tag = ; Any character except reserved, star and bad-tag. - * reserved = `(' / `)' / `,' / `\' / `!' / `<' / `=' / `>' / `~' / CTL - * escape-val = `\' HEXDIG HEXDIG bad-tag = CR / LF / HTAB / `_' star = `*' - */ - /** - * @param pAttr - * @return String - */ - public static String buildString(ServiceLocationAttribute pAttr) { - StringBuffer buf = new StringBuffer(); - Vector valVec = pAttr.getValues(); - if (valVec != null && valVec.size() > 0) buf.append('('); - buf.append(Convert.escape(pAttr.getId(), Convert.ATTR_RESERVED)); - if (valVec != null && valVec.size() > 0) { - buf.append('='); - Iterator itr = valVec.iterator(); - boolean first = true; - while (itr.hasNext()) { - if (first) first = false; - else buf.append(','); - buf.append(AttributeHandler.escapeValue(itr.next())); - } - buf.append(')'); - } - return buf.toString(); - } - - /** - * escapeValue - * - * @param pValue - * @return String - */ - public static String escapeValue(Object pValue) { - if (pValue instanceof String) { - return Convert.escape((String) pValue, Convert.ATTR_RESERVED); - } else if (pValue instanceof Integer) { - return ((Integer) pValue).toString(); - } else if (pValue instanceof Boolean) { - return ((Boolean) pValue).toString(); - } else if (pValue instanceof byte[]) { - return AttributeHandler.mkOpaqueStr((byte[]) pValue); - } else if (pValue == null) { return ""; } - throw new IllegalArgumentException("Type: " + pValue.getClass().getName() - + " cannot be an attribute value!"); - } - - /** - * mkOpaqueStr - * - * @param pBytes - * @return String - */ - public static String mkOpaqueStr(byte[] pBytes) { - StringBuilder buf = new StringBuilder("\\FF"); - for (int i = 0; i < pBytes.length; i++) { - int value = pBytes[i] & 0xff; - String hexStr = Integer.toString(value, 16).toUpperCase(); - buf.append('\\'); - if (hexStr.length() == 1) buf.append('0'); - buf.append(hexStr); - } - return buf.toString(); - } - -} +/* + (C) Copyright IBM Corp. 2007, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, IBM, ebak@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1804402 2007-09-28 ebak IPv6 ready SLP + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2650 2013-07-18 blaschke-oss SLP opaque value handling incorrect + */ + +package org.metricshub.wbem.sblim.slp.internal; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.Iterator; +import java.util.Vector; + +import org.metricshub.wbem.sblim.slp.ServiceLocationAttribute; + +/** + * AttributeHandler + * + */ +public class AttributeHandler { + + /* + * attr-list = attribute / attribute `,' attr-list attribute = `(' attr-tag + * `=' attr-val-list `)' / attr-tag attr-val-list = attr-val / attr-val `,' + * attr-val-list attr-tag = 1*safe-tag attr-val = intval / strval / boolval + * / opaque intval = [-]1*DIGIT strval = 1*safe-val boolval = "true" / + * "false" opaque = "\FF" 1*escape-val safe-val = ; Any character except + * reserved. safe-tag = ; Any character except reserved, star and bad-tag. + * reserved = `(' / `)' / `,' / `\' / `!' / `<' / `=' / `>' / `~' / CTL + * escape-val = `\' HEXDIG HEXDIG bad-tag = CR / LF / HTAB / `_' star = `*' + */ + /** + * @param pAttr + * @return String + */ + public static String buildString(ServiceLocationAttribute pAttr) { + StringBuffer buf = new StringBuffer(); + Vector valVec = pAttr.getValues(); + if (valVec != null && valVec.size() > 0) buf.append('('); + buf.append(Convert.escape(pAttr.getId(), Convert.ATTR_RESERVED)); + if (valVec != null && valVec.size() > 0) { + buf.append('='); + Iterator itr = valVec.iterator(); + boolean first = true; + while (itr.hasNext()) { + if (first) first = false; + else buf.append(','); + buf.append(AttributeHandler.escapeValue(itr.next())); + } + buf.append(')'); + } + return buf.toString(); + } + + /** + * escapeValue + * + * @param pValue + * @return String + */ + public static String escapeValue(Object pValue) { + if (pValue instanceof String) { + return Convert.escape((String) pValue, Convert.ATTR_RESERVED); + } else if (pValue instanceof Integer) { + return ((Integer) pValue).toString(); + } else if (pValue instanceof Boolean) { + return ((Boolean) pValue).toString(); + } else if (pValue instanceof byte[]) { + return AttributeHandler.mkOpaqueStr((byte[]) pValue); + } else if (pValue == null) { return ""; } + throw new IllegalArgumentException("Type: " + pValue.getClass().getName() + + " cannot be an attribute value!"); + } + + /** + * mkOpaqueStr + * + * @param pBytes + * @return String + */ + public static String mkOpaqueStr(byte[] pBytes) { + StringBuilder buf = new StringBuilder("\\FF"); + for (int i = 0; i < pBytes.length; i++) { + int value = pBytes[i] & 0xff; + String hexStr = Integer.toString(value, 16).toUpperCase(); + buf.append('\\'); + if (hexStr.length() == 1) buf.append('0'); + buf.append(hexStr); + } + return buf.toString(); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/Convert.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/Convert.java similarity index 81% rename from src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/Convert.java rename to src/main/java/org/metricshub/wbem/sblim/slp/internal/Convert.java index 4ba64cf..231b0f9 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/Convert.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/Convert.java @@ -1,173 +1,171 @@ -/* - (C) Copyright IBM Corp. 2007, 2013 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, IBM, ebak@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1804402 2007-09-28 ebak IPv6 ready SLP - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2650 2013-07-18 blaschke-oss SLP opaque value handling incorrect - */ - -package org.sentrysoftware.wbem.sblim.slp.internal; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.UnsupportedEncodingException; - -import org.sentrysoftware.wbem.sblim.slp.ServiceLocationException; - -/** - * Convert - * - */ -public class Convert { - - /** - * ATTR_RESERVED - */ - public static final String ATTR_RESERVED = "(),\\!<=>~"; - - /** - * SCOPE_RESERVED - */ - public static final String SCOPE_RESERVED = "(),\\!<=>~;*+"; - - /** - * DEFAULT_RESERVED - */ - public static final String DEFAULT_RESERVED = ATTR_RESERVED; - - private static final byte[] EMPTY_BYTES = new byte[0]; - - /** - * getBytes - * - * @param pStr - * @return byte[] - */ - public static byte[] getBytes(String pStr) { - if (pStr == null) return EMPTY_BYTES; - try { - return pStr.getBytes(SLPDefaults.ENCODING); - } catch (UnsupportedEncodingException e) { - throw new RuntimeException("Unsupported encoding : " + SLPDefaults.ENCODING, e); - } - } - - /** - * escape - * - * @param pStr - * @return String - */ - public static String escape(String pStr) { - return escape(pStr, DEFAULT_RESERVED); - } - - /** - * escape - * - * @param pStr - * @param pReservedChars - * @return String - */ - public static String escape(String pStr, String pReservedChars) { - if (pStr == null) return ""; - if (pReservedChars == null) return pStr; - StringBuffer strBuf = null; - for (int i = 0; i < pStr.length(); i++) { - char ch = pStr.charAt(i); - if (ch < 32 || pReservedChars.indexOf(ch) >= 0) { - if (strBuf == null) { - strBuf = new StringBuffer(); - if (i > 0) strBuf.append(pStr.substring(0, i)); - } - strBuf.append(escapeChar(ch)); - } else if (strBuf != null) { - strBuf.append(ch); - } - } - return strBuf == null ? pStr : strBuf.toString(); - } - - /** - * unescape - * - * @param pStr - * @return String - * @throws ServiceLocationException - */ - public static String unescape(String pStr) throws ServiceLocationException { - if (pStr == null) return null; - StringBuffer resBuf = null; - int pos, lastPos = 0; - while ((pos = pStr.indexOf('\\', lastPos)) >= 0) { - char ch = unescapeChar(pStr.substring(pos)); - if (resBuf == null) resBuf = new StringBuffer(); - resBuf.append(pStr.subSequence(lastPos, pos)).append(ch); - lastPos = pos + 3; - } - if (resBuf != null && lastPos < pStr.length()) resBuf.append(pStr.substring(lastPos, pStr - .length())); - return resBuf == null ? pStr : resBuf.toString(); - } - - /** - * The escape character is a backslash (UTF-8 0x5c) followed by the two - * hexadecimal digits of the escaped character. -> Character code is ASCII. - * - * @param ch - * @return String - */ - private static String escapeChar(char ch) { - int code = ch; - String hexStr = Integer.toHexString(code).toUpperCase(); - return (hexStr.length() == 1 ? "\\0" : "\\") + hexStr; - } - - private static char unescapeChar(String pEscSeq) throws ServiceLocationException { - if (pEscSeq.length() < 3) throw new ServiceLocationException( - ServiceLocationException.PARSE_ERROR, - "Escaped character must contain 2 hex digits!\n" + "pEscSeq:" + pEscSeq); - String hexStr = pEscSeq.substring(1, 3); - try { - int code = Integer.parseInt(hexStr, 16); - return (char) code; - } catch (NumberFormatException e) { - throw new ServiceLocationException(ServiceLocationException.PARSE_ERROR, - "Failed to parse hex string: " + hexStr + ", pEscSeq=" + pEscSeq + " !", e); - } - } - -} +/* + (C) Copyright IBM Corp. 2007, 2013 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, IBM, ebak@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1804402 2007-09-28 ebak IPv6 ready SLP + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2650 2013-07-18 blaschke-oss SLP opaque value handling incorrect + */ + +package org.metricshub.wbem.sblim.slp.internal; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.UnsupportedEncodingException; + +import org.metricshub.wbem.sblim.slp.ServiceLocationException; + +/** + * Convert + * + */ +public class Convert { + + /** + * ATTR_RESERVED + */ + public static final String ATTR_RESERVED = "(),\\!<=>~"; + + /** + * SCOPE_RESERVED + */ + public static final String SCOPE_RESERVED = "(),\\!<=>~;*+"; + + /** + * DEFAULT_RESERVED + */ + public static final String DEFAULT_RESERVED = ATTR_RESERVED; + + private static final byte[] EMPTY_BYTES = new byte[0]; + + /** + * getBytes + * + * @param pStr + * @return byte[] + */ + public static byte[] getBytes(String pStr) { + if (pStr == null) return EMPTY_BYTES; + try { + return pStr.getBytes(SLPDefaults.ENCODING); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException("Unsupported encoding : " + SLPDefaults.ENCODING, e); + } + } + + /** + * escape + * + * @param pStr + * @return String + */ + public static String escape(String pStr) { + return escape(pStr, DEFAULT_RESERVED); + } + + /** + * escape + * + * @param pStr + * @param pReservedChars + * @return String + */ + public static String escape(String pStr, String pReservedChars) { + if (pStr == null) return ""; + if (pReservedChars == null) return pStr; + StringBuffer strBuf = null; + for (int i = 0; i < pStr.length(); i++) { + char ch = pStr.charAt(i); + if (ch < 32 || pReservedChars.indexOf(ch) >= 0) { + if (strBuf == null) { + strBuf = new StringBuffer(); + if (i > 0) strBuf.append(pStr.substring(0, i)); + } + strBuf.append(escapeChar(ch)); + } else if (strBuf != null) { + strBuf.append(ch); + } + } + return strBuf == null ? pStr : strBuf.toString(); + } + + /** + * unescape + * + * @param pStr + * @return String + * @throws ServiceLocationException + */ + public static String unescape(String pStr) throws ServiceLocationException { + if (pStr == null) return null; + StringBuffer resBuf = null; + int pos, lastPos = 0; + while ((pos = pStr.indexOf('\\', lastPos)) >= 0) { + char ch = unescapeChar(pStr.substring(pos)); + if (resBuf == null) resBuf = new StringBuffer(); + resBuf.append(pStr.subSequence(lastPos, pos)).append(ch); + lastPos = pos + 3; + } + if (resBuf != null && lastPos < pStr.length()) resBuf.append(pStr.substring(lastPos, pStr + .length())); + return resBuf == null ? pStr : resBuf.toString(); + } + + /** + * The escape character is a backslash (UTF-8 0x5c) followed by the two + * hexadecimal digits of the escaped character. -> Character code is ASCII. + * + * @param ch + * @return String + */ + private static String escapeChar(char ch) { + int code = ch; + String hexStr = Integer.toHexString(code).toUpperCase(); + return (hexStr.length() == 1 ? "\\0" : "\\") + hexStr; + } + + private static char unescapeChar(String pEscSeq) throws ServiceLocationException { + if (pEscSeq.length() < 3) throw new ServiceLocationException( + ServiceLocationException.PARSE_ERROR, + "Escaped character must contain 2 hex digits!\n" + "pEscSeq:" + pEscSeq); + String hexStr = pEscSeq.substring(1, 3); + try { + int code = Integer.parseInt(hexStr, 16); + return (char) code; + } catch (NumberFormatException e) { + throw new ServiceLocationException(ServiceLocationException.PARSE_ERROR, + "Failed to parse hex string: " + hexStr + ", pEscSeq=" + pEscSeq + " !", e); + } + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/IPv6MulticastAddressFactory.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/IPv6MulticastAddressFactory.java similarity index 77% rename from src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/IPv6MulticastAddressFactory.java rename to src/main/java/org/metricshub/wbem/sblim/slp/internal/IPv6MulticastAddressFactory.java index 677b3c9..5548585 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/IPv6MulticastAddressFactory.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/IPv6MulticastAddressFactory.java @@ -1,169 +1,167 @@ -/* - (C) Copyright IBM Corp. 2007, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, IBM, ebak@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1804402 2007-09-28 ebak IPv6 ready SLP - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.slp.internal; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.net.InetAddress; -import java.net.UnknownHostException; - -import org.sentrysoftware.wbem.sblim.slp.ServiceType; -import org.sentrysoftware.wbem.sblim.slp.internal.msg.AttributeRequest; -import org.sentrysoftware.wbem.sblim.slp.internal.msg.SLPMessage; -import org.sentrysoftware.wbem.sblim.slp.internal.msg.ServiceRequest; -import org.sentrysoftware.wbem.sblim.slp.internal.msg.ServiceTypeRequest; - -/** - *
      - * SVRLOC group-id : FF0X:0:0:0:0:0:0:116
      - *  - SRVTYPERQST Service Type Request
      - *  - ATTRRQST Attribute Request
      - *  - UA sends too
      - *  
      - * SVRLOC-DA group-id : FF0X:0:0:0:0:0:0:123
      - *  - SRVRQST for the "service:directory-agent" service type
      - *  - UA sends too
      - * 
      - * 1000 - 13FF: SRVRQST : FF0X:0:0:0:0:0:1:....
      - *  - the ID is the hashcode of the Service Type string used in the SrvRqst.
      - *  - UA sends too
      - * 
      - */ -public class IPv6MulticastAddressFactory { - - private static final byte[] SRVLOC = { (byte) 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, - (byte) 0x16 }; - - private static final byte[] SRVLOC_DA = { (byte) 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, (byte) 0x23 }; - - private static final byte[] SRV_RQST = { (byte) 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, - 0 }; - - /** - * getSrvLocAddress - * - * @param pScope - * @return InetAddress - * @throws UnknownHostException - */ - public static InetAddress getSrvLocAddress(int pScope) throws UnknownHostException { - SRVLOC[1] = (byte) (pScope & 0xff); - return InetAddress.getByAddress(SRVLOC); - } - - /** - * get - * - * @param pScope - * @param pMsg - * @return InetAddress - * @throws UnknownHostException - */ - public static InetAddress get(int pScope, SLPMessage pMsg) throws UnknownHostException { - if (pMsg instanceof ServiceTypeRequest || pMsg instanceof AttributeRequest) { return getSrvLocAddress(pScope); } - if (pMsg instanceof ServiceRequest) { - ServiceRequest srvRqst = (ServiceRequest) pMsg; - return get(pScope, srvRqst.getServiceType()); - } - throw new IllegalArgumentException("Cannot determine IPv6 multicast address for " - + pMsg.getClass().getName() + " !"); - } - - /** - * get - * - * @param pScope - * @param pSrvType - * @return InetAddress - * @throws UnknownHostException - */ - public static InetAddress get(int pScope, ServiceType pSrvType) throws UnknownHostException { - if (pSrvType.equals(SLPDefaults.DA_SERVICE_TYPE)) { - SRVLOC_DA[1] = (byte) (pScope & 0xff); - return InetAddress.getByAddress(SRVLOC_DA); - } - return get(pScope, getSrvTypeHash(pSrvType)); - } - - /** - * get - * - * @param pScope - * @param pSrvHash - * @return InetAddress - * @throws UnknownHostException - */ - public static InetAddress get(int pScope, int pSrvHash) throws UnknownHostException { - byte scope = (byte) (pScope & 0xff); - SRV_RQST[1] = scope; - SRV_RQST[14] = (byte) ((pSrvHash >> 8) & 0xff); - SRV_RQST[15] = (byte) (pSrvHash & 0xff); - return InetAddress.getByAddress(SRV_RQST); - } - - /** - *
      -	 *  unsigned long slp_hash(const char *pc, unsigned int len) {
      -	 *    unsigned long h = 0;
      -	 *    while (len-- != 0) {
      -	 *        h *= 33;
      -	 *        h += *pc++;
      -	 *    }
      -	 *    return (0x3FF & h); // round to a range of 0-1023
      -	 *   }
      -	 * 
      - * - * @param pServiceType - * @return int - */ - public static int getSrvTypeHash(ServiceType pServiceType) { - if (pServiceType == null) return 0x1000; - String typeStr = pServiceType.toString(); - int hash = 0; - for (int i = 0; i < typeStr.length(); i++) { - hash *= 33; - hash += typeStr.charAt(i); - } - return (0x3ff & hash) + 0x1000; - } - -} +/* + (C) Copyright IBM Corp. 2007, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, IBM, ebak@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1804402 2007-09-28 ebak IPv6 ready SLP + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.slp.internal; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.net.InetAddress; +import java.net.UnknownHostException; + +import org.metricshub.wbem.sblim.slp.ServiceType; +import org.metricshub.wbem.sblim.slp.internal.msg.AttributeRequest; +import org.metricshub.wbem.sblim.slp.internal.msg.SLPMessage; +import org.metricshub.wbem.sblim.slp.internal.msg.ServiceRequest; +import org.metricshub.wbem.sblim.slp.internal.msg.ServiceTypeRequest; + +/** + *
      + * SVRLOC group-id : FF0X:0:0:0:0:0:0:116
      + *  - SRVTYPERQST Service Type Request
      + *  - ATTRRQST Attribute Request
      + *  - UA sends too
      + *  
      + * SVRLOC-DA group-id : FF0X:0:0:0:0:0:0:123
      + *  - SRVRQST for the "service:directory-agent" service type
      + *  - UA sends too
      + * 
      + * 1000 - 13FF: SRVRQST : FF0X:0:0:0:0:0:1:....
      + *  - the ID is the hashcode of the Service Type string used in the SrvRqst.
      + *  - UA sends too
      + * 
      + */ +public class IPv6MulticastAddressFactory { + + private static final byte[] SRVLOC = { (byte) 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, + (byte) 0x16 }; + + private static final byte[] SRVLOC_DA = { (byte) 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, (byte) 0x23 }; + + private static final byte[] SRV_RQST = { (byte) 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, + 0 }; + + /** + * getSrvLocAddress + * + * @param pScope + * @return InetAddress + * @throws UnknownHostException + */ + public static InetAddress getSrvLocAddress(int pScope) throws UnknownHostException { + SRVLOC[1] = (byte) (pScope & 0xff); + return InetAddress.getByAddress(SRVLOC); + } + + /** + * get + * + * @param pScope + * @param pMsg + * @return InetAddress + * @throws UnknownHostException + */ + public static InetAddress get(int pScope, SLPMessage pMsg) throws UnknownHostException { + if (pMsg instanceof ServiceTypeRequest || pMsg instanceof AttributeRequest) { return getSrvLocAddress(pScope); } + if (pMsg instanceof ServiceRequest) { + ServiceRequest srvRqst = (ServiceRequest) pMsg; + return get(pScope, srvRqst.getServiceType()); + } + throw new IllegalArgumentException("Cannot determine IPv6 multicast address for " + + pMsg.getClass().getName() + " !"); + } + + /** + * get + * + * @param pScope + * @param pSrvType + * @return InetAddress + * @throws UnknownHostException + */ + public static InetAddress get(int pScope, ServiceType pSrvType) throws UnknownHostException { + if (pSrvType.equals(SLPDefaults.DA_SERVICE_TYPE)) { + SRVLOC_DA[1] = (byte) (pScope & 0xff); + return InetAddress.getByAddress(SRVLOC_DA); + } + return get(pScope, getSrvTypeHash(pSrvType)); + } + + /** + * get + * + * @param pScope + * @param pSrvHash + * @return InetAddress + * @throws UnknownHostException + */ + public static InetAddress get(int pScope, int pSrvHash) throws UnknownHostException { + byte scope = (byte) (pScope & 0xff); + SRV_RQST[1] = scope; + SRV_RQST[14] = (byte) ((pSrvHash >> 8) & 0xff); + SRV_RQST[15] = (byte) (pSrvHash & 0xff); + return InetAddress.getByAddress(SRV_RQST); + } + + /** + *
      +	 *  unsigned long slp_hash(const char *pc, unsigned int len) {
      +	 *    unsigned long h = 0;
      +	 *    while (len-- != 0) {
      +	 *        h *= 33;
      +	 *        h += *pc++;
      +	 *    }
      +	 *    return (0x3FF & h); // round to a range of 0-1023
      +	 *   }
      +	 * 
      + * + * @param pServiceType + * @return int + */ + public static int getSrvTypeHash(ServiceType pServiceType) { + if (pServiceType == null) return 0x1000; + String typeStr = pServiceType.toString(); + int hash = 0; + for (int i = 0; i < typeStr.length(); i++) { + hash *= 33; + hash += typeStr.charAt(i); + } + return (0x3ff & hash) + 0x1000; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/Net.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/Net.java similarity index 73% rename from src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/Net.java rename to src/main/java/org/metricshub/wbem/sblim/slp/internal/Net.java index fe99ac9..01f864f 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/Net.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/Net.java @@ -1,108 +1,106 @@ -/* - (C) Copyright IBM Corp. 2007, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, IBM, ebak@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1804402 2007-09-28 ebak IPv6 ready SLP - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - */ - -package org.sentrysoftware.wbem.sblim.slp.internal; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.net.Inet4Address; -import java.net.Inet6Address; -import java.net.InetAddress; -import java.net.NetworkInterface; -import java.net.SocketException; -import java.util.Enumeration; - -/** - * Net - * - */ -public class Net { - - private static boolean cHasV6, cHasV4; - - /** - * hasIPv6 - * - * @return boolean - */ - public static boolean hasIPv6() { - scan(); - return cHasV6; - } - - /** - * hasIPv4 - * - * @return boolean - */ - public static boolean hasIPv4() { - scan(); - return cHasV4; - } - - private static boolean cScanned; - - private static void scan() { - if (cScanned) return; - try { - cScanned = true; - Enumeration ifaceEnum = NetworkInterface.getNetworkInterfaces(); - ifLoop: while (ifaceEnum.hasMoreElements()) { - NetworkInterface iface = ifaceEnum.nextElement(); - Enumeration addrEnum = iface.getInetAddresses(); - while (addrEnum.hasMoreElements()) { - InetAddress addr = addrEnum.nextElement(); - if (addr instanceof Inet4Address) { - cHasV4 = true; - if (cHasV6) break ifLoop; - } else if (addr instanceof Inet6Address) { - cHasV6 = true; - if (cHasV4) break ifLoop; - } - } - } - TRC.info("available IP versions : IPv4:" + cHasV4 + ", IPv6:" + cHasV6); - } catch (SocketException e) { - TRC.error(e); - } - } - -} +/* + (C) Copyright IBM Corp. 2007, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, IBM, ebak@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1804402 2007-09-28 ebak IPv6 ready SLP + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + */ + +package org.metricshub.wbem.sblim.slp.internal; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.net.Inet4Address; +import java.net.Inet6Address; +import java.net.InetAddress; +import java.net.NetworkInterface; +import java.net.SocketException; +import java.util.Enumeration; + +/** + * Net + * + */ +public class Net { + + private static boolean cHasV6, cHasV4; + + /** + * hasIPv6 + * + * @return boolean + */ + public static boolean hasIPv6() { + scan(); + return cHasV6; + } + + /** + * hasIPv4 + * + * @return boolean + */ + public static boolean hasIPv4() { + scan(); + return cHasV4; + } + + private static boolean cScanned; + + private static void scan() { + if (cScanned) return; + try { + cScanned = true; + Enumeration ifaceEnum = NetworkInterface.getNetworkInterfaces(); + ifLoop: while (ifaceEnum.hasMoreElements()) { + NetworkInterface iface = ifaceEnum.nextElement(); + Enumeration addrEnum = iface.getInetAddresses(); + while (addrEnum.hasMoreElements()) { + InetAddress addr = addrEnum.nextElement(); + if (addr instanceof Inet4Address) { + cHasV4 = true; + if (cHasV6) break ifLoop; + } else if (addr instanceof Inet6Address) { + cHasV6 = true; + if (cHasV4) break ifLoop; + } + } + } + TRC.info("available IP versions : IPv4:" + cHasV4 + ", IPv6:" + cHasV6); + } catch (SocketException e) { + TRC.error(e); + } + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/SLPConfig.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/SLPConfig.java similarity index 91% rename from src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/SLPConfig.java rename to src/main/java/org/metricshub/wbem/sblim/slp/internal/SLPConfig.java index 37dbc2b..68580f0 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/SLPConfig.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/SLPConfig.java @@ -1,616 +1,614 @@ -/* - SLPConfig.java - - (C) Copyright IBM Corp. 2005, 2010 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * Change History - * Flag Date Prog Description - * ------------------------------------------------------------------------------- - * 1516246 2006-07-22 lupusalex Integrate SLP client code - * 1535793 2006-09-14 lupusalex Fix&Integrate CIM&SLP configuration classes - * 1804402 2007-09-28 ebak IPv6 ready SLP - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2414503 2008-12-10 raman_arora parseList not returning populated list - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2823494 2009-08-03 rgummada Change Boolean constructor to static - * 3026311 2010-07-07 blaschke-oss Vacuous comparison of integer value - * 3026360 2010-07-07 blaschke-oss Handle unwritten fields - */ - -package org.sentrysoftware.wbem.sblim.slp.internal; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.IOException; -import java.io.InputStream; -import java.net.InetAddress; -import java.net.MalformedURLException; -import java.net.URL; -import java.net.UnknownHostException; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Properties; -import java.util.StringTokenizer; -import java.util.Map.Entry; -import java.util.logging.Level; - -import org.sentrysoftware.wbem.sblim.slp.SLPConfigProperties; - -/** - * SLPConfig - * - */ -public final class SLPConfig { - - private static InetAddress cBroadcastAddress; - - private static SLPConfig cInstance = null; - - private static InetAddress cLocalHostAddress; - - private static InetAddress cLoopBackV4; - - private static InetAddress cLoopBackV6; - - private static InetAddress cMulticastAddress; - - // SRVLOC_MulticastAddress requires scope (FF0s:0:0:0:0:0:0:116) - private static InetAddress cSRVLOC_MulticastAddress = null; - - // SRVLOC_DA_MulticastAddress requires scope (FF0s:0:0:0:0:0:0:123) - private static InetAddress cSRVLOC_DA_MulticastAddress = null; - - private static InetAddress getByName(String pName) { - try { - return InetAddress.getByName(pName); - } catch (UnknownHostException e) { - e.printStackTrace(); - return null; - } - } - - static { - cLoopBackV4 = getByName(SLPDefaults.LOOPBACK_ADDRESS_V4); - cLoopBackV6 = getByName(SLPDefaults.LOOPBACK_ADDRESS_V6); - cMulticastAddress = getByName(SLPDefaults.MULTICAST_ADDRESS); - cBroadcastAddress = getByName(SLPDefaults.BROADCAST_ADDRESS); - try { - cLocalHostAddress = InetAddress.getLocalHost(); - } catch (UnknownHostException e) { - e.printStackTrace(); - } - } - - /** - * getBroadcastAddress - * - * @return InetAddress - */ - public static InetAddress getBroadcastAddress() { - return cBroadcastAddress; - } - - /** - * getGlobalCfg - * - * @return SLPConfig - */ - public static synchronized SLPConfig getGlobalCfg() { - if (cInstance == null) { - cInstance = new SLPConfig(); - } - return cInstance; - } - - /** - * getLoopbackV4 - * - * @return InetAddress - */ - public static InetAddress getLoopbackV4() { - return cLoopBackV4; - } - - /** - * getLoopbackV6 - * - * @return InetAddress - */ - public static InetAddress getLoopbackV6() { - return cLoopBackV6; - } - - /** - * getMulticastAddress - * - * @return InetAddress - */ - public static InetAddress getMulticastAddress() { - return cMulticastAddress; - } - - /** - * getSRVLOC_MulticastAddress - * - * @return InetAddress - */ - public static InetAddress getSRVLOC_MulticastAddress() { - return cSRVLOC_MulticastAddress; - } - - /** - * getSRVLOC_DA_MulticastAddress - * - * @return InetAddress - */ - public static InetAddress getSRVLOC_DA_MulticastAddress() { - return cSRVLOC_DA_MulticastAddress; - } - - private static int getIntProperty(String pName, int pDefaultValue, int pMinValue, int pMaxValue) { - int value = Integer.getInteger(pName, pDefaultValue).intValue(); - return Math.min(pMaxValue, Math.max(pMinValue, value)); - } - - private SLPConfig() { - - try { - // try to load config class from CIM client. This will cause load of - // the CIM client's config file. - Class.forName("org.sblim.cimclient.internal.util.WBEMConfiguration"); - } catch (ClassNotFoundException e) { - // nothing to do - } - - Properties slpProperties = new Properties(new Properties()); - try { - InputStream inputstream = getConfigURLStream(); - if (inputstream != null) { - slpProperties.load(inputstream); - } - for (Iterator> iterator = slpProperties.entrySet().iterator(); iterator - .hasNext();) { - Entry entry = iterator.next(); - System - .setProperty(String.valueOf(entry.getKey()), String.valueOf(entry - .getValue())); - } - } catch (IOException e) { - System.out.println("Error while parsing property file"); - e.printStackTrace(); - } - } - - /** - * getActiveDiscoveryGranularity - * - * @return int - */ - public int getActiveDiscoveryGranularity() { - return getIntProperty(SLPConfigProperties.NET_SLP_DA_ACTIVE_DISCOVERY_GRANULARITY, - SLPDefaults.ACTIVE_DISCOVERY_GRANULARITY, SLPLimits.MIN_DISCOVERY_GRANULARITY, - SLPLimits.MAX_DISCOVERY_GRANULARITY); - } - - /** - * getActiveDiscoveryInterval - * - * @return int - */ - public int getActiveDiscoveryInterval() { - int interval = getIntProperty(SLPConfigProperties.NET_SLP_DA_ACTIVE_DISCOVERY_INTERVAL, - SLPDefaults.ACTIVE_DISCOVERY_INTERVAL, SLPLimits.MIN_DISCOVERY_INTERVAL, - SLPLimits.MAX_DISCOVERY_INTERVAL); // 3mins - if (interval > 0 && interval < 300) { return 300; - // prevent network flooding - } - return interval; - } - - /** - * getDADiscoveryTimeouts - * - * @return int[] - */ - public int[] getDADiscoveryTimeouts() { - return parseTimeouts(SLPConfigProperties.NET_SLP_DA_DISCOVERY_TIMEOUTS, - SLPDefaults.DA_DISCOVERY_TIMEOUTS); - } - - /** - * getDatagramTimeouts - * - * @return int[] - */ - public int[] getDatagramTimeouts() { - return parseTimeouts(SLPConfigProperties.NET_SLP_DATAGRAM_TIMEOUTS, - SLPDefaults.DATAGRAM_TIMEOUTS); - } - - /** - * getInterfaces - * - * @return List - */ - @SuppressWarnings("null") - public List getInterfaces() { - - String property = System.getProperty(SLPConfigProperties.NET_SLP_INTERFACES); - - List addresses = parseList(property); - - final int count = addresses == null ? 0 : addresses.size(); - List interfaces = new ArrayList(count); - - if (count == 0) { - interfaces.add(cLocalHostAddress); - interfaces.add(cLoopBackV4); - interfaces.add(cLoopBackV6); - } else { - for (int i = 0; i < count; ++i) { - String address = addresses.get(i); - try { - InetAddress inetAddress = InetAddress.getByName(address); - if (!interfaces.contains(inetAddress)) { - if (inetAddress.equals(cLocalHostAddress)) { - interfaces.add(0, inetAddress); - } else { - interfaces.add(inetAddress); - } - } - } catch (UnknownHostException e) { - // TODO log this - continue; - } - } - } - return interfaces; - } - - /** - * getPort - * - * @return int - */ - public int getPort() { - return Integer.getInteger(SLPConfigProperties.NET_SLP_PORT, SLPDefaults.SLP_PORT) - .intValue(); - } - - /** - * setPort - * - * @param pPort - */ - public void setPort(int pPort) { - System.setProperty(SLPConfigProperties.NET_SLP_PORT, Integer.toString(pPort)); - } - - /** - * getTraceLevel - * - * @return String - */ - public Level getTraceLevel() { - String str = System.getProperty(SLPConfigProperties.NET_SLP_TRC_LEVEL); - if ("OFF".equalsIgnoreCase(str)) return Level.OFF; - if ("ERROR".equalsIgnoreCase(str)) return Level.SEVERE; - if ("WARNING".equalsIgnoreCase(str)) return Level.WARNING; - if ("INFO".equalsIgnoreCase(str)) return Level.INFO; - if ("ALL".equalsIgnoreCase(str)) return Level.FINEST; - return Level.SEVERE; - } - - /** - * setTraceLevel - * - * @param pLevel - */ - public void setTraceLevel(String pLevel) { - System.setProperty(SLPConfigProperties.NET_SLP_TRC_LEVEL, pLevel); - } - - /** - * setUseIPv6 - * - * @param pValue - */ - public void setUseIPv6(boolean pValue) { - System.setProperty(SLPConfigProperties.NET_SLP_USEIPV6, Boolean.toString(pValue)); - } - - /** - * useIPv6 - * - * @return boolean - */ - public boolean useIPv6() { - return getBoolean(SLPConfigProperties.NET_SLP_USEIPV6, SLPDefaults.USE_IPV6); - } - - /** - * setUseIPv4 - * - * @param pValue - */ - public void setUseIPv4(boolean pValue) { - System.setProperty(SLPConfigProperties.NET_SLP_USEIPV4, Boolean.valueOf(pValue).toString()); - } - - /** - * useIPv4 - * - * @return boolean - */ - public boolean useIPv4() { - return getBoolean(SLPConfigProperties.NET_SLP_USEIPV4, SLPDefaults.USE_IPV4); - } - - /** - * getLocalHost - * - * @return InetAddress - */ - public InetAddress getLocalHost() { - List interfaces = getInterfaces(); - return interfaces.get(0); - } - - /** - * getMaximumResults - * - * @return int - */ - public int getMaximumResults() { - int value = Integer.getInteger(SLPConfigProperties.NET_SLP_MAX_RESULTS, - SLPDefaults.MAXIMUM_RESULTS).intValue(); - return (value >= 1 && value < SLPDefaults.MAXIMUM_RESULTS) ? value - : SLPDefaults.MAXIMUM_RESULTS; - } - - /** - * getMTU - * - * @return int - */ - public int getMTU() { - return getIntProperty(SLPConfigProperties.NET_SLP_MTU, SLPDefaults.MTU, SLPLimits.MIN_MTU, - SLPLimits.MAX_MTU); - } - - /** - * getMulticastMaximumWait - * - * @return int - */ - public int getMulticastMaximumWait() { - return getIntProperty(SLPConfigProperties.NET_SLP_MULTICAST_MAXIMUM_WAIT, - SLPDefaults.MULTICAST_MAXIMUM_WAIT, SLPLimits.MIN_MULTICAST_MAXIMUM_WAIT, - SLPLimits.MAX_MULTICAST_MAXIMUM_WAIT); - } - - /** - * getMulticastRadius - * - * @return int - */ - public int getMulticastRadius() { - return getIntProperty(SLPConfigProperties.NET_SLP_MULTICAST_TTL, - SLPDefaults.MULTICAST_RADIUS, SLPLimits.MIN_MULTICAST_RADIUS, - SLPLimits.MAX_MULTICAST_RADIUS); - } - - /** - * getMulticastTimeouts - * - * @return int[] - */ - public int[] getMulticastTimeouts() { - return parseTimeouts(SLPConfigProperties.NET_SLP_MULTICAST_TIMEOUTS, - SLPDefaults.MULTICAST_TIMEOUTS); - } - - /** - * getPreconfiguredDAs - * - * @return List <InetAddress> - */ - public List getPreconfiguredDAs() { - String addressString = System.getProperty(SLPConfigProperties.NET_SLP_DA_ADDRESSES, ""); - List addresses = parseList(addressString); - if (addresses == null) return null; - List result = new ArrayList(); - for (Iterator iter = addresses.iterator(); iter.hasNext();) { - try { - result.add(InetAddress.getByName(iter.next())); - } catch (UnknownHostException e) { - // TODO: log this - } - } - return result; - } - - /** - * getConfiguredScopes - * - * @return List<String> - */ - public List getConfiguredScopes() { - List scopes = parseList(SLPConfigProperties.NET_SLP_USE_SCOPES); - if (scopes == null) scopes = new ArrayList(); - if (scopes.size() == 0) scopes.add(SLPDefaults.DEFAULT_SCOPE); - return scopes; - } - - /** - * getSAOnlyScopes - * - * @return List<String> - */ - public List getSAOnlyScopes() { - return parseList(SLPConfigProperties.NET_SLP_SAONLY_SCOPES); - } - - /** - * getServerSocketQueueLength - * - * @return int - */ - public int getServerSocketQueueLength() { - return getIntProperty(SLPConfigProperties.NET_SLP_SERVER_SOCKET_QUEUE_LENGTH, - SLPDefaults.SERVER_SOCKET_QUEUE_LENGTH, SLPLimits.MIN_SERVER_SOCKET_QUEUE_LENGTH, - SLPLimits.MAX_SERVER_SOCKET_QUEUE_LENGTH); - } - - /** - * getTCPTimeout - * - * @return int - */ - public int getTCPTimeout() { - return getIntProperty(SLPConfigProperties.NET_SLP_TCPTIMEOUT, SLPDefaults.TCP_TIMEOUT, - SLPLimits.MIN_TCP_TIMEOUT, SLPLimits.MAX_TCP_TIMEOUT); - } - - /** - * getTraceMsg - * - * @return boolean - */ - public boolean getTraceMsg() { - return Boolean.getBoolean(SLPConfigProperties.NET_SLP_TRACE_MSG); - } - - /** - * isBroadcastOnly - * - * @return boolean - */ - public boolean isBroadcastOnly() { - return Boolean.getBoolean(SLPConfigProperties.NET_SLP_IS_BROADCAST_ONLY); - } - - /** - * isDA - * - * @return boolean - */ - public boolean isDA() { - return Boolean.getBoolean(SLPConfigProperties.NET_SLP_IS_DA); - } - - /** - * isSA - * - * @return boolean - */ - public boolean isSA() { - return !isDA(); - } - - private static boolean getBoolean(String pPropName, boolean pDefaultValue) { - if (System.getProperty(pPropName) == null) return pDefaultValue; - return Boolean.getBoolean(pPropName); - } - - private InputStream getConfigURLStream() { - - String configURL = System.getProperty(SLPConfigProperties.NET_SLP_CONFIG_URL); - - if (configURL != null) { - if (configURL.trim().length() > 0) { - try { - URL url = new URL(configURL); - InputStream inputstream = url.openStream(); - return inputstream; - } catch (MalformedURLException e) { - // TODO log this - } catch (IOException e) { - // TODO LOG this... config file not found - } - } - return null; - } - for (int i = 0; i < SLPDefaults.CONF_URLS.length; ++i) { - configURL = SLPDefaults.CONF_URLS[i]; - try { - URL url = new URL(configURL); - InputStream inputstream = url.openStream(); - return inputstream; - } catch (Exception e) { - // Nothing to do - } - } - return null; - } - - /** - * Parses comma separated list. - * - * @param pList - * @return List of Strings - */ - private static List parseList(String pListStr) { - if (pListStr == null || pListStr.length() == 0) return null; - // TODO - StringTokenizer tokenizer = new StringTokenizer(pListStr, ","); - if (tokenizer.countTokens() == 0) return null; - List list = new ArrayList(tokenizer.countTokens()); - while (tokenizer.hasMoreTokens()) { - String str = tokenizer.nextToken().trim(); - if (str.length() == 0) continue; - list.add(str); - } - return list.size() == 0 ? null : list; - } - - private int[] parseTimeouts(String pPropertyName, int[] pDefaultTimeouts) { - String value = System.getProperty(pPropertyName); - - List list = parseList(value); - if (list == null) return pDefaultTimeouts; - - int timeouts[] = new int[list.size()]; - for (int pos = 0; pos < list.size(); pos++) { - String timeoutElem = list.get(pos); - try { - timeouts[pos] = Integer.parseInt(timeoutElem); - } catch (NumberFormatException e) { - return pDefaultTimeouts; - } - } - return timeouts; - } -} +/* + SLPConfig.java + + (C) Copyright IBM Corp. 2005, 2010 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * Change History + * Flag Date Prog Description + * ------------------------------------------------------------------------------- + * 1516246 2006-07-22 lupusalex Integrate SLP client code + * 1535793 2006-09-14 lupusalex Fix&Integrate CIM&SLP configuration classes + * 1804402 2007-09-28 ebak IPv6 ready SLP + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2414503 2008-12-10 raman_arora parseList not returning populated list + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2823494 2009-08-03 rgummada Change Boolean constructor to static + * 3026311 2010-07-07 blaschke-oss Vacuous comparison of integer value + * 3026360 2010-07-07 blaschke-oss Handle unwritten fields + */ + +package org.metricshub.wbem.sblim.slp.internal; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.IOException; +import java.io.InputStream; +import java.net.InetAddress; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.UnknownHostException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Properties; +import java.util.StringTokenizer; +import java.util.Map.Entry; +import java.util.logging.Level; + +import org.metricshub.wbem.sblim.slp.SLPConfigProperties; + +/** + * SLPConfig + * + */ +public final class SLPConfig { + + private static InetAddress cBroadcastAddress; + + private static SLPConfig cInstance = null; + + private static InetAddress cLocalHostAddress; + + private static InetAddress cLoopBackV4; + + private static InetAddress cLoopBackV6; + + private static InetAddress cMulticastAddress; + + // SRVLOC_MulticastAddress requires scope (FF0s:0:0:0:0:0:0:116) + private static InetAddress cSRVLOC_MulticastAddress = null; + + // SRVLOC_DA_MulticastAddress requires scope (FF0s:0:0:0:0:0:0:123) + private static InetAddress cSRVLOC_DA_MulticastAddress = null; + + private static InetAddress getByName(String pName) { + try { + return InetAddress.getByName(pName); + } catch (UnknownHostException e) { + e.printStackTrace(); + return null; + } + } + + static { + cLoopBackV4 = getByName(SLPDefaults.LOOPBACK_ADDRESS_V4); + cLoopBackV6 = getByName(SLPDefaults.LOOPBACK_ADDRESS_V6); + cMulticastAddress = getByName(SLPDefaults.MULTICAST_ADDRESS); + cBroadcastAddress = getByName(SLPDefaults.BROADCAST_ADDRESS); + try { + cLocalHostAddress = InetAddress.getLocalHost(); + } catch (UnknownHostException e) { + e.printStackTrace(); + } + } + + /** + * getBroadcastAddress + * + * @return InetAddress + */ + public static InetAddress getBroadcastAddress() { + return cBroadcastAddress; + } + + /** + * getGlobalCfg + * + * @return SLPConfig + */ + public static synchronized SLPConfig getGlobalCfg() { + if (cInstance == null) { + cInstance = new SLPConfig(); + } + return cInstance; + } + + /** + * getLoopbackV4 + * + * @return InetAddress + */ + public static InetAddress getLoopbackV4() { + return cLoopBackV4; + } + + /** + * getLoopbackV6 + * + * @return InetAddress + */ + public static InetAddress getLoopbackV6() { + return cLoopBackV6; + } + + /** + * getMulticastAddress + * + * @return InetAddress + */ + public static InetAddress getMulticastAddress() { + return cMulticastAddress; + } + + /** + * getSRVLOC_MulticastAddress + * + * @return InetAddress + */ + public static InetAddress getSRVLOC_MulticastAddress() { + return cSRVLOC_MulticastAddress; + } + + /** + * getSRVLOC_DA_MulticastAddress + * + * @return InetAddress + */ + public static InetAddress getSRVLOC_DA_MulticastAddress() { + return cSRVLOC_DA_MulticastAddress; + } + + private static int getIntProperty(String pName, int pDefaultValue, int pMinValue, int pMaxValue) { + int value = Integer.getInteger(pName, pDefaultValue).intValue(); + return Math.min(pMaxValue, Math.max(pMinValue, value)); + } + + private SLPConfig() { + + try { + // try to load config class from CIM client. This will cause load of + // the CIM client's config file. + Class.forName("org.sblim.cimclient.internal.util.WBEMConfiguration"); + } catch (ClassNotFoundException e) { + // nothing to do + } + + Properties slpProperties = new Properties(new Properties()); + try { + InputStream inputstream = getConfigURLStream(); + if (inputstream != null) { + slpProperties.load(inputstream); + } + for (Iterator> iterator = slpProperties.entrySet().iterator(); iterator + .hasNext();) { + Entry entry = iterator.next(); + System + .setProperty(String.valueOf(entry.getKey()), String.valueOf(entry + .getValue())); + } + } catch (IOException e) { + System.out.println("Error while parsing property file"); + e.printStackTrace(); + } + } + + /** + * getActiveDiscoveryGranularity + * + * @return int + */ + public int getActiveDiscoveryGranularity() { + return getIntProperty(SLPConfigProperties.NET_SLP_DA_ACTIVE_DISCOVERY_GRANULARITY, + SLPDefaults.ACTIVE_DISCOVERY_GRANULARITY, SLPLimits.MIN_DISCOVERY_GRANULARITY, + SLPLimits.MAX_DISCOVERY_GRANULARITY); + } + + /** + * getActiveDiscoveryInterval + * + * @return int + */ + public int getActiveDiscoveryInterval() { + int interval = getIntProperty(SLPConfigProperties.NET_SLP_DA_ACTIVE_DISCOVERY_INTERVAL, + SLPDefaults.ACTIVE_DISCOVERY_INTERVAL, SLPLimits.MIN_DISCOVERY_INTERVAL, + SLPLimits.MAX_DISCOVERY_INTERVAL); // 3mins + if (interval > 0 && interval < 300) { return 300; + // prevent network flooding + } + return interval; + } + + /** + * getDADiscoveryTimeouts + * + * @return int[] + */ + public int[] getDADiscoveryTimeouts() { + return parseTimeouts(SLPConfigProperties.NET_SLP_DA_DISCOVERY_TIMEOUTS, + SLPDefaults.DA_DISCOVERY_TIMEOUTS); + } + + /** + * getDatagramTimeouts + * + * @return int[] + */ + public int[] getDatagramTimeouts() { + return parseTimeouts(SLPConfigProperties.NET_SLP_DATAGRAM_TIMEOUTS, + SLPDefaults.DATAGRAM_TIMEOUTS); + } + + /** + * getInterfaces + * + * @return List + */ + @SuppressWarnings("null") + public List getInterfaces() { + + String property = System.getProperty(SLPConfigProperties.NET_SLP_INTERFACES); + + List addresses = parseList(property); + + final int count = addresses == null ? 0 : addresses.size(); + List interfaces = new ArrayList(count); + + if (count == 0) { + interfaces.add(cLocalHostAddress); + interfaces.add(cLoopBackV4); + interfaces.add(cLoopBackV6); + } else { + for (int i = 0; i < count; ++i) { + String address = addresses.get(i); + try { + InetAddress inetAddress = InetAddress.getByName(address); + if (!interfaces.contains(inetAddress)) { + if (inetAddress.equals(cLocalHostAddress)) { + interfaces.add(0, inetAddress); + } else { + interfaces.add(inetAddress); + } + } + } catch (UnknownHostException e) { + // TODO log this + continue; + } + } + } + return interfaces; + } + + /** + * getPort + * + * @return int + */ + public int getPort() { + return Integer.getInteger(SLPConfigProperties.NET_SLP_PORT, SLPDefaults.SLP_PORT) + .intValue(); + } + + /** + * setPort + * + * @param pPort + */ + public void setPort(int pPort) { + System.setProperty(SLPConfigProperties.NET_SLP_PORT, Integer.toString(pPort)); + } + + /** + * getTraceLevel + * + * @return String + */ + public Level getTraceLevel() { + String str = System.getProperty(SLPConfigProperties.NET_SLP_TRC_LEVEL); + if ("OFF".equalsIgnoreCase(str)) return Level.OFF; + if ("ERROR".equalsIgnoreCase(str)) return Level.SEVERE; + if ("WARNING".equalsIgnoreCase(str)) return Level.WARNING; + if ("INFO".equalsIgnoreCase(str)) return Level.INFO; + if ("ALL".equalsIgnoreCase(str)) return Level.FINEST; + return Level.SEVERE; + } + + /** + * setTraceLevel + * + * @param pLevel + */ + public void setTraceLevel(String pLevel) { + System.setProperty(SLPConfigProperties.NET_SLP_TRC_LEVEL, pLevel); + } + + /** + * setUseIPv6 + * + * @param pValue + */ + public void setUseIPv6(boolean pValue) { + System.setProperty(SLPConfigProperties.NET_SLP_USEIPV6, Boolean.toString(pValue)); + } + + /** + * useIPv6 + * + * @return boolean + */ + public boolean useIPv6() { + return getBoolean(SLPConfigProperties.NET_SLP_USEIPV6, SLPDefaults.USE_IPV6); + } + + /** + * setUseIPv4 + * + * @param pValue + */ + public void setUseIPv4(boolean pValue) { + System.setProperty(SLPConfigProperties.NET_SLP_USEIPV4, Boolean.valueOf(pValue).toString()); + } + + /** + * useIPv4 + * + * @return boolean + */ + public boolean useIPv4() { + return getBoolean(SLPConfigProperties.NET_SLP_USEIPV4, SLPDefaults.USE_IPV4); + } + + /** + * getLocalHost + * + * @return InetAddress + */ + public InetAddress getLocalHost() { + List interfaces = getInterfaces(); + return interfaces.get(0); + } + + /** + * getMaximumResults + * + * @return int + */ + public int getMaximumResults() { + int value = Integer.getInteger(SLPConfigProperties.NET_SLP_MAX_RESULTS, + SLPDefaults.MAXIMUM_RESULTS).intValue(); + return (value >= 1 && value < SLPDefaults.MAXIMUM_RESULTS) ? value + : SLPDefaults.MAXIMUM_RESULTS; + } + + /** + * getMTU + * + * @return int + */ + public int getMTU() { + return getIntProperty(SLPConfigProperties.NET_SLP_MTU, SLPDefaults.MTU, SLPLimits.MIN_MTU, + SLPLimits.MAX_MTU); + } + + /** + * getMulticastMaximumWait + * + * @return int + */ + public int getMulticastMaximumWait() { + return getIntProperty(SLPConfigProperties.NET_SLP_MULTICAST_MAXIMUM_WAIT, + SLPDefaults.MULTICAST_MAXIMUM_WAIT, SLPLimits.MIN_MULTICAST_MAXIMUM_WAIT, + SLPLimits.MAX_MULTICAST_MAXIMUM_WAIT); + } + + /** + * getMulticastRadius + * + * @return int + */ + public int getMulticastRadius() { + return getIntProperty(SLPConfigProperties.NET_SLP_MULTICAST_TTL, + SLPDefaults.MULTICAST_RADIUS, SLPLimits.MIN_MULTICAST_RADIUS, + SLPLimits.MAX_MULTICAST_RADIUS); + } + + /** + * getMulticastTimeouts + * + * @return int[] + */ + public int[] getMulticastTimeouts() { + return parseTimeouts(SLPConfigProperties.NET_SLP_MULTICAST_TIMEOUTS, + SLPDefaults.MULTICAST_TIMEOUTS); + } + + /** + * getPreconfiguredDAs + * + * @return List <InetAddress> + */ + public List getPreconfiguredDAs() { + String addressString = System.getProperty(SLPConfigProperties.NET_SLP_DA_ADDRESSES, ""); + List addresses = parseList(addressString); + if (addresses == null) return null; + List result = new ArrayList(); + for (Iterator iter = addresses.iterator(); iter.hasNext();) { + try { + result.add(InetAddress.getByName(iter.next())); + } catch (UnknownHostException e) { + // TODO: log this + } + } + return result; + } + + /** + * getConfiguredScopes + * + * @return List<String> + */ + public List getConfiguredScopes() { + List scopes = parseList(SLPConfigProperties.NET_SLP_USE_SCOPES); + if (scopes == null) scopes = new ArrayList(); + if (scopes.size() == 0) scopes.add(SLPDefaults.DEFAULT_SCOPE); + return scopes; + } + + /** + * getSAOnlyScopes + * + * @return List<String> + */ + public List getSAOnlyScopes() { + return parseList(SLPConfigProperties.NET_SLP_SAONLY_SCOPES); + } + + /** + * getServerSocketQueueLength + * + * @return int + */ + public int getServerSocketQueueLength() { + return getIntProperty(SLPConfigProperties.NET_SLP_SERVER_SOCKET_QUEUE_LENGTH, + SLPDefaults.SERVER_SOCKET_QUEUE_LENGTH, SLPLimits.MIN_SERVER_SOCKET_QUEUE_LENGTH, + SLPLimits.MAX_SERVER_SOCKET_QUEUE_LENGTH); + } + + /** + * getTCPTimeout + * + * @return int + */ + public int getTCPTimeout() { + return getIntProperty(SLPConfigProperties.NET_SLP_TCPTIMEOUT, SLPDefaults.TCP_TIMEOUT, + SLPLimits.MIN_TCP_TIMEOUT, SLPLimits.MAX_TCP_TIMEOUT); + } + + /** + * getTraceMsg + * + * @return boolean + */ + public boolean getTraceMsg() { + return Boolean.getBoolean(SLPConfigProperties.NET_SLP_TRACE_MSG); + } + + /** + * isBroadcastOnly + * + * @return boolean + */ + public boolean isBroadcastOnly() { + return Boolean.getBoolean(SLPConfigProperties.NET_SLP_IS_BROADCAST_ONLY); + } + + /** + * isDA + * + * @return boolean + */ + public boolean isDA() { + return Boolean.getBoolean(SLPConfigProperties.NET_SLP_IS_DA); + } + + /** + * isSA + * + * @return boolean + */ + public boolean isSA() { + return !isDA(); + } + + private static boolean getBoolean(String pPropName, boolean pDefaultValue) { + if (System.getProperty(pPropName) == null) return pDefaultValue; + return Boolean.getBoolean(pPropName); + } + + private InputStream getConfigURLStream() { + + String configURL = System.getProperty(SLPConfigProperties.NET_SLP_CONFIG_URL); + + if (configURL != null) { + if (configURL.trim().length() > 0) { + try { + URL url = new URL(configURL); + InputStream inputstream = url.openStream(); + return inputstream; + } catch (MalformedURLException e) { + // TODO log this + } catch (IOException e) { + // TODO LOG this... config file not found + } + } + return null; + } + for (int i = 0; i < SLPDefaults.CONF_URLS.length; ++i) { + configURL = SLPDefaults.CONF_URLS[i]; + try { + URL url = new URL(configURL); + InputStream inputstream = url.openStream(); + return inputstream; + } catch (Exception e) { + // Nothing to do + } + } + return null; + } + + /** + * Parses comma separated list. + * + * @param pList + * @return List of Strings + */ + private static List parseList(String pListStr) { + if (pListStr == null || pListStr.length() == 0) return null; + // TODO + StringTokenizer tokenizer = new StringTokenizer(pListStr, ","); + if (tokenizer.countTokens() == 0) return null; + List list = new ArrayList(tokenizer.countTokens()); + while (tokenizer.hasMoreTokens()) { + String str = tokenizer.nextToken().trim(); + if (str.length() == 0) continue; + list.add(str); + } + return list.size() == 0 ? null : list; + } + + private int[] parseTimeouts(String pPropertyName, int[] pDefaultTimeouts) { + String value = System.getProperty(pPropertyName); + + List list = parseList(value); + if (list == null) return pDefaultTimeouts; + + int timeouts[] = new int[list.size()]; + for (int pos = 0; pos < list.size(); pos++) { + String timeoutElem = list.get(pos); + try { + timeouts[pos] = Integer.parseInt(timeoutElem); + } catch (NumberFormatException e) { + return pDefaultTimeouts; + } + } + return timeouts; + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/SLPDefaults.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/SLPDefaults.java similarity index 81% rename from src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/SLPDefaults.java rename to src/main/java/org/metricshub/wbem/sblim/slp/internal/SLPDefaults.java index ee1a589..fced292 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/SLPDefaults.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/SLPDefaults.java @@ -1,219 +1,217 @@ -/* - SLPDefaults.java - - (C) Copyright IBM Corp. 2005, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com - * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1516246 2006-07-22 lupusalex Integrate SLP client code - * 1535793 2006-09-14 lupusalex Fix&Integrate CIM&SLP configuration classes - * 1804402 2007-09-28 ebak IPv6 ready SLP - * 1911400 2008-03-10 blaschks-oss Source RPM file on SourceForge is broken - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.slp.internal; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.Locale; - -import org.sentrysoftware.wbem.sblim.slp.ServiceType; - -/** - * SLPDefaults - * - */ -/** - * Class SLPDefaults is responsible for - * - */ -public interface SLPDefaults { - - /** - * ALL_AUTHORITIES - */ - public static final String ALL_AUTHORITIES = "*"; - - /** - * BROADCAST_ADDRESS - */ - public static final String BROADCAST_ADDRESS = "255.255.255.255"; - - /** - * CONF_URLS - */ - public static final String[] CONF_URLS = { - "file:sblim-slp-client2.properties", - "file:" + System.getProperty("user.home") + System.getProperty("file.separator") - + "sblim-slp-client2.properties", - "file:/etc/java/sblim-slp-client2.properties", "file:/etc/sblim-slp-client2.properties" }; - - /** - * DA_DISCOVERY_TIMEOUTS - */ - public static final int DA_DISCOVERY_TIMEOUTS[] = { 200, 200, 200, 200, 300, 400 }; - - /** - * DA_SERVICE_TYPE - */ - public static final ServiceType DA_SERVICE_TYPE = new ServiceType("service:directory-agent"); - - /** - * DATAGRAM_TIMEOUTS - */ - public static final int DATAGRAM_TIMEOUTS[] = { 100, 200, 300 }; - - /** - * DEFAULT_SCOPE - */ - public static final String DEFAULT_SCOPE = "default"; - - /** - * ACTIVE_DISCOVERY_GRANULARITY - */ - public static final int ACTIVE_DISCOVERY_GRANULARITY = 900; - - /** - * ACTIVE_DISCOVERY_INTERVAL - */ - public static final int ACTIVE_DISCOVERY_INTERVAL = 900; - - /** - * LOCALE - */ - public static final Locale LOCALE = new Locale("en", ""); - - /** - * LOG_FILE - */ - public static final String LOG_FILE = "slp.log"; - - /** - * LOOPBACK_ADDRESS_V4 - */ - public static final String LOOPBACK_ADDRESS_V4 = "127.0.0.1"; - - /** - * LOOPBACK_ADDRESS_V6 - */ - public static final String LOOPBACK_ADDRESS_V6 = "::1"; - - /** - * LOOPBACK_NAME - */ - public static final String LOOPBACK_NAME = "localhost"; - - /** - * MAXIMUM_RESULTS - */ - public static final int MAXIMUM_RESULTS = 0x7fffffff; - - /** - * MTU - */ - public static final int MTU = 1400; - - /** - * MULTICAST_ADDRESS - */ - public static final String MULTICAST_ADDRESS = "239.255.255.253"; - - /** - * MULTICAST_MAXIMUM_WAIT - */ - public static final int MULTICAST_MAXIMUM_WAIT = 2000; - - /** - * MULTICAST_RADIUS - */ - public static final int MULTICAST_RADIUS = 255; - - /** - * MULTICAST_TIMEOUTS - */ - public static final int MULTICAST_TIMEOUTS[] = { 200, 200, 200, 200, 300, 400 }; - - /** - * SA_SERVICE_TYPE - */ - public static final ServiceType SA_SERVICE_TYPE = new ServiceType("service:service-agent"); - - /** - * SERVER_SOCKET_QUEUE_LENGTH - */ - public static final int SERVER_SOCKET_QUEUE_LENGTH = 10; - - /** - * SLP_PORT - */ - public static final int SLP_PORT = 427; - - /** - * USE_IPV6 - */ - public static final boolean USE_IPV6 = true; - - /** - * USE_IPV4 - */ - public static final boolean USE_IPV4 = true; - - /** - * SLP_VERSION - */ - public static final int SLP_VERSION = 2; - - /** - * TCP_TIMEOUT - */ - public static final int TCP_TIMEOUT = 20000; - - /** - * ENCODING - */ - public static final String ENCODING = "UTF-8"; - - /** - * DA list is rediscovered if DACACHE_TIMEOUT (seconds) is elapsed. - */ - public static final int DACACHE_TIMEOUT = 90; - - /** - * IPV6_MULTICAST_SCOPE - */ - public static final int IPV6_MULTICAST_SCOPE = 5; - -} +/* + SLPDefaults.java + + (C) Copyright IBM Corp. 2005, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com + * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1516246 2006-07-22 lupusalex Integrate SLP client code + * 1535793 2006-09-14 lupusalex Fix&Integrate CIM&SLP configuration classes + * 1804402 2007-09-28 ebak IPv6 ready SLP + * 1911400 2008-03-10 blaschks-oss Source RPM file on SourceForge is broken + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.slp.internal; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.Locale; + +import org.metricshub.wbem.sblim.slp.ServiceType; + +/** + * SLPDefaults + * + */ +/** + * Class SLPDefaults is responsible for + * + */ +public interface SLPDefaults { + + /** + * ALL_AUTHORITIES + */ + public static final String ALL_AUTHORITIES = "*"; + + /** + * BROADCAST_ADDRESS + */ + public static final String BROADCAST_ADDRESS = "255.255.255.255"; + + /** + * CONF_URLS + */ + public static final String[] CONF_URLS = { + "file:sblim-slp-client2.properties", + "file:" + System.getProperty("user.home") + System.getProperty("file.separator") + + "sblim-slp-client2.properties", + "file:/etc/java/sblim-slp-client2.properties", "file:/etc/sblim-slp-client2.properties" }; + + /** + * DA_DISCOVERY_TIMEOUTS + */ + public static final int DA_DISCOVERY_TIMEOUTS[] = { 200, 200, 200, 200, 300, 400 }; + + /** + * DA_SERVICE_TYPE + */ + public static final ServiceType DA_SERVICE_TYPE = new ServiceType("service:directory-agent"); + + /** + * DATAGRAM_TIMEOUTS + */ + public static final int DATAGRAM_TIMEOUTS[] = { 100, 200, 300 }; + + /** + * DEFAULT_SCOPE + */ + public static final String DEFAULT_SCOPE = "default"; + + /** + * ACTIVE_DISCOVERY_GRANULARITY + */ + public static final int ACTIVE_DISCOVERY_GRANULARITY = 900; + + /** + * ACTIVE_DISCOVERY_INTERVAL + */ + public static final int ACTIVE_DISCOVERY_INTERVAL = 900; + + /** + * LOCALE + */ + public static final Locale LOCALE = new Locale("en", ""); + + /** + * LOG_FILE + */ + public static final String LOG_FILE = "slp.log"; + + /** + * LOOPBACK_ADDRESS_V4 + */ + public static final String LOOPBACK_ADDRESS_V4 = "127.0.0.1"; + + /** + * LOOPBACK_ADDRESS_V6 + */ + public static final String LOOPBACK_ADDRESS_V6 = "::1"; + + /** + * LOOPBACK_NAME + */ + public static final String LOOPBACK_NAME = "localhost"; + + /** + * MAXIMUM_RESULTS + */ + public static final int MAXIMUM_RESULTS = 0x7fffffff; + + /** + * MTU + */ + public static final int MTU = 1400; + + /** + * MULTICAST_ADDRESS + */ + public static final String MULTICAST_ADDRESS = "239.255.255.253"; + + /** + * MULTICAST_MAXIMUM_WAIT + */ + public static final int MULTICAST_MAXIMUM_WAIT = 2000; + + /** + * MULTICAST_RADIUS + */ + public static final int MULTICAST_RADIUS = 255; + + /** + * MULTICAST_TIMEOUTS + */ + public static final int MULTICAST_TIMEOUTS[] = { 200, 200, 200, 200, 300, 400 }; + + /** + * SA_SERVICE_TYPE + */ + public static final ServiceType SA_SERVICE_TYPE = new ServiceType("service:service-agent"); + + /** + * SERVER_SOCKET_QUEUE_LENGTH + */ + public static final int SERVER_SOCKET_QUEUE_LENGTH = 10; + + /** + * SLP_PORT + */ + public static final int SLP_PORT = 427; + + /** + * USE_IPV6 + */ + public static final boolean USE_IPV6 = true; + + /** + * USE_IPV4 + */ + public static final boolean USE_IPV4 = true; + + /** + * SLP_VERSION + */ + public static final int SLP_VERSION = 2; + + /** + * TCP_TIMEOUT + */ + public static final int TCP_TIMEOUT = 20000; + + /** + * ENCODING + */ + public static final String ENCODING = "UTF-8"; + + /** + * DA list is rediscovered if DACACHE_TIMEOUT (seconds) is elapsed. + */ + public static final int DACACHE_TIMEOUT = 90; + + /** + * IPV6_MULTICAST_SCOPE + */ + public static final int IPV6_MULTICAST_SCOPE = 5; + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/SLPLimits.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/SLPLimits.java similarity index 74% rename from src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/SLPLimits.java rename to src/main/java/org/metricshub/wbem/sblim/slp/internal/SLPLimits.java index d915756..d0c2c58 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/SLPLimits.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/SLPLimits.java @@ -1,123 +1,121 @@ -/* - SLPLimits.java - - (C) Copyright IBM Corp. 2006, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Alexander Wolf-Reber, IBM a.wolf-reber@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1535793 2006-09-14 lupusalex Fix&Integrate CIM&SLP configuration classes - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2907527 2009-12-02 blaschke-oss Fix SLP properties issues - */ -package org.sentrysoftware.wbem.sblim.slp.internal; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -/** - * SLPLimits - * - */ -public interface SLPLimits { - - /** - * MAX_DISCOVERY_GRANULARITY - */ - public static final int MAX_DISCOVERY_GRANULARITY = 10800; - - /** - * MAX_DISCOVERY_INTERVAL - */ - public static final int MAX_DISCOVERY_INTERVAL = 3 * 60 * 60; // 3h - - /** - * MAX_MTU - */ - public static final int MAX_MTU = 8192; - - /** - * MAX_MULTICAST_MAXIMUM_WAIT - */ - public static final int MAX_MULTICAST_MAXIMUM_WAIT = 60000; - - /** - * MAX_MULTICAST_RADIUS - */ - public static final int MAX_MULTICAST_RADIUS = 255; - - /** - * MAX_SERVER_SOCKET_QUEUE_LENGTH - */ - public static final int MAX_SERVER_SOCKET_QUEUE_LENGTH = 0x7fffffff; - - /** - * MAX_TCP_TIMEOUT - */ - public static final int MAX_TCP_TIMEOUT = 360000; - - /** - * MIN_DISCOVERY_GRANULARITY - */ - public static final int MIN_DISCOVERY_GRANULARITY = 0; - - /** - * MIN_DISCOVERY_INTERVAL - */ - public static final int MIN_DISCOVERY_INTERVAL = 0; - - /** - * MIN_MTU - */ - public static final int MIN_MTU = 128; - - /** - * MIN_MULTICAST_MAXIMUM_WAIT - */ - public static final int MIN_MULTICAST_MAXIMUM_WAIT = 1000; - - /** - * MIN_MULTICAST_RADIUS - */ - public static final int MIN_MULTICAST_RADIUS = 1; - - /** - * MIN_SERVER_SOCKET_QUEUE_LENGTH - */ - public static final int MIN_SERVER_SOCKET_QUEUE_LENGTH = 0; - - /** - * MIN_TCP_TIMEOUT - */ - public static final int MIN_TCP_TIMEOUT = 100; - -} +/* + SLPLimits.java + + (C) Copyright IBM Corp. 2006, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Alexander Wolf-Reber, IBM a.wolf-reber@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1535793 2006-09-14 lupusalex Fix&Integrate CIM&SLP configuration classes + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2907527 2009-12-02 blaschke-oss Fix SLP properties issues + */ +package org.metricshub.wbem.sblim.slp.internal; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +/** + * SLPLimits + * + */ +public interface SLPLimits { + + /** + * MAX_DISCOVERY_GRANULARITY + */ + public static final int MAX_DISCOVERY_GRANULARITY = 10800; + + /** + * MAX_DISCOVERY_INTERVAL + */ + public static final int MAX_DISCOVERY_INTERVAL = 3 * 60 * 60; // 3h + + /** + * MAX_MTU + */ + public static final int MAX_MTU = 8192; + + /** + * MAX_MULTICAST_MAXIMUM_WAIT + */ + public static final int MAX_MULTICAST_MAXIMUM_WAIT = 60000; + + /** + * MAX_MULTICAST_RADIUS + */ + public static final int MAX_MULTICAST_RADIUS = 255; + + /** + * MAX_SERVER_SOCKET_QUEUE_LENGTH + */ + public static final int MAX_SERVER_SOCKET_QUEUE_LENGTH = 0x7fffffff; + + /** + * MAX_TCP_TIMEOUT + */ + public static final int MAX_TCP_TIMEOUT = 360000; + + /** + * MIN_DISCOVERY_GRANULARITY + */ + public static final int MIN_DISCOVERY_GRANULARITY = 0; + + /** + * MIN_DISCOVERY_INTERVAL + */ + public static final int MIN_DISCOVERY_INTERVAL = 0; + + /** + * MIN_MTU + */ + public static final int MIN_MTU = 128; + + /** + * MIN_MULTICAST_MAXIMUM_WAIT + */ + public static final int MIN_MULTICAST_MAXIMUM_WAIT = 1000; + + /** + * MIN_MULTICAST_RADIUS + */ + public static final int MIN_MULTICAST_RADIUS = 1; + + /** + * MIN_SERVER_SOCKET_QUEUE_LENGTH + */ + public static final int MIN_SERVER_SOCKET_QUEUE_LENGTH = 0; + + /** + * MIN_TCP_TIMEOUT + */ + public static final int MIN_TCP_TIMEOUT = 100; + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/SLPString.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/SLPString.java similarity index 78% rename from src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/SLPString.java rename to src/main/java/org/metricshub/wbem/sblim/slp/internal/SLPString.java index a8608c7..3ce766e 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/SLPString.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/SLPString.java @@ -1,121 +1,119 @@ -/* - (C) Copyright IBM Corp. 2007, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, IBM, ebak@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1804402 2007-09-28 ebak IPv6 ready SLP - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.slp.internal; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -/** - *
      - * This class provides functions for comparison of SLP message strings.
      - * 
      - * From RFC 2608:
      - * 
      - * String comparison for order and equality in SLP MUST be case
      - * insensitive inside the 0x00-0x7F subrange of UTF-8 (which corresponds
      - * to ASCII character encoding).  Case insensitivity SHOULD be supported
      - * throughout the entire UTF-8 encoded Unicode [6] character set.
      - * 
      - * The case insensitivity rule applies to all string matching in SLPv2,
      - * including Scope strings, SLP SPI strings, service types, attribute
      - * tags and values in query handling, language tags, previous responder
      - * lists.  Comparisons of URL strings, however, is case sensitive.
      - * 
      - * White space (SPACE, CR, LF, TAB) internal to a string value is folded
      - * to a single SPACE character for the sake of string comparisons.
      - * White space preceding or following a string value is ignored for the
      - * purposes of string comparison.  For example, "  Some String  "
      - * matches "SOME    STRING".
      - * 
      - */ - -public class SLPString { - - /** - * equals - * - * @param pStr0 - * @param pStr1 - * @return boolean - */ - public static boolean equals(String pStr0, String pStr1) { - if (pStr0 == null) return pStr1 == null; - if (pStr1 == null) return false; - return unify(pStr0).equals(unify(pStr1)); - } - - /** - * compare - * - * @param pStr0 - * @param pStr1 - * @return int - */ - public static int compare(String pStr0, String pStr1) { - return unify(pStr0).compareTo(unify(pStr1)); - } - - /** - * public for testing only. - * - * @param pStr - * @return String - */ - public static String unify(String pStr) { - if (pStr == null) return null; - StringBuffer resBuf = new StringBuffer(); - boolean inSpace = false; - for (int i = 0; i < pStr.length(); i++) { - char ch = pStr.charAt(i); - if (ch == ' ' || ch == '\t' || ch == 0xa || ch == 0xd) { - if (resBuf.length() == 0) continue; // skip front white spaces - inSpace = true; - } else { - if (inSpace) { - resBuf.append(' '); - inSpace = false; - } - resBuf.append(Character.toLowerCase(ch)); - } - } - return resBuf.toString(); - } - -} +/* + (C) Copyright IBM Corp. 2007, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, IBM, ebak@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1804402 2007-09-28 ebak IPv6 ready SLP + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.slp.internal; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +/** + *
      + * This class provides functions for comparison of SLP message strings.
      + * 
      + * From RFC 2608:
      + * 
      + * String comparison for order and equality in SLP MUST be case
      + * insensitive inside the 0x00-0x7F subrange of UTF-8 (which corresponds
      + * to ASCII character encoding).  Case insensitivity SHOULD be supported
      + * throughout the entire UTF-8 encoded Unicode [6] character set.
      + * 
      + * The case insensitivity rule applies to all string matching in SLPv2,
      + * including Scope strings, SLP SPI strings, service types, attribute
      + * tags and values in query handling, language tags, previous responder
      + * lists.  Comparisons of URL strings, however, is case sensitive.
      + * 
      + * White space (SPACE, CR, LF, TAB) internal to a string value is folded
      + * to a single SPACE character for the sake of string comparisons.
      + * White space preceding or following a string value is ignored for the
      + * purposes of string comparison.  For example, "  Some String  "
      + * matches "SOME    STRING".
      + * 
      + */ + +public class SLPString { + + /** + * equals + * + * @param pStr0 + * @param pStr1 + * @return boolean + */ + public static boolean equals(String pStr0, String pStr1) { + if (pStr0 == null) return pStr1 == null; + if (pStr1 == null) return false; + return unify(pStr0).equals(unify(pStr1)); + } + + /** + * compare + * + * @param pStr0 + * @param pStr1 + * @return int + */ + public static int compare(String pStr0, String pStr1) { + return unify(pStr0).compareTo(unify(pStr1)); + } + + /** + * public for testing only. + * + * @param pStr + * @return String + */ + public static String unify(String pStr) { + if (pStr == null) return null; + StringBuffer resBuf = new StringBuffer(); + boolean inSpace = false; + for (int i = 0; i < pStr.length(); i++) { + char ch = pStr.charAt(i); + if (ch == ' ' || ch == '\t' || ch == 0xa || ch == 0xd) { + if (resBuf.length() == 0) continue; // skip front white spaces + inSpace = true; + } else { + if (inSpace) { + resBuf.append(' '); + inSpace = false; + } + resBuf.append(Character.toLowerCase(ch)); + } + } + return resBuf.toString(); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/TRC.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/TRC.java similarity index 85% rename from src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/TRC.java rename to src/main/java/org/metricshub/wbem/sblim/slp/internal/TRC.java index 85cafcc..e8f959c 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/TRC.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/TRC.java @@ -1,303 +1,301 @@ -/* - (C) Copyright IBM Corp. 2007, 2011 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, IBM, ebak@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1804402 2007-09-28 ebak IPv6 ready SLP - * 1892103 2008-02-12 ebak SLP improvements - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 3400209 2011-08-31 blaschke-oss Highlighted Static Analysis (PMD) issues - */ - -package org.sentrysoftware.wbem.sblim.slp.internal; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.OutputStream; -import java.io.PrintStream; -import java.io.PrintWriter; -import java.io.StringWriter; -import java.util.Calendar; -import java.util.Date; -import java.util.logging.Level; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.sentrysoftware.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; - -/** - * debug -> FINEST info -> INFO warning -> WARNING error -> SEVERE - * - */ -public class TRC { - - private static PrintStream cOut; - - private static Level cLevel = SLPConfig.getGlobalCfg().getTraceLevel(); - - private static LogAndTraceBroker cLogger = LogAndTraceBroker.getBroker(); - - private static Pattern[] cDenyPatterns; - - private static Pattern[] cAllowPatterns; - - private static final String NAME = new TRC().getClass().getName(); - - /** - * setLevel - * - * @param pLevel - */ - public static void setLevel(Level pLevel) { - cLevel = pLevel; - } - - /** - * setConsolLog - * - * @param pOutStr - */ - public static void setOutput(OutputStream pOutStr) { - setOutput(new PrintStream(pOutStr)); - } - - /** - * setOutputStream - * - * @param pOutStr - */ - public static void setOutput(PrintStream pOutStr) { - cOut = pOutStr; - } - - /** - * setPatterns - * - * @param pDenyPatterns - * @param pAllowPatterns - */ - public static void setPatterns(String[] pDenyPatterns, String[] pAllowPatterns) { - cDenyPatterns = compile(pDenyPatterns); - cAllowPatterns = compile(pAllowPatterns); - } - - private static Pattern[] compile(String[] pStrs) { - if (pStrs == null) return null; - Pattern[] patterns = new Pattern[pStrs.length]; - for (int i = 0; i < patterns.length; i++) { - patterns[i] = Pattern.compile(pStrs[i]); - } - return patterns; - } - - /** - * debug - * - * @param pMsg - */ - public static void debug(String pMsg) { - debug(pMsg, null); - } - - /** - * debug - * - * @param pMsg - * @param pEx - */ - public static void debug(String pMsg, Exception pEx) { - if (cLevel.intValue() > Level.FINEST.intValue()) return; - trace(Level.FINEST, pMsg, pEx); - } - - /** - * info - * - * @param pMsg - */ - public static void info(String pMsg) { - info(pMsg, null); - } - - /** - * info - * - * @param pMsg - * @param pEx - */ - public static void info(String pMsg, Exception pEx) { - if (cLevel.intValue() > Level.INFO.intValue()) return; - trace(Level.INFO, pMsg, pEx); - } - - /** - * warning - * - * @param pMsg - */ - public static void warning(String pMsg) { - warning(pMsg, null); - } - - /** - * warning - * - * @param pMsg - * @param pEx - */ - public static void warning(String pMsg, Exception pEx) { - if (cLevel.intValue() > Level.WARNING.intValue()) return; - trace(Level.WARNING, pMsg, pEx); - } - - /** - * error - * - * @param pMsg - */ - public static void error(String pMsg) { - error(pMsg, null); - } - - /** - * error - * - * @param pEx - */ - public static void error(Exception pEx) { - error(null, pEx); - } - - /** - * error - * - * @param pMsg - * @param pEx - */ - public static void error(String pMsg, Exception pEx) { - if (cLevel.intValue() > Level.SEVERE.intValue()) return; - trace(Level.SEVERE, pMsg, pEx); - } - - private static boolean hasMatch(Pattern[] pPatterns, String pStr) { - if (pPatterns == null) return false; - for (int i = 0; i < pPatterns.length; i++) { - Pattern pattern = pPatterns[i]; - Matcher m = pattern.matcher(pStr); - if (m.matches()) return true; - } - return false; - } - - private static boolean deny(String pFnStr) { - return hasMatch(cDenyPatterns, pFnStr); - } - - private static boolean allow(String pFnStr) { - return hasMatch(cAllowPatterns, pFnStr); - } - - private static void trace(Level pLevel, String pMsg, Exception pEx) { - StackTraceElement location = getLocation(); - String fnStr = getFunctionStr(location); - if (deny(fnStr) && !allow(fnStr)) return; - StringBuffer buf = new StringBuffer('[' + pLevel.toString() + ' ' - + Thread.currentThread().getName() + ' ' + getDate() + ' ' - + getLocationStr(location) + "]\n"); - if (pMsg != null) buf.append(pMsg + '\n'); - if (pEx != null) { - StringWriter writer = new StringWriter(); - pEx.printStackTrace(new PrintWriter(writer)); - buf.append(writer.toString() + '\n'); - } - synchronized (TRC.class) { - if (cOut != null) { - cOut.println(buf.toString()); - System.out.flush(); - } else { - cLogger.trace(pLevel, buf.toString()); - } - } - } - - private static StackTraceElement getLocation() { - Throwable thr = new Throwable(); - StackTraceElement[] elements = thr.getStackTrace(); - StackTraceElement e = null; - for (int i = 0; i < elements.length; i++) { - e = elements[i]; - if (!e.getClassName().equals(NAME)) return e; - } - return null; - } - - private static String getFunctionStr(StackTraceElement pSTE) { - return pSTE.getClassName() + '.' + pSTE.getMethodName(); - } - - private static String getLocationStr(StackTraceElement pSTE) { - return getFunctionStr(pSTE) + '(' + pSTE.getFileName() + ':' + pSTE.getLineNumber() + ')'; - } - - private static String pad(int pDigits, int pNum) { - String str = Integer.toString(pNum); - int len = Math.max(pDigits, str.length()); - char[] cA = new char[len]; - int paddingDigits = pDigits - str.length(); - int dIdx = 0; - while (dIdx < paddingDigits) - cA[dIdx++] = '0'; - int sIdx = 0; - while (dIdx < len) - cA[dIdx++] = str.charAt(sIdx++); - return new String(cA); - } - - /** - * getDate - * - * @return String - */ - private static String getDate() { - long millis = new Date().getTime(); - Calendar cal = Calendar.getInstance(); - cal.setTimeInMillis(millis); - return Integer.toString(cal.get(Calendar.YEAR)) + '.' + pad(2, cal.get(Calendar.MONTH) + 1) - + '.' + pad(2, cal.get(Calendar.DAY_OF_MONTH)) + ' ' - + pad(2, cal.get(Calendar.HOUR_OF_DAY)) + ':' + pad(2, cal.get(Calendar.MINUTE)) - + ':' + pad(2, cal.get(Calendar.SECOND)) + ' ' - + pad(3, cal.get(Calendar.MILLISECOND)); - } - -} +/* + (C) Copyright IBM Corp. 2007, 2011 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, IBM, ebak@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1804402 2007-09-28 ebak IPv6 ready SLP + * 1892103 2008-02-12 ebak SLP improvements + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 3400209 2011-08-31 blaschke-oss Highlighted Static Analysis (PMD) issues + */ + +package org.metricshub.wbem.sblim.slp.internal; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.OutputStream; +import java.io.PrintStream; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.Calendar; +import java.util.Date; +import java.util.logging.Level; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.metricshub.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; + +/** + * debug -> FINEST info -> INFO warning -> WARNING error -> SEVERE + * + */ +public class TRC { + + private static PrintStream cOut; + + private static Level cLevel = SLPConfig.getGlobalCfg().getTraceLevel(); + + private static LogAndTraceBroker cLogger = LogAndTraceBroker.getBroker(); + + private static Pattern[] cDenyPatterns; + + private static Pattern[] cAllowPatterns; + + private static final String NAME = new TRC().getClass().getName(); + + /** + * setLevel + * + * @param pLevel + */ + public static void setLevel(Level pLevel) { + cLevel = pLevel; + } + + /** + * setConsolLog + * + * @param pOutStr + */ + public static void setOutput(OutputStream pOutStr) { + setOutput(new PrintStream(pOutStr)); + } + + /** + * setOutputStream + * + * @param pOutStr + */ + public static void setOutput(PrintStream pOutStr) { + cOut = pOutStr; + } + + /** + * setPatterns + * + * @param pDenyPatterns + * @param pAllowPatterns + */ + public static void setPatterns(String[] pDenyPatterns, String[] pAllowPatterns) { + cDenyPatterns = compile(pDenyPatterns); + cAllowPatterns = compile(pAllowPatterns); + } + + private static Pattern[] compile(String[] pStrs) { + if (pStrs == null) return null; + Pattern[] patterns = new Pattern[pStrs.length]; + for (int i = 0; i < patterns.length; i++) { + patterns[i] = Pattern.compile(pStrs[i]); + } + return patterns; + } + + /** + * debug + * + * @param pMsg + */ + public static void debug(String pMsg) { + debug(pMsg, null); + } + + /** + * debug + * + * @param pMsg + * @param pEx + */ + public static void debug(String pMsg, Exception pEx) { + if (cLevel.intValue() > Level.FINEST.intValue()) return; + trace(Level.FINEST, pMsg, pEx); + } + + /** + * info + * + * @param pMsg + */ + public static void info(String pMsg) { + info(pMsg, null); + } + + /** + * info + * + * @param pMsg + * @param pEx + */ + public static void info(String pMsg, Exception pEx) { + if (cLevel.intValue() > Level.INFO.intValue()) return; + trace(Level.INFO, pMsg, pEx); + } + + /** + * warning + * + * @param pMsg + */ + public static void warning(String pMsg) { + warning(pMsg, null); + } + + /** + * warning + * + * @param pMsg + * @param pEx + */ + public static void warning(String pMsg, Exception pEx) { + if (cLevel.intValue() > Level.WARNING.intValue()) return; + trace(Level.WARNING, pMsg, pEx); + } + + /** + * error + * + * @param pMsg + */ + public static void error(String pMsg) { + error(pMsg, null); + } + + /** + * error + * + * @param pEx + */ + public static void error(Exception pEx) { + error(null, pEx); + } + + /** + * error + * + * @param pMsg + * @param pEx + */ + public static void error(String pMsg, Exception pEx) { + if (cLevel.intValue() > Level.SEVERE.intValue()) return; + trace(Level.SEVERE, pMsg, pEx); + } + + private static boolean hasMatch(Pattern[] pPatterns, String pStr) { + if (pPatterns == null) return false; + for (int i = 0; i < pPatterns.length; i++) { + Pattern pattern = pPatterns[i]; + Matcher m = pattern.matcher(pStr); + if (m.matches()) return true; + } + return false; + } + + private static boolean deny(String pFnStr) { + return hasMatch(cDenyPatterns, pFnStr); + } + + private static boolean allow(String pFnStr) { + return hasMatch(cAllowPatterns, pFnStr); + } + + private static void trace(Level pLevel, String pMsg, Exception pEx) { + StackTraceElement location = getLocation(); + String fnStr = getFunctionStr(location); + if (deny(fnStr) && !allow(fnStr)) return; + StringBuffer buf = new StringBuffer('[' + pLevel.toString() + ' ' + + Thread.currentThread().getName() + ' ' + getDate() + ' ' + + getLocationStr(location) + "]\n"); + if (pMsg != null) buf.append(pMsg + '\n'); + if (pEx != null) { + StringWriter writer = new StringWriter(); + pEx.printStackTrace(new PrintWriter(writer)); + buf.append(writer.toString() + '\n'); + } + synchronized (TRC.class) { + if (cOut != null) { + cOut.println(buf.toString()); + System.out.flush(); + } else { + cLogger.trace(pLevel, buf.toString()); + } + } + } + + private static StackTraceElement getLocation() { + Throwable thr = new Throwable(); + StackTraceElement[] elements = thr.getStackTrace(); + StackTraceElement e = null; + for (int i = 0; i < elements.length; i++) { + e = elements[i]; + if (!e.getClassName().equals(NAME)) return e; + } + return null; + } + + private static String getFunctionStr(StackTraceElement pSTE) { + return pSTE.getClassName() + '.' + pSTE.getMethodName(); + } + + private static String getLocationStr(StackTraceElement pSTE) { + return getFunctionStr(pSTE) + '(' + pSTE.getFileName() + ':' + pSTE.getLineNumber() + ')'; + } + + private static String pad(int pDigits, int pNum) { + String str = Integer.toString(pNum); + int len = Math.max(pDigits, str.length()); + char[] cA = new char[len]; + int paddingDigits = pDigits - str.length(); + int dIdx = 0; + while (dIdx < paddingDigits) + cA[dIdx++] = '0'; + int sIdx = 0; + while (dIdx < len) + cA[dIdx++] = str.charAt(sIdx++); + return new String(cA); + } + + /** + * getDate + * + * @return String + */ + private static String getDate() { + long millis = new Date().getTime(); + Calendar cal = Calendar.getInstance(); + cal.setTimeInMillis(millis); + return Integer.toString(cal.get(Calendar.YEAR)) + '.' + pad(2, cal.get(Calendar.MONTH) + 1) + + '.' + pad(2, cal.get(Calendar.DAY_OF_MONTH)) + ' ' + + pad(2, cal.get(Calendar.HOUR_OF_DAY)) + ':' + pad(2, cal.get(Calendar.MINUTE)) + + ':' + pad(2, cal.get(Calendar.SECOND)) + ' ' + + pad(3, cal.get(Calendar.MILLISECOND)); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/AttributeReply.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/AttributeReply.java similarity index 78% rename from src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/AttributeReply.java rename to src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/AttributeReply.java index a0604f0..4f9fc21 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/AttributeReply.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/AttributeReply.java @@ -1,153 +1,151 @@ -/* - (C) Copyright IBM Corp. 2007, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, IBM, ebak@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1804402 2007-09-28 ebak IPv6 ready SLP - * 1892103 2008-02-12 ebak SLP improvements - * 1949918 2008-04-08 raman_arora Malformed service URL crashes SLP discovery - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - */ - -package org.sentrysoftware.wbem.sblim.slp.internal.msg; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.IOException; -import java.util.Iterator; -import java.util.List; - -import org.sentrysoftware.wbem.sblim.slp.ServiceLocationAttribute; -import org.sentrysoftware.wbem.sblim.slp.ServiceLocationException; -import org.sentrysoftware.wbem.sblim.slp.internal.TRC; - -/* - * 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Service - * Location header (function = AttrRply = 7) | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Error - * Code | length of | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | - * \ - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |# of - * AttrAuths | Attribute Authentication Block (if present) \ - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * - */ - -/** - * AttributeReply message - * - */ -public class AttributeReply extends ReplyMessage { - - private List iAttrList; - - /** - * parse - * - * @param pHdr - * @param pInStr - * @return SLPMessage - * @throws ServiceLocationException - * @throws IOException - */ - public static SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) - throws ServiceLocationException, IOException { - AttributeReply reply = new AttributeReply(pHdr, pInStr.read16(), pInStr.readAttributeList()); - if (pInStr.readAuthBlockList() != null) TRC.warning("Non empty auth block!"); - return reply; - } - - /** - * Ctor. - * - * @param pErrorCode - * @param pAttrList - * - list of ServiceLocationAttributes - */ - public AttributeReply(int pErrorCode, List pAttrList) { - super(ATTR_RPLY, pErrorCode); - this.iAttrList = pAttrList; - } - - /** - * Ctor. - * - * @param pLangTag - * @param pErrorCode - * @param pAttrList - * - list of ServiceLocationAttributes - */ - public AttributeReply(String pLangTag, int pErrorCode, List pAttrList) { - super(ATTR_RPLY, pLangTag, pErrorCode); - this.iAttrList = pAttrList; - } - - /** - * Ctor. - * - * @param pHeader - * @param pErrorCode - * @param pAttrList - * - list of ServiceLocationAttributes - */ - public AttributeReply(MsgHeader pHeader, int pErrorCode, - List pAttrList) { - super(pHeader, pErrorCode); - this.iAttrList = pAttrList; - } - - @Override - public Iterator getResultIterator() { - return this.iAttrList == null ? null : this.iAttrList.iterator(); - } - - /** - * @param pOption - */ - @Override - protected boolean serializeBody(SLPOutputStream pOutStr, SerializeOption pOption) { - return pOutStr.write16(getErrorCode()) && pOutStr.writeAttributeList(this.iAttrList) - && pOutStr.writeAuthBlockList(null); - } - - @Override - public Iterator getExceptionIterator() { - // this message doesn't have exception table - return null; - } - -} +/* + (C) Copyright IBM Corp. 2007, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, IBM, ebak@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1804402 2007-09-28 ebak IPv6 ready SLP + * 1892103 2008-02-12 ebak SLP improvements + * 1949918 2008-04-08 raman_arora Malformed service URL crashes SLP discovery + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + */ + +package org.metricshub.wbem.sblim.slp.internal.msg; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.IOException; +import java.util.Iterator; +import java.util.List; + +import org.metricshub.wbem.sblim.slp.ServiceLocationAttribute; +import org.metricshub.wbem.sblim.slp.internal.TRC; +import org.metricshub.wbem.sblim.slp.ServiceLocationException; + +/* + * 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Service + * Location header (function = AttrRply = 7) | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Error + * Code | length of | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | + * \ + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |# of + * AttrAuths | Attribute Authentication Block (if present) \ + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * + */ + +/** + * AttributeReply message + * + */ +public class AttributeReply extends ReplyMessage { + + private List iAttrList; + + /** + * parse + * + * @param pHdr + * @param pInStr + * @return SLPMessage + * @throws ServiceLocationException + * @throws IOException + */ + public static SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) + throws ServiceLocationException, IOException { + AttributeReply reply = new AttributeReply(pHdr, pInStr.read16(), pInStr.readAttributeList()); + if (pInStr.readAuthBlockList() != null) TRC.warning("Non empty auth block!"); + return reply; + } + + /** + * Ctor. + * + * @param pErrorCode + * @param pAttrList + * - list of ServiceLocationAttributes + */ + public AttributeReply(int pErrorCode, List pAttrList) { + super(ATTR_RPLY, pErrorCode); + this.iAttrList = pAttrList; + } + + /** + * Ctor. + * + * @param pLangTag + * @param pErrorCode + * @param pAttrList + * - list of ServiceLocationAttributes + */ + public AttributeReply(String pLangTag, int pErrorCode, List pAttrList) { + super(ATTR_RPLY, pLangTag, pErrorCode); + this.iAttrList = pAttrList; + } + + /** + * Ctor. + * + * @param pHeader + * @param pErrorCode + * @param pAttrList + * - list of ServiceLocationAttributes + */ + public AttributeReply(MsgHeader pHeader, int pErrorCode, + List pAttrList) { + super(pHeader, pErrorCode); + this.iAttrList = pAttrList; + } + + @Override + public Iterator getResultIterator() { + return this.iAttrList == null ? null : this.iAttrList.iterator(); + } + + /** + * @param pOption + */ + @Override + protected boolean serializeBody(SLPOutputStream pOutStr, SerializeOption pOption) { + return pOutStr.write16(getErrorCode()) && pOutStr.writeAttributeList(this.iAttrList) + && pOutStr.writeAuthBlockList(null); + } + + @Override + public Iterator getExceptionIterator() { + // this message doesn't have exception table + return null; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/AttributeRequest.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/AttributeRequest.java similarity index 82% rename from src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/AttributeRequest.java rename to src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/AttributeRequest.java index 448bdb0..2e890ac 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/AttributeRequest.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/AttributeRequest.java @@ -1,178 +1,176 @@ -/* - (C) Copyright IBM Corp. 2007, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, IBM, ebak@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1804402 2007-09-28 ebak IPv6 ready SLP - * 1892103 2008-02-15 ebak SLP improvements - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - */ - -package org.sentrysoftware.wbem.sblim.slp.internal.msg; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.IOException; -import java.util.List; -import java.util.SortedSet; - -import org.sentrysoftware.wbem.sblim.slp.ServiceLocationException; -import org.sentrysoftware.wbem.sblim.slp.ServiceURL; - -/* - * 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Service - * Location header (function = AttrRqst = 6) | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | length of - * PRList | String \ - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | length of - * URL | URL \ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | - * length of | string \ - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | length of - * string | string \ - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | length of - * string | string \ - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - */ - -/** - * AttributeRequest message - * - */ -public class AttributeRequest extends RequestMessage { - - private String iURLStr; - - private List iTagList; - - private List iSPIList; - - private static final int[] ALLOWED_RSPS = { ATTR_RPLY }; - - /** - * parse - * - * @param pHdr - * @param pInStr - * @return SLPMessage - * @throws ServiceLocationException - * @throws IOException - */ - public static SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) - throws ServiceLocationException, IOException { - return new AttributeRequest(pHdr, pInStr.readStringSet(), pInStr.readString(), pInStr - .readStringList(), pInStr.readStringList(), pInStr.readStringList()); - } - - /** - * Ctor. - * - * @param pPrevResponderSet - * - set of address strings - * @param pURLStr - * @param pScopeList - * - list of scope strings - * @param pTagList - * @param pSPIList - */ - public AttributeRequest(SortedSet pPrevResponderSet, String pURLStr, - List pScopeList, List pTagList, List pSPIList) { - super(ATTR_RQST, pPrevResponderSet, pScopeList); - init(pURLStr, pTagList, pSPIList); - } - - /** - * Ctor. - * - * @param pLangTag - * @param pPrevResponderSet - * - set of address strings - * @param pURLStr - * @param pScopeList - * - list of scope strings - * @param pTagList - * @param pSPIList - */ - public AttributeRequest(String pLangTag, SortedSet pPrevResponderSet, String pURLStr, - List pScopeList, List pTagList, List pSPIList) { - super(ATTR_RQST, pLangTag, pPrevResponderSet, pScopeList); - init(pURLStr, pTagList, pSPIList); - } - - /** - * Ctor. - * - * @param pHeader - * @param pPrevResponderSet - * - set of address strings - * @param pURLStr - * @param pScopeList - * - list of scope strings - * @param pTagList - * @param pSPIList - */ - public AttributeRequest(MsgHeader pHeader, SortedSet pPrevResponderSet, String pURLStr, - List pScopeList, List pTagList, List pSPIList) { - super(pHeader, pPrevResponderSet, pScopeList); - init(pURLStr, pTagList, pSPIList); - } - - /** - * getServiceURL - * - * @return ServiceURL - */ - public ServiceURL getServiceURL() { - return new ServiceURL(this.iURLStr, 65535); - } - - @Override - protected boolean serializeRequestBody(SLPOutputStream pOutStr) { - return pOutStr.write(this.iURLStr) && pOutStr.writeStringList(getScopeList()) - && pOutStr.writeStringList(this.iTagList) && pOutStr.writeStringList(this.iSPIList); - } - - @Override - protected int[] getAllowedResponseIDs() { - return ALLOWED_RSPS; - } - - private void init(String pURLStr, List pTagList, List pSPIList) { - this.iURLStr = pURLStr; - this.iTagList = pTagList; - this.iSPIList = pSPIList; - } - -} +/* + (C) Copyright IBM Corp. 2007, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, IBM, ebak@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1804402 2007-09-28 ebak IPv6 ready SLP + * 1892103 2008-02-15 ebak SLP improvements + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + */ + +package org.metricshub.wbem.sblim.slp.internal.msg; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.IOException; +import java.util.List; +import java.util.SortedSet; + +import org.metricshub.wbem.sblim.slp.ServiceURL; +import org.metricshub.wbem.sblim.slp.ServiceLocationException; + +/* + * 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Service + * Location header (function = AttrRqst = 6) | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | length of + * PRList | String \ + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | length of + * URL | URL \ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | + * length of | string \ + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | length of + * string | string \ + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | length of + * string | string \ + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + */ + +/** + * AttributeRequest message + * + */ +public class AttributeRequest extends RequestMessage { + + private String iURLStr; + + private List iTagList; + + private List iSPIList; + + private static final int[] ALLOWED_RSPS = { ATTR_RPLY }; + + /** + * parse + * + * @param pHdr + * @param pInStr + * @return SLPMessage + * @throws ServiceLocationException + * @throws IOException + */ + public static SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) + throws ServiceLocationException, IOException { + return new AttributeRequest(pHdr, pInStr.readStringSet(), pInStr.readString(), pInStr + .readStringList(), pInStr.readStringList(), pInStr.readStringList()); + } + + /** + * Ctor. + * + * @param pPrevResponderSet + * - set of address strings + * @param pURLStr + * @param pScopeList + * - list of scope strings + * @param pTagList + * @param pSPIList + */ + public AttributeRequest(SortedSet pPrevResponderSet, String pURLStr, + List pScopeList, List pTagList, List pSPIList) { + super(ATTR_RQST, pPrevResponderSet, pScopeList); + init(pURLStr, pTagList, pSPIList); + } + + /** + * Ctor. + * + * @param pLangTag + * @param pPrevResponderSet + * - set of address strings + * @param pURLStr + * @param pScopeList + * - list of scope strings + * @param pTagList + * @param pSPIList + */ + public AttributeRequest(String pLangTag, SortedSet pPrevResponderSet, String pURLStr, + List pScopeList, List pTagList, List pSPIList) { + super(ATTR_RQST, pLangTag, pPrevResponderSet, pScopeList); + init(pURLStr, pTagList, pSPIList); + } + + /** + * Ctor. + * + * @param pHeader + * @param pPrevResponderSet + * - set of address strings + * @param pURLStr + * @param pScopeList + * - list of scope strings + * @param pTagList + * @param pSPIList + */ + public AttributeRequest(MsgHeader pHeader, SortedSet pPrevResponderSet, String pURLStr, + List pScopeList, List pTagList, List pSPIList) { + super(pHeader, pPrevResponderSet, pScopeList); + init(pURLStr, pTagList, pSPIList); + } + + /** + * getServiceURL + * + * @return ServiceURL + */ + public ServiceURL getServiceURL() { + return new ServiceURL(this.iURLStr, 65535); + } + + @Override + protected boolean serializeRequestBody(SLPOutputStream pOutStr) { + return pOutStr.write(this.iURLStr) && pOutStr.writeStringList(getScopeList()) + && pOutStr.writeStringList(this.iTagList) && pOutStr.writeStringList(this.iSPIList); + } + + @Override + protected int[] getAllowedResponseIDs() { + return ALLOWED_RSPS; + } + + private void init(String pURLStr, List pTagList, List pSPIList) { + this.iURLStr = pURLStr; + this.iTagList = pTagList; + this.iSPIList = pSPIList; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/DAAdvert.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/DAAdvert.java similarity index 84% rename from src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/DAAdvert.java rename to src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/DAAdvert.java index 34e5cd4..122977d 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/DAAdvert.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/DAAdvert.java @@ -1,203 +1,201 @@ -/* - (C) Copyright IBM Corp. 2007, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, IBM, ebak@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1804402 2007-09-28 ebak IPv6 ready SLP - * 1892103 2008-02-12 ebak SLP improvements - * 1949918 2008-04-08 raman_arora Malformed service URL crashes SLP discovery - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - */ - -package org.sentrysoftware.wbem.sblim.slp.internal.msg; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.TreeSet; - -import org.sentrysoftware.wbem.sblim.slp.ServiceLocationAttribute; -import org.sentrysoftware.wbem.sblim.slp.ServiceLocationException; - -/* - * 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Service - * Location header (function = DAAdvert = 8) | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Error - * Code | DA Stateless Boot Timestamp | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |DA - * Stateless Boot Time,, contd.| Length of URL | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ \ URL \ - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Length of - * | \ - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Length of - * | \ - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Length of - * | String \ - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | # Auth - * Blocks | Authentication block (if any) \ - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ FIXME: is - * this URL an URL-entry or an URL String. Assuming URL String. - */ - -/** - * DAAdvert message - * - */ -public class DAAdvert extends ReplyMessage { - - private long iStatelessBootTime; - - private String iURLStr; - - private List iScopeList; - - private List iAttrList; - - private List iSPIList; - - /** - * parse - * - * @param pHdr - * @param pInStr - * @return SLPMessage - * @throws ServiceLocationException - * @throws IOException - */ - public static SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) - throws ServiceLocationException, IOException { - return new DAAdvert(pHdr, pInStr.read16(), pInStr.read32(), pInStr.readString(), pInStr - .readStringList(), pInStr.readAttributeList(), pInStr.readStringList()); - } - - /** - * Ctor. - * - * @param pErrorCode - * @param pStatelessBootTime - * @param pURLStr - * @param pScopeList - * - list of scope strings - * @param pAttrList - * - list of ServiceLocationAttributes - * @param pSPIList - */ - public DAAdvert(int pErrorCode, long pStatelessBootTime, String pURLStr, - List pScopeList, List pAttrList, List pSPIList) { - super(DA_ADVERT, pErrorCode); - init(pStatelessBootTime, pURLStr, pScopeList, pAttrList, pSPIList); - } - - /** - * Ctor. - * - * @param pLangTag - * @param pErrorCode - * @param pStatelessBootTime - * @param pURLStr - * @param pScopeList - * - list of scope strings - * @param pAttrList - * - list of ServiceLocationAttributes - * @param pSPIList - */ - public DAAdvert(String pLangTag, int pErrorCode, long pStatelessBootTime, String pURLStr, - List pScopeList, List pAttrList, List pSPIList) { - super(DA_ADVERT, pLangTag, pErrorCode); - init(pStatelessBootTime, pURLStr, pScopeList, pAttrList, pSPIList); - } - - /** - * Ctor. - * - * @param pHeader - * @param pErrorCode - * @param pStatelessBootTime - * @param pURLStr - * @param pScopeList - * - list of scope strings - * @param pAttrList - * - list of ServiceLocationAttributes - * @param pSPIList - */ - public DAAdvert(MsgHeader pHeader, int pErrorCode, long pStatelessBootTime, String pURLStr, - List pScopeList, List pAttrList, List pSPIList) { - super(pHeader, pErrorCode); - init(pStatelessBootTime, pURLStr, pScopeList, pAttrList, pSPIList); - } - - /** - * @return Iterator of DADescriptors - * @see ReplyMessage#getResultIterator() - */ - @Override - public Iterator getResultIterator() { - ArrayList list = new ArrayList(1); - list.add(new DADescriptor(this.iURLStr, new TreeSet(this.iScopeList), - this.iAttrList)); - return list.iterator(); - } - - /** - * @param pOption - */ - @Override - protected boolean serializeBody(SLPOutputStream pOutStr, SerializeOption pOption) { - return pOutStr.write16(getErrorCode()) && pOutStr.write32(this.iStatelessBootTime) - && pOutStr.write(this.iURLStr) && pOutStr.writeStringList(this.iScopeList) - && pOutStr.writeAttributeList(this.iAttrList) - && pOutStr.writeStringList(this.iSPIList); - } - - private void init(long pStatelessBootTime, String pURLStr, List pScopeList, - List pAttrList, List pSPIList) { - this.iStatelessBootTime = pStatelessBootTime; - this.iURLStr = pURLStr; - this.iScopeList = pScopeList; - this.iAttrList = pAttrList; - this.iSPIList = pSPIList; - } - - @Override - public Iterator getExceptionIterator() { - // this message doesn't have exception table - return null; - } - -} +/* + (C) Copyright IBM Corp. 2007, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, IBM, ebak@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1804402 2007-09-28 ebak IPv6 ready SLP + * 1892103 2008-02-12 ebak SLP improvements + * 1949918 2008-04-08 raman_arora Malformed service URL crashes SLP discovery + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + */ + +package org.metricshub.wbem.sblim.slp.internal.msg; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.TreeSet; + +import org.metricshub.wbem.sblim.slp.ServiceLocationAttribute; +import org.metricshub.wbem.sblim.slp.ServiceLocationException; + +/* + * 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Service + * Location header (function = DAAdvert = 8) | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Error + * Code | DA Stateless Boot Timestamp | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |DA + * Stateless Boot Time,, contd.| Length of URL | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ \ URL \ + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Length of + * | \ + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Length of + * | \ + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Length of + * | String \ + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | # Auth + * Blocks | Authentication block (if any) \ + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ FIXME: is + * this URL an URL-entry or an URL String. Assuming URL String. + */ + +/** + * DAAdvert message + * + */ +public class DAAdvert extends ReplyMessage { + + private long iStatelessBootTime; + + private String iURLStr; + + private List iScopeList; + + private List iAttrList; + + private List iSPIList; + + /** + * parse + * + * @param pHdr + * @param pInStr + * @return SLPMessage + * @throws ServiceLocationException + * @throws IOException + */ + public static SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) + throws ServiceLocationException, IOException { + return new DAAdvert(pHdr, pInStr.read16(), pInStr.read32(), pInStr.readString(), pInStr + .readStringList(), pInStr.readAttributeList(), pInStr.readStringList()); + } + + /** + * Ctor. + * + * @param pErrorCode + * @param pStatelessBootTime + * @param pURLStr + * @param pScopeList + * - list of scope strings + * @param pAttrList + * - list of ServiceLocationAttributes + * @param pSPIList + */ + public DAAdvert(int pErrorCode, long pStatelessBootTime, String pURLStr, + List pScopeList, List pAttrList, List pSPIList) { + super(DA_ADVERT, pErrorCode); + init(pStatelessBootTime, pURLStr, pScopeList, pAttrList, pSPIList); + } + + /** + * Ctor. + * + * @param pLangTag + * @param pErrorCode + * @param pStatelessBootTime + * @param pURLStr + * @param pScopeList + * - list of scope strings + * @param pAttrList + * - list of ServiceLocationAttributes + * @param pSPIList + */ + public DAAdvert(String pLangTag, int pErrorCode, long pStatelessBootTime, String pURLStr, + List pScopeList, List pAttrList, List pSPIList) { + super(DA_ADVERT, pLangTag, pErrorCode); + init(pStatelessBootTime, pURLStr, pScopeList, pAttrList, pSPIList); + } + + /** + * Ctor. + * + * @param pHeader + * @param pErrorCode + * @param pStatelessBootTime + * @param pURLStr + * @param pScopeList + * - list of scope strings + * @param pAttrList + * - list of ServiceLocationAttributes + * @param pSPIList + */ + public DAAdvert(MsgHeader pHeader, int pErrorCode, long pStatelessBootTime, String pURLStr, + List pScopeList, List pAttrList, List pSPIList) { + super(pHeader, pErrorCode); + init(pStatelessBootTime, pURLStr, pScopeList, pAttrList, pSPIList); + } + + /** + * @return Iterator of DADescriptors + * @see ReplyMessage#getResultIterator() + */ + @Override + public Iterator getResultIterator() { + ArrayList list = new ArrayList(1); + list.add(new DADescriptor(this.iURLStr, new TreeSet(this.iScopeList), + this.iAttrList)); + return list.iterator(); + } + + /** + * @param pOption + */ + @Override + protected boolean serializeBody(SLPOutputStream pOutStr, SerializeOption pOption) { + return pOutStr.write16(getErrorCode()) && pOutStr.write32(this.iStatelessBootTime) + && pOutStr.write(this.iURLStr) && pOutStr.writeStringList(this.iScopeList) + && pOutStr.writeAttributeList(this.iAttrList) + && pOutStr.writeStringList(this.iSPIList); + } + + private void init(long pStatelessBootTime, String pURLStr, List pScopeList, + List pAttrList, List pSPIList) { + this.iStatelessBootTime = pStatelessBootTime; + this.iURLStr = pURLStr; + this.iScopeList = pScopeList; + this.iAttrList = pAttrList; + this.iSPIList = pSPIList; + } + + @Override + public Iterator getExceptionIterator() { + // this message doesn't have exception table + return null; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/DADescriptor.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/DADescriptor.java similarity index 79% rename from src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/DADescriptor.java rename to src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/DADescriptor.java index 3b44256..5587d71 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/DADescriptor.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/DADescriptor.java @@ -1,170 +1,168 @@ -/* - (C) Copyright IBM Corp. 2007, 2010 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, IBM, ebak@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1804402 2007-09-28 ebak IPv6 ready SLP - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2795671 2009-05-22 raman_arora Add Type to Comparable - * 3023135 2010-07-01 blaschke-oss DADescriptor equals/compareTo issue - */ - -package org.sentrysoftware.wbem.sblim.slp.internal.msg; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.Iterator; -import java.util.List; -import java.util.TreeSet; - -import org.sentrysoftware.wbem.sblim.slp.ServiceLocationAttribute; - -/** - *
      - * This class contains the DA related information from a DAAdvert message.
      - * URL
      - * Scope list
      - * Attribute list
      - * 
      - */ -public class DADescriptor implements Comparable { - - private String iURL; - - private TreeSet iScopeSet; - - private List iAttributes; - - /** - * Ctor. - * - * @param pURL - * @param pScopeSet - * - set of scope Strings - * @param pAttributes - * - set of ServiceLocationAttributes - */ - public DADescriptor(String pURL, TreeSet pScopeSet, - List pAttributes) { - this.iURL = pURL; - this.iScopeSet = pScopeSet; - this.iAttributes = pAttributes; - } - - /** - * getURL - * - * @return String - */ - public String getURL() { - return this.iURL; - } - - /** - * hasScope - * - * @param pScope - * @return boolean - */ - public boolean hasScope(String pScope) { - if (this.iScopeSet == null) return false; - return this.iScopeSet.contains(pScope); - } - - public int compareTo(DADescriptor o) { - DADescriptor that = o; - return this.iURL.compareTo(that.iURL); - } - - @Override - public boolean equals(Object pObj) { - if (!(pObj instanceof DADescriptor)) return false; - DADescriptor that = (DADescriptor) pObj; - return this.iURL.equals(that.iURL); - } - - private int iHashCode = 0; - - private void incHashCode(int pHashCode) { - this.iHashCode *= 31; - this.iHashCode += pHashCode; - } - - /* - * hashCode has to be independent of the order of scopes and attributes - * (non-Javadoc) - * - * @see java.lang.Object#hashCode() - */ - @Override - public int hashCode() { - if (this.iHashCode == 0) { - this.iHashCode = this.iURL.hashCode(); - Iterator itr; - if (this.iScopeSet != null) { - itr = this.iScopeSet.iterator(); - while (itr.hasNext()) - incHashCode(itr.next().hashCode()); - } - if (this.iAttributes != null) { - itr = this.iAttributes.iterator(); - /* - * iHasCode is simply incremented, because attribute order - * mustn't be considered. - */ - while (itr.hasNext()) - this.iHashCode += itr.next().hashCode(); - } - } - return this.iHashCode; - } - - @Override - public String toString() { - StringBuffer strBuf = new StringBuffer("URL : " + this.iURL + "\nScopes : "); - if (this.iScopeSet != null) { - Iterator itr = this.iScopeSet.iterator(); - boolean more = false; - while (itr.hasNext()) { - if (more) strBuf.append(", "); - else more = true; - strBuf.append(itr.next()); - } - } - - return strBuf.toString(); - } - -} +/* + (C) Copyright IBM Corp. 2007, 2010 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, IBM, ebak@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1804402 2007-09-28 ebak IPv6 ready SLP + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2795671 2009-05-22 raman_arora Add Type to Comparable + * 3023135 2010-07-01 blaschke-oss DADescriptor equals/compareTo issue + */ + +package org.metricshub.wbem.sblim.slp.internal.msg; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.Iterator; +import java.util.List; +import java.util.TreeSet; + +import org.metricshub.wbem.sblim.slp.ServiceLocationAttribute; + +/** + *
      + * This class contains the DA related information from a DAAdvert message.
      + * URL
      + * Scope list
      + * Attribute list
      + * 
      + */ +public class DADescriptor implements Comparable { + + private String iURL; + + private TreeSet iScopeSet; + + private List iAttributes; + + /** + * Ctor. + * + * @param pURL + * @param pScopeSet + * - set of scope Strings + * @param pAttributes + * - set of ServiceLocationAttributes + */ + public DADescriptor(String pURL, TreeSet pScopeSet, + List pAttributes) { + this.iURL = pURL; + this.iScopeSet = pScopeSet; + this.iAttributes = pAttributes; + } + + /** + * getURL + * + * @return String + */ + public String getURL() { + return this.iURL; + } + + /** + * hasScope + * + * @param pScope + * @return boolean + */ + public boolean hasScope(String pScope) { + if (this.iScopeSet == null) return false; + return this.iScopeSet.contains(pScope); + } + + public int compareTo(DADescriptor o) { + DADescriptor that = o; + return this.iURL.compareTo(that.iURL); + } + + @Override + public boolean equals(Object pObj) { + if (!(pObj instanceof DADescriptor)) return false; + DADescriptor that = (DADescriptor) pObj; + return this.iURL.equals(that.iURL); + } + + private int iHashCode = 0; + + private void incHashCode(int pHashCode) { + this.iHashCode *= 31; + this.iHashCode += pHashCode; + } + + /* + * hashCode has to be independent of the order of scopes and attributes + * (non-Javadoc) + * + * @see java.lang.Object#hashCode() + */ + @Override + public int hashCode() { + if (this.iHashCode == 0) { + this.iHashCode = this.iURL.hashCode(); + Iterator itr; + if (this.iScopeSet != null) { + itr = this.iScopeSet.iterator(); + while (itr.hasNext()) + incHashCode(itr.next().hashCode()); + } + if (this.iAttributes != null) { + itr = this.iAttributes.iterator(); + /* + * iHasCode is simply incremented, because attribute order + * mustn't be considered. + */ + while (itr.hasNext()) + this.iHashCode += itr.next().hashCode(); + } + } + return this.iHashCode; + } + + @Override + public String toString() { + StringBuffer strBuf = new StringBuffer("URL : " + this.iURL + "\nScopes : "); + if (this.iScopeSet != null) { + Iterator itr = this.iScopeSet.iterator(); + boolean more = false; + while (itr.hasNext()) { + if (more) strBuf.append(", "); + else more = true; + strBuf.append(itr.next()); + } + } + + return strBuf.toString(); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/FunctionIDs.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/FunctionIDs.java similarity index 69% rename from src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/FunctionIDs.java rename to src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/FunctionIDs.java index 355a2a4..b60609a 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/FunctionIDs.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/FunctionIDs.java @@ -1,115 +1,113 @@ -/* - (C) Copyright IBM Corp. 2007, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, IBM, ebak@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1804402 2007-09-28 ebak IPv6 ready SLP - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.slp.internal.msg; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -/** - * FunctionIDs - */ -public interface FunctionIDs { - - /** - * SRV_RQST - */ - public static final int SRV_RQST = 1; - - /** - * SRV_RPLY - */ - public static final int SRV_RPLY = 2; - - /** - * SRV_REG - */ - public static final int SRV_REG = 3; - - /** - * SRV_DEREG - */ - public static final int SRV_DEREG = 4; - - /** - * SRV_ACK - */ - public static final int SRV_ACK = 5; - - /** - * ATTR_RQST - */ - public static final int ATTR_RQST = 6; - - /** - * ATTR_RPLY - */ - public static final int ATTR_RPLY = 7; - - /** - * DA_ADVERT - */ - public static final int DA_ADVERT = 8; - - /** - * SRV_TYPE_RQST - */ - public static final int SRV_TYPE_RQST = 9; - - /** - * SRV_TYPE_RPLY - */ - public static final int SRV_TYPE_RPLY = 10; - - /** - * SA_ADVERT - */ - public static final int SA_ADVERT = 11; - - /** - * FIRST_ID - */ - public static final int FIRST_ID = SRV_RQST; - - /** - * LAST_ID - */ - public static final int LAST_ID = SA_ADVERT; - -} +/* + (C) Copyright IBM Corp. 2007, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, IBM, ebak@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1804402 2007-09-28 ebak IPv6 ready SLP + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.slp.internal.msg; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +/** + * FunctionIDs + */ +public interface FunctionIDs { + + /** + * SRV_RQST + */ + public static final int SRV_RQST = 1; + + /** + * SRV_RPLY + */ + public static final int SRV_RPLY = 2; + + /** + * SRV_REG + */ + public static final int SRV_REG = 3; + + /** + * SRV_DEREG + */ + public static final int SRV_DEREG = 4; + + /** + * SRV_ACK + */ + public static final int SRV_ACK = 5; + + /** + * ATTR_RQST + */ + public static final int ATTR_RQST = 6; + + /** + * ATTR_RPLY + */ + public static final int ATTR_RPLY = 7; + + /** + * DA_ADVERT + */ + public static final int DA_ADVERT = 8; + + /** + * SRV_TYPE_RQST + */ + public static final int SRV_TYPE_RQST = 9; + + /** + * SRV_TYPE_RPLY + */ + public static final int SRV_TYPE_RPLY = 10; + + /** + * SA_ADVERT + */ + public static final int SA_ADVERT = 11; + + /** + * FIRST_ID + */ + public static final int FIRST_ID = SRV_RQST; + + /** + * LAST_ID + */ + public static final int LAST_ID = SA_ADVERT; + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/MsgFactory.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/MsgFactory.java similarity index 84% rename from src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/MsgFactory.java rename to src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/MsgFactory.java index 43483a8..b8c05df 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/MsgFactory.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/MsgFactory.java @@ -1,229 +1,227 @@ -/* - (C) Copyright IBM Corp. 2007, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, IBM, ebak@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1804402 2007-09-28 ebak IPv6 ready SLP - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.slp.internal.msg; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.IOException; -import java.io.InputStream; -import java.net.DatagramPacket; -import java.net.Socket; - -import org.sentrysoftware.wbem.sblim.slp.internal.msg.FunctionIDs; -import org.sentrysoftware.wbem.sblim.slp.ServiceLocationException; - -/** - * MsgFactory - * - */ -public class MsgFactory implements FunctionIDs { - - /** - * FactoryEntry - * - */ - private interface FactoryEntry { - - /** - * parse - * - * @param pHdr - * @param pInStr - * @return SLPMessage - * @throws ServiceLocationException - * @throws IOException - */ - public SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) - throws ServiceLocationException, IOException; - } - - private static FactoryEntry[] cFactoryArray; - - private static void placeFactory(int pFnID, FactoryEntry pEntry) { - cFactoryArray[pFnID - FIRST_ID] = pEntry; - } - - private static synchronized void createFactoryArray() { - if (cFactoryArray != null) return; - cFactoryArray = new FactoryEntry[LAST_ID - FIRST_ID + 1]; - for (int i = 0; i < cFactoryArray.length; i++) - cFactoryArray[i] = null; - placeFactory(ATTR_RPLY, new FactoryEntry() { - - public SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) - throws ServiceLocationException, IOException { - return AttributeReply.parse(pHdr, pInStr); - } - }); - placeFactory(ATTR_RQST, new FactoryEntry() { - - public SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) - throws ServiceLocationException, IOException { - return AttributeRequest.parse(pHdr, pInStr); - } - }); - placeFactory(DA_ADVERT, new FactoryEntry() { - - public SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) - throws ServiceLocationException, IOException { - return DAAdvert.parse(pHdr, pInStr); - } - }); - placeFactory(SA_ADVERT, new FactoryEntry() { - - public SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) - throws ServiceLocationException, IOException { - return SAAdvert.parse(pHdr, pInStr); - } - }); - placeFactory(SRV_ACK, new FactoryEntry() { - - public SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) - throws ServiceLocationException, IOException { - return ServiceAcknowledgment.parse(pHdr, pInStr); - } - }); - placeFactory(SRV_DEREG, new FactoryEntry() { - - public SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) - throws ServiceLocationException, IOException { - return ServiceDeregistration.parse(pHdr, pInStr); - } - }); - placeFactory(SRV_REG, new FactoryEntry() { - - public SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) - throws ServiceLocationException, IOException { - return ServiceRegistration.parse(pHdr, pInStr); - } - }); - placeFactory(SRV_RPLY, new FactoryEntry() { - - public SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) - throws ServiceLocationException, IOException { - return ServiceReply.parse(pHdr, pInStr); - } - }); - placeFactory(SRV_RQST, new FactoryEntry() { - - public SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) - throws ServiceLocationException, IOException { - return ServiceRequest.parse(pHdr, pInStr); - } - }); - // - placeFactory(SRV_TYPE_RPLY, new FactoryEntry() { - - public SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) - throws ServiceLocationException, IOException { - return ServiceTypeReply.parse(pHdr, pInStr); - } - }); - placeFactory(SRV_TYPE_RQST, new FactoryEntry() { - - public SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) - throws ServiceLocationException, IOException { - return ServiceTypeRequest.parse(pHdr, pInStr); - } - }); - } - - private static FactoryEntry getFactory(int pFnID) { - createFactoryArray(); - return cFactoryArray[pFnID - FIRST_ID]; - } - - /** - * parse - * - * @param pSock - * @return SLPMessage - * @throws ServiceLocationException - * @throws IOException - */ - public static SLPMessage parse(Socket pSock) throws ServiceLocationException, IOException { - return parse(pSock.getInputStream()); - } - - /** - * parse - * - * @param pInStr - * @return SLPMessage - * @throws ServiceLocationException - * @throws IOException - */ - public static SLPMessage parse(InputStream pInStr) throws ServiceLocationException, IOException { - return parse(new SLPInputStream(pInStr)); - } - - /** - * parse - * - * @param pPacket - * @return SLPMessage - * @throws ServiceLocationException - * @throws IOException - */ - public static SLPMessage parse(DatagramPacket pPacket) throws ServiceLocationException, - IOException { - return parse(new SLPInputStream(pPacket)); - } - - /** - * parse - * - * @param pInStr - * @return SLPMessage - * @throws ServiceLocationException - * @throws IOException - */ - public static SLPMessage parse(SLPInputStream pInStr) throws ServiceLocationException, - IOException { - MsgHeader hdr = MsgHeader.parse(pInStr); - FactoryEntry factory = getFactory(hdr.getFunctionID()); - if (factory == null) throw new ServiceLocationException( - ServiceLocationException.NOT_IMPLEMENTED, "FunctionID=" + hdr.getFunctionID() - + " is not implemented!"); - return factory.parse(hdr, pInStr); - } - -} +/* + (C) Copyright IBM Corp. 2007, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, IBM, ebak@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1804402 2007-09-28 ebak IPv6 ready SLP + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.slp.internal.msg; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.IOException; +import java.io.InputStream; +import java.net.DatagramPacket; +import java.net.Socket; + +import org.metricshub.wbem.sblim.slp.internal.msg.FunctionIDs; +import org.metricshub.wbem.sblim.slp.ServiceLocationException; + +/** + * MsgFactory + * + */ +public class MsgFactory implements FunctionIDs { + + /** + * FactoryEntry + * + */ + private interface FactoryEntry { + + /** + * parse + * + * @param pHdr + * @param pInStr + * @return SLPMessage + * @throws ServiceLocationException + * @throws IOException + */ + public SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) + throws ServiceLocationException, IOException; + } + + private static FactoryEntry[] cFactoryArray; + + private static void placeFactory(int pFnID, FactoryEntry pEntry) { + cFactoryArray[pFnID - FIRST_ID] = pEntry; + } + + private static synchronized void createFactoryArray() { + if (cFactoryArray != null) return; + cFactoryArray = new FactoryEntry[LAST_ID - FIRST_ID + 1]; + for (int i = 0; i < cFactoryArray.length; i++) + cFactoryArray[i] = null; + placeFactory(ATTR_RPLY, new FactoryEntry() { + + public SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) + throws ServiceLocationException, IOException { + return AttributeReply.parse(pHdr, pInStr); + } + }); + placeFactory(ATTR_RQST, new FactoryEntry() { + + public SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) + throws ServiceLocationException, IOException { + return AttributeRequest.parse(pHdr, pInStr); + } + }); + placeFactory(DA_ADVERT, new FactoryEntry() { + + public SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) + throws ServiceLocationException, IOException { + return DAAdvert.parse(pHdr, pInStr); + } + }); + placeFactory(SA_ADVERT, new FactoryEntry() { + + public SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) + throws ServiceLocationException, IOException { + return SAAdvert.parse(pHdr, pInStr); + } + }); + placeFactory(SRV_ACK, new FactoryEntry() { + + public SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) + throws ServiceLocationException, IOException { + return ServiceAcknowledgment.parse(pHdr, pInStr); + } + }); + placeFactory(SRV_DEREG, new FactoryEntry() { + + public SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) + throws ServiceLocationException, IOException { + return ServiceDeregistration.parse(pHdr, pInStr); + } + }); + placeFactory(SRV_REG, new FactoryEntry() { + + public SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) + throws ServiceLocationException, IOException { + return ServiceRegistration.parse(pHdr, pInStr); + } + }); + placeFactory(SRV_RPLY, new FactoryEntry() { + + public SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) + throws ServiceLocationException, IOException { + return ServiceReply.parse(pHdr, pInStr); + } + }); + placeFactory(SRV_RQST, new FactoryEntry() { + + public SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) + throws ServiceLocationException, IOException { + return ServiceRequest.parse(pHdr, pInStr); + } + }); + // + placeFactory(SRV_TYPE_RPLY, new FactoryEntry() { + + public SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) + throws ServiceLocationException, IOException { + return ServiceTypeReply.parse(pHdr, pInStr); + } + }); + placeFactory(SRV_TYPE_RQST, new FactoryEntry() { + + public SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) + throws ServiceLocationException, IOException { + return ServiceTypeRequest.parse(pHdr, pInStr); + } + }); + } + + private static FactoryEntry getFactory(int pFnID) { + createFactoryArray(); + return cFactoryArray[pFnID - FIRST_ID]; + } + + /** + * parse + * + * @param pSock + * @return SLPMessage + * @throws ServiceLocationException + * @throws IOException + */ + public static SLPMessage parse(Socket pSock) throws ServiceLocationException, IOException { + return parse(pSock.getInputStream()); + } + + /** + * parse + * + * @param pInStr + * @return SLPMessage + * @throws ServiceLocationException + * @throws IOException + */ + public static SLPMessage parse(InputStream pInStr) throws ServiceLocationException, IOException { + return parse(new SLPInputStream(pInStr)); + } + + /** + * parse + * + * @param pPacket + * @return SLPMessage + * @throws ServiceLocationException + * @throws IOException + */ + public static SLPMessage parse(DatagramPacket pPacket) throws ServiceLocationException, + IOException { + return parse(new SLPInputStream(pPacket)); + } + + /** + * parse + * + * @param pInStr + * @return SLPMessage + * @throws ServiceLocationException + * @throws IOException + */ + public static SLPMessage parse(SLPInputStream pInStr) throws ServiceLocationException, + IOException { + MsgHeader hdr = MsgHeader.parse(pInStr); + FactoryEntry factory = getFactory(hdr.getFunctionID()); + if (factory == null) throw new ServiceLocationException( + ServiceLocationException.NOT_IMPLEMENTED, "FunctionID=" + hdr.getFunctionID() + + " is not implemented!"); + return factory.parse(hdr, pInStr); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/MsgHeader.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/MsgHeader.java similarity index 86% rename from src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/MsgHeader.java rename to src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/MsgHeader.java index a1a858c..f853487 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/MsgHeader.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/MsgHeader.java @@ -1,341 +1,339 @@ -/* - (C) Copyright IBM Corp. 2007, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, IBM, ebak@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1804402 2007-09-28 ebak IPv6 ready SLP - * 1892103 2008-02-15 ebak SLP improvements - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.slp.internal.msg; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.IOException; -import java.util.Random; - -import org.sentrysoftware.wbem.sblim.slp.ServiceLocationException; -import org.sentrysoftware.wbem.sblim.slp.internal.Convert; - -/* - * SLP Header: 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 - * 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | - * Version | Function-ID | Length | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Length, - * contd.|O|F|R| reserved |Next Ext Offset| - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Next - * Extension Offset, contd.| XID | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Language - * Tag Length | Language Tag \ - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * - * Message Type Abbreviation Function-ID - * - * Service Request SrvRqst 1 Service Reply SrvRply 2 Service Registration SrvReg - * 3 Service Deregister SrvDeReg 4 Service Acknowledge SrvAck 5 Attribute - * Request AttrRqst 6 Attribute Reply AttrRply 7 DA Advertisement DAAdvert 8 - * Service Type Request SrvTypeRqst 9 Service Type Reply SrvTypeRply 10 SA - * Advertisement SAAdvert 11 - * - * Length: @2 3 bytes length of the entire SLP message, header included. - * - * Flags: @5 1 byte OVERFLOW (0x80): is set when a message's length exceeds what - * can fit into a datagram. FRESH (0x40): is set on every new SrvReg. REQUEST - * MCAST (0x20): is set when multicasting or broadcasting requests. - * - * Reserved: @6 1 byte bits MUST be 0. - * - * Next Extension Offset: @7 3 bytes is set to 0 unless extensions are used. The - * first extension begins at 'offset' bytes, from the message's beginning. It is - * placed after the SLP message data. - * - * XID: @10 2 bytes is set to a unique value for each unique request. If the - * request is retransmitted, the same XID is used. Replies set the XID to the - * same value as the xid in the request. Only unsolicited DAAdverts are sent - * with an XID of 0. - * - * Language Tag Length: @12 2 bytes is the length in bytes of the Language Tag - * field. - * - * Language Tag: @14 The Language Tag in a reply MUST be the same as the - * Language Tag in the request. This field must be encoded 1*8ALPHA *("-" - * 1*8ALPHA). - */ - -/** - * MsgHeader - * - */ -public class MsgHeader implements FunctionIDs { - - /** - * VERSION - */ - public static final byte VERSION = 2; - - /** - * RAW_HDR_LEN - */ - public static final int RAW_HDR_LEN = 14; - - /** - * OVERFLOW - */ - public static final int OVERFLOW = 0x8000; - - /** - * FRESH - */ - public static final int FRESH = 0x4000; - - /** - * MCAST - */ - public static final int MCAST = 0x2000; - - /** - * Initialized with a random value, then it is increased by every - * getNewXID(). - */ - private static int cXID = -1; - - private int iVersion, iFunctionID; - - private String iLangTag; - - private boolean iOverflow, iFresh, iMCast; - - /** - * XIDs SHOULD be randomly chosen to avoid duplicate XIDs in requests if UAs - * restart frequently. This variable is used only for to keep the XID of a - * parsed message. serialize() overwrites it. - */ - private int iXID; - - /** - * parse - * - * @param pInStr - * @return MsgHeader - * @throws ServiceLocationException - * @throws IOException - */ - public static MsgHeader parse(SLPInputStream pInStr) throws ServiceLocationException, - IOException { - int version = pInStr.read8(); - int fnID = pInStr.read8(); - if (fnID < FIRST_ID || fnID > LAST_ID) throw new ServiceLocationException( - ServiceLocationException.PARSE_ERROR, "functionID:" + fnID + " is not supported!"); - // int len = - pInStr.read24(); // TODO: could be used for sanity checking - int flags = pInStr.read16(); - pInStr.read24(); // skip extension - int XID = pInStr.read16(); - String langTag = pInStr.readString(); - return new MsgHeader(version, fnID, langTag, (flags & OVERFLOW) > 0, (flags & FRESH) > 0, - (flags & MCAST) > 0, XID); - } - - /** - * Ctor. - * - * @param pHdr - */ - public MsgHeader(MsgHeader pHdr) { - this(pHdr.iVersion, pHdr.iFunctionID, pHdr.iLangTag, pHdr.iOverflow, pHdr.iFresh, - pHdr.iMCast, pHdr.iXID); - } - - /** - * Ctor. - * - * @param pVersion - * @param pFunctionID - * @param pLangTag - * @param pOverflow - * @param pFresh - * @param pMCast - * @param pXID - */ - public MsgHeader(int pVersion, int pFunctionID, String pLangTag, boolean pOverflow, - boolean pFresh, boolean pMCast, int pXID) { - this.iVersion = pVersion; - this.iFunctionID = pFunctionID; - this.iLangTag = pLangTag; - this.iOverflow = pOverflow; - this.iFresh = pFresh; - this.iMCast = pMCast; - this.iXID = pXID; - } - - /** - * getVersion - * - * @return int - */ - public int getVersion() { - return this.iVersion; - } - - /** - * getFunctionID - * - * @return int - */ - public int getFunctionID() { - return this.iFunctionID; - } - - /** - * getLangTag - * - * @return int - */ - public String getLangTag() { - return this.iLangTag; - } - - /** - * overflows - * - * @return boolean - */ - public boolean overflows() { - return this.iOverflow; - } - - /** - * fresh - * - * @return boolean - */ - public boolean fresh() { - return this.iFresh; - } - - /** - * multicast - * - * @return boolean - */ - public boolean multicast() { - return this.iMCast; - } - - /** - * @return the XID which is parsed from the message. serialize() doesn't use - * this value, that serializes a new XID into the stream at every - * call (unless pKeepXID is set). - */ - public int getXID() { - return this.iXID; - } - - /** - * The response have to contain the same XID of the request. So this setter - * can be useful. - * - * @param pXID - */ - public void setXID(int pXID) { - this.iXID = pXID; - } - - /** - * getSize - * - * @return int - */ - public int getSize() { - byte[] langBytes = getLangTagBytes(); - return RAW_HDR_LEN + langBytes.length; - } - - /* - * message body have to be serialized first in order to know length and - * MCAST - */ - /** - * serialize - * - * @param pBodyLength - * @param pOverflow - * @param pSetMultiCastFlag - * @param pKeepXID - * @return byte[] - */ - public byte[] serialize(int pBodyLength, boolean pOverflow, boolean pSetMultiCastFlag, - boolean pKeepXID) { - SLPOutputStream outStr = new SLPOutputStream(); - outStr.writeNoChk8(VERSION); - outStr.writeNoChk8(this.iFunctionID); - outStr.writeNoChk24(getSize() + pBodyLength); - int flags = 0; - if (pOverflow) flags |= OVERFLOW; - if (this.iFresh) flags |= FRESH; - if (pSetMultiCastFlag) flags |= MCAST; - outStr.writeNoChk16(flags); - outStr.writeNoChk24(0); // skip extension - if (!pKeepXID) this.iXID = getNewXID(); - outStr.writeNoChk16(this.iXID); - byte[] langTagBytes = getLangTagBytes(); - outStr.writeNoChk16(langTagBytes.length); - outStr.writeNoChk(langTagBytes); - return outStr.toByteArray(); - } - - private byte[] iLangTagBytes; - - private byte[] getLangTagBytes() { - if (this.iLangTagBytes != null) return this.iLangTagBytes; - this.iLangTagBytes = Convert.getBytes(this.iLangTag); - return this.iLangTagBytes; - } - - /* - * XID = 0 is not allowed except for some special case - */ - private static int getNewXID() { - if (cXID < 0) { - cXID = new Random().nextInt(65536); - return cXID == 0 ? ++cXID : cXID; - } - ++cXID; - cXID &= 0xffff; - if (cXID == 0) ++cXID; - return ++cXID; - } - -} +/* + (C) Copyright IBM Corp. 2007, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, IBM, ebak@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1804402 2007-09-28 ebak IPv6 ready SLP + * 1892103 2008-02-15 ebak SLP improvements + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.slp.internal.msg; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.IOException; +import java.util.Random; + +import org.metricshub.wbem.sblim.slp.internal.Convert; +import org.metricshub.wbem.sblim.slp.ServiceLocationException; + +/* + * SLP Header: 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 + * 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | + * Version | Function-ID | Length | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Length, + * contd.|O|F|R| reserved |Next Ext Offset| + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Next + * Extension Offset, contd.| XID | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Language + * Tag Length | Language Tag \ + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * + * Message Type Abbreviation Function-ID + * + * Service Request SrvRqst 1 Service Reply SrvRply 2 Service Registration SrvReg + * 3 Service Deregister SrvDeReg 4 Service Acknowledge SrvAck 5 Attribute + * Request AttrRqst 6 Attribute Reply AttrRply 7 DA Advertisement DAAdvert 8 + * Service Type Request SrvTypeRqst 9 Service Type Reply SrvTypeRply 10 SA + * Advertisement SAAdvert 11 + * + * Length: @2 3 bytes length of the entire SLP message, header included. + * + * Flags: @5 1 byte OVERFLOW (0x80): is set when a message's length exceeds what + * can fit into a datagram. FRESH (0x40): is set on every new SrvReg. REQUEST + * MCAST (0x20): is set when multicasting or broadcasting requests. + * + * Reserved: @6 1 byte bits MUST be 0. + * + * Next Extension Offset: @7 3 bytes is set to 0 unless extensions are used. The + * first extension begins at 'offset' bytes, from the message's beginning. It is + * placed after the SLP message data. + * + * XID: @10 2 bytes is set to a unique value for each unique request. If the + * request is retransmitted, the same XID is used. Replies set the XID to the + * same value as the xid in the request. Only unsolicited DAAdverts are sent + * with an XID of 0. + * + * Language Tag Length: @12 2 bytes is the length in bytes of the Language Tag + * field. + * + * Language Tag: @14 The Language Tag in a reply MUST be the same as the + * Language Tag in the request. This field must be encoded 1*8ALPHA *("-" + * 1*8ALPHA). + */ + +/** + * MsgHeader + * + */ +public class MsgHeader implements FunctionIDs { + + /** + * VERSION + */ + public static final byte VERSION = 2; + + /** + * RAW_HDR_LEN + */ + public static final int RAW_HDR_LEN = 14; + + /** + * OVERFLOW + */ + public static final int OVERFLOW = 0x8000; + + /** + * FRESH + */ + public static final int FRESH = 0x4000; + + /** + * MCAST + */ + public static final int MCAST = 0x2000; + + /** + * Initialized with a random value, then it is increased by every + * getNewXID(). + */ + private static int cXID = -1; + + private int iVersion, iFunctionID; + + private String iLangTag; + + private boolean iOverflow, iFresh, iMCast; + + /** + * XIDs SHOULD be randomly chosen to avoid duplicate XIDs in requests if UAs + * restart frequently. This variable is used only for to keep the XID of a + * parsed message. serialize() overwrites it. + */ + private int iXID; + + /** + * parse + * + * @param pInStr + * @return MsgHeader + * @throws ServiceLocationException + * @throws IOException + */ + public static MsgHeader parse(SLPInputStream pInStr) throws ServiceLocationException, + IOException { + int version = pInStr.read8(); + int fnID = pInStr.read8(); + if (fnID < FIRST_ID || fnID > LAST_ID) throw new ServiceLocationException( + ServiceLocationException.PARSE_ERROR, "functionID:" + fnID + " is not supported!"); + // int len = + pInStr.read24(); // TODO: could be used for sanity checking + int flags = pInStr.read16(); + pInStr.read24(); // skip extension + int XID = pInStr.read16(); + String langTag = pInStr.readString(); + return new MsgHeader(version, fnID, langTag, (flags & OVERFLOW) > 0, (flags & FRESH) > 0, + (flags & MCAST) > 0, XID); + } + + /** + * Ctor. + * + * @param pHdr + */ + public MsgHeader(MsgHeader pHdr) { + this(pHdr.iVersion, pHdr.iFunctionID, pHdr.iLangTag, pHdr.iOverflow, pHdr.iFresh, + pHdr.iMCast, pHdr.iXID); + } + + /** + * Ctor. + * + * @param pVersion + * @param pFunctionID + * @param pLangTag + * @param pOverflow + * @param pFresh + * @param pMCast + * @param pXID + */ + public MsgHeader(int pVersion, int pFunctionID, String pLangTag, boolean pOverflow, + boolean pFresh, boolean pMCast, int pXID) { + this.iVersion = pVersion; + this.iFunctionID = pFunctionID; + this.iLangTag = pLangTag; + this.iOverflow = pOverflow; + this.iFresh = pFresh; + this.iMCast = pMCast; + this.iXID = pXID; + } + + /** + * getVersion + * + * @return int + */ + public int getVersion() { + return this.iVersion; + } + + /** + * getFunctionID + * + * @return int + */ + public int getFunctionID() { + return this.iFunctionID; + } + + /** + * getLangTag + * + * @return int + */ + public String getLangTag() { + return this.iLangTag; + } + + /** + * overflows + * + * @return boolean + */ + public boolean overflows() { + return this.iOverflow; + } + + /** + * fresh + * + * @return boolean + */ + public boolean fresh() { + return this.iFresh; + } + + /** + * multicast + * + * @return boolean + */ + public boolean multicast() { + return this.iMCast; + } + + /** + * @return the XID which is parsed from the message. serialize() doesn't use + * this value, that serializes a new XID into the stream at every + * call (unless pKeepXID is set). + */ + public int getXID() { + return this.iXID; + } + + /** + * The response have to contain the same XID of the request. So this setter + * can be useful. + * + * @param pXID + */ + public void setXID(int pXID) { + this.iXID = pXID; + } + + /** + * getSize + * + * @return int + */ + public int getSize() { + byte[] langBytes = getLangTagBytes(); + return RAW_HDR_LEN + langBytes.length; + } + + /* + * message body have to be serialized first in order to know length and + * MCAST + */ + /** + * serialize + * + * @param pBodyLength + * @param pOverflow + * @param pSetMultiCastFlag + * @param pKeepXID + * @return byte[] + */ + public byte[] serialize(int pBodyLength, boolean pOverflow, boolean pSetMultiCastFlag, + boolean pKeepXID) { + SLPOutputStream outStr = new SLPOutputStream(); + outStr.writeNoChk8(VERSION); + outStr.writeNoChk8(this.iFunctionID); + outStr.writeNoChk24(getSize() + pBodyLength); + int flags = 0; + if (pOverflow) flags |= OVERFLOW; + if (this.iFresh) flags |= FRESH; + if (pSetMultiCastFlag) flags |= MCAST; + outStr.writeNoChk16(flags); + outStr.writeNoChk24(0); // skip extension + if (!pKeepXID) this.iXID = getNewXID(); + outStr.writeNoChk16(this.iXID); + byte[] langTagBytes = getLangTagBytes(); + outStr.writeNoChk16(langTagBytes.length); + outStr.writeNoChk(langTagBytes); + return outStr.toByteArray(); + } + + private byte[] iLangTagBytes; + + private byte[] getLangTagBytes() { + if (this.iLangTagBytes != null) return this.iLangTagBytes; + this.iLangTagBytes = Convert.getBytes(this.iLangTag); + return this.iLangTagBytes; + } + + /* + * XID = 0 is not allowed except for some special case + */ + private static int getNewXID() { + if (cXID < 0) { + cXID = new Random().nextInt(65536); + return cXID == 0 ? ++cXID : cXID; + } + ++cXID; + cXID &= 0xffff; + if (cXID == 0) ++cXID; + return ++cXID; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/ReplyMessage.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/ReplyMessage.java similarity index 72% rename from src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/ReplyMessage.java rename to src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/ReplyMessage.java index 6e44cd7..79a662c 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/ReplyMessage.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/ReplyMessage.java @@ -1,114 +1,112 @@ -/* - (C) Copyright IBM Corp. 2007, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, IBM, ebak@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1804402 2007-09-28 ebak IPv6 ready SLP - * 1949918 2008-04-08 raman_arora Malformed service URL crashes SLP discovery - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - */ - -package org.sentrysoftware.wbem.sblim.slp.internal.msg; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.Iterator; - -/** - * ReplyMessage - * - */ -public abstract class ReplyMessage extends SLPMessage { - - private int iErrorCode; - - /** - * Ctor. - * - * @param pFunctionID - * @param pErrorCode - */ - public ReplyMessage(int pFunctionID, int pErrorCode) { - super(pFunctionID); - this.iErrorCode = pErrorCode; - } - - /** - * Ctor. - * - * @param pFunctionID - * @param pLangTag - * @param pErrorCode - */ - public ReplyMessage(int pFunctionID, String pLangTag, int pErrorCode) { - super(pFunctionID, pLangTag); - this.iErrorCode = pErrorCode; - } - - /** - * Ctor. - * - * @param pHeader - * @param pErrorCode - */ - public ReplyMessage(MsgHeader pHeader, int pErrorCode) { - super(pHeader); - this.iErrorCode = pErrorCode; - } - - /** - * getErrorCode - * - * @return int - */ - public int getErrorCode() { - return this.iErrorCode; - } - - /** - * getResultIterator - * - * @return Iterator - */ - public abstract Iterator getResultIterator(); - - /** - * getExceptionIterator - * - * @return Iterator - */ - public abstract Iterator getExceptionIterator(); - -} +/* + (C) Copyright IBM Corp. 2007, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, IBM, ebak@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1804402 2007-09-28 ebak IPv6 ready SLP + * 1949918 2008-04-08 raman_arora Malformed service URL crashes SLP discovery + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + */ + +package org.metricshub.wbem.sblim.slp.internal.msg; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.Iterator; + +/** + * ReplyMessage + * + */ +public abstract class ReplyMessage extends SLPMessage { + + private int iErrorCode; + + /** + * Ctor. + * + * @param pFunctionID + * @param pErrorCode + */ + public ReplyMessage(int pFunctionID, int pErrorCode) { + super(pFunctionID); + this.iErrorCode = pErrorCode; + } + + /** + * Ctor. + * + * @param pFunctionID + * @param pLangTag + * @param pErrorCode + */ + public ReplyMessage(int pFunctionID, String pLangTag, int pErrorCode) { + super(pFunctionID, pLangTag); + this.iErrorCode = pErrorCode; + } + + /** + * Ctor. + * + * @param pHeader + * @param pErrorCode + */ + public ReplyMessage(MsgHeader pHeader, int pErrorCode) { + super(pHeader); + this.iErrorCode = pErrorCode; + } + + /** + * getErrorCode + * + * @return int + */ + public int getErrorCode() { + return this.iErrorCode; + } + + /** + * getResultIterator + * + * @return Iterator + */ + public abstract Iterator getResultIterator(); + + /** + * getExceptionIterator + * + * @return Iterator + */ + public abstract Iterator getExceptionIterator(); + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/RequestMessage.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/RequestMessage.java similarity index 82% rename from src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/RequestMessage.java rename to src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/RequestMessage.java index 39e8cef..669ddf0 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/RequestMessage.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/RequestMessage.java @@ -1,207 +1,205 @@ -/* - (C) Copyright IBM Corp. 2007, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, IBM, ebak@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1804402 2007-09-28 ebak IPv6 ready SLP - * 1892103 2008-02-12 ebak SLP improvements - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors - */ - -package org.sentrysoftware.wbem.sblim.slp.internal.msg; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.Iterator; -import java.util.List; -import java.util.SortedSet; -import java.util.TreeSet; - -import org.sentrysoftware.wbem.sblim.slp.internal.msg.SLPMessage; -import org.sentrysoftware.wbem.sblim.slp.ServiceLocationException; - -/** - * RequestMessage - * - */ -public abstract class RequestMessage extends SLPMessage { - - private SortedSet iPrevResponderSet; - - private List iScopeList; - - /** - * Ctor. - * - * @param pFunctionID - * @param pPrevResponderSet - * - set of address strings - * @param pScopeList - * - list of scope strings - */ - public RequestMessage(int pFunctionID, SortedSet pPrevResponderSet, - List pScopeList) { - super(pFunctionID); - init(pPrevResponderSet, pScopeList); - } - - /** - * Ctor. - * - * @param pFunctionID - * @param pLangTag - * @param pPrevResponderSet - * - set of address strings - * @param pScopeList - * - list of scope strings - */ - public RequestMessage(int pFunctionID, String pLangTag, SortedSet pPrevResponderSet, - List pScopeList) { - super(pFunctionID, pLangTag); - init(pPrevResponderSet, pScopeList); - } - - /** - * Ctor. - * - * @param pHeader - * @param pPrevResponderSet - * - set of address strings - * @param pScopeList - * - list of scope strings - */ - public RequestMessage(MsgHeader pHeader, SortedSet pPrevResponderSet, - List pScopeList) { - super(pHeader); - init(pPrevResponderSet, pScopeList); - } - - /** - * getPrevResponderSet - * - * @return SortedSet - */ - public SortedSet getPrevResponderSet() { - return this.iPrevResponderSet; - } - - /** - * getPrevRespondersItr - * - * @return Iterator - */ - public Iterator getPrevRespondersItr() { - return this.iPrevResponderSet == null ? null : this.iPrevResponderSet.iterator(); - } - - /** - * updatePrevResponders - * - * @param pResponder - * @return boolean - */ - public boolean updatePrevResponders(String pResponder) { - if (this.iPrevResponderSet == null) this.iPrevResponderSet = new TreeSet(); - return this.iPrevResponderSet.add(pResponder); - } - - /** - * getScopeList - * - * @return List of scope strings - */ - public List getScopeList() { - return this.iScopeList; - } - - /** - * isAllowedResponseType - * - * @param pRspMsg - * @return boolean - */ - public boolean isAllowedResponseType(SLPMessage pRspMsg) { - if (pRspMsg == null) return false; - int id = pRspMsg.getFunctionID(); - int[] rspIDs = getAllowedResponseIDs(); - if (rspIDs == null) return true; - for (int i = 0; i < rspIDs.length; i++) - if (id == rspIDs[i]) return true; - return false; - } - - /** - * serializeWithoutResponders - * - * @param pSetMulticastFlag - * @param pDatagramLimited - * @param pKeepXID - * @return byte[] - * @throws ServiceLocationException - */ - public byte[] serializeWithoutResponders(boolean pSetMulticastFlag, boolean pDatagramLimited, - boolean pKeepXID) throws ServiceLocationException { - - return serialize(pSetMulticastFlag, pDatagramLimited, pKeepXID, new SkipResponders()); - } - - @Override - protected boolean serializeBody(SLPOutputStream pOutStr, SerializeOption pSkipResponders) - throws ServiceLocationException { - if (!pOutStr.writeStringList(pSkipResponders == null ? getPrevRespondersItr() : null)) throw new ServiceLocationException( - ServiceLocationException.PREVIOUS_RESPONDER_OVERFLOW, - "Previous responder list has overflowed!"); - return serializeRequestBody(pOutStr); - } - - protected abstract boolean serializeRequestBody(SLPOutputStream pOutStr) - throws ServiceLocationException; - - protected abstract int[] getAllowedResponseIDs(); - - private void init(SortedSet pPrevResponderSet, List pScopeList) { - this.iPrevResponderSet = pPrevResponderSet; - this.iScopeList = pScopeList; - } - - class SkipResponders extends SerializeOption { - /* - * non-null instance indicates that the PreviousResponderList - * serialization have to be skipped - */ - } - -} +/* + (C) Copyright IBM Corp. 2007, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, IBM, ebak@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1804402 2007-09-28 ebak IPv6 ready SLP + * 1892103 2008-02-12 ebak SLP improvements + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors + */ + +package org.metricshub.wbem.sblim.slp.internal.msg; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.Iterator; +import java.util.List; +import java.util.SortedSet; +import java.util.TreeSet; + +import org.metricshub.wbem.sblim.slp.internal.msg.SLPMessage; +import org.metricshub.wbem.sblim.slp.ServiceLocationException; + +/** + * RequestMessage + * + */ +public abstract class RequestMessage extends SLPMessage { + + private SortedSet iPrevResponderSet; + + private List iScopeList; + + /** + * Ctor. + * + * @param pFunctionID + * @param pPrevResponderSet + * - set of address strings + * @param pScopeList + * - list of scope strings + */ + public RequestMessage(int pFunctionID, SortedSet pPrevResponderSet, + List pScopeList) { + super(pFunctionID); + init(pPrevResponderSet, pScopeList); + } + + /** + * Ctor. + * + * @param pFunctionID + * @param pLangTag + * @param pPrevResponderSet + * - set of address strings + * @param pScopeList + * - list of scope strings + */ + public RequestMessage(int pFunctionID, String pLangTag, SortedSet pPrevResponderSet, + List pScopeList) { + super(pFunctionID, pLangTag); + init(pPrevResponderSet, pScopeList); + } + + /** + * Ctor. + * + * @param pHeader + * @param pPrevResponderSet + * - set of address strings + * @param pScopeList + * - list of scope strings + */ + public RequestMessage(MsgHeader pHeader, SortedSet pPrevResponderSet, + List pScopeList) { + super(pHeader); + init(pPrevResponderSet, pScopeList); + } + + /** + * getPrevResponderSet + * + * @return SortedSet + */ + public SortedSet getPrevResponderSet() { + return this.iPrevResponderSet; + } + + /** + * getPrevRespondersItr + * + * @return Iterator + */ + public Iterator getPrevRespondersItr() { + return this.iPrevResponderSet == null ? null : this.iPrevResponderSet.iterator(); + } + + /** + * updatePrevResponders + * + * @param pResponder + * @return boolean + */ + public boolean updatePrevResponders(String pResponder) { + if (this.iPrevResponderSet == null) this.iPrevResponderSet = new TreeSet(); + return this.iPrevResponderSet.add(pResponder); + } + + /** + * getScopeList + * + * @return List of scope strings + */ + public List getScopeList() { + return this.iScopeList; + } + + /** + * isAllowedResponseType + * + * @param pRspMsg + * @return boolean + */ + public boolean isAllowedResponseType(SLPMessage pRspMsg) { + if (pRspMsg == null) return false; + int id = pRspMsg.getFunctionID(); + int[] rspIDs = getAllowedResponseIDs(); + if (rspIDs == null) return true; + for (int i = 0; i < rspIDs.length; i++) + if (id == rspIDs[i]) return true; + return false; + } + + /** + * serializeWithoutResponders + * + * @param pSetMulticastFlag + * @param pDatagramLimited + * @param pKeepXID + * @return byte[] + * @throws ServiceLocationException + */ + public byte[] serializeWithoutResponders(boolean pSetMulticastFlag, boolean pDatagramLimited, + boolean pKeepXID) throws ServiceLocationException { + + return serialize(pSetMulticastFlag, pDatagramLimited, pKeepXID, new SkipResponders()); + } + + @Override + protected boolean serializeBody(SLPOutputStream pOutStr, SerializeOption pSkipResponders) + throws ServiceLocationException { + if (!pOutStr.writeStringList(pSkipResponders == null ? getPrevRespondersItr() : null)) throw new ServiceLocationException( + ServiceLocationException.PREVIOUS_RESPONDER_OVERFLOW, + "Previous responder list has overflowed!"); + return serializeRequestBody(pOutStr); + } + + protected abstract boolean serializeRequestBody(SLPOutputStream pOutStr) + throws ServiceLocationException; + + protected abstract int[] getAllowedResponseIDs(); + + private void init(SortedSet pPrevResponderSet, List pScopeList) { + this.iPrevResponderSet = pPrevResponderSet; + this.iScopeList = pScopeList; + } + + class SkipResponders extends SerializeOption { + /* + * non-null instance indicates that the PreviousResponderList + * serialization have to be skipped + */ + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/SAAdvert.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/SAAdvert.java similarity index 80% rename from src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/SAAdvert.java rename to src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/SAAdvert.java index 43eefc6..b65911b 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/SAAdvert.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/SAAdvert.java @@ -1,174 +1,172 @@ -/* - (C) Copyright IBM Corp. 2007, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, IBM, ebak@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1804402 2007-09-28 ebak IPv6 ready SLP - * 1892103 2008-02-12 ebak SLP improvements - * 1949918 2008-04-08 raman_arora Malformed service URL crashes SLP discovery - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - */ - -package org.sentrysoftware.wbem.sblim.slp.internal.msg; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.sentrysoftware.wbem.sblim.slp.ServiceLocationAttribute; -import org.sentrysoftware.wbem.sblim.slp.ServiceLocationException; - -/* - * 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Service - * Location header (function = SAAdvert = 11) | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Length of - * URL | URL \ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | - * Length of | \ - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Length of - * | \ - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | # auth - * blocks | authentication block (if any) \ - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * - */ - -/** - * SAAdvert message - * - */ -public class SAAdvert extends ReplyMessage { - - private String iURLStr; - - private List iScopeList; - - private List iAttrList; - - /** - * parse - * - * @param pHdr - * @param pInStr - * @return SLPMessage - * @throws ServiceLocationException - * @throws IOException - */ - public static SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) - throws ServiceLocationException, IOException { - return new SAAdvert(pHdr, pInStr.readString(), pInStr.readStringList(), pInStr - .readAttributeList()); - } - - /** - * Ctor. - * - * @param pURLStr - * @param pScopeList - * - list of scope strings - * @param pAttrList - * - list of ServiceLocationAttributes - */ - public SAAdvert(String pURLStr, List pScopeList, - List pAttrList) { - super(SA_ADVERT, 0); - init(pURLStr, pScopeList, pAttrList); - } - - /** - * Ctor. - * - * @param pLangTag - * @param pURLStr - * @param pScopeList - * - list of scope strings - * @param pAttrList - * - list of ServiceLocationAttributes - */ - public SAAdvert(String pLangTag, String pURLStr, List pScopeList, - List pAttrList) { - super(SA_ADVERT, pLangTag, 0); - init(pURLStr, pScopeList, pAttrList); - } - - /** - * Ctor. - * - * @param pHeader - * @param pURLStr - * @param pScopeList - * - list of scope strings - * @param pAttrList - * - list of ServiceLocationAttributes - */ - public SAAdvert(MsgHeader pHeader, String pURLStr, List pScopeList, - List pAttrList) { - super(pHeader, 0); - init(pURLStr, pScopeList, pAttrList); - } - - @Override - public Iterator getResultIterator() { - ArrayList list = new ArrayList(); - list.add(this.iURLStr); - return list.iterator(); - } - - /** - * @param pOption - */ - @Override - protected boolean serializeBody(SLPOutputStream pOutStr, SerializeOption pOption) { - return pOutStr.write(this.iURLStr) && pOutStr.writeStringList(this.iScopeList) - && pOutStr.writeAttributeList(this.iAttrList); - } - - private void init(String pURLStr, List pScopeList, - List pAttrList) { - this.iURLStr = pURLStr; - this.iScopeList = pScopeList; - this.iAttrList = pAttrList; - } - - @Override - public Iterator getExceptionIterator() { - // this message doesn't have exception table - return null; - } - -} +/* + (C) Copyright IBM Corp. 2007, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, IBM, ebak@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1804402 2007-09-28 ebak IPv6 ready SLP + * 1892103 2008-02-12 ebak SLP improvements + * 1949918 2008-04-08 raman_arora Malformed service URL crashes SLP discovery + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + */ + +package org.metricshub.wbem.sblim.slp.internal.msg; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.metricshub.wbem.sblim.slp.ServiceLocationAttribute; +import org.metricshub.wbem.sblim.slp.ServiceLocationException; + +/* + * 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Service + * Location header (function = SAAdvert = 11) | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Length of + * URL | URL \ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | + * Length of | \ + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Length of + * | \ + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | # auth + * blocks | authentication block (if any) \ + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * + */ + +/** + * SAAdvert message + * + */ +public class SAAdvert extends ReplyMessage { + + private String iURLStr; + + private List iScopeList; + + private List iAttrList; + + /** + * parse + * + * @param pHdr + * @param pInStr + * @return SLPMessage + * @throws ServiceLocationException + * @throws IOException + */ + public static SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) + throws ServiceLocationException, IOException { + return new SAAdvert(pHdr, pInStr.readString(), pInStr.readStringList(), pInStr + .readAttributeList()); + } + + /** + * Ctor. + * + * @param pURLStr + * @param pScopeList + * - list of scope strings + * @param pAttrList + * - list of ServiceLocationAttributes + */ + public SAAdvert(String pURLStr, List pScopeList, + List pAttrList) { + super(SA_ADVERT, 0); + init(pURLStr, pScopeList, pAttrList); + } + + /** + * Ctor. + * + * @param pLangTag + * @param pURLStr + * @param pScopeList + * - list of scope strings + * @param pAttrList + * - list of ServiceLocationAttributes + */ + public SAAdvert(String pLangTag, String pURLStr, List pScopeList, + List pAttrList) { + super(SA_ADVERT, pLangTag, 0); + init(pURLStr, pScopeList, pAttrList); + } + + /** + * Ctor. + * + * @param pHeader + * @param pURLStr + * @param pScopeList + * - list of scope strings + * @param pAttrList + * - list of ServiceLocationAttributes + */ + public SAAdvert(MsgHeader pHeader, String pURLStr, List pScopeList, + List pAttrList) { + super(pHeader, 0); + init(pURLStr, pScopeList, pAttrList); + } + + @Override + public Iterator getResultIterator() { + ArrayList list = new ArrayList(); + list.add(this.iURLStr); + return list.iterator(); + } + + /** + * @param pOption + */ + @Override + protected boolean serializeBody(SLPOutputStream pOutStr, SerializeOption pOption) { + return pOutStr.write(this.iURLStr) && pOutStr.writeStringList(this.iScopeList) + && pOutStr.writeAttributeList(this.iAttrList); + } + + private void init(String pURLStr, List pScopeList, + List pAttrList) { + this.iURLStr = pURLStr; + this.iScopeList = pScopeList; + this.iAttrList = pAttrList; + } + + @Override + public Iterator getExceptionIterator() { + // this message doesn't have exception table + return null; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/SLPInputStream.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/SLPInputStream.java similarity index 88% rename from src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/SLPInputStream.java rename to src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/SLPInputStream.java index 8854335..93a0d2e 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/SLPInputStream.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/SLPInputStream.java @@ -1,504 +1,502 @@ -/* - (C) Copyright IBM Corp. 2007, 2010 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, IBM, ebak@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1804402 2007-09-28 ebak IPv6 ready SLP - * 1892103 2008-02-12 ebak SLP improvements - * 1949918 2008-04-08 raman_arora Malformed service URL crashes SLP discovery - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 3023349 2010-07-02 blaschke-oss SLP uses # constructor instead of valueOf - */ - -package org.sentrysoftware.wbem.sblim.slp.internal.msg; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.UnsupportedEncodingException; -import java.net.DatagramPacket; -import java.net.Socket; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.SortedSet; -import java.util.StringTokenizer; -import java.util.TreeSet; - -import org.sentrysoftware.wbem.sblim.slp.ServiceLocationAttribute; -import org.sentrysoftware.wbem.sblim.slp.ServiceLocationException; -import org.sentrysoftware.wbem.sblim.slp.ServiceType; -import org.sentrysoftware.wbem.sblim.slp.ServiceURL; -import org.sentrysoftware.wbem.sblim.slp.internal.Convert; -import org.sentrysoftware.wbem.sblim.slp.internal.SLPDefaults; -import org.sentrysoftware.wbem.sblim.slp.internal.TRC; - -/** - * Helps the parsing of the bytes of SLP messages. - * - */ -public class SLPInputStream { - - private InputStream iInStr; - - private final byte[] iBBuf = new byte[4]; - - /** - * Ctor. - * - * @param pBytes - */ - public SLPInputStream(byte[] pBytes) { - this(pBytes, 0, pBytes.length); - } - - /** - * Ctor. - * - * @param pSock - * @throws IOException - */ - public SLPInputStream(Socket pSock) throws IOException { - this(pSock.getInputStream()); - } - - /** - * Ctor. - * - * @param pInStr - */ - public SLPInputStream(InputStream pInStr) { - this.iInStr = pInStr; - } - - /** - * Ctor. - * - * @param pPacket - */ - public SLPInputStream(DatagramPacket pPacket) { - this(pPacket.getData(), pPacket.getOffset(), pPacket.getLength()); - } - - /** - * Ctor. - * - * @param pBytes - * @param pOffset - * @param pLength - */ - public SLPInputStream(byte[] pBytes, int pOffset, int pLength) { - this.iInStr = new ByteArrayInputStream(pBytes, pOffset, pLength); - } - - /** - * readString - * - * @return String - * @throws ServiceLocationException - * @throws IOException - */ - public String readString() throws ServiceLocationException, IOException { - return Convert.unescape(readRawString()); - } - - /** - * readStringSet - * - * @return SortedSet of Strings - * @throws ServiceLocationException - * @throws IOException - */ - public SortedSet readStringSet() throws ServiceLocationException, IOException { - SortedSet set = new TreeSet(); - readStringCollection(set); - return set; - } - - /** - * readStringList - * - * @return List of Strings - * @throws ServiceLocationException - * @throws IOException - */ - public List readStringList() throws ServiceLocationException, IOException { - ArrayList strList = new ArrayList(); - readStringCollection(strList); - return strList; - } - - /** - * readAttribute - * - * @return ServiceLocationAttribute - * @throws ServiceLocationException - * @throws IOException - */ - public ServiceLocationAttribute readAttribute() throws ServiceLocationException, IOException { - String str = readRawString(); - return str == null ? null : new ServiceLocationAttribute(str); - } - - /** - * readAttributeList - * - * @return List of ServiceLocationAttributes - * @throws ServiceLocationException - * @throws IOException - */ - public List readAttributeList() throws ServiceLocationException, - IOException { - String str = readRawString(); - return str == null ? null : new AttrListParser(str).getList(); - } - - /** - * # of AttrAuths |(if present) Attribute Authentication Blocks... - * - * @return null - * @throws ServiceLocationException - * @throws IOException - */ - public List readAuthBlockList() throws ServiceLocationException, IOException { - Integer blockCntInt = doRead8(); - if (blockCntInt == null) return null; - int blockCnt = blockCntInt.intValue(); - if (blockCnt != 0) throw new ServiceLocationException( - ServiceLocationException.NOT_IMPLEMENTED, - "Handling of authentication blocks is not implemented! blockCount = " + blockCnt); - return null; - } - - /* - * 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | - * Reserved | Lifetime | URL Length | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |URL - * len, contd.| URL (variable length) \ - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |# of - * URL auths | Auth. blocks (if any) \ - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - */ - /** - * @return ServiceURL - * @throws ServiceLocationException - * @throws IOException - */ - public ServiceURL readURL() throws ServiceLocationException, IOException { - if (doRead8() == null) return null; // skip reserved - Integer lifeTimeInt = doRead16(); - if (lifeTimeInt == null) return null; - int lifeTime = lifeTimeInt.intValue(); - String urlStr = readString(); - if (urlStr == null) return null; - Integer numOfAuthsInt = doRead8(); - if (numOfAuthsInt == null) return null; - int numOfAuths = numOfAuthsInt.intValue(); - while (numOfAuths-- > 0) { - TRC.warning("readAuth"); - readString(); - } - return new ServiceURL(urlStr, lifeTime); - } - - /** - * readUrlList - * - * @param pURLExceptions - * @return List of valid ServiceURLs - * @throws ServiceLocationException - * @throws IOException - * - * Add URL to list only if it is valid URL i.e. no exception is - * thrown by parser - * - */ - public List readUrlList(List pURLExceptions) - throws ServiceLocationException, IOException { - Integer cntInt = doRead16(); - if (cntInt == null) return null; - int cnt = cntInt.intValue(); - ArrayList urlList = new ArrayList(cnt); - ServiceURL url; - while (cnt-- > 0) { - try { - url = readURL(); - if (url == null) break; - urlList.add(url); - } catch (IllegalArgumentException e) { - pURLExceptions.add(e); - TRC.warning("Ignoring Invalid URL : " + e.getMessage()); - } - } - return urlList; - } - - /** - * readServiceType - * - * @return ServiceType - * @throws ServiceLocationException - * @throws IOException - */ - public ServiceType readServiceType() throws ServiceLocationException, IOException { - String str = readString(); - return str == null ? null : new ServiceType(str); - } - - /** - * readServTypeList - * - * @return List of ServiceTypes - * @throws ServiceLocationException - * @throws IOException - */ - public List readServTypeList() throws ServiceLocationException, IOException { - Iterator strItr = readStringList().iterator(); - ArrayList srvTypeList = new ArrayList(); - while (strItr.hasNext()) { - srvTypeList.add(new ServiceType(strItr.next())); - } - return srvTypeList; - } - - /** - * read8 - * - * @return int - * @throws ServiceLocationException - * @throws IOException - */ - public int read8() throws ServiceLocationException, IOException { - Integer res = doRead8(); - if (res == null) throw new ServiceLocationException(ServiceLocationException.PARSE_ERROR, - "Failed to read byte field!"); - return res.intValue(); - } - - /** - * read16 - * - * @return int - * @throws ServiceLocationException - * @throws IOException - */ - public int read16() throws ServiceLocationException, IOException { - Integer res = doRead16(); - if (res == null) throw new ServiceLocationException(ServiceLocationException.PARSE_ERROR, - "Failed to read 2-byte-long field!"); - return res.intValue(); - } - - /** - * read24 - * - * @return int - * @throws ServiceLocationException - * @throws IOException - */ - public int read24() throws ServiceLocationException, IOException { - Integer res = doRead24(); - if (res == null) throw new ServiceLocationException(ServiceLocationException.PARSE_ERROR, - "Failed to read 3-byte-long field!"); - return res.intValue(); - } - - /** - * read32 - * - * @return long - * @throws ServiceLocationException - * @throws IOException - */ - public long read32() throws ServiceLocationException, IOException { - Long res = doRead32(); - if (res == null) throw new ServiceLocationException(ServiceLocationException.PARSE_ERROR, - "Failed to read 4-byte-long field!"); - return res.longValue(); - } - - private Integer doRead8() throws IOException { - int res = this.iInStr.read(); - return res < 0 ? null : Integer.valueOf(res); - } - - private Integer doRead16() throws IOException { - int cnt = this.iInStr.read(this.iBBuf, 0, 2); - if (cnt != 2) return null; - return Integer.valueOf((this.iBBuf[0] & 0xff) << 8 | this.iBBuf[1] & 0xff); - } - - private Integer doRead24() throws IOException { - int cnt = this.iInStr.read(this.iBBuf, 0, 3); - if (cnt != 3) return null; - return Integer.valueOf((this.iBBuf[0] & 0xff) << 16 | (this.iBBuf[1] & 0xff) << 8 - | this.iBBuf[2] & 0xff); - } - - private Long doRead32() throws IOException { - int cnt = this.iInStr.read(this.iBBuf, 0, 4); - if (cnt != 4) return null; - long res = (this.iBBuf[0] & 0xff) << 8; - res |= (this.iBBuf[1] & 0xff) << 8; - res |= (this.iBBuf[2] & 0xff) << 8; - res |= this.iBBuf[3] & 0xff; - return Long.valueOf(res); - } - - private String readRawString() throws ServiceLocationException, IOException { - Integer lenInt = doRead16(); - if (lenInt == null) return null; - int len = lenInt.intValue(); - if (len <= 0) return null; - byte[] bytes = new byte[len]; - int read = this.iInStr.read(bytes, 0, len); - if (read != len) return null; - try { - return new String(bytes, SLPDefaults.ENCODING); - } catch (UnsupportedEncodingException e) { - throw new ServiceLocationException(ServiceLocationException.INTERNAL_SYSTEM_ERROR, e); - } - } - - private void readStringCollection(Collection pCol) throws ServiceLocationException, - IOException { - String rawListStr = readRawString(); - if (rawListStr == null) return; - StringTokenizer tokenizer = new StringTokenizer(rawListStr, ","); - while (tokenizer.hasMoreElements()) - pCol.add(Convert.unescape(tokenizer.nextToken())); - } - - private static class AttrListParser { - - private int iPos = 0; - - private String iAttrListStr; - - private ArrayList iList = new ArrayList(); - - /** - * Ctor. - * - * @param pAttrListStr - * @throws ServiceLocationException - */ - public AttrListParser(String pAttrListStr) throws ServiceLocationException { - debug("attrListStr=" + pAttrListStr); - this.iAttrListStr = pAttrListStr; - String attrStr; - while ((attrStr = readEntry()) != null) { - debug("attrStr=" + attrStr); - this.iList.add(new ServiceLocationAttribute(attrStr)); - } - } - - /** - * getList - * - * @return List of ServiceLocationAttributes - */ - public List getList() { - return this.iList; - } - - /* - * ( "(" attrID "=" ( value "," )* value ")" ("," / EndOfString ) ) / - * attrID ("," / EndOfString ) - */ - private String readEntry() throws ServiceLocationException { - if (this.iAttrListStr == null) return null; - int lastIdx = this.iAttrListStr.length() - 1; - if (this.iPos == lastIdx) return null; - boolean inBlock = false; - int startPos = this.iPos; - while (true) { - char ch = this.iAttrListStr.charAt(this.iPos); - if (ch == '(') { - if (inBlock || this.iPos != startPos) throw new ServiceLocationException( - ServiceLocationException.PARSE_ERROR, invalidChar('(')); - inBlock = true; - } else if (ch == ')') { - if (!inBlock) throw new ServiceLocationException( - ServiceLocationException.PARSE_ERROR, invalidChar(')')); - if (this.iPos == lastIdx) return this.iAttrListStr.substring(startPos); - inBlock = false; - } else { - if (inBlock) { - if (this.iPos == lastIdx) - /* - * throw new ServiceLocationException( - * ServiceLocationException.PARSE_ERROR, "There is no - * ')' for '(' !" ); - */ - return this.iAttrListStr.substring(startPos); - } else { - if (ch == ',') { - ++this.iPos; - return this.iAttrListStr.substring(startPos, this.iPos - 1); - } - if (this.iPos == lastIdx) { return this.iAttrListStr.substring(startPos); } - } - } - if (this.iPos == lastIdx) throw new ServiceLocationException( - ServiceLocationException.PARSE_ERROR, "Unexpected end of Attribute list:\n" - + this.iAttrListStr); - ++this.iPos; - } - } - - /** - * @param ch - */ - private String invalidChar(char ch) { - return "Invalid '(' character in Attribute list:\n" + this.iAttrListStr - + "\nat position: " + this.iPos; - } - - } - - /** - * @param pMsg - */ - static void debug(String pMsg) { - // System.out.println(pMsg); - } - -} +/* + (C) Copyright IBM Corp. 2007, 2010 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, IBM, ebak@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1804402 2007-09-28 ebak IPv6 ready SLP + * 1892103 2008-02-12 ebak SLP improvements + * 1949918 2008-04-08 raman_arora Malformed service URL crashes SLP discovery + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 3023349 2010-07-02 blaschke-oss SLP uses # constructor instead of valueOf + */ + +package org.metricshub.wbem.sblim.slp.internal.msg; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.net.DatagramPacket; +import java.net.Socket; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import java.util.SortedSet; +import java.util.StringTokenizer; +import java.util.TreeSet; + +import org.metricshub.wbem.sblim.slp.ServiceLocationAttribute; +import org.metricshub.wbem.sblim.slp.ServiceType; +import org.metricshub.wbem.sblim.slp.ServiceURL; +import org.metricshub.wbem.sblim.slp.internal.Convert; +import org.metricshub.wbem.sblim.slp.internal.SLPDefaults; +import org.metricshub.wbem.sblim.slp.internal.TRC; +import org.metricshub.wbem.sblim.slp.ServiceLocationException; + +/** + * Helps the parsing of the bytes of SLP messages. + * + */ +public class SLPInputStream { + + private InputStream iInStr; + + private final byte[] iBBuf = new byte[4]; + + /** + * Ctor. + * + * @param pBytes + */ + public SLPInputStream(byte[] pBytes) { + this(pBytes, 0, pBytes.length); + } + + /** + * Ctor. + * + * @param pSock + * @throws IOException + */ + public SLPInputStream(Socket pSock) throws IOException { + this(pSock.getInputStream()); + } + + /** + * Ctor. + * + * @param pInStr + */ + public SLPInputStream(InputStream pInStr) { + this.iInStr = pInStr; + } + + /** + * Ctor. + * + * @param pPacket + */ + public SLPInputStream(DatagramPacket pPacket) { + this(pPacket.getData(), pPacket.getOffset(), pPacket.getLength()); + } + + /** + * Ctor. + * + * @param pBytes + * @param pOffset + * @param pLength + */ + public SLPInputStream(byte[] pBytes, int pOffset, int pLength) { + this.iInStr = new ByteArrayInputStream(pBytes, pOffset, pLength); + } + + /** + * readString + * + * @return String + * @throws ServiceLocationException + * @throws IOException + */ + public String readString() throws ServiceLocationException, IOException { + return Convert.unescape(readRawString()); + } + + /** + * readStringSet + * + * @return SortedSet of Strings + * @throws ServiceLocationException + * @throws IOException + */ + public SortedSet readStringSet() throws ServiceLocationException, IOException { + SortedSet set = new TreeSet(); + readStringCollection(set); + return set; + } + + /** + * readStringList + * + * @return List of Strings + * @throws ServiceLocationException + * @throws IOException + */ + public List readStringList() throws ServiceLocationException, IOException { + ArrayList strList = new ArrayList(); + readStringCollection(strList); + return strList; + } + + /** + * readAttribute + * + * @return ServiceLocationAttribute + * @throws ServiceLocationException + * @throws IOException + */ + public ServiceLocationAttribute readAttribute() throws ServiceLocationException, IOException { + String str = readRawString(); + return str == null ? null : new ServiceLocationAttribute(str); + } + + /** + * readAttributeList + * + * @return List of ServiceLocationAttributes + * @throws ServiceLocationException + * @throws IOException + */ + public List readAttributeList() throws ServiceLocationException, + IOException { + String str = readRawString(); + return str == null ? null : new AttrListParser(str).getList(); + } + + /** + * # of AttrAuths |(if present) Attribute Authentication Blocks... + * + * @return null + * @throws ServiceLocationException + * @throws IOException + */ + public List readAuthBlockList() throws ServiceLocationException, IOException { + Integer blockCntInt = doRead8(); + if (blockCntInt == null) return null; + int blockCnt = blockCntInt.intValue(); + if (blockCnt != 0) throw new ServiceLocationException( + ServiceLocationException.NOT_IMPLEMENTED, + "Handling of authentication blocks is not implemented! blockCount = " + blockCnt); + return null; + } + + /* + * 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | + * Reserved | Lifetime | URL Length | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |URL + * len, contd.| URL (variable length) \ + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |# of + * URL auths | Auth. blocks (if any) \ + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + */ + /** + * @return ServiceURL + * @throws ServiceLocationException + * @throws IOException + */ + public ServiceURL readURL() throws ServiceLocationException, IOException { + if (doRead8() == null) return null; // skip reserved + Integer lifeTimeInt = doRead16(); + if (lifeTimeInt == null) return null; + int lifeTime = lifeTimeInt.intValue(); + String urlStr = readString(); + if (urlStr == null) return null; + Integer numOfAuthsInt = doRead8(); + if (numOfAuthsInt == null) return null; + int numOfAuths = numOfAuthsInt.intValue(); + while (numOfAuths-- > 0) { + TRC.warning("readAuth"); + readString(); + } + return new ServiceURL(urlStr, lifeTime); + } + + /** + * readUrlList + * + * @param pURLExceptions + * @return List of valid ServiceURLs + * @throws ServiceLocationException + * @throws IOException + * + * Add URL to list only if it is valid URL i.e. no exception is + * thrown by parser + * + */ + public List readUrlList(List pURLExceptions) + throws ServiceLocationException, IOException { + Integer cntInt = doRead16(); + if (cntInt == null) return null; + int cnt = cntInt.intValue(); + ArrayList urlList = new ArrayList(cnt); + ServiceURL url; + while (cnt-- > 0) { + try { + url = readURL(); + if (url == null) break; + urlList.add(url); + } catch (IllegalArgumentException e) { + pURLExceptions.add(e); + TRC.warning("Ignoring Invalid URL : " + e.getMessage()); + } + } + return urlList; + } + + /** + * readServiceType + * + * @return ServiceType + * @throws ServiceLocationException + * @throws IOException + */ + public ServiceType readServiceType() throws ServiceLocationException, IOException { + String str = readString(); + return str == null ? null : new ServiceType(str); + } + + /** + * readServTypeList + * + * @return List of ServiceTypes + * @throws ServiceLocationException + * @throws IOException + */ + public List readServTypeList() throws ServiceLocationException, IOException { + Iterator strItr = readStringList().iterator(); + ArrayList srvTypeList = new ArrayList(); + while (strItr.hasNext()) { + srvTypeList.add(new ServiceType(strItr.next())); + } + return srvTypeList; + } + + /** + * read8 + * + * @return int + * @throws ServiceLocationException + * @throws IOException + */ + public int read8() throws ServiceLocationException, IOException { + Integer res = doRead8(); + if (res == null) throw new ServiceLocationException(ServiceLocationException.PARSE_ERROR, + "Failed to read byte field!"); + return res.intValue(); + } + + /** + * read16 + * + * @return int + * @throws ServiceLocationException + * @throws IOException + */ + public int read16() throws ServiceLocationException, IOException { + Integer res = doRead16(); + if (res == null) throw new ServiceLocationException(ServiceLocationException.PARSE_ERROR, + "Failed to read 2-byte-long field!"); + return res.intValue(); + } + + /** + * read24 + * + * @return int + * @throws ServiceLocationException + * @throws IOException + */ + public int read24() throws ServiceLocationException, IOException { + Integer res = doRead24(); + if (res == null) throw new ServiceLocationException(ServiceLocationException.PARSE_ERROR, + "Failed to read 3-byte-long field!"); + return res.intValue(); + } + + /** + * read32 + * + * @return long + * @throws ServiceLocationException + * @throws IOException + */ + public long read32() throws ServiceLocationException, IOException { + Long res = doRead32(); + if (res == null) throw new ServiceLocationException(ServiceLocationException.PARSE_ERROR, + "Failed to read 4-byte-long field!"); + return res.longValue(); + } + + private Integer doRead8() throws IOException { + int res = this.iInStr.read(); + return res < 0 ? null : Integer.valueOf(res); + } + + private Integer doRead16() throws IOException { + int cnt = this.iInStr.read(this.iBBuf, 0, 2); + if (cnt != 2) return null; + return Integer.valueOf((this.iBBuf[0] & 0xff) << 8 | this.iBBuf[1] & 0xff); + } + + private Integer doRead24() throws IOException { + int cnt = this.iInStr.read(this.iBBuf, 0, 3); + if (cnt != 3) return null; + return Integer.valueOf((this.iBBuf[0] & 0xff) << 16 | (this.iBBuf[1] & 0xff) << 8 + | this.iBBuf[2] & 0xff); + } + + private Long doRead32() throws IOException { + int cnt = this.iInStr.read(this.iBBuf, 0, 4); + if (cnt != 4) return null; + long res = (this.iBBuf[0] & 0xff) << 8; + res |= (this.iBBuf[1] & 0xff) << 8; + res |= (this.iBBuf[2] & 0xff) << 8; + res |= this.iBBuf[3] & 0xff; + return Long.valueOf(res); + } + + private String readRawString() throws ServiceLocationException, IOException { + Integer lenInt = doRead16(); + if (lenInt == null) return null; + int len = lenInt.intValue(); + if (len <= 0) return null; + byte[] bytes = new byte[len]; + int read = this.iInStr.read(bytes, 0, len); + if (read != len) return null; + try { + return new String(bytes, SLPDefaults.ENCODING); + } catch (UnsupportedEncodingException e) { + throw new ServiceLocationException(ServiceLocationException.INTERNAL_SYSTEM_ERROR, e); + } + } + + private void readStringCollection(Collection pCol) throws ServiceLocationException, + IOException { + String rawListStr = readRawString(); + if (rawListStr == null) return; + StringTokenizer tokenizer = new StringTokenizer(rawListStr, ","); + while (tokenizer.hasMoreElements()) + pCol.add(Convert.unescape(tokenizer.nextToken())); + } + + private static class AttrListParser { + + private int iPos = 0; + + private String iAttrListStr; + + private ArrayList iList = new ArrayList(); + + /** + * Ctor. + * + * @param pAttrListStr + * @throws ServiceLocationException + */ + public AttrListParser(String pAttrListStr) throws ServiceLocationException { + debug("attrListStr=" + pAttrListStr); + this.iAttrListStr = pAttrListStr; + String attrStr; + while ((attrStr = readEntry()) != null) { + debug("attrStr=" + attrStr); + this.iList.add(new ServiceLocationAttribute(attrStr)); + } + } + + /** + * getList + * + * @return List of ServiceLocationAttributes + */ + public List getList() { + return this.iList; + } + + /* + * ( "(" attrID "=" ( value "," )* value ")" ("," / EndOfString ) ) / + * attrID ("," / EndOfString ) + */ + private String readEntry() throws ServiceLocationException { + if (this.iAttrListStr == null) return null; + int lastIdx = this.iAttrListStr.length() - 1; + if (this.iPos == lastIdx) return null; + boolean inBlock = false; + int startPos = this.iPos; + while (true) { + char ch = this.iAttrListStr.charAt(this.iPos); + if (ch == '(') { + if (inBlock || this.iPos != startPos) throw new ServiceLocationException( + ServiceLocationException.PARSE_ERROR, invalidChar('(')); + inBlock = true; + } else if (ch == ')') { + if (!inBlock) throw new ServiceLocationException( + ServiceLocationException.PARSE_ERROR, invalidChar(')')); + if (this.iPos == lastIdx) return this.iAttrListStr.substring(startPos); + inBlock = false; + } else { + if (inBlock) { + if (this.iPos == lastIdx) + /* + * throw new ServiceLocationException( + * ServiceLocationException.PARSE_ERROR, "There is no + * ')' for '(' !" ); + */ + return this.iAttrListStr.substring(startPos); + } else { + if (ch == ',') { + ++this.iPos; + return this.iAttrListStr.substring(startPos, this.iPos - 1); + } + if (this.iPos == lastIdx) { return this.iAttrListStr.substring(startPos); } + } + } + if (this.iPos == lastIdx) throw new ServiceLocationException( + ServiceLocationException.PARSE_ERROR, "Unexpected end of Attribute list:\n" + + this.iAttrListStr); + ++this.iPos; + } + } + + /** + * @param ch + */ + private String invalidChar(char ch) { + return "Invalid '(' character in Attribute list:\n" + this.iAttrListStr + + "\nat position: " + this.iPos; + } + + } + + /** + * @param pMsg + */ + static void debug(String pMsg) { + // System.out.println(pMsg); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/SLPMessage.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/SLPMessage.java similarity index 79% rename from src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/SLPMessage.java rename to src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/SLPMessage.java index 766b0fd..b09caa8 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/SLPMessage.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/SLPMessage.java @@ -1,223 +1,222 @@ -/* - (C) Copyright IBM Corp. 2007, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, IBM, ebak@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1804402 2007-09-28 ebak IPv6 ready SLP - * 1892103 2008-02-12 ebak SLP improvements - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.slp.internal.msg; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import org.sentrysoftware.wbem.sblim.slp.ServiceLocationException; -import org.sentrysoftware.wbem.sblim.slp.internal.SLPConfig; -import org.sentrysoftware.wbem.sblim.slp.internal.SLPDefaults; - -/** - * SLPMessage - * - */ -public abstract class SLPMessage implements FunctionIDs { - - // cache it for instance lifetime, do not parse always - private final int iMaxDatagramSize = SLPConfig.getGlobalCfg().getMTU(); - - private MsgHeader iHeader; - - /** - * Ctor. - * - * @param pFunctionID - */ - public SLPMessage(int pFunctionID) { - this(pFunctionID, Util.getLangTag(SLPDefaults.LOCALE)); - } - - /** - * Ctor. - * - * @param pFunctionID - * @param pLangTag - */ - public SLPMessage(int pFunctionID, String pLangTag) { - this(new MsgHeader(MsgHeader.VERSION, pFunctionID, pLangTag, false, pFunctionID == SRV_REG, - false, 0)); - } - - /** - * Ctor. - * - * @param pHeader - */ - public SLPMessage(MsgHeader pHeader) { - this.iHeader = pHeader; - } - - /** - * getHeader - * - * @return MsgHeader - */ - public MsgHeader getHeader() { - return this.iHeader; - } - - /** - * getVersion - * - * @return int - */ - public int getVersion() { - return this.iHeader.getVersion(); - } - - /** - * getFunctionID - * - * @return int - */ - public int getFunctionID() { - return this.iHeader.getFunctionID(); - } - - /** - * getLangTag - * - * @return String - */ - public String getLangTag() { - return this.iHeader.getLangTag(); - } - - /** - * overflows - * - * @return boolean - */ - public boolean overflows() { - return this.iHeader.overflows(); - } - - /** - * fresh - * - * @return boolean - */ - public boolean fresh() { - return this.iHeader.fresh(); - } - - /** - * multicast - * - * @return boolean - */ - public boolean multicast() { - return this.iHeader.multicast(); - } - - /** - * getXID - * - * @return int - */ - public int getXID() { - return this.iHeader.getXID(); - } - - /** - * @see MsgHeader#setXID(int) - * @param pXID - */ - public void setXID(int pXID) { - this.iHeader.setXID(pXID); - } - - /** - * serialize - * - * @param pSetMulticastFlag - * @param pDatagramLimited - * @param pKeepXID - * @return byte[] - * @throws ServiceLocationException - */ - public byte[] serialize(boolean pSetMulticastFlag, boolean pDatagramLimited, boolean pKeepXID) - throws ServiceLocationException { - return serialize(pSetMulticastFlag, pDatagramLimited, pKeepXID, null); - } - - /** - * serialize - * - * @param pSetMulticastFlag - * @param pDatagramLimited - * @param pKeepXID - * @param pOption - * - passed to the serializeBody() method of the inherited - * classes - * @return byte[] - * @throws ServiceLocationException - */ - public byte[] serialize(boolean pSetMulticastFlag, boolean pDatagramLimited, boolean pKeepXID, - SerializeOption pOption) throws ServiceLocationException { - SLPOutputStream bodyOutStr = new SLPOutputStream(pDatagramLimited ? this.iMaxDatagramSize - - this.iHeader.getSize() : -1); - boolean fit = serializeBody(bodyOutStr, pOption); - byte[] bodyBytes = bodyOutStr.toByteArray(); - byte[] headerBytes = this.iHeader.serialize(bodyBytes.length, !fit, pSetMulticastFlag, - pKeepXID); - byte[] bytes = new byte[headerBytes.length + bodyBytes.length]; - System.arraycopy(headerBytes, 0, bytes, 0, headerBytes.length); - System.arraycopy(bodyBytes, 0, bytes, headerBytes.length, bodyBytes.length); - return bytes; - } - - /** - * @return true if all data is written into pOStr (all data fits into size - * limit) - */ - protected abstract boolean serializeBody(SLPOutputStream pOutStr, SerializeOption pOption) - throws ServiceLocationException; - - @Override - public String toString() { - return super.toString() + " " + getXID(); - } - -} +/* + (C) Copyright IBM Corp. 2007, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, IBM, ebak@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1804402 2007-09-28 ebak IPv6 ready SLP + * 1892103 2008-02-12 ebak SLP improvements + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.slp.internal.msg; + +import org.metricshub.wbem.sblim.slp.internal.SLPConfig; +import org.metricshub.wbem.sblim.slp.internal.SLPDefaults; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import org.metricshub.wbem.sblim.slp.ServiceLocationException; + +/** + * SLPMessage + * + */ +public abstract class SLPMessage implements FunctionIDs { + + // cache it for instance lifetime, do not parse always + private final int iMaxDatagramSize = SLPConfig.getGlobalCfg().getMTU(); + + private MsgHeader iHeader; + + /** + * Ctor. + * + * @param pFunctionID + */ + public SLPMessage(int pFunctionID) { + this(pFunctionID, Util.getLangTag(SLPDefaults.LOCALE)); + } + + /** + * Ctor. + * + * @param pFunctionID + * @param pLangTag + */ + public SLPMessage(int pFunctionID, String pLangTag) { + this(new MsgHeader(MsgHeader.VERSION, pFunctionID, pLangTag, false, pFunctionID == SRV_REG, + false, 0)); + } + + /** + * Ctor. + * + * @param pHeader + */ + public SLPMessage(MsgHeader pHeader) { + this.iHeader = pHeader; + } + + /** + * getHeader + * + * @return MsgHeader + */ + public MsgHeader getHeader() { + return this.iHeader; + } + + /** + * getVersion + * + * @return int + */ + public int getVersion() { + return this.iHeader.getVersion(); + } + + /** + * getFunctionID + * + * @return int + */ + public int getFunctionID() { + return this.iHeader.getFunctionID(); + } + + /** + * getLangTag + * + * @return String + */ + public String getLangTag() { + return this.iHeader.getLangTag(); + } + + /** + * overflows + * + * @return boolean + */ + public boolean overflows() { + return this.iHeader.overflows(); + } + + /** + * fresh + * + * @return boolean + */ + public boolean fresh() { + return this.iHeader.fresh(); + } + + /** + * multicast + * + * @return boolean + */ + public boolean multicast() { + return this.iHeader.multicast(); + } + + /** + * getXID + * + * @return int + */ + public int getXID() { + return this.iHeader.getXID(); + } + + /** + * @see MsgHeader#setXID(int) + * @param pXID + */ + public void setXID(int pXID) { + this.iHeader.setXID(pXID); + } + + /** + * serialize + * + * @param pSetMulticastFlag + * @param pDatagramLimited + * @param pKeepXID + * @return byte[] + * @throws ServiceLocationException + */ + public byte[] serialize(boolean pSetMulticastFlag, boolean pDatagramLimited, boolean pKeepXID) + throws ServiceLocationException { + return serialize(pSetMulticastFlag, pDatagramLimited, pKeepXID, null); + } + + /** + * serialize + * + * @param pSetMulticastFlag + * @param pDatagramLimited + * @param pKeepXID + * @param pOption + * - passed to the serializeBody() method of the inherited + * classes + * @return byte[] + * @throws ServiceLocationException + */ + public byte[] serialize(boolean pSetMulticastFlag, boolean pDatagramLimited, boolean pKeepXID, + SerializeOption pOption) throws ServiceLocationException { + SLPOutputStream bodyOutStr = new SLPOutputStream(pDatagramLimited ? this.iMaxDatagramSize + - this.iHeader.getSize() : -1); + boolean fit = serializeBody(bodyOutStr, pOption); + byte[] bodyBytes = bodyOutStr.toByteArray(); + byte[] headerBytes = this.iHeader.serialize(bodyBytes.length, !fit, pSetMulticastFlag, + pKeepXID); + byte[] bytes = new byte[headerBytes.length + bodyBytes.length]; + System.arraycopy(headerBytes, 0, bytes, 0, headerBytes.length); + System.arraycopy(bodyBytes, 0, bytes, headerBytes.length, bodyBytes.length); + return bytes; + } + + /** + * @return true if all data is written into pOStr (all data fits into size + * limit) + */ + protected abstract boolean serializeBody(SLPOutputStream pOutStr, SerializeOption pOption) + throws ServiceLocationException; + + @Override + public String toString() { + return super.toString() + " " + getXID(); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/SLPOutputStream.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/SLPOutputStream.java similarity index 86% rename from src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/SLPOutputStream.java rename to src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/SLPOutputStream.java index 56ef272..e4ba0f6 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/SLPOutputStream.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/SLPOutputStream.java @@ -1,442 +1,440 @@ -/* - (C) Copyright IBM Corp. 2007, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, IBM, ebak@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1804402 2007-09-28 ebak IPv6 ready SLP - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2210455 2008-10-30 blaschke-oss Enhance javadoc, fix potential null pointers - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2797696 2009-05-27 raman_arora Input files use unsafe operations - */ - -package org.sentrysoftware.wbem.sblim.slp.internal.msg; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.ByteArrayOutputStream; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.sentrysoftware.wbem.sblim.slp.ServiceLocationAttribute; -import org.sentrysoftware.wbem.sblim.slp.ServiceType; -import org.sentrysoftware.wbem.sblim.slp.ServiceURL; -import org.sentrysoftware.wbem.sblim.slp.internal.AttributeHandler; -import org.sentrysoftware.wbem.sblim.slp.internal.Convert; -import org.sentrysoftware.wbem.sblim.slp.internal.TRC; - -/** - * SLPOutputStream helps the building of SLP message bytes - * - */ -public class SLPOutputStream { - - private static final int MAX_FIELD_SIZE = 65535; - - private static final byte[] EMPTY_BYTES = new byte[0]; - - private ByteArrayOutputStream iOutStr = new ByteArrayOutputStream(); - - private int iStreamLimit; - - /** - * Ctor. - */ - public SLPOutputStream() { - this(Integer.MAX_VALUE); - } - - /** - * Ctor. - * - * @param pStreamLimit - */ - public SLPOutputStream(int pStreamLimit) { - this.iStreamLimit = pStreamLimit <= 0 ? Integer.MAX_VALUE : pStreamLimit; - } - - /** - * size - * - * @return int - */ - public int size() { - return this.iOutStr.size(); - } - - /** - * freeSpace - * - * @return int - */ - public int freeSpace() { - return this.iStreamLimit - this.iOutStr.size(); - } - - /** - * toByteArray - * - * @return byte[] - */ - public byte[] toByteArray() { - return this.iOutStr.toByteArray(); - } - - /** - * write - * - * @param pBytes - * @return boolean - */ - public boolean write(byte[] pBytes) { - if (freeSpace() < pBytes.length) return false; - writeNoChk(pBytes); - return true; - } - - /** - * write - * - * @param pServType - * @return boolean - */ - public boolean write(ServiceType pServType) { - if (pServType == null) return write((String) null); - return write(pServType.toString()); - } - - /** - * URL_HDR_LENGTH - */ - public static final int URL_HDR_LENGTH = 6; - - /* - * 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | - * Reserved | Lifetime | URL Length | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |URL - * len, contd.| URL (variable length) \ - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |# of - * URL auths | Auth. blocks (if any) \ - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - */ - /** - * @param pURL - * @return boolean - */ - public boolean write(ServiceURL pURL) { - // URL strings in URL entries are not encoded - String urlStr = pURL.toString(); - byte[] urlStrBytes = Convert.getBytes(urlStr); - if (freeSpace() < URL_HDR_LENGTH + urlStrBytes.length) return false; - writeNoChk8(0); - writeNoChk16(pURL.getLifetime()); - writeNoChk16(urlStrBytes.length); - writeNoChk(urlStrBytes); - writeNoChk8(0); - return true; - } - - /** - * writeURLList - * - * @param pURLList - * @return boolean - */ - @SuppressWarnings("null") - public boolean writeURLList(List pURLList) { - int cnt = pURLList == null ? 0 : pURLList.size(); - if (cnt == 0) return write16(cnt); - SLPOutputStream tmpStr = new SLPOutputStream(); - int i; - for (i = 0; i < cnt; i++) { - tmpStr.write((ServiceURL) pURLList.get(i)); - if (freeSpace() < tmpStr.size() + 2) break; - } - writeNoChk16(i); - writeNoChk(tmpStr.toByteArray()); - return i == cnt; - } - - /** - * writeServTypeList - * - * @param pServTypeList - * @return boolean - */ - public boolean writeServTypeList(List pServTypeList) { - return writeServTypeList(pServTypeList == null ? null : pServTypeList.iterator()); - } - - /** - * writeServTypeList - * - * @param pServTypeItr - * @return boolean - */ - public boolean writeServTypeList(Iterator pServTypeItr) { - if (pServTypeItr == null) return writeStringList((Iterator) null); - ArrayList servTypeList = new ArrayList(); - while (pServTypeItr.hasNext()) - servTypeList.add(((ServiceType) pServTypeItr.next()).toString()); - return writeStringList(servTypeList); - } - - /** - * writeAttributeList - * - * @param pAttrList - * @return boolean - */ - public boolean writeAttributeList(List pAttrList) { - return writeAttributeList(pAttrList == null ? null : pAttrList.iterator()); - } - - /** - * writeAttributeList - * - * @param pAttrItr - * @return boolean - */ - public boolean writeAttributeList(Iterator pAttrItr) { - if (pAttrItr == null) return writeStringList((Iterator) null); - ArrayList attrStrList = new ArrayList(); - while (pAttrItr.hasNext()) - attrStrList.add(AttributeHandler - .buildString((ServiceLocationAttribute) pAttrItr.next())); - return writeStringList(attrStrList, null); - } - - /** - * # of AttrAuths |(if present) Attribute Authentication Blocks... - * - * @param pAuthBlockList - * @return boolean - */ - public boolean writeAuthBlockList(List pAuthBlockList) { - int cnt = pAuthBlockList == null ? 0 : pAuthBlockList.size(); - if (cnt != 0) TRC - .error("Handling of non empty authentication block list is not implemented!"); - return write8(0); - } - - /** - * write - * - * @param pStr - * @return boolean - */ - public boolean write(String pStr) { - return write(pStr, Convert.DEFAULT_RESERVED); - } - - /** - * write - * - * @param pStr - * @param pReservedChars - * @return boolean - */ - public boolean write(String pStr, String pReservedChars) { - byte[] bytes = pStr == null ? EMPTY_BYTES : Convert.getBytes(Convert.escape(pStr, - pReservedChars)); - if (bytes.length > MAX_FIELD_SIZE) return false; - if (freeSpace() < bytes.length + 2) return false; - writeNoChk16(bytes.length); - writeNoChk(bytes); - return true; - } - - /** - * writeStringList - * - * @param pStrList - * @return boolean - */ - public boolean writeStringList(List pStrList) { - return writeStringList(pStrList == null ? null : pStrList.iterator()); - } - - /** - * writeStringList - * - * @param pStrListItr - * @return boolean - */ - public boolean writeStringList(Iterator pStrListItr) { - return writeStringList(pStrListItr, Convert.DEFAULT_RESERVED); - } - - /** - * writeStringList - * - * @param pStrList - * @param pReservedChars - * @return boolean - */ - public boolean writeStringList(List pStrList, String pReservedChars) { - return writeStringList(pStrList == null ? null : pStrList.iterator(), pReservedChars); - } - - /** - * writeStringList - * - * @param pStrListItr - * @param pReservedChars - * @return true if all list items are written to the stream, otherwise false - */ - public boolean writeStringList(Iterator pStrListItr, String pReservedChars) { - ByteArrayOutputStream listByteStr = new ByteArrayOutputStream(); - boolean first = true; - boolean allWritten = true; - if (pStrListItr != null) while (pStrListItr.hasNext()) { - StringBuffer strBuf = new StringBuffer(); - String listItemStr = Convert.escape(pStrListItr.next(), pReservedChars); - if (first) { - first = false; - } else { - strBuf.append(','); - } - strBuf.append(listItemStr); - byte[] listItemBytes = Convert.getBytes(strBuf.toString()); - int currentSize = listByteStr.size() + listItemBytes.length; - if (currentSize > MAX_FIELD_SIZE || currentSize + 2 > freeSpace()) { - allWritten = false; - break; - } - listByteStr.write(listItemBytes, 0, listItemBytes.length); - } - byte[] listBytes = listByteStr.toByteArray(); - writeNoChk16(listBytes.length); - writeNoChk(listBytes); - return allWritten; - } - - /** - * write8 - * - * @param pValue - * @return boolean - */ - public boolean write8(int pValue) { - if (freeSpace() < 1) return false; - writeNoChk8(pValue); - return true; - } - - /** - * write16 - * - * @param pValue - * @return boolean - */ - public boolean write16(int pValue) { - if (freeSpace() < 2) return false; - writeNoChk16(pValue); - return true; - } - - /** - * write24 - * - * @param pValue - * @return boolean - */ - public boolean write24(int pValue) { - if (freeSpace() < 3) return false; - writeNoChk24(pValue); - return true; - } - - /** - * write32 - * - * @param pValue - * @return boolean - */ - public boolean write32(long pValue) { - if (freeSpace() < 4) return false; - writeNoChk32(pValue); - return true; - } - - /** - * writeNoChk - * - * @param pBytes - */ - public void writeNoChk(byte[] pBytes) { - this.iOutStr.write(pBytes, 0, pBytes.length); - } - - /** - * writeNoChk8 - * - * @param pValue - */ - public void writeNoChk8(int pValue) { - this.iOutStr.write(pValue); - } - - /** - * writeNoChk16 - * - * @param pValue - */ - public void writeNoChk16(int pValue) { - this.iOutStr.write((pValue >> 8) & 0xff); - this.iOutStr.write((pValue & 0xff)); - } - - /** - * writeNoChk24 - * - * @param pValue - */ - public void writeNoChk24(int pValue) { - this.iOutStr.write((pValue >> 16) & 0xff); - writeNoChk16(pValue); - } - - /** - * writeNoChk32 - * - * @param pValue - */ - public void writeNoChk32(long pValue) { - this.iOutStr.write((int) ((pValue >> 24) & 0xff)); - writeNoChk24((int) pValue); - } -} +/* + (C) Copyright IBM Corp. 2007, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, IBM, ebak@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1804402 2007-09-28 ebak IPv6 ready SLP + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2210455 2008-10-30 blaschke-oss Enhance javadoc, fix potential null pointers + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2797696 2009-05-27 raman_arora Input files use unsafe operations + */ + +package org.metricshub.wbem.sblim.slp.internal.msg; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.ByteArrayOutputStream; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.metricshub.wbem.sblim.slp.ServiceLocationAttribute; +import org.metricshub.wbem.sblim.slp.ServiceType; +import org.metricshub.wbem.sblim.slp.ServiceURL; +import org.metricshub.wbem.sblim.slp.internal.AttributeHandler; +import org.metricshub.wbem.sblim.slp.internal.Convert; +import org.metricshub.wbem.sblim.slp.internal.TRC; + +/** + * SLPOutputStream helps the building of SLP message bytes + * + */ +public class SLPOutputStream { + + private static final int MAX_FIELD_SIZE = 65535; + + private static final byte[] EMPTY_BYTES = new byte[0]; + + private ByteArrayOutputStream iOutStr = new ByteArrayOutputStream(); + + private int iStreamLimit; + + /** + * Ctor. + */ + public SLPOutputStream() { + this(Integer.MAX_VALUE); + } + + /** + * Ctor. + * + * @param pStreamLimit + */ + public SLPOutputStream(int pStreamLimit) { + this.iStreamLimit = pStreamLimit <= 0 ? Integer.MAX_VALUE : pStreamLimit; + } + + /** + * size + * + * @return int + */ + public int size() { + return this.iOutStr.size(); + } + + /** + * freeSpace + * + * @return int + */ + public int freeSpace() { + return this.iStreamLimit - this.iOutStr.size(); + } + + /** + * toByteArray + * + * @return byte[] + */ + public byte[] toByteArray() { + return this.iOutStr.toByteArray(); + } + + /** + * write + * + * @param pBytes + * @return boolean + */ + public boolean write(byte[] pBytes) { + if (freeSpace() < pBytes.length) return false; + writeNoChk(pBytes); + return true; + } + + /** + * write + * + * @param pServType + * @return boolean + */ + public boolean write(ServiceType pServType) { + if (pServType == null) return write((String) null); + return write(pServType.toString()); + } + + /** + * URL_HDR_LENGTH + */ + public static final int URL_HDR_LENGTH = 6; + + /* + * 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | + * Reserved | Lifetime | URL Length | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |URL + * len, contd.| URL (variable length) \ + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |# of + * URL auths | Auth. blocks (if any) \ + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + */ + /** + * @param pURL + * @return boolean + */ + public boolean write(ServiceURL pURL) { + // URL strings in URL entries are not encoded + String urlStr = pURL.toString(); + byte[] urlStrBytes = Convert.getBytes(urlStr); + if (freeSpace() < URL_HDR_LENGTH + urlStrBytes.length) return false; + writeNoChk8(0); + writeNoChk16(pURL.getLifetime()); + writeNoChk16(urlStrBytes.length); + writeNoChk(urlStrBytes); + writeNoChk8(0); + return true; + } + + /** + * writeURLList + * + * @param pURLList + * @return boolean + */ + @SuppressWarnings("null") + public boolean writeURLList(List pURLList) { + int cnt = pURLList == null ? 0 : pURLList.size(); + if (cnt == 0) return write16(cnt); + SLPOutputStream tmpStr = new SLPOutputStream(); + int i; + for (i = 0; i < cnt; i++) { + tmpStr.write((ServiceURL) pURLList.get(i)); + if (freeSpace() < tmpStr.size() + 2) break; + } + writeNoChk16(i); + writeNoChk(tmpStr.toByteArray()); + return i == cnt; + } + + /** + * writeServTypeList + * + * @param pServTypeList + * @return boolean + */ + public boolean writeServTypeList(List pServTypeList) { + return writeServTypeList(pServTypeList == null ? null : pServTypeList.iterator()); + } + + /** + * writeServTypeList + * + * @param pServTypeItr + * @return boolean + */ + public boolean writeServTypeList(Iterator pServTypeItr) { + if (pServTypeItr == null) return writeStringList((Iterator) null); + ArrayList servTypeList = new ArrayList(); + while (pServTypeItr.hasNext()) + servTypeList.add(((ServiceType) pServTypeItr.next()).toString()); + return writeStringList(servTypeList); + } + + /** + * writeAttributeList + * + * @param pAttrList + * @return boolean + */ + public boolean writeAttributeList(List pAttrList) { + return writeAttributeList(pAttrList == null ? null : pAttrList.iterator()); + } + + /** + * writeAttributeList + * + * @param pAttrItr + * @return boolean + */ + public boolean writeAttributeList(Iterator pAttrItr) { + if (pAttrItr == null) return writeStringList((Iterator) null); + ArrayList attrStrList = new ArrayList(); + while (pAttrItr.hasNext()) + attrStrList.add(AttributeHandler + .buildString((ServiceLocationAttribute) pAttrItr.next())); + return writeStringList(attrStrList, null); + } + + /** + * # of AttrAuths |(if present) Attribute Authentication Blocks... + * + * @param pAuthBlockList + * @return boolean + */ + public boolean writeAuthBlockList(List pAuthBlockList) { + int cnt = pAuthBlockList == null ? 0 : pAuthBlockList.size(); + if (cnt != 0) TRC + .error("Handling of non empty authentication block list is not implemented!"); + return write8(0); + } + + /** + * write + * + * @param pStr + * @return boolean + */ + public boolean write(String pStr) { + return write(pStr, Convert.DEFAULT_RESERVED); + } + + /** + * write + * + * @param pStr + * @param pReservedChars + * @return boolean + */ + public boolean write(String pStr, String pReservedChars) { + byte[] bytes = pStr == null ? EMPTY_BYTES : Convert.getBytes(Convert.escape(pStr, + pReservedChars)); + if (bytes.length > MAX_FIELD_SIZE) return false; + if (freeSpace() < bytes.length + 2) return false; + writeNoChk16(bytes.length); + writeNoChk(bytes); + return true; + } + + /** + * writeStringList + * + * @param pStrList + * @return boolean + */ + public boolean writeStringList(List pStrList) { + return writeStringList(pStrList == null ? null : pStrList.iterator()); + } + + /** + * writeStringList + * + * @param pStrListItr + * @return boolean + */ + public boolean writeStringList(Iterator pStrListItr) { + return writeStringList(pStrListItr, Convert.DEFAULT_RESERVED); + } + + /** + * writeStringList + * + * @param pStrList + * @param pReservedChars + * @return boolean + */ + public boolean writeStringList(List pStrList, String pReservedChars) { + return writeStringList(pStrList == null ? null : pStrList.iterator(), pReservedChars); + } + + /** + * writeStringList + * + * @param pStrListItr + * @param pReservedChars + * @return true if all list items are written to the stream, otherwise false + */ + public boolean writeStringList(Iterator pStrListItr, String pReservedChars) { + ByteArrayOutputStream listByteStr = new ByteArrayOutputStream(); + boolean first = true; + boolean allWritten = true; + if (pStrListItr != null) while (pStrListItr.hasNext()) { + StringBuffer strBuf = new StringBuffer(); + String listItemStr = Convert.escape(pStrListItr.next(), pReservedChars); + if (first) { + first = false; + } else { + strBuf.append(','); + } + strBuf.append(listItemStr); + byte[] listItemBytes = Convert.getBytes(strBuf.toString()); + int currentSize = listByteStr.size() + listItemBytes.length; + if (currentSize > MAX_FIELD_SIZE || currentSize + 2 > freeSpace()) { + allWritten = false; + break; + } + listByteStr.write(listItemBytes, 0, listItemBytes.length); + } + byte[] listBytes = listByteStr.toByteArray(); + writeNoChk16(listBytes.length); + writeNoChk(listBytes); + return allWritten; + } + + /** + * write8 + * + * @param pValue + * @return boolean + */ + public boolean write8(int pValue) { + if (freeSpace() < 1) return false; + writeNoChk8(pValue); + return true; + } + + /** + * write16 + * + * @param pValue + * @return boolean + */ + public boolean write16(int pValue) { + if (freeSpace() < 2) return false; + writeNoChk16(pValue); + return true; + } + + /** + * write24 + * + * @param pValue + * @return boolean + */ + public boolean write24(int pValue) { + if (freeSpace() < 3) return false; + writeNoChk24(pValue); + return true; + } + + /** + * write32 + * + * @param pValue + * @return boolean + */ + public boolean write32(long pValue) { + if (freeSpace() < 4) return false; + writeNoChk32(pValue); + return true; + } + + /** + * writeNoChk + * + * @param pBytes + */ + public void writeNoChk(byte[] pBytes) { + this.iOutStr.write(pBytes, 0, pBytes.length); + } + + /** + * writeNoChk8 + * + * @param pValue + */ + public void writeNoChk8(int pValue) { + this.iOutStr.write(pValue); + } + + /** + * writeNoChk16 + * + * @param pValue + */ + public void writeNoChk16(int pValue) { + this.iOutStr.write((pValue >> 8) & 0xff); + this.iOutStr.write((pValue & 0xff)); + } + + /** + * writeNoChk24 + * + * @param pValue + */ + public void writeNoChk24(int pValue) { + this.iOutStr.write((pValue >> 16) & 0xff); + writeNoChk16(pValue); + } + + /** + * writeNoChk32 + * + * @param pValue + */ + public void writeNoChk32(long pValue) { + this.iOutStr.write((int) ((pValue >> 24) & 0xff)); + writeNoChk24((int) pValue); + } +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/SerializeOption.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/SerializeOption.java similarity index 61% rename from src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/SerializeOption.java rename to src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/SerializeOption.java index 1b63262..40a1627 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/SerializeOption.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/SerializeOption.java @@ -1,56 +1,54 @@ -/* - (C) Copyright IBM Corp. 2007, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, IBM, ebak@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1892103 2008-02-12 ebak SLP improvements - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.slp.internal.msg; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -/** - * Inherited classes of SerializeOption provide additional serialization - * parameters for the inherited SLPMessage classes. - * - */ -public abstract class SerializeOption { - - /* - * Inherited classes add the methods. - */ - -} +/* + (C) Copyright IBM Corp. 2007, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, IBM, ebak@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1892103 2008-02-12 ebak SLP improvements + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.slp.internal.msg; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +/** + * Inherited classes of SerializeOption provide additional serialization + * parameters for the inherited SLPMessage classes. + * + */ +public abstract class SerializeOption { + + /* + * Inherited classes add the methods. + */ + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/ServiceAcknowledgment.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/ServiceAcknowledgment.java similarity index 73% rename from src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/ServiceAcknowledgment.java rename to src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/ServiceAcknowledgment.java index 2c8f445..64b1769 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/ServiceAcknowledgment.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/ServiceAcknowledgment.java @@ -1,122 +1,120 @@ -/* - (C) Copyright IBM Corp. 2007, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, IBM, ebak@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1804402 2007-09-28 ebak IPv6 ready SLP - * 1892103 2008-02-12 ebak SLP improvements - * 1949918 2008-04-08 raman_arora Malformed service URL crashes SLP discovery - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - */ - -package org.sentrysoftware.wbem.sblim.slp.internal.msg; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.IOException; -import java.util.Iterator; - -import org.sentrysoftware.wbem.sblim.slp.ServiceLocationException; - -/** - * ServiceAcknowledgment message - * - */ -public class ServiceAcknowledgment extends ReplyMessage { - - /** - * parse - * - * @param pHdr - * @param pInStr - * @return SLPMessage - * @throws ServiceLocationException - * @throws IOException - */ - public static SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) - throws ServiceLocationException, IOException { - return new ServiceAcknowledgment(pHdr, pInStr.read16()); - } - - /** - * Ctor. - * - * @param pErrorCode - */ - public ServiceAcknowledgment(int pErrorCode) { - super(SRV_ACK, pErrorCode); - } - - /** - * Ctor. - * - * @param pLangTag - * @param pErrorCode - */ - public ServiceAcknowledgment(String pLangTag, int pErrorCode) { - super(SRV_ACK, pLangTag, pErrorCode); - } - - /** - * Ctor. - * - * @param pHeader - * @param pErrorCode - */ - public ServiceAcknowledgment(MsgHeader pHeader, int pErrorCode) { - super(pHeader, pErrorCode); - } - - @Override - public Iterator getResultIterator() { - // this message doesn't have iterable results - return null; - } - - /** - * @param pOption - */ - @Override - protected boolean serializeBody(SLPOutputStream pOutStr, SerializeOption pOption) { - return pOutStr.write16(getErrorCode()); - } - - @Override - public Iterator getExceptionIterator() { - // this message doesn't have exception table - return null; - } - -} +/* + (C) Copyright IBM Corp. 2007, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, IBM, ebak@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1804402 2007-09-28 ebak IPv6 ready SLP + * 1892103 2008-02-12 ebak SLP improvements + * 1949918 2008-04-08 raman_arora Malformed service URL crashes SLP discovery + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + */ + +package org.metricshub.wbem.sblim.slp.internal.msg; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.IOException; +import java.util.Iterator; + +import org.metricshub.wbem.sblim.slp.ServiceLocationException; + +/** + * ServiceAcknowledgment message + * + */ +public class ServiceAcknowledgment extends ReplyMessage { + + /** + * parse + * + * @param pHdr + * @param pInStr + * @return SLPMessage + * @throws ServiceLocationException + * @throws IOException + */ + public static SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) + throws ServiceLocationException, IOException { + return new ServiceAcknowledgment(pHdr, pInStr.read16()); + } + + /** + * Ctor. + * + * @param pErrorCode + */ + public ServiceAcknowledgment(int pErrorCode) { + super(SRV_ACK, pErrorCode); + } + + /** + * Ctor. + * + * @param pLangTag + * @param pErrorCode + */ + public ServiceAcknowledgment(String pLangTag, int pErrorCode) { + super(SRV_ACK, pLangTag, pErrorCode); + } + + /** + * Ctor. + * + * @param pHeader + * @param pErrorCode + */ + public ServiceAcknowledgment(MsgHeader pHeader, int pErrorCode) { + super(pHeader, pErrorCode); + } + + @Override + public Iterator getResultIterator() { + // this message doesn't have iterable results + return null; + } + + /** + * @param pOption + */ + @Override + protected boolean serializeBody(SLPOutputStream pOutStr, SerializeOption pOption) { + return pOutStr.write16(getErrorCode()); + } + + @Override + public Iterator getExceptionIterator() { + // this message doesn't have exception table + return null; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/ServiceDeregistration.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/ServiceDeregistration.java similarity index 80% rename from src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/ServiceDeregistration.java rename to src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/ServiceDeregistration.java index 7054afa..0b2b58e 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/ServiceDeregistration.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/ServiceDeregistration.java @@ -1,167 +1,165 @@ -/* - (C) Copyright IBM Corp. 2007, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, IBM, ebak@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1804402 2007-09-28 ebak IPv6 ready SLP - * 1892103 2008-02-12 ebak SLP improvements - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - */ - -package org.sentrysoftware.wbem.sblim.slp.internal.msg; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.IOException; -import java.util.List; - -import org.sentrysoftware.wbem.sblim.slp.ServiceLocationException; -import org.sentrysoftware.wbem.sblim.slp.ServiceURL; - -/* - * 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Service - * Location header (function = SrvDeReg = 4) | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Length of - * | \ - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | URL Entry \ - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Length of - * | \ - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ The - * is a of attribute tags to deregister as defined in - * Section 9.4. If no is present, the SrvDeReg deregisters the - * service in all languages it has been registered in. If the is - * present, the SrvDeReg deregisters the attributes whose tags are listed in the - * tag spec. Services registered with Authentication Blocks MUST NOT include a - * in a SrvDeReg message: A DA will respond with an - * AUTHENTICATION_FAILED error in this case. - */ - -/** - * ServiceDeregistration message - * - */ -public class ServiceDeregistration extends SLPMessage { - - private List iScopeList; - - private ServiceURL iURL; - - private List iTagList; - - /** - * parse - * - * @param pHdr - * @param pInStr - * @return SLPMessage - * @throws ServiceLocationException - * @throws IOException - */ - public static SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) - throws ServiceLocationException, IOException { - return new ServiceDeregistration(pHdr, pInStr.readStringList(), pInStr.readURL(), pInStr - .readStringList()); - } - - /** - * Ctor. - * - * @param pScopeList - * - list of scope strings - * @param pURL - * @param pTagList - */ - public ServiceDeregistration(List pScopeList, ServiceURL pURL, List pTagList) { - super(SRV_DEREG); - init(pScopeList, pURL, pTagList); - } - - /** - * Ctor. - * - * @param pLangTag - * @param pScopeList - * - list of scope strings - * @param pURL - * @param pTagList - */ - public ServiceDeregistration(String pLangTag, List pScopeList, ServiceURL pURL, - List pTagList) { - super(SRV_DEREG, pLangTag); - init(pScopeList, pURL, pTagList); - } - - /** - * Ctor. - * - * @param pHeader - * @param pScopeList - * - list of scope strings - * @param pURL - * @param pTagList - */ - public ServiceDeregistration(MsgHeader pHeader, List pScopeList, ServiceURL pURL, - List pTagList) { - super(pHeader); - init(pScopeList, pURL, pTagList); - } - - /** - * getServiceURL - * - * @return ServiceURL - */ - public ServiceURL getServiceURL() { - return this.iURL; - } - - /** - * @param pOption - */ - @Override - protected boolean serializeBody(SLPOutputStream pOutStr, SerializeOption pOption) { - return pOutStr.writeStringList(this.iScopeList) && pOutStr.write(this.iURL) - && pOutStr.writeStringList(this.iTagList); - } - - private void init(List pScopeList, ServiceURL pURL, List pTagList) { - this.iScopeList = pScopeList; - this.iURL = pURL; - this.iTagList = pTagList; - } - -} +/* + (C) Copyright IBM Corp. 2007, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, IBM, ebak@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1804402 2007-09-28 ebak IPv6 ready SLP + * 1892103 2008-02-12 ebak SLP improvements + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + */ + +package org.metricshub.wbem.sblim.slp.internal.msg; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.IOException; +import java.util.List; + +import org.metricshub.wbem.sblim.slp.ServiceURL; +import org.metricshub.wbem.sblim.slp.ServiceLocationException; + +/* + * 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Service + * Location header (function = SrvDeReg = 4) | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Length of + * | \ + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | URL Entry \ + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Length of + * | \ + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ The + * is a of attribute tags to deregister as defined in + * Section 9.4. If no is present, the SrvDeReg deregisters the + * service in all languages it has been registered in. If the is + * present, the SrvDeReg deregisters the attributes whose tags are listed in the + * tag spec. Services registered with Authentication Blocks MUST NOT include a + * in a SrvDeReg message: A DA will respond with an + * AUTHENTICATION_FAILED error in this case. + */ + +/** + * ServiceDeregistration message + * + */ +public class ServiceDeregistration extends SLPMessage { + + private List iScopeList; + + private ServiceURL iURL; + + private List iTagList; + + /** + * parse + * + * @param pHdr + * @param pInStr + * @return SLPMessage + * @throws ServiceLocationException + * @throws IOException + */ + public static SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) + throws ServiceLocationException, IOException { + return new ServiceDeregistration(pHdr, pInStr.readStringList(), pInStr.readURL(), pInStr + .readStringList()); + } + + /** + * Ctor. + * + * @param pScopeList + * - list of scope strings + * @param pURL + * @param pTagList + */ + public ServiceDeregistration(List pScopeList, ServiceURL pURL, List pTagList) { + super(SRV_DEREG); + init(pScopeList, pURL, pTagList); + } + + /** + * Ctor. + * + * @param pLangTag + * @param pScopeList + * - list of scope strings + * @param pURL + * @param pTagList + */ + public ServiceDeregistration(String pLangTag, List pScopeList, ServiceURL pURL, + List pTagList) { + super(SRV_DEREG, pLangTag); + init(pScopeList, pURL, pTagList); + } + + /** + * Ctor. + * + * @param pHeader + * @param pScopeList + * - list of scope strings + * @param pURL + * @param pTagList + */ + public ServiceDeregistration(MsgHeader pHeader, List pScopeList, ServiceURL pURL, + List pTagList) { + super(pHeader); + init(pScopeList, pURL, pTagList); + } + + /** + * getServiceURL + * + * @return ServiceURL + */ + public ServiceURL getServiceURL() { + return this.iURL; + } + + /** + * @param pOption + */ + @Override + protected boolean serializeBody(SLPOutputStream pOutStr, SerializeOption pOption) { + return pOutStr.writeStringList(this.iScopeList) && pOutStr.write(this.iURL) + && pOutStr.writeStringList(this.iTagList); + } + + private void init(List pScopeList, ServiceURL pURL, List pTagList) { + this.iScopeList = pScopeList; + this.iURL = pURL; + this.iTagList = pTagList; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/ServiceRegistration.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/ServiceRegistration.java similarity index 82% rename from src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/ServiceRegistration.java rename to src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/ServiceRegistration.java index 0a15908..db0e105 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/ServiceRegistration.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/ServiceRegistration.java @@ -1,197 +1,195 @@ -/* - (C) Copyright IBM Corp. 2007, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, IBM, ebak@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1804402 2007-09-28 ebak IPv6 ready SLP - * 1892103 2008-02-12 ebak SLP improvements - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - */ - -package org.sentrysoftware.wbem.sblim.slp.internal.msg; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.IOException; -import java.util.List; - -import org.sentrysoftware.wbem.sblim.slp.ServiceLocationAttribute; -import org.sentrysoftware.wbem.sblim.slp.ServiceLocationException; -import org.sentrysoftware.wbem.sblim.slp.ServiceURL; - -/* - * 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Service - * Location header (function = SrvReg = 3) | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | - * \ - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | length of - * service type string | \ - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | length of - * | \ - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | length of - * attr-list string | \ - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |# of - * AttrAuths |(if present) Attribute Authentication Blocks...\ - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - */ -/** - * ServiceRegistration message - * - */ -public class ServiceRegistration extends SLPMessage { - - private ServiceURL iServURL; - - private List iScopeList; - - private List iAttrList; - - private List iAuthBlockList; - - /** - * parse - * - * @param pHdr - * @param pInStr - * @return SLPMessage - * @throws ServiceLocationException - * @throws IOException - */ - public static SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) - throws ServiceLocationException, IOException { - ServiceURL url = pInStr.readURL(); - pInStr.readServiceType(); // FIXME reading dummy SrvType. Correct? - return new ServiceRegistration(pHdr, url, pInStr.readStringList(), pInStr - .readAttributeList(), pInStr.readAuthBlockList()); - } - - /** - * Ctor. - * - * @param pServURL - * @param pScopeList - * - list of scope strings - * @param pAttrList - * - list of ServiceLocationAttributes - * @param pAuthBlockList - */ - public ServiceRegistration(ServiceURL pServURL, List pScopeList, - List pAttrList, List pAuthBlockList) { - super(SRV_REG); - init(pServURL, pScopeList, pAttrList, pAuthBlockList); - } - - /** - * Ctor. - * - * @param pLangTag - * @param pServURL - * @param pScopeList - * - list of scope strings - * @param pAttrList - * - list of ServiceLocationAttributes - * @param pAuthBlockList - */ - public ServiceRegistration(String pLangTag, ServiceURL pServURL, List pScopeList, - List pAttrList, List pAuthBlockList) { - super(SRV_REG, pLangTag); - init(pServURL, pScopeList, pAttrList, pAuthBlockList); - } - - /** - * Ctor. - * - * @param pHeader - * @param pServURL - * @param pScopeList - * - list of scope strings - * @param pAttrList - * - list of ServiceLocationAttributes - * @param pAuthBlockList - */ - public ServiceRegistration(MsgHeader pHeader, ServiceURL pServURL, List pScopeList, - List pAttrList, List pAuthBlockList) { - super(pHeader); - init(pServURL, pScopeList, pAttrList, pAuthBlockList); - } - - /** - * getServiceURL - * - * @return ServiceURL - */ - public ServiceURL getServiceURL() { - return this.iServURL; - } - - /** - * getScopeList - * - * @return List - */ - public List getScopeList() { - return this.iScopeList; - } - - /** - * getAttributeList - * - * @return List - */ - public List getAttributeList() { - return this.iAttrList; - } - - /** - * @param pOption - */ - @Override - protected boolean serializeBody(SLPOutputStream pOutStr, SerializeOption pOption) { - return pOutStr.write(this.iServURL) && pOutStr.write(this.iServURL.getServiceType()) - && pOutStr.writeStringList(this.iScopeList) - && pOutStr.writeAttributeList(this.iAttrList) - && pOutStr.writeAuthBlockList(this.iAuthBlockList); - } - - private void init(ServiceURL pServURL, List pScopeList, - List pAttrList, List pAuthBlockList) { - this.iServURL = pServURL; - this.iScopeList = pScopeList; - this.iAttrList = pAttrList; - this.iAuthBlockList = pAuthBlockList; - } - -} +/* + (C) Copyright IBM Corp. 2007, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, IBM, ebak@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1804402 2007-09-28 ebak IPv6 ready SLP + * 1892103 2008-02-12 ebak SLP improvements + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + */ + +package org.metricshub.wbem.sblim.slp.internal.msg; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.IOException; +import java.util.List; + +import org.metricshub.wbem.sblim.slp.ServiceLocationAttribute; +import org.metricshub.wbem.sblim.slp.ServiceURL; +import org.metricshub.wbem.sblim.slp.ServiceLocationException; + +/* + * 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Service + * Location header (function = SrvReg = 3) | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | + * \ + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | length of + * service type string | \ + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | length of + * | \ + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | length of + * attr-list string | \ + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |# of + * AttrAuths |(if present) Attribute Authentication Blocks...\ + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + */ +/** + * ServiceRegistration message + * + */ +public class ServiceRegistration extends SLPMessage { + + private ServiceURL iServURL; + + private List iScopeList; + + private List iAttrList; + + private List iAuthBlockList; + + /** + * parse + * + * @param pHdr + * @param pInStr + * @return SLPMessage + * @throws ServiceLocationException + * @throws IOException + */ + public static SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) + throws ServiceLocationException, IOException { + ServiceURL url = pInStr.readURL(); + pInStr.readServiceType(); // FIXME reading dummy SrvType. Correct? + return new ServiceRegistration(pHdr, url, pInStr.readStringList(), pInStr + .readAttributeList(), pInStr.readAuthBlockList()); + } + + /** + * Ctor. + * + * @param pServURL + * @param pScopeList + * - list of scope strings + * @param pAttrList + * - list of ServiceLocationAttributes + * @param pAuthBlockList + */ + public ServiceRegistration(ServiceURL pServURL, List pScopeList, + List pAttrList, List pAuthBlockList) { + super(SRV_REG); + init(pServURL, pScopeList, pAttrList, pAuthBlockList); + } + + /** + * Ctor. + * + * @param pLangTag + * @param pServURL + * @param pScopeList + * - list of scope strings + * @param pAttrList + * - list of ServiceLocationAttributes + * @param pAuthBlockList + */ + public ServiceRegistration(String pLangTag, ServiceURL pServURL, List pScopeList, + List pAttrList, List pAuthBlockList) { + super(SRV_REG, pLangTag); + init(pServURL, pScopeList, pAttrList, pAuthBlockList); + } + + /** + * Ctor. + * + * @param pHeader + * @param pServURL + * @param pScopeList + * - list of scope strings + * @param pAttrList + * - list of ServiceLocationAttributes + * @param pAuthBlockList + */ + public ServiceRegistration(MsgHeader pHeader, ServiceURL pServURL, List pScopeList, + List pAttrList, List pAuthBlockList) { + super(pHeader); + init(pServURL, pScopeList, pAttrList, pAuthBlockList); + } + + /** + * getServiceURL + * + * @return ServiceURL + */ + public ServiceURL getServiceURL() { + return this.iServURL; + } + + /** + * getScopeList + * + * @return List + */ + public List getScopeList() { + return this.iScopeList; + } + + /** + * getAttributeList + * + * @return List + */ + public List getAttributeList() { + return this.iAttrList; + } + + /** + * @param pOption + */ + @Override + protected boolean serializeBody(SLPOutputStream pOutStr, SerializeOption pOption) { + return pOutStr.write(this.iServURL) && pOutStr.write(this.iServURL.getServiceType()) + && pOutStr.writeStringList(this.iScopeList) + && pOutStr.writeAttributeList(this.iAttrList) + && pOutStr.writeAuthBlockList(this.iAuthBlockList); + } + + private void init(ServiceURL pServURL, List pScopeList, + List pAttrList, List pAuthBlockList) { + this.iServURL = pServURL; + this.iScopeList = pScopeList; + this.iAttrList = pAttrList; + this.iAuthBlockList = pAuthBlockList; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/ServiceReply.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/ServiceReply.java similarity index 81% rename from src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/ServiceReply.java rename to src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/ServiceReply.java index 27a9903..0f1fedb 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/ServiceReply.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/ServiceReply.java @@ -1,185 +1,183 @@ -/* - (C) Copyright IBM Corp. 2007, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, IBM, ebak@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1804402 2007-09-28 ebak IPv6 ready SLP - * 1892103 2008-02-12 ebak SLP improvements - * 1949918 2008-04-08 raman_arora Malformed service URL crashes SLP discovery - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - */ - -package org.sentrysoftware.wbem.sblim.slp.internal.msg; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.sentrysoftware.wbem.sblim.slp.ServiceLocationException; -import org.sentrysoftware.wbem.sblim.slp.ServiceURL; - -/* - * 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Service - * Location header (function = SrvRply = 2) | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Error - * Code | URL Entry count | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ... \ - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - */ -/** - * ServiceReply message - * - */ -public class ServiceReply extends ReplyMessage { - - private List iURLEntries; - - private List iURLExceptions; - - /** - * parse - * - * @param pHdr - * @param pInStr - * @return SLPMessage - * @throws ServiceLocationException - * @throws IOException - */ - public static SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) - throws ServiceLocationException, IOException { - int errorCode = pInStr.read16(); - ArrayList urlExceptions = new ArrayList(); - List urlEntries = pInStr.readUrlList(urlExceptions); - return new ServiceReply(pHdr, errorCode, urlEntries, urlExceptions); - } - - /** - * Ctor. - * - * @param pErrorCode - * @param pURLEntries - * - list of ServiceURLs - */ - public ServiceReply(int pErrorCode, List pURLEntries) { - super(SRV_RPLY, pErrorCode); - this.iURLEntries = pURLEntries; - } - - /** - * Ctor. - * - * @param pLangTag - * @param pErrorCode - * @param pURLEntries - * - list of ServiceURLs - * @param pURLExceptions - * - list of URL Exceptions - */ - public ServiceReply(String pLangTag, int pErrorCode, List pURLEntries, - List pURLExceptions) { - super(SRV_RPLY, pLangTag, pErrorCode); - this.iURLEntries = pURLEntries; - this.iURLExceptions = pURLExceptions; - } - - /** - * Ctor. - * - * @param pHeader - * @param pErrorCode - * @param pURLEntries - * - list of ServiceURLs - * @param pURLExceptions - * - list of URL Exceptions - */ - public ServiceReply(MsgHeader pHeader, int pErrorCode, List pURLEntries, - List pURLExceptions) { - super(pHeader, pErrorCode); - this.iURLEntries = pURLEntries; - this.iURLExceptions = pURLExceptions; - } - - /** - * getResultIterator - * - * @return iterator of URL Exception list - */ - @Override - public Iterator getResultIterator() { - return this.iURLEntries == null ? null : this.iURLEntries.iterator(); - } - - /** - * getExceptionIterator - * - * @return iterator of URL Exception list - */ - @Override - public Iterator getExceptionIterator() { - return this.iURLExceptions == null ? null : this.iURLExceptions.iterator(); - } - - /** - * getURLEntries - * - * @return list of ServiceURLs - */ - public List getURLEntries() { - return this.iURLEntries; - } - - /** - * getURLExceptions - * - * @return list of URL Exceptions - */ - public List getURLExceptions() { - return this.iURLExceptions; - } - - /** - * @param pOption - */ - @Override - protected boolean serializeBody(SLPOutputStream pOutStr, SerializeOption pOption) { - return pOutStr.write16(getErrorCode()) && pOutStr.writeURLList(this.iURLEntries); - } - -} +/* + (C) Copyright IBM Corp. 2007, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, IBM, ebak@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1804402 2007-09-28 ebak IPv6 ready SLP + * 1892103 2008-02-12 ebak SLP improvements + * 1949918 2008-04-08 raman_arora Malformed service URL crashes SLP discovery + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + */ + +package org.metricshub.wbem.sblim.slp.internal.msg; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.metricshub.wbem.sblim.slp.ServiceURL; +import org.metricshub.wbem.sblim.slp.ServiceLocationException; + +/* + * 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Service + * Location header (function = SrvRply = 2) | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Error + * Code | URL Entry count | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ... \ + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + */ +/** + * ServiceReply message + * + */ +public class ServiceReply extends ReplyMessage { + + private List iURLEntries; + + private List iURLExceptions; + + /** + * parse + * + * @param pHdr + * @param pInStr + * @return SLPMessage + * @throws ServiceLocationException + * @throws IOException + */ + public static SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) + throws ServiceLocationException, IOException { + int errorCode = pInStr.read16(); + ArrayList urlExceptions = new ArrayList(); + List urlEntries = pInStr.readUrlList(urlExceptions); + return new ServiceReply(pHdr, errorCode, urlEntries, urlExceptions); + } + + /** + * Ctor. + * + * @param pErrorCode + * @param pURLEntries + * - list of ServiceURLs + */ + public ServiceReply(int pErrorCode, List pURLEntries) { + super(SRV_RPLY, pErrorCode); + this.iURLEntries = pURLEntries; + } + + /** + * Ctor. + * + * @param pLangTag + * @param pErrorCode + * @param pURLEntries + * - list of ServiceURLs + * @param pURLExceptions + * - list of URL Exceptions + */ + public ServiceReply(String pLangTag, int pErrorCode, List pURLEntries, + List pURLExceptions) { + super(SRV_RPLY, pLangTag, pErrorCode); + this.iURLEntries = pURLEntries; + this.iURLExceptions = pURLExceptions; + } + + /** + * Ctor. + * + * @param pHeader + * @param pErrorCode + * @param pURLEntries + * - list of ServiceURLs + * @param pURLExceptions + * - list of URL Exceptions + */ + public ServiceReply(MsgHeader pHeader, int pErrorCode, List pURLEntries, + List pURLExceptions) { + super(pHeader, pErrorCode); + this.iURLEntries = pURLEntries; + this.iURLExceptions = pURLExceptions; + } + + /** + * getResultIterator + * + * @return iterator of URL Exception list + */ + @Override + public Iterator getResultIterator() { + return this.iURLEntries == null ? null : this.iURLEntries.iterator(); + } + + /** + * getExceptionIterator + * + * @return iterator of URL Exception list + */ + @Override + public Iterator getExceptionIterator() { + return this.iURLExceptions == null ? null : this.iURLExceptions.iterator(); + } + + /** + * getURLEntries + * + * @return list of ServiceURLs + */ + public List getURLEntries() { + return this.iURLEntries; + } + + /** + * getURLExceptions + * + * @return list of URL Exceptions + */ + public List getURLExceptions() { + return this.iURLExceptions; + } + + /** + * @param pOption + */ + @Override + protected boolean serializeBody(SLPOutputStream pOutStr, SerializeOption pOption) { + return pOutStr.write16(getErrorCode()) && pOutStr.writeURLList(this.iURLEntries); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/ServiceRequest.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/ServiceRequest.java similarity index 83% rename from src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/ServiceRequest.java rename to src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/ServiceRequest.java index 72649d1..ecae18e 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/ServiceRequest.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/ServiceRequest.java @@ -1,189 +1,187 @@ -/* - (C) Copyright IBM Corp. 2007, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, IBM, ebak@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1804402 2007-09-28 ebak IPv6 ready SLP - * 1892103 2008-02-15 ebak SLP improvements - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - */ - -package org.sentrysoftware.wbem.sblim.slp.internal.msg; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.IOException; -import java.util.List; -import java.util.SortedSet; - -import org.sentrysoftware.wbem.sblim.slp.ServiceLocationException; -import org.sentrysoftware.wbem.sblim.slp.ServiceType; - -/* - * 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Service - * Location header (function = SrvRqst = 1) | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | length of - * | String \ - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | length of - * | String \ - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | length of - * | String \ - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | length of - * predicate string | Service Request \ - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | length of - * string | String \ - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - */ - -/* - * The string indicates a SLP SPI that the requester has been - * configured with. If this string is omitted, the responder does not include - * any Authentication Blocks in its reply. If it is included, the responder MUST - * return a reply which has an associated authentication block with the SLP SPI - * in the SrvRqst. If no replies may be returned because the SLP SPI is not - * supported, the responder returns an AUTHENTICATION_UNKNOWN error. - */ - -/** - * ServiceRequest message - * - */ -public class ServiceRequest extends RequestMessage { - - private ServiceType iServiceType; - - private String iPredicate, iSlpSpi; - - private static final int[] ALLOWED_RSPS = { SRV_RPLY, DA_ADVERT, SA_ADVERT }; - - /** - * parse - * - * @param pHdr - * @param pInStr - * @return SLPMessage - * @throws ServiceLocationException - * @throws IOException - */ - public static SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) - throws ServiceLocationException, IOException { - return new ServiceRequest(pHdr, pInStr.readStringSet(), // prevResponders - pInStr.readServiceType(), // serviceType - pInStr.readStringList(), // scopeList - pInStr.readString(), // predicate - pInStr.readString() // SlpSpi - ); - } - - /** - * Ctor. - * - * @param pLangTag - * @param pPrevResponderSet - * - set of address strings - * @param pServiceType - * @param pScopeList - * - list of scope strings - * @param pPredicate - * @param pSlpSpi - */ - public ServiceRequest(String pLangTag, SortedSet pPrevResponderSet, - ServiceType pServiceType, List pScopeList, String pPredicate, String pSlpSpi) { - super(SRV_RQST, pLangTag, pPrevResponderSet, pScopeList); - init(pServiceType, pPredicate, pSlpSpi); - } - - /** - * Ctor. - * - * @param pPrevResponderSet - * - set of address strings - * @param pServiceType - * @param pScopeList - * - list of scope strings - * @param pPredicate - * @param pSlpSpi - */ - public ServiceRequest(SortedSet pPrevResponderSet, ServiceType pServiceType, - List pScopeList, String pPredicate, String pSlpSpi) { - super(SRV_RQST, pPrevResponderSet, pScopeList); - init(pServiceType, pPredicate, pSlpSpi); - } - - /** - * @param pHeader - * @param pPrevResponderSet - * - set of address strings - * @param pServiceType - * @param pScopeList - * - list of scope strings - * @param pPredicate - * - LDAPv3 search filter - * @param pSlpSpi - */ - public ServiceRequest(MsgHeader pHeader, SortedSet pPrevResponderSet, - ServiceType pServiceType, List pScopeList, String pPredicate, String pSlpSpi) { - super(pHeader, pPrevResponderSet, pScopeList); - init(pServiceType, pPredicate, pSlpSpi); - } - - /** - * getServiceType - * - * @return ServiceType - */ - public ServiceType getServiceType() { - return this.iServiceType; - } - - @Override - protected boolean serializeRequestBody(SLPOutputStream pOutStr) { - return pOutStr.write(this.iServiceType) && pOutStr.writeStringList(getScopeList()) - && pOutStr.write(this.iPredicate) && pOutStr.write(this.iSlpSpi); - } - - @Override - protected int[] getAllowedResponseIDs() { - return ALLOWED_RSPS; - } - - private void init(ServiceType pServiceType, String pPredicate, String pSlpSpi) { - this.iServiceType = pServiceType; - this.iPredicate = pPredicate; - this.iSlpSpi = pSlpSpi; - } - -} +/* + (C) Copyright IBM Corp. 2007, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, IBM, ebak@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1804402 2007-09-28 ebak IPv6 ready SLP + * 1892103 2008-02-15 ebak SLP improvements + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + */ + +package org.metricshub.wbem.sblim.slp.internal.msg; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.IOException; +import java.util.List; +import java.util.SortedSet; + +import org.metricshub.wbem.sblim.slp.ServiceType; +import org.metricshub.wbem.sblim.slp.ServiceLocationException; + +/* + * 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Service + * Location header (function = SrvRqst = 1) | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | length of + * | String \ + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | length of + * | String \ + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | length of + * | String \ + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | length of + * predicate string | Service Request \ + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | length of + * string | String \ + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + */ + +/* + * The string indicates a SLP SPI that the requester has been + * configured with. If this string is omitted, the responder does not include + * any Authentication Blocks in its reply. If it is included, the responder MUST + * return a reply which has an associated authentication block with the SLP SPI + * in the SrvRqst. If no replies may be returned because the SLP SPI is not + * supported, the responder returns an AUTHENTICATION_UNKNOWN error. + */ + +/** + * ServiceRequest message + * + */ +public class ServiceRequest extends RequestMessage { + + private ServiceType iServiceType; + + private String iPredicate, iSlpSpi; + + private static final int[] ALLOWED_RSPS = { SRV_RPLY, DA_ADVERT, SA_ADVERT }; + + /** + * parse + * + * @param pHdr + * @param pInStr + * @return SLPMessage + * @throws ServiceLocationException + * @throws IOException + */ + public static SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) + throws ServiceLocationException, IOException { + return new ServiceRequest(pHdr, pInStr.readStringSet(), // prevResponders + pInStr.readServiceType(), // serviceType + pInStr.readStringList(), // scopeList + pInStr.readString(), // predicate + pInStr.readString() // SlpSpi + ); + } + + /** + * Ctor. + * + * @param pLangTag + * @param pPrevResponderSet + * - set of address strings + * @param pServiceType + * @param pScopeList + * - list of scope strings + * @param pPredicate + * @param pSlpSpi + */ + public ServiceRequest(String pLangTag, SortedSet pPrevResponderSet, + ServiceType pServiceType, List pScopeList, String pPredicate, String pSlpSpi) { + super(SRV_RQST, pLangTag, pPrevResponderSet, pScopeList); + init(pServiceType, pPredicate, pSlpSpi); + } + + /** + * Ctor. + * + * @param pPrevResponderSet + * - set of address strings + * @param pServiceType + * @param pScopeList + * - list of scope strings + * @param pPredicate + * @param pSlpSpi + */ + public ServiceRequest(SortedSet pPrevResponderSet, ServiceType pServiceType, + List pScopeList, String pPredicate, String pSlpSpi) { + super(SRV_RQST, pPrevResponderSet, pScopeList); + init(pServiceType, pPredicate, pSlpSpi); + } + + /** + * @param pHeader + * @param pPrevResponderSet + * - set of address strings + * @param pServiceType + * @param pScopeList + * - list of scope strings + * @param pPredicate + * - LDAPv3 search filter + * @param pSlpSpi + */ + public ServiceRequest(MsgHeader pHeader, SortedSet pPrevResponderSet, + ServiceType pServiceType, List pScopeList, String pPredicate, String pSlpSpi) { + super(pHeader, pPrevResponderSet, pScopeList); + init(pServiceType, pPredicate, pSlpSpi); + } + + /** + * getServiceType + * + * @return ServiceType + */ + public ServiceType getServiceType() { + return this.iServiceType; + } + + @Override + protected boolean serializeRequestBody(SLPOutputStream pOutStr) { + return pOutStr.write(this.iServiceType) && pOutStr.writeStringList(getScopeList()) + && pOutStr.write(this.iPredicate) && pOutStr.write(this.iSlpSpi); + } + + @Override + protected int[] getAllowedResponseIDs() { + return ALLOWED_RSPS; + } + + private void init(ServiceType pServiceType, String pPredicate, String pSlpSpi) { + this.iServiceType = pServiceType; + this.iPredicate = pPredicate; + this.iSlpSpi = pSlpSpi; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/ServiceTypeReply.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/ServiceTypeReply.java similarity index 78% rename from src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/ServiceTypeReply.java rename to src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/ServiceTypeReply.java index b46735e..7e03758 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/ServiceTypeReply.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/ServiceTypeReply.java @@ -1,144 +1,142 @@ -/* - (C) Copyright IBM Corp. 2007, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, IBM, ebak@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1804402 2007-09-28 ebak IPv6 ready SLP - * 1892103 2008-02-12 ebak SLP improvements - * 1949918 2008-04-08 raman_arora Malformed service URL crashes SLP discovery - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - */ - -package org.sentrysoftware.wbem.sblim.slp.internal.msg; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.IOException; -import java.util.Iterator; -import java.util.List; - -import org.sentrysoftware.wbem.sblim.slp.ServiceLocationException; -import org.sentrysoftware.wbem.sblim.slp.ServiceType; - -/* - * 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Service - * Location header (function = SrvTypeRply = 10) | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Error - * Code | length of | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | - * \ - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - */ -/** - * ServiceTypeReply message - * - */ -public class ServiceTypeReply extends ReplyMessage { - - private List iServTypeList; - - /** - * parse - * - * @param pHdr - * @param pInStr - * @return SLPMessage - * @throws ServiceLocationException - * @throws IOException - */ - public static SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) - throws ServiceLocationException, IOException { - return new ServiceTypeReply(pHdr, pInStr.read16(), pInStr.readServTypeList()); - } - - /** - * Ctor. - * - * @param pErrorCode - * @param pServTypeList - * - list of ServiceTypes - */ - public ServiceTypeReply(int pErrorCode, List pServTypeList) { - super(SRV_TYPE_RPLY, pErrorCode); - this.iServTypeList = pServTypeList; - } - - /** - * Ctor. - * - * @param pLangTag - * @param pErrorCode - * @param pServTypeList - * - list of ServiceTypes - */ - public ServiceTypeReply(String pLangTag, int pErrorCode, List pServTypeList) { - super(SRV_TYPE_RPLY, pLangTag, pErrorCode); - this.iServTypeList = pServTypeList; - } - - /** - * Ctor. - * - * @param pHeader - * @param pErrorCode - * @param pServTypeList - * - list of ServiceTypes - */ - public ServiceTypeReply(MsgHeader pHeader, int pErrorCode, List pServTypeList) { - super(pHeader, pErrorCode); - this.iServTypeList = pServTypeList; - } - - @Override - public Iterator getResultIterator() { - return this.iServTypeList == null ? null : this.iServTypeList.iterator(); - } - - /** - * @param pOption - */ - @Override - protected boolean serializeBody(SLPOutputStream pOutStr, SerializeOption pOption) { - return pOutStr.write16(getErrorCode()) && pOutStr.writeServTypeList(getResultIterator()); - } - - @Override - public Iterator getExceptionIterator() { - // this message doesn't have exception table - return null; - } - -} +/* + (C) Copyright IBM Corp. 2007, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, IBM, ebak@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1804402 2007-09-28 ebak IPv6 ready SLP + * 1892103 2008-02-12 ebak SLP improvements + * 1949918 2008-04-08 raman_arora Malformed service URL crashes SLP discovery + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + */ + +package org.metricshub.wbem.sblim.slp.internal.msg; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.IOException; +import java.util.Iterator; +import java.util.List; + +import org.metricshub.wbem.sblim.slp.ServiceType; +import org.metricshub.wbem.sblim.slp.ServiceLocationException; + +/* + * 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Service + * Location header (function = SrvTypeRply = 10) | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Error + * Code | length of | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | + * \ + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + */ +/** + * ServiceTypeReply message + * + */ +public class ServiceTypeReply extends ReplyMessage { + + private List iServTypeList; + + /** + * parse + * + * @param pHdr + * @param pInStr + * @return SLPMessage + * @throws ServiceLocationException + * @throws IOException + */ + public static SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) + throws ServiceLocationException, IOException { + return new ServiceTypeReply(pHdr, pInStr.read16(), pInStr.readServTypeList()); + } + + /** + * Ctor. + * + * @param pErrorCode + * @param pServTypeList + * - list of ServiceTypes + */ + public ServiceTypeReply(int pErrorCode, List pServTypeList) { + super(SRV_TYPE_RPLY, pErrorCode); + this.iServTypeList = pServTypeList; + } + + /** + * Ctor. + * + * @param pLangTag + * @param pErrorCode + * @param pServTypeList + * - list of ServiceTypes + */ + public ServiceTypeReply(String pLangTag, int pErrorCode, List pServTypeList) { + super(SRV_TYPE_RPLY, pLangTag, pErrorCode); + this.iServTypeList = pServTypeList; + } + + /** + * Ctor. + * + * @param pHeader + * @param pErrorCode + * @param pServTypeList + * - list of ServiceTypes + */ + public ServiceTypeReply(MsgHeader pHeader, int pErrorCode, List pServTypeList) { + super(pHeader, pErrorCode); + this.iServTypeList = pServTypeList; + } + + @Override + public Iterator getResultIterator() { + return this.iServTypeList == null ? null : this.iServTypeList.iterator(); + } + + /** + * @param pOption + */ + @Override + protected boolean serializeBody(SLPOutputStream pOutStr, SerializeOption pOption) { + return pOutStr.write16(getErrorCode()) && pOutStr.writeServTypeList(getResultIterator()); + } + + @Override + public Iterator getExceptionIterator() { + // this message doesn't have exception table + return null; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/ServiceTypeRequest.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/ServiceTypeRequest.java similarity index 80% rename from src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/ServiceTypeRequest.java rename to src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/ServiceTypeRequest.java index e23b01e..24bafc0 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/ServiceTypeRequest.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/ServiceTypeRequest.java @@ -1,153 +1,151 @@ -/* - (C) Copyright IBM Corp. 2007, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, IBM, ebak@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1804402 2007-09-28 ebak IPv6 ready SLP - * 1892103 2008-02-15 ebak SLP improvements - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - */ - -package org.sentrysoftware.wbem.sblim.slp.internal.msg; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.IOException; -import java.util.List; -import java.util.SortedSet; - -import org.sentrysoftware.wbem.sblim.slp.ServiceLocationException; - -/* - * 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Service - * Location header (function = SrvTypeRqst = 9) | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | length of - * PRList | String \ - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | length of - * Naming Authority | \ - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | length of - * | String \ - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - */ -/** - * ServiceTypeRequest message - * - */ -public class ServiceTypeRequest extends RequestMessage { - - private String iNamingAuth; - - private static final int[] ALLOWED_RSPS = { SRV_TYPE_RPLY }; - - /** - * parse - * - * @param pHdr - * @param pInStr - * @return SLPMessage - * @throws ServiceLocationException - * @throws IOException - */ - public static SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) - throws ServiceLocationException, IOException { - return new ServiceTypeRequest(pHdr, pInStr.readStringSet(), // prevResponderSet - pInStr.readString(), // naming authority - pInStr.readStringList() // scope list - ); - } - - /** - * Ctor. - * - * @param pPrevResponderSet - * - set of address strings - * @param pNamingAuth - * @param pScopeList - * - set of scope strings - */ - public ServiceTypeRequest(SortedSet pPrevResponderSet, String pNamingAuth, - List pScopeList) { - super(SRV_TYPE_RQST, pPrevResponderSet, pScopeList); - init(pNamingAuth); - } - - /** - * Ctor. - * - * @param pLangTag - * @param pPrevResponderSet - * - set of address strings - * @param pNamingAuth - * @param pScopeList - * - set of scope strings - */ - public ServiceTypeRequest(String pLangTag, SortedSet pPrevResponderSet, - String pNamingAuth, List pScopeList) { - super(SRV_TYPE_RQST, pLangTag, pPrevResponderSet, pScopeList); - init(pNamingAuth); - } - - /** - * Ctor. - * - * @param pHeader - * @param pPrevResponderSet - * - set of address strings - * @param pNamingAuth - * @param pScopeList - * - set of scope strings - */ - public ServiceTypeRequest(MsgHeader pHeader, SortedSet pPrevResponderSet, - String pNamingAuth, List pScopeList) { - super(pHeader, pPrevResponderSet, pScopeList); - init(pNamingAuth); - } - - @Override - protected boolean serializeRequestBody(SLPOutputStream pOutStr) { - return pOutStr.write(this.iNamingAuth) && pOutStr.writeStringList(getScopeList()); - } - - @Override - protected int[] getAllowedResponseIDs() { - return ALLOWED_RSPS; - } - - private void init(String pNamingAuth) { - this.iNamingAuth = pNamingAuth; - } - -} +/* + (C) Copyright IBM Corp. 2007, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, IBM, ebak@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1804402 2007-09-28 ebak IPv6 ready SLP + * 1892103 2008-02-15 ebak SLP improvements + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + */ + +package org.metricshub.wbem.sblim.slp.internal.msg; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.IOException; +import java.util.List; +import java.util.SortedSet; + +import org.metricshub.wbem.sblim.slp.ServiceLocationException; + +/* + * 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Service + * Location header (function = SrvTypeRqst = 9) | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | length of + * PRList | String \ + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | length of + * Naming Authority | \ + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | length of + * | String \ + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + */ +/** + * ServiceTypeRequest message + * + */ +public class ServiceTypeRequest extends RequestMessage { + + private String iNamingAuth; + + private static final int[] ALLOWED_RSPS = { SRV_TYPE_RPLY }; + + /** + * parse + * + * @param pHdr + * @param pInStr + * @return SLPMessage + * @throws ServiceLocationException + * @throws IOException + */ + public static SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) + throws ServiceLocationException, IOException { + return new ServiceTypeRequest(pHdr, pInStr.readStringSet(), // prevResponderSet + pInStr.readString(), // naming authority + pInStr.readStringList() // scope list + ); + } + + /** + * Ctor. + * + * @param pPrevResponderSet + * - set of address strings + * @param pNamingAuth + * @param pScopeList + * - set of scope strings + */ + public ServiceTypeRequest(SortedSet pPrevResponderSet, String pNamingAuth, + List pScopeList) { + super(SRV_TYPE_RQST, pPrevResponderSet, pScopeList); + init(pNamingAuth); + } + + /** + * Ctor. + * + * @param pLangTag + * @param pPrevResponderSet + * - set of address strings + * @param pNamingAuth + * @param pScopeList + * - set of scope strings + */ + public ServiceTypeRequest(String pLangTag, SortedSet pPrevResponderSet, + String pNamingAuth, List pScopeList) { + super(SRV_TYPE_RQST, pLangTag, pPrevResponderSet, pScopeList); + init(pNamingAuth); + } + + /** + * Ctor. + * + * @param pHeader + * @param pPrevResponderSet + * - set of address strings + * @param pNamingAuth + * @param pScopeList + * - set of scope strings + */ + public ServiceTypeRequest(MsgHeader pHeader, SortedSet pPrevResponderSet, + String pNamingAuth, List pScopeList) { + super(pHeader, pPrevResponderSet, pScopeList); + init(pNamingAuth); + } + + @Override + protected boolean serializeRequestBody(SLPOutputStream pOutStr) { + return pOutStr.write(this.iNamingAuth) && pOutStr.writeStringList(getScopeList()); + } + + @Override + protected int[] getAllowedResponseIDs() { + return ALLOWED_RSPS; + } + + private void init(String pNamingAuth) { + this.iNamingAuth = pNamingAuth; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/Util.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/Util.java similarity index 64% rename from src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/Util.java rename to src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/Util.java index 97b24cd..b2e4dd8 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/msg/Util.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/Util.java @@ -1,66 +1,64 @@ -/* - (C) Copyright IBM Corp. 2007, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, IBM, ebak@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1804402 2007-09-28 ebak IPv6 ready SLP - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.slp.internal.msg; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.Locale; - -/** - * Common handful functions can be here. - * - */ -public class Util { - - /** - * getLangTag - * - * @param pLocale - * @return String - */ - public static String getLangTag(Locale pLocale) { - if (pLocale == null) return null; - String country = pLocale.getCountry(); - String lang = pLocale.getLanguage(); - return (country != null && country.length() > 0) ? lang + "-" + country : lang; - } - -} +/* + (C) Copyright IBM Corp. 2007, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, IBM, ebak@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1804402 2007-09-28 ebak IPv6 ready SLP + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.slp.internal.msg; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.Locale; + +/** + * Common handful functions can be here. + * + */ +public class Util { + + /** + * getLangTag + * + * @param pLocale + * @return String + */ + public static String getLangTag(Locale pLocale) { + if (pLocale == null) return null; + String country = pLocale.getCountry(); + String lang = pLocale.getLanguage(); + return (country != null && country.length() > 0) ? lang + "-" + country : lang; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/package.html b/src/main/java/org/metricshub/wbem/sblim/slp/internal/package.html similarity index 100% rename from src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/package.html rename to src/main/java/org/metricshub/wbem/sblim/slp/internal/package.html diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/sa/DatagramThread.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/sa/DatagramThread.java similarity index 72% rename from src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/sa/DatagramThread.java rename to src/main/java/org/metricshub/wbem/sblim/slp/internal/sa/DatagramThread.java index b311dc7..991a426 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/sa/DatagramThread.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/sa/DatagramThread.java @@ -1,124 +1,122 @@ -/* - (C) Copyright IBM Corp. 2007, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, IBM, ebak@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1804402 2007-09-28 ebak IPv6 ready SLP - * 1892103 2008-02-13 ebak SLP improvements - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.slp.internal.sa; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.IOException; -import java.net.DatagramPacket; -import java.net.InetAddress; -import java.net.MulticastSocket; -import java.net.SocketTimeoutException; - -import org.sentrysoftware.wbem.sblim.slp.internal.SLPConfig; -import org.sentrysoftware.wbem.sblim.slp.internal.SLPDefaults; -import org.sentrysoftware.wbem.sblim.slp.internal.TRC; - -/** - * DatagramThread - * - */ -public class DatagramThread extends RecieverThread { - - private static MulticastSocket cMCastSocket; - - private DatagramPacket iPacket = new DatagramPacket(new byte[SLPDefaults.MTU], SLPDefaults.MTU); - - /** - * Ctor. - * - * @param pSrvAgent - */ - public DatagramThread(ServiceAgent pSrvAgent) { - super("DatagramThread", pSrvAgent); - } - - /** - * joinGroup - * - * @param pGroup - * @throws IOException - */ - public synchronized void joinGroup(InetAddress pGroup) throws IOException { - TRC.debug("join:" + pGroup); - cMCastSocket.joinGroup(pGroup); - } - - /** - * leaveGroup - * - * @param pGroup - * @throws IOException - */ - public synchronized void leaveGroup(InetAddress pGroup) throws IOException { - TRC.debug("leave:" + pGroup); - cMCastSocket.leaveGroup(pGroup); - } - - @Override - protected void init() throws IOException { - if (cMCastSocket == null) { - cMCastSocket = new MulticastSocket(SLPConfig.getGlobalCfg().getPort()); - cMCastSocket.setReuseAddress(true); - cMCastSocket.setSoTimeout(100); - } - } - - @Override - protected void mainLoop() throws IOException { - try { - cMCastSocket.receive(this.iPacket); - TRC.debug("Packet received"); - this.iSrvAgent.processMessage(cMCastSocket, this.iPacket); - } catch (SocketTimeoutException e) { - // superclass will restart this function - } - } - - @Override - protected void close() { - if (cMCastSocket == null) return; - cMCastSocket.close(); - cMCastSocket = null; - } - -} +/* + (C) Copyright IBM Corp. 2007, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, IBM, ebak@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1804402 2007-09-28 ebak IPv6 ready SLP + * 1892103 2008-02-13 ebak SLP improvements + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.slp.internal.sa; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.IOException; +import java.net.DatagramPacket; +import java.net.InetAddress; +import java.net.MulticastSocket; +import java.net.SocketTimeoutException; + +import org.metricshub.wbem.sblim.slp.internal.SLPConfig; +import org.metricshub.wbem.sblim.slp.internal.SLPDefaults; +import org.metricshub.wbem.sblim.slp.internal.TRC; + +/** + * DatagramThread + * + */ +public class DatagramThread extends RecieverThread { + + private static MulticastSocket cMCastSocket; + + private DatagramPacket iPacket = new DatagramPacket(new byte[SLPDefaults.MTU], SLPDefaults.MTU); + + /** + * Ctor. + * + * @param pSrvAgent + */ + public DatagramThread(ServiceAgent pSrvAgent) { + super("DatagramThread", pSrvAgent); + } + + /** + * joinGroup + * + * @param pGroup + * @throws IOException + */ + public synchronized void joinGroup(InetAddress pGroup) throws IOException { + TRC.debug("join:" + pGroup); + cMCastSocket.joinGroup(pGroup); + } + + /** + * leaveGroup + * + * @param pGroup + * @throws IOException + */ + public synchronized void leaveGroup(InetAddress pGroup) throws IOException { + TRC.debug("leave:" + pGroup); + cMCastSocket.leaveGroup(pGroup); + } + + @Override + protected void init() throws IOException { + if (cMCastSocket == null) { + cMCastSocket = new MulticastSocket(SLPConfig.getGlobalCfg().getPort()); + cMCastSocket.setReuseAddress(true); + cMCastSocket.setSoTimeout(100); + } + } + + @Override + protected void mainLoop() throws IOException { + try { + cMCastSocket.receive(this.iPacket); + TRC.debug("Packet received"); + this.iSrvAgent.processMessage(cMCastSocket, this.iPacket); + } catch (SocketTimeoutException e) { + // superclass will restart this function + } + } + + @Override + protected void close() { + if (cMCastSocket == null) return; + cMCastSocket.close(); + cMCastSocket = null; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/sa/MessageTable.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/sa/MessageTable.java similarity index 83% rename from src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/sa/MessageTable.java rename to src/main/java/org/metricshub/wbem/sblim/slp/internal/sa/MessageTable.java index 8e76db6..336e21a 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/sa/MessageTable.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/sa/MessageTable.java @@ -1,256 +1,254 @@ -/* - (C) Copyright IBM Corp. 2007, 2010 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, IBM, ebak@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1804402 2007-09-28 ebak IPv6 ready SLP - * 1892103 2008-02-12 ebak SLP improvements - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2795671 2009-05-22 raman_arora Add Type to Comparable - * 3023120 2010-07-01 blaschke-oss RequestDescriptor equals/compareTo issue - * 3023349 2010-07-02 blaschke-oss SLP uses # constructor instead of valueOf - */ - -package org.sentrysoftware.wbem.sblim.slp.internal.sa; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.net.InetAddress; -import java.util.Arrays; -import java.util.Date; -import java.util.SortedMap; -import java.util.TreeMap; - -import org.sentrysoftware.wbem.sblim.slp.ServiceLocationException; -import org.sentrysoftware.wbem.sblim.slp.internal.msg.RequestMessage; -import org.sentrysoftware.wbem.sblim.slp.internal.msg.SLPMessage; - -/** - * Keeps track of datagram messages. For requests with the same XID the same - * responses should be returned. - * - */ -public class MessageTable { - - private static class RequestDescriptor implements Comparable { - - private byte[] iSrcAddress; - - private byte[] iRequest; - - /** - * Ctor. - * - * @param pSource - * @param pRequest - * @throws ServiceLocationException - */ - public RequestDescriptor(InetAddress pSource, SLPMessage pRequest) - throws ServiceLocationException { - this.iSrcAddress = pSource.getAddress(); - this.iRequest = (pRequest instanceof RequestMessage) ? ((RequestMessage) pRequest) - .serializeWithoutResponders(false, true, true) : pRequest.serialize(false, - true, true); - } - - public int compareTo(RequestDescriptor pObj) { - RequestDescriptor that = pObj; - int cmp = compare(this.iSrcAddress, that.iSrcAddress); - if (cmp != 0) return cmp; - return compare(this.iRequest, that.iRequest); - } - - private static int compare(byte[] pBytes0, byte[] pBytes1) { - int len = Math.min(pBytes0.length, pBytes1.length); - for (int i = 0; i < len; i++) { - int cmp = pBytes0[i] & 0xff - pBytes1[i] & 0xff; - if (cmp != 0) return cmp; - } - return pBytes0.length - pBytes1.length; - } - - @Override - public boolean equals(Object pObj) { - if (!(pObj instanceof RequestDescriptor)) return false; - RequestDescriptor that = (RequestDescriptor) pObj; - return compare(this.iSrcAddress, that.iSrcAddress) == 0 - && compare(this.iRequest, that.iRequest) == 0; - } - - @Override - public int hashCode() { - return Arrays.hashCode(this.iSrcAddress) + Arrays.hashCode(this.iRequest); - } - } - - private static class TableEntry { - - private long iTime; - - private RequestDescriptor iReqDesc; - - private byte[] iResponse; - - /** - * Ctor. - * - * @param pTime - * @param pReqKey - * @param pResponse - */ - public TableEntry(long pTime, RequestDescriptor pReqKey, byte[] pResponse) { - this.iTime = pTime; - this.iReqDesc = pReqKey; - this.iResponse = pResponse; - } - - /** - * getTime - * - * @return long - */ - public long getTime() { - return this.iTime; - } - - /** - * setTime - * - * @param pTime - */ - public void setTime(long pTime) { - this.iTime = pTime; - } - - /** - * getRequestDescriptor - * - * @return RequestDescriptor - */ - public RequestDescriptor getRequestDescriptor() { - return this.iReqDesc; - } - - /** - * getResponse - * - * @return byte[] - */ - public byte[] getResponse() { - return this.iResponse; - } - - } - - /** - * Remember messages for 30 seconds. - */ - private static final long KEEPIN = 30; - - /** - * Time -> TableEntry - */ - private SortedMap iTimeMap = new TreeMap(); - - /** - * RequestKey -> TableEntry - */ - private SortedMap iReqMap = new TreeMap(); - - /** - * getResponse - * - * @param pSource - * @param pRequest - * @return byte[] - * @throws ServiceLocationException - */ - public synchronized byte[] getResponse(InetAddress pSource, SLPMessage pRequest) - throws ServiceLocationException { - long now = getSecs(); - RequestDescriptor reqDesc = new RequestDescriptor(pSource, pRequest); - TableEntry entry = this.iReqMap.get(reqDesc); - if (entry == null) return null; - clean(); - updateTime(entry, now); - return entry.getResponse(); - } - - /** - * addResponse - * - * @param pSource - * @param pRequest - * @param pRespond - * @throws ServiceLocationException - */ - public synchronized void addResponse(InetAddress pSource, SLPMessage pRequest, byte[] pRespond) - throws ServiceLocationException { - insert(new TableEntry(getSecs(), new RequestDescriptor(pSource, pRequest), pRespond)); - clean(); - } - - private void clean() { - long now = getSecs(); - Long timeStamp; - while ((timeStamp = this.iTimeMap.firstKey()) != null) { - if (now - timeStamp.longValue() < KEEPIN) break; - TableEntry entry = this.iTimeMap.get(timeStamp); - remove(entry); - } - } - - private void insert(TableEntry pEntry) { - this.iTimeMap.put(Long.valueOf(pEntry.getTime()), pEntry); - this.iReqMap.put(pEntry.getRequestDescriptor(), pEntry); - } - - private void remove(TableEntry pEntry) { - this.iTimeMap.remove(Long.valueOf(pEntry.getTime())); - this.iReqMap.remove(pEntry.getRequestDescriptor()); - } - - private void updateTime(TableEntry pEntry, long pTime) { - remove(pEntry); - pEntry.setTime(pTime); - insert(pEntry); - } - - private static long getSecs() { - return new Date().getTime() / 1000; - } - -} +/* + (C) Copyright IBM Corp. 2007, 2010 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, IBM, ebak@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1804402 2007-09-28 ebak IPv6 ready SLP + * 1892103 2008-02-12 ebak SLP improvements + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2795671 2009-05-22 raman_arora Add Type to Comparable + * 3023120 2010-07-01 blaschke-oss RequestDescriptor equals/compareTo issue + * 3023349 2010-07-02 blaschke-oss SLP uses # constructor instead of valueOf + */ + +package org.metricshub.wbem.sblim.slp.internal.sa; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.net.InetAddress; +import java.util.Arrays; +import java.util.Date; +import java.util.SortedMap; +import java.util.TreeMap; + +import org.metricshub.wbem.sblim.slp.internal.msg.RequestMessage; +import org.metricshub.wbem.sblim.slp.internal.msg.SLPMessage; +import org.metricshub.wbem.sblim.slp.ServiceLocationException; + +/** + * Keeps track of datagram messages. For requests with the same XID the same + * responses should be returned. + * + */ +public class MessageTable { + + private static class RequestDescriptor implements Comparable { + + private byte[] iSrcAddress; + + private byte[] iRequest; + + /** + * Ctor. + * + * @param pSource + * @param pRequest + * @throws ServiceLocationException + */ + public RequestDescriptor(InetAddress pSource, SLPMessage pRequest) + throws ServiceLocationException { + this.iSrcAddress = pSource.getAddress(); + this.iRequest = (pRequest instanceof RequestMessage) ? ((RequestMessage) pRequest) + .serializeWithoutResponders(false, true, true) : pRequest.serialize(false, + true, true); + } + + public int compareTo(RequestDescriptor pObj) { + RequestDescriptor that = pObj; + int cmp = compare(this.iSrcAddress, that.iSrcAddress); + if (cmp != 0) return cmp; + return compare(this.iRequest, that.iRequest); + } + + private static int compare(byte[] pBytes0, byte[] pBytes1) { + int len = Math.min(pBytes0.length, pBytes1.length); + for (int i = 0; i < len; i++) { + int cmp = pBytes0[i] & 0xff - pBytes1[i] & 0xff; + if (cmp != 0) return cmp; + } + return pBytes0.length - pBytes1.length; + } + + @Override + public boolean equals(Object pObj) { + if (!(pObj instanceof RequestDescriptor)) return false; + RequestDescriptor that = (RequestDescriptor) pObj; + return compare(this.iSrcAddress, that.iSrcAddress) == 0 + && compare(this.iRequest, that.iRequest) == 0; + } + + @Override + public int hashCode() { + return Arrays.hashCode(this.iSrcAddress) + Arrays.hashCode(this.iRequest); + } + } + + private static class TableEntry { + + private long iTime; + + private RequestDescriptor iReqDesc; + + private byte[] iResponse; + + /** + * Ctor. + * + * @param pTime + * @param pReqKey + * @param pResponse + */ + public TableEntry(long pTime, RequestDescriptor pReqKey, byte[] pResponse) { + this.iTime = pTime; + this.iReqDesc = pReqKey; + this.iResponse = pResponse; + } + + /** + * getTime + * + * @return long + */ + public long getTime() { + return this.iTime; + } + + /** + * setTime + * + * @param pTime + */ + public void setTime(long pTime) { + this.iTime = pTime; + } + + /** + * getRequestDescriptor + * + * @return RequestDescriptor + */ + public RequestDescriptor getRequestDescriptor() { + return this.iReqDesc; + } + + /** + * getResponse + * + * @return byte[] + */ + public byte[] getResponse() { + return this.iResponse; + } + + } + + /** + * Remember messages for 30 seconds. + */ + private static final long KEEPIN = 30; + + /** + * Time -> TableEntry + */ + private SortedMap iTimeMap = new TreeMap(); + + /** + * RequestKey -> TableEntry + */ + private SortedMap iReqMap = new TreeMap(); + + /** + * getResponse + * + * @param pSource + * @param pRequest + * @return byte[] + * @throws ServiceLocationException + */ + public synchronized byte[] getResponse(InetAddress pSource, SLPMessage pRequest) + throws ServiceLocationException { + long now = getSecs(); + RequestDescriptor reqDesc = new RequestDescriptor(pSource, pRequest); + TableEntry entry = this.iReqMap.get(reqDesc); + if (entry == null) return null; + clean(); + updateTime(entry, now); + return entry.getResponse(); + } + + /** + * addResponse + * + * @param pSource + * @param pRequest + * @param pRespond + * @throws ServiceLocationException + */ + public synchronized void addResponse(InetAddress pSource, SLPMessage pRequest, byte[] pRespond) + throws ServiceLocationException { + insert(new TableEntry(getSecs(), new RequestDescriptor(pSource, pRequest), pRespond)); + clean(); + } + + private void clean() { + long now = getSecs(); + Long timeStamp; + while ((timeStamp = this.iTimeMap.firstKey()) != null) { + if (now - timeStamp.longValue() < KEEPIN) break; + TableEntry entry = this.iTimeMap.get(timeStamp); + remove(entry); + } + } + + private void insert(TableEntry pEntry) { + this.iTimeMap.put(Long.valueOf(pEntry.getTime()), pEntry); + this.iReqMap.put(pEntry.getRequestDescriptor(), pEntry); + } + + private void remove(TableEntry pEntry) { + this.iTimeMap.remove(Long.valueOf(pEntry.getTime())); + this.iReqMap.remove(pEntry.getRequestDescriptor()); + } + + private void updateTime(TableEntry pEntry, long pTime) { + remove(pEntry); + pEntry.setTime(pTime); + insert(pEntry); + } + + private static long getSecs() { + return new Date().getTime() / 1000; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/sa/RecieverThread.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/sa/RecieverThread.java similarity index 74% rename from src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/sa/RecieverThread.java rename to src/main/java/org/metricshub/wbem/sblim/slp/internal/sa/RecieverThread.java index 561444d..371c4f4 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/sa/RecieverThread.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/sa/RecieverThread.java @@ -1,177 +1,175 @@ -/* - (C) Copyright IBM Corp. 2007, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, IBM, ebak@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1804402 2007-09-28 ebak IPv6 ready SLP - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.slp.internal.sa; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.IOException; - -import org.sentrysoftware.wbem.sblim.slp.ServiceLocationException; -import org.sentrysoftware.wbem.sblim.slp.internal.TRC; - -/** - * RecieverThread - * - */ -public abstract class RecieverThread implements Runnable { - - private Thread iThread; - - private volatile boolean iStop; - - private boolean iInited; - - private Object iInitLock = new Object(); - - protected ServiceAgent iSrvAgent; - - /** - * Ctor. - * - * @param pName - * @param pSrvAgent - */ - public RecieverThread(String pName, ServiceAgent pSrvAgent) { - this.iThread = new Thread(this, pName); - this.iSrvAgent = pSrvAgent; - } - - /** - * start - */ - public void start() { - this.iThread.start(); - } - - /** - * wait4init - */ - public void wait4init() { - synchronized (this.iInitLock) { - try { - if (this.iInited) return; - this.iInitLock.wait(); - return; - } catch (InterruptedException e) { - TRC.error(e); - } - } - } - - /** - * stop - */ - public void stop() { - stop(true); - } - - /** - * stop - * - * @param pWait - */ - public void stop(boolean pWait) { - this.iStop = true; - if (pWait) join(); - } - - public void run() { - // 1st init - synchronized (this.iInitLock) { - TRC.debug("initing"); - initialize(); - this.iInited = true; - TRC.debug("inited"); - try { - this.iInitLock.notifyAll(); - } catch (IllegalMonitorStateException e) { - TRC.error(e); - } - } - while (!this.iStop) { - try { - mainLoop(); - } catch (Exception e) { - TRC.error(e); - sleep(100); - initialize(); - } - } - close(); - this.iStop = false; - TRC.debug("STOPPED"); - } - - // exception of init shoud be reachable for ServiceTable - - protected abstract void init() throws ServiceLocationException, IOException; - - protected abstract void mainLoop() throws IOException; - - protected abstract void close(); - - private void join() { - try { - this.iThread.join(); - } catch (InterruptedException e) { - TRC.error(e); - } - } - - private void initialize() { - try { - init(); - } catch (ServiceLocationException e) { - TRC.error(e); - } catch (IOException e) { - TRC.error(e); - } - } - - private static void sleep(int pMillis) { - try { - Thread.sleep(pMillis); - } catch (InterruptedException e) { - TRC.error(e); - } - } - -} +/* + (C) Copyright IBM Corp. 2007, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, IBM, ebak@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1804402 2007-09-28 ebak IPv6 ready SLP + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.slp.internal.sa; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.IOException; + +import org.metricshub.wbem.sblim.slp.internal.TRC; +import org.metricshub.wbem.sblim.slp.ServiceLocationException; + +/** + * RecieverThread + * + */ +public abstract class RecieverThread implements Runnable { + + private Thread iThread; + + private volatile boolean iStop; + + private boolean iInited; + + private Object iInitLock = new Object(); + + protected ServiceAgent iSrvAgent; + + /** + * Ctor. + * + * @param pName + * @param pSrvAgent + */ + public RecieverThread(String pName, ServiceAgent pSrvAgent) { + this.iThread = new Thread(this, pName); + this.iSrvAgent = pSrvAgent; + } + + /** + * start + */ + public void start() { + this.iThread.start(); + } + + /** + * wait4init + */ + public void wait4init() { + synchronized (this.iInitLock) { + try { + if (this.iInited) return; + this.iInitLock.wait(); + return; + } catch (InterruptedException e) { + TRC.error(e); + } + } + } + + /** + * stop + */ + public void stop() { + stop(true); + } + + /** + * stop + * + * @param pWait + */ + public void stop(boolean pWait) { + this.iStop = true; + if (pWait) join(); + } + + public void run() { + // 1st init + synchronized (this.iInitLock) { + TRC.debug("initing"); + initialize(); + this.iInited = true; + TRC.debug("inited"); + try { + this.iInitLock.notifyAll(); + } catch (IllegalMonitorStateException e) { + TRC.error(e); + } + } + while (!this.iStop) { + try { + mainLoop(); + } catch (Exception e) { + TRC.error(e); + sleep(100); + initialize(); + } + } + close(); + this.iStop = false; + TRC.debug("STOPPED"); + } + + // exception of init shoud be reachable for ServiceTable + + protected abstract void init() throws ServiceLocationException, IOException; + + protected abstract void mainLoop() throws IOException; + + protected abstract void close(); + + private void join() { + try { + this.iThread.join(); + } catch (InterruptedException e) { + TRC.error(e); + } + } + + private void initialize() { + try { + init(); + } catch (ServiceLocationException e) { + TRC.error(e); + } catch (IOException e) { + TRC.error(e); + } + } + + private static void sleep(int pMillis) { + try { + Thread.sleep(pMillis); + } catch (InterruptedException e) { + TRC.error(e); + } + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/sa/ServiceAgent.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/sa/ServiceAgent.java similarity index 78% rename from src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/sa/ServiceAgent.java rename to src/main/java/org/metricshub/wbem/sblim/slp/internal/sa/ServiceAgent.java index bae0455..068c4b3 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/sa/ServiceAgent.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/sa/ServiceAgent.java @@ -1,363 +1,361 @@ -/* - (C) Copyright IBM Corp. 2007, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, IBM, ebak@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1804402 2007-09-28 ebak IPv6 ready SLP - * 1804402 2007-11-10 ebak IPv6 ready SLP - revision 4 - * 1892103 2008-02-15 ebak SLP improvements - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors - */ - -package org.sentrysoftware.wbem.sblim.slp.internal.sa; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.IOException; -import java.io.OutputStream; -import java.net.DatagramPacket; -import java.net.DatagramSocket; -import java.net.Socket; -import java.net.UnknownHostException; -import java.util.List; - -import org.sentrysoftware.wbem.sblim.slp.ServiceLocationException; -import org.sentrysoftware.wbem.sblim.slp.ServiceURL; -import org.sentrysoftware.wbem.sblim.slp.internal.IPv6MulticastAddressFactory; -import org.sentrysoftware.wbem.sblim.slp.internal.Net; -import org.sentrysoftware.wbem.sblim.slp.internal.SLPConfig; -import org.sentrysoftware.wbem.sblim.slp.internal.SLPDefaults; -import org.sentrysoftware.wbem.sblim.slp.internal.TRC; -import org.sentrysoftware.wbem.sblim.slp.internal.msg.AttributeReply; -import org.sentrysoftware.wbem.sblim.slp.internal.msg.AttributeRequest; -import org.sentrysoftware.wbem.sblim.slp.internal.msg.FunctionIDs; -import org.sentrysoftware.wbem.sblim.slp.internal.msg.MsgFactory; -import org.sentrysoftware.wbem.sblim.slp.internal.msg.ReplyMessage; -import org.sentrysoftware.wbem.sblim.slp.internal.msg.RequestMessage; -import org.sentrysoftware.wbem.sblim.slp.internal.msg.SLPMessage; -import org.sentrysoftware.wbem.sblim.slp.internal.msg.ServiceAcknowledgment; -import org.sentrysoftware.wbem.sblim.slp.internal.msg.ServiceDeregistration; -import org.sentrysoftware.wbem.sblim.slp.internal.msg.ServiceRegistration; -import org.sentrysoftware.wbem.sblim.slp.internal.msg.ServiceReply; -import org.sentrysoftware.wbem.sblim.slp.internal.msg.ServiceRequest; -import org.sentrysoftware.wbem.sblim.slp.internal.msg.ServiceTypeReply; - -/** - * ServiceAgent - * - */ -public class ServiceAgent implements FunctionIDs { - - private boolean iUseV4 = Net.hasIPv4() && SLPConfig.getGlobalCfg().useIPv4(), iUseV6 = Net - .hasIPv6() - && SLPConfig.getGlobalCfg().useIPv6(); - - boolean iStarted; - - private volatile boolean iSkipFirstRequest; - - private DatagramThread iDGThread = new DatagramThread(this); - - private TCPThread iTCPThread = new TCPThread(this); - - private ServiceTable iSrvTable = new ServiceTable(this.iDGThread); - - private MessageTable iMsgTable = new MessageTable(); - - /** - * main - * - * @param pArgs - * @throws IOException - */ - public static void main(String[] pArgs) throws IOException { - if (pArgs != null && pArgs.length >= 1) { - int port = Integer.parseInt(pArgs[0]); - SLPConfig.getGlobalCfg().setPort(port); - } - ServiceAgent srvAgent = new ServiceAgent(); - srvAgent.start(); - TRC.debug("starting idle loop"); - while (true) { - try { - Thread.sleep(100); - } catch (InterruptedException e) { - // lofasz - } - } - } - - /** - * setSkipFirstRequest - * - * @param pValue - */ - public void setSkipFirstRequest(boolean pValue) { - this.iSkipFirstRequest = pValue; - } - - /** - * start - * - * @throws IOException - */ - public void start() throws IOException { - if (this.iStarted) return; - // launch receivers - TRC.debug("start receivers"); - if (this.iUseV4 || this.iUseV6) { - this.iTCPThread.start(); - this.iDGThread.start(); - TRC.debug("wait4 TCP init"); - this.iTCPThread.wait4init(); - TRC.debug("wait4 Datagram init"); - this.iDGThread.wait4init(); - } - this.iStarted = true; - TRC.debug("receivers started"); - // join multicast groups - if (this.iUseV4) this.iDGThread.joinGroup(SLPConfig.getMulticastAddress()); - if (this.iUseV6) { - this.iDGThread.joinGroup(IPv6MulticastAddressFactory - .getSrvLocAddress(SLPDefaults.IPV6_MULTICAST_SCOPE)); - } - } - - /** - * stop - */ - public void stop() { - // stop the receivers - if (this.iUseV4 || this.iUseV6) { - this.iTCPThread.stop(); - this.iDGThread.stop(); - } - this.iStarted = false; - - } - - /** - * processMessage - * - * @param pDGSock - * @param pPacket - */ - public void processMessage(DatagramSocket pDGSock, DatagramPacket pPacket) { - byte[] reply; - SLPMessage msg; - try { - msg = MsgFactory.parse(pPacket); - } catch (Exception e) { - // no response for unparseable messages - TRC.debug("Message parsing error!", e); - return; - } - - try { - TRC.debug("processing: " + msg); - reply = this.iMsgTable.getResponse(pPacket.getAddress(), msg); - if (reply == null) { - SLPMessage replyMsg = makeReply(msg); - if (replyMsg != null) { - TRC.debug("response : " + replyMsg); - reply = replyMsg.serialize(false, true, true); - this.iMsgTable.addResponse(pPacket.getAddress(), msg, reply); - // debugging: do not reply to the first request - if (this.iSkipFirstRequest) { - TRC.debug("refusing response"); - return; - } - } - } else { - TRC.debug("cached response"); - } - } catch (ServiceLocationException e) { - TRC.debug(e.toString(), e); - reply = makeErrorReply(msg, e); // known XID - } - if (reply != null) { - try { - TRC.debug("sending response"); - pDGSock.send(new DatagramPacket(reply, reply.length, pPacket.getAddress(), pPacket - .getPort())); - } catch (IOException e) { - TRC.error(e); - } - } - } - - /** - * processMessage - * - * @param pStreamSock - */ - public void processMessage(Socket pStreamSock) { - byte[] reply; - SLPMessage msg; - try { - msg = MsgFactory.parse(pStreamSock.getInputStream()); - } catch (Exception e) { - // no response for unparseable messages - TRC.debug("Message parsing error!", e); - return; - } - try { - SLPMessage replyMsg = makeReply(msg); - reply = replyMsg == null ? null : replyMsg.serialize(false, false, true); - } catch (ServiceLocationException e) { - reply = makeErrorReply(msg, e); - } - if (reply != null) { - try { - OutputStream os = pStreamSock.getOutputStream(); - os.write(reply); - os.flush(); - } catch (IOException e) { - TRC.error(e); - } - } - try { - pStreamSock.close(); - } catch (IOException e) { - TRC.error(e); - } - } - - /* - * XID is set to a unique value for each unique request. If the request is - * retransmitted, the same XID is used. Replies set the XID to the same - * value as the xid in the request. Only unsolicited DAAdverts are sent with - * an XID of 0. - */ - private SLPMessage makeReply(SLPMessage pRequest) throws ServiceLocationException { - try { - SLPMessage msg = pRequest instanceof RequestMessage ? makeReply4Request((RequestMessage) pRequest) - : makeReply4Others(pRequest); - if (msg != null) msg.setXID(pRequest.getXID()); - return msg; - } catch (UnknownHostException e) { - TRC.error(e); - throw new ServiceLocationException(ServiceLocationException.NETWORK_ERROR); - } catch (IOException e) { - TRC.error(e); - throw new ServiceLocationException(ServiceLocationException.NETWORK_ERROR); - } - - } - - private ReplyMessage makeReply4Request(RequestMessage pRequest) { - ReplyMessage replyMsg; - List scopes = pRequest.getScopeList(); - switch (pRequest.getFunctionID()) { - case SRV_RQST: - ServiceRequest srvRqst = (ServiceRequest) pRequest; - if (SLPDefaults.DA_SERVICE_TYPE.equals(srvRqst.getServiceType())) return null; - List urlList = this.iSrvTable.getServiceURLs(srvRqst.getServiceType(), - scopes); - TRC.debug("srvReply : " + urlList); - replyMsg = new ServiceReply(0, urlList); - break; - case ATTR_RQST: - AttributeRequest attrRqst = (AttributeRequest) pRequest; - replyMsg = new AttributeReply(0, this.iSrvTable.getAttributes(attrRqst - .getServiceURL(), scopes)); - break; - case SRV_TYPE_RQST: - // ServiceTypeRequest srvTypeRqst = - // (ServiceTypeRequest)pRequest; - replyMsg = new ServiceTypeReply(0, this.iSrvTable.getServiceTypes(scopes)); - break; - default: - return null; - } - return replyMsg; - } - - private SLPMessage makeReply4Others(SLPMessage pRequest) throws IOException { - switch (pRequest.getFunctionID()) { - case SRV_REG: - ServiceRegistration srvReg = (ServiceRegistration) pRequest; - this.iSrvTable.add(srvReg.getServiceURL(), srvReg.getAttributeList(), srvReg - .getScopeList()); - return new ServiceAcknowledgment(0); - case SRV_DEREG: - ServiceDeregistration srvDereg = (ServiceDeregistration) pRequest; - this.iSrvTable.remove(srvDereg.getServiceURL()); - return new ServiceAcknowledgment(0); - default: - // FIXME maybe returning an error message is better - return null; - } - } - - private static byte[] makeErrorReply(SLPMessage pRequest, ServiceLocationException pE) { - return makeErrorReply(pRequest, pE.getErrorCode()); - } - - /* - * Error reply: SRV_REG, SRV_DEREG -> SRV_ACK SRV_RQST -> SRV_RSP ATTR_RQST - * -> ATTR_RPLY SRV_TYPE_RQST -> SRV_TYPE_RPLY - */ - - private static byte[] makeErrorReply(SLPMessage pRequest, int pErrorCode) { - ReplyMessage replyMsg; - switch (pRequest.getFunctionID()) { - case SRV_RQST: - replyMsg = new ServiceReply(pErrorCode, null); - break; - case ATTR_RQST: - replyMsg = new AttributeReply(pErrorCode, null); - break; - case SRV_TYPE_RQST: - replyMsg = new ServiceTypeReply(pErrorCode, null); - break; - case SRV_REG: - case SRV_DEREG: - replyMsg = new ServiceAcknowledgment(pErrorCode); - break; - default: - return null; - } - replyMsg.setXID(pRequest.getXID()); - try { - return replyMsg.serialize(false, true, true); - } catch (ServiceLocationException se) { - TRC.error(se); - return null; - } - } - -} +/* + (C) Copyright IBM Corp. 2007, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, IBM, ebak@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1804402 2007-09-28 ebak IPv6 ready SLP + * 1804402 2007-11-10 ebak IPv6 ready SLP - revision 4 + * 1892103 2008-02-15 ebak SLP improvements + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors + */ + +package org.metricshub.wbem.sblim.slp.internal.sa; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.IOException; +import java.io.OutputStream; +import java.net.DatagramPacket; +import java.net.DatagramSocket; +import java.net.Socket; +import java.net.UnknownHostException; +import java.util.List; + +import org.metricshub.wbem.sblim.slp.ServiceURL; +import org.metricshub.wbem.sblim.slp.internal.IPv6MulticastAddressFactory; +import org.metricshub.wbem.sblim.slp.internal.SLPConfig; +import org.metricshub.wbem.sblim.slp.internal.SLPDefaults; +import org.metricshub.wbem.sblim.slp.internal.TRC; +import org.metricshub.wbem.sblim.slp.internal.msg.AttributeReply; +import org.metricshub.wbem.sblim.slp.internal.msg.AttributeRequest; +import org.metricshub.wbem.sblim.slp.internal.msg.MsgFactory; +import org.metricshub.wbem.sblim.slp.internal.msg.RequestMessage; +import org.metricshub.wbem.sblim.slp.internal.msg.SLPMessage; +import org.metricshub.wbem.sblim.slp.internal.msg.ServiceAcknowledgment; +import org.metricshub.wbem.sblim.slp.internal.msg.ServiceDeregistration; +import org.metricshub.wbem.sblim.slp.internal.msg.ServiceRegistration; +import org.metricshub.wbem.sblim.slp.internal.msg.ServiceReply; +import org.metricshub.wbem.sblim.slp.internal.msg.ServiceRequest; +import org.metricshub.wbem.sblim.slp.internal.msg.ServiceTypeReply; +import org.metricshub.wbem.sblim.slp.ServiceLocationException; +import org.metricshub.wbem.sblim.slp.internal.Net; +import org.metricshub.wbem.sblim.slp.internal.msg.FunctionIDs; +import org.metricshub.wbem.sblim.slp.internal.msg.ReplyMessage; + +/** + * ServiceAgent + * + */ +public class ServiceAgent implements FunctionIDs { + + private boolean iUseV4 = Net.hasIPv4() && SLPConfig.getGlobalCfg().useIPv4(), iUseV6 = Net + .hasIPv6() + && SLPConfig.getGlobalCfg().useIPv6(); + + boolean iStarted; + + private volatile boolean iSkipFirstRequest; + + private DatagramThread iDGThread = new DatagramThread(this); + + private TCPThread iTCPThread = new TCPThread(this); + + private ServiceTable iSrvTable = new ServiceTable(this.iDGThread); + + private MessageTable iMsgTable = new MessageTable(); + + /** + * main + * + * @param pArgs + * @throws IOException + */ + public static void main(String[] pArgs) throws IOException { + if (pArgs != null && pArgs.length >= 1) { + int port = Integer.parseInt(pArgs[0]); + SLPConfig.getGlobalCfg().setPort(port); + } + ServiceAgent srvAgent = new ServiceAgent(); + srvAgent.start(); + TRC.debug("starting idle loop"); + while (true) { + try { + Thread.sleep(100); + } catch (InterruptedException e) { + // lofasz + } + } + } + + /** + * setSkipFirstRequest + * + * @param pValue + */ + public void setSkipFirstRequest(boolean pValue) { + this.iSkipFirstRequest = pValue; + } + + /** + * start + * + * @throws IOException + */ + public void start() throws IOException { + if (this.iStarted) return; + // launch receivers + TRC.debug("start receivers"); + if (this.iUseV4 || this.iUseV6) { + this.iTCPThread.start(); + this.iDGThread.start(); + TRC.debug("wait4 TCP init"); + this.iTCPThread.wait4init(); + TRC.debug("wait4 Datagram init"); + this.iDGThread.wait4init(); + } + this.iStarted = true; + TRC.debug("receivers started"); + // join multicast groups + if (this.iUseV4) this.iDGThread.joinGroup(SLPConfig.getMulticastAddress()); + if (this.iUseV6) { + this.iDGThread.joinGroup(IPv6MulticastAddressFactory + .getSrvLocAddress(SLPDefaults.IPV6_MULTICAST_SCOPE)); + } + } + + /** + * stop + */ + public void stop() { + // stop the receivers + if (this.iUseV4 || this.iUseV6) { + this.iTCPThread.stop(); + this.iDGThread.stop(); + } + this.iStarted = false; + + } + + /** + * processMessage + * + * @param pDGSock + * @param pPacket + */ + public void processMessage(DatagramSocket pDGSock, DatagramPacket pPacket) { + byte[] reply; + SLPMessage msg; + try { + msg = MsgFactory.parse(pPacket); + } catch (Exception e) { + // no response for unparseable messages + TRC.debug("Message parsing error!", e); + return; + } + + try { + TRC.debug("processing: " + msg); + reply = this.iMsgTable.getResponse(pPacket.getAddress(), msg); + if (reply == null) { + SLPMessage replyMsg = makeReply(msg); + if (replyMsg != null) { + TRC.debug("response : " + replyMsg); + reply = replyMsg.serialize(false, true, true); + this.iMsgTable.addResponse(pPacket.getAddress(), msg, reply); + // debugging: do not reply to the first request + if (this.iSkipFirstRequest) { + TRC.debug("refusing response"); + return; + } + } + } else { + TRC.debug("cached response"); + } + } catch (ServiceLocationException e) { + TRC.debug(e.toString(), e); + reply = makeErrorReply(msg, e); // known XID + } + if (reply != null) { + try { + TRC.debug("sending response"); + pDGSock.send(new DatagramPacket(reply, reply.length, pPacket.getAddress(), pPacket + .getPort())); + } catch (IOException e) { + TRC.error(e); + } + } + } + + /** + * processMessage + * + * @param pStreamSock + */ + public void processMessage(Socket pStreamSock) { + byte[] reply; + SLPMessage msg; + try { + msg = MsgFactory.parse(pStreamSock.getInputStream()); + } catch (Exception e) { + // no response for unparseable messages + TRC.debug("Message parsing error!", e); + return; + } + try { + SLPMessage replyMsg = makeReply(msg); + reply = replyMsg == null ? null : replyMsg.serialize(false, false, true); + } catch (ServiceLocationException e) { + reply = makeErrorReply(msg, e); + } + if (reply != null) { + try { + OutputStream os = pStreamSock.getOutputStream(); + os.write(reply); + os.flush(); + } catch (IOException e) { + TRC.error(e); + } + } + try { + pStreamSock.close(); + } catch (IOException e) { + TRC.error(e); + } + } + + /* + * XID is set to a unique value for each unique request. If the request is + * retransmitted, the same XID is used. Replies set the XID to the same + * value as the xid in the request. Only unsolicited DAAdverts are sent with + * an XID of 0. + */ + private SLPMessage makeReply(SLPMessage pRequest) throws ServiceLocationException { + try { + SLPMessage msg = pRequest instanceof RequestMessage ? makeReply4Request((RequestMessage) pRequest) + : makeReply4Others(pRequest); + if (msg != null) msg.setXID(pRequest.getXID()); + return msg; + } catch (UnknownHostException e) { + TRC.error(e); + throw new ServiceLocationException(ServiceLocationException.NETWORK_ERROR); + } catch (IOException e) { + TRC.error(e); + throw new ServiceLocationException(ServiceLocationException.NETWORK_ERROR); + } + + } + + private ReplyMessage makeReply4Request(RequestMessage pRequest) { + ReplyMessage replyMsg; + List scopes = pRequest.getScopeList(); + switch (pRequest.getFunctionID()) { + case SRV_RQST: + ServiceRequest srvRqst = (ServiceRequest) pRequest; + if (SLPDefaults.DA_SERVICE_TYPE.equals(srvRqst.getServiceType())) return null; + List urlList = this.iSrvTable.getServiceURLs(srvRqst.getServiceType(), + scopes); + TRC.debug("srvReply : " + urlList); + replyMsg = new ServiceReply(0, urlList); + break; + case ATTR_RQST: + AttributeRequest attrRqst = (AttributeRequest) pRequest; + replyMsg = new AttributeReply(0, this.iSrvTable.getAttributes(attrRqst + .getServiceURL(), scopes)); + break; + case SRV_TYPE_RQST: + // ServiceTypeRequest srvTypeRqst = + // (ServiceTypeRequest)pRequest; + replyMsg = new ServiceTypeReply(0, this.iSrvTable.getServiceTypes(scopes)); + break; + default: + return null; + } + return replyMsg; + } + + private SLPMessage makeReply4Others(SLPMessage pRequest) throws IOException { + switch (pRequest.getFunctionID()) { + case SRV_REG: + ServiceRegistration srvReg = (ServiceRegistration) pRequest; + this.iSrvTable.add(srvReg.getServiceURL(), srvReg.getAttributeList(), srvReg + .getScopeList()); + return new ServiceAcknowledgment(0); + case SRV_DEREG: + ServiceDeregistration srvDereg = (ServiceDeregistration) pRequest; + this.iSrvTable.remove(srvDereg.getServiceURL()); + return new ServiceAcknowledgment(0); + default: + // FIXME maybe returning an error message is better + return null; + } + } + + private static byte[] makeErrorReply(SLPMessage pRequest, ServiceLocationException pE) { + return makeErrorReply(pRequest, pE.getErrorCode()); + } + + /* + * Error reply: SRV_REG, SRV_DEREG -> SRV_ACK SRV_RQST -> SRV_RSP ATTR_RQST + * -> ATTR_RPLY SRV_TYPE_RQST -> SRV_TYPE_RPLY + */ + + private static byte[] makeErrorReply(SLPMessage pRequest, int pErrorCode) { + ReplyMessage replyMsg; + switch (pRequest.getFunctionID()) { + case SRV_RQST: + replyMsg = new ServiceReply(pErrorCode, null); + break; + case ATTR_RQST: + replyMsg = new AttributeReply(pErrorCode, null); + break; + case SRV_TYPE_RQST: + replyMsg = new ServiceTypeReply(pErrorCode, null); + break; + case SRV_REG: + case SRV_DEREG: + replyMsg = new ServiceAcknowledgment(pErrorCode); + break; + default: + return null; + } + replyMsg.setXID(pRequest.getXID()); + try { + return replyMsg.serialize(false, true, true); + } catch (ServiceLocationException se) { + TRC.error(se); + return null; + } + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/sa/ServiceTable.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/sa/ServiceTable.java similarity index 85% rename from src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/sa/ServiceTable.java rename to src/main/java/org/metricshub/wbem/sblim/slp/internal/sa/ServiceTable.java index 4c2e9f2..dd29f23 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/sa/ServiceTable.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/sa/ServiceTable.java @@ -1,421 +1,419 @@ -/* - (C) Copyright IBM Corp. 2007, 2010 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, IBM, ebak@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1804402 2007-09-28 ebak IPv6 ready SLP - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 3023349 2010-07-02 blaschke-oss SLP uses # constructor instead of valueOf - */ - -package org.sentrysoftware.wbem.sblim.slp.internal.sa; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.IOException; -import java.net.UnknownHostException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; - -import org.sentrysoftware.wbem.sblim.slp.ServiceLocationAttribute; -import org.sentrysoftware.wbem.sblim.slp.ServiceType; -import org.sentrysoftware.wbem.sblim.slp.ServiceURL; -import org.sentrysoftware.wbem.sblim.slp.internal.IPv6MulticastAddressFactory; -import org.sentrysoftware.wbem.sblim.slp.internal.Net; -import org.sentrysoftware.wbem.sblim.slp.internal.SLPConfig; -import org.sentrysoftware.wbem.sblim.slp.internal.SLPDefaults; -import org.sentrysoftware.wbem.sblim.slp.internal.TRC; - -/** - * ServiceTable - * - */ -public class ServiceTable { - - DatagramThread iDgramThread; - - private boolean iUseV6 = Net.hasIPv6() && SLPConfig.getGlobalCfg().useIPv6(); - - class AddressHashTable { - - class Counter { - - /** - * iValue - */ - public int iValue = 1; - } - - /** - * AddressHash -> Counter - */ - private HashMap iMap = new HashMap(); - - /** - * register - * - * @param pType - * @throws UnknownHostException - * @throws IOException - */ - public void register(ServiceType pType) throws UnknownHostException, IOException { - Integer hash = Integer.valueOf(IPv6MulticastAddressFactory.getSrvTypeHash(pType)); - TRC.debug("srvType:" + pType + ", hash:" + hash); - Counter cntr = this.iMap.get(hash); - if (cntr == null) { - cntr = new Counter(); - this.iMap.put(hash, cntr); - ServiceTable.this.iDgramThread.joinGroup(IPv6MulticastAddressFactory.get( - SLPDefaults.IPV6_MULTICAST_SCOPE, hash.intValue())); - } else { - ++cntr.iValue; - } - - } - - /** - * unregister - * - * @param pType - * @throws UnknownHostException - * @throws IOException - */ - public void unregister(ServiceType pType) throws UnknownHostException, IOException { - Integer hash = Integer.valueOf(IPv6MulticastAddressFactory.getSrvTypeHash(pType)); - Counter cntr = this.iMap.get(hash); - if (cntr == null) return; - if (cntr.iValue <= 1) { - this.iMap.remove(hash); - ServiceTable.this.iDgramThread.leaveGroup(IPv6MulticastAddressFactory.get( - SLPDefaults.IPV6_MULTICAST_SCOPE, hash.intValue())); - } else { - --cntr.iValue; - } - } - - } - - private static class ServiceEntry { - - private ServiceURL iSrvURL; - - private List iAttribs; - - private List iScopes; - - /** - * Ctor. - * - * @param pSrvURL - * @param pAttribs - * @param pScopes - */ - public ServiceEntry(ServiceURL pSrvURL, List pAttribs, - List pScopes) { - set(pSrvURL, pAttribs, pScopes); - } - - /** - * set - * - * @param pSrvURL - * @param pAttribs - * @param pScopes - */ - public void set(ServiceURL pSrvURL, List pAttribs, - List pScopes) { - this.iSrvURL = pSrvURL; - this.iAttribs = pAttribs; - this.iScopes = pScopes; - } - - /** - * getServiceURL - * - * @return ServiceURL - */ - public ServiceURL getServiceURL() { - return this.iSrvURL; - } - - /** - * getServiceType - * - * @return ServiceType - */ - public ServiceType getServiceType() { - return this.iSrvURL.getServiceType(); - } - - /** - * getAttributes - * - * @return List - */ - public List getAttributes() { - return this.iAttribs; - } - - /** - * getScopes - * - * @return List - */ - public List getScopes() { - return this.iScopes; - } - - /** - * hasMatchingScope - * - * @param pScopes - * @return boolean - */ - public boolean hasMatchingScope(List pScopes) { - if (pScopes == null) return false; - Iterator itr = pScopes.iterator(); - while (itr.hasNext()) - if (hasScope(itr.next())) return true; - return false; - } - - @Override - public String toString() { - return "url:" + this.iSrvURL + ", attribs:" + dumpList(this.iAttribs) + ", scopes:" - + dumpList(this.iScopes); - } - - private boolean hasScope(String pScope) { - return this.iScopes == null ? false : this.iScopes.contains(pScope); - } - - } - - static class ServiceEntryList extends ArrayList { - - private static final long serialVersionUID = 1L; - - /** - * get - * - * @param pSrvURL - * @return ServiceEntry - */ - public ServiceEntry get(ServiceURL pSrvURL) { - for (int i = 0; i < size(); i++) { - ServiceEntry entry = (ServiceEntry) get(i); - if (pSrvURL.equals(entry.getServiceURL())) return entry; - } - return null; - } - - /** - * remove - * - * @param pSrvURL - */ - public void remove(ServiceURL pSrvURL) { - for (int i = 0; i < size(); i++) { - ServiceEntry entry = (ServiceEntry) get(i); - if (pSrvURL.equals(entry.getServiceURL())) { - remove(i); - break; - } - } - } - - /** - * getServiceURLs - * - * @param pSrvType - * @param pScopes - * @return List - */ - public List getServiceURLs(ServiceType pSrvType, List pScopes) { - if (pSrvType == null) return null; - List srvURLs = null; - for (int i = 0; i < size(); i++) { - ServiceEntry entry = (ServiceEntry) get(i); - if (!entry.hasMatchingScope(pScopes)) continue; - if (pSrvType.getPrincipleTypeName().equals( - entry.getServiceType().getPrincipleTypeName())) { - if (srvURLs == null) srvURLs = new ArrayList(); - srvURLs.add(entry.getServiceURL()); - } - } - return srvURLs; - } - - } - - private ServiceEntryList iSrvEntryTable = new ServiceEntryList(); - - private AddressHashTable iAddressHashTable = new AddressHashTable(); - - /** - * Ctor. - * - * @param pDgramThread - */ - public ServiceTable(DatagramThread pDgramThread) { - this.iDgramThread = pDgramThread; - } - - /** - * add - * - * @param pSrvURL - * @param pAttrList - * @param pScopes - * @throws UnknownHostException - * @throws IOException - */ - public synchronized void add(ServiceURL pSrvURL, List pAttrList, - List pScopes) throws UnknownHostException, IOException { - if (pSrvURL == null) return; - TRC.debug("add URL:" + pSrvURL + ", scopes:" + dumpList(pScopes)); - ServiceEntry srvEntry = this.iSrvEntryTable.get(pSrvURL); - if (srvEntry == null) { - this.iSrvEntryTable.add(new ServiceEntry(pSrvURL, pAttrList, pScopes)); - } else { - srvEntry.set(pSrvURL, pAttrList, pScopes); - } - - if (!this.iUseV6) return; - this.iAddressHashTable.register(pSrvURL.getServiceType()); - } - - /** - * remove - * - * @param pSrvURL - * @throws UnknownHostException - * @throws IOException - */ - public synchronized void remove(ServiceURL pSrvURL) throws UnknownHostException, IOException { - this.iSrvEntryTable.remove(pSrvURL); - - if (!this.iUseV6) return; - this.iAddressHashTable.unregister(pSrvURL.getServiceType()); - } - - /** - * getServiceURLs - * - * @param pSrvType - * @param pScopes - * @return List ServiceURL - */ - public synchronized List getServiceURLs(ServiceType pSrvType, List pScopes) { - TRC.debug("getServiceURLs srvType:" + pSrvType + ", scopes:" + dumpList(pScopes)); - List list = this.iSrvEntryTable.getServiceURLs(pSrvType, pScopes); - return list; - } - - /** - * getAttributes - * - * @param pSrvURL - * @param pScopes - * @return List ServiceLocationAttribute - */ - public synchronized List getAttributes(ServiceURL pSrvURL, - List pScopes) { - if (pSrvURL == null) return null; - if (pSrvURL.getURLPath() == null) return getAttributes(pSrvURL.getServiceType(), pScopes); - ServiceEntry entry = this.iSrvEntryTable.get(pSrvURL); - return entry == null ? null : entry.getAttributes(); - } - - /** - * getAttributes - * - * @param pSrvType - * @param pScopes - * @return List ServiceLocationAttribute - */ - public synchronized List getAttributes(ServiceType pSrvType, - List pScopes) { - if (pSrvType == null) return null; - HashSet attribs = new HashSet(); - for (int i = 0; i < this.iSrvEntryTable.size(); i++) { - ServiceEntry entry = (ServiceEntry) this.iSrvEntryTable.get(i); - ServiceType srvType = entry.getServiceType(); - if (pSrvType.equals(srvType)) attribs.addAll(entry.getAttributes()); - } - return new ArrayList(attribs); - } - - /** - * getServiceTypes - * - * @param pScopes - * @return List ServiceType - */ - public synchronized List getServiceTypes(List pScopes) { - List srvTypes = null; - for (int i = 0; i < this.iSrvEntryTable.size(); i++) { - ServiceEntry entry = (ServiceEntry) this.iSrvEntryTable.get(i); - if (entry.hasMatchingScope(pScopes)) { - ServiceType srvType = entry.getServiceType(); - if (srvType == null) continue; - if (srvTypes == null) srvTypes = new ArrayList(); - srvTypes.add(srvType); - } - } - return srvTypes; - } - - static String dumpList(List pList) { - return dumpList(pList, ","); - } - - private static String dumpList(List pList, String pSep) { - if (pList == null) return "null"; - StringBuffer buf = new StringBuffer(); - Iterator itr = pList.iterator(); - boolean first = true; - while (itr.hasNext()) { - if (!first) buf.append(pSep); - buf.append(itr.next().toString()); - first = false; - } - return buf.toString(); - } - -} +/* + (C) Copyright IBM Corp. 2007, 2010 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, IBM, ebak@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1804402 2007-09-28 ebak IPv6 ready SLP + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 3023349 2010-07-02 blaschke-oss SLP uses # constructor instead of valueOf + */ + +package org.metricshub.wbem.sblim.slp.internal.sa; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.IOException; +import java.net.UnknownHostException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; + +import org.metricshub.wbem.sblim.slp.ServiceLocationAttribute; +import org.metricshub.wbem.sblim.slp.ServiceType; +import org.metricshub.wbem.sblim.slp.ServiceURL; +import org.metricshub.wbem.sblim.slp.internal.IPv6MulticastAddressFactory; +import org.metricshub.wbem.sblim.slp.internal.SLPConfig; +import org.metricshub.wbem.sblim.slp.internal.SLPDefaults; +import org.metricshub.wbem.sblim.slp.internal.TRC; +import org.metricshub.wbem.sblim.slp.internal.Net; + +/** + * ServiceTable + * + */ +public class ServiceTable { + + DatagramThread iDgramThread; + + private boolean iUseV6 = Net.hasIPv6() && SLPConfig.getGlobalCfg().useIPv6(); + + class AddressHashTable { + + class Counter { + + /** + * iValue + */ + public int iValue = 1; + } + + /** + * AddressHash -> Counter + */ + private HashMap iMap = new HashMap(); + + /** + * register + * + * @param pType + * @throws UnknownHostException + * @throws IOException + */ + public void register(ServiceType pType) throws UnknownHostException, IOException { + Integer hash = Integer.valueOf(IPv6MulticastAddressFactory.getSrvTypeHash(pType)); + TRC.debug("srvType:" + pType + ", hash:" + hash); + Counter cntr = this.iMap.get(hash); + if (cntr == null) { + cntr = new Counter(); + this.iMap.put(hash, cntr); + ServiceTable.this.iDgramThread.joinGroup(IPv6MulticastAddressFactory.get( + SLPDefaults.IPV6_MULTICAST_SCOPE, hash.intValue())); + } else { + ++cntr.iValue; + } + + } + + /** + * unregister + * + * @param pType + * @throws UnknownHostException + * @throws IOException + */ + public void unregister(ServiceType pType) throws UnknownHostException, IOException { + Integer hash = Integer.valueOf(IPv6MulticastAddressFactory.getSrvTypeHash(pType)); + Counter cntr = this.iMap.get(hash); + if (cntr == null) return; + if (cntr.iValue <= 1) { + this.iMap.remove(hash); + ServiceTable.this.iDgramThread.leaveGroup(IPv6MulticastAddressFactory.get( + SLPDefaults.IPV6_MULTICAST_SCOPE, hash.intValue())); + } else { + --cntr.iValue; + } + } + + } + + private static class ServiceEntry { + + private ServiceURL iSrvURL; + + private List iAttribs; + + private List iScopes; + + /** + * Ctor. + * + * @param pSrvURL + * @param pAttribs + * @param pScopes + */ + public ServiceEntry(ServiceURL pSrvURL, List pAttribs, + List pScopes) { + set(pSrvURL, pAttribs, pScopes); + } + + /** + * set + * + * @param pSrvURL + * @param pAttribs + * @param pScopes + */ + public void set(ServiceURL pSrvURL, List pAttribs, + List pScopes) { + this.iSrvURL = pSrvURL; + this.iAttribs = pAttribs; + this.iScopes = pScopes; + } + + /** + * getServiceURL + * + * @return ServiceURL + */ + public ServiceURL getServiceURL() { + return this.iSrvURL; + } + + /** + * getServiceType + * + * @return ServiceType + */ + public ServiceType getServiceType() { + return this.iSrvURL.getServiceType(); + } + + /** + * getAttributes + * + * @return List + */ + public List getAttributes() { + return this.iAttribs; + } + + /** + * getScopes + * + * @return List + */ + public List getScopes() { + return this.iScopes; + } + + /** + * hasMatchingScope + * + * @param pScopes + * @return boolean + */ + public boolean hasMatchingScope(List pScopes) { + if (pScopes == null) return false; + Iterator itr = pScopes.iterator(); + while (itr.hasNext()) + if (hasScope(itr.next())) return true; + return false; + } + + @Override + public String toString() { + return "url:" + this.iSrvURL + ", attribs:" + dumpList(this.iAttribs) + ", scopes:" + + dumpList(this.iScopes); + } + + private boolean hasScope(String pScope) { + return this.iScopes == null ? false : this.iScopes.contains(pScope); + } + + } + + static class ServiceEntryList extends ArrayList { + + private static final long serialVersionUID = 1L; + + /** + * get + * + * @param pSrvURL + * @return ServiceEntry + */ + public ServiceEntry get(ServiceURL pSrvURL) { + for (int i = 0; i < size(); i++) { + ServiceEntry entry = (ServiceEntry) get(i); + if (pSrvURL.equals(entry.getServiceURL())) return entry; + } + return null; + } + + /** + * remove + * + * @param pSrvURL + */ + public void remove(ServiceURL pSrvURL) { + for (int i = 0; i < size(); i++) { + ServiceEntry entry = (ServiceEntry) get(i); + if (pSrvURL.equals(entry.getServiceURL())) { + remove(i); + break; + } + } + } + + /** + * getServiceURLs + * + * @param pSrvType + * @param pScopes + * @return List + */ + public List getServiceURLs(ServiceType pSrvType, List pScopes) { + if (pSrvType == null) return null; + List srvURLs = null; + for (int i = 0; i < size(); i++) { + ServiceEntry entry = (ServiceEntry) get(i); + if (!entry.hasMatchingScope(pScopes)) continue; + if (pSrvType.getPrincipleTypeName().equals( + entry.getServiceType().getPrincipleTypeName())) { + if (srvURLs == null) srvURLs = new ArrayList(); + srvURLs.add(entry.getServiceURL()); + } + } + return srvURLs; + } + + } + + private ServiceEntryList iSrvEntryTable = new ServiceEntryList(); + + private AddressHashTable iAddressHashTable = new AddressHashTable(); + + /** + * Ctor. + * + * @param pDgramThread + */ + public ServiceTable(DatagramThread pDgramThread) { + this.iDgramThread = pDgramThread; + } + + /** + * add + * + * @param pSrvURL + * @param pAttrList + * @param pScopes + * @throws UnknownHostException + * @throws IOException + */ + public synchronized void add(ServiceURL pSrvURL, List pAttrList, + List pScopes) throws UnknownHostException, IOException { + if (pSrvURL == null) return; + TRC.debug("add URL:" + pSrvURL + ", scopes:" + dumpList(pScopes)); + ServiceEntry srvEntry = this.iSrvEntryTable.get(pSrvURL); + if (srvEntry == null) { + this.iSrvEntryTable.add(new ServiceEntry(pSrvURL, pAttrList, pScopes)); + } else { + srvEntry.set(pSrvURL, pAttrList, pScopes); + } + + if (!this.iUseV6) return; + this.iAddressHashTable.register(pSrvURL.getServiceType()); + } + + /** + * remove + * + * @param pSrvURL + * @throws UnknownHostException + * @throws IOException + */ + public synchronized void remove(ServiceURL pSrvURL) throws UnknownHostException, IOException { + this.iSrvEntryTable.remove(pSrvURL); + + if (!this.iUseV6) return; + this.iAddressHashTable.unregister(pSrvURL.getServiceType()); + } + + /** + * getServiceURLs + * + * @param pSrvType + * @param pScopes + * @return List ServiceURL + */ + public synchronized List getServiceURLs(ServiceType pSrvType, List pScopes) { + TRC.debug("getServiceURLs srvType:" + pSrvType + ", scopes:" + dumpList(pScopes)); + List list = this.iSrvEntryTable.getServiceURLs(pSrvType, pScopes); + return list; + } + + /** + * getAttributes + * + * @param pSrvURL + * @param pScopes + * @return List ServiceLocationAttribute + */ + public synchronized List getAttributes(ServiceURL pSrvURL, + List pScopes) { + if (pSrvURL == null) return null; + if (pSrvURL.getURLPath() == null) return getAttributes(pSrvURL.getServiceType(), pScopes); + ServiceEntry entry = this.iSrvEntryTable.get(pSrvURL); + return entry == null ? null : entry.getAttributes(); + } + + /** + * getAttributes + * + * @param pSrvType + * @param pScopes + * @return List ServiceLocationAttribute + */ + public synchronized List getAttributes(ServiceType pSrvType, + List pScopes) { + if (pSrvType == null) return null; + HashSet attribs = new HashSet(); + for (int i = 0; i < this.iSrvEntryTable.size(); i++) { + ServiceEntry entry = (ServiceEntry) this.iSrvEntryTable.get(i); + ServiceType srvType = entry.getServiceType(); + if (pSrvType.equals(srvType)) attribs.addAll(entry.getAttributes()); + } + return new ArrayList(attribs); + } + + /** + * getServiceTypes + * + * @param pScopes + * @return List ServiceType + */ + public synchronized List getServiceTypes(List pScopes) { + List srvTypes = null; + for (int i = 0; i < this.iSrvEntryTable.size(); i++) { + ServiceEntry entry = (ServiceEntry) this.iSrvEntryTable.get(i); + if (entry.hasMatchingScope(pScopes)) { + ServiceType srvType = entry.getServiceType(); + if (srvType == null) continue; + if (srvTypes == null) srvTypes = new ArrayList(); + srvTypes.add(srvType); + } + } + return srvTypes; + } + + static String dumpList(List pList) { + return dumpList(pList, ","); + } + + private static String dumpList(List pList, String pSep) { + if (pList == null) return "null"; + StringBuffer buf = new StringBuffer(); + Iterator itr = pList.iterator(); + boolean first = true; + while (itr.hasNext()) { + if (!first) buf.append(pSep); + buf.append(itr.next().toString()); + first = false; + } + return buf.toString(); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/sa/TCPThread.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/sa/TCPThread.java similarity index 71% rename from src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/sa/TCPThread.java rename to src/main/java/org/metricshub/wbem/sblim/slp/internal/sa/TCPThread.java index 2c07417..64d7cc6 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/sa/TCPThread.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/sa/TCPThread.java @@ -1,117 +1,115 @@ -/* - (C) Copyright IBM Corp. 2007, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, IBM, ebak@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1804402 2007-09-28 ebak IPv6 ready SLP - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors - */ - -package org.sentrysoftware.wbem.sblim.slp.internal.sa; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.IOException; -import java.net.ServerSocket; -import java.net.Socket; -import java.net.SocketTimeoutException; - -import org.sentrysoftware.wbem.sblim.slp.internal.SLPConfig; -import org.sentrysoftware.wbem.sblim.slp.internal.TRC; - -/** - * TCPThread - * - */ -public class TCPThread extends RecieverThread { - - private ServerSocket iListenerSocket; - - /** - * Ctor. - * - * @param pSrvAgent - */ - public TCPThread(ServiceAgent pSrvAgent) { - super("TCP receiver", pSrvAgent); - } - - @Override - protected void init() throws IOException { - this.iListenerSocket = new ServerSocket(SLPConfig.getGlobalCfg().getPort()); - this.iListenerSocket.setReuseAddress(true); - this.iListenerSocket.setSoTimeout(100); - } - - @Override - protected void mainLoop() throws IOException { - try { - new ConnectionThread(this.iListenerSocket.accept()); - } catch (SocketTimeoutException e) { - // superclass will execute the mainLoop again - } - } - - private class ConnectionThread implements Runnable { - - private Socket iSock; - - /** - * Ctor. - * - * @param pSock - */ - public ConnectionThread(Socket pSock) { - this.iSock = pSock; - new Thread(this).start(); - } - - public void run() { - TCPThread.this.iSrvAgent.processMessage(this.iSock); - } - - } - - @Override - protected void close() { - if (this.iListenerSocket == null) return; - try { - this.iListenerSocket.close(); - } catch (IOException e) { - TRC.error(e); - } - } - -} +/* + (C) Copyright IBM Corp. 2007, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, IBM, ebak@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1804402 2007-09-28 ebak IPv6 ready SLP + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors + */ + +package org.metricshub.wbem.sblim.slp.internal.sa; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.IOException; +import java.net.ServerSocket; +import java.net.Socket; +import java.net.SocketTimeoutException; + +import org.metricshub.wbem.sblim.slp.internal.SLPConfig; +import org.metricshub.wbem.sblim.slp.internal.TRC; + +/** + * TCPThread + * + */ +public class TCPThread extends RecieverThread { + + private ServerSocket iListenerSocket; + + /** + * Ctor. + * + * @param pSrvAgent + */ + public TCPThread(ServiceAgent pSrvAgent) { + super("TCP receiver", pSrvAgent); + } + + @Override + protected void init() throws IOException { + this.iListenerSocket = new ServerSocket(SLPConfig.getGlobalCfg().getPort()); + this.iListenerSocket.setReuseAddress(true); + this.iListenerSocket.setSoTimeout(100); + } + + @Override + protected void mainLoop() throws IOException { + try { + new ConnectionThread(this.iListenerSocket.accept()); + } catch (SocketTimeoutException e) { + // superclass will execute the mainLoop again + } + } + + private class ConnectionThread implements Runnable { + + private Socket iSock; + + /** + * Ctor. + * + * @param pSock + */ + public ConnectionThread(Socket pSock) { + this.iSock = pSock; + new Thread(this).start(); + } + + public void run() { + TCPThread.this.iSrvAgent.processMessage(this.iSock); + } + + } + + @Override + protected void close() { + if (this.iListenerSocket == null) return; + try { + this.iListenerSocket.close(); + } catch (IOException e) { + TRC.error(e); + } + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/ua/DACache.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/ua/DACache.java similarity index 80% rename from src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/ua/DACache.java rename to src/main/java/org/metricshub/wbem/sblim/slp/internal/ua/DACache.java index d4bbea2..b0fc299 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/ua/DACache.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/ua/DACache.java @@ -1,175 +1,173 @@ -/* - (C) Copyright IBM Corp. 2007, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, IBM, ebak@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1804402 2007-09-28 ebak IPv6 ready SLP - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - */ - -package org.sentrysoftware.wbem.sblim.slp.internal.ua; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.ArrayList; -import java.util.Date; -import java.util.Iterator; -import java.util.List; -import java.util.TreeMap; -import java.util.TreeSet; - -import org.sentrysoftware.wbem.sblim.slp.internal.SLPDefaults; -import org.sentrysoftware.wbem.sblim.slp.internal.msg.DADescriptor; - -/** - * DACache caches the discovered DA list in order to eliminate frequent DA - * discovery network traffic. - * - */ -public class DACache { - - private static class ScopeEntry { - - private long iTimeOfDiscovery; - - private TreeSet iDADescriptors; - - /** - * Ctor. - * - * @param pDADescriptors - */ - public ScopeEntry(TreeSet pDADescriptors) { - this.iDADescriptors = pDADescriptors; - this.iTimeOfDiscovery = getSecs(); - } - - /** - * valid - * - * @return boolean - */ - public boolean valid() { - return getSecs() - this.iTimeOfDiscovery <= SLPDefaults.DACACHE_TIMEOUT; - } - - /** - * getDADescriptorItr - * - * @return Iterator - */ - public Iterator getDADescriptorItr() { - return this.iDADescriptors == null ? null : this.iDADescriptors.iterator(); - } - - } - - /** - * key: scope value: ScopeEntry - */ - private static TreeMap cScopeMap = new TreeMap(); - - // TODO: handle scopes - - /** - * @param pScopes - * @return List of discoverable scope strings - */ - public static synchronized List getDiscoverableScopeList(List pScopes) { - if (pScopes == null || pScopes.size() == 0) return null; - List scopeList = null; - Iterator itr = pScopes.iterator(); - while (itr.hasNext()) { - String scope = itr.next(); - ScopeEntry scopeEntry = cScopeMap.get(scope); - if (scopeEntry == null || !scopeEntry.valid()) { - if (scopeList == null) scopeList = new ArrayList(); - scopeList.add(scope); - } - } - return scopeList; - } - - /** - * @param pScopes - * @return List of DA URLs - */ - public static synchronized List getDAList(List pScopes) { - if (cScopeMap == null) return null; - TreeSet daSet = new TreeSet(); - Iterator scopeItr = pScopes.iterator(); - while (scopeItr.hasNext()) { - String scope = scopeItr.next(); - ScopeEntry scopeEntry = cScopeMap.get(scope); - if (scopeEntry == null) continue; - Iterator descItr = scopeEntry.getDADescriptorItr(); - if (descItr == null) continue; - while (descItr.hasNext()) { - daSet.add(descItr.next().getURL()); - } - } - return new ArrayList(daSet); - } - - /** - * @param pScopes - * - list of discovered hosts - * @param pDADescriptors - * - DADescriptors of the discovered DAs - */ - public static synchronized void setDAList(List pScopes, - List pDADescriptors) { - if (pScopes == null || pDADescriptors == null) return; - Iterator scopeItr = pScopes.iterator(); - while (scopeItr.hasNext()) { - String scope = scopeItr.next(); - TreeSet daDescsForScope = null; - Iterator descItr = pDADescriptors.iterator(); - while (descItr.hasNext()) { - DADescriptor daDesc = descItr.next(); - if (daDesc.hasScope(scope)) { - if (daDescsForScope == null) daDescsForScope = new TreeSet(); - daDescsForScope.add(daDesc); - } - } - cScopeMap.put(scope, new ScopeEntry(daDescsForScope)); - } - } - - static long getSecs() { - return new Date().getTime() / 1000; - } - -} +/* + (C) Copyright IBM Corp. 2007, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, IBM, ebak@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1804402 2007-09-28 ebak IPv6 ready SLP + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + */ + +package org.metricshub.wbem.sblim.slp.internal.ua; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.ArrayList; +import java.util.Date; +import java.util.Iterator; +import java.util.List; +import java.util.TreeMap; +import java.util.TreeSet; + +import org.metricshub.wbem.sblim.slp.internal.SLPDefaults; +import org.metricshub.wbem.sblim.slp.internal.msg.DADescriptor; + +/** + * DACache caches the discovered DA list in order to eliminate frequent DA + * discovery network traffic. + * + */ +public class DACache { + + private static class ScopeEntry { + + private long iTimeOfDiscovery; + + private TreeSet iDADescriptors; + + /** + * Ctor. + * + * @param pDADescriptors + */ + public ScopeEntry(TreeSet pDADescriptors) { + this.iDADescriptors = pDADescriptors; + this.iTimeOfDiscovery = getSecs(); + } + + /** + * valid + * + * @return boolean + */ + public boolean valid() { + return getSecs() - this.iTimeOfDiscovery <= SLPDefaults.DACACHE_TIMEOUT; + } + + /** + * getDADescriptorItr + * + * @return Iterator + */ + public Iterator getDADescriptorItr() { + return this.iDADescriptors == null ? null : this.iDADescriptors.iterator(); + } + + } + + /** + * key: scope value: ScopeEntry + */ + private static TreeMap cScopeMap = new TreeMap(); + + // TODO: handle scopes + + /** + * @param pScopes + * @return List of discoverable scope strings + */ + public static synchronized List getDiscoverableScopeList(List pScopes) { + if (pScopes == null || pScopes.size() == 0) return null; + List scopeList = null; + Iterator itr = pScopes.iterator(); + while (itr.hasNext()) { + String scope = itr.next(); + ScopeEntry scopeEntry = cScopeMap.get(scope); + if (scopeEntry == null || !scopeEntry.valid()) { + if (scopeList == null) scopeList = new ArrayList(); + scopeList.add(scope); + } + } + return scopeList; + } + + /** + * @param pScopes + * @return List of DA URLs + */ + public static synchronized List getDAList(List pScopes) { + if (cScopeMap == null) return null; + TreeSet daSet = new TreeSet(); + Iterator scopeItr = pScopes.iterator(); + while (scopeItr.hasNext()) { + String scope = scopeItr.next(); + ScopeEntry scopeEntry = cScopeMap.get(scope); + if (scopeEntry == null) continue; + Iterator descItr = scopeEntry.getDADescriptorItr(); + if (descItr == null) continue; + while (descItr.hasNext()) { + daSet.add(descItr.next().getURL()); + } + } + return new ArrayList(daSet); + } + + /** + * @param pScopes + * - list of discovered hosts + * @param pDADescriptors + * - DADescriptors of the discovered DAs + */ + public static synchronized void setDAList(List pScopes, + List pDADescriptors) { + if (pScopes == null || pDADescriptors == null) return; + Iterator scopeItr = pScopes.iterator(); + while (scopeItr.hasNext()) { + String scope = scopeItr.next(); + TreeSet daDescsForScope = null; + Iterator descItr = pDADescriptors.iterator(); + while (descItr.hasNext()) { + DADescriptor daDesc = descItr.next(); + if (daDesc.hasScope(scope)) { + if (daDescsForScope == null) daDescsForScope = new TreeSet(); + daDescsForScope.add(daDesc); + } + } + cScopeMap.put(scope, new ScopeEntry(daDescsForScope)); + } + } + + static long getSecs() { + return new Date().getTime() / 1000; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/ua/DatagramRequester.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/ua/DatagramRequester.java similarity index 86% rename from src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/ua/DatagramRequester.java rename to src/main/java/org/metricshub/wbem/sblim/slp/internal/ua/DatagramRequester.java index 47b8795..9546500 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/ua/DatagramRequester.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/ua/DatagramRequester.java @@ -1,419 +1,417 @@ -/* - (C) Copyright IBM Corp. 2007, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, IBM, ebak@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1804402 2007-09-28 ebak IPv6 ready SLP - * 1804402 2007-11-10 ebak IPv6 ready SLP - revision 4 - * 1892103 2008-02-12 ebak SLP improvements - * 1949918 2008-04-08 raman_arora Malformed service URL crashes SLP discovery - * 1950819 2008-04-24 rgummada SLP error: "java.io.IOException" on Linux and IPv6 - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2839595 2009-09-30 rgummada SLP discovery fails on Unix IPv6 systems - */ - -package org.sentrysoftware.wbem.sblim.slp.internal.ua; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.IOException; -import java.net.DatagramPacket; -import java.net.DatagramSocket; -import java.net.Inet6Address; -import java.net.InetAddress; -import java.net.MulticastSocket; -import java.net.SocketTimeoutException; -import java.util.ArrayList; -import java.util.Date; -import java.util.Iterator; -import java.util.List; - -import org.sentrysoftware.wbem.sblim.slp.ServiceLocationException; -import org.sentrysoftware.wbem.sblim.slp.internal.IPv6MulticastAddressFactory; -import org.sentrysoftware.wbem.sblim.slp.internal.Net; -import org.sentrysoftware.wbem.sblim.slp.internal.SLPConfig; -import org.sentrysoftware.wbem.sblim.slp.internal.SLPDefaults; -import org.sentrysoftware.wbem.sblim.slp.internal.TRC; -import org.sentrysoftware.wbem.sblim.slp.internal.msg.MsgFactory; -import org.sentrysoftware.wbem.sblim.slp.internal.msg.ReplyMessage; -import org.sentrysoftware.wbem.sblim.slp.internal.msg.RequestMessage; - -/** - * DatagramRequester - * - */ -public class DatagramRequester implements Runnable { - - RequestMessage iReqMsg; - - private Thread iThread; - - ResultTable iResTable; - - private InetAddress iDst0, iDst1; - - private DatagramSocket iDGramSocket; - - private int iPort = SLPConfig.getGlobalCfg().getPort(); - - private boolean iUseV4 = Net.hasIPv4() && SLPConfig.getGlobalCfg().useIPv4(), iUseV6 = Net - .hasIPv6() - && SLPConfig.getGlobalCfg().useIPv6(); - - private List iTCPRequesters; - - int iTotalTimeOut; - - int[] iTimeOuts; - - int iMaxResults = SLPConfig.getGlobalCfg().getMaximumResults(); - - /* - * this size is used for the receiver instead of the configurable MTU size - */ - private static final int MAX_DATAGRAM_SIZE = 65536; - - private final byte[] iInBuf = new byte[MAX_DATAGRAM_SIZE]; - - /** - * Constructor used for unicast requests - * - * @param pRqstMsg - * @param pResTable - * @param pDst - * @throws IOException - */ - public DatagramRequester(RequestMessage pRqstMsg, ResultTable pResTable, InetAddress pDst) - throws IOException { - this.iReqMsg = pRqstMsg; - this.iResTable = pResTable; - this.iDst0 = pDst; - this.iTimeOuts = SLPConfig.getGlobalCfg().getDatagramTimeouts(); - this.iDGramSocket = new DatagramSocket(); - } - - /** - * Constructor used for multicast requests - * - * @param pRqstMsg - * @param pResTable - * @throws IOException - */ - public DatagramRequester(RequestMessage pRqstMsg, ResultTable pResTable) throws IOException { - this.iReqMsg = pRqstMsg; - this.iResTable = pResTable; - this.iTimeOuts = SLPConfig.getGlobalCfg().getMulticastTimeouts(); - this.iTotalTimeOut = SLPConfig.getGlobalCfg().getMulticastMaximumWait(); - MulticastSocket mcastSocket = new MulticastSocket(); - this.iDGramSocket = mcastSocket; - if (this.iUseV6) { - this.iDst0 = IPv6MulticastAddressFactory - .get(SLPDefaults.IPV6_MULTICAST_SCOPE, pRqstMsg); - try { - mcastSocket.joinGroup(this.iDst0); - } catch (IOException ioe) { - // some kernels can't handle IPv6 mcast - TRC.warning("IOException caught during join, disabling IPv6: " + ioe.getMessage(), - ioe); - this.iDst0 = null; - } - } - if (this.iUseV4) { - this.iDst1 = SLPConfig.getMulticastAddress(); - mcastSocket.joinGroup(this.iDst1); - } - } - - /** - * start - * - * @param pAsThread - */ - public void start(boolean pAsThread) { - this.iResTable.registerRequester(this); - if (pAsThread) { - this.iThread = new Thread(this); - this.iThread.start(); - } else { - this.iThread = null; - run(); - } - } - - /** - * For diagnostic only. - * - * @return int - */ - public int getPort() { - return this.iDGramSocket == null ? -1 : this.iDGramSocket.getLocalPort(); - } - - /** - * waitFor - */ - public void waitFor() { - if (this.iThread == null) return; - try { - this.iThread.join(); - } catch (InterruptedException e) { - TRC.error(e); - } - } - - public void run() { - try { - if (this.iDGramSocket instanceof MulticastSocket) { - mcastNegotiate(); - } else { - ucastNegotiate(); - } - } catch (Exception e) { - this.iResTable.addException(e); - TRC.error(e.getMessage(), e); - } finally { - this.iDGramSocket.close(); - this.iResTable.unregisterRequester(this); - } - } - - class MCastLoopController { - - private long iStartTime = getMillis(); - - private int iTimeOutIdx = 0; - - /** - * getTimeOut - * - * @return int - */ - public int getTimeOut() { - return DatagramRequester.this.iTimeOuts[this.iTimeOutIdx]; - } - - private boolean hasNextTimeOut() { - return this.iTimeOutIdx < DatagramRequester.this.iTimeOuts.length; - } - - /** - * nextTimeOut - */ - public void nextTimeOut() { - if (hasNextTimeOut()) ++this.iTimeOutIdx; - } - - /** - * hasNext - * - * @return boolean - */ - public boolean hasNext() { - return DatagramRequester.this.iResTable.getTotalResponses() < DatagramRequester.this.iMaxResults - && getMillis() - this.iStartTime < DatagramRequester.this.iTotalTimeOut - && hasNextTimeOut(); - } - - } - - private void mcastNegotiate() throws Exception { - byte[] reqBytes = this.iReqMsg.serialize(true, true, false); - DatagramPacket outPacket0 = this.iDst0 == null ? null : new DatagramPacket(reqBytes, - reqBytes.length, this.iDst0, this.iPort); - DatagramPacket outPacket1 = this.iDst1 == null ? null : new DatagramPacket(reqBytes, - reqBytes.length, this.iDst1, this.iPort); - DatagramPacket inPacket = new DatagramPacket(this.iInBuf, this.iInBuf.length); - MCastLoopController ctrl = new MCastLoopController(); - boolean respondersUpdated = false; - ResponseCache rspCache = new ResponseCache(); - sendLoop: while (ctrl.hasNext()) { - if (respondersUpdated) { - byte[] msg = this.iReqMsg.serialize(true, true, true); - if (outPacket0 != null) outPacket0.setData(msg); - if (outPacket1 != null) outPacket1.setData(msg); - respondersUpdated = false; - } - // send it relative frequently in order to avoid lost packets - TRC.debug("sending: " + this.iReqMsg); - - try { - if (outPacket0 != null) this.iDGramSocket.send(outPacket0); - } catch (IOException ioe) { - // some back level kernels can't handle sending IPv6 mcast - TRC.warning("IOException caught during send, disabling IPv6: " + ioe.getMessage(), - ioe); - outPacket0 = null; - this.iDst0 = null; - } - - if (outPacket1 != null) this.iDGramSocket.send(outPacket1); - while (ctrl.hasNext()) { - this.iDGramSocket.setSoTimeout(ctrl.getTimeOut()); - try { - this.iDGramSocket.receive(inPacket); - } catch (SocketTimeoutException e) { - // set new timeout value - TRC.debug("receive timed out"); - ctrl.nextTimeOut(); - continue sendLoop; - } - InetAddress responderAddress = inPacket.getAddress(); - - respondersUpdated = this.iReqMsg.updatePrevResponders(responderAddress.toString()); - - if (rspCache.contains(inPacket)) { - TRC.debug("received packet is found in rspCache"); - continue; // packet data is already processed - } - ReplyMessage replyMsg = handleResponse(inPacket); - - if (replyMsg != null) { - if (replyMsg.overflows()) { - if (!isLinkLocal(responderAddress)) { - // TCP doesn't seem to be working on linkLocal IPv6 - // connection - addTCPRequester(responderAddress); - rspCache.add(inPacket); - } - } else { - rspCache.add(inPacket); - } - } - } - break; - } - waitForTCPRequesters(); - } - - private void ucastNegotiate() throws Exception { - byte[] reqBytes = this.iReqMsg.serialize(false, true, false); - DatagramPacket outPacket = new DatagramPacket(reqBytes, reqBytes.length, this.iDst0, - this.iPort); - DatagramPacket inPacket = new DatagramPacket(this.iInBuf, this.iInBuf.length); - int timeOutIdx = 0; - int timeOut = this.iTimeOuts[timeOutIdx]; - /* - * ad-hoc solution to avoid endless loop in case of broken answers - */ - int tries = 10; - while (timeOutIdx < this.iTimeOuts.length && tries > 0) { - // send it relative frequently in order to avoid lost packets - TRC.debug("sending: " + this.iReqMsg); - this.iDGramSocket.send(outPacket); - this.iDGramSocket.setSoTimeout(timeOut); - try { - this.iDGramSocket.receive(inPacket); - } catch (SocketTimeoutException e) { - // set new timeout value - TRC.debug("receive timed out"); - timeOut = this.iTimeOuts[timeOutIdx++]; - continue; - } - InetAddress responderAddress = inPacket.getAddress(); - ReplyMessage replyMsg = handleResponse(inPacket); - if (replyMsg == null) { - --tries; - continue; - } - if (replyMsg.overflows()) { - TCPRequester tcpRequester = new TCPRequester(this.iResTable, responderAddress, - this.iReqMsg, true); - tcpRequester.waitFor(); - } - /* - * one answer is wanted from one host - */ - break; - } - } - - /** - * Tries to parse the content of the packet as a ReplyMessage. If parsing is - * successful ReplyMessage is placed into the ResultTable, otherwise the - * Exception is placed there. - * - * @param pPacket - * @return the ReplyMessage or null in case of - * - * Add all invalid URL exceptions thrown by parser into exception - * table - */ - private ReplyMessage handleResponse(DatagramPacket pPacket) { - ReplyMessage replyMsg; - try { - replyMsg = (ReplyMessage) MsgFactory.parse(pPacket); - TRC.debug("expected: " + this.iReqMsg.getXID() + ", received: " + replyMsg); - if (this.iReqMsg.getXID() != replyMsg.getXID() - || !this.iReqMsg.isAllowedResponseType(replyMsg)) { - TRC.debug("expected: " + this.iReqMsg.getXID() + ", ignoring: " + replyMsg); - return null; - } - } catch (Exception e) { - this.iResTable.addException(e); - return null; - } - TRC.debug("resTable <- " + replyMsg); - this.iResTable.addResults(replyMsg); - this.iResTable.addExceptions(replyMsg); - return replyMsg; - } - - private static boolean isLinkLocal(InetAddress pAddr) { - if (pAddr instanceof Inet6Address) { - Inet6Address dest6 = (Inet6Address) pAddr; - // TCP on linkLocal is evil - return dest6.isLinkLocalAddress(); - } - return false; - } - - static long getMillis() { - return new Date().getTime(); - } - - private void addTCPRequester(InetAddress pDest) throws ServiceLocationException { - if (this.iTCPRequesters == null) this.iTCPRequesters = new ArrayList(); - this.iTCPRequesters.add(new TCPRequester(this.iResTable, pDest, this.iReqMsg, true)); - } - - private void waitForTCPRequesters() { - if (this.iTCPRequesters == null) return; - Iterator itr = this.iTCPRequesters.iterator(); - while (itr.hasNext()) - itr.next().waitFor(); - this.iTCPRequesters.clear(); - } - -} +/* + (C) Copyright IBM Corp. 2007, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, IBM, ebak@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1804402 2007-09-28 ebak IPv6 ready SLP + * 1804402 2007-11-10 ebak IPv6 ready SLP - revision 4 + * 1892103 2008-02-12 ebak SLP improvements + * 1949918 2008-04-08 raman_arora Malformed service URL crashes SLP discovery + * 1950819 2008-04-24 rgummada SLP error: "java.io.IOException" on Linux and IPv6 + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2839595 2009-09-30 rgummada SLP discovery fails on Unix IPv6 systems + */ + +package org.metricshub.wbem.sblim.slp.internal.ua; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.IOException; +import java.net.DatagramPacket; +import java.net.DatagramSocket; +import java.net.Inet6Address; +import java.net.InetAddress; +import java.net.MulticastSocket; +import java.net.SocketTimeoutException; +import java.util.ArrayList; +import java.util.Date; +import java.util.Iterator; +import java.util.List; + +import org.metricshub.wbem.sblim.slp.internal.IPv6MulticastAddressFactory; +import org.metricshub.wbem.sblim.slp.internal.SLPConfig; +import org.metricshub.wbem.sblim.slp.internal.SLPDefaults; +import org.metricshub.wbem.sblim.slp.internal.TRC; +import org.metricshub.wbem.sblim.slp.internal.msg.MsgFactory; +import org.metricshub.wbem.sblim.slp.internal.msg.RequestMessage; +import org.metricshub.wbem.sblim.slp.ServiceLocationException; +import org.metricshub.wbem.sblim.slp.internal.Net; +import org.metricshub.wbem.sblim.slp.internal.msg.ReplyMessage; + +/** + * DatagramRequester + * + */ +public class DatagramRequester implements Runnable { + + RequestMessage iReqMsg; + + private Thread iThread; + + ResultTable iResTable; + + private InetAddress iDst0, iDst1; + + private DatagramSocket iDGramSocket; + + private int iPort = SLPConfig.getGlobalCfg().getPort(); + + private boolean iUseV4 = Net.hasIPv4() && SLPConfig.getGlobalCfg().useIPv4(), iUseV6 = Net + .hasIPv6() + && SLPConfig.getGlobalCfg().useIPv6(); + + private List iTCPRequesters; + + int iTotalTimeOut; + + int[] iTimeOuts; + + int iMaxResults = SLPConfig.getGlobalCfg().getMaximumResults(); + + /* + * this size is used for the receiver instead of the configurable MTU size + */ + private static final int MAX_DATAGRAM_SIZE = 65536; + + private final byte[] iInBuf = new byte[MAX_DATAGRAM_SIZE]; + + /** + * Constructor used for unicast requests + * + * @param pRqstMsg + * @param pResTable + * @param pDst + * @throws IOException + */ + public DatagramRequester(RequestMessage pRqstMsg, ResultTable pResTable, InetAddress pDst) + throws IOException { + this.iReqMsg = pRqstMsg; + this.iResTable = pResTable; + this.iDst0 = pDst; + this.iTimeOuts = SLPConfig.getGlobalCfg().getDatagramTimeouts(); + this.iDGramSocket = new DatagramSocket(); + } + + /** + * Constructor used for multicast requests + * + * @param pRqstMsg + * @param pResTable + * @throws IOException + */ + public DatagramRequester(RequestMessage pRqstMsg, ResultTable pResTable) throws IOException { + this.iReqMsg = pRqstMsg; + this.iResTable = pResTable; + this.iTimeOuts = SLPConfig.getGlobalCfg().getMulticastTimeouts(); + this.iTotalTimeOut = SLPConfig.getGlobalCfg().getMulticastMaximumWait(); + MulticastSocket mcastSocket = new MulticastSocket(); + this.iDGramSocket = mcastSocket; + if (this.iUseV6) { + this.iDst0 = IPv6MulticastAddressFactory + .get(SLPDefaults.IPV6_MULTICAST_SCOPE, pRqstMsg); + try { + mcastSocket.joinGroup(this.iDst0); + } catch (IOException ioe) { + // some kernels can't handle IPv6 mcast + TRC.warning("IOException caught during join, disabling IPv6: " + ioe.getMessage(), + ioe); + this.iDst0 = null; + } + } + if (this.iUseV4) { + this.iDst1 = SLPConfig.getMulticastAddress(); + mcastSocket.joinGroup(this.iDst1); + } + } + + /** + * start + * + * @param pAsThread + */ + public void start(boolean pAsThread) { + this.iResTable.registerRequester(this); + if (pAsThread) { + this.iThread = new Thread(this); + this.iThread.start(); + } else { + this.iThread = null; + run(); + } + } + + /** + * For diagnostic only. + * + * @return int + */ + public int getPort() { + return this.iDGramSocket == null ? -1 : this.iDGramSocket.getLocalPort(); + } + + /** + * waitFor + */ + public void waitFor() { + if (this.iThread == null) return; + try { + this.iThread.join(); + } catch (InterruptedException e) { + TRC.error(e); + } + } + + public void run() { + try { + if (this.iDGramSocket instanceof MulticastSocket) { + mcastNegotiate(); + } else { + ucastNegotiate(); + } + } catch (Exception e) { + this.iResTable.addException(e); + TRC.error(e.getMessage(), e); + } finally { + this.iDGramSocket.close(); + this.iResTable.unregisterRequester(this); + } + } + + class MCastLoopController { + + private long iStartTime = getMillis(); + + private int iTimeOutIdx = 0; + + /** + * getTimeOut + * + * @return int + */ + public int getTimeOut() { + return DatagramRequester.this.iTimeOuts[this.iTimeOutIdx]; + } + + private boolean hasNextTimeOut() { + return this.iTimeOutIdx < DatagramRequester.this.iTimeOuts.length; + } + + /** + * nextTimeOut + */ + public void nextTimeOut() { + if (hasNextTimeOut()) ++this.iTimeOutIdx; + } + + /** + * hasNext + * + * @return boolean + */ + public boolean hasNext() { + return DatagramRequester.this.iResTable.getTotalResponses() < DatagramRequester.this.iMaxResults + && getMillis() - this.iStartTime < DatagramRequester.this.iTotalTimeOut + && hasNextTimeOut(); + } + + } + + private void mcastNegotiate() throws Exception { + byte[] reqBytes = this.iReqMsg.serialize(true, true, false); + DatagramPacket outPacket0 = this.iDst0 == null ? null : new DatagramPacket(reqBytes, + reqBytes.length, this.iDst0, this.iPort); + DatagramPacket outPacket1 = this.iDst1 == null ? null : new DatagramPacket(reqBytes, + reqBytes.length, this.iDst1, this.iPort); + DatagramPacket inPacket = new DatagramPacket(this.iInBuf, this.iInBuf.length); + MCastLoopController ctrl = new MCastLoopController(); + boolean respondersUpdated = false; + ResponseCache rspCache = new ResponseCache(); + sendLoop: while (ctrl.hasNext()) { + if (respondersUpdated) { + byte[] msg = this.iReqMsg.serialize(true, true, true); + if (outPacket0 != null) outPacket0.setData(msg); + if (outPacket1 != null) outPacket1.setData(msg); + respondersUpdated = false; + } + // send it relative frequently in order to avoid lost packets + TRC.debug("sending: " + this.iReqMsg); + + try { + if (outPacket0 != null) this.iDGramSocket.send(outPacket0); + } catch (IOException ioe) { + // some back level kernels can't handle sending IPv6 mcast + TRC.warning("IOException caught during send, disabling IPv6: " + ioe.getMessage(), + ioe); + outPacket0 = null; + this.iDst0 = null; + } + + if (outPacket1 != null) this.iDGramSocket.send(outPacket1); + while (ctrl.hasNext()) { + this.iDGramSocket.setSoTimeout(ctrl.getTimeOut()); + try { + this.iDGramSocket.receive(inPacket); + } catch (SocketTimeoutException e) { + // set new timeout value + TRC.debug("receive timed out"); + ctrl.nextTimeOut(); + continue sendLoop; + } + InetAddress responderAddress = inPacket.getAddress(); + + respondersUpdated = this.iReqMsg.updatePrevResponders(responderAddress.toString()); + + if (rspCache.contains(inPacket)) { + TRC.debug("received packet is found in rspCache"); + continue; // packet data is already processed + } + ReplyMessage replyMsg = handleResponse(inPacket); + + if (replyMsg != null) { + if (replyMsg.overflows()) { + if (!isLinkLocal(responderAddress)) { + // TCP doesn't seem to be working on linkLocal IPv6 + // connection + addTCPRequester(responderAddress); + rspCache.add(inPacket); + } + } else { + rspCache.add(inPacket); + } + } + } + break; + } + waitForTCPRequesters(); + } + + private void ucastNegotiate() throws Exception { + byte[] reqBytes = this.iReqMsg.serialize(false, true, false); + DatagramPacket outPacket = new DatagramPacket(reqBytes, reqBytes.length, this.iDst0, + this.iPort); + DatagramPacket inPacket = new DatagramPacket(this.iInBuf, this.iInBuf.length); + int timeOutIdx = 0; + int timeOut = this.iTimeOuts[timeOutIdx]; + /* + * ad-hoc solution to avoid endless loop in case of broken answers + */ + int tries = 10; + while (timeOutIdx < this.iTimeOuts.length && tries > 0) { + // send it relative frequently in order to avoid lost packets + TRC.debug("sending: " + this.iReqMsg); + this.iDGramSocket.send(outPacket); + this.iDGramSocket.setSoTimeout(timeOut); + try { + this.iDGramSocket.receive(inPacket); + } catch (SocketTimeoutException e) { + // set new timeout value + TRC.debug("receive timed out"); + timeOut = this.iTimeOuts[timeOutIdx++]; + continue; + } + InetAddress responderAddress = inPacket.getAddress(); + ReplyMessage replyMsg = handleResponse(inPacket); + if (replyMsg == null) { + --tries; + continue; + } + if (replyMsg.overflows()) { + TCPRequester tcpRequester = new TCPRequester(this.iResTable, responderAddress, + this.iReqMsg, true); + tcpRequester.waitFor(); + } + /* + * one answer is wanted from one host + */ + break; + } + } + + /** + * Tries to parse the content of the packet as a ReplyMessage. If parsing is + * successful ReplyMessage is placed into the ResultTable, otherwise the + * Exception is placed there. + * + * @param pPacket + * @return the ReplyMessage or null in case of + * + * Add all invalid URL exceptions thrown by parser into exception + * table + */ + private ReplyMessage handleResponse(DatagramPacket pPacket) { + ReplyMessage replyMsg; + try { + replyMsg = (ReplyMessage) MsgFactory.parse(pPacket); + TRC.debug("expected: " + this.iReqMsg.getXID() + ", received: " + replyMsg); + if (this.iReqMsg.getXID() != replyMsg.getXID() + || !this.iReqMsg.isAllowedResponseType(replyMsg)) { + TRC.debug("expected: " + this.iReqMsg.getXID() + ", ignoring: " + replyMsg); + return null; + } + } catch (Exception e) { + this.iResTable.addException(e); + return null; + } + TRC.debug("resTable <- " + replyMsg); + this.iResTable.addResults(replyMsg); + this.iResTable.addExceptions(replyMsg); + return replyMsg; + } + + private static boolean isLinkLocal(InetAddress pAddr) { + if (pAddr instanceof Inet6Address) { + Inet6Address dest6 = (Inet6Address) pAddr; + // TCP on linkLocal is evil + return dest6.isLinkLocalAddress(); + } + return false; + } + + static long getMillis() { + return new Date().getTime(); + } + + private void addTCPRequester(InetAddress pDest) throws ServiceLocationException { + if (this.iTCPRequesters == null) this.iTCPRequesters = new ArrayList(); + this.iTCPRequesters.add(new TCPRequester(this.iResTable, pDest, this.iReqMsg, true)); + } + + private void waitForTCPRequesters() { + if (this.iTCPRequesters == null) return; + Iterator itr = this.iTCPRequesters.iterator(); + while (itr.hasNext()) + itr.next().waitFor(); + this.iTCPRequesters.clear(); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/ua/LocatorImpl.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/ua/LocatorImpl.java similarity index 72% rename from src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/ua/LocatorImpl.java rename to src/main/java/org/metricshub/wbem/sblim/slp/internal/ua/LocatorImpl.java index e099497..90851a6 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/ua/LocatorImpl.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/ua/LocatorImpl.java @@ -1,142 +1,140 @@ -/* - (C) Copyright IBM Corp. 2007, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, IBM, ebak@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1804402 2007-09-28 ebak IPv6 ready SLP - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - */ - -package org.sentrysoftware.wbem.sblim.slp.internal.ua; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.net.InetAddress; -import java.util.Locale; -import java.util.SortedSet; -import java.util.Vector; - -import org.sentrysoftware.wbem.sblim.slp.Locator; -import org.sentrysoftware.wbem.sblim.slp.ServiceLocationEnumeration; -import org.sentrysoftware.wbem.sblim.slp.ServiceType; -import org.sentrysoftware.wbem.sblim.slp.ServiceURL; -import org.sentrysoftware.wbem.sblim.slp.internal.SLPDefaults; -import org.sentrysoftware.wbem.sblim.slp.internal.TRC; -import org.sentrysoftware.wbem.sblim.slp.internal.msg.AttributeRequest; -import org.sentrysoftware.wbem.sblim.slp.internal.msg.ServiceRequest; -import org.sentrysoftware.wbem.sblim.slp.internal.msg.ServiceTypeRequest; -import org.sentrysoftware.wbem.sblim.slp.internal.msg.Util; - -/** - * LocatorImpl - * - */ -public class LocatorImpl implements Locator { - - private Locale iLocale; - - private String iLangTag; - - /** - * Ctor. - * - * @param pLocale - */ - public LocatorImpl(Locale pLocale) { - this.iLocale = pLocale; - this.iLangTag = Util.getLangTag(this.iLocale); - TRC.debug("created, langTag=" + this.iLangTag); - } - - public ServiceLocationEnumeration findAttributes(ServiceURL pURL, Vector pScopes, - Vector pAttributeIds) { - return findAttributes(pURL, pScopes, pAttributeIds, null); - } - - public ServiceLocationEnumeration findAttributes(ServiceURL pURL, Vector pScopes, - Vector pAttributeIds, Vector pDirectoryAgents) { - return new SLEnumerationImpl(new AttributeRequest(this.iLangTag, (SortedSet) null, - pURL.toString(), getScopes(pScopes), pAttributeIds, null), pDirectoryAgents); - } - - public ServiceLocationEnumeration findAttributes(ServiceType pType, Vector pScopes, - Vector pAttributeIds) { - return findAttributes(pType, pScopes, pAttributeIds, null); - } - - public ServiceLocationEnumeration findAttributes(ServiceType pType, Vector pScopes, - Vector pAttributeIds, Vector pDirectoryAgents) { - return new SLEnumerationImpl(new AttributeRequest(this.iLangTag, (SortedSet) null, - pType.toString(), getScopes(pScopes), pAttributeIds, null), pDirectoryAgents); - } - - public ServiceLocationEnumeration findServiceTypes(String pNamingAuthority, - Vector pScopes) { - return findServiceTypes(pNamingAuthority, pScopes, null); - } - - public ServiceLocationEnumeration findServiceTypes(String pNamingAuthority, - Vector pScopes, Vector pDirectoryAgent) { - return new SLEnumerationImpl(new ServiceTypeRequest(this.iLangTag, null, pNamingAuthority, - getScopes(pScopes)), pDirectoryAgent); - } - - public ServiceLocationEnumeration findServices(ServiceType pType, Vector pScopes, - String pSearchFilter) { - return findServices(pType, pScopes, pSearchFilter, null); - } - - public ServiceLocationEnumeration findServices(ServiceType pType, Vector pScopes, - String pSearchFilter, Vector pDirectoryAgents) { - return new SLEnumerationImpl(new ServiceRequest(this.iLangTag, null, pType, - getScopes(pScopes), pSearchFilter, null), pDirectoryAgents); - } - - public Locale getLocale() { - return this.iLocale; - } - - /** - * @param pScopes - * @return pScopes if that is not empty or a Vector with "default" entry if - * the pScopes is null or empty - */ - private static Vector getScopes(Vector pScopes) { - if (pScopes == null) pScopes = new Vector(); - if (pScopes.isEmpty()) pScopes.add(SLPDefaults.DEFAULT_SCOPE); - return pScopes; - } - -} +/* + (C) Copyright IBM Corp. 2007, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, IBM, ebak@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1804402 2007-09-28 ebak IPv6 ready SLP + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + */ + +package org.metricshub.wbem.sblim.slp.internal.ua; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.net.InetAddress; +import java.util.Locale; +import java.util.SortedSet; +import java.util.Vector; + +import org.metricshub.wbem.sblim.slp.ServiceLocationEnumeration; +import org.metricshub.wbem.sblim.slp.ServiceType; +import org.metricshub.wbem.sblim.slp.ServiceURL; +import org.metricshub.wbem.sblim.slp.internal.SLPDefaults; +import org.metricshub.wbem.sblim.slp.internal.TRC; +import org.metricshub.wbem.sblim.slp.internal.msg.AttributeRequest; +import org.metricshub.wbem.sblim.slp.internal.msg.ServiceRequest; +import org.metricshub.wbem.sblim.slp.internal.msg.ServiceTypeRequest; +import org.metricshub.wbem.sblim.slp.Locator; +import org.metricshub.wbem.sblim.slp.internal.msg.Util; + +/** + * LocatorImpl + * + */ +public class LocatorImpl implements Locator { + + private Locale iLocale; + + private String iLangTag; + + /** + * Ctor. + * + * @param pLocale + */ + public LocatorImpl(Locale pLocale) { + this.iLocale = pLocale; + this.iLangTag = Util.getLangTag(this.iLocale); + TRC.debug("created, langTag=" + this.iLangTag); + } + + public ServiceLocationEnumeration findAttributes(ServiceURL pURL, Vector pScopes, + Vector pAttributeIds) { + return findAttributes(pURL, pScopes, pAttributeIds, null); + } + + public ServiceLocationEnumeration findAttributes(ServiceURL pURL, Vector pScopes, + Vector pAttributeIds, Vector pDirectoryAgents) { + return new SLEnumerationImpl(new AttributeRequest(this.iLangTag, (SortedSet) null, + pURL.toString(), getScopes(pScopes), pAttributeIds, null), pDirectoryAgents); + } + + public ServiceLocationEnumeration findAttributes(ServiceType pType, Vector pScopes, + Vector pAttributeIds) { + return findAttributes(pType, pScopes, pAttributeIds, null); + } + + public ServiceLocationEnumeration findAttributes(ServiceType pType, Vector pScopes, + Vector pAttributeIds, Vector pDirectoryAgents) { + return new SLEnumerationImpl(new AttributeRequest(this.iLangTag, (SortedSet) null, + pType.toString(), getScopes(pScopes), pAttributeIds, null), pDirectoryAgents); + } + + public ServiceLocationEnumeration findServiceTypes(String pNamingAuthority, + Vector pScopes) { + return findServiceTypes(pNamingAuthority, pScopes, null); + } + + public ServiceLocationEnumeration findServiceTypes(String pNamingAuthority, + Vector pScopes, Vector pDirectoryAgent) { + return new SLEnumerationImpl(new ServiceTypeRequest(this.iLangTag, null, pNamingAuthority, + getScopes(pScopes)), pDirectoryAgent); + } + + public ServiceLocationEnumeration findServices(ServiceType pType, Vector pScopes, + String pSearchFilter) { + return findServices(pType, pScopes, pSearchFilter, null); + } + + public ServiceLocationEnumeration findServices(ServiceType pType, Vector pScopes, + String pSearchFilter, Vector pDirectoryAgents) { + return new SLEnumerationImpl(new ServiceRequest(this.iLangTag, null, pType, + getScopes(pScopes), pSearchFilter, null), pDirectoryAgents); + } + + public Locale getLocale() { + return this.iLocale; + } + + /** + * @param pScopes + * @return pScopes if that is not empty or a Vector with "default" entry if + * the pScopes is null or empty + */ + private static Vector getScopes(Vector pScopes) { + if (pScopes == null) pScopes = new Vector(); + if (pScopes.isEmpty()) pScopes.add(SLPDefaults.DEFAULT_SCOPE); + return pScopes; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/ua/ResponseCache.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/ua/ResponseCache.java similarity index 76% rename from src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/ua/ResponseCache.java rename to src/main/java/org/metricshub/wbem/sblim/slp/internal/ua/ResponseCache.java index d471e8a..2b4dcdb 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/ua/ResponseCache.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/ua/ResponseCache.java @@ -1,126 +1,124 @@ -/* - (C) Copyright IBM Corp. 2007, 2010 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, IBM, ebak@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1804402 2007-09-28 ebak IPv6 ready SLP - * 1892103 2008-02-12 ebak SLP improvements - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 3019214 2010-06-21 blaschke-oss SLP equals methods assume too much - */ - -package org.sentrysoftware.wbem.sblim.slp.internal.ua; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.net.DatagramPacket; -import java.util.Arrays; -import java.util.HashSet; - -/** - * ResponseCache intends to eliminate the processing of SLP responses with the - * same content. - * - */ -public class ResponseCache { - - private static class Entry { - - private byte[] iData; - - private int iHashCode; - - /** - * Ctor. - * - * @param pData - * @param pOffset - * @param pLength - */ - public Entry(byte[] pData, int pOffset, int pLength) { - this.iData = new byte[pLength]; - System.arraycopy(pData, pOffset, this.iData, 0, pLength); - for (int pos = 0; pos < this.iData.length; ++pos) { - this.iHashCode <<= 4; - this.iHashCode += (this.iData[pos] & 0xff); - } - } - - /** - * Ctor. - * - * @param pPacket - */ - public Entry(DatagramPacket pPacket) { - this(pPacket.getData(), pPacket.getOffset(), pPacket.getLength()); - } - - @Override - public int hashCode() { - return this.iHashCode; - } - - @Override - public boolean equals(Object pObj) { - if (pObj == null || !(pObj instanceof Entry)) return false; - if (this == pObj) return true; - Entry that = (Entry) pObj; - return this.iHashCode == that.iHashCode && Arrays.equals(this.iData, that.iData); - } - - } - - private HashSet iResponseSet = new HashSet(); - - /** - * add - * - * @param pPacket - */ - public void add(DatagramPacket pPacket) { - this.iResponseSet.add(new Entry(pPacket)); - } - - /** - * contains - * - * @param pPacket - * @return boolean - */ - public boolean contains(DatagramPacket pPacket) { - return this.iResponseSet.contains(new Entry(pPacket)); - } - -} +/* + (C) Copyright IBM Corp. 2007, 2010 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, IBM, ebak@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1804402 2007-09-28 ebak IPv6 ready SLP + * 1892103 2008-02-12 ebak SLP improvements + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 3019214 2010-06-21 blaschke-oss SLP equals methods assume too much + */ + +package org.metricshub.wbem.sblim.slp.internal.ua; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.net.DatagramPacket; +import java.util.Arrays; +import java.util.HashSet; + +/** + * ResponseCache intends to eliminate the processing of SLP responses with the + * same content. + * + */ +public class ResponseCache { + + private static class Entry { + + private byte[] iData; + + private int iHashCode; + + /** + * Ctor. + * + * @param pData + * @param pOffset + * @param pLength + */ + public Entry(byte[] pData, int pOffset, int pLength) { + this.iData = new byte[pLength]; + System.arraycopy(pData, pOffset, this.iData, 0, pLength); + for (int pos = 0; pos < this.iData.length; ++pos) { + this.iHashCode <<= 4; + this.iHashCode += (this.iData[pos] & 0xff); + } + } + + /** + * Ctor. + * + * @param pPacket + */ + public Entry(DatagramPacket pPacket) { + this(pPacket.getData(), pPacket.getOffset(), pPacket.getLength()); + } + + @Override + public int hashCode() { + return this.iHashCode; + } + + @Override + public boolean equals(Object pObj) { + if (pObj == null || !(pObj instanceof Entry)) return false; + if (this == pObj) return true; + Entry that = (Entry) pObj; + return this.iHashCode == that.iHashCode && Arrays.equals(this.iData, that.iData); + } + + } + + private HashSet iResponseSet = new HashSet(); + + /** + * add + * + * @param pPacket + */ + public void add(DatagramPacket pPacket) { + this.iResponseSet.add(new Entry(pPacket)); + } + + /** + * contains + * + * @param pPacket + * @return boolean + */ + public boolean contains(DatagramPacket pPacket) { + return this.iResponseSet.contains(new Entry(pPacket)); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/ua/ResultTable.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/ua/ResultTable.java similarity index 83% rename from src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/ua/ResultTable.java rename to src/main/java/org/metricshub/wbem/sblim/slp/internal/ua/ResultTable.java index cd01bad..bee02dd 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/ua/ResultTable.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/ua/ResultTable.java @@ -1,235 +1,233 @@ -/* - (C) Copyright IBM Corp. 2007, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, IBM, ebak@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1804402 2007-09-28 ebak IPv6 ready SLP - * 1892103 2008-02-12 ebak SLP improvements - * 1949918 2008-04-08 raman_arora Malformed service URL crashes SLP discovery - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - */ - -package org.sentrysoftware.wbem.sblim.slp.internal.ua; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedHashSet; -import java.util.NoSuchElementException; - -import org.sentrysoftware.wbem.sblim.slp.internal.TRC; -import org.sentrysoftware.wbem.sblim.slp.internal.msg.ReplyMessage; - -/** - * ResultTable - * - */ -public class ResultTable implements Iterator { - - private ArrayList iRequesters = new ArrayList(); - - private ArrayList iExceptions = new ArrayList(); - - /* - * iInSet contains the results which are not read out. iOutSet contains the - * results which are read out. - */ - private LinkedHashSet iInSet = new LinkedHashSet(); - - private LinkedHashSet iOutSet = new LinkedHashSet(); - - /** - * ResultTable has to know which Requesters provide results. Requester have - * to be registered before hasNext() is called. - * - * @see #unregisterRequester(DatagramRequester) - * @param pReq - */ - public synchronized void registerRequester(DatagramRequester pReq) { - for (int i = 0; i < this.iRequesters.size(); i++) - if (pReq == this.iRequesters.get(i)) return; - this.iRequesters.add(pReq); - } - - /** - * If the Requester's sequence is completed, Requester has to be - * unregistered otherwise hasNext() will block. - * - * @param pReq - */ - public synchronized void unregisterRequester(DatagramRequester pReq) { - for (int i = 0; i < this.iRequesters.size(); i++) { - if (pReq == this.iRequesters.get(i)) { - this.iRequesters.remove(i); - if (this.iRequesters.size() == 0) wakeUp(); - return; - } - } - } - - /** - * addResults - * - * @param pReplyMsg - */ - public void addResults(ReplyMessage pReplyMsg) { - addResults(pReplyMsg.getResultIterator()); - } - - /** - * addResults - * - * @param pResItr - */ - public synchronized void addResults(Iterator pResItr) { - if (pResItr == null) return; - while (pResItr.hasNext()) - addResult(pResItr.next()); - // waking up hasNext() - if (this.iInSet.size() > 0) wakeUp(); - } - - /** - * addExceptions - * - * @param pReplyMsg - */ - public synchronized void addExceptions(ReplyMessage pReplyMsg) { - addExceptions(pReplyMsg.getExceptionIterator()); - } - - /** - * addExceptions - * - * @param pExceptionItr - */ - public synchronized void addExceptions(Iterator pExceptionItr) { - if (pExceptionItr == null) return; - while (pExceptionItr.hasNext()) - addException((Exception) pExceptionItr.next()); - } - - /** - * addException - * - * @param pE - */ - public synchronized void addException(Exception pE) { - this.iExceptions.add(pE); - if (this.iExceptions.size() > 0) wakeUp(); - } - - /** - * getTotalResponses - * - * @return int - */ - public synchronized int getTotalResponses() { - return this.iOutSet.size() + this.iInSet.size(); - } - - /** - * @see java.util.Iterator#hasNext() - * @return true if there are results or exceptions to read - */ - public synchronized boolean hasNext() { - if (hasData()) return true; - // no more requester, no chance for result - if (this.iRequesters.size() == 0) return false; - /* - * wait wake up if iInSet is extended or all Requesters are unregistered - */ - try { - wait(); - } catch (InterruptedException e) { - TRC.error(e); - } - return hasData(); - } - - /** - * @see java.util.Iterator#next() - * @return a result or an Exception - */ - public synchronized Object next() throws NoSuchElementException { - Iterator itr = this.iInSet.iterator(); - Object res = itr.next(); - this.iInSet.remove(res); - this.iOutSet.add(res); - return res; - } - - /** - * @return next element in Exception table - * @throws NoSuchElementException - */ - public Object nextException() throws NoSuchElementException { - Iterator itr = this.iExceptions.iterator(); - Object res = itr.next(); - this.iExceptions.remove(res); - return res; - } - - /** - * @return next element in Exception table - */ - public boolean hasMoreExceptions() { - return this.iExceptions.size() > 0; - } - - public void remove() { - throw new UnsupportedOperationException(); - } - - private void addResult(Object pResult) { - if (this.iOutSet.contains(pResult) || this.iInSet.contains(pResult)) return; - this.iInSet.add(pResult); - } - - private void wakeUp() { - try { - notifyAll(); - } catch (IllegalMonitorStateException e) { - TRC.error(e); - } - } - - private boolean hasData() { - return this.iInSet.size() > 0; - } - -} +/* + (C) Copyright IBM Corp. 2007, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, IBM, ebak@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1804402 2007-09-28 ebak IPv6 ready SLP + * 1892103 2008-02-12 ebak SLP improvements + * 1949918 2008-04-08 raman_arora Malformed service URL crashes SLP discovery + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + */ + +package org.metricshub.wbem.sblim.slp.internal.ua; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.LinkedHashSet; +import java.util.NoSuchElementException; + +import org.metricshub.wbem.sblim.slp.internal.TRC; +import org.metricshub.wbem.sblim.slp.internal.msg.ReplyMessage; + +/** + * ResultTable + * + */ +public class ResultTable implements Iterator { + + private ArrayList iRequesters = new ArrayList(); + + private ArrayList iExceptions = new ArrayList(); + + /* + * iInSet contains the results which are not read out. iOutSet contains the + * results which are read out. + */ + private LinkedHashSet iInSet = new LinkedHashSet(); + + private LinkedHashSet iOutSet = new LinkedHashSet(); + + /** + * ResultTable has to know which Requesters provide results. Requester have + * to be registered before hasNext() is called. + * + * @see #unregisterRequester(DatagramRequester) + * @param pReq + */ + public synchronized void registerRequester(DatagramRequester pReq) { + for (int i = 0; i < this.iRequesters.size(); i++) + if (pReq == this.iRequesters.get(i)) return; + this.iRequesters.add(pReq); + } + + /** + * If the Requester's sequence is completed, Requester has to be + * unregistered otherwise hasNext() will block. + * + * @param pReq + */ + public synchronized void unregisterRequester(DatagramRequester pReq) { + for (int i = 0; i < this.iRequesters.size(); i++) { + if (pReq == this.iRequesters.get(i)) { + this.iRequesters.remove(i); + if (this.iRequesters.size() == 0) wakeUp(); + return; + } + } + } + + /** + * addResults + * + * @param pReplyMsg + */ + public void addResults(ReplyMessage pReplyMsg) { + addResults(pReplyMsg.getResultIterator()); + } + + /** + * addResults + * + * @param pResItr + */ + public synchronized void addResults(Iterator pResItr) { + if (pResItr == null) return; + while (pResItr.hasNext()) + addResult(pResItr.next()); + // waking up hasNext() + if (this.iInSet.size() > 0) wakeUp(); + } + + /** + * addExceptions + * + * @param pReplyMsg + */ + public synchronized void addExceptions(ReplyMessage pReplyMsg) { + addExceptions(pReplyMsg.getExceptionIterator()); + } + + /** + * addExceptions + * + * @param pExceptionItr + */ + public synchronized void addExceptions(Iterator pExceptionItr) { + if (pExceptionItr == null) return; + while (pExceptionItr.hasNext()) + addException((Exception) pExceptionItr.next()); + } + + /** + * addException + * + * @param pE + */ + public synchronized void addException(Exception pE) { + this.iExceptions.add(pE); + if (this.iExceptions.size() > 0) wakeUp(); + } + + /** + * getTotalResponses + * + * @return int + */ + public synchronized int getTotalResponses() { + return this.iOutSet.size() + this.iInSet.size(); + } + + /** + * @see java.util.Iterator#hasNext() + * @return true if there are results or exceptions to read + */ + public synchronized boolean hasNext() { + if (hasData()) return true; + // no more requester, no chance for result + if (this.iRequesters.size() == 0) return false; + /* + * wait wake up if iInSet is extended or all Requesters are unregistered + */ + try { + wait(); + } catch (InterruptedException e) { + TRC.error(e); + } + return hasData(); + } + + /** + * @see java.util.Iterator#next() + * @return a result or an Exception + */ + public synchronized Object next() throws NoSuchElementException { + Iterator itr = this.iInSet.iterator(); + Object res = itr.next(); + this.iInSet.remove(res); + this.iOutSet.add(res); + return res; + } + + /** + * @return next element in Exception table + * @throws NoSuchElementException + */ + public Object nextException() throws NoSuchElementException { + Iterator itr = this.iExceptions.iterator(); + Object res = itr.next(); + this.iExceptions.remove(res); + return res; + } + + /** + * @return next element in Exception table + */ + public boolean hasMoreExceptions() { + return this.iExceptions.size() > 0; + } + + public void remove() { + throw new UnsupportedOperationException(); + } + + private void addResult(Object pResult) { + if (this.iOutSet.contains(pResult) || this.iInSet.contains(pResult)) return; + this.iInSet.add(pResult); + } + + private void wakeUp() { + try { + notifyAll(); + } catch (IllegalMonitorStateException e) { + TRC.error(e); + } + } + + private boolean hasData() { + return this.iInSet.size() > 0; + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/ua/SLEnumerationImpl.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/ua/SLEnumerationImpl.java similarity index 82% rename from src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/ua/SLEnumerationImpl.java rename to src/main/java/org/metricshub/wbem/sblim/slp/internal/ua/SLEnumerationImpl.java index 3d3b875..83c214d 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/ua/SLEnumerationImpl.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/ua/SLEnumerationImpl.java @@ -1,257 +1,255 @@ -/* - (C) Copyright IBM Corp. 2007, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, IBM, ebak@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1804402 2007-09-28 ebak IPv6 ready SLP - * 1804402 2007-11-10 ebak IPv6 ready SLP - revision 4 - * 1892103 2008-02-12 ebak SLP improvements - * 1949918 2008-04-08 raman_arora Malformed service URL crashes SLP discovery - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) - * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors - */ - -package org.sentrysoftware.wbem.sblim.slp.internal.ua; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.IOException; -import java.net.InetAddress; -import java.net.UnknownHostException; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.NoSuchElementException; - -import org.sentrysoftware.wbem.sblim.slp.ServiceLocationEnumeration; -import org.sentrysoftware.wbem.sblim.slp.ServiceLocationException; -import org.sentrysoftware.wbem.sblim.slp.ServiceURL; -import org.sentrysoftware.wbem.sblim.slp.internal.SLPDefaults; -import org.sentrysoftware.wbem.sblim.slp.internal.TRC; -import org.sentrysoftware.wbem.sblim.slp.internal.msg.DADescriptor; -import org.sentrysoftware.wbem.sblim.slp.internal.msg.RequestMessage; -import org.sentrysoftware.wbem.sblim.slp.internal.msg.ServiceRequest; - -/** - * SLEnumerationImpl - * - */ -public class SLEnumerationImpl implements ServiceLocationEnumeration { - - private RequestMessage iReqMsg; - - private ResultTable iResultTable; - - private List iDAList; - - private boolean iInited = false; - - private boolean iIsDASrvRequest; - - private DatagramRequester iMCastRequester; - - /** - * Ctor. - * - * @param pReqMsg - * @param pDAList - */ - public SLEnumerationImpl(RequestMessage pReqMsg, List pDAList) { - this.iReqMsg = pReqMsg; - this.iResultTable = new ResultTable(); - this.iDAList = pDAList; - this.iIsDASrvRequest = isDASrvRequest(); - } - - /** - * This implementation can throw RuntimeExceptions. They can be ignored or - * used for analysis. - * - * @see ServiceLocationEnumeration#next() - */ - public Object next() throws NoSuchElementException { - Object obj = this.iResultTable.next(); - if (obj instanceof Exception) throw new RuntimeException((Exception) obj); - if (this.iIsDASrvRequest) { - // DADescriptor is internal -> converting to ServiceURL - DADescriptor daDesc = (DADescriptor) obj; - return new ServiceURL(daDesc.getURL(), ServiceURL.LIFETIME_MAXIMUM); - } - return obj; - } - - /** - * @return next Object in Exception table - * @throws NoSuchElementException - * - * This in internal implementation to get list of all exceptions - * thrown/caught by parser This can throw RuntimeExceptions. - * They can be ignored or used for analysis. - * - * use hasNextException to check whether there exists another - * element in Exception table - */ - public Object nextException() throws NoSuchElementException { - return this.iResultTable.nextException(); - } - - /** - * @return true if there exists another element in Exception table - * - */ - public boolean hasMoreExceptions() { - return this.iResultTable.hasMoreExceptions(); - } - - /* - * states: - init - initiated - finished - */ - public boolean hasMoreElements() { - if (!this.iInited) { - List daList = null; - /* - * OpenSLP DA doesn't reply to unicasted DA discovery, therefore if - * the discoverable service type is service:directory-agent a - * multicasting is done. - */ - if (!this.iIsDASrvRequest) { - try { - daList = getDAList(this.iReqMsg.getScopeList()); - } catch (Exception e) { - throw new RuntimeException(new ServiceLocationException( - ServiceLocationException.INTERNAL_ERROR, e)); - } - } - try { - if (daList == null || daList.size() == 0) { - setupMulticasting(); - } else { - setupUnicasting(daList); - } - } catch (Exception e) { - throw new RuntimeException(e); - } - this.iInited = true; - } - return this.iResultTable.hasNext(); - } - - public Object nextElement() throws NoSuchElementException { - return next(); - } - - /** - * For diagnostic only! - * - * @return int - */ - public int getPort() { - return this.iMCastRequester == null ? -1 : this.iMCastRequester.getPort(); - } - - private boolean isDASrvRequest() { - if (!(this.iReqMsg instanceof ServiceRequest)) return false; - ServiceRequest srvReq = (ServiceRequest) this.iReqMsg; - return SLPDefaults.DA_SERVICE_TYPE.equals(srvReq.getServiceType()); - } - - /** - * @param pScopes - * @return List of DA address InetAddresses - * @throws UnknownHostException - */ - private List getDAList(List pScopes) throws UnknownHostException, - IOException { - if (this.iDAList != null && this.iDAList.size() > 0) return this.iDAList; - - // return cached DA list from previous discovery - List scopes = DACache.getDiscoverableScopeList(pScopes); - if (scopes != null) { - ResultTable resultTable = new ResultTable(); - ServiceRequest srvReq = new ServiceRequest(null, SLPDefaults.DA_SERVICE_TYPE, scopes, - null, null); - // multicast DA discovery - DatagramRequester requester = new DatagramRequester(srvReq, resultTable); - requester.start(false); - if (resultTable.hasNext()) { - List daList = new ArrayList(); - while (resultTable.hasNext()) { - try { - daList.add((DADescriptor) resultTable.next()); - } catch (RuntimeException e) { - TRC.warning(e.getMessage(), e); - } - } - DACache.setDAList(scopes, daList); - } - } - return getInetAddresses(DACache.getDAList(pScopes)); - } - - private List getInetAddresses(List pAddrStrList) { - if (pAddrStrList == null) return null; - List list = new ArrayList(pAddrStrList.size()); - Iterator strItr = pAddrStrList.iterator(); - while (strItr.hasNext()) { - String srvURLStr = strItr.next(); - try { - ServiceURL srvURL = new ServiceURL(srvURLStr, ServiceURL.LIFETIME_DEFAULT); - list.add(InetAddress.getByName(srvURL.getURLPath())); - } catch (Exception e) { - TRC.error("Failed to get InetAddress for srvURLStr=" + srvURLStr, e); - } - } - TRC.info("number of discovered DAs:" + list.size()); - return list; - } - - private void setupUnicasting(List pDAList) throws IOException { - Iterator itr = pDAList.iterator(); - while (itr.hasNext()) { - InetAddress address = itr.next(); - new DatagramRequester(this.iReqMsg, this.iResultTable, address).start(true); - } - } - - private void setupMulticasting() throws ServiceLocationException, IOException { - try { - this.iMCastRequester = new DatagramRequester(this.iReqMsg, this.iResultTable); - this.iMCastRequester.start(true); - } catch (UnknownHostException e) { - throw new ServiceLocationException(ServiceLocationException.NETWORK_ERROR, e); - } - } - -} +/* + (C) Copyright IBM Corp. 2007, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, IBM, ebak@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1804402 2007-09-28 ebak IPv6 ready SLP + * 1804402 2007-11-10 ebak IPv6 ready SLP - revision 4 + * 1892103 2008-02-12 ebak SLP improvements + * 1949918 2008-04-08 raman_arora Malformed service URL crashes SLP discovery + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) + * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors + */ + +package org.metricshub.wbem.sblim.slp.internal.ua; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.IOException; +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.NoSuchElementException; + +import org.metricshub.wbem.sblim.slp.ServiceLocationEnumeration; +import org.metricshub.wbem.sblim.slp.ServiceURL; +import org.metricshub.wbem.sblim.slp.internal.SLPDefaults; +import org.metricshub.wbem.sblim.slp.internal.TRC; +import org.metricshub.wbem.sblim.slp.internal.msg.DADescriptor; +import org.metricshub.wbem.sblim.slp.internal.msg.RequestMessage; +import org.metricshub.wbem.sblim.slp.internal.msg.ServiceRequest; +import org.metricshub.wbem.sblim.slp.ServiceLocationException; + +/** + * SLEnumerationImpl + * + */ +public class SLEnumerationImpl implements ServiceLocationEnumeration { + + private RequestMessage iReqMsg; + + private ResultTable iResultTable; + + private List iDAList; + + private boolean iInited = false; + + private boolean iIsDASrvRequest; + + private DatagramRequester iMCastRequester; + + /** + * Ctor. + * + * @param pReqMsg + * @param pDAList + */ + public SLEnumerationImpl(RequestMessage pReqMsg, List pDAList) { + this.iReqMsg = pReqMsg; + this.iResultTable = new ResultTable(); + this.iDAList = pDAList; + this.iIsDASrvRequest = isDASrvRequest(); + } + + /** + * This implementation can throw RuntimeExceptions. They can be ignored or + * used for analysis. + * + * @see ServiceLocationEnumeration#next() + */ + public Object next() throws NoSuchElementException { + Object obj = this.iResultTable.next(); + if (obj instanceof Exception) throw new RuntimeException((Exception) obj); + if (this.iIsDASrvRequest) { + // DADescriptor is internal -> converting to ServiceURL + DADescriptor daDesc = (DADescriptor) obj; + return new ServiceURL(daDesc.getURL(), ServiceURL.LIFETIME_MAXIMUM); + } + return obj; + } + + /** + * @return next Object in Exception table + * @throws NoSuchElementException + * + * This in internal implementation to get list of all exceptions + * thrown/caught by parser This can throw RuntimeExceptions. + * They can be ignored or used for analysis. + * + * use hasNextException to check whether there exists another + * element in Exception table + */ + public Object nextException() throws NoSuchElementException { + return this.iResultTable.nextException(); + } + + /** + * @return true if there exists another element in Exception table + * + */ + public boolean hasMoreExceptions() { + return this.iResultTable.hasMoreExceptions(); + } + + /* + * states: - init - initiated - finished + */ + public boolean hasMoreElements() { + if (!this.iInited) { + List daList = null; + /* + * OpenSLP DA doesn't reply to unicasted DA discovery, therefore if + * the discoverable service type is service:directory-agent a + * multicasting is done. + */ + if (!this.iIsDASrvRequest) { + try { + daList = getDAList(this.iReqMsg.getScopeList()); + } catch (Exception e) { + throw new RuntimeException(new ServiceLocationException( + ServiceLocationException.INTERNAL_ERROR, e)); + } + } + try { + if (daList == null || daList.size() == 0) { + setupMulticasting(); + } else { + setupUnicasting(daList); + } + } catch (Exception e) { + throw new RuntimeException(e); + } + this.iInited = true; + } + return this.iResultTable.hasNext(); + } + + public Object nextElement() throws NoSuchElementException { + return next(); + } + + /** + * For diagnostic only! + * + * @return int + */ + public int getPort() { + return this.iMCastRequester == null ? -1 : this.iMCastRequester.getPort(); + } + + private boolean isDASrvRequest() { + if (!(this.iReqMsg instanceof ServiceRequest)) return false; + ServiceRequest srvReq = (ServiceRequest) this.iReqMsg; + return SLPDefaults.DA_SERVICE_TYPE.equals(srvReq.getServiceType()); + } + + /** + * @param pScopes + * @return List of DA address InetAddresses + * @throws UnknownHostException + */ + private List getDAList(List pScopes) throws UnknownHostException, + IOException { + if (this.iDAList != null && this.iDAList.size() > 0) return this.iDAList; + + // return cached DA list from previous discovery + List scopes = DACache.getDiscoverableScopeList(pScopes); + if (scopes != null) { + ResultTable resultTable = new ResultTable(); + ServiceRequest srvReq = new ServiceRequest(null, SLPDefaults.DA_SERVICE_TYPE, scopes, + null, null); + // multicast DA discovery + DatagramRequester requester = new DatagramRequester(srvReq, resultTable); + requester.start(false); + if (resultTable.hasNext()) { + List daList = new ArrayList(); + while (resultTable.hasNext()) { + try { + daList.add((DADescriptor) resultTable.next()); + } catch (RuntimeException e) { + TRC.warning(e.getMessage(), e); + } + } + DACache.setDAList(scopes, daList); + } + } + return getInetAddresses(DACache.getDAList(pScopes)); + } + + private List getInetAddresses(List pAddrStrList) { + if (pAddrStrList == null) return null; + List list = new ArrayList(pAddrStrList.size()); + Iterator strItr = pAddrStrList.iterator(); + while (strItr.hasNext()) { + String srvURLStr = strItr.next(); + try { + ServiceURL srvURL = new ServiceURL(srvURLStr, ServiceURL.LIFETIME_DEFAULT); + list.add(InetAddress.getByName(srvURL.getURLPath())); + } catch (Exception e) { + TRC.error("Failed to get InetAddress for srvURLStr=" + srvURLStr, e); + } + } + TRC.info("number of discovered DAs:" + list.size()); + return list; + } + + private void setupUnicasting(List pDAList) throws IOException { + Iterator itr = pDAList.iterator(); + while (itr.hasNext()) { + InetAddress address = itr.next(); + new DatagramRequester(this.iReqMsg, this.iResultTable, address).start(true); + } + } + + private void setupMulticasting() throws ServiceLocationException, IOException { + try { + this.iMCastRequester = new DatagramRequester(this.iReqMsg, this.iResultTable); + this.iMCastRequester.start(true); + } catch (UnknownHostException e) { + throw new ServiceLocationException(ServiceLocationException.NETWORK_ERROR, e); + } + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/ua/TCPRequester.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/ua/TCPRequester.java similarity index 72% rename from src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/ua/TCPRequester.java rename to src/main/java/org/metricshub/wbem/sblim/slp/internal/ua/TCPRequester.java index a37b149..8432361 100644 --- a/src/main/java/org/sentrysoftware/wbem/sblim/slp/internal/ua/TCPRequester.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/ua/TCPRequester.java @@ -1,153 +1,151 @@ -/* - (C) Copyright IBM Corp. 2007, 2009 - - THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE - CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. - - You can obtain a current copy of the Eclipse Public License from - http://www.opensource.org/licenses/eclipse-1.0.php - - @author : Endre Bak, IBM, ebak@de.ibm.com - * - * Change History - * Flag Date Prog Description - *------------------------------------------------------------------------------- - * 1804402 2007-09-28 ebak IPv6 ready SLP - * 1892103 2008-02-12 ebak SLP improvements - * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL - * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) - */ - -package org.sentrysoftware.wbem.sblim.slp.internal.ua; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -import java.io.IOException; -import java.io.OutputStream; -import java.net.InetAddress; -import java.net.Socket; - -import org.sentrysoftware.wbem.sblim.slp.ServiceLocationException; -import org.sentrysoftware.wbem.sblim.slp.internal.SLPConfig; -import org.sentrysoftware.wbem.sblim.slp.internal.TRC; -import org.sentrysoftware.wbem.sblim.slp.internal.msg.MsgFactory; -import org.sentrysoftware.wbem.sblim.slp.internal.msg.ReplyMessage; -import org.sentrysoftware.wbem.sblim.slp.internal.msg.RequestMessage; - -/** - * TCPRequester - * - */ -public class TCPRequester implements Runnable { - - private InetAddress iDestination; - - private Thread iThread; - - private ResultTable iResTable; - - private RequestMessage iReqMsg; - - private byte[] iRequestBytes; - - private int iPort = SLPConfig.getGlobalCfg().getPort(); - - private final int iTCPTimeOut = SLPConfig.getGlobalCfg().getTCPTimeout(); - - /** - * Ctor. - * - * @param pResTable - * @param pDestination - * @param pReqMsg - * @param pAsThread - * @throws ServiceLocationException - */ - public TCPRequester(ResultTable pResTable, InetAddress pDestination, RequestMessage pReqMsg, - boolean pAsThread) throws ServiceLocationException { - this.iResTable = pResTable; - this.iDestination = pDestination; - this.iReqMsg = pReqMsg; - this.iRequestBytes = pReqMsg.serializeWithoutResponders(false, false, true); - // FIXME: Is it safe to omit PreviousResopnder list for TCP request? - if (pAsThread) { - this.iThread = new Thread(this); - this.iThread.start(); - } else { - this.iThread = null; - run(); - } - } - - /** - * waitFor - */ - public void waitFor() { - if (this.iThread == null) return; - try { - this.iThread.join(); - } catch (InterruptedException e) { - TRC.error(e); - } - } - - public void run() { - Socket socket = null; - try { - socket = new Socket(this.iDestination, this.iPort); - socket.setSoTimeout(this.iTCPTimeOut); - OutputStream os = socket.getOutputStream(); - TRC.debug("sendTCP"); - os.write(this.iRequestBytes); - os.flush(); - handleResponse(socket); - TRC.debug("recievedOnTCP"); - } catch (Exception e) { - TRC.error(e.getMessage()); - } finally { - if (socket != null) { - try { - socket.close(); - } catch (IOException e) { - TRC.error(e); - } - } - } - - } - - private void handleResponse(Socket pSocket) { - ReplyMessage replyMsg; - try { - replyMsg = (ReplyMessage) MsgFactory.parse(pSocket); - } catch (Exception e) { - this.iResTable.addException(e); - return; - } - if (this.iReqMsg.getXID() == replyMsg.getXID() - && this.iReqMsg.isAllowedResponseType(replyMsg)) this.iResTable - .addResults(replyMsg); - } - -} +/* + (C) Copyright IBM Corp. 2007, 2009 + + THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + + You can obtain a current copy of the Eclipse Public License from + http://www.opensource.org/licenses/eclipse-1.0.php + + @author : Endre Bak, IBM, ebak@de.ibm.com + * + * Change History + * Flag Date Prog Description + *------------------------------------------------------------------------------- + * 1804402 2007-09-28 ebak IPv6 ready SLP + * 1892103 2008-02-12 ebak SLP improvements + * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL + * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) + */ + +package org.metricshub.wbem.sblim.slp.internal.ua; + +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * WBEM Java Client + * ჻჻჻჻჻჻ + * Copyright 2023 - 2025 MetricsHub + * ჻჻჻჻჻჻ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +import java.io.IOException; +import java.io.OutputStream; +import java.net.InetAddress; +import java.net.Socket; + +import org.metricshub.wbem.sblim.slp.internal.SLPConfig; +import org.metricshub.wbem.sblim.slp.internal.TRC; +import org.metricshub.wbem.sblim.slp.internal.msg.MsgFactory; +import org.metricshub.wbem.sblim.slp.internal.msg.RequestMessage; +import org.metricshub.wbem.sblim.slp.ServiceLocationException; +import org.metricshub.wbem.sblim.slp.internal.msg.ReplyMessage; + +/** + * TCPRequester + * + */ +public class TCPRequester implements Runnable { + + private InetAddress iDestination; + + private Thread iThread; + + private ResultTable iResTable; + + private RequestMessage iReqMsg; + + private byte[] iRequestBytes; + + private int iPort = SLPConfig.getGlobalCfg().getPort(); + + private final int iTCPTimeOut = SLPConfig.getGlobalCfg().getTCPTimeout(); + + /** + * Ctor. + * + * @param pResTable + * @param pDestination + * @param pReqMsg + * @param pAsThread + * @throws ServiceLocationException + */ + public TCPRequester(ResultTable pResTable, InetAddress pDestination, RequestMessage pReqMsg, + boolean pAsThread) throws ServiceLocationException { + this.iResTable = pResTable; + this.iDestination = pDestination; + this.iReqMsg = pReqMsg; + this.iRequestBytes = pReqMsg.serializeWithoutResponders(false, false, true); + // FIXME: Is it safe to omit PreviousResopnder list for TCP request? + if (pAsThread) { + this.iThread = new Thread(this); + this.iThread.start(); + } else { + this.iThread = null; + run(); + } + } + + /** + * waitFor + */ + public void waitFor() { + if (this.iThread == null) return; + try { + this.iThread.join(); + } catch (InterruptedException e) { + TRC.error(e); + } + } + + public void run() { + Socket socket = null; + try { + socket = new Socket(this.iDestination, this.iPort); + socket.setSoTimeout(this.iTCPTimeOut); + OutputStream os = socket.getOutputStream(); + TRC.debug("sendTCP"); + os.write(this.iRequestBytes); + os.flush(); + handleResponse(socket); + TRC.debug("recievedOnTCP"); + } catch (Exception e) { + TRC.error(e.getMessage()); + } finally { + if (socket != null) { + try { + socket.close(); + } catch (IOException e) { + TRC.error(e); + } + } + } + + } + + private void handleResponse(Socket pSocket) { + ReplyMessage replyMsg; + try { + replyMsg = (ReplyMessage) MsgFactory.parse(pSocket); + } catch (Exception e) { + this.iResTable.addException(e); + return; + } + if (this.iReqMsg.getXID() == replyMsg.getXID() + && this.iReqMsg.isAllowedResponseType(replyMsg)) this.iResTable + .addResults(replyMsg); + } + +} diff --git a/src/main/java/org/sentrysoftware/wbem/sblim/slp/package.html b/src/main/java/org/metricshub/wbem/sblim/slp/package.html similarity index 100% rename from src/main/java/org/sentrysoftware/wbem/sblim/slp/package.html rename to src/main/java/org/metricshub/wbem/sblim/slp/package.html diff --git a/src/main/java/org/sentrysoftware/wbem/client/exceptions/WqlQuerySyntaxException.java b/src/main/java/org/sentrysoftware/wbem/client/exceptions/WqlQuerySyntaxException.java deleted file mode 100644 index 98eca75..0000000 --- a/src/main/java/org/sentrysoftware/wbem/client/exceptions/WqlQuerySyntaxException.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.sentrysoftware.wbem.client.exceptions; - -/*- - * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ - * WBEM Java Client - * ჻჻჻჻჻჻ - * Copyright (C) 2023 Sentry Software - * ჻჻჻჻჻჻ - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ - */ - -/** - * Exception for a syntax error in the WQL Query parameter. - * - */ -public class WqlQuerySyntaxException extends Exception { - - private static final long serialVersionUID = 1L; - - public WqlQuerySyntaxException(final String wqlQuery) { - super("Syntax error in WQL Query: " + wqlQuery); - } - - public WqlQuerySyntaxException(final Throwable cause) { - super(cause); - } -} diff --git a/src/site/markdown/index.md b/src/site/markdown/index.md index 1f6fbb6..7cd52bd 100644 --- a/src/site/markdown/index.md +++ b/src/site/markdown/index.md @@ -49,14 +49,14 @@ java -jar --add-exports java.xml/com.sun.org.apache.xerces.internal.parsers --ad Use it as follows: ```Java -package org.sentrysoftware.wbem; +package org.metricshub.wbem; import java.net.MalformedURLException; import java.net.URL; -import org.sentrysoftware.wbem.client.WbemClient; -import org.sentrysoftware.wbem.client.WqlQuery; -import org.sentrysoftware.wbem.javax.wbem.WBEMException; -import org.sentrysoftware.wbem.utils.exceptions.WqlQuerySyntaxException; +import org.metricshub.wbem.client.WbemClient; +import org.metricshub.wbem.client.WqlQuery; +import org.metricshub.wbem.client.exceptions.WqlQuerySyntaxException; +import org.metricshub.wbem.javax.wbem.WBEMException; public class Main { diff --git a/src/site/resources/images/metricshub-logo.png b/src/site/resources/images/metricshub-logo.png new file mode 100644 index 0000000000000000000000000000000000000000..89d6fb80d559b54044abd03ee658ddcc6a77ca3f GIT binary patch literal 6041 zcmV;K7iQ>*P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGf4*&oQ4*`<-1El}}7cNOeK~#8N?VSsJ zRMnlw|L2^0=aDCG3I?bp21JE~NU^n*DxkC$3`kttTBY4>wc6TkeN{y!0kw5^Tl#Qo z)#`57^695)2|gpeC{XV zKaZSy&+q=v|9@T=3KS?%pg@5F1qu`>FmRar^OT|mYKu+-HQfgLTn>C3nod)oG&~(T zpAYc&ogCmz4#7Ws1YSSre8^)yw_(9J1K^2VmJ>8P!^U}b(fd{(-@$zz>b-n(uTL0gvS*aE7qR- z>~8l>zUGt=(JnY=unyWSI$r51;dpBJehA?a1DmRCr3u!O3fS_t z`<9$C>y5e@Jjjdeb?EV)%_d?u# zmoM?Xh~9yz=Y;@%Q3iZUCyFMH0?HKhT2O+rih(@X1?rYDu<0@PrR<}C&E7PBG1K`S zBCLh%C`vt*aC$+Y$6^{s?_@o1c646<^7+s2a$oWtz829QsICtI|Mwv9;q6YNH86@$ zNH+eAgSGTD*c?e%vqx>q=Zl7jzyo@TezhI9(fedB_>;g8PcPHKJQjabGF7*(dewIK z6<>kzr$2cIsy`b5{up|Z;m5KdAObxR{!@Ul)RNsW;d!%dbH?ua+KaU5*Vi`w2XJ=PH-I&J=2n-H>G8PlJyC&b@I}x1^ z)mM~)Hs=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M4hjdI|=Hf)mR-^xEO7OyYL>e&zIr3mebiYedG?bB_I?=8VAk86sLfti^O>}=dL7C;kADEy@o_W;yE>YIY1hlp zLW<(*b!gHEl#4=**}j~UxY&gsuCm|*Zin^`pFXO?s6a!O4YcswYvW_R| z1kw8V%kO%W2yyfvt8w!C*!8-sH_`ss*T&33vr+1hZlUbHe739yx=F;_Ag0{!LMc2w zL+08n-*E3&B3f$Jl5@lG-mauc+}n)5Zs%$UH7`x6 zhVrxn&B?r42A@aE;_ChN0-qfy<6flR@o$(qFR33>y&h1Trrtp6!PUcSjIYB215p-w zg@ewIoz!2hUMnMm&QKQAa1=7j$)QwYw=@k>2ZQ9$s9Juvr zF1>mpbxxh|=m8K@4~}{baq9M0!rJoy7>8fF79?~gtorRkZHGF%g|R=s;HLh_$I@#o zIEo9Z_rYn?jHcyM8w_dmAfwx_zECyXv(P}K-E4Zzu9nmXp^igcHH6cVtLW4_e&aDT zq`AgfwMlO*EN}dc_V33XNU;bA39ycHPpW_NT*p)CQUsx zQ;^=*s|5;oDx}@;p*7pED{9H!5%SaZ(EC9&PWzaAuR)p1;>6bzxMnuAvrywhJxJ*m zeh*5$O{zSkzr7e?9Yk)p_8J=Kv`O_Fpi-f%BQZviMz6_okk7HWhoQtb2obK&G@JU} z8~7}QFpZyk5ti7q6TUb3&I;>@Ti51rbQfuKz@Y-_r*XYHhxj$qbBrEf%ZCc;Ri#s? zL|dWEiKv}t6FrLqG^!0y#TzWkgtGK+Rz;6Rc|7@`arLB~or78UfB*7A-g@VprUpB4 zjLWmQL1X(o8jT9Syd@2?(%X*oWUL8wkEgxR@bq^M+H9juI1NEs{a?w&$p4w8CzF=# z0Z4;}sF@DU4(P8Q^ma})%w9a org.sentrysoftware.maven sentry-maven-skin - 6.2.00 + 6.4.01 @@ -13,15 +13,15 @@ - images/sentry-logo-179x75px.png - https://sentrysoftware.com + images/metricshub-logo.png + https://metricshub.com - + diff --git a/src/test/java/org/sentrysoftware/wbem/WbemCimDataHandlerTest.java b/src/test/java/org/metricshub/wbem/WbemCimDataHandlerTest.java similarity index 90% rename from src/test/java/org/sentrysoftware/wbem/WbemCimDataHandlerTest.java rename to src/test/java/org/metricshub/wbem/WbemCimDataHandlerTest.java index 8a9be5f..1ce5195 100644 --- a/src/test/java/org/sentrysoftware/wbem/WbemCimDataHandlerTest.java +++ b/src/test/java/org/metricshub/wbem/WbemCimDataHandlerTest.java @@ -1,158 +1,157 @@ -package org.sentrysoftware.wbem; - -import java.math.BigInteger; - -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -import org.sentrysoftware.wbem.javax.cim.CIMClass; -import org.sentrysoftware.wbem.javax.cim.CIMClassProperty; -import org.sentrysoftware.wbem.javax.cim.CIMDataType; -import org.sentrysoftware.wbem.javax.cim.CIMDateTime; -import org.sentrysoftware.wbem.javax.cim.CIMDateTimeAbsolute; -import org.sentrysoftware.wbem.javax.cim.CIMDateTimeInterval; -import org.sentrysoftware.wbem.javax.cim.CIMInstance; -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; -import org.sentrysoftware.wbem.javax.cim.CIMProperty; -import org.sentrysoftware.wbem.client.WbemCimDataHandler; - -class WbemCimDataHandlerTest { - - @Test - void testGetCimPropertyAsString() { - - final CIMObjectPath objectPath = new CIMObjectPath("root/emc:Symm_StorageSystem.CreationClassName=\"Symm_StorageSystem\",Name=\"SYMMETRIX-+-000297800620\""); - - Assertions.assertThrows(IllegalArgumentException.class, () -> WbemCimDataHandler.getCimPropertyAsString(null, new CIMInstance(objectPath, new CIMProperty[] {new CIMProperty("Name", CIMDataType.STRING_T, "SYMMETRIX-+-000297800620")}), null)); - Assertions.assertThrows(IllegalArgumentException.class, () -> WbemCimDataHandler.getCimPropertyAsString("Name", null, null)); - - Assertions.assertThrows(IllegalArgumentException.class, () -> WbemCimDataHandler.getCimPropertyAsString("__Path", new CIMInstance(null, new CIMProperty[] {new CIMProperty("Name", CIMDataType.STRING_T, "SYMMETRIX-+-000297800620")}), null)); - Assertions.assertThrows(IllegalArgumentException.class, () -> WbemCimDataHandler.getCimPropertyAsString("Ref", new CIMInstance(objectPath, new CIMProperty[] {new CIMProperty("Ref", new CIMDataType("Ref", 1), "x")}), null)); - - Assertions.assertEquals( - "Symm_StorageSystem.CreationClassName=\"Symm_StorageSystem\",Name=\"SYMMETRIX-+-000297800620\"", - WbemCimDataHandler.getCimPropertyAsString("__PATH", new CIMInstance(objectPath, null), null)); - - Assertions.assertEquals( - "", - WbemCimDataHandler.getCimPropertyAsString( - "UnknownProperty", - new CIMInstance(objectPath, new CIMProperty[] {new CIMProperty("Name", CIMDataType.STRING_T, "\"SYMMETRIX-+-000297800620;\"")}), null)); - - Assertions.assertEquals( - "blablaVal", - WbemCimDataHandler.getCimPropertyAsString( - "blabla", - new CIMInstance(objectPath, new CIMProperty[] {new CIMProperty("Name", CIMDataType.STRING_T, "\"SYMMETRIX-+-000297800620;\""), new CIMProperty("blabla", CIMDataType.STRING_T, "blablaVal", true, false, null)}), null)); - - Assertions.assertEquals( - "", - WbemCimDataHandler.getCimPropertyAsString( - "Name", - new CIMInstance(objectPath, new CIMProperty[] {new CIMProperty("Name", CIMDataType.STRING_T, null)}), null)); - - Assertions.assertEquals( - "\"SYMMETRIX-+-000297800620;\"", - WbemCimDataHandler.getCimPropertyAsString( - "Name", - new CIMInstance(objectPath, new CIMProperty[] {new CIMProperty("Name", CIMDataType.STRING_T, "\"SYMMETRIX-+-000297800620;\"")}), null)); - - Assertions.assertEquals( - "true", - WbemCimDataHandler.getCimPropertyAsString( - "EMCAutoMetaEnabled", - new CIMInstance(objectPath, new CIMProperty[] {new CIMProperty("EMCAutoMetaEnabled", CIMDataType.BOOLEAN_T, Boolean.TRUE)}), null)); - - Assertions.assertEquals( - "true|false|", - WbemCimDataHandler.getCimPropertyAsString( - "EMCAutoMetaEnabledArray", - new CIMInstance(objectPath, new CIMProperty[] {new CIMProperty("EMCAutoMetaEnabledArray", CIMDataType.BOOLEAN_ARRAY_T, new Boolean[] {Boolean.TRUE, Boolean.FALSE})}), null)); - - Assertions.assertEquals( - "10", - WbemCimDataHandler.getCimPropertyAsString( - "PortType", - new CIMInstance(objectPath, new CIMProperty[] {new CIMProperty("PortType", CIMDataType.SINT32_T, Integer.valueOf(10))}), null)); - - Assertions.assertEquals( - "2125000000", - WbemCimDataHandler.getCimPropertyAsString( - "MaxSpeed", - new CIMInstance(objectPath, new CIMProperty[] {new CIMProperty("MaxSpeed", CIMDataType.UINT64_T, new BigInteger("2125000000"))}), null)); - - Assertions.assertEquals( - "1|2|", - WbemCimDataHandler.getCimPropertyAsString( - "OperationalStatus", - new CIMInstance(objectPath, new CIMProperty[] {new CIMProperty("OperationalStatus", CIMDataType.SINT16_ARRAY_T, new Short[] {1,2})}), null)); - - Assertions.assertEquals( - "Symm_StorageSystem.CreationClassName=\"Symm_StorageSystem\",Name=\"SYMMETRIX-+-000297800620\"", - WbemCimDataHandler.getCimPropertyAsString( - "Ref", - new CIMInstance(objectPath, new CIMProperty[] {new CIMProperty("Ref", new CIMDataType("Ref"), objectPath)}), null)); - - Assertions.assertEquals( - "Symm_StorageSystem.CreationClassName=\"Symm_StorageSystem\",Name=\"SYMMETRIX-+-000297800620\"" + - "|", - WbemCimDataHandler.getCimPropertyAsString( - "Ref", - new CIMInstance(objectPath, new CIMProperty[] {new CIMProperty("Ref", new CIMDataType("Ref", 1), new CIMObjectPath[] {objectPath})}), null)); - - Assertions.assertEquals( - "Symm_StorageSystem.CreationClassName=\"Symm_StorageSystem\",Name=\"SYMMETRIX-+-000297800620\"" + - "||"+ - "Symm_StorageSystem.CreationClassName=\"Symm_StorageSystem\",Name=\"SYMMETRIX-+-000297800620\"" + - "|", - WbemCimDataHandler.getCimPropertyAsString( - "Ref", - new CIMInstance(objectPath, new CIMProperty[] {new CIMProperty("Ref", new CIMDataType("Ref", 3), new CIMObjectPath[] {objectPath, null, objectPath})}), null)); - - Assertions.assertEquals( - "1173882243000", - WbemCimDataHandler.getCimPropertyAsString( - "timeAbsolute", - new CIMInstance(objectPath, new CIMProperty[] {new CIMProperty("timeAbsolute", CIMDataType.DATETIME_T, new CIMDateTimeAbsolute("20070314160503.566012+101"))}), null)); - - Assertions.assertEquals( - "1173882243566", - WbemCimDataHandler.getCimPropertyAsString( - "timeInterval", - new CIMInstance(objectPath, new CIMProperty[] {new CIMProperty("timeInterval", CIMDataType.DATETIME_T, new CIMDateTimeInterval(1173882243566L))}), null)); - - Assertions.assertEquals( - "1173882243000|1173882243566|", - WbemCimDataHandler.getCimPropertyAsString( - "timeArray", - new CIMInstance(objectPath, new CIMProperty[] {new CIMProperty("timeArray", CIMDataType.DATETIME_ARRAY_T, new CIMDateTime[] {new CIMDateTimeAbsolute("20070314160503.566012+101"), new CIMDateTimeInterval(1173882243566L)})}), null)); - - final CIMClass cimClass = new CIMClass( - "testClass", - null, - null, - new CIMClassProperty[] {new CIMClassProperty("KeyProp", CIMDataType.STRING_T, null, null, false, false, null)}, - null); - - Assertions.assertEquals( - "class testClass {" + - " string KeyProp;" + - "};", - WbemCimDataHandler.getCimPropertyAsString( - "propClass", - new CIMInstance(objectPath, new CIMProperty[] {new CIMProperty("propClass", CIMDataType.CLASS_T, cimClass)}), null).replaceAll("[\r\n]", "")); - - Assertions.assertEquals( - "class testClass {" + - " string KeyProp;" + - "};" + - "$$" + - "class testClass {" + - " string KeyProp;" + - "};" + - "$", - WbemCimDataHandler.getCimPropertyAsString( - "propClass", - new CIMInstance(objectPath, new CIMProperty[] {new CIMProperty("propClass", CIMDataType.CLASS_ARRAY_T, new CIMClass[] {cimClass, null, cimClass})}), "$").replaceAll("[\r\n]", "")); - } -} +package org.metricshub.wbem; + +import java.math.BigInteger; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.metricshub.wbem.client.WbemCimDataHandler; +import org.metricshub.wbem.javax.cim.CIMClass; +import org.metricshub.wbem.javax.cim.CIMClassProperty; +import org.metricshub.wbem.javax.cim.CIMDataType; +import org.metricshub.wbem.javax.cim.CIMDateTimeAbsolute; +import org.metricshub.wbem.javax.cim.CIMDateTimeInterval; +import org.metricshub.wbem.javax.cim.CIMInstance; +import org.metricshub.wbem.javax.cim.CIMObjectPath; +import org.metricshub.wbem.javax.cim.CIMDateTime; +import org.metricshub.wbem.javax.cim.CIMProperty; + +class WbemCimDataHandlerTest { + + @Test + void testGetCimPropertyAsString() { + + final CIMObjectPath objectPath = new CIMObjectPath("root/emc:Symm_StorageSystem.CreationClassName=\"Symm_StorageSystem\",Name=\"SYMMETRIX-+-000297800620\""); + + Assertions.assertThrows(IllegalArgumentException.class, () -> WbemCimDataHandler.getCimPropertyAsString(null, new CIMInstance(objectPath, new CIMProperty[] {new CIMProperty("Name", CIMDataType.STRING_T, "SYMMETRIX-+-000297800620")}), null)); + Assertions.assertThrows(IllegalArgumentException.class, () -> WbemCimDataHandler.getCimPropertyAsString("Name", null, null)); + + Assertions.assertThrows(IllegalArgumentException.class, () -> WbemCimDataHandler.getCimPropertyAsString("__Path", new CIMInstance(null, new CIMProperty[] {new CIMProperty("Name", CIMDataType.STRING_T, "SYMMETRIX-+-000297800620")}), null)); + Assertions.assertThrows(IllegalArgumentException.class, () -> WbemCimDataHandler.getCimPropertyAsString("Ref", new CIMInstance(objectPath, new CIMProperty[] {new CIMProperty("Ref", new CIMDataType("Ref", 1), "x")}), null)); + + Assertions.assertEquals( + "Symm_StorageSystem.CreationClassName=\"Symm_StorageSystem\",Name=\"SYMMETRIX-+-000297800620\"", + WbemCimDataHandler.getCimPropertyAsString("__PATH", new CIMInstance(objectPath, null), null)); + + Assertions.assertEquals( + "", + WbemCimDataHandler.getCimPropertyAsString( + "UnknownProperty", + new CIMInstance(objectPath, new CIMProperty[] {new CIMProperty("Name", CIMDataType.STRING_T, "\"SYMMETRIX-+-000297800620;\"")}), null)); + + Assertions.assertEquals( + "blablaVal", + WbemCimDataHandler.getCimPropertyAsString( + "blabla", + new CIMInstance(objectPath, new CIMProperty[] {new CIMProperty("Name", CIMDataType.STRING_T, "\"SYMMETRIX-+-000297800620;\""), new CIMProperty("blabla", CIMDataType.STRING_T, "blablaVal", true, false, null)}), null)); + + Assertions.assertEquals( + "", + WbemCimDataHandler.getCimPropertyAsString( + "Name", + new CIMInstance(objectPath, new CIMProperty[] {new CIMProperty("Name", CIMDataType.STRING_T, null)}), null)); + + Assertions.assertEquals( + "\"SYMMETRIX-+-000297800620;\"", + WbemCimDataHandler.getCimPropertyAsString( + "Name", + new CIMInstance(objectPath, new CIMProperty[] {new CIMProperty("Name", CIMDataType.STRING_T, "\"SYMMETRIX-+-000297800620;\"")}), null)); + + Assertions.assertEquals( + "true", + WbemCimDataHandler.getCimPropertyAsString( + "EMCAutoMetaEnabled", + new CIMInstance(objectPath, new CIMProperty[] {new CIMProperty("EMCAutoMetaEnabled", CIMDataType.BOOLEAN_T, Boolean.TRUE)}), null)); + + Assertions.assertEquals( + "true|false|", + WbemCimDataHandler.getCimPropertyAsString( + "EMCAutoMetaEnabledArray", + new CIMInstance(objectPath, new CIMProperty[] {new CIMProperty("EMCAutoMetaEnabledArray", CIMDataType.BOOLEAN_ARRAY_T, new Boolean[] {Boolean.TRUE, Boolean.FALSE})}), null)); + + Assertions.assertEquals( + "10", + WbemCimDataHandler.getCimPropertyAsString( + "PortType", + new CIMInstance(objectPath, new CIMProperty[] {new CIMProperty("PortType", CIMDataType.SINT32_T, Integer.valueOf(10))}), null)); + + Assertions.assertEquals( + "2125000000", + WbemCimDataHandler.getCimPropertyAsString( + "MaxSpeed", + new CIMInstance(objectPath, new CIMProperty[] {new CIMProperty("MaxSpeed", CIMDataType.UINT64_T, new BigInteger("2125000000"))}), null)); + + Assertions.assertEquals( + "1|2|", + WbemCimDataHandler.getCimPropertyAsString( + "OperationalStatus", + new CIMInstance(objectPath, new CIMProperty[] {new CIMProperty("OperationalStatus", CIMDataType.SINT16_ARRAY_T, new Short[] {1,2})}), null)); + + Assertions.assertEquals( + "Symm_StorageSystem.CreationClassName=\"Symm_StorageSystem\",Name=\"SYMMETRIX-+-000297800620\"", + WbemCimDataHandler.getCimPropertyAsString( + "Ref", + new CIMInstance(objectPath, new CIMProperty[] {new CIMProperty("Ref", new CIMDataType("Ref"), objectPath)}), null)); + + Assertions.assertEquals( + "Symm_StorageSystem.CreationClassName=\"Symm_StorageSystem\",Name=\"SYMMETRIX-+-000297800620\"" + + "|", + WbemCimDataHandler.getCimPropertyAsString( + "Ref", + new CIMInstance(objectPath, new CIMProperty[] {new CIMProperty("Ref", new CIMDataType("Ref", 1), new CIMObjectPath[] {objectPath})}), null)); + + Assertions.assertEquals( + "Symm_StorageSystem.CreationClassName=\"Symm_StorageSystem\",Name=\"SYMMETRIX-+-000297800620\"" + + "||"+ + "Symm_StorageSystem.CreationClassName=\"Symm_StorageSystem\",Name=\"SYMMETRIX-+-000297800620\"" + + "|", + WbemCimDataHandler.getCimPropertyAsString( + "Ref", + new CIMInstance(objectPath, new CIMProperty[] {new CIMProperty("Ref", new CIMDataType("Ref", 3), new CIMObjectPath[] {objectPath, null, objectPath})}), null)); + + Assertions.assertEquals( + "1173882243000", + WbemCimDataHandler.getCimPropertyAsString( + "timeAbsolute", + new CIMInstance(objectPath, new CIMProperty[] {new CIMProperty("timeAbsolute", CIMDataType.DATETIME_T, new CIMDateTimeAbsolute("20070314160503.566012+101"))}), null)); + + Assertions.assertEquals( + "1173882243566", + WbemCimDataHandler.getCimPropertyAsString( + "timeInterval", + new CIMInstance(objectPath, new CIMProperty[] {new CIMProperty("timeInterval", CIMDataType.DATETIME_T, new CIMDateTimeInterval(1173882243566L))}), null)); + + Assertions.assertEquals( + "1173882243000|1173882243566|", + WbemCimDataHandler.getCimPropertyAsString( + "timeArray", + new CIMInstance(objectPath, new CIMProperty[] {new CIMProperty("timeArray", CIMDataType.DATETIME_ARRAY_T, new CIMDateTime[] {new CIMDateTimeAbsolute("20070314160503.566012+101"), new CIMDateTimeInterval(1173882243566L)})}), null)); + + final CIMClass cimClass = new CIMClass( + "testClass", + null, + null, + new CIMClassProperty[] {new CIMClassProperty("KeyProp", CIMDataType.STRING_T, null, null, false, false, null)}, + null); + + Assertions.assertEquals( + "class testClass {" + + " string KeyProp;" + + "};", + WbemCimDataHandler.getCimPropertyAsString( + "propClass", + new CIMInstance(objectPath, new CIMProperty[] {new CIMProperty("propClass", CIMDataType.CLASS_T, cimClass)}), null).replaceAll("[\r\n]", "")); + + Assertions.assertEquals( + "class testClass {" + + " string KeyProp;" + + "};" + + "$$" + + "class testClass {" + + " string KeyProp;" + + "};" + + "$", + WbemCimDataHandler.getCimPropertyAsString( + "propClass", + new CIMInstance(objectPath, new CIMProperty[] {new CIMProperty("propClass", CIMDataType.CLASS_ARRAY_T, new CIMClass[] {cimClass, null, cimClass})}), "$").replaceAll("[\r\n]", "")); + } +} diff --git a/src/test/java/org/sentrysoftware/wbem/WbemClientTest.java b/src/test/java/org/metricshub/wbem/WbemClientTest.java similarity index 89% rename from src/test/java/org/sentrysoftware/wbem/WbemClientTest.java rename to src/test/java/org/metricshub/wbem/WbemClientTest.java index 7e24bb7..a1a16bf 100644 --- a/src/test/java/org/sentrysoftware/wbem/WbemClientTest.java +++ b/src/test/java/org/metricshub/wbem/WbemClientTest.java @@ -1,163 +1,163 @@ -package org.sentrysoftware.wbem; - -import java.net.URL; -import java.util.Locale; - -import javax.security.auth.Subject; - -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentMatchers; -import org.mockito.MockedStatic; -import org.mockito.Mockito; -import org.sentrysoftware.wbem.client.WbemClient; -import org.sentrysoftware.wbem.client.WbemQueryResult; -import org.sentrysoftware.wbem.client.WqlQuery; -import org.sentrysoftware.wbem.javax.cim.CIMInstance; -import org.sentrysoftware.wbem.javax.cim.CIMObjectPath; -import org.sentrysoftware.wbem.javax.wbem.CloseableIterator; -import org.sentrysoftware.wbem.javax.wbem.client.EnumerateResponse; -import org.sentrysoftware.wbem.javax.wbem.client.WBEMClient; -import org.sentrysoftware.wbem.javax.wbem.client.WBEMClientConstants; -import org.sentrysoftware.wbem.javax.wbem.client.WBEMClientFactory; - -class WbemClientTest { - - @Test - void testConnect() throws Exception { - final URL url = new URL("https://host:8080"); - final String username = "user"; - final char[] password = {'p', 'a', 's', 's'}; - int timeout = 60*1000; - - Assertions.assertThrows(IllegalArgumentException.class, () -> new WbemClient().connect(null, username, password, timeout)); - Assertions.assertThrows(IllegalArgumentException.class, () -> new WbemClient().connect(url, null, password, timeout)); - Assertions.assertThrows(IllegalArgumentException.class, () -> new WbemClient().connect(url, username, null, timeout)); - - try (final MockedStatic mockedWBEMClientFactory = Mockito.mockStatic(WBEMClientFactory.class); - final WbemClient wbemClient = new WbemClient()) { - final WBEMClient client = Mockito.mock(WBEMClient.class); - - mockedWBEMClientFactory.when(() -> WBEMClientFactory.getClient("CIM-XML")).thenReturn(client); - Mockito.doNothing().when(client).setProperty(WBEMClientConstants.PROP_TIMEOUT, String.valueOf(timeout)); - Mockito.doNothing().when(client).initialize( - ArgumentMatchers.any(CIMObjectPath.class), - ArgumentMatchers.any(Subject.class), - ArgumentMatchers.eq(new Locale[] {Locale.ENGLISH})); - - wbemClient.connect(url, username, password, timeout); - } - } - - @SuppressWarnings("unchecked") - @Test - void testExecuteWql() throws Exception { - final String namespace = "root/emc"; - final WqlQuery queryHandler = WqlQuery.parseQuery("Select * from EMC_StorageSystem"); - - Assertions.assertThrows(IllegalArgumentException.class, () -> new WbemClient().executeWql(null, namespace, null)); - Assertions.assertThrows(IllegalArgumentException.class, () -> new WbemClient().executeWql(queryHandler, null, null)); - - Assertions.assertThrows(IllegalStateException.class, () -> new WbemClient().executeWql(queryHandler, namespace, null)); - - final URL url = new URL("https://host:8080"); - final String username = "user"; - final char[] password = {'p', 'a', 's', 's'}; - int timeout = 60*1000; - final WBEMClient client = Mockito.mock(WBEMClient.class); - final CloseableIterator iterator = Mockito.mock(CloseableIterator.class); - final WbemQueryResult result = Mockito.mock(WbemQueryResult.class); - - try (final MockedStatic mockedWBEMClientFactory = Mockito.mockStatic(WBEMClientFactory.class); - final MockedStatic mockedMatsyaWbemClient = Mockito.mockStatic(WbemClient.class); - final WbemClient matsyaWbemClient =new WbemClient()) { - - mockedWBEMClientFactory.when(() -> WBEMClientFactory.getClient("CIM-XML")).thenReturn(client); - - Mockito.doNothing().when(client).setProperty(WBEMClientConstants.PROP_TIMEOUT, String.valueOf(timeout)); - - Mockito.doNothing().when(client).initialize( - ArgumentMatchers.any(CIMObjectPath.class), - ArgumentMatchers.any(Subject.class), - ArgumentMatchers.eq(new Locale[] {Locale.ENGLISH})); - - Mockito.doReturn(iterator).when(client).enumerateInstances( - ArgumentMatchers.any(CIMObjectPath.class), - ArgumentMatchers.eq(true), - ArgumentMatchers.eq(false), - ArgumentMatchers.eq(true), - ArgumentMatchers.eq(queryHandler.getPropertiesArray())); - - mockedMatsyaWbemClient.when(() -> WbemClient.enumerateInstances( - ArgumentMatchers.any(WqlQuery.class), - ArgumentMatchers.any(CloseableIterator.class), - ArgumentMatchers.isNull())) - .thenReturn(result); - - matsyaWbemClient.connect(url, username, password, timeout); - - Assertions.assertEquals(result, matsyaWbemClient.executeWql(queryHandler, namespace, null)); - } - } - - @SuppressWarnings("unchecked") - @Test - void testGetAssociators() throws Exception { - final URL url = new URL("https://host:8080"); - final String username = "user"; - final char[] password = {'p', 'a', 's', 's'}; - int timeout = 60*1000; - final WBEMClient client = Mockito.mock(WBEMClient.class); - final WqlQuery queryHandler = WqlQuery.parseQuery("Select * from EMC_StorageSystem"); - final EnumerateResponse response = Mockito.mock(EnumerateResponse.class); - final CloseableIterator iterator = Mockito.mock(CloseableIterator.class); - final WbemQueryResult result = Mockito.mock(WbemQueryResult.class); - - final String objectPathAssociators = "objectPathAssociators"; - Assertions.assertThrows(IllegalArgumentException.class, () -> new WbemClient().getAssociators(null, objectPathAssociators, null)); - Assertions.assertThrows(IllegalArgumentException.class, () -> new WbemClient().getAssociators(queryHandler, null, null)); - - Assertions.assertThrows(IllegalStateException.class, () -> new WbemClient().getAssociators(queryHandler, objectPathAssociators, null)); - - try (final MockedStatic mockedWBEMClientFactory = Mockito.mockStatic(WBEMClientFactory.class); - final MockedStatic mockedMatsyaWbemClient = Mockito.mockStatic(WbemClient.class); - final WbemClient matsyaWbemClient = new WbemClient()) { - - mockedWBEMClientFactory.when(() -> WBEMClientFactory.getClient("CIM-XML")).thenReturn(client); - - Mockito.doNothing().when(client).setProperty(WBEMClientConstants.PROP_TIMEOUT, String.valueOf(timeout)); - - Mockito.doNothing().when(client).initialize( - ArgumentMatchers.any(CIMObjectPath.class), - ArgumentMatchers.any(Subject.class), - ArgumentMatchers.eq(new Locale[] {Locale.ENGLISH})); - - Mockito.doReturn(response).when(client).associators( - ArgumentMatchers.any(CIMObjectPath.class), - ArgumentMatchers.eq(queryHandler.getClassName()), - ArgumentMatchers.isNull(), - ArgumentMatchers.isNull(), - ArgumentMatchers.isNull(), - ArgumentMatchers.eq(false), - ArgumentMatchers.eq(queryHandler.getPropertiesArray()), - ArgumentMatchers.isNull(), - ArgumentMatchers.isNull(), - ArgumentMatchers.isNull(), - ArgumentMatchers.eq(false), - ArgumentMatchers.isNull()); - - Mockito.doReturn(iterator).when(response).getResponses(); - - mockedMatsyaWbemClient.when(() -> WbemClient.enumerateInstances( - ArgumentMatchers.any(WqlQuery.class), - ArgumentMatchers.any(CloseableIterator.class), - ArgumentMatchers.isNull())) - .thenReturn(result); - - matsyaWbemClient.connect(url, username, password, timeout); - - Assertions.assertEquals(result, matsyaWbemClient.getAssociators(queryHandler, objectPathAssociators, null)); - } - } - -} +package org.metricshub.wbem; + +import java.net.URL; +import java.util.Locale; + +import javax.security.auth.Subject; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.metricshub.wbem.client.WbemClient; +import org.metricshub.wbem.client.WqlQuery; +import org.metricshub.wbem.javax.cim.CIMInstance; +import org.metricshub.wbem.javax.cim.CIMObjectPath; +import org.metricshub.wbem.javax.wbem.CloseableIterator; +import org.metricshub.wbem.javax.wbem.client.EnumerateResponse; +import org.metricshub.wbem.javax.wbem.client.WBEMClient; +import org.metricshub.wbem.javax.wbem.client.WBEMClientFactory; +import org.mockito.ArgumentMatchers; +import org.mockito.MockedStatic; +import org.mockito.Mockito; +import org.metricshub.wbem.client.WbemQueryResult; +import org.metricshub.wbem.javax.wbem.client.WBEMClientConstants; + +class WbemClientTest { + + @Test + void testConnect() throws Exception { + final URL url = new URL("https://host:8080"); + final String username = "user"; + final char[] password = {'p', 'a', 's', 's'}; + int timeout = 60*1000; + + Assertions.assertThrows(IllegalArgumentException.class, () -> new WbemClient().connect(null, username, password, timeout)); + Assertions.assertThrows(IllegalArgumentException.class, () -> new WbemClient().connect(url, null, password, timeout)); + Assertions.assertThrows(IllegalArgumentException.class, () -> new WbemClient().connect(url, username, null, timeout)); + + try (final MockedStatic mockedWBEMClientFactory = Mockito.mockStatic(WBEMClientFactory.class); + final WbemClient wbemClient = new WbemClient()) { + final WBEMClient client = Mockito.mock(WBEMClient.class); + + mockedWBEMClientFactory.when(() -> WBEMClientFactory.getClient("CIM-XML")).thenReturn(client); + Mockito.doNothing().when(client).setProperty(WBEMClientConstants.PROP_TIMEOUT, String.valueOf(timeout)); + Mockito.doNothing().when(client).initialize( + ArgumentMatchers.any(CIMObjectPath.class), + ArgumentMatchers.any(Subject.class), + ArgumentMatchers.eq(new Locale[] {Locale.ENGLISH})); + + wbemClient.connect(url, username, password, timeout); + } + } + + @SuppressWarnings("unchecked") + @Test + void testExecuteWql() throws Exception { + final String namespace = "root/emc"; + final WqlQuery queryHandler = WqlQuery.parseQuery("Select * from EMC_StorageSystem"); + + Assertions.assertThrows(IllegalArgumentException.class, () -> new WbemClient().executeWql(null, namespace, null)); + Assertions.assertThrows(IllegalArgumentException.class, () -> new WbemClient().executeWql(queryHandler, null, null)); + + Assertions.assertThrows(IllegalStateException.class, () -> new WbemClient().executeWql(queryHandler, namespace, null)); + + final URL url = new URL("https://host:8080"); + final String username = "user"; + final char[] password = {'p', 'a', 's', 's'}; + int timeout = 60*1000; + final WBEMClient client = Mockito.mock(WBEMClient.class); + final CloseableIterator iterator = Mockito.mock(CloseableIterator.class); + final WbemQueryResult result = Mockito.mock(WbemQueryResult.class); + + try (final MockedStatic mockedWBEMClientFactory = Mockito.mockStatic(WBEMClientFactory.class); + final MockedStatic mockedMatsyaWbemClient = Mockito.mockStatic(WbemClient.class); + final WbemClient matsyaWbemClient =new WbemClient()) { + + mockedWBEMClientFactory.when(() -> WBEMClientFactory.getClient("CIM-XML")).thenReturn(client); + + Mockito.doNothing().when(client).setProperty(WBEMClientConstants.PROP_TIMEOUT, String.valueOf(timeout)); + + Mockito.doNothing().when(client).initialize( + ArgumentMatchers.any(CIMObjectPath.class), + ArgumentMatchers.any(Subject.class), + ArgumentMatchers.eq(new Locale[] {Locale.ENGLISH})); + + Mockito.doReturn(iterator).when(client).enumerateInstances( + ArgumentMatchers.any(CIMObjectPath.class), + ArgumentMatchers.eq(true), + ArgumentMatchers.eq(false), + ArgumentMatchers.eq(true), + ArgumentMatchers.eq(queryHandler.getPropertiesArray())); + + mockedMatsyaWbemClient.when(() -> WbemClient.enumerateInstances( + ArgumentMatchers.any(WqlQuery.class), + ArgumentMatchers.any(CloseableIterator.class), + ArgumentMatchers.isNull())) + .thenReturn(result); + + matsyaWbemClient.connect(url, username, password, timeout); + + Assertions.assertEquals(result, matsyaWbemClient.executeWql(queryHandler, namespace, null)); + } + } + + @SuppressWarnings("unchecked") + @Test + void testGetAssociators() throws Exception { + final URL url = new URL("https://host:8080"); + final String username = "user"; + final char[] password = {'p', 'a', 's', 's'}; + int timeout = 60*1000; + final WBEMClient client = Mockito.mock(WBEMClient.class); + final WqlQuery queryHandler = WqlQuery.parseQuery("Select * from EMC_StorageSystem"); + final EnumerateResponse response = Mockito.mock(EnumerateResponse.class); + final CloseableIterator iterator = Mockito.mock(CloseableIterator.class); + final WbemQueryResult result = Mockito.mock(WbemQueryResult.class); + + final String objectPathAssociators = "objectPathAssociators"; + Assertions.assertThrows(IllegalArgumentException.class, () -> new WbemClient().getAssociators(null, objectPathAssociators, null)); + Assertions.assertThrows(IllegalArgumentException.class, () -> new WbemClient().getAssociators(queryHandler, null, null)); + + Assertions.assertThrows(IllegalStateException.class, () -> new WbemClient().getAssociators(queryHandler, objectPathAssociators, null)); + + try (final MockedStatic mockedWBEMClientFactory = Mockito.mockStatic(WBEMClientFactory.class); + final MockedStatic mockedMatsyaWbemClient = Mockito.mockStatic(WbemClient.class); + final WbemClient matsyaWbemClient = new WbemClient()) { + + mockedWBEMClientFactory.when(() -> WBEMClientFactory.getClient("CIM-XML")).thenReturn(client); + + Mockito.doNothing().when(client).setProperty(WBEMClientConstants.PROP_TIMEOUT, String.valueOf(timeout)); + + Mockito.doNothing().when(client).initialize( + ArgumentMatchers.any(CIMObjectPath.class), + ArgumentMatchers.any(Subject.class), + ArgumentMatchers.eq(new Locale[] {Locale.ENGLISH})); + + Mockito.doReturn(response).when(client).associators( + ArgumentMatchers.any(CIMObjectPath.class), + ArgumentMatchers.eq(queryHandler.getClassName()), + ArgumentMatchers.isNull(), + ArgumentMatchers.isNull(), + ArgumentMatchers.isNull(), + ArgumentMatchers.eq(false), + ArgumentMatchers.eq(queryHandler.getPropertiesArray()), + ArgumentMatchers.isNull(), + ArgumentMatchers.isNull(), + ArgumentMatchers.isNull(), + ArgumentMatchers.eq(false), + ArgumentMatchers.isNull()); + + Mockito.doReturn(iterator).when(response).getResponses(); + + mockedMatsyaWbemClient.when(() -> WbemClient.enumerateInstances( + ArgumentMatchers.any(WqlQuery.class), + ArgumentMatchers.any(CloseableIterator.class), + ArgumentMatchers.isNull())) + .thenReturn(result); + + matsyaWbemClient.connect(url, username, password, timeout); + + Assertions.assertEquals(result, matsyaWbemClient.getAssociators(queryHandler, objectPathAssociators, null)); + } + } + +} diff --git a/src/test/java/org/sentrysoftware/wbem/WbemExecutorTest.java b/src/test/java/org/metricshub/wbem/WbemExecutorTest.java similarity index 92% rename from src/test/java/org/sentrysoftware/wbem/WbemExecutorTest.java rename to src/test/java/org/metricshub/wbem/WbemExecutorTest.java index a7beb0b..b94802b 100644 --- a/src/test/java/org/sentrysoftware/wbem/WbemExecutorTest.java +++ b/src/test/java/org/metricshub/wbem/WbemExecutorTest.java @@ -1,82 +1,82 @@ -package org.sentrysoftware.wbem; - -import java.net.URL; -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; - -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentMatchers; -import org.mockito.MockedStatic; -import org.mockito.Mockito; -import org.sentrysoftware.wbem.client.WbemExecutor; -import org.sentrysoftware.wbem.client.WbemQueryResult; -import org.sentrysoftware.wbem.javax.wbem.WBEMException; - -class WbemExecutorTest { - - @SuppressWarnings("unchecked") - @Test - void testExecuteWql() throws Exception { - final URL url = new URL("https://host:8080"); - final String username = "user"; - final char[] password = {'p', 'a', 's', 's'}; - int timeout = 60*1000; - final String namespace = "root/emc"; - final String query = "Select * from EMC_StorageSystem"; - - Assertions.assertThrows(IllegalArgumentException.class, () -> WbemExecutor.executeWql(null, namespace, username, password, query, timeout, null)); - Assertions.assertThrows(IllegalArgumentException.class, () -> WbemExecutor.executeWql(url, namespace, null, password, query, timeout, null)); - Assertions.assertThrows(IllegalArgumentException.class, () -> WbemExecutor.executeWql(url, namespace, username, null, query, timeout, null)); - Assertions.assertThrows(IllegalArgumentException.class, () -> WbemExecutor.executeWql(url, namespace, username, password, null, timeout, null)); - Assertions.assertThrows(TimeoutException.class, () -> WbemExecutor.executeWql(url, namespace, username, password, query, 0, null)); - - final WbemQueryResult result = Mockito.mock(WbemQueryResult.class); - final Future handler = Mockito.mock(Future.class); - final ExecutorService executor = Mockito.mock(ExecutorService.class); - - try (final MockedStatic mockedExecutorService = Mockito.mockStatic(Executors.class)) { - final WBEMException wbemException = new WBEMException("msg"); - final ExecutionException executionException = new ExecutionException(wbemException); - - mockedExecutorService.when(Executors::newSingleThreadExecutor).thenReturn(executor); - - Mockito.doReturn(handler).when(executor).submit(ArgumentMatchers.any(Callable.class)); - Mockito.doThrow(executionException).when(handler).get(timeout, TimeUnit.MILLISECONDS); - - Assertions.assertThrows( - WBEMException.class, - () -> WbemExecutor.executeWql(url, namespace, username, password, query, timeout, null)); - } - - try (final MockedStatic mockedExecutorService = Mockito.mockStatic(Executors.class)) { - final IllegalArgumentException illegalArgumentException = new IllegalArgumentException("msg"); - final ExecutionException executionException = new ExecutionException(illegalArgumentException); - - mockedExecutorService.when(Executors::newSingleThreadExecutor).thenReturn(executor); - - Mockito.doReturn(handler).when(executor).submit(ArgumentMatchers.any(Callable.class)); - Mockito.doThrow(executionException).when(handler).get(timeout, TimeUnit.MILLISECONDS); - - Assertions.assertThrows( - RuntimeException.class, - () -> WbemExecutor.executeWql(url, namespace, username, password, query, timeout, null)); - } - - try (final MockedStatic mockedExecutorService = Mockito.mockStatic(Executors.class)) { - mockedExecutorService.when(Executors::newSingleThreadExecutor).thenReturn(executor); - - Mockito.doReturn(handler).when(executor).submit(ArgumentMatchers.any(Callable.class)); - Mockito.doReturn(result).when(handler).get(timeout, TimeUnit.MILLISECONDS); - - Assertions.assertEquals( - result, - WbemExecutor.executeWql(url, namespace, username, password, query, timeout, null)); - } - } -} +package org.metricshub.wbem; + +import java.net.URL; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.metricshub.wbem.client.WbemExecutor; +import org.metricshub.wbem.javax.wbem.WBEMException; +import org.mockito.ArgumentMatchers; +import org.mockito.MockedStatic; +import org.mockito.Mockito; +import org.metricshub.wbem.client.WbemQueryResult; + +class WbemExecutorTest { + + @SuppressWarnings("unchecked") + @Test + void testExecuteWql() throws Exception { + final URL url = new URL("https://host:8080"); + final String username = "user"; + final char[] password = {'p', 'a', 's', 's'}; + int timeout = 60*1000; + final String namespace = "root/emc"; + final String query = "Select * from EMC_StorageSystem"; + + Assertions.assertThrows(IllegalArgumentException.class, () -> WbemExecutor.executeWql(null, namespace, username, password, query, timeout, null)); + Assertions.assertThrows(IllegalArgumentException.class, () -> WbemExecutor.executeWql(url, namespace, null, password, query, timeout, null)); + Assertions.assertThrows(IllegalArgumentException.class, () -> WbemExecutor.executeWql(url, namespace, username, null, query, timeout, null)); + Assertions.assertThrows(IllegalArgumentException.class, () -> WbemExecutor.executeWql(url, namespace, username, password, null, timeout, null)); + Assertions.assertThrows(TimeoutException.class, () -> WbemExecutor.executeWql(url, namespace, username, password, query, 0, null)); + + final WbemQueryResult result = Mockito.mock(WbemQueryResult.class); + final Future handler = Mockito.mock(Future.class); + final ExecutorService executor = Mockito.mock(ExecutorService.class); + + try (final MockedStatic mockedExecutorService = Mockito.mockStatic(Executors.class)) { + final WBEMException wbemException = new WBEMException("msg"); + final ExecutionException executionException = new ExecutionException(wbemException); + + mockedExecutorService.when(Executors::newSingleThreadExecutor).thenReturn(executor); + + Mockito.doReturn(handler).when(executor).submit(ArgumentMatchers.any(Callable.class)); + Mockito.doThrow(executionException).when(handler).get(timeout, TimeUnit.MILLISECONDS); + + Assertions.assertThrows( + WBEMException.class, + () -> WbemExecutor.executeWql(url, namespace, username, password, query, timeout, null)); + } + + try (final MockedStatic mockedExecutorService = Mockito.mockStatic(Executors.class)) { + final IllegalArgumentException illegalArgumentException = new IllegalArgumentException("msg"); + final ExecutionException executionException = new ExecutionException(illegalArgumentException); + + mockedExecutorService.when(Executors::newSingleThreadExecutor).thenReturn(executor); + + Mockito.doReturn(handler).when(executor).submit(ArgumentMatchers.any(Callable.class)); + Mockito.doThrow(executionException).when(handler).get(timeout, TimeUnit.MILLISECONDS); + + Assertions.assertThrows( + RuntimeException.class, + () -> WbemExecutor.executeWql(url, namespace, username, password, query, timeout, null)); + } + + try (final MockedStatic mockedExecutorService = Mockito.mockStatic(Executors.class)) { + mockedExecutorService.when(Executors::newSingleThreadExecutor).thenReturn(executor); + + Mockito.doReturn(handler).when(executor).submit(ArgumentMatchers.any(Callable.class)); + Mockito.doReturn(result).when(handler).get(timeout, TimeUnit.MILLISECONDS); + + Assertions.assertEquals( + result, + WbemExecutor.executeWql(url, namespace, username, password, query, timeout, null)); + } + } +} diff --git a/src/test/java/org/sentrysoftware/wbem/WqlQueryTest.java b/src/test/java/org/metricshub/wbem/WqlQueryTest.java similarity index 95% rename from src/test/java/org/sentrysoftware/wbem/WqlQueryTest.java rename to src/test/java/org/metricshub/wbem/WqlQueryTest.java index acac015..beb278f 100644 --- a/src/test/java/org/sentrysoftware/wbem/WqlQueryTest.java +++ b/src/test/java/org/metricshub/wbem/WqlQueryTest.java @@ -1,76 +1,76 @@ -package org.sentrysoftware.wbem; - -import java.util.Arrays; -import java.util.LinkedHashSet; -import java.util.stream.Collectors; - -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.sentrysoftware.wbem.client.WqlQuery; -import org.sentrysoftware.wbem.client.exceptions.WqlQuerySyntaxException; - -class WqlQueryTest { - - @Test - void testQueryCommon() { - Assertions.assertThrows(IllegalArgumentException.class, () -> WqlQuery.parseQuery(null)); - Assertions.assertThrows(WqlQuerySyntaxException.class, () -> WqlQuery.parseQuery("")); - Assertions.assertThrows(WqlQuerySyntaxException.class, () -> WqlQuery.parseQuery("Sel")); - Assertions.assertThrows(WqlQuerySyntaxException.class, () -> WqlQuery.parseQuery("Up")); - Assertions.assertThrows(WqlQuerySyntaxException.class, () -> WqlQuery.parseQuery("Upate T set a=x, b=y")); - Assertions.assertThrows(WqlQuerySyntaxException.class, () -> WqlQuery.parseQuery("Upate T set a=x, b=y where c=z")); - } - - @Test - void testSelect() throws Exception { - Assertions.assertThrows(WqlQuerySyntaxException.class, () -> WqlQuery.parseQuery("Sel a,b From T")); - Assertions.assertThrows(WqlQuerySyntaxException.class, () -> WqlQuery.parseQuery("Update a,b From T")); - Assertions.assertThrows(WqlQuerySyntaxException.class, () -> WqlQuery.parseQuery("Select *,a,b From T")); - Assertions.assertThrows(WqlQuerySyntaxException.class, () -> WqlQuery.parseQuery("Select *,* From T")); - Assertions.assertThrows(WqlQuerySyntaxException.class, () -> WqlQuery.parseQuery("Select * * From T")); - Assertions.assertThrows(WqlQuerySyntaxException.class, () -> WqlQuery.parseQuery("Select")); - Assertions.assertThrows(WqlQuerySyntaxException.class, () -> WqlQuery.parseQuery("Select a,b ")); - Assertions.assertThrows(WqlQuerySyntaxException.class, () -> WqlQuery.parseQuery("Select From ")); - Assertions.assertThrows(WqlQuerySyntaxException.class, () -> WqlQuery.parseQuery("Select From T")); - Assertions.assertThrows(WqlQuerySyntaxException.class, () -> WqlQuery.parseQuery(" a,b From T")); - Assertions.assertThrows(WqlQuerySyntaxException.class, () -> WqlQuery.parseQuery("Select a,b From ")); - Assertions.assertThrows(WqlQuerySyntaxException.class, () -> WqlQuery.parseQuery("Select Select a,b From T")); - Assertions.assertThrows(WqlQuerySyntaxException.class, () -> WqlQuery.parseQuery("Select a,b From From T")); - Assertions.assertThrows(WqlQuerySyntaxException.class, () -> WqlQuery.parseQuery("Select ,a,b From T")); - Assertions.assertThrows(WqlQuerySyntaxException.class, () -> WqlQuery.parseQuery("Select a, ,b From T")); - Assertions.assertThrows(WqlQuerySyntaxException.class, () -> WqlQuery.parseQuery("Select a,b, From T")); - Assertions.assertThrows(WqlQuerySyntaxException.class, () -> WqlQuery.parseQuery("Select a b From T")); - Assertions.assertThrows(WqlQuerySyntaxException.class, () -> WqlQuery.parseQuery("Select a;b From T")); - Assertions.assertThrows(WqlQuerySyntaxException.class, () -> WqlQuery.parseQuery("Select a,b From T U")); - Assertions.assertThrows(WqlQuerySyntaxException.class, () -> WqlQuery.parseQuery("Select a,b T ")); - Assertions.assertThrows(WqlQuerySyntaxException.class, () -> WqlQuery.parseQuery("From a,b Select T")); - - { - final WqlQuery wqlQuery = WqlQuery.parseQuery("SELECT * FROM HITACHI_FCPort"); - - Assertions.assertEquals("HITACHI_FCPort", wqlQuery.getClassName()); - Assertions.assertNull(wqlQuery.getPropertiesArray()); - Assertions.assertTrue(wqlQuery.getProperties().isEmpty()); - Assertions.assertTrue(wqlQuery.getOriginalProperties().isEmpty()); - Assertions.assertFalse(wqlQuery.hasDuplicateProperties()); - } - { - final WqlQuery wqlQuery = WqlQuery.parseQuery(" select Antecedent, Dependent from IBMTSDS_SHWIDToSPC"); - - Assertions.assertEquals("IBMTSDS_SHWIDToSPC", wqlQuery.getClassName()); - Assertions.assertArrayEquals(new String[] {"Antecedent", "Dependent"}, wqlQuery.getPropertiesArray()); - Assertions.assertEquals(Arrays.asList("Antecedent", "Dependent").stream().collect(Collectors.toCollection(LinkedHashSet::new)), wqlQuery.getProperties()); - Assertions.assertEquals(Arrays.asList("Antecedent", "Dependent"), wqlQuery.getOriginalProperties()); - Assertions.assertFalse(wqlQuery.hasDuplicateProperties()); - } - { - final WqlQuery wqlQuery = WqlQuery.parseQuery(" SELECT __Path, Name, __PATH from EMC_StorageSystem "); - - Assertions.assertEquals("EMC_StorageSystem", wqlQuery.getClassName()); - Assertions.assertArrayEquals(new String[] {"Name"}, wqlQuery.getPropertiesArray()); - Assertions.assertEquals(Arrays.asList("__Path", "Name").stream().collect(Collectors.toCollection(LinkedHashSet::new)), wqlQuery.getProperties()); - Assertions.assertEquals(Arrays.asList("__Path", "Name", "__PATH"), wqlQuery.getOriginalProperties()); - Assertions.assertTrue(wqlQuery.hasDuplicateProperties()); - } - } -} +package org.metricshub.wbem; + +import java.util.Arrays; +import java.util.LinkedHashSet; +import java.util.stream.Collectors; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.metricshub.wbem.client.WqlQuery; +import org.metricshub.wbem.client.exceptions.WqlQuerySyntaxException; + +class WqlQueryTest { + + @Test + void testQueryCommon() { + Assertions.assertThrows(IllegalArgumentException.class, () -> WqlQuery.parseQuery(null)); + Assertions.assertThrows(WqlQuerySyntaxException.class, () -> WqlQuery.parseQuery("")); + Assertions.assertThrows(WqlQuerySyntaxException.class, () -> WqlQuery.parseQuery("Sel")); + Assertions.assertThrows(WqlQuerySyntaxException.class, () -> WqlQuery.parseQuery("Up")); + Assertions.assertThrows(WqlQuerySyntaxException.class, () -> WqlQuery.parseQuery("Upate T set a=x, b=y")); + Assertions.assertThrows(WqlQuerySyntaxException.class, () -> WqlQuery.parseQuery("Upate T set a=x, b=y where c=z")); + } + + @Test + void testSelect() throws Exception { + Assertions.assertThrows(WqlQuerySyntaxException.class, () -> WqlQuery.parseQuery("Sel a,b From T")); + Assertions.assertThrows(WqlQuerySyntaxException.class, () -> WqlQuery.parseQuery("Update a,b From T")); + Assertions.assertThrows(WqlQuerySyntaxException.class, () -> WqlQuery.parseQuery("Select *,a,b From T")); + Assertions.assertThrows(WqlQuerySyntaxException.class, () -> WqlQuery.parseQuery("Select *,* From T")); + Assertions.assertThrows(WqlQuerySyntaxException.class, () -> WqlQuery.parseQuery("Select * * From T")); + Assertions.assertThrows(WqlQuerySyntaxException.class, () -> WqlQuery.parseQuery("Select")); + Assertions.assertThrows(WqlQuerySyntaxException.class, () -> WqlQuery.parseQuery("Select a,b ")); + Assertions.assertThrows(WqlQuerySyntaxException.class, () -> WqlQuery.parseQuery("Select From ")); + Assertions.assertThrows(WqlQuerySyntaxException.class, () -> WqlQuery.parseQuery("Select From T")); + Assertions.assertThrows(WqlQuerySyntaxException.class, () -> WqlQuery.parseQuery(" a,b From T")); + Assertions.assertThrows(WqlQuerySyntaxException.class, () -> WqlQuery.parseQuery("Select a,b From ")); + Assertions.assertThrows(WqlQuerySyntaxException.class, () -> WqlQuery.parseQuery("Select Select a,b From T")); + Assertions.assertThrows(WqlQuerySyntaxException.class, () -> WqlQuery.parseQuery("Select a,b From From T")); + Assertions.assertThrows(WqlQuerySyntaxException.class, () -> WqlQuery.parseQuery("Select ,a,b From T")); + Assertions.assertThrows(WqlQuerySyntaxException.class, () -> WqlQuery.parseQuery("Select a, ,b From T")); + Assertions.assertThrows(WqlQuerySyntaxException.class, () -> WqlQuery.parseQuery("Select a,b, From T")); + Assertions.assertThrows(WqlQuerySyntaxException.class, () -> WqlQuery.parseQuery("Select a b From T")); + Assertions.assertThrows(WqlQuerySyntaxException.class, () -> WqlQuery.parseQuery("Select a;b From T")); + Assertions.assertThrows(WqlQuerySyntaxException.class, () -> WqlQuery.parseQuery("Select a,b From T U")); + Assertions.assertThrows(WqlQuerySyntaxException.class, () -> WqlQuery.parseQuery("Select a,b T ")); + Assertions.assertThrows(WqlQuerySyntaxException.class, () -> WqlQuery.parseQuery("From a,b Select T")); + + { + final WqlQuery wqlQuery = WqlQuery.parseQuery("SELECT * FROM HITACHI_FCPort"); + + Assertions.assertEquals("HITACHI_FCPort", wqlQuery.getClassName()); + Assertions.assertNull(wqlQuery.getPropertiesArray()); + Assertions.assertTrue(wqlQuery.getProperties().isEmpty()); + Assertions.assertTrue(wqlQuery.getOriginalProperties().isEmpty()); + Assertions.assertFalse(wqlQuery.hasDuplicateProperties()); + } + { + final WqlQuery wqlQuery = WqlQuery.parseQuery(" select Antecedent, Dependent from IBMTSDS_SHWIDToSPC"); + + Assertions.assertEquals("IBMTSDS_SHWIDToSPC", wqlQuery.getClassName()); + Assertions.assertArrayEquals(new String[] {"Antecedent", "Dependent"}, wqlQuery.getPropertiesArray()); + Assertions.assertEquals(Arrays.asList("Antecedent", "Dependent").stream().collect(Collectors.toCollection(LinkedHashSet::new)), wqlQuery.getProperties()); + Assertions.assertEquals(Arrays.asList("Antecedent", "Dependent"), wqlQuery.getOriginalProperties()); + Assertions.assertFalse(wqlQuery.hasDuplicateProperties()); + } + { + final WqlQuery wqlQuery = WqlQuery.parseQuery(" SELECT __Path, Name, __PATH from EMC_StorageSystem "); + + Assertions.assertEquals("EMC_StorageSystem", wqlQuery.getClassName()); + Assertions.assertArrayEquals(new String[] {"Name"}, wqlQuery.getPropertiesArray()); + Assertions.assertEquals(Arrays.asList("__Path", "Name").stream().collect(Collectors.toCollection(LinkedHashSet::new)), wqlQuery.getProperties()); + Assertions.assertEquals(Arrays.asList("__Path", "Name", "__PATH"), wqlQuery.getOriginalProperties()); + Assertions.assertTrue(wqlQuery.hasDuplicateProperties()); + } + } +} From 173f12331b119a8661698344361c41330517c55c Mon Sep 17 00:00:00 2001 From: Elyes Cherfa Date: Mon, 31 Mar 2025 19:33:31 +0200 Subject: [PATCH 2/6] Issue #35: Rebrand Codebase from Sentry Software to MetricsHub * Reformatted all the classes using prettier. * Added Favicon.ico, css and fonts inside resources directory. --- checkstyle.origin.xml | 222 --- pom.xml | 12 +- .../org/metricshub/wbem/client/Utils.java | 12 +- .../wbem/client/WbemCimDataHandler.java | 59 +- .../metricshub/wbem/client/WbemClient.java | 124 +- .../metricshub/wbem/client/WbemExecutor.java | 110 +- .../wbem/client/WbemQueryResult.java | 5 +- .../org/metricshub/wbem/client/WqlQuery.java | 67 +- .../exceptions/WqlQuerySyntaxException.java | 1 - .../wbem/javax/cim/CIMArgument.java | 9 +- .../metricshub/wbem/javax/cim/CIMClass.java | 159 +- .../wbem/javax/cim/CIMClassProperty.java | 62 +- .../wbem/javax/cim/CIMDataType.java | 264 +-- .../wbem/javax/cim/CIMDateTime.java | 15 +- .../wbem/javax/cim/CIMDateTimeAbsolute.java | 59 +- .../wbem/javax/cim/CIMDateTimeInterval.java | 243 ++- .../metricshub/wbem/javax/cim/CIMElement.java | 18 +- .../metricshub/wbem/javax/cim/CIMFlavor.java | 4 +- .../wbem/javax/cim/CIMInstance.java | 86 +- .../metricshub/wbem/javax/cim/CIMMethod.java | 63 +- .../javax/cim/CIMNamedElementInterface.java | 4 +- .../wbem/javax/cim/CIMObjectPath.java | 152 +- .../wbem/javax/cim/CIMParameter.java | 35 +- .../wbem/javax/cim/CIMProperty.java | 35 +- .../cim/CIMQualifiedElementInterface.java | 16 +- .../wbem/javax/cim/CIMQualifier.java | 19 +- .../wbem/javax/cim/CIMQualifierType.java | 20 +- .../metricshub/wbem/javax/cim/CIMScope.java | 7 +- .../wbem/javax/cim/CIMTypedElement.java | 11 +- .../wbem/javax/cim/CIMValuedElement.java | 25 +- .../wbem/javax/cim/UnsignedInteger16.java | 31 +- .../wbem/javax/cim/UnsignedInteger32.java | 31 +- .../wbem/javax/cim/UnsignedInteger64.java | 35 +- .../wbem/javax/cim/UnsignedInteger8.java | 31 +- .../wbem/javax/wbem/CloseableIterator.java | 6 +- .../wbem/javax/wbem/WBEMException.java | 85 +- .../javax/wbem/client/EnumerateResponse.java | 12 +- .../javax/wbem/client/PasswordCredential.java | 14 +- .../javax/wbem/client/RoleCredential.java | 12 +- .../wbem/javax/wbem/client/RolePrincipal.java | 23 +- .../wbem/javax/wbem/client/UserPrincipal.java | 26 +- .../wbem/javax/wbem/client/WBEMClient.java | 613 ++++--- .../wbem/client/WBEMClientConstants.java | 17 +- .../javax/wbem/client/WBEMClientFactory.java | 23 +- .../wbem/listener/IndicationListener.java | 5 +- .../javax/wbem/listener/WBEMListener.java | 19 +- .../wbem/listener/WBEMListenerConstants.java | 1 - .../wbem/listener/WBEMListenerFactory.java | 29 +- .../sblim/cimclient/CIMXMLTraceListener.java | 6 +- .../wbem/sblim/cimclient/GenericExts.java | 17 +- .../cimclient/IndicationListenerSBLIM.java | 10 +- .../sblim/cimclient/LogAndTraceManager.java | 32 +- .../wbem/sblim/cimclient/LogListener.java | 5 +- .../wbem/sblim/cimclient/TraceListener.java | 8 +- .../wbem/sblim/cimclient/WBEMClientSBLIM.java | 49 +- .../WBEMConfigurationProperties.java | 220 +-- .../sblim/cimclient/WBEMListenerSBLIM.java | 166 +- .../discovery/AdvertisementCatalog.java | 138 +- .../sblim/cimclient/discovery/Discoverer.java | 7 +- .../discovery/DiscovererFactory.java | 15 +- .../cimclient/discovery/WBEMProtocol.java | 23 +- .../discovery/WBEMServiceAdvertisement.java | 29 +- .../internal/cim/CIMElementSorter.java | 17 +- .../cimclient/internal/cim/CIMHelper.java | 138 +- .../internal/cim/CIMInstanceBuilder.java | 37 +- .../internal/cim/CIMOctetString.java | 115 +- .../cim/CIMQualifiedElementInterfaceImpl.java | 63 +- .../cimclient/internal/cim/CIMVersion.java | 15 +- .../internal/cim/DTStringReader.java | 61 +- .../internal/cim/DTStringWriter.java | 14 +- .../cimxml/CIMClientXML_HelperImpl.java | 1248 +++++++------ .../cimclient/internal/cimxml/CIMMessage.java | 34 +- .../cimclient/internal/cimxml/CIMRequest.java | 31 +- .../internal/cimxml/CIMResponse.java | 44 +- .../internal/cimxml/CIMXMLBuilderImpl.java | 569 +++--- .../internal/cimxml/CIMXMLParseException.java | 5 +- .../internal/cimxml/CIMXMLParserImpl.java | 1292 +++++++------ .../internal/cimxml/CimXmlSerializer.java | 53 +- .../internal/cimxml/LocalPathBuilder.java | 94 +- .../cimclient/internal/cimxml/TypedValue.java | 10 +- .../internal/cimxml/sax/CIMObjectFactory.java | 400 +++-- .../internal/cimxml/sax/EmbObjHandler.java | 109 +- .../internal/cimxml/sax/NodeConstIf.java | 531 +++--- .../internal/cimxml/sax/NodeFactory.java | 978 ++++++---- .../internal/cimxml/sax/NodePool.java | 22 +- .../internal/cimxml/sax/SAXHelper.java | 21 +- .../internal/cimxml/sax/SAXSession.java | 11 +- .../cimxml/sax/XMLDefaultHandlerImpl.java | 45 +- .../sax/node/AbstractArrayValueNode.java | 3 +- .../cimxml/sax/node/AbstractMessageNode.java | 5 +- .../sax/node/AbstractMethodCallNode.java | 24 +- .../cimxml/sax/node/AbstractMultiRspNode.java | 7 +- .../cimxml/sax/node/AbstractObjectNode.java | 4 +- .../sax/node/AbstractObjectPathNode.java | 11 +- .../sax/node/AbstractParamValueNode.java | 5 +- .../sax/node/AbstractParameterNode.java | 24 +- .../cimxml/sax/node/AbstractPathNode.java | 3 +- .../cimxml/sax/node/AbstractPropertyNode.java | 48 +- .../cimxml/sax/node/AbstractResponseNode.java | 3 +- .../sax/node/AbstractScalarValueNode.java | 3 +- .../sax/node/AbstractSimpleRspNode.java | 8 +- .../cimxml/sax/node/AbstractValueNode.java | 3 +- .../internal/cimxml/sax/node/ArrayIf.java | 6 +- .../internal/cimxml/sax/node/CIMNode.java | 27 +- .../cimxml/sax/node/ClassNameNode.java | 10 +- .../internal/cimxml/sax/node/ClassNode.java | 47 +- .../cimxml/sax/node/ClassPathNode.java | 34 +- .../cimxml/sax/node/CorrelatorNode.java | 15 +- .../internal/cimxml/sax/node/ErrorIf.java | 4 +- .../internal/cimxml/sax/node/ErrorNode.java | 23 +- .../cimxml/sax/node/ExpMethodCallNode.java | 19 +- .../sax/node/ExpMethodResponseNode.java | 32 +- .../cimxml/sax/node/ExpParamValueNode.java | 18 +- .../internal/cimxml/sax/node/HostNode.java | 9 +- .../cimxml/sax/node/IMethodCallNode.java | 14 +- .../cimxml/sax/node/IMethodResponseNode.java | 64 +- .../cimxml/sax/node/IParamValueNode.java | 45 +- .../cimxml/sax/node/IReturnValueNode.java | 52 +- .../cimxml/sax/node/InstanceNameNode.java | 54 +- .../cimxml/sax/node/InstanceNode.java | 30 +- .../cimxml/sax/node/InstancePathNode.java | 32 +- .../cimxml/sax/node/KeyBindingNode.java | 15 +- .../cimxml/sax/node/KeyValueNode.java | 27 +- .../cimxml/sax/node/LocalClassPathNode.java | 25 +- .../sax/node/LocalInstancePathNode.java | 30 +- .../sax/node/LocalNameSpacePathNode.java | 28 +- .../internal/cimxml/sax/node/MessageNode.java | 32 +- .../cimxml/sax/node/MethodCallNode.java | 14 +- .../internal/cimxml/sax/node/MethodNode.java | 50 +- .../cimxml/sax/node/MethodResponseNode.java | 59 +- .../cimxml/sax/node/MultiExpReqNode.java | 12 +- .../cimxml/sax/node/MultiExpRspNode.java | 14 +- .../cimxml/sax/node/MultiReqNode.java | 14 +- .../cimxml/sax/node/MultiRspNode.java | 13 +- .../cimxml/sax/node/NameSpaceNode.java | 12 +- .../cimxml/sax/node/NameSpacePathNode.java | 25 +- .../internal/cimxml/sax/node/Node.java | 78 +- .../cimxml/sax/node/NonVolatileIf.java | 4 +- .../cimxml/sax/node/ObjectPathIf.java | 3 +- .../cimxml/sax/node/ObjectPathNode.java | 23 +- .../cimxml/sax/node/ParamValueNode.java | 46 +- .../cimxml/sax/node/ParameterArrayNode.java | 9 +- .../cimxml/sax/node/ParameterNode.java | 12 +- .../sax/node/ParameterRefArrayNode.java | 7 +- .../sax/node/ParameterReferenceNode.java | 6 +- .../cimxml/sax/node/PropertyArrayNode.java | 11 +- .../cimxml/sax/node/PropertyNode.java | 11 +- .../sax/node/PropertyReferenceNode.java | 10 +- .../cimxml/sax/node/QualiDeclNode.java | 59 +- .../cimxml/sax/node/QualifiedNodeHandler.java | 28 +- .../cimxml/sax/node/QualifierNode.java | 41 +- .../cimxml/sax/node/RetValPipeIf.java | 6 +- .../cimxml/sax/node/ReturnValueNode.java | 21 +- .../internal/cimxml/sax/node/ScopeNode.java | 13 +- .../cimxml/sax/node/SimpleExpReqNode.java | 15 +- .../cimxml/sax/node/SimpleExpRspNode.java | 18 +- .../cimxml/sax/node/SimpleReqNode.java | 15 +- .../cimxml/sax/node/SimpleRspNode.java | 35 +- .../internal/cimxml/sax/node/TypedIf.java | 3 +- .../cimxml/sax/node/ValueArrayNode.java | 19 +- .../internal/cimxml/sax/node/ValueIf.java | 5 +- .../sax/node/ValueInstanceWithPathNode.java | 32 +- .../sax/node/ValueNamedInstanceNode.java | 34 +- .../internal/cimxml/sax/node/ValueNode.java | 6 +- .../cimxml/sax/node/ValueNullNode.java | 9 +- .../cimxml/sax/node/ValueObjectNode.java | 23 +- .../node/ValueObjectWithLocalPathNode.java | 36 +- .../sax/node/ValueObjectWithPathNode.java | 25 +- .../cimxml/sax/node/ValueRefArrayNode.java | 18 +- .../cimxml/sax/node/ValueReferenceNode.java | 62 +- .../internal/discovery/slp/DiscovererSLP.java | 59 +- .../slp/WBEMServiceAdvertisementSLP.java | 63 +- .../internal/http/AuthorizationHandler.java | 33 +- .../internal/http/AuthorizationInfo.java | 125 +- .../internal/http/BASE64Encoder.java | 78 +- .../cimclient/internal/http/Challenge.java | 60 +- .../cimclient/internal/http/HttpClient.java | 512 +++--- .../internal/http/HttpClientMethod.java | 27 +- .../internal/http/HttpClientPool.java | 92 +- .../internal/http/HttpConnectionHandler.java | 105 +- .../internal/http/HttpContentHandler.java | 13 +- .../internal/http/HttpException.java | 11 +- .../cimclient/internal/http/HttpHeader.java | 92 +- .../internal/http/HttpHeaderParser.java | 45 +- .../cimclient/internal/http/HttpMethod.java | 16 +- .../internal/http/HttpParseException.java | 5 +- .../internal/http/HttpServerConnection.java | 141 +- .../internal/http/HttpServerMethod.java | 21 +- .../internal/http/HttpServerWorker.java | 6 +- .../internal/http/HttpSocketFactory.java | 111 +- .../internal/http/HttpUrlConnection.java | 25 +- .../internal/http/MessageReader.java | 33 +- .../internal/http/MessageWriter.java | 54 +- .../internal/http/PegasusLocalAuthInfo.java | 36 +- .../cimclient/internal/http/WwwAuthInfo.java | 100 +- .../internal/http/io/ASCIIPrintStream.java | 52 +- .../internal/http/io/BoundedInputStream.java | 11 +- .../internal/http/io/ChunkedInputStream.java | 38 +- .../internal/http/io/ChunkedOutputStream.java | 9 +- .../internal/http/io/DebugInputStream.java | 22 +- .../http/io/KeepAliveInputStream.java | 6 +- .../http/io/PersistentInputStream.java | 7 +- .../http/io/PersistentOutputStream.java | 5 +- .../internal/http/io/TrailerException.java | 17 +- .../internal/logging/LogAndTraceBroker.java | 382 ++-- .../internal/logging/LogFormatter.java | 5 +- .../internal/logging/MessageLoader.java | 17 +- .../cimclient/internal/logging/Messages.java | 3 +- .../cimclient/internal/logging/TimeStamp.java | 14 +- .../internal/logging/TraceFormatter.java | 5 +- .../internal/pullparser/XMLPullParser.java | 363 ++-- .../pullparser/XMLPullParserException.java | 7 +- .../cimclient/internal/uri/Authority.java | 130 +- .../cimclient/internal/uri/BooleanValue.java | 15 +- .../cimclient/internal/uri/CharValue.java | 15 +- .../cimclient/internal/uri/DateTimeValue.java | 25 +- .../cimclient/internal/uri/IntegerValue.java | 50 +- .../cimclient/internal/uri/KeyValuePair.java | 16 +- .../cimclient/internal/uri/KeyValuePairs.java | 10 +- .../internal/uri/NamespaceHandle.java | 25 +- .../cimclient/internal/uri/NamespacePath.java | 22 +- .../cimclient/internal/uri/QuotedValue.java | 4 +- .../cimclient/internal/uri/RealValue.java | 26 +- .../internal/uri/ReferenceValue.java | 6 +- .../cimclient/internal/uri/StringValue.java | 4 +- .../sblim/cimclient/internal/uri/Test.java | 189 +- .../sblim/cimclient/internal/uri/URI.java | 83 +- .../cimclient/internal/uri/URIString.java | 71 +- .../sblim/cimclient/internal/uri/Value.java | 45 +- .../sblim/cimclient/internal/util/MOF.java | 155 +- .../cimclient/internal/util/StringSorter.java | 6 +- .../cimclient/internal/util/ThreadPool.java | 48 +- .../sblim/cimclient/internal/util/Util.java | 18 +- .../internal/util/WBEMConfiguration.java | 619 ++++--- .../util/WBEMConfigurationDefaults.java | 11 +- .../internal/util/WBEMConstants.java | 4 +- .../cimclient/internal/util/XMLHostStr.java | 20 +- .../cimclient/internal/wbem/CIMError.java | 40 +- .../internal/wbem/CloseableIteratorDOM.java | 19 +- .../wbem/CloseableIteratorGeneric.java | 12 +- .../internal/wbem/CloseableIteratorPULL.java | 31 +- .../internal/wbem/CloseableIteratorSAX.java | 34 +- .../internal/wbem/EnumerateResponseDOM.java | 53 +- .../internal/wbem/EnumerateResponsePULL.java | 58 +- .../internal/wbem/EnumerateResponseSAX.java | 52 +- .../internal/wbem/WBEMClientCIMXML.java | 1595 +++++++++-------- .../internal/wbem/indications/CIMEvent.java | 16 +- .../wbem/indications/CIMEventDispatcher.java | 70 +- .../indications/CIMIndicationHandler.java | 266 +-- .../ReliableIndicationHandler.java | 113 +- .../wbem/operations/CIMAssociatorNamesOp.java | 24 +- .../wbem/operations/CIMAssociatorsOp.java | 34 +- .../wbem/operations/CIMCreateClassOp.java | 7 +- .../wbem/operations/CIMCreateInstanceOp.java | 8 +- .../wbem/operations/CIMCreateNameSpaceOp.java | 4 +- .../operations/CIMCreateQualifierTypeOp.java | 8 +- .../wbem/operations/CIMDeleteClassOp.java | 4 +- .../wbem/operations/CIMDeleteInstanceOp.java | 4 +- .../wbem/operations/CIMDeleteNameSpaceOp.java | 5 +- .../operations/CIMDeleteQualifierTypeOp.java | 4 +- .../wbem/operations/CIMEnumClassNamesOp.java | 8 +- .../wbem/operations/CIMEnumClassesOp.java | 23 +- .../operations/CIMEnumInstanceNamesOp.java | 4 +- .../wbem/operations/CIMEnumInstancesOp.java | 26 +- .../wbem/operations/CIMEnumNameSpaceOp.java | 4 +- .../operations/CIMEnumQualifierTypesOp.java | 4 +- .../wbem/operations/CIMExecQueryOp.java | 10 +- .../wbem/operations/CIMGetClassOp.java | 24 +- .../wbem/operations/CIMGetInstanceOp.java | 23 +- .../wbem/operations/CIMGetPropertyOp.java | 8 +- .../operations/CIMGetQualifierTypeOp.java | 8 +- .../wbem/operations/CIMInvokeMethodOp.java | 20 +- .../wbem/operations/CIMOperation.java | 17 +- .../wbem/operations/CIMReferenceNamesOp.java | 10 +- .../wbem/operations/CIMReferencesOp.java | 26 +- .../wbem/operations/CIMSetClassOp.java | 8 +- .../wbem/operations/CIMSetInstanceOp.java | 20 +- .../wbem/operations/CIMSetPropertyOp.java | 10 +- .../operations/CIMSetQualifierTypeOp.java | 8 +- .../operations/CIMSingleResultOperation.java | 12 +- .../metricshub/wbem/sblim/slp/Advertiser.java | 18 +- .../metricshub/wbem/sblim/slp/Locator.java | 95 +- .../wbem/sblim/slp/SLPConfigProperties.java | 10 +- .../sblim/slp/ServiceLocationAttribute.java | 85 +- .../ServiceLocationAttributeDescriptor.java | 24 +- .../slp/ServiceLocationAttributeVerifier.java | 32 +- .../sblim/slp/ServiceLocationEnumeration.java | 9 +- .../sblim/slp/ServiceLocationException.java | 52 +- .../sblim/slp/ServiceLocationManager.java | 16 +- .../wbem/sblim/slp/ServiceType.java | 60 +- .../metricshub/wbem/sblim/slp/ServiceURL.java | 63 +- .../wbem/sblim/slp/TemplateRegistry.java | 27 +- .../sblim/slp/internal/AdvertiserImpl.java | 67 +- .../sblim/slp/internal/AttributeHandler.java | 18 +- .../wbem/sblim/slp/internal/Convert.java | 30 +- .../internal/IPv6MulticastAddressFactory.java | 35 +- .../wbem/sblim/slp/internal/Net.java | 10 +- .../wbem/sblim/slp/internal/SLPConfig.java | 167 +- .../wbem/sblim/slp/internal/SLPDefaults.java | 16 +- .../wbem/sblim/slp/internal/SLPLimits.java | 4 +- .../wbem/sblim/slp/internal/SLPString.java | 15 +- .../wbem/sblim/slp/internal/TRC.java | 73 +- .../slp/internal/msg/AttributeReply.java | 28 +- .../slp/internal/msg/AttributeRequest.java | 67 +- .../wbem/sblim/slp/internal/msg/DAAdvert.java | 83 +- .../sblim/slp/internal/msg/DADescriptor.java | 23 +- .../sblim/slp/internal/msg/FunctionIDs.java | 2 - .../sblim/slp/internal/msg/MsgFactory.java | 188 +- .../sblim/slp/internal/msg/MsgHeader.java | 76 +- .../sblim/slp/internal/msg/ReplyMessage.java | 16 +- .../slp/internal/msg/RequestMessage.java | 61 +- .../wbem/sblim/slp/internal/msg/SAAdvert.java | 45 +- .../slp/internal/msg/SLPInputStream.java | 121 +- .../sblim/slp/internal/msg/SLPMessage.java | 59 +- .../slp/internal/msg/SLPOutputStream.java | 73 +- .../slp/internal/msg/SerializeOption.java | 3 +- .../internal/msg/ServiceAcknowledgment.java | 15 +- .../internal/msg/ServiceDeregistration.java | 34 +- .../slp/internal/msg/ServiceRegistration.java | 78 +- .../sblim/slp/internal/msg/ServiceReply.java | 32 +- .../slp/internal/msg/ServiceRequest.java | 67 +- .../slp/internal/msg/ServiceTypeReply.java | 18 +- .../slp/internal/msg/ServiceTypeRequest.java | 43 +- .../wbem/sblim/slp/internal/msg/Util.java | 5 +- .../sblim/slp/internal/sa/DatagramThread.java | 11 +- .../sblim/slp/internal/sa/MessageTable.java | 43 +- .../sblim/slp/internal/sa/RecieverThread.java | 11 +- .../sblim/slp/internal/sa/ServiceAgent.java | 50 +- .../sblim/slp/internal/sa/ServiceTable.java | 87 +- .../wbem/sblim/slp/internal/sa/TCPThread.java | 11 +- .../wbem/sblim/slp/internal/ua/DACache.java | 15 +- .../slp/internal/ua/DatagramRequester.java | 78 +- .../sblim/slp/internal/ua/LocatorImpl.java | 98 +- .../sblim/slp/internal/ua/ResponseCache.java | 13 +- .../sblim/slp/internal/ua/ResultTable.java | 30 +- .../slp/internal/ua/SLEnumerationImpl.java | 28 +- .../sblim/slp/internal/ua/TCPRequester.java | 22 +- src/site/markdown/index.md | 14 +- src/site/resources/css/site.css | 86 + src/site/resources/favicon.ico | Bin 0 -> 15406 bytes src/site/resources/fonts/Poppins-Bold.ttf | Bin 0 -> 153944 bytes src/site/resources/fonts/Poppins-Bold.woff | Bin 0 -> 72548 bytes src/site/resources/fonts/Poppins-Bold.woff2 | Bin 0 -> 50576 bytes .../resources/fonts/Poppins-ExtraBold.ttf | Bin 0 -> 152764 bytes .../resources/fonts/Poppins-ExtraBold.woff | Bin 0 -> 72388 bytes .../resources/fonts/Poppins-ExtraBold.woff2 | Bin 0 -> 50492 bytes src/site/resources/fonts/Poppins-Regular.ttf | Bin 0 -> 158240 bytes .../resources/fonts/Poppins-Regular.woff2 | Bin 0 -> 51148 bytes src/site/site.xml | 3 +- .../wbem/WbemCimDataHandlerTest.java | 386 +++- .../org/metricshub/wbem/WbemClientTest.java | 163 +- .../org/metricshub/wbem/WbemExecutorTest.java | 47 +- .../org/metricshub/wbem/WqlQueryTest.java | 15 +- 353 files changed, 11697 insertions(+), 10166 deletions(-) delete mode 100644 checkstyle.origin.xml create mode 100644 src/site/resources/css/site.css create mode 100644 src/site/resources/favicon.ico create mode 100644 src/site/resources/fonts/Poppins-Bold.ttf create mode 100644 src/site/resources/fonts/Poppins-Bold.woff create mode 100644 src/site/resources/fonts/Poppins-Bold.woff2 create mode 100644 src/site/resources/fonts/Poppins-ExtraBold.ttf create mode 100644 src/site/resources/fonts/Poppins-ExtraBold.woff create mode 100644 src/site/resources/fonts/Poppins-ExtraBold.woff2 create mode 100644 src/site/resources/fonts/Poppins-Regular.ttf create mode 100644 src/site/resources/fonts/Poppins-Regular.woff2 diff --git a/checkstyle.origin.xml b/checkstyle.origin.xml deleted file mode 100644 index 2098fe6..0000000 --- a/checkstyle.origin.xml +++ /dev/null @@ -1,222 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pom.xml b/pom.xml index 1108870..b80fce4 100644 --- a/pom.xml +++ b/pom.xml @@ -16,7 +16,7 @@ MetricsHub - https://metricshub.com + https://metricshub.org https://metricshub.org/wbem @@ -32,11 +32,11 @@ GitHub - https://github.com/MetricsHub/wbem-java/issues/ + https://github.com/metricshub/wbem-java/issues/ - scm:git:https://github.com/MetricsHub/wbem-java.git + scm:git:https://github.com/metricshub/wbem-java.git https://github.com/metricshub/wbem-java HEAD @@ -44,21 +44,21 @@ Bertrand Martin (@bertysentry) - bertrand@metricshub.com + bertrand@sentrysoftware.com maintainer Nassim BOUTEKEDJIRET (@NassimBtk) - nassim@metricshub.com + nassim@sentrysoftware.com maintainer Elyes Cherfa (@CherfaElyes) - elyes@metricshub.com + elyes@sentrysoftware.com maintainer diff --git a/src/main/java/org/metricshub/wbem/client/Utils.java b/src/main/java/org/metricshub/wbem/client/Utils.java index 835e14f..7d1e072 100644 --- a/src/main/java/org/metricshub/wbem/client/Utils.java +++ b/src/main/java/org/metricshub/wbem/client/Utils.java @@ -62,18 +62,18 @@ public static void checkNonNull(final T argument, final String name) { *
    • group(2): optional fraction of seconds *
    • group(3): timezone offset... in minutes (sigh) */ - private static final Pattern CIM_DATETIME_PATTERN = Pattern - .compile("^([0-9]{14})(?:\\.([0-9]{3,6}))?([+-][0-9]{3})$"); + private static final Pattern CIM_DATETIME_PATTERN = Pattern.compile( + "^([0-9]{14})(?:\\.([0-9]{3,6}))?([+-][0-9]{3})$" + ); /** * Convert a String holding a CIM_DATETIME (i.e. a string in the form of * yyyymmddHHMMSS.mmmmmmsUUU) to an OffsetDateTime object - * + * * @param stringValue String value with a CIM_DATETIME * @return OffsetDateTime instance */ public static OffsetDateTime convertCimDateTime(final String stringValue) { - if (stringValue == null) { return null; } @@ -92,13 +92,11 @@ public static OffsetDateTime convertCimDateTime(final String stringValue) { // Zone Offset final String zoneOffset = dateTimeMatcher.group(3); if (zoneOffset == null) { - throw new IllegalStateException( - "Unable to get the timezone offset from CIM_DATETIME value: " + stringValue); + throw new IllegalStateException("Unable to get the timezone offset from CIM_DATETIME value: " + stringValue); } final int secondsOffset = Integer.parseInt(zoneOffset) * 60; final ZoneOffset offset = ZoneOffset.ofTotalSeconds(secondsOffset); return OffsetDateTime.of(localDateTime, offset); } - } diff --git a/src/main/java/org/metricshub/wbem/client/WbemCimDataHandler.java b/src/main/java/org/metricshub/wbem/client/WbemCimDataHandler.java index 538e136..2495289 100644 --- a/src/main/java/org/metricshub/wbem/client/WbemCimDataHandler.java +++ b/src/main/java/org/metricshub/wbem/client/WbemCimDataHandler.java @@ -27,7 +27,6 @@ import java.util.function.Function; import java.util.stream.Collectors; import java.util.stream.Stream; - import org.metricshub.wbem.javax.cim.CIMDataType; import org.metricshub.wbem.javax.cim.CIMDateTimeAbsolute; import org.metricshub.wbem.javax.cim.CIMDateTimeInterval; @@ -41,11 +40,12 @@ */ public class WbemCimDataHandler { - private WbemCimDataHandler() { } + private WbemCimDataHandler() {} public static final String PATH_PROPERTY = "__Path"; private static final Map> CONVERT_MAP; + static { final Map> map = new HashMap<>(); map.put(CIMDataType.STRING, String::valueOf); @@ -76,9 +76,10 @@ private WbemCimDataHandler() { } * @return */ public static String getCimPropertyAsString( - final String property, - final CIMInstance cimInstance, - final String arraySeparator) { + final String property, + final CIMInstance cimInstance, + final String arraySeparator + ) { Utils.checkNonNull(property, "property"); Utils.checkNonNull(cimInstance, "cimInstance"); @@ -92,17 +93,17 @@ public static String getCimPropertyAsString( CIMProperty cimProperty = cimInstance.getProperty(property); // then, if null, check getKeys - final String separator = arraySeparator == null? Utils.DEFAULT_ARRAY_SEPARATOR : arraySeparator; + final String separator = arraySeparator == null ? Utils.DEFAULT_ARRAY_SEPARATOR : arraySeparator; if (cimProperty == null && cimInstance.getKeys() != null) { - return Stream.of(cimInstance.getKeys()) - .filter(key -> key.getName() != null && key.getName().equalsIgnoreCase(property)) - .findFirst() - .map(cp -> convertCimPropertyValue(cp, separator)) - .orElse(Utils.EMPTY); + return Stream + .of(cimInstance.getKeys()) + .filter(key -> key.getName() != null && key.getName().equalsIgnoreCase(property)) + .findFirst() + .map(cp -> convertCimPropertyValue(cp, separator)) + .orElse(Utils.EMPTY); } - return cimProperty == null ? - Utils.EMPTY : convertCimPropertyValue(cimProperty, separator); + return cimProperty == null ? Utils.EMPTY : convertCimPropertyValue(cimProperty, separator); } /** @@ -112,9 +113,7 @@ public static String getCimPropertyAsString( * @param arraySeparator The array separator value. * @return */ - private static String convertCimPropertyValue( - final CIMProperty cimProperty, - final String arraySeparator) { + private static String convertCimPropertyValue(final CIMProperty cimProperty, final String arraySeparator) { final Object cimPropertyValue = cimProperty.getValue(); if (cimPropertyValue == null) { return Utils.EMPTY; @@ -125,9 +124,9 @@ private static String convertCimPropertyValue( return cimPropertyValue.toString(); } - return dataType.isArray() ? - convertArray(cimProperty, arraySeparator) : - CONVERT_MAP.getOrDefault(dataType.getType(), Object::toString).apply(cimPropertyValue); + return dataType.isArray() + ? convertArray(cimProperty, arraySeparator) + : CONVERT_MAP.getOrDefault(dataType.getType(), Object::toString).apply(cimPropertyValue); } /** @@ -137,12 +136,16 @@ private static String convertCimPropertyValue( * @param arraySeparator The array separator value. * @return */ - private static String convertArray( - final CIMProperty cimProperty, - final String arraySeparator) { - return Arrays.stream((Object[]) cimProperty.getValue()) - .map(obj -> (obj == null) ? Utils.EMPTY : CONVERT_MAP.getOrDefault(cimProperty.getDataType().getType(), Object::toString).apply(obj)) - .collect(Collectors.joining(arraySeparator, Utils.EMPTY, arraySeparator)); + private static String convertArray(final CIMProperty cimProperty, final String arraySeparator) { + return Arrays + .stream((Object[]) cimProperty.getValue()) + .map( + obj -> + (obj == null) + ? Utils.EMPTY + : CONVERT_MAP.getOrDefault(cimProperty.getDataType().getType(), Object::toString).apply(obj) + ) + .collect(Collectors.joining(arraySeparator, Utils.EMPTY, arraySeparator)); } /** @@ -158,9 +161,9 @@ private static String convertReference(final Object cimPropertyValue) { final CIMObjectPath objectPath = (CIMObjectPath) cimPropertyValue; final String str = objectPath.toString(); return str - .substring(str.indexOf(':') + 1) // take the part after : (if exists) - .replace("\\\\", "\\") // Replace \\ by \ - .replace("\\\"", "\""); // Replace \" by " + .substring(str.indexOf(':') + 1) // take the part after : (if exists) + .replace("\\\\", "\\") // Replace \\ by \ + .replace("\\\"", "\""); // Replace \" by " } /** diff --git a/src/main/java/org/metricshub/wbem/client/WbemClient.java b/src/main/java/org/metricshub/wbem/client/WbemClient.java index 1ed9248..421c451 100644 --- a/src/main/java/org/metricshub/wbem/client/WbemClient.java +++ b/src/main/java/org/metricshub/wbem/client/WbemClient.java @@ -29,11 +29,10 @@ import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; - import javax.security.auth.Subject; - import org.metricshub.wbem.javax.cim.CIMInstance; import org.metricshub.wbem.javax.cim.CIMObjectPath; +import org.metricshub.wbem.javax.cim.CIMProperty; import org.metricshub.wbem.javax.wbem.CloseableIterator; import org.metricshub.wbem.javax.wbem.WBEMException; import org.metricshub.wbem.javax.wbem.client.EnumerateResponse; @@ -42,15 +41,13 @@ import org.metricshub.wbem.javax.wbem.client.WBEMClient; import org.metricshub.wbem.javax.wbem.client.WBEMClientConstants; import org.metricshub.wbem.javax.wbem.client.WBEMClientFactory; -import org.metricshub.wbem.javax.cim.CIMProperty; /** * Matsya WBEM client for query execution. * */ public class WbemClient implements AutoCloseable { - - private static final Locale[] FIXED_AVAILABLE_LOCALES_ARRAY = {Locale.ENGLISH}; + private static final Locale[] FIXED_AVAILABLE_LOCALES_ARRAY = { Locale.ENGLISH }; private WBEMClient client; @@ -65,23 +62,19 @@ public class WbemClient implements AutoCloseable { * @param timeout * @throws WBEMException */ - public void connect( - final URL url, - final String username, - final char[] password, - int timeout) throws WBEMException { - + public void connect(final URL url, final String username, final char[] password, int timeout) throws WBEMException { Utils.checkNonNull(url, "url"); Utils.checkNonNull(username, "username"); Utils.checkNonNull(password, "password"); final CIMObjectPath cimObjectPath = new CIMObjectPath( - url.getProtocol(), - url.getHost(), - String.valueOf(url.getPort()), - null, - null, - null); + url.getProtocol(), + url.getHost(), + String.valueOf(url.getPort()), + null, + null, + null + ); final Subject subject = new Subject(); subject.getPrincipals().add(new UserPrincipal(username)); @@ -112,11 +105,8 @@ public void close() { * @return * @throws WBEMException */ - public WbemQueryResult executeWql( - final WqlQuery wqlQuery, - final String namespace, - final String arraySeparator) throws WBEMException { - + public WbemQueryResult executeWql(final WqlQuery wqlQuery, final String namespace, final String arraySeparator) + throws WBEMException { Utils.checkNonNull(wqlQuery, "wqlQuery"); Utils.checkNonNull(namespace, "namespace"); @@ -124,12 +114,14 @@ public WbemQueryResult executeWql( throw new IllegalStateException("client must be connected first."); } - iterator = client.enumerateInstances( + iterator = + client.enumerateInstances( new CIMObjectPath(null, null, null, namespace, wqlQuery.getClassName(), null), true, false, true, - wqlQuery.getPropertiesArray()); + wqlQuery.getPropertiesArray() + ); return enumerateInstances(wqlQuery, iterator, arraySeparator); } @@ -143,10 +135,11 @@ public WbemQueryResult executeWql( * @throws WBEMException */ public WbemQueryResult getAssociators( - final WqlQuery wqlQuery, - final String objectPathAssociators, - final String arraySeparator) throws WBEMException { - + final WqlQuery wqlQuery, + final String objectPathAssociators, + final String arraySeparator + ) + throws WBEMException { Utils.checkNonNull(wqlQuery, "wqlQuery"); Utils.checkNonNull(objectPathAssociators, "objectPathAssociators"); @@ -155,28 +148,30 @@ public WbemQueryResult getAssociators( } final EnumerateResponse response = client.associators( - new CIMObjectPath(objectPathAssociators), - wqlQuery.getClassName(), - null, - null, - null, - false, - wqlQuery.getPropertiesArray(), - null, - null, - null, - false, - null); + new CIMObjectPath(objectPathAssociators), + wqlQuery.getClassName(), + null, + null, + null, + false, + wqlQuery.getPropertiesArray(), + null, + null, + null, + false, + null + ); iterator = response.getResponses(); return enumerateInstances(wqlQuery, iterator, arraySeparator); } public static WbemQueryResult enumerateInstances( - final WqlQuery wqlQuery, - final CloseableIterator iterator, - final String arraySeparator) { - if (iterator == null) { + final WqlQuery wqlQuery, + final CloseableIterator iterator, + final String arraySeparator + ) { + if (iterator == null) { return new WbemQueryResult(new ArrayList<>(), new ArrayList<>()); } @@ -189,32 +184,41 @@ public static WbemQueryResult enumerateInstances( if (properties == null) { properties = - wqlQuery.getProperties().isEmpty() ? - Stream.of(cimInstance.getProperties()) - .map(CIMProperty::getName) - .collect(Collectors.toCollection(LinkedHashSet::new)) : - wqlQuery.getProperties(); + wqlQuery.getProperties().isEmpty() + ? Stream + .of(cimInstance.getProperties()) + .map(CIMProperty::getName) + .collect(Collectors.toCollection(LinkedHashSet::new)) + : wqlQuery.getProperties(); } if (originalProperties == null) { - originalProperties = wqlQuery.hasDuplicateProperties() ? - wqlQuery.getOriginalProperties() : - properties.stream().collect(Collectors.toList()); + originalProperties = + wqlQuery.hasDuplicateProperties() + ? wqlQuery.getOriginalProperties() + : properties.stream().collect(Collectors.toList()); } final List row; if (wqlQuery.hasDuplicateProperties()) { - - final Map cimProperties = properties.stream().collect(Collectors.toMap( - String::toLowerCase, - property -> WbemCimDataHandler.getCimPropertyAsString(property, cimInstance, arraySeparator))); - - row = originalProperties.stream() + final Map cimProperties = properties + .stream() + .collect( + Collectors.toMap( + String::toLowerCase, + property -> WbemCimDataHandler.getCimPropertyAsString(property, cimInstance, arraySeparator) + ) + ); + + row = + originalProperties + .stream() .map(property -> cimProperties.get(property.toLowerCase())) .collect(Collectors.toList()); - } else { - row = properties.stream() + row = + properties + .stream() .map(property -> WbemCimDataHandler.getCimPropertyAsString(property, cimInstance, arraySeparator)) .collect(Collectors.toList()); } diff --git a/src/main/java/org/metricshub/wbem/client/WbemExecutor.java b/src/main/java/org/metricshub/wbem/client/WbemExecutor.java index 08014b8..ab15c5c 100644 --- a/src/main/java/org/metricshub/wbem/client/WbemExecutor.java +++ b/src/main/java/org/metricshub/wbem/client/WbemExecutor.java @@ -27,7 +27,6 @@ import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; - import org.metricshub.wbem.client.exceptions.WqlQuerySyntaxException; import org.metricshub.wbem.javax.wbem.WBEMException; @@ -37,7 +36,7 @@ */ public class WbemExecutor { - private WbemExecutor() { } + private WbemExecutor() {} /** * Execute a WBEM query on remote. @@ -56,26 +55,16 @@ private WbemExecutor() { } * @throws InterruptedException */ public static WbemQueryResult executeWql( - final URL url, - final String namespace, - final String username, - final char[] password, - final String query, - int timeout, - final String arraySeparator) - throws WqlQuerySyntaxException, - WBEMException, - TimeoutException, - InterruptedException { - return executeMethod( - url, - namespace, - username, - password, - query, - null, - timeout, - arraySeparator); + final URL url, + final String namespace, + final String username, + final char[] password, + final String query, + int timeout, + final String arraySeparator + ) + throws WqlQuerySyntaxException, WBEMException, TimeoutException, InterruptedException { + return executeMethod(url, namespace, username, password, query, null, timeout, arraySeparator); } /** @@ -95,26 +84,16 @@ public static WbemQueryResult executeWql( * @throws InterruptedException */ public static WbemQueryResult getAssociators( - final URL url, - final String username, - final char[] password, - final String query, - final String objectPathAssociators, - int timeout, - final String arraySeparator) - throws WqlQuerySyntaxException, - WBEMException, - TimeoutException, - InterruptedException { - return executeMethod( - url, - null, - username, - password, - query, - objectPathAssociators, - timeout, - arraySeparator); + final URL url, + final String username, + final char[] password, + final String query, + final String objectPathAssociators, + int timeout, + final String arraySeparator + ) + throws WqlQuerySyntaxException, WBEMException, TimeoutException, InterruptedException { + return executeMethod(url, null, username, password, query, objectPathAssociators, timeout, arraySeparator); } /** @@ -135,19 +114,16 @@ public static WbemQueryResult getAssociators( * @throws WqlQuerySyntaxException */ private static WbemQueryResult executeMethod( - final URL url, - final String namespace, - final String username, - final char[] password, - final String query, - final String objectPathAssociators, - int timeout, - final String arraySeparator) - throws InterruptedException, - TimeoutException, - WBEMException, - WqlQuerySyntaxException { - + final URL url, + final String namespace, + final String username, + final char[] password, + final String query, + final String objectPathAssociators, + int timeout, + final String arraySeparator + ) + throws InterruptedException, TimeoutException, WBEMException, WqlQuerySyntaxException { Utils.checkNonNull(url, "url"); Utils.checkNonNull(username, "username"); Utils.checkNonNull(password, "password"); @@ -156,36 +132,34 @@ private static WbemQueryResult executeMethod( final ExecutorService executor = Executors.newSingleThreadExecutor(); - final Future future = executor.submit(() -> { - try (final WbemClient matsyaWbemClient = new WbemClient()) { - matsyaWbemClient.connect(url, username, password, timeout); + final Future future = executor.submit( + () -> { + try (final WbemClient matsyaWbemClient = new WbemClient()) { + matsyaWbemClient.connect(url, username, password, timeout); - return objectPathAssociators == null ? - matsyaWbemClient.executeWql(wqlQuery, namespace, arraySeparator) : - matsyaWbemClient.getAssociators(wqlQuery, objectPathAssociators, arraySeparator); + return objectPathAssociators == null + ? matsyaWbemClient.executeWql(wqlQuery, namespace, arraySeparator) + : matsyaWbemClient.getAssociators(wqlQuery, objectPathAssociators, arraySeparator); + } } - }); + ); try { return future.get(timeout, TimeUnit.MILLISECONDS); - } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw (InterruptedException) e; - } catch (TimeoutException e) { future.cancel(true); throw e; - - } catch (ExecutionException e) { + } catch (ExecutionException e) { if (e.getCause() instanceof WBEMException) { throw (WBEMException) e.getCause(); } // else should be RunTimeException as matsyaWbemClient only thrown // WBEMException as checked exceptions. throw (RuntimeException) e.getCause(); - } - finally { + } finally { executor.shutdownNow(); } } diff --git a/src/main/java/org/metricshub/wbem/client/WbemQueryResult.java b/src/main/java/org/metricshub/wbem/client/WbemQueryResult.java index c402f41..04e8eb4 100644 --- a/src/main/java/org/metricshub/wbem/client/WbemQueryResult.java +++ b/src/main/java/org/metricshub/wbem/client/WbemQueryResult.java @@ -27,16 +27,13 @@ * */ public class WbemQueryResult { - /** List of the properties of the query. */ private final List properties; /** Query results. */ private final List> values; - public WbemQueryResult( - final List properties, - final List> values) { + public WbemQueryResult(final List properties, final List> values) { this.properties = properties; this.values = values; } diff --git a/src/main/java/org/metricshub/wbem/client/WqlQuery.java b/src/main/java/org/metricshub/wbem/client/WqlQuery.java index 489326a..18e4f02 100644 --- a/src/main/java/org/metricshub/wbem/client/WqlQuery.java +++ b/src/main/java/org/metricshub/wbem/client/WqlQuery.java @@ -30,7 +30,6 @@ import java.util.regex.Pattern; import java.util.stream.Collectors; import java.util.stream.Stream; - import org.metricshub.wbem.client.exceptions.WqlQuerySyntaxException; /** @@ -39,18 +38,20 @@ */ public class WqlQuery { - private WqlQuery() { } + private WqlQuery() {} private static final String ID = "[^\\s]+"; private static final String LIST_SEPARATOR = "\\s*,\\s*"; private static final Pattern CHECK_SELECT_PATTERN = Pattern.compile( - "^\\s*SELECT\\s+(\\*|(?!SELECT|FROM|WHERE)\\w+|((?!SELECT|FROM|WHERE)\\w+\\s*,\\s*)+((?!SELECT|FROM|WHERE)\\w+))\\s+FROM\\s+((?!SELECT|WHERE|FROM)\\w+)\\s*?$", - Pattern.CASE_INSENSITIVE); - - private static final Pattern EXTRACT_SELECT_PATTERN= Pattern.compile( - "^\\s*SELECT\\s+(.+)\\s+FROM\\s+("+ID+")\\s*$", - Pattern.CASE_INSENSITIVE); + "^\\s*SELECT\\s+(\\*|(?!SELECT|FROM|WHERE)\\w+|((?!SELECT|FROM|WHERE)\\w+\\s*,\\s*)+((?!SELECT|FROM|WHERE)\\w+))\\s+FROM\\s+((?!SELECT|WHERE|FROM)\\w+)\\s*?$", + Pattern.CASE_INSENSITIVE + ); + + private static final Pattern EXTRACT_SELECT_PATTERN = Pattern.compile( + "^\\s*SELECT\\s+(.+)\\s+FROM\\s+(" + ID + ")\\s*$", + Pattern.CASE_INSENSITIVE + ); private static final int SELECT_GROUP_CLASSNAME = 2; private static final int SELECT_GROUP_FIELDS = 1; private static final int SELECT_GROUP_COUNT = 2; @@ -66,7 +67,6 @@ private WqlQuery() { } * @throws WqlQuerySyntaxException On WQL Syntax exception. */ public static WqlQuery parseQuery(final String query) throws WqlQuerySyntaxException { - Utils.checkNonNull(query, "query"); if (CHECK_SELECT_PATTERN.matcher(query).find()) { @@ -82,11 +82,12 @@ public String getClassName() { } public String[] getPropertiesArray() { - return properties.isEmpty() ? - null : - properties.stream() - .filter(property -> !WbemCimDataHandler.PATH_PROPERTY.equalsIgnoreCase(property)) - .toArray(String[]::new); + return properties.isEmpty() + ? null + : properties + .stream() + .filter(property -> !WbemCimDataHandler.PATH_PROPERTY.equalsIgnoreCase(property)) + .toArray(String[]::new); } public Set getProperties() { @@ -101,35 +102,35 @@ public boolean hasDuplicateProperties() { return properties != null && originalProperties != null && properties.size() != originalProperties.size(); } - private void parseSelect( - final String query) throws WqlQuerySyntaxException { - + private void parseSelect(final String query) throws WqlQuerySyntaxException { final Matcher matcher = EXTRACT_SELECT_PATTERN.matcher(query); if (!matcher.find()) { throw new WqlQuerySyntaxException(query); } - if (matcher.groupCount() < SELECT_GROUP_COUNT) { - throw new WqlQuerySyntaxException(query); + if (matcher.groupCount() < SELECT_GROUP_COUNT) { + throw new WqlQuerySyntaxException(query); } - className = matcher.group(SELECT_GROUP_CLASSNAME); + className = matcher.group(SELECT_GROUP_CLASSNAME); - final String fieldsList = matcher.group(SELECT_GROUP_FIELDS); - final String[] fieldArray = Optional.ofNullable(fieldsList) - .filter(s -> !"*".equals(s)) - .map(s -> s.split(LIST_SEPARATOR)) - .orElse(new String[0]); + final String fieldsList = matcher.group(SELECT_GROUP_FIELDS); + final String[] fieldArray = Optional + .ofNullable(fieldsList) + .filter(s -> !"*".equals(s)) + .map(s -> s.split(LIST_SEPARATOR)) + .orElse(new String[0]); - originalProperties = Stream.of(fieldArray) - .map(String::trim) - .collect(Collectors.toList()); + originalProperties = Stream.of(fieldArray).map(String::trim).collect(Collectors.toList()); - // using a map, so the properties will keep the case and the order of the query. - final Map originalMap = new HashMap<>(); - originalProperties.stream().forEach( - property -> originalMap.computeIfAbsent(property.toLowerCase(), prop -> property)); + // using a map, so the properties will keep the case and the order of the query. + final Map originalMap = new HashMap<>(); + originalProperties + .stream() + .forEach(property -> originalMap.computeIfAbsent(property.toLowerCase(), prop -> property)); - properties = originalProperties.stream() + properties = + originalProperties + .stream() .map(property -> originalMap.get(property.toLowerCase())) .collect(Collectors.toCollection(LinkedHashSet::new)); } diff --git a/src/main/java/org/metricshub/wbem/client/exceptions/WqlQuerySyntaxException.java b/src/main/java/org/metricshub/wbem/client/exceptions/WqlQuerySyntaxException.java index 08c7189..a54c3ed 100644 --- a/src/main/java/org/metricshub/wbem/client/exceptions/WqlQuerySyntaxException.java +++ b/src/main/java/org/metricshub/wbem/client/exceptions/WqlQuerySyntaxException.java @@ -25,7 +25,6 @@ * */ public class WqlQuerySyntaxException extends Exception { - private static final long serialVersionUID = 1L; public WqlQuerySyntaxException(final String wqlQuery) { diff --git a/src/main/java/org/metricshub/wbem/javax/cim/CIMArgument.java b/src/main/java/org/metricshub/wbem/javax/cim/CIMArgument.java index fc076cb..b3136ae 100644 --- a/src/main/java/org/metricshub/wbem/javax/cim/CIMArgument.java +++ b/src/main/java/org/metricshub/wbem/javax/cim/CIMArgument.java @@ -51,14 +51,13 @@ * method invocation. A CIMArgument has a name, data type and * value. A CIMArgument corresponds to a CIMParameter * defined for a CIMMethod. - * + * * @param * Type parameter. - * + * * @see CIMParameter */ public class CIMArgument extends CIMValuedElement { - private static final long serialVersionUID = 4727439564059428267L; /** @@ -66,7 +65,7 @@ public class CIMArgument extends CIMValuedElement { * A CIMArgument corresponds to a CIMParameter. * For each CIMParameter being populated during a method * invocation a CIMArgument object must be created. - * + * * @param pName * Name of the CIM argument. * @param pType @@ -86,7 +85,7 @@ public CIMArgument(String pName, CIMDataType pType, E pValue) throws IllegalArgu * true if and only if the argument is not null * and is a CIMArgument that represents the same name, type and * value as this CIMArgument. - * + * * @param pObj * The object to compare with. * @return true if the objects are the same; false diff --git a/src/main/java/org/metricshub/wbem/javax/cim/CIMClass.java b/src/main/java/org/metricshub/wbem/javax/cim/CIMClass.java index 30ea988..40291e1 100644 --- a/src/main/java/org/metricshub/wbem/javax/cim/CIMClass.java +++ b/src/main/java/org/metricshub/wbem/javax/cim/CIMClass.java @@ -60,7 +60,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.TreeSet; - import org.metricshub.wbem.sblim.cimclient.internal.cim.CIMElementSorter; import org.metricshub.wbem.sblim.cimclient.internal.cim.CIMQualifiedElementInterfaceImpl; import org.metricshub.wbem.sblim.cimclient.internal.util.MOF; @@ -80,9 +79,7 @@ *
    • an array of methods
    • * */ -public class CIMClass extends CIMElement implements CIMQualifiedElementInterface, - CIMNamedElementInterface { - +public class CIMClass extends CIMElement implements CIMQualifiedElementInterface, CIMNamedElementInterface { private static final long serialVersionUID = -5634561913210025100L; private CIMQualifiedElementInterfaceImpl iQualiImpl; @@ -105,7 +102,7 @@ public class CIMClass extends CIMElement implements CIMQualifiedElementInterface * pIsKeyed parameters. If an invalid value is supplied (i.e. * the class is an association, but the pIsAssociation was set * to false), it may or may not be corrected. - * + * * @param pPath * Object Name of the CIM class. * @param pSuperClass @@ -124,11 +121,17 @@ public class CIMClass extends CIMElement implements CIMQualifiedElementInterface * false otherwise. * @throws IllegalArgumentException * If pPath is null. - * + * */ - public CIMClass(CIMObjectPath pPath, String pSuperClass, CIMQualifier[] pQualifiers, - CIMClassProperty[] pProperties, CIMMethod[] pMethods, boolean pIsAssociation, - boolean pIsKeyed) { + public CIMClass( + CIMObjectPath pPath, + String pSuperClass, + CIMQualifier[] pQualifiers, + CIMClassProperty[] pProperties, + CIMMethod[] pMethods, + boolean pIsAssociation, + boolean pIsKeyed + ) { this(pPath, pSuperClass, pQualifiers, pProperties, pMethods); // if (this.isAssociation() != pIsAssociation) { // throw new IllegalArgumentException( @@ -153,7 +156,7 @@ public CIMClass(CIMObjectPath pPath, String pSuperClass, CIMQualifier[] pQual * Creates and instantiates a Java object representing a CIM Class. This * constructor will inspect the class to determine if it is an association * or has keys. - * + * * @param pName * Name of the CIM class. * @param pSuperClass @@ -167,10 +170,14 @@ public CIMClass(CIMObjectPath pPath, String pSuperClass, CIMQualifier[] pQual * @throws IllegalArgumentException * If pName is null. */ - public CIMClass(String pName, String pSuperClass, CIMQualifier[] pQualifiers, - CIMClassProperty[] pProperties, CIMMethod[] pMethods) { - this(new CIMObjectPath(null, null, null, null, pName, null), pSuperClass, pQualifiers, - pProperties, pMethods); + public CIMClass( + String pName, + String pSuperClass, + CIMQualifier[] pQualifiers, + CIMClassProperty[] pProperties, + CIMMethod[] pMethods + ) { + this(new CIMObjectPath(null, null, null, null, pName, null), pSuperClass, pQualifiers, pProperties, pMethods); } /** @@ -179,8 +186,13 @@ public CIMClass(String pName, String pSuperClass, CIMQualifier[] pQualifiers, * on whether there is qualifier with name="Association" and value=true and * a property with a qualifier with name="Key" and value=true, respectively. */ - private CIMClass(CIMObjectPath pPath, String pSuperClass, CIMQualifier[] pQualifiers, - CIMClassProperty[] pProperties, CIMMethod[] pMethods) { + private CIMClass( + CIMObjectPath pPath, + String pSuperClass, + CIMQualifier[] pQualifiers, + CIMClassProperty[] pProperties, + CIMMethod[] pMethods + ) { super(pPath == null ? null : pPath.getObjectName()); this.iObjPath = pPath; this.iSuperClass = pSuperClass; @@ -194,7 +206,7 @@ private CIMClass(CIMObjectPath pPath, String pSuperClass, CIMQualifier[] pQua /** * Indicates whether the specified CIMClass is equal to this * CIMClass. - * + * * @param pObj * The CIMClass object with which to compare. * @return true if this object is the same as the @@ -205,11 +217,16 @@ public boolean equals(Object pObj) { if (!(pObj instanceof CIMClass)) return false; CIMClass that = (CIMClass) pObj; if (!super.equals(that)) return false; - if (this.iSuperClass == null ? that.iSuperClass != null : !this.iSuperClass - .equalsIgnoreCase(that.iSuperClass)) return false; - if (!this.iQualiImpl.equals(that.iQualiImpl) || !Arrays.equals(this.iProps, that.iProps) - || !Arrays.equals(this.iMethods, that.iMethods) || this.iIsAssoc != that.iIsAssoc - || isKeyed() != that.isKeyed()) return false; + if ( + this.iSuperClass == null ? that.iSuperClass != null : !this.iSuperClass.equalsIgnoreCase(that.iSuperClass) + ) return false; + if ( + !this.iQualiImpl.equals(that.iQualiImpl) || + !Arrays.equals(this.iProps, that.iProps) || + !Arrays.equals(this.iMethods, that.iMethods) || + this.iIsAssoc != that.iIsAssoc || + isKeyed() != that.isKeyed() + ) return false; return true; } @@ -218,7 +235,7 @@ public boolean equals(Object pObj) { * according to the input parameters. Inclusion of class origin and * qualifiers can also be controlled. Methods will not be included in the * class returned. - * + * * @param pLocalOnly * If true only the elements defined in this class * are included; otherwise all elements are included. @@ -241,35 +258,49 @@ public boolean equals(Object pObj) { * invalid property names, they are ignored. * @return CIMClass matching the requested criteria. */ - public CIMClass filterProperties(boolean pLocalOnly, boolean pIncludeQualifiers, - boolean pIncludeClassOrigin, String[] pPropertyList) { + public CIMClass filterProperties( + boolean pLocalOnly, + boolean pIncludeQualifiers, + boolean pIncludeClassOrigin, + String[] pPropertyList + ) { ArrayList> newPropAList = new ArrayList>(); // place pPropertyList into a set, for easy and fast search TreeSet set; if (pPropertyList != null) { set = new TreeSet(); - for (int i = 0; i < pPropertyList.length; i++) - set.add(pPropertyList[i].toUpperCase()); + for (int i = 0; i < pPropertyList.length; i++) set.add(pPropertyList[i].toUpperCase()); } else set = null; for (int i = 0; i < getPropertyCount(); i++) { CIMClassProperty refProp = getProperty(i); if (pLocalOnly && refProp.isPropagated()) continue; - if (set == null || set.contains(refProp.getName().toUpperCase())) newPropAList - .add(new CIMClassProperty(refProp.getName(), refProp.getDataType(), - refProp.getValue(), - pIncludeQualifiers ? refProp.getQualifiers() : null, - pIncludeQualifiers ? refProp.isKey() : false, // FIXME: - // Should it depend on pIncludeQualifiers? - refProp.isPropagated(), pIncludeClassOrigin ? refProp.getOriginClass() - : null)); + if (set == null || set.contains(refProp.getName().toUpperCase())) newPropAList.add( + new CIMClassProperty( + refProp.getName(), + refProp.getDataType(), + refProp.getValue(), + pIncludeQualifiers ? refProp.getQualifiers() : null, + pIncludeQualifiers ? refProp.isKey() : false, // FIXME: + // Should it depend on pIncludeQualifiers? + refProp.isPropagated(), + pIncludeClassOrigin ? refProp.getOriginClass() : null + ) + ); } - return new CIMClass(getObjectPath(), getSuperClassName(), getQualifiers(), newPropAList - .toArray(new CIMClassProperty[0]), null, isAssociation(), isKeyed()); + return new CIMClass( + getObjectPath(), + getSuperClassName(), + getQualifiers(), + newPropAList.toArray(new CIMClassProperty[0]), + null, + isAssociation(), + isKeyed() + ); } /** * Returns a list of key properties for this CIM class. - * + * * @return The list of CIM properties that are keys for this CIM class. */ public CIMClassProperty[] getKeys() { @@ -283,7 +314,7 @@ public CIMClassProperty[] getKeys() { /** * Get a method by index. - * + * * @param pIndex * The index of the method to retrieve. * @return The CIMMethod at the specified index. @@ -295,7 +326,7 @@ public CIMMethod getMethod(int pIndex) throws ArrayIndexOutOfBoundsException /** * Returns the specified CIM method in this CIM class. - * + * * @param pName * The string name of the method to retrieve. The name may be * specified in the form "originClass.methodName". @@ -310,7 +341,7 @@ public CIMMethod getMethod(String pName) { /** * Returns the CIM method specified by its name and optionally, its origin * class. The origin class is the class in which the method is defined. - * + * * @param pName * The string name of the method to get. * @param pOriginClass @@ -327,7 +358,7 @@ public CIMMethod getMethod(String pName, String pOriginClass) { /** * Get the number of methods defined in this CIM class. - * + * * @return The number of methods defined in the CIM class. */ public int getMethodCount() { @@ -336,7 +367,7 @@ public int getMethodCount() { /** * Get the CIM methods defined in this CIM class. - * + * * @return The methods in this CIM class. */ public CIMMethod[] getMethods() { @@ -346,7 +377,7 @@ public CIMMethod[] getMethods() { /** * This method returns the CIMObjectPath that represents this * CIM class. - * + * * @return The CIMObjectPath that represents this CIM class. */ public CIMObjectPath getObjectPath() { @@ -355,7 +386,7 @@ public CIMObjectPath getObjectPath() { /** * Get the properties defined for this CIM class. - * + * * @return The properties for this class. */ public CIMClassProperty[] getProperties() { @@ -364,7 +395,7 @@ public CIMClassProperty[] getProperties() { /** * Get a class property by index. - * + * * @param pIndex * The index of the class property to retrieve. * @return The CIMClassProperty at the specified index. @@ -376,7 +407,7 @@ public CIMClassProperty getProperty(int pIndex) throws ArrayIndexOutOfBoundsE /** * Gets the specified property. - * + * * @param pName * The text string for the name of the property. * @return The property requested or null if the property does @@ -388,7 +419,7 @@ public CIMClassProperty getProperty(String pName) { /** * Gets the specified property. - * + * * @param pName * The string name of the property to get. * @param pOriginClass @@ -405,7 +436,7 @@ public CIMClassProperty getProperty(String pName, String pOriginClass) { /** * Get the number of properties defined in this CIMClass. - * + * * @return The number of properties defined in the CIMClass. */ public int getPropertyCount() { @@ -414,7 +445,7 @@ public int getPropertyCount() { /** * Get a qualifier by index. - * + * * @param pIndex * The index of the qualifier to retrieve. * @return The qualifier at the specified index. @@ -426,7 +457,7 @@ public CIMQualifier getQualifier(int pIndex) throws ArrayIndexOutOfBoundsExce /** * Gets a qualifier by name. - * + * * @param pName * The name of the qualifier to get. * @return The qualifier requested or null if the qualifier @@ -438,7 +469,7 @@ public CIMQualifier getQualifier(String pName) { /** * Get the number of qualifiers defined in this CIM class. - * + * * @return The number of qualifiers defined in the CIM class. */ public int getQualifierCount() { @@ -447,7 +478,7 @@ public int getQualifierCount() { /** * Returns the list of qualifiers for the CIM class. - * + * * @return Qualifiers for this class. */ public CIMQualifier[] getQualifiers() { @@ -456,7 +487,7 @@ public CIMQualifier[] getQualifiers() { /** * Gets a qualifier value by name. - * + * * @param pName * The name of the qualifier to get. * @return null if the qualifier does not exist or value is @@ -469,7 +500,7 @@ public Object getQualifierValue(String pName) { /** * Gets the name of the parent of this CIM class. - * + * * @return The name of the parent class. */ public String getSuperClassName() { @@ -479,7 +510,7 @@ public String getSuperClassName() { /** * Checks whether the specified qualifier is one of the qualifiers in this * CIM class. - * + * * @param pName * The name of the qualifier. * @return true if the qualifier exists in this CIM class, @@ -494,7 +525,7 @@ public boolean hasQualifier(String pName) { * for this class with the specified value. This method will return * false if the qualifier is not applied or if the value does * not match. - * + * * @param pName * The name of the qualifier. * @param pValue @@ -512,7 +543,7 @@ public boolean hasQualifierValue(String pName, Object pValue) { * two or more classes. The properties of an association class include * references, or pointers, to the two or more instances. All CIM classes * can be included in one or more associations. - * + * * @return true if this CIM class is an association; otherwise, * false. */ @@ -524,7 +555,7 @@ public boolean isAssociation() { * Identifies whether or not this class is keyed. Only keyed classes can * have instances. Returns true if this CIM class has one or * more key properties. Otherwise, returns false. - * + * * @return true if this CIM class has a key property, otherwise * returns false. */ @@ -535,7 +566,7 @@ public boolean isKeyed() { /** * Returns a new CIM instance initialized with the default CIM properties, * values and name of this CIM class. - * + * * @return A CIM instance of this CIM class. */ public CIMInstance newInstance() { @@ -547,7 +578,7 @@ public CIMInstance newInstance() { * method is intended to be used only for debugging purposes, and the format * of the returned string may vary between implementations. The returned * string may be empty but may not be null. - * + * * @return A String representation of this CIM class. */ @Override @@ -557,7 +588,7 @@ public String toString() { /** * Checks whether an array of properties contains a key. - * + * * @param pProps * Array of properties. * @return true if at least one of the class properties is a @@ -565,9 +596,7 @@ public String toString() { */ private static boolean hasKey(CIMClassProperty[] pProps) { if (pProps == null) return false; - for (int i = 0; i < pProps.length; i++) - if (pProps[i].isKey()) return true; + for (int i = 0; i < pProps.length; i++) if (pProps[i].isKey()) return true; return false; } - } diff --git a/src/main/java/org/metricshub/wbem/javax/cim/CIMClassProperty.java b/src/main/java/org/metricshub/wbem/javax/cim/CIMClassProperty.java index b6a8d2f..c8d3eb5 100644 --- a/src/main/java/org/metricshub/wbem/javax/cim/CIMClassProperty.java +++ b/src/main/java/org/metricshub/wbem/javax/cim/CIMClassProperty.java @@ -62,20 +62,19 @@ * >DSP004). This class is to be used for all CIMClass * properties. NOTE: For instance properties, use the class * CIMProperty. - * + * * @param * Type parameter. - * + * */ public class CIMClassProperty extends CIMProperty implements CIMQualifiedElementInterface { - private static final long serialVersionUID = -1455588144409014311L; private CIMQualifiedElementInterfaceImpl iQualiImpl; /** * This method constructs an instance of CIMClassProperty. - * + * * @param pName * The name of the property. * @param pType @@ -93,8 +92,15 @@ public class CIMClassProperty extends CIMProperty implements CIMQualifiedE * @param pOriginClass * The original class in which the property was defined. */ - public CIMClassProperty(String pName, CIMDataType pType, E pValue, - CIMQualifier[] pQualifiers, boolean pKey, boolean pPropagated, String pOriginClass) { + public CIMClassProperty( + String pName, + CIMDataType pType, + E pValue, + CIMQualifier[] pQualifiers, + boolean pKey, + boolean pPropagated, + String pOriginClass + ) { super(pName, pType, pValue, pKey | hasKey(pQualifiers), pPropagated, pOriginClass); this.iQualiImpl = new CIMQualifiedElementInterfaceImpl(pQualifiers, pKey, true); } @@ -104,7 +110,7 @@ public CIMClassProperty(String pName, CIMDataType pType, E pValue, * true if and only if the argument is not null and is a * CIMClassProperty that represents the same name, type and * value as this object. - * + * * @param pObj * The object to compare with. * @return true if the objects are the same; false @@ -119,7 +125,7 @@ public boolean equals(Object pObj) { /** * Returns a CIMClassProperty filtered as specified. - * + * * @param pIncludeQualifiers * If true all qualifiers are returned; otherwise no * qualifiers. @@ -134,7 +140,7 @@ public CIMClassProperty filter(boolean pIncludeQualifiers, boolean pIncludeCl /** * Returns a CIMClassProperty filtered as specified. - * + * * @param pIncludeQualifiers * If true all qualifiers are returned; otherwise no * qualifiers. @@ -146,17 +152,22 @@ public CIMClassProperty filter(boolean pIncludeQualifiers, boolean pIncludeCl * propagated will be included. * @return CIMClassProperty A filtered CIMClassProperty. */ - public CIMClassProperty filter(boolean pIncludeQualifiers, boolean pIncludeClassOrigin, - boolean pLocalOnly) { + public CIMClassProperty filter(boolean pIncludeQualifiers, boolean pIncludeClassOrigin, boolean pLocalOnly) { // FIXME: should key depend on pIncludeQualifiers? - return new CIMClassProperty(getName(), getDataType(), getValue(), - pIncludeQualifiers ? this.iQualiImpl.getQualifiers(pLocalOnly) : null, isKey(), - isPropagated(), pIncludeClassOrigin ? getOriginClass() : null); + return new CIMClassProperty( + getName(), + getDataType(), + getValue(), + pIncludeQualifiers ? this.iQualiImpl.getQualifiers(pLocalOnly) : null, + isKey(), + isPropagated(), + pIncludeClassOrigin ? getOriginClass() : null + ); } /** * Get a qualifier by index. - * + * * @param pIndex * The index of the qualifier to retrieve. * @return The qualifier at the specified index. @@ -168,7 +179,7 @@ public CIMQualifier getQualifier(int pIndex) throws ArrayIndexOutOfBoundsExce /** * Gets a qualifier by name. - * + * * @param pName * The name of the qualifier to get. * @return The qualifier requested or null if the qualifier @@ -180,7 +191,7 @@ public CIMQualifier getQualifier(String pName) { /** * Get the number of qualifiers defined for this property. - * + * * @return The number of qualifiers defined for this property. */ public int getQualifierCount() { @@ -189,7 +200,7 @@ public int getQualifierCount() { /** * Returns the list of qualifiers for this property. - * + * * @return Qualifiers for this property. */ public CIMQualifier[] getQualifiers() { @@ -198,7 +209,7 @@ public CIMQualifier[] getQualifiers() { /** * Gets a qualifier value by name. - * + * * @param pName * The name of the qualifier to get. * @return null if the qualifier does not exist or value is @@ -212,7 +223,7 @@ public Object getQualifierValue(String pName) { /** * Checks whether the specified qualifier is one of the qualifiers defined * for this property. - * + * * @param pName * The name of the qualifier. * @return true if the qualifier exists in this property, @@ -227,7 +238,7 @@ public boolean hasQualifier(String pName) { * for this property with the specified value. This method will return * false if the qualifier is not applied or if the value does * not match. - * + * * @param pName * The name of the qualifier. * @param pValue @@ -241,10 +252,10 @@ public boolean hasQualifierValue(String pName, Object pValue) { /** * Checks whether an array of qualifiers contains a key. - * + * * @param pQualiA * Array of qualifiers. - * + * * @return true if at least one of the qualifiers is a key, * false otherwise. */ @@ -253,9 +264,10 @@ private static boolean hasKey(CIMQualifier[] pQualiA) { Boolean trueBool = Boolean.TRUE; for (int i = 0; i < pQualiA.length; i++) { CIMQualifier quali = pQualiA[i]; - if ("key".equalsIgnoreCase(quali.getName())) { return trueBool.equals(quali.getValue()); } + if ("key".equalsIgnoreCase(quali.getName())) { + return trueBool.equals(quali.getValue()); + } } return false; } - } diff --git a/src/main/java/org/metricshub/wbem/javax/cim/CIMDataType.java b/src/main/java/org/metricshub/wbem/javax/cim/CIMDataType.java index aca33c9..1917b0b 100644 --- a/src/main/java/org/metricshub/wbem/javax/cim/CIMDataType.java +++ b/src/main/java/org/metricshub/wbem/javax/cim/CIMDataType.java @@ -51,7 +51,6 @@ */ import java.io.Serializable; - import org.metricshub.wbem.sblim.cimclient.internal.util.MOF; //Sync'd against JSR48 1.0.0 javadoc (version 1.7.0_02) on Sun Apr 22 15:31:53 EDT 2012 @@ -137,47 +136,46 @@ * */ public class CIMDataType extends Object implements Serializable { - private static final long serialVersionUID = 1L; /** * Boolean - * + * * @see Boolean */ public static final int BOOLEAN = 9; /** * Boolean unbounded array data type - * + * * @see Boolean */ public static final CIMDataType BOOLEAN_ARRAY_T = new CIMDataType(BOOLEAN, true); /** * Boolean data type - * + * * @see Boolean */ public static final CIMDataType BOOLEAN_T = new CIMDataType(BOOLEAN, false); /** * 16-bit UCS-2 character - * + * * @see Character */ public static final int CHAR16 = 13; /** * 16-bit UCS-2 character unbounded Array type - * + * * @see Character */ public static final CIMDataType CHAR16_ARRAY_T = new CIMDataType(CHAR16, true); /** * 16-bit UCS-2 character data type - * + * * @see Character */ public static final CIMDataType CHAR16_T = new CIMDataType(CHAR16, false); @@ -189,35 +187,35 @@ public class CIMDataType extends Object implements Serializable { /** * CIMClass unbounded Array type - * + * * @see CIMClass */ public static final CIMDataType CLASS_ARRAY_T = new CIMDataType(CLASS, true); /** * CIMClass type - * + * * @see CIMClass */ public static final CIMDataType CLASS_T = new CIMDataType(CLASS, false); /** * A string containing the date-time - * + * * @see CIMDateTimeInterval CIMDateTimeAbsolute */ public static final int DATETIME = 12; /** * A date-time unbounded array data type - * + * * @see CIMDateTimeInterval CIMDateTimeAbsolute */ public static final CIMDataType DATETIME_ARRAY_T = new CIMDataType(DATETIME, true); /** * A date-time data type - * + * * @see CIMDateTimeInterval CIMDateTimeAbsolute */ public static final CIMDataType DATETIME_T = new CIMDataType(DATETIME, false); @@ -239,14 +237,14 @@ public class CIMDataType extends Object implements Serializable { /** * CIMInstance type - * + * * @see CIMInstance */ public static final int OBJECT = 15; /** * CIMInstance unbounded Array type - * + * * @see CIMInstance */ public static final CIMDataType OBJECT_ARRAY_T = new CIMDataType(OBJECT, true); @@ -254,98 +252,98 @@ public class CIMDataType extends Object implements Serializable { /** * CIMInstance type data type (Note: For CIMV2, this can only be used when * the property has either an EmbeddedInstance or EmbeddedObject qualifier) - * + * * @see CIMInstance */ public static final CIMDataType OBJECT_T = new CIMDataType(OBJECT, false); /** * IEEE 4-byte floating-point - * + * * @see Float */ public static final int REAL32 = 10; /** * IEEE 4-byte floating-point unbounded array data type - * + * * @see Float */ public static final CIMDataType REAL32_ARRAY_T = new CIMDataType(REAL32, true); /** * IEEE 4-byte floating-point data type - * + * * @see Float */ public static final CIMDataType REAL32_T = new CIMDataType(REAL32, false); /** * IEEE 8-byte floating-point - * + * * @see Double */ public static final int REAL64 = 11; /** * IEEE 8-byte floating-point unbounded array data type - * + * * @see Double */ public static final CIMDataType REAL64_ARRAY_T = new CIMDataType(REAL64, true); /** * IEEE 8-byte floating-point data type - * + * * @see Double */ public static final CIMDataType REAL64_T = new CIMDataType(REAL64, false); /** * Reference type - * + * * @see CIMObjectPath */ public static final int REFERENCE = 14; /** * Signed 16-bit integer - * + * * @see Short */ public static final int SINT16 = 3; /** * Signed 16-bit integer unbounded array data type - * + * * @see Short */ public static final CIMDataType SINT16_ARRAY_T = new CIMDataType(SINT16, true); /** * Signed 16-bit integer data type - * + * * @see Short */ public static final CIMDataType SINT16_T = new CIMDataType(SINT16, false); /** * Signed 32-bit integer - * + * * @see Integer */ public static final int SINT32 = 5; /** * Signed 32-bit integer unbounded array data type - * + * * @see Integer */ public static final CIMDataType SINT32_ARRAY_T = new CIMDataType(SINT32, true); /** * Signed 32-bit integer data type - * + * * @see Integer */ public static final CIMDataType SINT32_T = new CIMDataType(SINT32, false); @@ -357,140 +355,140 @@ public class CIMDataType extends Object implements Serializable { /** * Signed 64-bit integer unbounded array data type - * + * * @see Long */ public static final CIMDataType SINT64_ARRAY_T = new CIMDataType(SINT64, true); /** * Signed 64-bit integer data type - * + * * @see Long */ public static final CIMDataType SINT64_T = new CIMDataType(SINT64, false); /** * Signed 8-bit integer - * + * * @see Byte */ public static final int SINT8 = 1; /** * Signed 8-bit integer unbounded array data type - * + * * @see Byte */ public static final CIMDataType SINT8_ARRAY_T = new CIMDataType(SINT8, true); /** * Signed 8-bit integer data type - * + * * @see Byte */ public static final CIMDataType SINT8_T = new CIMDataType(SINT8, false); /** * UCS-2 string - * + * * @see String */ public static final int STRING = 8; /** * UCS-2 string unbounded array data type - * + * * @see String */ public static final CIMDataType STRING_ARRAY_T = new CIMDataType(STRING, true); /** * UCS-2 string data type - * + * * @see String */ public static final CIMDataType STRING_T = new CIMDataType(STRING, false); /** * Unsigned 16-bit integer - * + * * @see UnsignedInteger16 */ public static final int UINT16 = 2; /** * Unsigned 16-bit integer unbounded array data type - * + * * @see UnsignedInteger16 */ public static final CIMDataType UINT16_ARRAY_T = new CIMDataType(UINT16, true); /** * Unsigned 16-bit integer data type - * + * * @see UnsignedInteger16 */ public static final CIMDataType UINT16_T = new CIMDataType(UINT16, false); /** * Unsigned 32-bit integer - * + * * @see UnsignedInteger32 */ public static final int UINT32 = 4; /** * Unsigned 32-bit integer unbounded array data type - * + * * @see UnsignedInteger32 */ public static final CIMDataType UINT32_ARRAY_T = new CIMDataType(UINT32, true); /** * Unsigned 32-bit integer data type - * + * * @see UnsignedInteger32 */ public static final CIMDataType UINT32_T = new CIMDataType(UINT32, false); /** * Unsigned 64-bit integer - * + * * @see UnsignedInteger64 */ public static final int UINT64 = 6; /** * Unsigned 64-bit integer unbounded array data type - * + * * @see UnsignedInteger64 */ public static final CIMDataType UINT64_ARRAY_T = new CIMDataType(UINT64, true); /** * Unsigned 64-bit integer data type - * + * * @see UnsignedInteger64 */ public static final CIMDataType UINT64_T = new CIMDataType(UINT64, false); /** * Unsigned 8-bit integer - * + * * @see UnsignedInteger8 */ public static final int UINT8 = 0; /** * Unsigned 8-bit integer unbounded array data type - * + * * @see UnsignedInteger8 */ public static final CIMDataType UINT8_ARRAY_T = new CIMDataType(UINT8, true); /** * Unsigned 8-bit integer data type - * + * * @see UnsignedInteger8 */ public static final CIMDataType UINT8_T = new CIMDataType(UINT8, false); @@ -508,7 +506,7 @@ public class CIMDataType extends Object implements Serializable { /** * Sets the data type (non-array). - * + * * @param pType * The data type of the class. */ @@ -519,12 +517,12 @@ private void setType(int pType) { /** * Sets the data type (array). - * + * * @param pType * The data type of the class. * @param pBound * Array bounds or unbounded if zero. - * + * */ private void setType(int pType, int pBound) { this.iTypeCode = pType; @@ -533,7 +531,7 @@ private void setType(int pType, int pBound) { /** * Constructs a CIMDataType. - * + * * @param pType * The data type as defined in the CIM class. * @param pIsArray @@ -553,7 +551,7 @@ public CIMDataType(int pType, boolean pIsArray) throws IllegalArgumentException * Constructs a CIMDataType array object of the specified type * and size. This should only be used when the size is being limited/defined * as part of the data type. - * + * * @param pType * The data type as defined in the CIM class. * @param pSize @@ -563,15 +561,14 @@ public CIMDataType(int pType, boolean pIsArray) throws IllegalArgumentException * integer. */ public CIMDataType(int pType, int pSize) throws IllegalArgumentException { - if (pSize <= 0) throw new IllegalArgumentException( - "Maximum number of elements must be positive integer!"); + if (pSize <= 0) throw new IllegalArgumentException("Maximum number of elements must be positive integer!"); setType(pType, pSize); } /** * Creates a new CIM REFERENCE data type object with the specified class * reference. - * + * * @param pClassName * The CIM class reference name. * @throws IllegalArgumentException @@ -586,7 +583,7 @@ public CIMDataType(String pClassName) { /** * Creates a new CIM REFERENCE array data type object with the specified * class reference. - * + * * @param pClassName * The CIM class reference name. * @param pSize @@ -596,8 +593,7 @@ public CIMDataType(String pClassName) { */ public CIMDataType(String pClassName, int pSize) { if (pClassName == null) throw new IllegalArgumentException("Class name must not be null!"); - if (pSize < 0) throw new IllegalArgumentException( - "Maximum number of elements cannot be negative integer!"); + if (pSize < 0) throw new IllegalArgumentException("Maximum number of elements cannot be negative integer!"); setType(REFERENCE, pSize); this.iRefClassName = pClassName; } @@ -605,7 +601,7 @@ public CIMDataType(String pClassName, int pSize) { /** * Checks that the specified CIMDataType is equal to this * CIMDataType. - * + * * @param pObj * The object to compare. * @return true if the specified object is equal to this @@ -617,14 +613,13 @@ public boolean equals(Object pObj) { if (!(pObj instanceof CIMDataType)) return false; CIMDataType that = (CIMDataType) pObj; if (this.iRefClassName == null && that.iRefClassName != null) return false; - boolean refMatch = (this.iRefClassName == null ? true : this.iRefClassName - .equals(that.iRefClassName)); + boolean refMatch = (this.iRefClassName == null ? true : this.iRefClassName.equals(that.iRefClassName)); return (this.iTypeCode == that.iTypeCode && isArray() == that.isArray() && refMatch); } /** * Get the data type of an object. - * + * * @param pObj * The object whose data type is to be returned. * @return The data type of the specified object. @@ -632,46 +627,109 @@ public boolean equals(Object pObj) { * If pObj is not a valid CIM Type. */ public static final CIMDataType getDataType(Object pObj) throws IllegalArgumentException { - if (pObj instanceof Byte) { return SINT8_T; } - if (pObj instanceof Byte[]) { return SINT8_ARRAY_T; } - if (pObj instanceof Short) { return SINT16_T; } - if (pObj instanceof Short[]) { return SINT16_ARRAY_T; } - if (pObj instanceof Integer) { return SINT32_T; } - if (pObj instanceof Integer[]) { return SINT32_ARRAY_T; } - if (pObj instanceof Long) { return SINT64_T; } - if (pObj instanceof Long[]) { return SINT64_ARRAY_T; } - if (pObj instanceof UnsignedInteger8) { return UINT8_T; } - if (pObj instanceof UnsignedInteger8[]) { return UINT8_ARRAY_T; } - if (pObj instanceof UnsignedInteger16) { return UINT16_T; } - if (pObj instanceof UnsignedInteger16[]) { return UINT16_ARRAY_T; } - if (pObj instanceof UnsignedInteger32) { return UINT32_T; } - if (pObj instanceof UnsignedInteger32[]) { return UINT32_ARRAY_T; } - if (pObj instanceof UnsignedInteger64) { return UINT64_T; } - if (pObj instanceof UnsignedInteger64[]) { return UINT64_ARRAY_T; } - if (pObj instanceof Boolean) { return BOOLEAN_T; } - if (pObj instanceof Boolean[]) { return BOOLEAN_ARRAY_T; } - if (pObj instanceof Character) { return CHAR16_T; } - if (pObj instanceof Character[]) { return CHAR16_ARRAY_T; } - if (pObj instanceof String) { return STRING_T; } - if (pObj instanceof String[]) { return STRING_ARRAY_T; } - if (pObj instanceof Float) { return REAL32_T; } - if (pObj instanceof Float[]) { return REAL32_ARRAY_T; } - if (pObj instanceof Double) { return REAL64_T; } - if (pObj instanceof Double[]) { return REAL64_ARRAY_T; } - if (pObj instanceof CIMDateTime) { return DATETIME_T; } - if (pObj instanceof CIMDateTime[]) { return DATETIME_ARRAY_T; } - if (pObj instanceof CIMClass) { return CLASS_T; } - if (pObj instanceof CIMClass[]) { return CLASS_ARRAY_T; } - if (pObj instanceof CIMInstance) { return OBJECT_T; } - if (pObj instanceof CIMInstance[]) { return OBJECT_ARRAY_T; } + if (pObj instanceof Byte) { + return SINT8_T; + } + if (pObj instanceof Byte[]) { + return SINT8_ARRAY_T; + } + if (pObj instanceof Short) { + return SINT16_T; + } + if (pObj instanceof Short[]) { + return SINT16_ARRAY_T; + } + if (pObj instanceof Integer) { + return SINT32_T; + } + if (pObj instanceof Integer[]) { + return SINT32_ARRAY_T; + } + if (pObj instanceof Long) { + return SINT64_T; + } + if (pObj instanceof Long[]) { + return SINT64_ARRAY_T; + } + if (pObj instanceof UnsignedInteger8) { + return UINT8_T; + } + if (pObj instanceof UnsignedInteger8[]) { + return UINT8_ARRAY_T; + } + if (pObj instanceof UnsignedInteger16) { + return UINT16_T; + } + if (pObj instanceof UnsignedInteger16[]) { + return UINT16_ARRAY_T; + } + if (pObj instanceof UnsignedInteger32) { + return UINT32_T; + } + if (pObj instanceof UnsignedInteger32[]) { + return UINT32_ARRAY_T; + } + if (pObj instanceof UnsignedInteger64) { + return UINT64_T; + } + if (pObj instanceof UnsignedInteger64[]) { + return UINT64_ARRAY_T; + } + if (pObj instanceof Boolean) { + return BOOLEAN_T; + } + if (pObj instanceof Boolean[]) { + return BOOLEAN_ARRAY_T; + } + if (pObj instanceof Character) { + return CHAR16_T; + } + if (pObj instanceof Character[]) { + return CHAR16_ARRAY_T; + } + if (pObj instanceof String) { + return STRING_T; + } + if (pObj instanceof String[]) { + return STRING_ARRAY_T; + } + if (pObj instanceof Float) { + return REAL32_T; + } + if (pObj instanceof Float[]) { + return REAL32_ARRAY_T; + } + if (pObj instanceof Double) { + return REAL64_T; + } + if (pObj instanceof Double[]) { + return REAL64_ARRAY_T; + } + if (pObj instanceof CIMDateTime) { + return DATETIME_T; + } + if (pObj instanceof CIMDateTime[]) { + return DATETIME_ARRAY_T; + } + if (pObj instanceof CIMClass) { + return CLASS_T; + } + if (pObj instanceof CIMClass[]) { + return CLASS_ARRAY_T; + } + if (pObj instanceof CIMInstance) { + return OBJECT_T; + } + if (pObj instanceof CIMInstance[]) { + return OBJECT_ARRAY_T; + } if (pObj instanceof CIMObjectPath) { CIMObjectPath op = (CIMObjectPath) pObj; return new CIMDataType(op.getObjectName()); } if (pObj instanceof CIMObjectPath[]) { CIMObjectPath[] ops = (CIMObjectPath[]) pObj; - for (int i = 0; i < ops.length; i++) - if (ops[i] != null) return new CIMDataType(ops[i].getObjectName(), 0); + for (int i = 0; i < ops.length; i++) if (ops[i] != null) return new CIMDataType(ops[i].getObjectName(), 0); } // TODO: tracing /* @@ -683,7 +741,7 @@ public static final CIMDataType getDataType(Object pObj) throws IllegalArgumentE /** * Returns the class name of the CIM REFERENCE data type. - * + * * @return The CIM REFERENCE class name. */ public String getRefClassName() { @@ -693,7 +751,7 @@ public String getRefClassName() { /** * Returns the size of the maximum number of elements an array data type may * hold. - * + * * @return The maximum size of the array data type. */ public int getSize() { @@ -702,7 +760,7 @@ public int getSize() { /** * Returns the data type. - * + * * @return The data type. */ public int getType() { @@ -711,7 +769,7 @@ public int getType() { /** * Checks if the data type is an array type. - * + * * @return true if the data type is an array type, * false otherwise. */ @@ -725,7 +783,7 @@ public boolean isArray() { * debugging purposes, and the format of the returned string may vary * between implementations. The returned string may be empty but may not be * null. - * + * * @return A string representation of this data type. */ @Override diff --git a/src/main/java/org/metricshub/wbem/javax/cim/CIMDateTime.java b/src/main/java/org/metricshub/wbem/javax/cim/CIMDateTime.java index 1c44ded..15bbaca 100644 --- a/src/main/java/org/metricshub/wbem/javax/cim/CIMDateTime.java +++ b/src/main/java/org/metricshub/wbem/javax/cim/CIMDateTime.java @@ -69,7 +69,7 @@ *
    • utc - is the offset from UTC in minutes (using the sign indicated by s). * It is ignored for a time interval.
    • * - * + * * For example, the absolute datetime for Monday, May 25, 1998, at 1:30 PM EST * would be represented as: 19980525133015.000000-300. Values must be * zero-padded so that the entire string is always the same 25-character length. @@ -81,29 +81,28 @@ * is always used for interval properties. */ public abstract class CIMDateTime extends Object implements Serializable, Comparable { - private static final long serialVersionUID = 3424668043014662166L; /** * Creates a CIMDateTime object using a string. - * + * * @param pDateString * A string in the format of yyyyMMddHHmmss.SSSSSSsutc. * @throws IllegalArgumentException * If string is not in the correct format. */ public CIMDateTime(String pDateString) throws IllegalArgumentException { - // FIXME: what to do here? + // FIXME: what to do here? } protected CIMDateTime() { - // FIXME: what to do here? + // FIXME: what to do here? } /** * Determines whether the CIMDateTime that is passed in is * equal to the current CIMDateTime object. - * + * * @param pObj * The CIMDateTime object to compare to. * @return true if this CIMDateTime object is equal to the one @@ -118,7 +117,7 @@ public boolean equals(Object pObj) { /** * Gets the internal string representation of this object. - * + * * @return The internal representation of the CIMDateTime * object. */ @@ -126,7 +125,7 @@ public boolean equals(Object pObj) { /** * Returns the hash code for this object. - * + * * @return A hash code value for this object. * @see java.lang.Object#hashCode() */ diff --git a/src/main/java/org/metricshub/wbem/javax/cim/CIMDateTimeAbsolute.java b/src/main/java/org/metricshub/wbem/javax/cim/CIMDateTimeAbsolute.java index 510a514..8421e43 100644 --- a/src/main/java/org/metricshub/wbem/javax/cim/CIMDateTimeAbsolute.java +++ b/src/main/java/org/metricshub/wbem/javax/cim/CIMDateTimeAbsolute.java @@ -54,7 +54,6 @@ */ import java.util.Calendar; - import org.metricshub.wbem.sblim.cimclient.internal.cim.DTStringReader; import org.metricshub.wbem.sblim.cimclient.internal.cim.DTStringWriter; @@ -81,7 +80,6 @@ * significant must be replaced with asterisk characters. */ public class CIMDateTimeAbsolute extends CIMDateTime { - private static final long serialVersionUID = 7556792806296945178l; private int iYear, iMonth, iDay, iHour, iMin, iSec, iUSec, iUtc; @@ -101,7 +99,7 @@ public CIMDateTimeAbsolute() { /** * Create a CIMDateTimeAbsolute object using a * Calendar object. - * + * * @param pCalendar * A Calendar object used to initialize this object. * @throws IllegalArgumentException @@ -110,13 +108,14 @@ public CIMDateTimeAbsolute() { public CIMDateTimeAbsolute(Calendar pCalendar) throws IllegalArgumentException { if (pCalendar == null) throw new IllegalArgumentException("Null Calendar is not allowed!"); if (pCalendar.get(Calendar.YEAR) > 9999) throw new IllegalArgumentException( - "The year field cannot be greater than 9999!"); + "The year field cannot be greater than 9999!" + ); set(pCalendar); } /** * Creates a CIMDateTimeAbsolute object using a string. - * + * * @param pDateTime * A string in the format of yyyyMMddHHmmss.SSSSSSsutc. * @throws IllegalArgumentException @@ -135,8 +134,7 @@ public CIMDateTimeAbsolute(String pDateTime) throws IllegalArgumentException { this.iUSec = reader.readAndCheck(6, "microSeconds", 0, 999999, true); char sign = reader.read(); if (sign != '+' && sign != '-') { - String msg = "Illegal character '" + sign + "' at position " + reader.getPos() - + "! '+' or '-' is expected."; + String msg = "Illegal character '" + sign + "' at position " + reader.getPos() + "! '+' or '-' is expected."; throw new IllegalArgumentException(msg); } this.iUtc = reader.read(3, "utc", true); @@ -145,8 +143,7 @@ public CIMDateTimeAbsolute(String pDateTime) throws IllegalArgumentException { } else if (sign == '-') { this.iUtc = -this.iUtc; } - if (reader.read() != 0) throw new IllegalArgumentException("Extra character at the end of " - + pDateTime + " !"); + if (reader.read() != 0) throw new IllegalArgumentException("Extra character at the end of " + pDateTime + " !"); this.iStr = pDateTime; } @@ -154,7 +151,7 @@ public CIMDateTimeAbsolute(String pDateTime) throws IllegalArgumentException { * Compares the CIMDateTimeAbsolute object with this one. If * either date has "Not Significant" fields then we can only compare the * significant fields. - * + * * @param pDateTime * The CIMDateTimeAbsolute to be compared with this * one. @@ -166,8 +163,9 @@ public CIMDateTimeAbsolute(String pDateTime) throws IllegalArgumentException { */ public int compareTo(CIMDateTime pDateTime) throws IllegalArgumentException { if (!(pDateTime instanceof CIMDateTimeAbsolute)) { - String msg = "pDateTime must be a CIMDateTimeAbsolute instance while it is a " - + (pDateTime == null ? "null!" : pDateTime.getClass().getName() + " instance!"); + String msg = + "pDateTime must be a CIMDateTimeAbsolute instance while it is a " + + (pDateTime == null ? "null!" : pDateTime.getClass().getName() + " instance!"); throw new IllegalArgumentException(msg); } @@ -186,7 +184,7 @@ public int compareTo(CIMDateTime pDateTime) throws IllegalArgumentException { /** * Gets the internal string representation of the date/time object. - * + * * @return The internal representation of the date/time object. */ @Override @@ -202,14 +200,13 @@ public String getDateTimeString() { dTWriter.write(2, this.iSec); dTWriter.write('.'); dTWriter.write(6, this.iUSec); - if (this.iUnsignificantUtc) dTWriter.write("+***"); - else dTWriter.writeSigned(3, this.iUtc); + if (this.iUnsignificantUtc) dTWriter.write("+***"); else dTWriter.writeSigned(3, this.iUtc); return this.iStr = dTWriter.toString(); } /** * Returns day value of this date. - * + * * @return If day field "not significant" this returns -1, otherwise returns * day of this date. */ @@ -219,7 +216,7 @@ public int getDay() { /** * Returns hour value of this date. - * + * * @return If hour field "not significant" this returns -1, otherwise * returns hour of this date. */ @@ -229,7 +226,7 @@ public int getHour() { /** * Returns microsecond value of this date. - * + * * @return If microsecond field "not significant" this returns -1, otherwise * returns microseconds of this date. */ @@ -239,7 +236,7 @@ public int getMicrosecond() { /** * Returns minute value of this date. - * + * * @return If minute field "not significant" this returns -1, otherwise * returns minute of this date. */ @@ -249,7 +246,7 @@ public int getMinute() { /** * Returns month value of this date. - * + * * @return If month field "not significant" this returns -1, otherwise * returns the month of this date. */ @@ -259,7 +256,7 @@ public int getMonth() { /** * Returns second value of this date. - * + * * @return If second field "not significant" this returns -1, otherwise * returns second of this date. */ @@ -269,7 +266,7 @@ public int getSecond() { /** * Returns UTC offset value of this date. - * + * * @return UTC offset of this date. */ public int getUTCOffset() { @@ -278,7 +275,7 @@ public int getUTCOffset() { /** * Returns year value of this Date. - * + * * @return If year field "not significant" this returns -1, otherwise * returns the year of this date. */ @@ -288,7 +285,7 @@ public int getYear() { /** * Returns the hash code for this object. - * + * * @return A hash code value for this object. * @see java.lang.Object#hashCode() */ @@ -303,7 +300,7 @@ public int hashCode() { * for debugging purposes, and the format of the returned string may vary * between implementations. The returned string may be empty but may not be * null. - * + * * @return String representation of this datetime. */ @Override @@ -311,13 +308,12 @@ public String toString() { return getDateTimeString(); } - private static final int YEAR = 1, MONTH = 2, DAY = 4, HOUR = 8, MIN = 16, SEC = 32, USEC = 64, - UTC = 128; + private static final int YEAR = 1, MONTH = 2, DAY = 4, HOUR = 8, MIN = 16, SEC = 32, USEC = 64, UTC = 128; /** * Get mask of this CIMDateTimeAbsolute where bit is set if the * corresponding field is significant or clear if it is not significant. - * + * * @return Mask of significant fields in datetime object. */ private int getMask() { @@ -335,7 +331,7 @@ private int getMask() { /** * Get value of a field based on mask. - * + * * @param pMask * Mask of significant fields. * @param pField @@ -353,7 +349,7 @@ private int mask(int pMask, int pField, int pValue, int pInitValue) { /** * Get total microseconds of CIMDateTimeAbsolute object where * only significant fields are used in calculation. - * + * * @param pMask * Mask of significant fields. * @return Total microseconds of significant fields in datetime. @@ -380,7 +376,7 @@ private long getTotalUSec(int pMask) { /** * Initializes this CIMDateTimeAbsolute object from the * Calendar passed in. - * + * * @param pCal * Calendar object. */ @@ -398,5 +394,4 @@ private void set(Calendar pCal) { this.iUtc = pCal.get(Calendar.ZONE_OFFSET) / 60000; } } - } diff --git a/src/main/java/org/metricshub/wbem/javax/cim/CIMDateTimeInterval.java b/src/main/java/org/metricshub/wbem/javax/cim/CIMDateTimeInterval.java index d36ea4f..e34571a 100644 --- a/src/main/java/org/metricshub/wbem/javax/cim/CIMDateTimeInterval.java +++ b/src/main/java/org/metricshub/wbem/javax/cim/CIMDateTimeInterval.java @@ -88,10 +88,9 @@ * For example, if an interval of 1 day, 13 hours, 23 minutes, 12 seconds, and * 125 milliseconds was measured with a precision of 1 millisecond, the format * would be: 00000001132312.125***:000. - * + * */ public class CIMDateTimeInterval extends CIMDateTime { - private static final long serialVersionUID = -7362881414085831668l; private int iDays, iHours, iMinutes, iSeconds, iUSeconds; @@ -104,21 +103,26 @@ public class CIMDateTimeInterval extends CIMDateTime { private int iUnsignificantUSecDigits; - private static final int MAX_DAY = 99999999, MAX_HOUR = 23, MAX_MIN = 59, MAX_SEC = 59, - MAX_MILLISEC = 999, MAX_MICROSEC = 999999; + private static final int MAX_DAY = 99999999, MAX_HOUR = 23, MAX_MIN = 59, MAX_SEC = 59, MAX_MILLISEC = + 999, MAX_MICROSEC = 999999; - private static final long MAX_INTERVAL = ((((long) MAX_DAY * 24 * 60 * 60) - + ((long) MAX_HOUR * 60 * 60) + ((long) MAX_MIN * 60) + MAX_SEC) * 1000) - + MAX_MILLISEC; + private static final long MAX_INTERVAL = + ((((long) MAX_DAY * 24 * 60 * 60) + ((long) MAX_HOUR * 60 * 60) + ((long) MAX_MIN * 60) + MAX_SEC) * 1000) + + MAX_MILLISEC; - private static final long MILLISEC_ACCURACY_DIV = 1000, - SEC_ACCURACY_DIV = 1000 * MILLISEC_ACCURACY_DIV, - MIN_ACCURACY_DIV = 60 * SEC_ACCURACY_DIV, HOUR_ACCURACY_DIV = 60 * MIN_ACCURACY_DIV, - DAY_ACCURACY_DIV = 24 * HOUR_ACCURACY_DIV, - NO_ACCURACY_DIV = 100000000 * DAY_ACCURACY_DIV; + private static final long MILLISEC_ACCURACY_DIV = 1000, SEC_ACCURACY_DIV = + 1000 * MILLISEC_ACCURACY_DIV, MIN_ACCURACY_DIV = 60 * SEC_ACCURACY_DIV, HOUR_ACCURACY_DIV = + 60 * MIN_ACCURACY_DIV, DAY_ACCURACY_DIV = 24 * HOUR_ACCURACY_DIV, NO_ACCURACY_DIV = 100000000 * DAY_ACCURACY_DIV; - private static final long[] USEC_ACCURACY_DIV_A = { 1, 10, 100, MILLISEC_ACCURACY_DIV, 10000, - 100000, SEC_ACCURACY_DIV }; + private static final long[] USEC_ACCURACY_DIV_A = { + 1, + 10, + 100, + MILLISEC_ACCURACY_DIV, + 10000, + 100000, + SEC_ACCURACY_DIV + }; private long iAccuracyDivisor = 1; @@ -127,7 +131,7 @@ public class CIMDateTimeInterval extends CIMDateTime { * of the interval (day, hours, minutes, seconds and microseconds). Any * property that has a -1 will make that field "not significant" (i.e. that * field has asterisks in the datetime string). - * + * * @param pDays * Number of days in the interval (-1 - 99999999). * @param pHours @@ -142,7 +146,7 @@ public class CIMDateTimeInterval extends CIMDateTime { * If any value is not valid. */ public CIMDateTimeInterval(int pDays, int pHours, int pMinutes, int pSeconds, int pMicroseconds) - throws IllegalArgumentException { + throws IllegalArgumentException { boolean notSignificant = checkLimits("pDays", pDays, 0, MAX_DAY, false); if (notSignificant) this.iAccuracyDivisor = NO_ACCURACY_DIV; notSignificant = checkLimits("pHours", pHours, 0, MAX_HOUR, notSignificant); @@ -151,8 +155,7 @@ public CIMDateTimeInterval(int pDays, int pHours, int pMinutes, int pSeconds, in if (notSignificant && this.iAccuracyDivisor == 1) this.iAccuracyDivisor = HOUR_ACCURACY_DIV; notSignificant = checkLimits("pSeconds", pSeconds, 0, MAX_SEC, notSignificant); if (notSignificant && this.iAccuracyDivisor == 1) this.iAccuracyDivisor = MIN_ACCURACY_DIV; - notSignificant = checkLimits("pMicroseconds", pMicroseconds, 0, MAX_MICROSEC, - notSignificant); + notSignificant = checkLimits("pMicroseconds", pMicroseconds, 0, MAX_MICROSEC, notSignificant); if (notSignificant) { this.iUnsignificantUSecDigits = 6; if (this.iAccuracyDivisor == 1) this.iAccuracyDivisor = USEC_ACCURACY_DIV_A[this.iUnsignificantUSecDigits]; @@ -166,24 +169,45 @@ public CIMDateTimeInterval(int pDays, int pHours, int pMinutes, int pSeconds, in this.iSeconds = pSeconds; this.iUSeconds = pMicroseconds; - debug("CIMDateTimeInterval(" + pDays + "," + pHours + "," + pMinutes + "," + pSeconds + "," - + pMicroseconds + "): days=" + this.iDays + ", hours=" + this.iHours + ", mins=" - + this.iMinutes + ", secs=" + this.iSeconds + ", usecs=" + this.iUSeconds - + ", acc div=" + this.iAccuracyDivisor + ", unsig digits=" - + this.iUnsignificantUSecDigits); + debug( + "CIMDateTimeInterval(" + + pDays + + "," + + pHours + + "," + + pMinutes + + "," + + pSeconds + + "," + + pMicroseconds + + "): days=" + + this.iDays + + ", hours=" + + this.iHours + + ", mins=" + + this.iMinutes + + ", secs=" + + this.iSeconds + + ", usecs=" + + this.iUSeconds + + ", acc div=" + + this.iAccuracyDivisor + + ", unsig digits=" + + this.iUnsignificantUSecDigits + ); } /** * Constructs a CIMDateTimeInterval using a milliseconds value. - * + * * @param pMilliseconds * Number of milliseconds in the interval (0 - 8639999999999999). * @throws IllegalArgumentException */ public CIMDateTimeInterval(long pMilliseconds) throws IllegalArgumentException { if (pMilliseconds < 0 || pMilliseconds > MAX_INTERVAL) throw new IllegalArgumentException( - "pMilliseconds must be between 0 and " + MAX_INTERVAL + ". " + pMilliseconds - + " is illegal!"); + "pMilliseconds must be between 0 and " + MAX_INTERVAL + ". " + pMilliseconds + " is illegal!" + ); long totalUSecs = pMilliseconds * 1000; long totalSecs = pMilliseconds / 1000; long totalMins = totalSecs / 60; @@ -202,26 +226,39 @@ public CIMDateTimeInterval(long pMilliseconds) throws IllegalArgumentException { this.iTotalMicrosCalced = true; this.iTotalMicros = pMilliseconds * 1000; - debug("CIMDateTimeInterval(" + pMilliseconds + "): days=" + this.iDays + ", hours=" - + this.iHours + ", mins=" + this.iMinutes + ", secs=" + this.iSeconds + ", usecs=" - + this.iUSeconds + ", acc div=" + this.iAccuracyDivisor + ", unsig digits=" - + this.iUnsignificantUSecDigits); + debug( + "CIMDateTimeInterval(" + + pMilliseconds + + "): days=" + + this.iDays + + ", hours=" + + this.iHours + + ", mins=" + + this.iMinutes + + ", secs=" + + this.iSeconds + + ", usecs=" + + this.iUSeconds + + ", acc div=" + + this.iAccuracyDivisor + + ", unsig digits=" + + this.iUnsignificantUSecDigits + ); } /** * Creates a CIMDateTimeInterval object using a string. - * + * * @param pIntervalString * A string in the format of ddddddddHHMMSS.mmmmmm:000. * @throws IllegalArgumentException * If string is not in the correct format or null. */ public CIMDateTimeInterval(String pIntervalString) throws IllegalArgumentException { - if (pIntervalString == null) throw new IllegalArgumentException( - "Null IntervalString is not allowed!"); - if (pIntervalString.length() != LENGTH) throw new IllegalArgumentException("Length of " - + pIntervalString + " must be " + LENGTH + ", " + pIntervalString.length() - + " is not valid!"); + if (pIntervalString == null) throw new IllegalArgumentException("Null IntervalString is not allowed!"); + if (pIntervalString.length() != LENGTH) throw new IllegalArgumentException( + "Length of " + pIntervalString + " must be " + LENGTH + ", " + pIntervalString.length() + " is not valid!" + ); String intervalStr = setAccuracy(pIntervalString); DTStringReader dtReader = new DTStringReader(intervalStr); this.iDays = dtReader.readAndCheck(8, "days", 0, MAX_DAY, true); @@ -234,22 +271,35 @@ public CIMDateTimeInterval(String pIntervalString) throws IllegalArgumentExcepti dtReader.read(':'); int zeros = dtReader.read(3, "zeros", false); if (zeros != 0) { - String msg = "In " + pIntervalString - + " the last 3 characters after ':' must be zeros!"; + String msg = "In " + pIntervalString + " the last 3 characters after ':' must be zeros!"; throw new IllegalArgumentException(msg); } - debug("CIMDateTimeInterval(\"" + pIntervalString + "\"): days=" + this.iDays + ", hours=" - + this.iHours + ", mins=" + this.iMinutes + ", secs=" + this.iSeconds + ", usecs=" - + this.iUSeconds + ", acc div=" + this.iAccuracyDivisor + ", unsig digits=" - + this.iUnsignificantUSecDigits); + debug( + "CIMDateTimeInterval(\"" + + pIntervalString + + "\"): days=" + + this.iDays + + ", hours=" + + this.iHours + + ", mins=" + + this.iMinutes + + ", secs=" + + this.iSeconds + + ", usecs=" + + this.iUSeconds + + ", acc div=" + + this.iAccuracyDivisor + + ", unsig digits=" + + this.iUnsignificantUSecDigits + ); } /** * Compares the CIMDateTimeInterval object with this one. If * either interval has "Not Significant" fields then we only compare the * significant fields. - * + * * @param pObj * The CIMDateTimeInterval to be compared with this * one. @@ -261,14 +311,16 @@ public CIMDateTimeInterval(String pIntervalString) throws IllegalArgumentExcepti */ public int compareTo(CIMDateTime pObj) throws IllegalArgumentException { if (!(pObj instanceof CIMDateTimeInterval)) { - String msg = "This method requires a CIMDateTimeInterval instance, while it has received a " - + (pObj == null ? "null!" : pObj.getClass().getName() + " instance!"); + String msg = + "This method requires a CIMDateTimeInterval instance, while it has received a " + + (pObj == null ? "null!" : pObj.getClass().getName() + " instance!"); throw new IllegalArgumentException(msg); } CIMDateTimeInterval that = (CIMDateTimeInterval) pObj; long accuracyDivisor = Math.max(this.iAccuracyDivisor, that.iAccuracyDivisor); - debug("this.acDiv=" + this.iAccuracyDivisor + ", that.acDiv=" + that.iAccuracyDivisor - + ", acDiv=" + accuracyDivisor); + debug( + "this.acDiv=" + this.iAccuracyDivisor + ", that.acDiv=" + that.iAccuracyDivisor + ", acDiv=" + accuracyDivisor + ); Long thisMicros = Long.valueOf(calcMicros(accuracyDivisor)); Long thatMicros = Long.valueOf(that.calcMicros(accuracyDivisor)); debug("thisUs=" + thisMicros + ", thatUs=" + thatMicros); @@ -277,7 +329,7 @@ public int compareTo(CIMDateTime pObj) throws IllegalArgumentException { /** * Gets the internal string representation of this object. - * + * * @return The internal representation of the * CIMDateTimeInterval object. */ @@ -291,15 +343,14 @@ public String getDateTimeString() { dtWriter.write(2, this.iMinutes); dtWriter.write(2, this.iSeconds); dtWriter.write('.'); - dtWriter.writeUSec(this.iUSeconds / (int) this.iAccuracyDivisor, - this.iUnsignificantUSecDigits); + dtWriter.writeUSec(this.iUSeconds / (int) this.iAccuracyDivisor, this.iUnsignificantUSecDigits); dtWriter.write(":000"); return dtWriter.toString(); } /** * Returns days value of this interval. - * + * * @return If days field "not significant" this returns -1, otherwise * returns number of days in the interval. */ @@ -309,7 +360,7 @@ public int getDays() { /** * Returns hours value of this interval. - * + * * @return If hours field "not significant" this returns -1, otherwise * returns number of hours in the interval. */ @@ -319,7 +370,7 @@ public int getHours() { /** * Returns microseconds value of this interval. - * + * * @return If microseconds field "not significant" this returns -1, * otherwise returns number of microseconds in the interval. */ @@ -329,7 +380,7 @@ public int getMicroseconds() { /** * Returns minutes value of this interval. - * + * * @return If minutes field "not significant" this returns -1, otherwise * returns number of minutes in the interval. */ @@ -339,7 +390,7 @@ public int getMinutes() { /** * Returns seconds value of this interval. - * + * * @return If seconds field "not significant" this returns -1, otherwise * returns number of seconds in the interval. */ @@ -349,7 +400,7 @@ public int getSeconds() { /** * Returns the total length of the interval in milliseconds. - * + * * @return The length of the interval in milliseconds. */ public long getTotalMilliseconds() { @@ -358,7 +409,7 @@ public long getTotalMilliseconds() { /** * Returns the hash code for this object. - * + * * @return A hash code value for this object. * @see java.lang.Object#hashCode() */ @@ -373,7 +424,7 @@ public int hashCode() { * for debugging purposes, and the format of the returned string may vary * between implementations. The returned string may be empty but may not be * null. - * + * * @return String representation of this datetime. */ @Override @@ -383,12 +434,12 @@ public String toString() { // ddddddddHHMMSS.mmmmmm:000 - private static final int DAY_START_IDX = 0, HOUR_START_IDX = 8, MIN_START_IDX = 10, - SEC_START_IDX = 12, DOT_IDX = 14, USEC_START_IDX = 15, UTC_START_IDX = 21, LENGTH = 25; + private static final int DAY_START_IDX = 0, HOUR_START_IDX = 8, MIN_START_IDX = 10, SEC_START_IDX = 12, DOT_IDX = + 14, USEC_START_IDX = 15, UTC_START_IDX = 21, LENGTH = 25; /** * Checks the granularity of the CIMDateTimeAbsolute precision. - * + * * @param pIdx * Index of first asterisk in datetime string. * @param pFieldName @@ -404,31 +455,30 @@ public String toString() { * If field is not completely significant or completely * unsignificant (mix of asterisks and digits). */ - private boolean checkGranularity(int pIdx, String pFieldName, int pFieldStartIdx, - int pNextStartIdx) throws IllegalArgumentException { + private boolean checkGranularity(int pIdx, String pFieldName, int pFieldStartIdx, int pNextStartIdx) + throws IllegalArgumentException { if (pIdx > pFieldStartIdx && pIdx < pNextStartIdx) throw new IllegalArgumentException( - "Partial unsignificant digits are not allowed for field " + pFieldName + " in " - + this.iStr + "!"); + "Partial unsignificant digits are not allowed for field " + pFieldName + " in " + this.iStr + "!" + ); return pIdx == pFieldStartIdx; } /** * Find index of first asterisk within string. - * + * * @param pIvStr * Time interval string. * @return Index of first asterisk or -1 if asterisk does not exist. */ private static int findStar(String pIvStr) { - for (int i = 0; i < UTC_START_IDX; i++) - if (pIvStr.charAt(i) == '*') return i; + for (int i = 0; i < UTC_START_IDX; i++) if (pIvStr.charAt(i) == '*') return i; return -1; } /** * Verify that all characters in the string after the starting index are * asterisks. - * + * * @param pIvStr * Time interval string. * @param pStartIdx @@ -437,16 +487,21 @@ private static int findStar(String pIvStr) { private static void checkStars(String pIvStr, int pStartIdx) { for (int i = pStartIdx; i < UTC_START_IDX; i++) { char ch = pIvStr.charAt(i); - if (i != DOT_IDX && ch != '*') throw new IllegalArgumentException("In " + pIvStr - + " every digit character after the first '*' character must " + "be '*', '" - + ch + "' is invalid!"); + if (i != DOT_IDX && ch != '*') throw new IllegalArgumentException( + "In " + + pIvStr + + " every digit character after the first '*' character must " + + "be '*', '" + + ch + + "' is invalid!" + ); } } /** * Determines the accuracy (precision) of the interval string and replaces * all asterisks in microsecond field with zeros. - * + * * @param pIntervalStr * Time interval string. * @return Corrected time interval string with iAccuracyDivisor @@ -482,7 +537,8 @@ private String setAccuracy(String pIntervalStr) throws IllegalArgumentException for (int i = startIdx; i < UTC_START_IDX; i++) { if (i == DOT_IDX) continue; if (this.iStr.charAt(i) != '*') throw new IllegalArgumentException( - "All remaining digits must be marked as unsignificant in " + this.iStr + " !"); + "All remaining digits must be marked as unsignificant in " + this.iStr + " !" + ); buf[i] = '0'; } return new String(buf); @@ -490,7 +546,7 @@ private String setAccuracy(String pIntervalStr) throws IllegalArgumentException /** * Get total microseconds of CIMDateTimeInterval object. - * + * * @return Total microseconds of time interval. */ private long getTotalMicros() { @@ -503,16 +559,27 @@ private long getTotalMicros() { if (this.iMinutes > 0) this.iTotalMicros += MIN_ACCURACY_DIV * this.iMinutes; if (this.iHours > 0) this.iTotalMicros += HOUR_ACCURACY_DIV * this.iHours; if (this.iDays > 0) this.iTotalMicros += DAY_ACCURACY_DIV * this.iDays; - debug("days=" + this.iDays + " ,hours=" + this.iHours + " ,mins=" + this.iMinutes - + ", secs=" + this.iSeconds + ", usecs=" + this.iUSeconds + ", totalMicros=" - + this.iTotalMicros); + debug( + "days=" + + this.iDays + + " ,hours=" + + this.iHours + + " ,mins=" + + this.iMinutes + + ", secs=" + + this.iSeconds + + ", usecs=" + + this.iUSeconds + + ", totalMicros=" + + this.iTotalMicros + ); return this.iTotalMicros; } /** * Calculates microseconds of CIMDateTimeInterval object taking * accuracy (precision) into consideration. - * + * * @param pAccuracyDivisor * Accuracy divisor of time interval. * @return Total microseconds of time interval rounded down to precision. @@ -526,7 +593,7 @@ private long calcMicros(long pAccuracyDivisor) { * Checks validity of time interval field, making sure value is between * minimum and maximum values and is not significant if following an * unsignifcant field. - * + * * @param pName * Name of field. * @param pValue @@ -541,23 +608,25 @@ private long calcMicros(long pAccuracyDivisor) { * otherwise. * @throws IllegalArgumentException */ - private static boolean checkLimits(String pName, int pValue, int pLow, int pHigh, - boolean pNotSignificant) throws IllegalArgumentException { + private static boolean checkLimits(String pName, int pValue, int pLow, int pHigh, boolean pNotSignificant) + throws IllegalArgumentException { if (pValue == -1) return true; if (pNotSignificant) throw new IllegalArgumentException( - "Not significant fields must be followed by not significant fields!"); - if (pValue < pLow || pValue > pHigh) throw new IllegalArgumentException(pName - + " must be between " + pLow + " and " + pHigh + ". " + pValue + " is invalid!"); + "Not significant fields must be followed by not significant fields!" + ); + if (pValue < pLow || pValue > pHigh) throw new IllegalArgumentException( + pName + " must be between " + pLow + " and " + pHigh + ". " + pValue + " is invalid!" + ); return false; } /** * Prints debug message. - * + * * @param pMsg * Debug message. */ private static void debug(String pMsg) { - // System.out.println(pMsg); + // System.out.println(pMsg); } } diff --git a/src/main/java/org/metricshub/wbem/javax/cim/CIMElement.java b/src/main/java/org/metricshub/wbem/javax/cim/CIMElement.java index 27888fa..ba02dc0 100644 --- a/src/main/java/org/metricshub/wbem/javax/cim/CIMElement.java +++ b/src/main/java/org/metricshub/wbem/javax/cim/CIMElement.java @@ -58,14 +58,13 @@ * >DSP004). */ public abstract class CIMElement extends Object implements Serializable, Comparable { - private static final long serialVersionUID = -3310480832682118922L; private String iName; /** * Creates a new CIM element with the given name. - * + * * @param pName * The string for the name of the element. * @throws IllegalArgumentException @@ -78,7 +77,7 @@ public CIMElement(String pName) { /** * Compares this element name to the CIMElement passed in. - * + * * @param pObj * The CIMElement to be compared. * @return A negative integer, zero, or a positive integer as this object is @@ -95,7 +94,7 @@ public int compareTo(CIMElement pObj) { * CIM element. Otherwise, it returns false. Useful for * comparing two CIM elements, for example, to determine whether a CIM * element exists in a Collection. - * + * * @param pObj * The object to be compared a CIM element. * @return true indicates the specified CIM element equals this @@ -104,14 +103,15 @@ public int compareTo(CIMElement pObj) { */ @Override public boolean equals(Object pObj) { - if (pObj instanceof CIMElement) { return this.iName - .equalsIgnoreCase(((CIMElement) pObj).iName); } + if (pObj instanceof CIMElement) { + return this.iName.equalsIgnoreCase(((CIMElement) pObj).iName); + } return false; } /** * Returns a string representing the name of a CIM element instance. - * + * * @return The name of this CIM element. */ public String getName() { @@ -122,7 +122,7 @@ public String getName() { * Returns a hash code value for the CIM element. This method is supported * for the benefit of hashtables such as those provided by * java.util.Hashtable. - * + * * @return A hash code value for this CIM element. */ @Override @@ -136,7 +136,7 @@ public int hashCode() { * debugging purposes. The format of the returned string may vary between * implementations. The returned string may be empty but may not be * null - * + * * @return String representation of this CIM element. */ @Override diff --git a/src/main/java/org/metricshub/wbem/javax/cim/CIMFlavor.java b/src/main/java/org/metricshub/wbem/javax/cim/CIMFlavor.java index fd9faac..6f152ce 100644 --- a/src/main/java/org/metricshub/wbem/javax/cim/CIMFlavor.java +++ b/src/main/java/org/metricshub/wbem/javax/cim/CIMFlavor.java @@ -54,7 +54,6 @@ * rules specify how qualifiers are transmitted from classes to derived classes. */ public class CIMFlavor extends Object implements Serializable { - private static final long serialVersionUID = -4177389103635687939l; /** @@ -77,11 +76,10 @@ public class CIMFlavor extends Object implements Serializable { /** * Returns an array of possible flavors. - * + * * @return All possible flavors. */ public static int[] getFlavors() { return flavors; } - } diff --git a/src/main/java/org/metricshub/wbem/javax/cim/CIMInstance.java b/src/main/java/org/metricshub/wbem/javax/cim/CIMInstance.java index 3380ff9..cd7c846 100644 --- a/src/main/java/org/metricshub/wbem/javax/cim/CIMInstance.java +++ b/src/main/java/org/metricshub/wbem/javax/cim/CIMInstance.java @@ -51,7 +51,6 @@ import java.io.Serializable; import java.util.ArrayList; import java.util.logging.Level; - import org.metricshub.wbem.sblim.cimclient.internal.cim.CIMElementSorter; import org.metricshub.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; import org.metricshub.wbem.sblim.cimclient.internal.util.MOF; @@ -66,7 +65,6 @@ * >DSP004). */ public class CIMInstance extends Object implements CIMNamedElementInterface, Serializable { - private static final long serialVersionUID = -249160087013230559L; private static final CIMProperty[] EMPTY_PROP_A = new CIMProperty[0]; @@ -78,7 +76,7 @@ public class CIMInstance extends Object implements CIMNamedElementInterface, Ser /** * Constructs a CIMInstance object using the name and * properties specified. - * + * * @param pName * The CIMObjectPath for this * CIMInstance. @@ -92,8 +90,7 @@ public class CIMInstance extends Object implements CIMNamedElementInterface, Ser * cost of the verification. Some implementations may leave it * up to the developer to ensure that the values match. */ - public CIMInstance(CIMObjectPath pName, CIMProperty[] pProps) - throws IllegalArgumentException { + public CIMInstance(CIMObjectPath pName, CIMProperty[] pProps) throws IllegalArgumentException { if (pName == null) { String msg = "CIMObjectPath parameter cannot be null!"; // TODO: tracing @@ -117,7 +114,7 @@ public CIMInstance(CIMObjectPath pName, CIMProperty[] pProps) /** * Returns a CIMInstance with the updated * CIMObjectPath. - * + * * @param pPath * The complete CIMObjectPath for this instance. * @return A new CIMInstance with the updated @@ -130,7 +127,7 @@ public CIMInstance deriveInstance(CIMObjectPath pPath) { /** * Returns a CIMInstance with the updated values for the * properties in pPropA. Any new properties are ignored. - * + * * @param pPropA * The array of properties to update. * @return A new instance with the updated properties. @@ -138,8 +135,7 @@ public CIMInstance deriveInstance(CIMObjectPath pPath) { public CIMInstance deriveInstance(CIMProperty[] pPropA) { if (pPropA == null || pPropA.length == 0) return this; CIMProperty[] newPropA = new CIMProperty[getPropertyCount()]; - for (int i = 0; i < newPropA.length; i++) - newPropA[i] = this.iProps[i]; + for (int i = 0; i < newPropA.length; i++) newPropA[i] = this.iProps[i]; for (int i = 0; i < pPropA.length; i++) { CIMProperty newProp = pPropA[i]; int idx = CIMElementSorter.findIdx(newPropA, newProp.getName()); @@ -150,16 +146,28 @@ public CIMInstance deriveInstance(CIMProperty[] pPropA) { * the referenced class name due to derivation */ if (!typesEqual(oldProp, newProp)) { - LogAndTraceBroker.getBroker().trace( + LogAndTraceBroker + .getBroker() + .trace( Level.FINE, - "CIMInstance.deriveInstance() can update only property " - + "values but not property types!\n" + "original property: " - + oldProp + "\nnew property: " + newProp); + "CIMInstance.deriveInstance() can update only property " + + "values but not property types!\n" + + "original property: " + + oldProp + + "\nnew property: " + + newProp + ); continue; } - newPropA[idx] = new CIMProperty(oldProp.getName(), newProp.getDataType(), - newProp.getValue(), oldProp.isKey(), oldProp.isPropagated(), oldProp - .getOriginClass()); + newPropA[idx] = + new CIMProperty( + oldProp.getName(), + newProp.getDataType(), + newProp.getValue(), + oldProp.isKey(), + oldProp.isPropagated(), + oldProp.getOriginClass() + ); } return new CIMInstance(this.iObjPath, newPropA); } @@ -168,7 +176,7 @@ public CIMInstance deriveInstance(CIMProperty[] pPropA) { * Indicates whether some other instance is equal to this one. Two * CIMInstances are considered equal if the names are the same. * This method does NOT compare each property value. - * + * * @param pObj * The object to compare. * @return true if the specified path references the same @@ -185,7 +193,7 @@ public boolean equals(Object pObj) { * This method returns a new CIMInstance with properties * filtered according to the input parameters. Inclusion of class origin and * qualifiers can also be controlled. - * + * * @param pLocalOnly * Include only the properties values that were instantiated in * this instance. @@ -205,24 +213,30 @@ public boolean equals(Object pObj) { * invalid property names, they are ignored. * @return CIMInstance matching the input filter. */ - public CIMInstance filterProperties(boolean pLocalOnly, boolean pIncludeClassOrigin, - String[] pPropertyList) { + public CIMInstance filterProperties(boolean pLocalOnly, boolean pIncludeClassOrigin, String[] pPropertyList) { StringSorter.sort(pPropertyList); ArrayList> propAList = new ArrayList>(); for (int i = 0; i < getPropertyCount(); i++) { CIMProperty prop = getProperty(i); if (pLocalOnly && prop.isPropagated()) continue; if (pPropertyList != null && !StringSorter.find(pPropertyList, prop.getName())) continue; - propAList.add(new CIMProperty(prop.getName(), prop.getDataType(), prop - .getValue(), prop.isKey(), prop.isPropagated(), pIncludeClassOrigin ? prop - .getOriginClass() : null)); + propAList.add( + new CIMProperty( + prop.getName(), + prop.getDataType(), + prop.getValue(), + prop.isKey(), + prop.isPropagated(), + pIncludeClassOrigin ? prop.getOriginClass() : null + ) + ); } return new CIMInstance(this.iObjPath, propAList.toArray(EMPTY_PROP_A)); } /** * Get the name of the class that instantiates this CIM instance. - * + * * @return Name of class that instantiates this CIM instance. */ public String getClassName() { @@ -231,7 +245,7 @@ public String getClassName() { /** * Get the key properties for this instance. - * + * * @return An array of key properties. */ public CIMProperty[] getKeys() { @@ -240,7 +254,7 @@ public CIMProperty[] getKeys() { /** * Returns the CIMObjectPath that represents this instance. - * + * * @return The CIMObjectPath that represents this instance. */ public CIMObjectPath getObjectPath() { @@ -249,7 +263,7 @@ public CIMObjectPath getObjectPath() { /** * Retrieve an array of the properties for this instance. - * + * * @return An array of the CIM properties for this instance. */ public CIMProperty[] getProperties() { @@ -258,7 +272,7 @@ public CIMProperty[] getProperties() { /** * Get a class property by index. - * + * * @param pIndex * The index of the class property to retrieve. * @return The CIMProperty at the specified index. @@ -270,7 +284,7 @@ public CIMProperty getProperty(int pIndex) throws ArrayIndexOutOfBoundsExcept /** * Returns the specified property. - * + * * @param pName * The text string for the name of the property. * @return The property requested or null if the property does @@ -282,7 +296,7 @@ public CIMProperty getProperty(String pName) { /** * Returns the specified CIMProperty. - * + * * @param pName * The string name of the property to get. * @param pOriginClass @@ -301,7 +315,7 @@ public CIMProperty getProperty(String pName, String pOriginClass) { /** * Get the number of properties defined in this CIMInstance. - * + * * @return The number of properties defined in the CIMInstance. */ public int getPropertyCount() { @@ -310,7 +324,7 @@ public int getPropertyCount() { /** * Returns the value of a property of this CIM Instance. - * + * * @param name * The name of the property. * @return The value for the specified property name or null if @@ -325,7 +339,7 @@ public Object getPropertyValue(String name) { * Computes the hash code for this instance. The hash code will be the * object path of the instance not including the host or namespace * information. - * + * * @return The integer representing the hash code for this object path. */ @Override @@ -339,7 +353,7 @@ public int hashCode() { * debugging purposes, and the format of the returned string may vary * between implementations. The returned string may be empty but may not be * null. - * + * * @return String representation of this instance. */ @Override @@ -349,7 +363,7 @@ public String toString() { /** * Indicates whether the data types of the two properties are equal. - * + * * @param pProp0 * First property. *@param pProp1 @@ -360,7 +374,5 @@ public String toString() { private static boolean typesEqual(CIMProperty pProp0, CIMProperty pProp1) { CIMDataType type0 = pProp0.getDataType(), type1 = pProp0.getDataType(); return type0.getType() == type1.getType() && type0.isArray() == type1.isArray(); - } - } diff --git a/src/main/java/org/metricshub/wbem/javax/cim/CIMMethod.java b/src/main/java/org/metricshub/wbem/javax/cim/CIMMethod.java index 0c4624c..93dcae3 100644 --- a/src/main/java/org/metricshub/wbem/javax/cim/CIMMethod.java +++ b/src/main/java/org/metricshub/wbem/javax/cim/CIMMethod.java @@ -50,7 +50,6 @@ */ import java.util.Arrays; - import org.metricshub.wbem.sblim.cimclient.internal.cim.CIMElementSorter; import org.metricshub.wbem.sblim.cimclient.internal.cim.CIMQualifiedElementInterfaceImpl; import org.metricshub.wbem.sblim.cimclient.internal.util.MOF; @@ -62,12 +61,11 @@ * Specification (DSP004). - * + * * @param * Type parameter. */ public class CIMMethod extends CIMTypedElement implements CIMQualifiedElementInterface { - private static final long serialVersionUID = -3920536802046705977L; private CIMQualifiedElementInterfaceImpl iQualiImpl; @@ -81,7 +79,7 @@ public class CIMMethod extends CIMTypedElement implements CIMQualifiedElement /** * Constructs a CIMMethod object with the specified * information. - * + * * @param pName * The name of the method. * @param pType @@ -95,8 +93,14 @@ public class CIMMethod extends CIMTypedElement implements CIMQualifiedElement * @param pOriginClass * The class this method was defined or overridden in. */ - public CIMMethod(String pName, CIMDataType pType, CIMQualifier[] pQualis, - CIMParameter[] pParams, boolean pPropagated, String pOriginClass) { + public CIMMethod( + String pName, + CIMDataType pType, + CIMQualifier[] pQualis, + CIMParameter[] pParams, + boolean pPropagated, + String pOriginClass + ) { super(pName, pType); this.iQualiImpl = new CIMQualifiedElementInterfaceImpl(pQualis, false, true); this.iParams = (CIMParameter[]) CIMElementSorter.sort(pParams); @@ -109,7 +113,7 @@ public CIMMethod(String pName, CIMDataType pType, CIMQualifier[] pQualis, * true if and only if the argument is not null * and is a CIMMethod object that represents the same value as * this object. - * + * * @param pObj * The object to compare. * @return true if the objects are the same; false @@ -127,7 +131,7 @@ public boolean equals(Object pObj) { /** * Returns a CIMMethod filtered as specified. - * + * * @param pIncludeQualifiers * If true all qualifiers are returned; otherwise no * qualifiers. @@ -142,7 +146,7 @@ public CIMMethod filter(boolean pIncludeQualifiers, boolean pIncludeClassOrig /** * Returns a CIMMethod filtered as specified. - * + * * @param pIncludeQualifiers * If true all qualifiers are returned; otherwise no * qualifiers. @@ -152,19 +156,23 @@ public CIMMethod filter(boolean pIncludeQualifiers, boolean pIncludeClassOrig * @param pLocalOnly * If true only the qualifiers defined on this class * are included; otherwise all qualifiers are included. - * + * * @return A filtered CIMMethod. */ - public CIMMethod filter(boolean pIncludeQualifiers, boolean pIncludeClassOrigin, - boolean pLocalOnly) { - return new CIMMethod(getName(), getDataType(), pIncludeQualifiers ? this.iQualiImpl - .getQualifiers(pLocalOnly) : null, this.iParams, this.iPropagated, - pIncludeClassOrigin ? this.iOriginClass : null); + public CIMMethod filter(boolean pIncludeQualifiers, boolean pIncludeClassOrigin, boolean pLocalOnly) { + return new CIMMethod( + getName(), + getDataType(), + pIncludeQualifiers ? this.iQualiImpl.getQualifiers(pLocalOnly) : null, + this.iParams, + this.iPropagated, + pIncludeClassOrigin ? this.iOriginClass : null + ); } /** * Returns the class name in which this method was defined or overridden. - * + * * @return Name of class where this property was defined. */ public String getOriginClass() { @@ -173,7 +181,7 @@ public String getOriginClass() { /** * Get the parameter that matches the specified name. - * + * * @param pName * The name of the CIMParameter to retrieve. * @return CIMParameter matching the name specified; otherwise @@ -185,7 +193,7 @@ public CIMParameter getParameter(String pName) { /** * Returns an array of the parameters for this method. - * + * * @return The parameters for this method. */ public CIMParameter[] getParameters() { @@ -194,7 +202,7 @@ public CIMParameter[] getParameters() { /** * Get a qualifier by index. - * + * * @param pIndex * The index of the qualifier. * @return The Qualifier at index pIndex. @@ -206,7 +214,7 @@ public CIMQualifier getQualifier(int pIndex) throws ArrayIndexOutOfBoundsExce /** * Gets a qualifier by name. - * + * * @param pName * The name of the qualifier to get. * @return null if the qualifier does not exist, otherwise @@ -218,7 +226,7 @@ public CIMQualifier getQualifier(String pName) { /** * Get the number of qualifiers defined for this CIM Method. - * + * * @return The number of qualifiers. */ public int getQualifierCount() { @@ -227,7 +235,7 @@ public int getQualifierCount() { /** * Returns the list of qualifiers for this class. - * + * * @return Qualifiers for this class. */ public CIMQualifier[] getQualifiers() { @@ -236,7 +244,7 @@ public CIMQualifier[] getQualifiers() { /** * Gets a qualifier value by name. - * + * * @param pName * The name of the qualifier to get. * @return null if the qualifier does not exist or value is @@ -250,7 +258,7 @@ public Object getQualifierValue(String pName) { /** * Checks whether the specified qualifier is one of the qualifiers in this * CIM method. - * + * * @param pName * The name of the qualifier. * @return true if the qualifier exists in this CIM method, @@ -265,7 +273,7 @@ public boolean hasQualifier(String pName) { * for this method with the specified value. This method will return * false if the qualifier is not applied or if the value does * not match. - * + * * @param pName * The name of the qualifier. * @param pValue @@ -279,7 +287,7 @@ public boolean hasQualifierValue(String pName, Object pValue) { /** * Determines if this method is Propagated. - * + * * @return true if this method is propagated. */ public boolean isPropagated() { @@ -292,12 +300,11 @@ public boolean isPropagated() { * debugging purposes, and the format of the returned string may vary * between implementations. The returned string may be empty but may not be * null. - * + * * @return The string representation of this method. */ @Override public String toString() { return MOF.methodDeclaration(this, MOF.EMPTY); } - } diff --git a/src/main/java/org/metricshub/wbem/javax/cim/CIMNamedElementInterface.java b/src/main/java/org/metricshub/wbem/javax/cim/CIMNamedElementInterface.java index 7b78352..b7c498b 100644 --- a/src/main/java/org/metricshub/wbem/javax/cim/CIMNamedElementInterface.java +++ b/src/main/java/org/metricshub/wbem/javax/cim/CIMNamedElementInterface.java @@ -48,12 +48,10 @@ * can be retrieved by a WBEM client. */ public interface CIMNamedElementInterface { - /** * Retrieve the ObjectPath that represents the name for this element. - * + * * @return The Object Path that represents the element. */ CIMObjectPath getObjectPath(); - } diff --git a/src/main/java/org/metricshub/wbem/javax/cim/CIMObjectPath.java b/src/main/java/org/metricshub/wbem/javax/cim/CIMObjectPath.java index 3db7a92..f395b8f 100644 --- a/src/main/java/org/metricshub/wbem/javax/cim/CIMObjectPath.java +++ b/src/main/java/org/metricshub/wbem/javax/cim/CIMObjectPath.java @@ -63,7 +63,6 @@ import java.net.MalformedURLException; import java.net.URL; import java.util.Arrays; - import org.metricshub.wbem.sblim.cimclient.internal.cim.CIMElementSorter; import org.metricshub.wbem.sblim.cimclient.internal.uri.BooleanValue; import org.metricshub.wbem.sblim.cimclient.internal.uri.CharValue; @@ -118,7 +117,6 @@ * CreationClassName=My_ComputerSystem */ public class CIMObjectPath extends Object implements Serializable { - private static final long serialVersionUID = 4593259690658425064L; private String iScheme, iHost, iPort, iNamespace, iObjectName, iXmlSchemaName; @@ -128,17 +126,16 @@ public class CIMObjectPath extends Object implements Serializable { /** * Class TypeValuePair represents a type-value pair with special * identification functionality for integer and real numbers. - * + * */ private static class TypeValuePair { - private CIMDataType iType; private Object iValue; /** * Constructs a type-value pair with the specified type and value. - * + * * @param pType * Type. * @param pValue @@ -151,7 +148,7 @@ public TypeValuePair(CIMDataType pType, Object pValue) { /** * Constructs a type-value pair with the specified integer value. - * + * * @param intVal * Integer value. */ @@ -174,7 +171,6 @@ public TypeValuePair(IntegerValue intVal) { this.iType = CIMDataType.SINT64_T; this.iValue = Long.valueOf(intVal.longValue()); } - } else { // unsigned integers switch (intVal.getBitWidth()) { case 8: @@ -198,7 +194,7 @@ public TypeValuePair(IntegerValue intVal) { /** * Constructs a type-value pair with the specified real value. - * + * * @param pRealVal * Real value. */ @@ -215,7 +211,7 @@ public TypeValuePair(RealValue pRealVal) { /** * Returns the type of the type-value pair. - * + * * @return Type of type-value pair. */ public CIMDataType getType() { @@ -224,18 +220,17 @@ public CIMDataType getType() { /** * Returns the value of the type-value pair. - * + * * @return Value of type-value pair. */ public Object getValue() { return this.iValue; } - } /** * Extracts and returns sorted list of key-value pairs from the URI. - * + * * @param pURI * The Uniform Resource Identifier. * @return Sorted array of keys in URI. @@ -256,24 +251,20 @@ private CIMProperty[] getKeysFromURI(URI pURI) { CIMObjectPath op = new CIMObjectPath(refVal.getRef()); typeValue = new TypeValuePair(new CIMDataType(op.getObjectName()), op); } else if (uriVal instanceof BooleanValue) { - typeValue = new TypeValuePair(CIMDataType.BOOLEAN_T, ((BooleanValue) uriVal) - .getBoolean()); + typeValue = new TypeValuePair(CIMDataType.BOOLEAN_T, ((BooleanValue) uriVal).getBoolean()); } else if (uriVal instanceof CharValue) { - typeValue = new TypeValuePair(CIMDataType.CHAR16_T, ((CharValue) uriVal) - .getCharacter()); + typeValue = new TypeValuePair(CIMDataType.CHAR16_T, ((CharValue) uriVal).getCharacter()); } else if (uriVal instanceof IntegerValue) { typeValue = new TypeValuePair((IntegerValue) uriVal); } else if (uriVal instanceof RealValue) { typeValue = new TypeValuePair((RealValue) uriVal); } else if (uriVal instanceof DateTimeValue) { - typeValue = new TypeValuePair(CIMDataType.DATETIME_T, ((DateTimeValue) uriVal) - .getDateTime()); + typeValue = new TypeValuePair(CIMDataType.DATETIME_T, ((DateTimeValue) uriVal).getDateTime()); } else { // TODO: error or warning tracing typeValue = new TypeValuePair(CIMDataType.INVALID_T, null); } - keys[i] = new CIMProperty(name, typeValue.getType(), typeValue.getValue(), - true, false, null); + keys[i] = new CIMProperty(name, typeValue.getType(), typeValue.getValue(), true, false, null); } return (CIMProperty[]) CIMElementSorter.sort(keys); } @@ -281,7 +272,7 @@ private CIMProperty[] getKeysFromURI(URI pURI) { /** * Initializes the elements of the CIMObjectPath from the given * URI. - * + * * @param pURI * The Uniform Resource Identifier. */ @@ -297,7 +288,7 @@ private void setURI(URI pURI) { /** * Constructs a CIM Object Path referencing an instance of the specified CIM * element in the given URI. - * + * * @param pURI * The Uniform Resource Identifier. */ @@ -320,7 +311,7 @@ private CIMObjectPath(URI pURI) { * //myserver.org/root/cimv2:My_ComputerSystem
      * /root/cimv2:My_ComputerSystem * - * + * * @param pObjectPath * The string representation of an object path for a CIM element * that will be parsed and used to initialize the object. @@ -332,8 +323,7 @@ public CIMObjectPath(String pObjectPath) { URI uri; if (pObjectPath == null) throw new IllegalArgumentException("ObjectPath is null!"); - if (pObjectPath.trim().length() == 0) throw new IllegalArgumentException( - "ObjectPath is empty!"); + if (pObjectPath.trim().length() == 0) throw new IllegalArgumentException("ObjectPath is empty!"); try { uri = URI.parse(pObjectPath); @@ -344,11 +334,15 @@ public CIMObjectPath(String pObjectPath) { try { uri = URI.parseRef(new URIString(pObjectPath), true); } catch (IllegalArgumentException asTypedRef) { - String msg = "Parsing of ObjectPath string has failed!\n" - + "Nested error messages:\n" + "When parsing as normal URI string:\n" - + asURI.getMessage() + "When parsing as untyped reference:\n" - + asUntypedRef.getMessage() + "When parsing as typed reference:\n" - + asTypedRef.getMessage(); + String msg = + "Parsing of ObjectPath string has failed!\n" + + "Nested error messages:\n" + + "When parsing as normal URI string:\n" + + asURI.getMessage() + + "When parsing as untyped reference:\n" + + asUntypedRef.getMessage() + + "When parsing as typed reference:\n" + + asTypedRef.getMessage(); // TODO: tracing throw new IllegalArgumentException(msg); } @@ -368,7 +362,7 @@ public CIMObjectPath(String pObjectPath) { * preceding '/' in the namespace parameter. For example, OpenPegasus will * accept "root/cimv2" as a namespace but will not accept * "/root/cimv2". - * + * * @param pScheme * The connection scheme to the host (e.g. http, https, ...) * @param pHost @@ -383,17 +377,23 @@ public CIMObjectPath(String pObjectPath) { * The keys and their corresponding values that identify an * instance of the CIM element. */ - public CIMObjectPath(String pScheme, String pHost, String pPort, String pNamespace, - String pObjectName, CIMProperty[] pKeys) { + public CIMObjectPath( + String pScheme, + String pHost, + String pPort, + String pNamespace, + String pObjectName, + CIMProperty[] pKeys + ) { this.iScheme = pScheme; this.iHost = pHost; this.iPort = pPort; this.iNamespace = pNamespace; this.iObjectName = pObjectName; if (pKeys != null) { - for (int i = 0; i < pKeys.length; i++) - if (!pKeys[i].isKey()) throw new IllegalArgumentException( - "All CIMObjectPath properties must be keys!"); + for (int i = 0; i < pKeys.length; i++) if (!pKeys[i].isKey()) throw new IllegalArgumentException( + "All CIMObjectPath properties must be keys!" + ); } this.iKeys = (CIMProperty[]) CIMElementSorter.sort(pKeys); } @@ -409,7 +409,7 @@ public CIMObjectPath(String pScheme, String pHost, String pPort, String pNamespa * preceding '/' in the namespace parameter. For example, OpenPegasus will * accept "root/cimv2" as a namespace but will not accept * "/root/cimv2". - * + * * @param pScheme * The connection scheme to the host (e.g. http, https, ...) * @param pHost @@ -427,8 +427,15 @@ public CIMObjectPath(String pScheme, String pHost, String pPort, String pNamespa * The name of the XML Schema for this object. This is only * needed for protocols that require this information. */ - public CIMObjectPath(String pScheme, String pHost, String pPort, String pNamespace, - String pObjectName, CIMProperty[] pKeys, String pXmlSchemaName) { + public CIMObjectPath( + String pScheme, + String pHost, + String pPort, + String pNamespace, + String pObjectName, + CIMProperty[] pKeys, + String pXmlSchemaName + ) { this(pScheme, pHost, pPort, pNamespace, pObjectName, pKeys); if (pXmlSchemaName != null) { try { @@ -443,7 +450,7 @@ public CIMObjectPath(String pScheme, String pHost, String pPort, String pNamespa /** * Compares this CIM object path with the specified CIM object path for * equality. - * + * * @param pObj * The object to compare to this CIM object path. Only the model * paths are compared. @@ -461,13 +468,14 @@ private boolean equalsWorker(Object pObj, boolean pIncludeNamespacePath) { // hostname information is not any longer part of the comparison, since // there is no reliable way to attach hostnames if (pIncludeNamespacePath) { - boolean namespaceEqual = (this.iNamespace == null ? that.iNamespace == null - : this.iNamespace.equalsIgnoreCase(that.iNamespace)); + boolean namespaceEqual = + (this.iNamespace == null ? that.iNamespace == null : this.iNamespace.equalsIgnoreCase(that.iNamespace)); if (!namespaceEqual) return false; } - return (this.iObjectName == null ? that.iObjectName == null : this.iObjectName - .equalsIgnoreCase(that.iObjectName)) - && keysEqual(that); + return ( + (this.iObjectName == null ? that.iObjectName == null : this.iObjectName.equalsIgnoreCase(that.iObjectName)) && + keysEqual(that) + ); } /** @@ -476,7 +484,7 @@ private boolean equalsWorker(Object pObj, boolean pIncludeNamespacePath) { *
      * NOTE: CIMProperty.equals() shouldn't be used for keys, * because the XML doesn't contain originClass and propagated information. - * + * * @param pThat * The object path whose keys are to be compared to this CIM * object path's keys. @@ -490,14 +498,16 @@ private boolean keysEqual(CIMObjectPath pThat) { if (this.iKeys.length != pThat.iKeys.length) return false; for (int i = 0; i < this.iKeys.length; i++) { CIMProperty thisKey = this.iKeys[i], thatKey = pThat.iKeys[i]; - if (!equals(thisKey, thatKey)) { return false; } + if (!equals(thisKey, thatKey)) { + return false; + } } return true; } /** * Compares two properties for equality. - * + * * @param pThis * First property. * @param pThat @@ -506,20 +516,23 @@ private boolean keysEqual(CIMObjectPath pThat) { * otherwise. */ private boolean equals(CIMProperty pThis, CIMProperty pThat) { - if (pThis.getDataType() != null && pThis.getDataType().isArray()) { return ncEqualsIC(pThis - .getName(), pThat.getName()) - && ncEquals(pThis.getDataType(), pThat.getDataType()) - && Arrays.equals((Object[]) pThis.getValue(), (Object[]) pThat.getValue()); - + if (pThis.getDataType() != null && pThis.getDataType().isArray()) { + return ( + ncEqualsIC(pThis.getName(), pThat.getName()) && + ncEquals(pThis.getDataType(), pThat.getDataType()) && + Arrays.equals((Object[]) pThis.getValue(), (Object[]) pThat.getValue()) + ); } - return ncEqualsIC(pThis.getName(), pThat.getName()) - && ncEquals(pThis.getDataType(), pThat.getDataType()) - && ncEquals(pThis.getValue(), pThat.getValue()); + return ( + ncEqualsIC(pThis.getName(), pThat.getName()) && + ncEquals(pThis.getDataType(), pThat.getDataType()) && + ncEquals(pThis.getValue(), pThat.getValue()) + ); } /** * Compares two objects for equality. - * + * * @param pThis * First object. * @param pThat @@ -533,7 +546,7 @@ private boolean ncEquals(Object pThis, Object pThat) { /** * Compares two strings for equality, ignoring case. - * + * * @param pThis * First string. * @param pThat @@ -550,7 +563,7 @@ private boolean ncEqualsIC(String pThis, String pThat) { * the model path includes references, then the references will also be * compared for the model path (i.e. the namespace part of the object path * will be ignored). - * + * * @param pModelPath * The object to compare. * @return true if the specified path references the same @@ -562,7 +575,7 @@ public boolean equalsModelPath(CIMObjectPath pModelPath) { /** * Gets the host. - * + * * @return The name of the host. */ public String getHost() { @@ -571,7 +584,7 @@ public String getHost() { /** * Gets a key property by name. - * + * * @param pName * The name of the key property to retrieve. * @return The CIMProperty with the given name, or @@ -583,7 +596,7 @@ public CIMProperty getKey(String pName) { /** * Gets all key properties. - * + * * @return The container of key properties. */ public CIMProperty[] getKeys() { @@ -602,7 +615,7 @@ public Object getKeyValue(String pName) { /** * Gets the namespace. - * + * * @return The name of the namespace. */ public String getNamespace() { @@ -612,7 +625,7 @@ public String getNamespace() { /** * Gets the object name. Depending on the type of CIM element referenced, * this may be either a class name or a qualifier type name. - * + * * @return The name of this CIM element. */ public String getObjectName() { @@ -621,7 +634,7 @@ public String getObjectName() { /** * Gets the the port on the host to which the connection was established. - * + * * @return The port on the host. */ public String getPort() { @@ -630,7 +643,7 @@ public String getPort() { /** * Get the connection scheme. - * + * * @return The connection scheme (e.g. http, https,...) */ public String getScheme() { @@ -639,7 +652,7 @@ public String getScheme() { /** * Get the XML Schema for this object (optional). - * + * * @return The XML Schema name. */ public String getXmlSchemaName() { @@ -648,7 +661,7 @@ public String getXmlSchemaName() { /** * Computes the hash code for this object path. - * + * * @return The integer representing the hash code for this object path. */ @Override @@ -661,12 +674,11 @@ public int hashCode() { * method is intended to be used only for debugging purposes. The format of * the value returned may vary between implementations. The string returned * may be empty but may not be null. - * + * * @return A string representation of this CIM object path. */ @Override public String toString() { return MOF.objectHandle(this, false, false); } - } diff --git a/src/main/java/org/metricshub/wbem/javax/cim/CIMParameter.java b/src/main/java/org/metricshub/wbem/javax/cim/CIMParameter.java index b1c6d22..9ec83a0 100644 --- a/src/main/java/org/metricshub/wbem/javax/cim/CIMParameter.java +++ b/src/main/java/org/metricshub/wbem/javax/cim/CIMParameter.java @@ -62,14 +62,13 @@ * Infrastructure Specification (DSP004). To invoke a method, you would use CIMArgument. - * + * * @param * Type parameter. - * + * * @see CIMMethod */ public class CIMParameter extends CIMTypedElement implements CIMQualifiedElementInterface { - private static final long serialVersionUID = -4741931597423829396L; private CIMQualifiedElementInterfaceImpl iQualiImpl; @@ -79,7 +78,7 @@ public class CIMParameter extends CIMTypedElement implements CIMQualifiedElem * data type and qualifiers. Takes a string for the name of an existing CIM * parameter and creates a new instance of a CIM parameter, using the name * and identifier of the existing CIM parameter. - * + * * @param pName * Name of this parameter. * @param pType @@ -97,7 +96,7 @@ public CIMParameter(String pName, CIMDataType pType, CIMQualifier[] pQualifie * true if and only if the argument is not null * and is a CIMParameter object that represents the same value * as this object. - * + * * @param pObj * The object to compare. * @return true if the objects are the same; false @@ -113,7 +112,7 @@ public boolean equals(Object pObj) { /** * Returns a CIMParameter filtered as specified. - * + * * @param pIncludeQualifiers * If true all qualifiers are returned; otherwise no * qualifiers. @@ -123,13 +122,16 @@ public boolean equals(Object pObj) { * @return A filtered CIMParameter. */ public CIMParameter filter(boolean pIncludeQualifiers, boolean pLocalOnly) { - return new CIMParameter(getName(), getDataType(), pIncludeQualifiers ? this.iQualiImpl - .getQualifiers(pLocalOnly) : null); + return new CIMParameter( + getName(), + getDataType(), + pIncludeQualifiers ? this.iQualiImpl.getQualifiers(pLocalOnly) : null + ); } /** * Get a qualifier by index. - * + * * @param pIndex * The index of the qualifier. * @return The Qualifier at index pIndex. @@ -141,7 +143,7 @@ public CIMQualifier getQualifier(int pIndex) throws ArrayIndexOutOfBoundsExce /** * Gets a qualifier by name. - * + * * @param pName * The name of the qualifier to get. * @return null if the qualifier does not exist, otherwise @@ -153,7 +155,7 @@ public CIMQualifier getQualifier(String pName) { /** * Get the number of qualifiers defined for this CIM Parameter. - * + * * @return The number of qualifiers. */ public int getQualifierCount() { @@ -162,7 +164,7 @@ public int getQualifierCount() { /** * Returns the list of qualifiers for this class. - * + * * @return Qualifiers for this class. */ public CIMQualifier[] getQualifiers() { @@ -171,7 +173,7 @@ public CIMQualifier[] getQualifiers() { /** * Gets a qualifier value by name. - * + * * @param pName * The name of the qualifier to get. * @return null if the qualifier does not exist or value is @@ -185,7 +187,7 @@ public Object getQualifierValue(String pName) { /** * Checks whether the specified qualifier is one of the qualifiers in this * CIM element. - * + * * @param pName * The name of the qualifier. * @return true if the qualifier exists in this CIM parameter, @@ -200,7 +202,7 @@ public boolean hasQualifier(String pName) { * for this parameter with the specified value. This method will return * false if the qualifier is not applied or if the value does * not match. - * + * * @param pName * The name of the qualifier. * @param pValue @@ -218,12 +220,11 @@ public boolean hasQualifierValue(String pName, Object pValue) { * debugging purposes, and the format of the returned string may vary * between implementations. The returned string may be empty but may not be * null. - * + * * @return String representation of this parameter. */ @Override public String toString() { return MOF.parameter(this, MOF.EMPTY); } - } diff --git a/src/main/java/org/metricshub/wbem/javax/cim/CIMProperty.java b/src/main/java/org/metricshub/wbem/javax/cim/CIMProperty.java index c37c0c5..7f203e8 100644 --- a/src/main/java/org/metricshub/wbem/javax/cim/CIMProperty.java +++ b/src/main/java/org/metricshub/wbem/javax/cim/CIMProperty.java @@ -58,12 +58,11 @@ * is a key property (used as part of the name of the CIM element), a flag to * signify whether it was propagated from a parent class and the class origin * information (where the property was originally defined). - * + * * @param * Type parameter. */ public class CIMProperty extends CIMValuedElement { - private static final long serialVersionUID = -4741931597423829396L; private boolean iKey, iPropagated; @@ -75,7 +74,7 @@ public class CIMProperty extends CIMValuedElement { * CIMClass, CIMClassProperty shall be used. This * can only be used for non-Key properties, non-propagated properties and * when the the origin class is not needed. - * + * * @param pName * The name of the property. * @param pType @@ -90,7 +89,7 @@ public CIMProperty(String pName, CIMDataType pType, E pValue) { /** * Constructs a CIMProperty to be used in instances. For a * CIMClass, CIMClassProperty shall be used. - * + * * @param pName * The name of the property. * @param pType @@ -105,8 +104,14 @@ public CIMProperty(String pName, CIMDataType pType, E pValue) { * @param pOriginClass * The class in which this property was defined or overridden. */ - public CIMProperty(String pName, CIMDataType pType, E pValue, boolean pKey, - boolean pPropagated, String pOriginClass) { + public CIMProperty( + String pName, + CIMDataType pType, + E pValue, + boolean pKey, + boolean pPropagated, + String pOriginClass + ) { super(pName, pType, pValue); this.iKey = pKey; this.iPropagated = pPropagated; @@ -118,7 +123,7 @@ public CIMProperty(String pName, CIMDataType pType, E pValue, boolean pKey, * true if and only if the argument is not null * and is a CIMProperty that represents the same name, type and * value as this object. - * + * * @param pObj * The object to compare with. * @return true if the objects are the same; false @@ -129,15 +134,16 @@ public boolean equals(Object pObj) { if (!(pObj instanceof CIMProperty)) return false; if (!super.equals(pObj)) return false; CIMProperty that = (CIMProperty) pObj; - return this.iKey == that.iKey - && this.iPropagated == that.iPropagated - && (this.iOriginClass == null ? that.iOriginClass == null : this.iOriginClass - .equalsIgnoreCase(that.iOriginClass)); + return ( + this.iKey == that.iKey && + this.iPropagated == that.iPropagated && + (this.iOriginClass == null ? that.iOriginClass == null : this.iOriginClass.equalsIgnoreCase(that.iOriginClass)) + ); } /** * Returns the class in which this property was defined or overridden. - * + * * @return Name of class where this property was defined. */ public String getOriginClass() { @@ -146,7 +152,7 @@ public String getOriginClass() { /** * Convenience method for determining if this property is a Key. - * + * * @return true if this property is a key. */ public boolean isKey() { @@ -157,11 +163,10 @@ public boolean isKey() { * Determines if this property is Propagated. When this property is part of * a class, this value designates that the class origin value is the same as * the class name. - * + * * @return true if this property is propagated. */ public boolean isPropagated() { return this.iPropagated; } - } diff --git a/src/main/java/org/metricshub/wbem/javax/cim/CIMQualifiedElementInterface.java b/src/main/java/org/metricshub/wbem/javax/cim/CIMQualifiedElementInterface.java index 5097df7..f7f7f76 100644 --- a/src/main/java/org/metricshub/wbem/javax/cim/CIMQualifiedElementInterface.java +++ b/src/main/java/org/metricshub/wbem/javax/cim/CIMQualifiedElementInterface.java @@ -48,10 +48,9 @@ * CIM Parameters are all CIM Elements that have qualifiers. */ public interface CIMQualifiedElementInterface { - /** * Get a qualifier by index. - * + * * @param pIndex * The index of the qualifier. * @return The Qualifier at index pIndex. @@ -60,7 +59,7 @@ public interface CIMQualifiedElementInterface { /** * Gets a qualifier by name. - * + * * @param pName * The name of the qualifier to get. * @return null if the qualifier does not exist, otherwise @@ -70,21 +69,21 @@ public interface CIMQualifiedElementInterface { /** * Get the number of qualifiers defined for this CIM Element. - * + * * @return The number of qualifiers. */ public int getQualifierCount(); /** * Returns the list of qualifiers for this class. - * + * * @return Qualifiers for this class. */ public CIMQualifier[] getQualifiers(); /** * Gets a qualifier value by name. - * + * * @param pName * The name of the qualifier to get. * @return null if the qualifier does not exist or value is @@ -96,7 +95,7 @@ public interface CIMQualifiedElementInterface { /** * Checks whether the specified qualifier is one of the qualifiers in this * CIM element. - * + * * @param pName * The name of the qualifier. * @return true if the qualifier exists in this CIM element, @@ -109,7 +108,7 @@ public interface CIMQualifiedElementInterface { * for this property with the specified value. This method will return * false if the qualifier is not applied or if the value does * not match. - * + * * @param pName * The name of the qualifier. * @param pValue @@ -118,5 +117,4 @@ public interface CIMQualifiedElementInterface { * otherwise false. */ public boolean hasQualifierValue(String pName, Object pValue); - } diff --git a/src/main/java/org/metricshub/wbem/javax/cim/CIMQualifier.java b/src/main/java/org/metricshub/wbem/javax/cim/CIMQualifier.java index 0e0051f..667db18 100644 --- a/src/main/java/org/metricshub/wbem/javax/cim/CIMQualifier.java +++ b/src/main/java/org/metricshub/wbem/javax/cim/CIMQualifier.java @@ -60,13 +60,12 @@ * qualifier type must have the same name and data type. CIM Qualifiers can only * be applied to elements that are allowed by the scope defined by the CIM * Qualifier Type. - * + * * @param * Type parameter. * @see CIMQualifierType */ public class CIMQualifier extends CIMValuedElement { - private static final long serialVersionUID = 3568987946093931214L; private int iFlavor; @@ -76,7 +75,7 @@ public class CIMQualifier extends CIMValuedElement { /** * Constructs a CIM qualifier with the specified name, type, value, and * flavors. - * + * * @param pName * The name of the qualifier. * @param pType @@ -97,7 +96,7 @@ public CIMQualifier(String pName, CIMDataType pType, E pValue, int pFlavor) { /** * Constructs a CIM qualifier with the specified name, type, value, and * flavors. - * + * * @param pName * The name of the qualifier. * @param pType @@ -114,8 +113,7 @@ public CIMQualifier(String pName, CIMDataType pType, E pValue, int pFlavor) { * false otherwise. * @see CIMFlavor */ - public CIMQualifier(String pName, CIMDataType pType, E pValue, int pFlavor, - boolean pIsPropagated) { + public CIMQualifier(String pName, CIMDataType pType, E pValue, int pFlavor, boolean pIsPropagated) { super(pName, pType, pValue); this.iFlavor = pFlavor; this.iPropagated = pIsPropagated; @@ -127,7 +125,7 @@ public CIMQualifier(String pName, CIMDataType pType, E pValue, int pFlavor, * the argument is not null and is a CIMQualifier * that represents the same name, type and value as this * CIMQualifier. - * + * * @param pObj * The object to compare. * @return true if the input qualifier is equal, otherwise @@ -143,7 +141,7 @@ public boolean equals(Object pObj) { /** * Returns the CIM flavors for this CIM qualifier. - * + * * @return A BitSet of CIM flavors in this CIM qualifier. */ public int getFlavor() { @@ -154,7 +152,7 @@ public int getFlavor() { * Determines if this qualifier is propagated. If the qualifier was * inherited, this value will be true. If the qualifier was * applied to the element directly, this value will be false. - * + * * @return true if this property is propagated; * false otherwise. */ @@ -168,12 +166,11 @@ public boolean isPropagated() { * debugging purposes, and the format of the returned string may vary * between implementations. The returned string may be empty but may not be * null. - * + * * @return A string representation of this qualifier. */ @Override public String toString() { return MOF.qualifier(this); } - } diff --git a/src/main/java/org/metricshub/wbem/javax/cim/CIMQualifierType.java b/src/main/java/org/metricshub/wbem/javax/cim/CIMQualifierType.java index 7cad6a2..4c0802b 100644 --- a/src/main/java/org/metricshub/wbem/javax/cim/CIMQualifierType.java +++ b/src/main/java/org/metricshub/wbem/javax/cim/CIMQualifierType.java @@ -67,7 +67,7 @@ *
    • Flavors - The flavors applicable to this qualifier type. * Flavors describe the propagation and override rules for a qualifier.
    • * - * + * * @param * Type parameter. * @see CIMScope @@ -75,7 +75,6 @@ * @see CIMQualifier */ public class CIMQualifierType extends CIMValuedElement implements CIMNamedElementInterface { - private static final long serialVersionUID = -4563643521754840535L; private CIMObjectPath iObjPath; @@ -85,7 +84,7 @@ public class CIMQualifierType extends CIMValuedElement implements CIMNamed /** * Constructs a new CIM qualifier type, using the name, type of the * specified CIM qualifier type. - * + * * @param pPath * The CIMObjectPath of a CIM qualifier type. * @param pType @@ -99,8 +98,8 @@ public class CIMQualifierType extends CIMValuedElement implements CIMNamed * @throws IllegalArgumentException * If the value/data type does not match. */ - public CIMQualifierType(CIMObjectPath pPath, CIMDataType pType, E pValue, int pScope, - int pFlavor) throws IllegalArgumentException { + public CIMQualifierType(CIMObjectPath pPath, CIMDataType pType, E pValue, int pScope, int pFlavor) + throws IllegalArgumentException { super(pPath == null ? null : pPath.getObjectName(), pType, pValue); this.iObjPath = pPath; this.iScope = pScope; @@ -112,7 +111,7 @@ public CIMQualifierType(CIMObjectPath pPath, CIMDataType pType, E pValue, int pS * true if and only if the argument is not null * and is a CIMQualifierType object that represents the same * value as this object. - * + * * @param pObj * The object to compare. * @return true if the specified object it is the same as this @@ -128,7 +127,7 @@ public boolean equals(Object pObj) { /** * Returns the flavors of this qualifier type as a BitSet. - * + * * @return BitSet of flavors for this qualifier type. */ public int getFlavor() { @@ -137,7 +136,7 @@ public int getFlavor() { /** * Get the object path for this CIMQualifierType. - * + * * @return The CIMObjectPath that represents this qualifier * type. */ @@ -147,7 +146,7 @@ public CIMObjectPath getObjectPath() { /** * Returns the scopes of this qualifier type as a bit set. - * + * * @return Bit set of CIM element scopes for which this qualifier type is * applicable. */ @@ -161,12 +160,11 @@ public int getScope() { * debugging purposes, and the format of the returned string may vary * between implementations. The returned string may be empty but may not be * null. - * + * * @return A string representation of this qualifier type. */ @Override public String toString() { return MOF.qualifierDeclaration(this); } - } diff --git a/src/main/java/org/metricshub/wbem/javax/cim/CIMScope.java b/src/main/java/org/metricshub/wbem/javax/cim/CIMScope.java index f0c082d..f898d54 100644 --- a/src/main/java/org/metricshub/wbem/javax/cim/CIMScope.java +++ b/src/main/java/org/metricshub/wbem/javax/cim/CIMScope.java @@ -53,7 +53,6 @@ * what elements the qualifier can be applied to. */ public class CIMScope extends Object implements Serializable { - private static final long serialVersionUID = -4563643521754840535l; /** @@ -96,16 +95,14 @@ public class CIMScope extends Object implements Serializable { */ public static final int REFERENCE = 16; - private static final int[] SCOPES = { ANY, ASSOCIATION, CLASS, INDICATION, METHOD, PARAMETER, - PROPERTY, REFERENCE }; + private static final int[] SCOPES = { ANY, ASSOCIATION, CLASS, INDICATION, METHOD, PARAMETER, PROPERTY, REFERENCE }; /** * Returns the complete set of possible scopes. - * + * * @return An int array of all scopes. */ public static int[] getScopes() { return SCOPES; } - } diff --git a/src/main/java/org/metricshub/wbem/javax/cim/CIMTypedElement.java b/src/main/java/org/metricshub/wbem/javax/cim/CIMTypedElement.java index 2a42582..fdfe782 100644 --- a/src/main/java/org/metricshub/wbem/javax/cim/CIMTypedElement.java +++ b/src/main/java/org/metricshub/wbem/javax/cim/CIMTypedElement.java @@ -51,7 +51,6 @@ * element that contains just the data type, but no value. */ public abstract class CIMTypedElement extends CIMElement { - private static final long serialVersionUID = -8839964536590822815L; private CIMDataType iType; @@ -59,7 +58,7 @@ public abstract class CIMTypedElement extends CIMElement { /** * Constructs a CIMTypedElement with the given name and data * type. - * + * * @param pName * Name of the element. * @param pType @@ -75,7 +74,7 @@ public CIMTypedElement(String pName, CIMDataType pType) { * true if and only if the argument is not null * and is a CIMTypedElement that represents the same name and * type as this object. - * + * * @param pObj * The object to compare with. * @return true if the objects are the same; false @@ -91,7 +90,7 @@ public boolean equals(Object pObj) { /** * Returns the CIMDataType for this CIM Element. - * + * * @return CIMDataType of this CIM element. */ public CIMDataType getDataType() { @@ -102,7 +101,7 @@ public CIMDataType getDataType() { * Returns a hash code value for the CIM typed element. This method is * supported for the benefit of hashtables such as those provided by * java.util.Hashtable. - * + * * @return A hash code value for this CIM typed element. */ @Override @@ -115,7 +114,7 @@ public int hashCode() { * method is intended to be used only for debugging purposes, and the format * of the returned string may vary between implementations. The returned * string may be empty but may not be null. - * + * * @return String representation of this element. */ @Override diff --git a/src/main/java/org/metricshub/wbem/javax/cim/CIMValuedElement.java b/src/main/java/org/metricshub/wbem/javax/cim/CIMValuedElement.java index 9e4f5f6..2b46061 100644 --- a/src/main/java/org/metricshub/wbem/javax/cim/CIMValuedElement.java +++ b/src/main/java/org/metricshub/wbem/javax/cim/CIMValuedElement.java @@ -46,26 +46,24 @@ */ import java.util.Arrays; - import org.metricshub.wbem.sblim.cimclient.internal.util.MOF; //Sync'd against JSR48 1.0.0 javadoc (version 1.7.0_03) on Tue Dec 10 07:02:50 EST 2013 /** * CIMValuedElement is a base class used by any element that * contains a name, type and value. - * + * * @param * Type parameter. */ public abstract class CIMValuedElement extends CIMTypedElement { - private static final long serialVersionUID = 4234L; private E iValue; /** * Creates a new CIM element with the given name, type and value. - * + * * @param pName * The string for the name for this element. * @param pType @@ -78,7 +76,6 @@ public abstract class CIMValuedElement extends CIMTypedElement { */ protected CIMValuedElement(String pName, CIMDataType pType, E pValue) { super(pName, pType); - if (pType != null && pValue != null) { CIMDataType valueDataType; try { @@ -88,8 +85,8 @@ protected CIMValuedElement(String pName, CIMDataType pType, E pValue) { valueDataType = null; } if (valueDataType != null && valueDataType.getType() != pType.getType()) throw new IllegalArgumentException( - "CIM value does not match type: " + valueDataType.getType() + " != " - + pType.getType()); + "CIM value does not match type: " + valueDataType.getType() + " != " + pType.getType() + ); } this.iValue = pValue; @@ -100,7 +97,7 @@ protected CIMValuedElement(String pName, CIMDataType pType, E pValue) { * true if and only if the argument is not null * and is a CIMValuedElement that represents the same name, * type and value as this object. - * + * * @param pObj * The object to compare with. * @return true if the objects are the same; false @@ -111,14 +108,15 @@ public boolean equals(Object pObj) { if (!(pObj instanceof CIMValuedElement)) return false; CIMValuedElement that = (CIMValuedElement) pObj; if (!super.equals(that)) return false; - if (getDataType().isArray()) { return Arrays.equals((Object[]) this.iValue, - (Object[]) that.iValue); } + if (getDataType().isArray()) { + return Arrays.equals((Object[]) this.iValue, (Object[]) that.iValue); + } return this.iValue == null ? that.iValue == null : this.iValue.equals(that.iValue); } /** * Returns the value for this CIM Element. - * + * * @return The value of the CIM Element. null is a valid value. */ public E getValue() { @@ -129,7 +127,7 @@ public E getValue() { * Returns a hash code value for the CIM valued element. This method is * supported for the benefit of hashtables such as those provided by * java.util.Hashtable. - * + * * @return A hash code value for this CIM valued element. */ @Override @@ -142,12 +140,11 @@ public int hashCode() { * method is intended to be used only for debugging purposes, and the format * of the returned string may vary between implementations. The returned * string may be empty but may not be null. - * + * * @return String representation of this element. */ @Override public String toString() { return MOF.valuedElement(this, MOF.EMPTY); } - } diff --git a/src/main/java/org/metricshub/wbem/javax/cim/UnsignedInteger16.java b/src/main/java/org/metricshub/wbem/javax/cim/UnsignedInteger16.java index 433742b..b767aa1 100644 --- a/src/main/java/org/metricshub/wbem/javax/cim/UnsignedInteger16.java +++ b/src/main/java/org/metricshub/wbem/javax/cim/UnsignedInteger16.java @@ -56,7 +56,6 @@ * >DSP004). */ public class UnsignedInteger16 extends Number implements Comparable { - private static final long serialVersionUID = -4992164525643467216L; /** @@ -74,7 +73,7 @@ public class UnsignedInteger16 extends Number implements Comparablenull. */ public int compareTo(UnsignedInteger16 pOther) { - if (pOther == null) throw new IllegalArgumentException( - "Other UnsignedInteger16 cannot be null!"); + if (pOther == null) throw new IllegalArgumentException("Other UnsignedInteger16 cannot be null!"); UnsignedInteger16 that = pOther; int d = this.iValue - that.iValue; if (d == 0) return 0; @@ -146,7 +144,7 @@ public int compareTo(UnsignedInteger16 pOther) { * true if and only if the argument is not null and is an * UnsignedInteger16 object that represents the same value as * this object. - * + * * @param pObj * The object to compare. * @return true if the objects are the same; false @@ -160,7 +158,7 @@ public boolean equals(Object pObj) { /** * Returns the value of this unsigned integer object as a byte. - * + * * @return The byte value of this unsigned integer object. */ @Override @@ -171,7 +169,7 @@ public byte byteValue() { /** * Returns the value of this unsigned integer object as a * double. - * + * * @return Value of this unsigned integer object as a double. */ @Override @@ -182,7 +180,7 @@ public double doubleValue() { /** * Returns the value of this unsigned integer object as a float * . - * + * * @return Value of this unsigned integer object as a float. */ @Override @@ -192,7 +190,7 @@ public float floatValue() { /** * Computes the hash code for this unsigned integer object. - * + * * @return The integer representing the hash code for this unsigned integer * object. */ @@ -203,7 +201,7 @@ public int hashCode() { /** * Returns the value of this unsigned integer object as an int. - * + * * @return Value of this unsigned integer object as an int. */ @Override @@ -213,7 +211,7 @@ public int intValue() { /** * Returns the value of this unsigned integer object as a long. - * + * * @return Value of this unsigned integer object as a long. */ @Override @@ -224,7 +222,7 @@ public long longValue() { /** * Returns the value of this unsigned integer object as a short * . - * + * * @return Value of this unsigned integer object as a short. */ @Override @@ -234,12 +232,11 @@ public short shortValue() { /** * Returns the text representation of this unsigned integer object. - * + * * @return Text representation of this unsigned integer. */ @Override public String toString() { return Integer.toString(this.iValue); } - } diff --git a/src/main/java/org/metricshub/wbem/javax/cim/UnsignedInteger32.java b/src/main/java/org/metricshub/wbem/javax/cim/UnsignedInteger32.java index 7722dce..426ffee 100644 --- a/src/main/java/org/metricshub/wbem/javax/cim/UnsignedInteger32.java +++ b/src/main/java/org/metricshub/wbem/javax/cim/UnsignedInteger32.java @@ -56,7 +56,6 @@ * >DSP004). */ public class UnsignedInteger32 extends Number implements Comparable { - private static final long serialVersionUID = -8861436527534071393L; /** @@ -74,7 +73,7 @@ public class UnsignedInteger32 extends Number implements Comparablenull. */ public int compareTo(UnsignedInteger32 pOther) { - if (pOther == null) throw new IllegalArgumentException( - "Other UnsignedInteger32 cannot be null!"); + if (pOther == null) throw new IllegalArgumentException("Other UnsignedInteger32 cannot be null!"); UnsignedInteger32 that = pOther; long d = this.iValue - that.iValue; if (d == 0) return 0; @@ -145,7 +143,7 @@ public int compareTo(UnsignedInteger32 pOther) { * Compares this object against the specified object. The result is * true if and only if the argument is not null and is an * UnsignedInteger32 object that represents the same value as this object. - * + * * @param pObj * The object to compare. * @return true if the objects are the same; false @@ -159,7 +157,7 @@ public boolean equals(Object pObj) { /** * Returns the value of this unsigned integer object as a byte. - * + * * @return The byte value of this unsigned integer object. */ @Override @@ -170,7 +168,7 @@ public byte byteValue() { /** * Returns the value of this unsigned integer object as a * double. - * + * * @return Value of this unsigned integer object as a double. */ @Override @@ -181,7 +179,7 @@ public double doubleValue() { /** * Returns the value of this unsigned integer object as a float * . - * + * * @return Value of this unsigned integer object as a float. */ @Override @@ -191,7 +189,7 @@ public float floatValue() { /** * Computes the hash code for this unsigned integer object. - * + * * @return The integer representing the hash code for this unsigned integer * object. */ @@ -202,7 +200,7 @@ public int hashCode() { /** * Returns the value of this unsigned integer object as an int. - * + * * @return Value of this unsigned integer object as an int. */ @Override @@ -212,7 +210,7 @@ public int intValue() { /** * Returns the value of this unsigned integer object as a long. - * + * * @return Value of this unsigned integer object as a long. */ @Override @@ -223,7 +221,7 @@ public long longValue() { /** * Returns the value of this unsigned integer object as a short * . - * + * * @return Value of this unsigned integer object as a short. */ @Override @@ -233,12 +231,11 @@ public short shortValue() { /** * Returns the text representation of this unsigned integer object. - * + * * @return Text representation of this unsigned integer. */ @Override public String toString() { return Long.toString(this.iValue); } - } diff --git a/src/main/java/org/metricshub/wbem/javax/cim/UnsignedInteger64.java b/src/main/java/org/metricshub/wbem/javax/cim/UnsignedInteger64.java index ced03b6..7d72fa0 100644 --- a/src/main/java/org/metricshub/wbem/javax/cim/UnsignedInteger64.java +++ b/src/main/java/org/metricshub/wbem/javax/cim/UnsignedInteger64.java @@ -57,7 +57,6 @@ * >DSP004). */ public class UnsignedInteger64 extends Number implements Comparable { - private static final long serialVersionUID = -3734165689168941119L; /** @@ -75,7 +74,7 @@ public class UnsignedInteger64 extends Number implements ComparableBigInteger. Only the lower 64 bits are considered. - * + * * @param pValue * The BigInteger to be represented as an unsigned * 64-bit integer. @@ -109,7 +108,7 @@ public UnsignedInteger64(BigInteger pValue) throws NumberFormatException { /** * Constructs an unsigned 64-bit integer object for the specified array of * bytes. Only the lower 64 bits are considered. - * + * * @param pValue * The byte array to be represented as an unsigned 64-bit * integer. @@ -126,7 +125,7 @@ public UnsignedInteger64(byte[] pValue) throws NumberFormatException { /** * Constructs an unsigned 64-bit integer object from the specified string. * Only the lower 64 bits are considered. - * + * * @param pValue * The string to be represented as an unsigned 64-bit integer. * @throws NumberFormatException @@ -141,7 +140,7 @@ public UnsignedInteger64(String pValue) throws NumberFormatException { /** * Get the value as a BigInteger. - * + * * @return BigInteger representation of this object. */ public BigInteger bigIntegerValue() { @@ -152,7 +151,7 @@ public BigInteger bigIntegerValue() { * Compares this object with the specified object for order. Returns a * negative integer, zero, or a positive integer as this object is less * than, equal to, or greater than the specified object. - * + * * @param pOther * The Object to be compared. * @return A negative integer, zero, or a positive integer as this object is @@ -164,8 +163,7 @@ public BigInteger bigIntegerValue() { * If value is null. */ public int compareTo(UnsignedInteger64 pOther) { - if (pOther == null) throw new IllegalArgumentException( - "Other UnsignedInteger64 cannot be null!"); + if (pOther == null) throw new IllegalArgumentException("Other UnsignedInteger64 cannot be null!"); UnsignedInteger64 that = pOther; int d = this.iValue.compareTo(that.iValue); if (d == 0) return 0; @@ -177,7 +175,7 @@ public int compareTo(UnsignedInteger64 pOther) { * true if and only if the argument is not null * and is an UnsignedInteger64 object that represents the same * value as this object. - * + * * @param pOther * The object to compare. * @return true if the objects are the same; false @@ -191,7 +189,7 @@ public boolean equals(Object pOther) { /** * Returns the value of this unsigned integer object as a byte. - * + * * @return The byte value of this unsigned integer object. */ @Override @@ -202,7 +200,7 @@ public byte byteValue() { /** * Returns the value of this unsigned integer object as a * double. - * + * * @return Value of this unsigned integer object as a double. */ @Override @@ -213,7 +211,7 @@ public double doubleValue() { /** * Returns the value of this unsigned integer object as a float * . - * + * * @return Value of this unsigned integer object as a float. */ @Override @@ -223,7 +221,7 @@ public float floatValue() { /** * Computes the hash code for this unsigned integer object. - * + * * @return The integer representing the hash code for this unsigned integer * object. */ @@ -234,7 +232,7 @@ public int hashCode() { /** * Returns the value of this unsigned integer object as an int. - * + * * @return Value of this unsigned integer object as an int. */ @Override @@ -244,7 +242,7 @@ public int intValue() { /** * Returns the value of this unsigned integer object as a long. - * + * * @return Value of this unsigned integer object as a long. */ @Override @@ -255,7 +253,7 @@ public long longValue() { /** * Returns the value of this unsigned integer object as a short * . - * + * * @return Value of this unsigned integer object as a short. */ @Override @@ -265,12 +263,11 @@ public short shortValue() { /** * Returns the text representation of this unsigned integer object. - * + * * @return Text representation of this unsigned integer. */ @Override public String toString() { return this.iValue.toString(); } - } diff --git a/src/main/java/org/metricshub/wbem/javax/cim/UnsignedInteger8.java b/src/main/java/org/metricshub/wbem/javax/cim/UnsignedInteger8.java index 9b97880..fc72da7 100644 --- a/src/main/java/org/metricshub/wbem/javax/cim/UnsignedInteger8.java +++ b/src/main/java/org/metricshub/wbem/javax/cim/UnsignedInteger8.java @@ -57,7 +57,6 @@ * >DSP004). */ public class UnsignedInteger8 extends Number implements Comparable { - private static final long serialVersionUID = 4392496278679167896L; /** @@ -75,7 +74,7 @@ public class UnsignedInteger8 extends Number implements Comparablenull. */ public int compareTo(UnsignedInteger8 pOther) { - if (pOther == null) throw new IllegalArgumentException( - "Other UnsignedInteger8 cannot be null!"); + if (pOther == null) throw new IllegalArgumentException("Other UnsignedInteger8 cannot be null!"); UnsignedInteger8 that = pOther; int d = this.iValue - that.iValue; if (d == 0) return 0; @@ -148,7 +146,7 @@ public int compareTo(UnsignedInteger8 pOther) { * and only if the argument is not null and is an * UnsignedInteger8 object that represents the same value as * this object. - * + * * @param pObj * The object to compare. * @return true if the objects are the same; false @@ -162,7 +160,7 @@ public boolean equals(Object pObj) { /** * Returns the value of this unsigned integer object as a byte. - * + * * @return The byte value of this unsigned integer object. */ @Override @@ -173,7 +171,7 @@ public byte byteValue() { /** * Returns the value of this unsigned integer object as a * double. - * + * * @return Value of this unsigned integer object as a double. */ @Override @@ -184,7 +182,7 @@ public double doubleValue() { /** * Returns the value of this unsigned integer object as a float * . - * + * * @return Value of this unsigned integer object as a float. */ @Override @@ -194,7 +192,7 @@ public float floatValue() { /** * Computes the hash code for this unsigned integer object. - * + * * @return The integer representing the hash code for this unsigned integer * object. */ @@ -205,7 +203,7 @@ public int hashCode() { /** * Returns the value of this unsigned integer object as an int. - * + * * @return Value of this unsigned integer object as an int. */ @Override @@ -215,7 +213,7 @@ public int intValue() { /** * Returns the value of this unsigned integer object as a long. - * + * * @return Value of this unsigned integer object as a long. */ @Override @@ -226,7 +224,7 @@ public long longValue() { /** * Returns the value of this unsigned integer object as a short * . - * + * * @return Value of this unsigned integer object as a short. */ @Override @@ -236,12 +234,11 @@ public short shortValue() { /** * Returns the text representation of this unsigned integer object. - * + * * @return Text representation of this unsigned integer. */ @Override public String toString() { return Short.toString(this.iValue); } - } diff --git a/src/main/java/org/metricshub/wbem/javax/wbem/CloseableIterator.java b/src/main/java/org/metricshub/wbem/javax/wbem/CloseableIterator.java index e77a71b..59a3bbc 100644 --- a/src/main/java/org/metricshub/wbem/javax/wbem/CloseableIterator.java +++ b/src/main/java/org/metricshub/wbem/javax/wbem/CloseableIterator.java @@ -55,12 +55,11 @@ * throw runtime exceptions, if a consumer receives a runtime exception for one * of these methods they must call getWBEMException() to get the * actual WBEMException. - * + * * @param * Type parameter. */ public interface CloseableIterator extends Iterator { - /** * Closes the Iterator. This allows the underlying * implementation to do any cleanup and disconnect from any source that it @@ -72,9 +71,8 @@ public interface CloseableIterator extends Iterator { * If next() or hasNext() throws a * RuntimeException, this method must be called to get the * WBEMException. - * + * * @return The WBEMException or null if one was not thrown. */ public WBEMException getWBEMException(); - } diff --git a/src/main/java/org/metricshub/wbem/javax/wbem/WBEMException.java b/src/main/java/org/metricshub/wbem/javax/wbem/WBEMException.java index c8f325e..dae941f 100644 --- a/src/main/java/org/metricshub/wbem/javax/wbem/WBEMException.java +++ b/src/main/java/org/metricshub/wbem/javax/wbem/WBEMException.java @@ -62,7 +62,6 @@ * */ public class WBEMException extends Exception { - private static final long serialVersionUID = 1224653110826327234L; /** @@ -221,35 +220,36 @@ public class WBEMException extends Exception { public static final int CIM_ERR_SERVER_LIMITS_EXCEEDED = 27; private static final String[] MESSAGES = new String[] { - /* 00 */"SUCCESS", - /* 01 */"CIM_ERR_FAILED", - /* 02 */"CIM_ERR_ACCESS_DENIED", - /* 03 */"CIM_ERR_INVALID_NAMESPACE", - /* 04 */"CIM_ERR_INVALID_PARAMETER", - /* 05 */"CIM_ERR_INVALID_CLASS", - /* 06 */"CIM_ERR_NOT_FOUND", - /* 07 */"CIM_ERR_NOT_SUPPORTED", - /* 08 */"CIM_ERR_CLASS_HAS_CHILDREN", - /* 09 */"CIM_ERR_CLASS_HAS_INSTANCES", - /* 10 */"CIM_ERR_INVALID_SUPERCLASS", - /* 11 */"CIM_ERR_ALREADY_EXISTS", - /* 12 */"CIM_ERR_NO_SUCH_PROPERTY", - /* 13 */null, - /* 14 */"CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED", - /* 15 */"CIM_ERR_INVALID_QUERY", - /* 16 */"CIM_ERR_METHOD_NOT_AVAILABLE", - /* 17 */"CIM_ERR_METHOD_NOT_FOUND", - /* 18 */null, - /* 19 */"CIM_ERR_INVALID_RESPONSE_DESTINATION", - /* 20 */"CIM_ERR_NAMESPACE_NOT_EMPTY", - /* 21 */"CIM_ERR_INVALID_ENUMERATION_CONTEXT", - /* 22 */"CIM_ERR_INVALID_OPERATION_TIMEOUT", - /* 23 */"CIM_ERR_PULL_HAS_BEEN_ABANDONED", - /* 24 */"CIM_ERR_PULL_CANNOT_BE_ABANDONED", - /* 25 */"CIM_ERR_FILTERED_ENUMERATION_NOT_SUPPORTED", - /* 26 */"CIM_ERR_CONTINUATION_ON_ERROR_NOT_SUPPORTED", - /* 27 */"CIM_ERR_SERVER_LIMITS_EXCEEDED", - /* 28 */"CIM_ERR_SERVER_IS_SHUTTING_DOWN" }; + /* 00 */"SUCCESS", + /* 01 */"CIM_ERR_FAILED", + /* 02 */"CIM_ERR_ACCESS_DENIED", + /* 03 */"CIM_ERR_INVALID_NAMESPACE", + /* 04 */"CIM_ERR_INVALID_PARAMETER", + /* 05 */"CIM_ERR_INVALID_CLASS", + /* 06 */"CIM_ERR_NOT_FOUND", + /* 07 */"CIM_ERR_NOT_SUPPORTED", + /* 08 */"CIM_ERR_CLASS_HAS_CHILDREN", + /* 09 */"CIM_ERR_CLASS_HAS_INSTANCES", + /* 10 */"CIM_ERR_INVALID_SUPERCLASS", + /* 11 */"CIM_ERR_ALREADY_EXISTS", + /* 12 */"CIM_ERR_NO_SUCH_PROPERTY", + /* 13 */null, + /* 14 */"CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED", + /* 15 */"CIM_ERR_INVALID_QUERY", + /* 16 */"CIM_ERR_METHOD_NOT_AVAILABLE", + /* 17 */"CIM_ERR_METHOD_NOT_FOUND", + /* 18 */null, + /* 19 */"CIM_ERR_INVALID_RESPONSE_DESTINATION", + /* 20 */"CIM_ERR_NAMESPACE_NOT_EMPTY", + /* 21 */"CIM_ERR_INVALID_ENUMERATION_CONTEXT", + /* 22 */"CIM_ERR_INVALID_OPERATION_TIMEOUT", + /* 23 */"CIM_ERR_PULL_HAS_BEEN_ABANDONED", + /* 24 */"CIM_ERR_PULL_CANNOT_BE_ABANDONED", + /* 25 */"CIM_ERR_FILTERED_ENUMERATION_NOT_SUPPORTED", + /* 26 */"CIM_ERR_CONTINUATION_ON_ERROR_NOT_SUPPORTED", + /* 27 */"CIM_ERR_SERVER_LIMITS_EXCEEDED", + /* 28 */"CIM_ERR_SERVER_IS_SHUTTING_DOWN" + }; private int iErrorID; @@ -258,7 +258,7 @@ public class WBEMException extends Exception { /** * Constructs a new exception using the specified ID. The detailed message * will be null. - * + * * @param pID * The Error ID to use. * @throws IllegalArgumentException @@ -270,7 +270,7 @@ public WBEMException(int pID) { /** * Constructs a new exception using the specified ID and detailed message. - * + * * @param pID * The error ID. * @param pMessage @@ -285,7 +285,7 @@ public WBEMException(int pID, String pMessage) { /** * Constructs a new exception using the specified ID, detailed message and * CIM_Error instances. - * + * * @param pID * The error ID. * @param pMessage @@ -302,7 +302,7 @@ public WBEMException(int pID, String pMessage, CIMInstance[] pErrors) { /** * Constructs a new exception using the specified ID, detailed message, * CIM_Error instances and cause. - * + * * @param pID * The error ID. * @param pMessage @@ -324,7 +324,7 @@ public WBEMException(int pID, String pMessage, CIMInstance[] pErrors, Throwable /** * Constructs a new exception using the specified detailed message. The * ID will be CIM_ERR_FAILED. - * + * * @param pMessage * The detailed message. */ @@ -334,7 +334,7 @@ public WBEMException(String pMessage) { /** * Get the CIM Error Instances. - * + * * @return Any CIM Error instances associated with this exception; * null if none. */ @@ -344,7 +344,7 @@ public CIMInstance[] getCIMErrors() { /** * Returns the ID of the error. - * + * * @return The ID of the error. */ public int getID() { @@ -353,18 +353,17 @@ public int getID() { /** * Prints out the ID and the optional detailed message. - * + * * @return A String representation of the exception. */ @Override public String toString() { - return "WBEMException: " + getCIMMessage() - + (super.getMessage() != null ? " (" + super.getMessage() + ")" : ""); + return "WBEMException: " + getCIMMessage() + (super.getMessage() != null ? " (" + super.getMessage() + ")" : ""); } /** * Returns a string representation of the exception ID. - * + * * @return A String representation of the exception ID. */ private String getCIMMessage() { @@ -373,10 +372,10 @@ private String getCIMMessage() { /** * Returns validity of error ID. - * + * * @param pID * The error ID. - * + * * @return true if error ID is valid, false * otherwise. */ diff --git a/src/main/java/org/metricshub/wbem/javax/wbem/client/EnumerateResponse.java b/src/main/java/org/metricshub/wbem/javax/wbem/client/EnumerateResponse.java index ee5f83f..9bdf5f4 100644 --- a/src/main/java/org/metricshub/wbem/javax/wbem/client/EnumerateResponse.java +++ b/src/main/java/org/metricshub/wbem/javax/wbem/client/EnumerateResponse.java @@ -42,12 +42,11 @@ //Sync'd against JSR48 1.0.0 javadoc (build 1.5.0_10) on Wed Jan 20 02:20:59 EST 2010 /** * This class is a container that stores the information from a Pull request. - * + * * @param * Type parameter. */ public class EnumerateResponse { - private String iContext; private CloseableIterator iResponses; @@ -56,7 +55,7 @@ public class EnumerateResponse { /** * Creates an EnumerateResponse. - * + * * @param pContext * The enumeration context returned. This will be used for any * future calls for this particular enumeration. @@ -74,7 +73,7 @@ public EnumerateResponse(String pContext, CloseableIterator pResponses, boole /** * Get the context that can be used for a subsequent pull request. - * + * * @return The Enumeration Context returned from the server. */ public String getContext() { @@ -83,7 +82,7 @@ public String getContext() { /** * Get the CloseableIterator for the returned CIM Elements. - * + * * @return CloseableIterator for the elements returned. */ public CloseableIterator getResponses() { @@ -92,14 +91,13 @@ public CloseableIterator getResponses() { /** * If true, there are no more elements to be returned. - * + * * @return true if this is the last of the results; * false otherwise. */ public boolean isEnd() { return this.iEnd; } - /* This iterates over the responses. As a side effect, CloseableIterator.hasNext() will not return anything after this is diff --git a/src/main/java/org/metricshub/wbem/javax/wbem/client/PasswordCredential.java b/src/main/java/org/metricshub/wbem/javax/wbem/client/PasswordCredential.java index 5978798..c37e1d0 100644 --- a/src/main/java/org/metricshub/wbem/javax/wbem/client/PasswordCredential.java +++ b/src/main/java/org/metricshub/wbem/javax/wbem/client/PasswordCredential.java @@ -52,17 +52,16 @@ * is used with UserPrincipal. PasswordCredential * includes the password and optionally the host information for which the * password is used to authenticate the UserPrincipal. - * + * */ public class PasswordCredential extends Object { - private String iPw; private String iHostname; /** * Creates a PasswordCredential using the supplied password. - * + * * @param pCredential * The user login password in clear text. * @throws IllegalArgumentException @@ -78,7 +77,7 @@ public PasswordCredential(char[] pCredential) { /** * Creates a PasswordCredential using the supplied password. - * + * * @param pCredential * The user login password in clear text. * @throws IllegalArgumentException @@ -95,7 +94,7 @@ public PasswordCredential(String pCredential) { /** * Creates a PasswordCredential using the supplied password and * host name. - * + * * @param pCredential * The user login password in clear text. * @param pHostname @@ -115,7 +114,7 @@ public PasswordCredential(String pCredential, String pHostname) { /** * Get the host name for which the password is used to authenticate. - * + * * @return The host name. */ public String getHostName() { @@ -124,11 +123,10 @@ public String getHostName() { /** * Return the user login password in clear text. - * + * * @return The user login password. */ public char[] getUserPassword() { return this.iPw.toCharArray(); } - } diff --git a/src/main/java/org/metricshub/wbem/javax/wbem/client/RoleCredential.java b/src/main/java/org/metricshub/wbem/javax/wbem/client/RoleCredential.java index f87ae5f..2f38a39 100644 --- a/src/main/java/org/metricshub/wbem/javax/wbem/client/RoleCredential.java +++ b/src/main/java/org/metricshub/wbem/javax/wbem/client/RoleCredential.java @@ -55,14 +55,13 @@ * that requires a password. */ public class RoleCredential extends Object { - private String iCredential; private String iHostname; /** * Creates a role credential using the supplied credential. - * + * * @param pCredential * The role credential in clear text. * @throws IllegalArgumentException @@ -75,7 +74,7 @@ public RoleCredential(char[] pCredential) throws IllegalArgumentException { /** * Creates a role credential using the supplied credential. - * + * * @param pCredential * The role credential in clear text. * @throws IllegalArgumentException @@ -88,7 +87,7 @@ public RoleCredential(String pCredential) throws IllegalArgumentException { /** * Creates a role credential using the supplied credential and host name. - * + * * @param pCredential * The role credential in clear text. * @param pHostname @@ -104,7 +103,7 @@ public RoleCredential(String pCredential, String pHostname) throws IllegalArgume /** * Return the role credential in clear text. - * + * * @return The role credential. */ public char[] getCredential() { @@ -113,11 +112,10 @@ public char[] getCredential() { /** * Get the host name for which the password is used to authenticate. - * + * * @return The host name. */ public String getHostName() { return this.iHostname; } - } diff --git a/src/main/java/org/metricshub/wbem/javax/wbem/client/RolePrincipal.java b/src/main/java/org/metricshub/wbem/javax/wbem/client/RolePrincipal.java index 137cb3d..b547524 100644 --- a/src/main/java/org/metricshub/wbem/javax/wbem/client/RolePrincipal.java +++ b/src/main/java/org/metricshub/wbem/javax/wbem/client/RolePrincipal.java @@ -52,14 +52,13 @@ * information for which the role is used to authenticate. */ public class RolePrincipal extends Object implements Principal { - private String iRole; private String iHost; /** * This constructor accepts the role name. - * + * * @param pRole * The role name. */ @@ -69,7 +68,7 @@ public RolePrincipal(String pRole) { /** * This constructor accepts the role name and host name. - * + * * @param pRole * The role name. * @param pHost @@ -85,7 +84,7 @@ public RolePrincipal(String pRole, String pHost) { * same principal as this object. The principals are equal if the specified * object is an instance of RolePrincipal and the user name and * host name are the same. - * + * * @param pObj * The Principal to compare for equality. * @return true if they are equal, otherwise false @@ -95,14 +94,15 @@ public RolePrincipal(String pRole, String pHost) { public boolean equals(Object pObj) { if (!(pObj instanceof RolePrincipal)) return false; RolePrincipal that = (RolePrincipal) pObj; - return (this.iRole == null ? that.iRole == null : this.iRole.equalsIgnoreCase(that.iRole)) - && (this.iHost == null ? that.iHost == null : this.iHost - .equalsIgnoreCase(that.iHost)); + return ( + (this.iRole == null ? that.iRole == null : this.iRole.equalsIgnoreCase(that.iRole)) && + (this.iHost == null ? that.iHost == null : this.iHost.equalsIgnoreCase(that.iHost)) + ); } /** * Get the host for which the principal uses to authenticate. - * + * * @return The host name. */ public String getHostName() { @@ -112,7 +112,7 @@ public String getHostName() { /** * Return the name of this principal identity; that is, return the login * name. - * + * * @return The name of this principal identity. * @see java.security.Principal#getName() */ @@ -123,7 +123,7 @@ public String getName() { /** * The hashCode() method returns an integer hash code to * represent this principal. - * + * * @return An integer hash code representing the principal. */ @Override @@ -135,12 +135,11 @@ public int hashCode() { * The toString() method returns a string representation of the * principal suitable for displaying in messages. It should not be used for * making authorization checks. - * + * * @return A printable string form of the role principal. */ @Override public String toString() { return this.iRole; } - } diff --git a/src/main/java/org/metricshub/wbem/javax/wbem/client/UserPrincipal.java b/src/main/java/org/metricshub/wbem/javax/wbem/client/UserPrincipal.java index d874fe8..df2efad 100644 --- a/src/main/java/org/metricshub/wbem/javax/wbem/client/UserPrincipal.java +++ b/src/main/java/org/metricshub/wbem/javax/wbem/client/UserPrincipal.java @@ -53,14 +53,13 @@ * information for which the username is used to authenticate. */ public class UserPrincipal extends Object implements Principal { - private String iUserName; private String iHostName; /** * This constructor accepts the user name. - * + * * @param pUserName * The user login name. * @throws IllegalArgumentException @@ -73,7 +72,7 @@ public UserPrincipal(String pUserName) throws IllegalArgumentException { /** * This constructor accepts the user name and host name. - * + * * @param pUserName * The user login name. * @param pHostName @@ -92,7 +91,7 @@ public UserPrincipal(String pUserName, String pHostName) throws IllegalArgumentE * principal as this object. The principals are equal if the specified * object is an instance of UserPrincipal and the user name and * authentication host name are the same. - * + * * @param pOtherPrincipal * Principal instance to compare for equality. * @return true if the object are equal; false @@ -102,15 +101,15 @@ public UserPrincipal(String pUserName, String pHostName) throws IllegalArgumentE public boolean equals(Object pOtherPrincipal) { if (!(pOtherPrincipal instanceof UserPrincipal)) return false; UserPrincipal that = (UserPrincipal) pOtherPrincipal; - return (this.iUserName == null ? that.iUserName == null : this.iUserName - .equalsIgnoreCase(that.iUserName)) - && (this.iHostName == null ? that.iHostName == null : this.iHostName - .equalsIgnoreCase(that.iHostName)); + return ( + (this.iUserName == null ? that.iUserName == null : this.iUserName.equalsIgnoreCase(that.iUserName)) && + (this.iHostName == null ? that.iHostName == null : this.iHostName.equalsIgnoreCase(that.iHostName)) + ); } /** * Return the host name associated with this principal. - * + * * @return The host name. */ public String getHostName() { @@ -120,7 +119,7 @@ public String getHostName() { /** * Return the name of this principal identity; that is, return the login * name. - * + * * @return The name of this principal identity. * @see java.security.Principal#getName() */ @@ -130,7 +129,7 @@ public String getName() { /** * Return the principal's login user name. - * + * * @return The user login name. */ public String getUserName() { @@ -141,7 +140,7 @@ public String getUserName() { * The hashCode method returns an integer hash code to * represent this principal. It can be used to test for non-equality, or as * an index key in a hash table. - * + * * @return An integer hash code representing the principal. */ @Override @@ -153,12 +152,11 @@ public int hashCode() { * The toString method returns a string representation of the * principal suitable for displaying in messages. It should not be used for * making authorization checks, however. - * + * * @return A printable string form of the principal identity. */ @Override public String toString() { return this.iUserName; } - } diff --git a/src/main/java/org/metricshub/wbem/javax/wbem/client/WBEMClient.java b/src/main/java/org/metricshub/wbem/javax/wbem/client/WBEMClient.java index 185c156..882e8c9 100644 --- a/src/main/java/org/metricshub/wbem/javax/wbem/client/WBEMClient.java +++ b/src/main/java/org/metricshub/wbem/javax/wbem/client/WBEMClient.java @@ -58,17 +58,16 @@ */ import java.util.Locale; - +import javax.security.auth.Subject; import org.metricshub.wbem.javax.cim.CIMArgument; import org.metricshub.wbem.javax.cim.CIMClass; import org.metricshub.wbem.javax.cim.CIMInstance; import org.metricshub.wbem.javax.cim.CIMObjectPath; import org.metricshub.wbem.javax.cim.CIMQualifierType; -import org.metricshub.wbem.javax.wbem.CloseableIterator; -import org.metricshub.wbem.javax.wbem.WBEMException; import org.metricshub.wbem.javax.cim.UnsignedInteger32; import org.metricshub.wbem.javax.cim.UnsignedInteger64; -import javax.security.auth.Subject; +import org.metricshub.wbem.javax.wbem.CloseableIterator; +import org.metricshub.wbem.javax.wbem.WBEMException; //Sync'd against JSR48 1.0.0 javadoc (version 1.7.0_03) on Tue Dec 10 07:02:50 EST 2013 /** @@ -76,15 +75,14 @@ * against a WBEM Server. A WBEMClient implementation can be * retrieved from the WBEMClientFactory specifying the protocol to * be used. - * + * * @see WBEMClientFactory */ public interface WBEMClient { - /** * Enumerates CIM classes that are associated to a specified source CIM * class. - * + * * @param pObjectName * CIMObjectPath defining the source CIM Class whose * associated classes are to be returned. The @@ -146,24 +144,31 @@ public interface WBEMClient { * If unsuccessful, one of the following status codes shall be * returned along with zero or more instances of * CIM_Error. The ORDERED list is: - * - * + * + * * CIM_ERR_ACCESS_DENIED * CIM_ERR_NOT_SUPPORTED * CIM_ERR_INVALID_NAMESPACE * CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized * or otherwise incorrect parameters) * CIM_ERR_FAILED (some other unspecified error occurred) - * + * */ - public CloseableIterator associatorClasses(CIMObjectPath pObjectName, - String pAssociationClass, String pResultClass, String pRole, String pResultRole, - boolean pIncludeQualifiers, boolean pIncludeClassOrigin, String[] pPropertyList) - throws WBEMException; + public CloseableIterator associatorClasses( + CIMObjectPath pObjectName, + String pAssociationClass, + String pResultClass, + String pRole, + String pResultRole, + boolean pIncludeQualifiers, + boolean pIncludeClassOrigin, + String[] pPropertyList + ) + throws WBEMException; /** * Enumerates CIM Instances associated to a specified source CIM Instance. - * + * * @param pObjectName * CIMObjectPath defining the source CIM Instance * whose associated instances are to be returned. The @@ -223,19 +228,26 @@ public CloseableIterator associatorClasses(CIMObjectPath pObjectName, * If unsuccessful, one of the following status codes shall be * returned along with zero or more instances of * CIM_Error. The ORDERED list is: - * - * + * + * * CIM_ERR_ACCESS_DENIED * CIM_ERR_NOT_SUPPORTED * CIM_ERR_INVALID_NAMESPACE * CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized * or otherwise incorrect parameters) * CIM_ERR_FAILED (some other unspecified error occurred) - * + * */ - public CloseableIterator associatorInstances(CIMObjectPath pObjectName, - String pAssociationClass, String pResultClass, String pRole, String pResultRole, - boolean pIncludeClassOrigin, String[] pPropertyList) throws WBEMException; + public CloseableIterator associatorInstances( + CIMObjectPath pObjectName, + String pAssociationClass, + String pResultClass, + String pRole, + String pResultRole, + boolean pIncludeClassOrigin, + String[] pPropertyList + ) + throws WBEMException; /** * Enumerates the CIMObjectPaths of CIM Objects that are @@ -246,7 +258,7 @@ public CloseableIterator associatorInstances(CIMObjectPath pObjectN * CloseableIterator of CIMObjectPaths of the * CIMInstance objects associated to the source Object is * returned. - * + * * @param pObjectName * CIMObjectPath defining the source CIM Object * whose associated Objects are to be returned. This argument may @@ -287,26 +299,31 @@ public CloseableIterator associatorInstances(CIMObjectPath pObjectN * @throws WBEMException * If unsuccessful, one of the following status codes must be * returned. The ORDERED list is: - * - * + * + * * CIM_ERR_ACCESS_DENIED * CIM_ERR_NOT_SUPPORTED * CIM_ERR_INVALID_NAMESPACE * CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized * or otherwise incorrect parameters) * CIM_ERR_FAILED (some other unspecified error occurred) - * + * */ - public CloseableIterator associatorNames(CIMObjectPath pObjectName, - String pAssociationClass, String pResultClass, String pRole, String pResultRole) - throws WBEMException; + public CloseableIterator associatorNames( + CIMObjectPath pObjectName, + String pAssociationClass, + String pResultClass, + String pRole, + String pResultRole + ) + throws WBEMException; /** * associatorPaths shall start an enumeration session for * traversing associations starting from the instance defined in the * pInstancePath parameter using any specified filtering * criteria and return zero or more CIMObjectPath objects. - * + * * @param pInstancePath * The CIMObjectPath for the instance for which the * enumeration is to be performed. @@ -420,8 +437,8 @@ public CloseableIterator associatorNames(CIMObjectPath pObjectNam * @throws WBEMException * If unsuccessful, one of the following status codes must be * returned. The ORDERED list is: - * - * + * + * * CIM_ERR_ACCESS_DENIED * CIM_ERR_SERVER_IS_SHUTTING_DOWN * CIM_ERR_NOT_SUPPORTED @@ -434,19 +451,28 @@ public CloseableIterator associatorNames(CIMObjectPath pObjectNam * CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED * CIM_ERR_INVALID_QUERY * CIM_ERR_FAILED (some other unspecified error occurred) - * + * */ - public EnumerateResponse associatorPaths(CIMObjectPath pInstancePath, - String pAssociationClass, String pResultClass, String pRole, String pResultRole, - String pFilterQueryLanguage, String pFilterQuery, UnsignedInteger32 pTimeout, - boolean pContinueOnError, UnsignedInteger32 pMaxObjects) throws WBEMException; + public EnumerateResponse associatorPaths( + CIMObjectPath pInstancePath, + String pAssociationClass, + String pResultClass, + String pRole, + String pResultRole, + String pFilterQueryLanguage, + String pFilterQuery, + UnsignedInteger32 pTimeout, + boolean pContinueOnError, + UnsignedInteger32 pMaxObjects + ) + throws WBEMException; /** * associators shall start an enumeration session for * traversing associations starting from the instance defined in the * pInstancePath parameter using any specified filtering * criteria and return zero or more CIMInstance objects. - * + * * @param pInstancePath * The CIMObjectPath for the instance for which the * enumeration is to be performed. @@ -580,8 +606,8 @@ public EnumerateResponse associatorPaths(CIMObjectPath pInstanceP * @throws WBEMException * If unsuccessful, one of the following status codes must be * returned. The ORDERED list is: - * - * + * + * * CIM_ERR_ACCESS_DENIED * CIM_ERR_SERVER_IS_SHUTTING_DOWN * CIM_ERR_NOT_SUPPORTED @@ -594,13 +620,23 @@ public EnumerateResponse associatorPaths(CIMObjectPath pInstanceP * CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED * CIM_ERR_INVALID_QUERY * CIM_ERR_FAILED (Some other unspecified error occurred) - * + * */ - public EnumerateResponse associators(CIMObjectPath pInstancePath, - String pAssociationClass, String pResultClass, String pRole, String pResultRole, - boolean pIncludeClassOrigin, String[] pPropertyList, String pFilterQueryLanguage, - String pFilterQuery, UnsignedInteger32 pTimeout, boolean pContinueOnError, - UnsignedInteger32 pMaxObjects) throws WBEMException; + public EnumerateResponse associators( + CIMObjectPath pInstancePath, + String pAssociationClass, + String pResultClass, + String pRole, + String pResultRole, + boolean pIncludeClassOrigin, + String[] pPropertyList, + String pFilterQueryLanguage, + String pFilterQuery, + UnsignedInteger32 pTimeout, + boolean pContinueOnError, + UnsignedInteger32 pMaxObjects + ) + throws WBEMException; /** * Closes the WBEMClient session. @@ -615,7 +651,7 @@ public EnumerateResponse associators(CIMObjectPath pInstancePath, * session and retrieves all the results until the * EnumerationResponse.isEnd() is true, this method shall not * be called. - * + * * @param pPath * The CIMObjectPath representing the namespace to * be used. @@ -628,7 +664,7 @@ public EnumerateResponse associators(CIMObjectPath pInstancePath, /** * Create a CIM class. The namespace from the * CIMClass.getObjectPath() shall be used. - * + * * @param pClass * The CIMClass to be created. * @throws UnsupportedOperationException @@ -637,8 +673,8 @@ public EnumerateResponse associators(CIMObjectPath pInstancePath, * @throws WBEMException * If unsuccessful, one of the following status codes must be * returned. The ORDERED list is: - * - * + * + * * CIM_ERR_ACCESS_DENIED * CIM_ERR_NOT_SUPPORTED * CIM_ERR_INVALID_NAMESPACE @@ -648,7 +684,7 @@ public EnumerateResponse associators(CIMObjectPath pInstancePath, * CIM_ERR_INVALID_SUPERCLASS (the putative CIM Class declares a * non-existent superclass) * CIM_ERR_FAILED (some other unspecified error occurred) - * + * */ public void createClass(CIMClass pClass) throws WBEMException; @@ -661,15 +697,15 @@ public EnumerateResponse associators(CIMObjectPath pInstancePath, * null and the provider can fill them in. This is * implementation specific unless specified by a CIM Schema or in a DMTF * Profile. - * + * * @param pInstance * The CIMInstance to be created. * @return CIMObjectPath of the instance created. * @throws WBEMException * If unsuccessful, one of the following status codes must be * returned. The ORDERED list is: - * - * + * + * * CIM_ERR_ACCESS_DENIED * CIM_ERR_NOT_SUPPORTED (provider does not support this method) * CIM_ERR_INVALID_NAMESPACE @@ -677,13 +713,13 @@ public EnumerateResponse associators(CIMObjectPath pInstancePath, * CIM_ERR_INVALID_CLASS (in this namespace) * CIM_ERR_ALREADY_EXISTS * CIM_ERR_FAILED (some other unspecified error occurred) - * + * */ public CIMObjectPath createInstance(CIMInstance pInstance) throws WBEMException; /** * Deletes the CIM class for the object specified by the CIM object path. - * + * * @param pPath * The CIMObjectPath identifying the namespace and * class name to delete. @@ -693,12 +729,12 @@ public EnumerateResponse associators(CIMObjectPath pInstancePath, * @throws WBEMException * If unsuccessful, one of the following status codes must be * returned. The ORDERED list is: - * - * + * + * * CIM_ERR_ACCESS_DENIED * CIM_ERR_NOT_SUPPORTED * CIM_ERR_INVALID_NAMESPACE - * CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized + * CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized * or otherwise incorrect parameters) * CIM_ERR_NOT_FOUND (the CIM Class to be deleted does not exist) * CIM_ERR_CLASS_HAS_CHILDREN (the CIM Class has one or more subclasses @@ -706,21 +742,21 @@ public EnumerateResponse associators(CIMObjectPath pInstancePath, * CIM_ERR_CLASS_HAS_INSTANCES (the CIM Class has one or more instances * which cannot be deleted) * CIM_ERR_FAILED (some other unspecified error occurred) - * + * */ public void deleteClass(CIMObjectPath pPath) throws WBEMException; /** * Delete the CIM instance specified by the CIM object path. - * + * * @param pPath * The object path of the instance to be deleted. It must include * all of the keys. * @throws WBEMException * If unsuccessful, one of the following status codes must be * returned. The ORDERED list is: - * - * + * + * * CIM_ERR_ACCESS_DENIED * CIM_ERR_NOT_SUPPORTED (provider does not support this method) * CIM_ERR_INVALID_NAMESPACE @@ -728,13 +764,13 @@ public EnumerateResponse associators(CIMObjectPath pInstancePath, * CIM_ERR_INVALID_CLASS (in this namespace) * CIM_ERR_NOT_FOUND (if the instance does not exist) * CIM_ERR_FAILED (some other unspecified error occurred) - * + * */ public void deleteInstance(CIMObjectPath pPath) throws WBEMException; /** * Delete a CIM Qualifier type. - * + * * @param pPath * The CIMObjectPath identifying the name and * namespace of the CIM qualifier type to delete. @@ -744,21 +780,21 @@ public EnumerateResponse associators(CIMObjectPath pInstancePath, * @throws WBEMException * If unsuccessful, one of the following status codes must be * returned. The ORDERED list is: - * - * + * + * * CIM_ERR_ACCESS_DENIED * CIM_ERR_NOT_SUPPORTED * CIM_ERR_INVALID_NAMESPACE * CIM_ERR_INVALID_PARAMETER (for this method) * CIM_ERR_NOT_FOUND (the Qualifier did not exist) * CIM_ERR_FAILED (some other unspecified error occurred) - * + * */ public void deleteQualifierType(CIMObjectPath pPath) throws WBEMException; /** * Enumerate CIM Classes. - * + * * @param pPath * The object path of the class to be enumerated. Only the * namespace and object name should be populated. If the object @@ -791,25 +827,30 @@ public EnumerateResponse associators(CIMObjectPath pInstancePath, * @throws WBEMException * If unsuccessful, one of the following status codes must be * returned. The ORDERED list is: - * - * + * + * * CIM_ERR_ACCESS_DENIED * CIM_ERR_NOT_SUPPORTED * CIM_ERR_INVALID_NAMESPACE - * CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized + * CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized * or otherwise incorrect parameters) * CIM_ERR_INVALID_CLASS (the CIM Class that is the basis for this * enumeration does not exist) * CIM_ERR_FAILED (some other unspecified error occurred) - * + * */ - public CloseableIterator enumerateClasses(CIMObjectPath pPath, boolean pDeep, - boolean pLocalOnly, boolean pIncludeQualifiers, boolean pIncludeClassOrigin) - throws WBEMException; + public CloseableIterator enumerateClasses( + CIMObjectPath pPath, + boolean pDeep, + boolean pLocalOnly, + boolean pIncludeQualifiers, + boolean pIncludeClassOrigin + ) + throws WBEMException; /** * Enumerate the names of CIM Classes. - * + * * @param pPath * The CIMObjectPath identifying the class to be * enumerated. If the class name in the object path specified is @@ -829,25 +870,24 @@ public CloseableIterator enumerateClasses(CIMObjectPath pPath, boolean * @throws WBEMException * If unsuccessful, one of the following status codes must be * returned. The ORDERED list is: - * - * + * + * * CIM_ERR_ACCESS_DENIED * CIM_ERR_NOT_SUPPORTED * CIM_ERR_INVALID_NAMESPACE - * CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized + * CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized * or otherwise incorrect parameters) * CIM_ERR_INVALID_CLASS (the CIM Class that is the basis for this * enumeration does not exist) * CIM_ERR_FAILED (some other unspecified error occurred) - * + * */ - public CloseableIterator enumerateClassNames(CIMObjectPath pPath, boolean pDeep) - throws WBEMException; + public CloseableIterator enumerateClassNames(CIMObjectPath pPath, boolean pDeep) throws WBEMException; /** * Enumerate the names of the instances for a specified class. The names of * all subclass instances are returned. - * + * * @param pPath * The CIMObjectPath identifying the class whose * instances are to be enumerated. Only the namespace and class @@ -857,24 +897,23 @@ public CloseableIterator enumerateClassNames(CIMObjectPath pPath, * @throws WBEMException * If unsuccessful, one of the following status codes must be * returned. The ORDERED list is: - * - * + * + * * CIM_ERR_ACCESS_DENIED * CIM_ERR_NOT_SUPPORTED (provider does not support this method) * CIM_ERR_INVALID_NAMESPACE * CIM_ERR_INVALID_PARAMETER (for this method) * CIM_ERR_INVALID_CLASS (in this namespace) * CIM_ERR_FAILED (some other unspecified error occurred) - * + * */ - public CloseableIterator enumerateInstanceNames(CIMObjectPath pPath) - throws WBEMException; + public CloseableIterator enumerateInstanceNames(CIMObjectPath pPath) throws WBEMException; /** * enumerateInstancePaths shall enumerate the instances of the * specified class in pClassPath and return zero or more * CIMObjectPaths. - * + * * @param pClassPath * The CIMObjectPath for the class for which the * enumeration is to be performed. @@ -959,8 +998,8 @@ public CloseableIterator enumerateInstanceNames(CIMObjectPath pPa * @throws WBEMException * If unsuccessful, one of the following status codes must be * returned. The ORDERED list is: - * - * + * + * * CIM_ERR_ACCESS_DENIED * CIM_ERR_SERVER_IS_SHUTTING_DOWN * CIM_ERR_NOT_SUPPORTED @@ -973,16 +1012,22 @@ public CloseableIterator enumerateInstanceNames(CIMObjectPath pPa * CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED * CIM_ERR_INVALID_QUERY * CIM_ERR_FAILED (some other unspecified error occurred) - * + * */ - public EnumerateResponse enumerateInstancePaths(CIMObjectPath pClassPath, - String pFilterQueryLanguage, String pFilterQuery, UnsignedInteger32 pTimeout, - boolean pContinueOnError, UnsignedInteger32 pMaxObjects) throws WBEMException; + public EnumerateResponse enumerateInstancePaths( + CIMObjectPath pClassPath, + String pFilterQueryLanguage, + String pFilterQuery, + UnsignedInteger32 pTimeout, + boolean pContinueOnError, + UnsignedInteger32 pMaxObjects + ) + throws WBEMException; /** * Enumerate the instances of a class. The instances of all subclasses are * also returned. - * + * * @param pPath * The object path of the class to be enumerated. Only the * namespace and class name components are used. Any other @@ -1018,25 +1063,30 @@ public EnumerateResponse enumerateInstancePaths(CIMObjectPath pCl * @throws WBEMException * If unsuccessful, one of the following status codes must be * returned. The ORDERED list is: - * - * + * + * * CIM_ERR_ACCESS_DENIED * CIM_ERR_NOT_SUPPORTED * CIM_ERR_INVALID_NAMESPACE * CIM_ERR_INVALID_PARAMETER (for this method) * CIM_ERR_INVALID_CLASS (in this namespace) * CIM_ERR_FAILED (some other unspecified error occurred) - * + * */ - public CloseableIterator enumerateInstances(CIMObjectPath pPath, boolean pDeep, - boolean pLocalOnly, boolean pIncludeClassOrigin, String[] pPropertyList) - throws WBEMException; + public CloseableIterator enumerateInstances( + CIMObjectPath pPath, + boolean pDeep, + boolean pLocalOnly, + boolean pIncludeClassOrigin, + String[] pPropertyList + ) + throws WBEMException; /** * enumerateInstances shall enumerate the instances of the * specified class in pClassPath and return zero or more * CIMInstances. - * + * * @param pClassPath * The CIMObjectPath for the class for which the * enumeration is to be performed. @@ -1145,9 +1195,9 @@ public CloseableIterator enumerateInstances(CIMObjectPath pPath, bo * @throws WBEMException * If unsuccessful, one of the following status codes must be * returned. The ORDERED list is: - * - * - * + * + * + * * CIM_ERR_ACCESS_DENIED * CIM_ERR_SERVER_IS_SHUTTING_DOWN * CIM_ERR_NOT_SUPPORTED @@ -1160,16 +1210,24 @@ public CloseableIterator enumerateInstances(CIMObjectPath pPath, bo * CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED * CIM_ERR_INVALID_QUERY * CIM_ERR_FAILED (some other unspecified error occurred) - * + * */ - public EnumerateResponse enumerateInstances(CIMObjectPath pClassPath, - boolean pDeepInheritance, boolean pIncludeClassOrigin, String[] pPropertyList, - String pFilterQueryLanguage, String pFilterQuery, UnsignedInteger32 pTimeout, - boolean pContinueOnError, UnsignedInteger32 pMaxObjects) throws WBEMException; + public EnumerateResponse enumerateInstances( + CIMObjectPath pClassPath, + boolean pDeepInheritance, + boolean pIncludeClassOrigin, + String[] pPropertyList, + String pFilterQueryLanguage, + String pFilterQuery, + UnsignedInteger32 pTimeout, + boolean pContinueOnError, + UnsignedInteger32 pMaxObjects + ) + throws WBEMException; /** * Enumerates the CIM Qualifier types for a specific namespace. - * + * * @param pPath * The CIMObjectPath identifying the namespace whose * qualifier types are to be enumerated. @@ -1181,24 +1239,23 @@ public EnumerateResponse enumerateInstances(CIMObjectPath pClassPat * @throws WBEMException * If unsuccessful, one of the following status codes must be * returned. The ORDERED list is: - * - * + * + * * CIM_ERR_ACCESS_DENIED * CIM_ERR_NOT_SUPPORTED * CIM_ERR_INVALID_NAMESPACE - * CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized + * CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized * or otherwise incorrect parameters) * CIM_ERR_FAILED (some other unspecified error occurred) - * + * */ - public CloseableIterator> enumerateQualifierTypes(CIMObjectPath pPath) - throws WBEMException; + public CloseableIterator> enumerateQualifierTypes(CIMObjectPath pPath) throws WBEMException; /** * enumerationCount provides an estimated count of the total * number of objects in an open enumeration session represented by an * enumeration context. - * + * * @param pPath * The namespace for the enumeration context. * @param pEnumerationContext @@ -1208,9 +1265,9 @@ public CloseableIterator> enumerateQualifierTypes(CIMObjectP * @throws WBEMException * If unsuccessful, one of the following status codes must be * returned. The ORDERED list is: - * - * - * + * + * + * * CIM_ERR_ACCESS_DENIED * CIM_ERR_SERVER_IS_SHUTTING_DOWN * CIM_ERR_NOT_SUPPORTED @@ -1219,15 +1276,14 @@ public CloseableIterator> enumerateQualifierTypes(CIMObjectP * CIM_ERR_INVALID_ENUMERATION_CONTEXT * CIM_ERR_SERVER_LIMITS_EXCEEDED * CIM_ERR_FAILED - * - * + * + * */ - public UnsignedInteger64 enumerationCount(CIMObjectPath pPath, String pEnumerationContext) - throws WBEMException; + public UnsignedInteger64 enumerationCount(CIMObjectPath pPath, String pEnumerationContext) throws WBEMException; /** * execQuery shall execute a query to retrieve objects. - * + * * @param pPath * CIMObjectPath identifying the class to query. * Only the namespace and class name components are used. All @@ -1241,8 +1297,8 @@ public UnsignedInteger64 enumerationCount(CIMObjectPath pPath, String pEnumerati * @throws WBEMException * If unsuccessful, one of the following status codes must be * returned. The ORDERED list is: - * - * + * + * * CIM_ERR_ACCESS_DENIED * CIM_ERR_NOT_SUPPORTED (provider does not support this method) * CIM_ERR_INVALID_NAMESPACE @@ -1253,15 +1309,15 @@ public UnsignedInteger64 enumerationCount(CIMObjectPath pPath, String pEnumerati * CIM_ERR_INVALID_QUERY (the query is not a valid query in the specified * query language) * CIM_ERR_FAILED (some other unspecified error occurred) - * + * */ - public CloseableIterator execQuery(CIMObjectPath pPath, String pQuery, - String pQueryLanguage) throws WBEMException; + public CloseableIterator execQuery(CIMObjectPath pPath, String pQuery, String pQueryLanguage) + throws WBEMException; /** * execQueryInstances shall execute a query to retrieve * instances. - * + * * @param pObjectName * The CIMObjectPath representing the namespace to * be used. @@ -1366,8 +1422,8 @@ public CloseableIterator execQuery(CIMObjectPath pPath, String pQue * @throws WBEMException * If unsuccessful, one of the following status codes must be * returned. The ORDERED list is: - * - * + * + * * CIM_ERR_ACCESS_DENIED * CIM_ERR_SERVER_IS_SHUTTING_DOWN * CIM_ERR_NOT_SUPPORTED @@ -1378,22 +1434,29 @@ public CloseableIterator execQuery(CIMObjectPath pPath, String pQue * or otherwise incorrect parameters) * CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED (the requested filter query * language is not recognized) - * CIM_ERR_INVALID_QUERY (the filter query is not a valid query in the + * CIM_ERR_INVALID_QUERY (the filter query is not a valid query in the * specified filter query language) - * CIM_ERR_QUERY_FEATURE_NOT_SUPPORTED (the query requires support for + * CIM_ERR_QUERY_FEATURE_NOT_SUPPORTED (the query requires support for * features that are not supported) * CIM_ERR_FAILED (Some other unspecified error occurred) - * + * */ - public EnumerateResponse execQueryInstances(CIMObjectPath pObjectName, - String pFilterQuery, String pFilterQueryLanguage, boolean pReturnQueryResultClass, - UnsignedInteger32 pTimeout, boolean pContinueOnError, UnsignedInteger32 pMaxObjects, - CIMClass pQueryResultClass) throws WBEMException; + public EnumerateResponse execQueryInstances( + CIMObjectPath pObjectName, + String pFilterQuery, + String pFilterQueryLanguage, + boolean pReturnQueryResultClass, + UnsignedInteger32 pTimeout, + boolean pContinueOnError, + UnsignedInteger32 pMaxObjects, + CIMClass pQueryResultClass + ) + throws WBEMException; /** * Returns the CIMClass for the specified * CIMObjectPath. - * + * * @param pName * The object path of the class to be returned. Only the name * space and class name components are used. All other @@ -1430,23 +1493,29 @@ public EnumerateResponse execQueryInstances(CIMObjectPath pObjectNa * @throws WBEMException * If unsuccessful, one of the following status codes must be * returned. The ORDERED list is: - * - * + * + * * CIM_ERR_ACCESS_DENIED * CIM_ERR_INVALID_NAMESPACE - * CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized + * CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized * or otherwise incorrect parameters) * CIM_ERR_NOT_FOUND (the requested CIM Class does not exist in the * specified namespace) * CIM_ERR_FAILED (some other unspecified error occurred) - * + * */ - public CIMClass getClass(CIMObjectPath pName, boolean pLocalOnly, boolean pIncludeQualifiers, - boolean pIncludeClassOrigin, String[] pPropertyList) throws WBEMException; + public CIMClass getClass( + CIMObjectPath pName, + boolean pLocalOnly, + boolean pIncludeQualifiers, + boolean pIncludeClassOrigin, + String[] pPropertyList + ) + throws WBEMException; /** * Get a CIMInstance. - * + * * @param pName * The object path of the instance to be returned. The Keys in * this CIMObjectPath must be populated. @@ -1477,8 +1546,8 @@ public CIMClass getClass(CIMObjectPath pName, boolean pLocalOnly, boolean pInclu * @throws WBEMException * If unsuccessful, one of the following status codes must be * returned. The ORDERED list is: - * - * + * + * * CIM_ERR_ACCESS_DENIED * CIM_ERR_NOT_SUPPORTED (provider does not support this method) * CIM_ERR_INVALID_NAMESPACE @@ -1486,15 +1555,20 @@ public CIMClass getClass(CIMObjectPath pName, boolean pLocalOnly, boolean pInclu * CIM_ERR_INVALID_CLASS (in this namespace) * CIM_ERR_NOT_FOUND (if instance does not exist) * CIM_ERR_FAILED (some other unspecified error occurred) - * + * */ - public CIMInstance getInstance(CIMObjectPath pName, boolean pLocalOnly, - boolean pIncludeClassOrigin, String[] pPropertyList) throws WBEMException; + public CIMInstance getInstance( + CIMObjectPath pName, + boolean pLocalOnly, + boolean pIncludeClassOrigin, + String[] pPropertyList + ) + throws WBEMException; /** * getInstancePaths shall get the CIMObjectPaths * using an enumeration context. - * + * * @param pPath * The CIMObjectPath representing the namespace to * be used. @@ -1514,9 +1588,9 @@ public CIMInstance getInstance(CIMObjectPath pName, boolean pLocalOnly, * @throws WBEMException * If unsuccessful, one of the following status codes must be * returned. The ORDERED list is: - * - * - * + * + * + * * CIM_ERR_ACCESS_DENIED * CIM_ERR_SERVER_IS_SHUTTING_DOWN * CIM_ERR_NOT_SUPPORTED @@ -1526,15 +1600,19 @@ public CIMInstance getInstance(CIMObjectPath pName, boolean pLocalOnly, * CIM_ERR_SERVER_LIMITS_EXCEEDED * CIM_ERR_PULL_HAS_BEEN_ABANDONED * CIM_ERR_FAILED (some other unspecified error occurred) - * + * */ - public EnumerateResponse getInstancePaths(CIMObjectPath pPath, String pContext, - UnsignedInteger32 pMaxObjects) throws WBEMException; + public EnumerateResponse getInstancePaths( + CIMObjectPath pPath, + String pContext, + UnsignedInteger32 pMaxObjects + ) + throws WBEMException; /** * getInstances shall get the instances from an enumeration * session started by execQueryInstances. - * + * * @param pPath * The CIMObjectPath representing the namespace to * be used. @@ -1556,9 +1634,9 @@ public EnumerateResponse getInstancePaths(CIMObjectPath pPath, St * @throws WBEMException * If unsuccessful, one of the following status codes must be * returned. The ORDERED list is: - * - * - * + * + * + * * CIM_ERR_ACCESS_DENIED * CIM_ERR_SERVER_IS_SHUTTING_DOWN * CIM_ERR_NOT_SUPPORTED @@ -1568,15 +1646,19 @@ public EnumerateResponse getInstancePaths(CIMObjectPath pPath, St * CIM_ERR_SERVER_LIMITS_EXCEEDED * CIM_ERR_PULL_HAS_BEEN_ABANDONED * CIM_ERR_FAILED - * + * */ - public EnumerateResponse getInstances(CIMObjectPath pPath, String pContext, - UnsignedInteger32 pMaxObjects) throws WBEMException; + public EnumerateResponse getInstances( + CIMObjectPath pPath, + String pContext, + UnsignedInteger32 pMaxObjects + ) + throws WBEMException; /** * getInstancesWithPath shall use the enumeration context * provided to get the next set of instances for the enumeration session. - * + * * @param pPath * The CIMObjectPath representing the namespace to * be used. @@ -1596,9 +1678,9 @@ public EnumerateResponse getInstances(CIMObjectPath pPath, String p * @throws WBEMException * If unsuccessful, one of the following status codes must be * returned. The ORDERED list is: - * - * - * + * + * + * * CIM_ERR_ACCESS_DENIED * CIM_ERR_SERVER_IS_SHUTTING_DOWN * CIM_ERR_NOT_SUPPORTED @@ -1608,15 +1690,19 @@ public EnumerateResponse getInstances(CIMObjectPath pPath, String p * CIM_ERR_SERVER_LIMITS_EXCEEDED * CIM_ERR_PULL_HAS_BEEN_ABANDONED * CIM_ERR_FAILED (some other unspecified error occurred) - * + * */ - public EnumerateResponse getInstancesWithPath(CIMObjectPath pPath, - String pContext, UnsignedInteger32 pMaxObjects) throws WBEMException; + public EnumerateResponse getInstancesWithPath( + CIMObjectPath pPath, + String pContext, + UnsignedInteger32 pMaxObjects + ) + throws WBEMException; /** * Get property values. See WBEMClientConstants for a list of * standard properties. - * + * * @param pKey * The name of the property. * @return The value of the property. @@ -1626,7 +1712,7 @@ public EnumerateResponse getInstancesWithPath(CIMObjectPath pPath, /** * Get a CIMQualifierType. - * + * * @param pName * CIMObjectPath that identifies the * CIMQualifierType to return. @@ -1637,23 +1723,23 @@ public EnumerateResponse getInstancesWithPath(CIMObjectPath pPath, * @throws WBEMException * If unsuccessful, one of the following status codes must be * returned. The ORDERED list is: - * - * + * + * * CIM_ERR_ACCESS_DENIED * CIM_ERR_NOT_SUPPORTED * CIM_ERR_INVALID_NAMESPACE - * CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized + * CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized * or otherwise incorrect parameters) * CIM_ERR_NOT_FOUND (the requested Qualifier declaration did not exist) * CIM_ERR_FAILED (some other unspecified error occurred) - * + * */ public CIMQualifierType getQualifierType(CIMObjectPath pName) throws WBEMException; /** * Initialize the client connection. This must be called before any * operations. This must only be called once. - * + * * @param pName * The protocol and host to use (e.g. http://192.168.1.128/). Any * other fields shall be ignored. @@ -1668,11 +1754,11 @@ public EnumerateResponse getInstancesWithPath(CIMObjectPath pPath, * If the protocol adapter or security cannot be initialized. */ public void initialize(CIMObjectPath pName, Subject pSubject, Locale[] pLocales) - throws IllegalArgumentException, WBEMException; + throws IllegalArgumentException, WBEMException; /** * Executes the specified method on the specified object. - * + * * @param pName * CIM object path of the object whose method must be invoked. It * must include all of the keys. @@ -1689,10 +1775,10 @@ public void initialize(CIMObjectPath pName, Subject pSubject, Locale[] pLocales) * @throws WBEMException * If unsuccessful, one of the following status codes must be * returned. The ORDERED list is: - * - * + * + * * CIM_ERR_ACCESS_DENIED - * CIM_ERR_NOT_SUPPORTED (implementation DOES NOT support ANY + * CIM_ERR_NOT_SUPPORTED (implementation DOES NOT support ANY * Extrinsic Method Invocation) * CIM_ERR_INVALID_NAMESPACE * CIM_ERR_INVALID_PARAMETER (for this method) @@ -1700,15 +1786,19 @@ public void initialize(CIMObjectPath pName, Subject pSubject, Locale[] pLocales) * CIM_ERR_METHOD_NOT_FOUND * CIM_ERR_METHOD_NOT_AVAILABLE * CIM_ERR_FAILED (some other unspecified error occurred) - * + * */ - public Object invokeMethod(CIMObjectPath pName, String pMethodName, - CIMArgument[] pInputArguments, CIMArgument[] pOutputArguments) - throws WBEMException; + public Object invokeMethod( + CIMObjectPath pName, + String pMethodName, + CIMArgument[] pInputArguments, + CIMArgument[] pOutputArguments + ) + throws WBEMException; /** * Modify the CIMClass. - * + * * @param pClass * CIMClass to be modified. * @throws UnsupportedOperationException @@ -1717,12 +1807,12 @@ public Object invokeMethod(CIMObjectPath pName, String pMethodName, * @throws WBEMException * If unsuccessful, one of the following status codes must be * returned. The ORDERED list is: - * - * + * + * * CIM_ERR_ACCESS_DENIED * CIM_ERR_NOT_SUPPORTED * CIM_ERR_INVALID_NAMESPACE - * CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized + * CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized * or otherwise incorrect parameters) * CIM_ERR_INVALID_SUPERCLASS (the putative CIM Class declares a * non-existent superclass) @@ -1733,14 +1823,14 @@ public Object invokeMethod(CIMObjectPath pName, String pMethodName, * because it was not possible to update the instances of the Class in * a consistent fashion) * CIM_ERR_FAILED (some other unspecified error occurred) - * + * */ public void modifyClass(CIMClass pClass) throws WBEMException; /** * Modify some or all of the properties of the specified * CIMInstance. - * + * * @param pInstance * CIMInstance to be modified. All Keys must be * populated. @@ -1758,8 +1848,8 @@ public Object invokeMethod(CIMObjectPath pName, String pMethodName, * @throws WBEMException * If unsuccessful, one of the following status codes must be * returned. The ORDERED list is: - * - * + * + * * CIM_ERR_ACCESS_DENIED * CIM_ERR_NOT_SUPPORTED (provider does not support this method) * CIM_ERR_INVALID_NAMESPACE @@ -1768,14 +1858,14 @@ public Object invokeMethod(CIMObjectPath pName, String pMethodName, * CIM_ERR_NOT_FOUND (if instance does not exist) * CIM_ERR_NO_SUCH_PROPERTY (in this instance) * CIM_ERR_FAILED (some other unspecified error occurred) - * + * */ public void modifyInstance(CIMInstance pInstance, String[] pPropertyList) throws WBEMException; /** * Enumerates the Association classes that refer to a specified source CIM * Class. - * + * * @param pObjectName * CIMObjectPath defining the source CIM class whose * referring classes are to be returned. pObjectName @@ -1823,25 +1913,31 @@ public Object invokeMethod(CIMObjectPath pName, String pMethodName, * If unsuccessful, one of the following status codes shall be * returned along with zero or more instance of * CIM_Error. The ORDERED list is: - * - * + * + * * CIM_ERR_ACCESS_DENIED * CIM_ERR_NOT_SUPPORTED * CIM_ERR_INVALID_NAMESPACE - * CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized + * CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized * or otherwise incorrect parameters) * CIM_ERR_FAILED (some other unspecified error occurred) - * + * */ - CloseableIterator referenceClasses(CIMObjectPath pObjectName, String pResultClass, - String pRole, boolean pIncludeQualifiers, boolean pIncludeClassOrigin, - String[] pPropertyList) throws WBEMException; + CloseableIterator referenceClasses( + CIMObjectPath pObjectName, + String pResultClass, + String pRole, + boolean pIncludeQualifiers, + boolean pIncludeClassOrigin, + String[] pPropertyList + ) + throws WBEMException; /** * Enumerates the Association instances that refer to a specified source CIM * Instance. - * + * * @param pObjectName * CIMObjectPath defining the source CIM Instance * whose referring instances are to be returned. The @@ -1882,19 +1978,24 @@ CloseableIterator referenceClasses(CIMObjectPath pObjectName, String p * If unsuccessful, one of the following status codes shall be * returned along with zero or more CIM_Error * instances. The ORDERED list is: - * - * + * + * * CIM_ERR_ACCESS_DENIED * CIM_ERR_NOT_SUPPORTED * CIM_ERR_INVALID_NAMESPACE - * CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized + * CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized * or otherwise incorrect parameters) * CIM_ERR_FAILED (some other unspecified error occurred) - * + * */ - CloseableIterator referenceInstances(CIMObjectPath pObjectName, - String pResultClass, String pRole, boolean pIncludeClassOrigin, String[] pPropertyList) - throws WBEMException; + CloseableIterator referenceInstances( + CIMObjectPath pObjectName, + String pResultClass, + String pRole, + boolean pIncludeClassOrigin, + String[] pPropertyList + ) + throws WBEMException; /** * Enumerates the CIMObjectPaths of Association Objects that @@ -1905,7 +2006,7 @@ CloseableIterator referenceInstances(CIMObjectPath pObjectName, * CloseableIterator of CIMObjectPaths of the * CIMInstance objects that refer to the source Object is * returned. - * + * * @param pObjectName * CIMObjectPath defining the source CIM Object * whose referring Objects are to be returned. This argument may @@ -1928,25 +2029,25 @@ CloseableIterator referenceInstances(CIMObjectPath pObjectName, * @throws WBEMException * If unsuccessful, one of the following status codes must be * returned. The ORDERED list is: - * - * + * + * * CIM_ERR_ACCESS_DENIED * CIM_ERR_NOT_SUPPORTED * CIM_ERR_INVALID_NAMESPACE - * CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized + * CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized * or otherwise incorrect parameters) * CIM_ERR_FAILED (some other unspecified error occurred) - * + * */ - public CloseableIterator referenceNames(CIMObjectPath pObjectName, - String pResultClass, String pRole) throws WBEMException; + public CloseableIterator referenceNames(CIMObjectPath pObjectName, String pResultClass, String pRole) + throws WBEMException; /** * referencePaths shall start an enumeration session for * association instances that have references that refer to the instance * defined in the pInstancePath parameter and return zero or * more CIMObjectPath objects. - * + * * @param pInstancePath * The CIMObjectPath for the instance for which the * enumeration is to be performed. @@ -2042,9 +2143,9 @@ public CloseableIterator referenceNames(CIMObjectPath pObjectName * @throws WBEMException * If unsuccessful, one of the following status codes must be * returned. The ORDERED list is: - * - * - * + * + * + * * CIM_ERR_ACCESS_DENIED * CIM_ERR_SERVER_IS_SHUTTING_DOWN * CIM_ERR_NOT_SUPPORTED @@ -2057,19 +2158,26 @@ public CloseableIterator referenceNames(CIMObjectPath pObjectName * CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED * CIM_ERR_INVALID_QUERY * CIM_ERR_FAILED (some other unspecified error occurred) - * + * */ - public EnumerateResponse referencePaths(CIMObjectPath pInstancePath, - String pResultClass, String pRole, String pFilterQueryLanguage, String pFilterQuery, - UnsignedInteger32 pTimeout, boolean pContinueOnError, UnsignedInteger32 pMaxObjects) - throws WBEMException; + public EnumerateResponse referencePaths( + CIMObjectPath pInstancePath, + String pResultClass, + String pRole, + String pFilterQueryLanguage, + String pFilterQuery, + UnsignedInteger32 pTimeout, + boolean pContinueOnError, + UnsignedInteger32 pMaxObjects + ) + throws WBEMException; /** * references shall start an enumeration session for * association instances that have references that refer to the instance * defined in the pInstancePath parameter and return zero or * more CIMInstance objects. - * + * * @param pInstancePath * The CIMObjectPath for the instance for which the * enumeration is to be performed. @@ -2182,8 +2290,8 @@ public EnumerateResponse referencePaths(CIMObjectPath pInstancePa * @throws WBEMException * If unsuccessful, one of the following status codes must be * returned. The ORDERED list is: - * - * + * + * * CIM_ERR_ACCESS_DENIED * CIM_ERR_SERVER_IS_SHUTTING_DOWN * CIM_ERR_NOT_SUPPORTED @@ -2196,16 +2304,25 @@ public EnumerateResponse referencePaths(CIMObjectPath pInstancePa * CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED * CIM_ERR_INVALID_QUERY * CIM_ERR_FAILED (some other unspecified error occurred) - * + * */ - public EnumerateResponse references(CIMObjectPath pInstancePath, - String pResultClass, String pRole, boolean pIncludeClassOrigin, String[] pPropertyList, - String pFilterQueryLanguage, String pFilterQuery, UnsignedInteger32 pTimeout, - boolean pContinueOnError, UnsignedInteger32 pMaxObjects) throws WBEMException; + public EnumerateResponse references( + CIMObjectPath pInstancePath, + String pResultClass, + String pRole, + boolean pIncludeClassOrigin, + String[] pPropertyList, + String pFilterQueryLanguage, + String pFilterQuery, + UnsignedInteger32 pTimeout, + boolean pContinueOnError, + UnsignedInteger32 pMaxObjects + ) + throws WBEMException; /** * Change the locales that were provided during initialization. - * + * * @param pLocales * An array of locales in order of priority of preference. */ @@ -2214,7 +2331,7 @@ public EnumerateResponse references(CIMObjectPath pInstancePath, /** * Set properties that enable options or protocol specific properties. See * WBEMClientConstants for a list of standard properties. - * + * * @param pKey * The name of the property. * @param pValue @@ -2229,7 +2346,7 @@ public EnumerateResponse references(CIMObjectPath pInstancePath, * Add a CIMQualifierType to the specified namespace if it does * not already exist. Otherwise, it modifies the qualifier type to the value * specified. - * + * * @param pQualifierType * The CIM qualifier type to be added. * @throws UnsupportedOperationException @@ -2238,15 +2355,15 @@ public EnumerateResponse references(CIMObjectPath pInstancePath, * @throws WBEMException * If unsuccessful, one of the following status codes must be * returned. The ORDERED list is: - * - * + * + * * CIM_ERR_ACCESS_DENIED * CIM_ERR_NOT_SUPPORTED * CIM_ERR_INVALID_NAMESPACE - * CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized + * CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized * or otherwise incorrect parameters) * CIM_ERR_FAILED (some other unspecified error occurred) - * + * */ public void setQualifierType(CIMQualifierType pQualifierType) throws WBEMException; } diff --git a/src/main/java/org/metricshub/wbem/javax/wbem/client/WBEMClientConstants.java b/src/main/java/org/metricshub/wbem/javax/wbem/client/WBEMClientConstants.java index 5d4ecf9..d02cde4 100644 --- a/src/main/java/org/metricshub/wbem/javax/wbem/client/WBEMClientConstants.java +++ b/src/main/java/org/metricshub/wbem/javax/wbem/client/WBEMClientConstants.java @@ -52,7 +52,6 @@ * property value is attempted to be set. */ public class WBEMClientConstants { - /** * Use this property to set the list of ciphers the client will support. * Setting this value to null will use the default set of ciphers provided @@ -135,24 +134,24 @@ public class WBEMClientConstants { /** * The CIM-XML Protocol as defined by the DMTF in the following * specifications: - * + * *
      -	 * DSP0200 - CIM Operations over HTTP 
      -	 * DSP0201 - Representation of CIM Using XML 
      +	 * DSP0200 - CIM Operations over HTTP
      +	 * DSP0201 - Representation of CIM Using XML
       	 * DSP0203 - CIM DTD
      -	 * 
      +	 *
       	 */
       	public static final String PROTOCOL_CIMXML = "CIM-XML";
       
       	/**
       	 * The WS-Management Protocol as defined by the DMTF in the following
       	 * specifications:
      -	 * 
      +	 *
       	 * 
      -	 * DSP0226 - WS-Management 
      -	 * DSP0227 - WS-Management CIM Binding Specification 
      +	 * DSP0226 - WS-Management
      +	 * DSP0227 - WS-Management CIM Binding Specification
       	 * DSP0230 - WS-CIM Mapping Specification
      -	 * 
      +	 *
       	 */
       	public static final String PROTOCOL_WSMANAGEMENT = "WS-Management";
       }
      diff --git a/src/main/java/org/metricshub/wbem/javax/wbem/client/WBEMClientFactory.java b/src/main/java/org/metricshub/wbem/javax/wbem/client/WBEMClientFactory.java
      index b896b10..2eb4817 100644
      --- a/src/main/java/org/metricshub/wbem/javax/wbem/client/WBEMClientFactory.java
      +++ b/src/main/java/org/metricshub/wbem/javax/wbem/client/WBEMClientFactory.java
      @@ -53,36 +53,37 @@
        * This class defines the functionality of a WBEMClient factory,
        * which is used to retrieve a WBEMClient for a specified protocol.
        * An example of how to use the factory is included below.
      - * 
      + *
        * 
        *   ...
        *   WBEMClient cc = null;
      - *   
      + *
        *   try {
        *     cc = WBEMClientFactory.getClient(WBEMClientConstants.PROTOCOL_CIMXML);
        *   } catch (Exception e) {
        *     System.out.println("Received error when trying to retrieve client handle");
        *     System.exit(-1);
        *   }
      - *   
      - *   // initialize the client 
      + *
      + *   // initialize the client
        *   cc.initialize(cns, s, null);
        *   ...
        * 
      */ public class WBEMClientFactory extends Object { - private static final String[] cProtocols = { WBEMClientConstants.PROTOCOL_CIMXML }; /** * */ - public WBEMClientFactory() { /**/} + public WBEMClientFactory() { + /**/ + } /** * Get a WBEMClient for a protocol. - * + * * @param pProtocol * The protocol name (e.g. "CIM-XML"). * @return The WBEMClient implementation for the protocol @@ -95,19 +96,19 @@ public WBEMClientFactory() { /**/} * If the protocol implementation could not be loaded. */ public static WBEMClient getClient(String pProtocol) throws WBEMException { - - if (WBEMClientConstants.PROTOCOL_CIMXML.equalsIgnoreCase(pProtocol)) { return new WBEMClientCIMXML(); } + if (WBEMClientConstants.PROTOCOL_CIMXML.equalsIgnoreCase(pProtocol)) { + return new WBEMClientCIMXML(); + } throw new IllegalArgumentException("\"" + pProtocol + "\" is not a supported protocol"); } /** * Get the names of the supported protocols. - * + * * @return A string array of the supported protocols. */ public static String[] getSupportedProtocols() { return cProtocols; } - } diff --git a/src/main/java/org/metricshub/wbem/javax/wbem/listener/IndicationListener.java b/src/main/java/org/metricshub/wbem/javax/wbem/listener/IndicationListener.java index 137e86c..fe03af6 100644 --- a/src/main/java/org/metricshub/wbem/javax/wbem/listener/IndicationListener.java +++ b/src/main/java/org/metricshub/wbem/javax/wbem/listener/IndicationListener.java @@ -42,7 +42,6 @@ */ import java.util.EventListener; - import org.metricshub.wbem.javax.cim.CIMInstance; //Sync'd against JSR48 1.0.0 javadoc (build 1.5.0_10) on Wed Jan 20 02:20:59 EST 2010 @@ -51,10 +50,9 @@ * indications. See the WBEMListenerFactory class for an example. */ public interface IndicationListener extends EventListener { - /** * Called when an indication has been received by the listener - * + * * @param pIndicationURL * The URL to which the indication was posted. For example if the * indication was delivered over the https protocol to the @@ -64,5 +62,4 @@ public interface IndicationListener extends EventListener { * The indication received. */ public void indicationOccured(String pIndicationURL, CIMInstance pIndication); - } diff --git a/src/main/java/org/metricshub/wbem/javax/wbem/listener/WBEMListener.java b/src/main/java/org/metricshub/wbem/javax/wbem/listener/WBEMListener.java index 7b09f81..6cba4d4 100644 --- a/src/main/java/org/metricshub/wbem/javax/wbem/listener/WBEMListener.java +++ b/src/main/java/org/metricshub/wbem/javax/wbem/listener/WBEMListener.java @@ -52,10 +52,9 @@ * listen for indications. */ public interface WBEMListener { - /** * Add a new listener using the specified port. - * + * * @param pListener * The Indication Listener that will be called when an indication * is received. @@ -67,12 +66,11 @@ public interface WBEMListener { * @throws IOException * If the port is already in use. */ - public int addListener(IndicationListener pListener, int pPort, String pTransport) - throws IOException; + public int addListener(IndicationListener pListener, int pPort, String pTransport) throws IOException; /** * Add a new listener using the specified port. - * + * * @param pListener * The Indication Listener that will be called when an indication * is received. @@ -87,12 +85,12 @@ public int addListener(IndicationListener pListener, int pPort, String pTranspor * @throws IOException * If the port is already in use. */ - public int addListener(IndicationListener pListener, int pPort, String pTransport, - String localAddr) throws IOException; + public int addListener(IndicationListener pListener, int pPort, String pTransport, String localAddr) + throws IOException; /** * Get a property value. - * + * * @param pName * The name of the property. * @return The value of the property. @@ -101,7 +99,7 @@ public int addListener(IndicationListener pListener, int pPort, String pTranspor /** * Remove the listener associated with the specified port. - * + * * @param pPort * The port. */ @@ -109,7 +107,7 @@ public int addListener(IndicationListener pListener, int pPort, String pTranspor /** * Set a property for the WBEM Listener. - * + * * @param pName * The name of the property. * @param pValue @@ -118,5 +116,4 @@ public int addListener(IndicationListener pListener, int pPort, String pTranspor * If the name is not a supported property name. */ public void setProperty(String pName, String pValue); - } diff --git a/src/main/java/org/metricshub/wbem/javax/wbem/listener/WBEMListenerConstants.java b/src/main/java/org/metricshub/wbem/javax/wbem/listener/WBEMListenerConstants.java index 4645fa0..d173999 100644 --- a/src/main/java/org/metricshub/wbem/javax/wbem/listener/WBEMListenerConstants.java +++ b/src/main/java/org/metricshub/wbem/javax/wbem/listener/WBEMListenerConstants.java @@ -46,7 +46,6 @@ * property value is attempted to be set. */ public class WBEMListenerConstants { - /** * Use this property to set the list of ciphers the listener will support. * Setting this value to null will use the default set of ciphers provided diff --git a/src/main/java/org/metricshub/wbem/javax/wbem/listener/WBEMListenerFactory.java b/src/main/java/org/metricshub/wbem/javax/wbem/listener/WBEMListenerFactory.java index 3e20ed4..26ae3d0 100644 --- a/src/main/java/org/metricshub/wbem/javax/wbem/listener/WBEMListenerFactory.java +++ b/src/main/java/org/metricshub/wbem/javax/wbem/listener/WBEMListenerFactory.java @@ -25,8 +25,6 @@ package org.metricshub.wbem.javax.wbem.listener; -import org.metricshub.wbem.sblim.cimclient.WBEMListenerSBLIM; - /*- * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ * WBEM Java Client @@ -48,39 +46,41 @@ */ import org.metricshub.wbem.javax.wbem.client.WBEMClientConstants; +import org.metricshub.wbem.sblim.cimclient.WBEMListenerSBLIM; //Sync'd against JSR48 1.0.0 javadoc (build 1.5.0_10) on Wed Jan 20 02:20:59 EST 2010 /** * This class is a factory for getting a WBEMListener * implementation for a specified protocol. An example of how to use the factory * is included below. - * + * *
        * ...
        * class MyListener implements IndicationListener {
      - * 
      + *
        *   public void indicationOccured(String pIndicationURL, CIMInstance pIndication) {
        *     System.out.println(pIndication);
        * 	 }
        * }
      - * 
      + *
        * String protocol = WBEMClientConstants.PROTOCOL_CIMXML;
        * WBEMListener api = WBEMListenerFactory.getListener(protocol);
        * int port = api.addListener(MyListener, 1234, protocol);
        * 
      */ public class WBEMListenerFactory extends Object { - private static final String[] PROTOCOLS = { WBEMClientConstants.PROTOCOL_CIMXML }; /** * */ - public WBEMListenerFactory() { /**/} + public WBEMListenerFactory() { + /**/ + } /** * Get a WBEM Listener implementation for the specified protocol. - * + * * @param pProtocol * The protocol name. * @return Implementation of WBEMListener. @@ -88,16 +88,17 @@ public WBEMListenerFactory() { /**/} * Could not load protocol implementation. */ public static WBEMListener getListener(String pProtocol) throws IllegalArgumentException { - - if (WBEMClientConstants.PROTOCOL_CIMXML.equalsIgnoreCase(pProtocol)) { return new WBEMListenerSBLIM(); } - throw new IllegalArgumentException("Protocol: " + pProtocol - + " is not supported! Invoke getProtocols() for the list of " - + "supported protocols."); + if (WBEMClientConstants.PROTOCOL_CIMXML.equalsIgnoreCase(pProtocol)) { + return new WBEMListenerSBLIM(); + } + throw new IllegalArgumentException( + "Protocol: " + pProtocol + " is not supported! Invoke getProtocols() for the list of " + "supported protocols." + ); } /** * Get the names of the supported protocols. - * + * * @return A string array of the protocol names supported. */ public static String[] getProtocols() { diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/CIMXMLTraceListener.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/CIMXMLTraceListener.java index c789c16..94d4c34 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/CIMXMLTraceListener.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/CIMXMLTraceListener.java @@ -44,14 +44,13 @@ /** * The interface CIMXMLTraceListener must be implemented if you want to attach * your own CIM-XML logging framework to the CIM Client. - * + * * @see LogAndTraceManager */ public interface CIMXMLTraceListener { - /** * Receive a CIM-XML trace message. - * + * * @param pLevel * One of the message level identifiers, e.g. FINE * @param pMessage @@ -62,5 +61,4 @@ public interface CIMXMLTraceListener { * (being sent from server to client) */ public void traceCIMXML(Level pLevel, String pMessage, boolean pOutgoing); - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/GenericExts.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/GenericExts.java index e9689f2..1d0078b 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/GenericExts.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/GenericExts.java @@ -50,10 +50,10 @@ public class GenericExts { /** * initArrayList : If arrayList is null then it will return the new * arrayList of same type if it is not null then it will clear the arrayList - * + * * @param * : Type Parameter - * + * * @param pAL * : ArrayList to be initialized * @return ArrayList : initialized ArrayList @@ -68,10 +68,10 @@ public static ArrayList initClearArrayList(ArrayList pAL) { * initArrayList : If arrayList is null then it will return the new * arrayList of same type if it is not null then it will return the same * arrayList - * + * * @param * : Type Parameter - * + * * @param pAL * : ArrayList to be initialized * @return ArrayList : initialized ArrayList @@ -84,20 +84,19 @@ public static ArrayList initArrayList(ArrayList pAL) { /** * cloneVector : Generic deep copy of the vector. If original vector is null * then return value will also be null. - * + * * @param * : Type of vector - * + * * @param oldVec * : The original vector. - * + * * @return Vector<T> : Deep copy of original vector. */ public static synchronized Vector cloneVector(Vector oldVec) { if (oldVec == null) return null; Vector newVec = new Vector(oldVec.size()); - for (T obj : oldVec) - newVec.add(obj); + for (T obj : oldVec) newVec.add(obj); return newVec; } } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/IndicationListenerSBLIM.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/IndicationListenerSBLIM.java index 2f0b230..e1c8051 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/IndicationListenerSBLIM.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/IndicationListenerSBLIM.java @@ -41,13 +41,12 @@ import java.net.InetAddress; import java.util.EventListener; - import org.metricshub.wbem.javax.cim.CIMInstance; /** * This interface is implemented by the code that wants to create a listener for * indications. See the WBEMListenerFactory class for an example. - * + * * The difference between this interface and IndicationListener is * that the JSR48 standard (javax.wbem.listener.IndicationListener) * does not allow for the listener to receive the IP of the indication sender @@ -55,10 +54,9 @@ * org.sblim.cimclinet.IndicationListenerSBLIM) does. */ public interface IndicationListenerSBLIM extends EventListener { - /** * Called when an indication has been received by the listener - * + * * @param pIndicationURL * The URL to which the indication was posted. For example if the * indication was delivered over the https protocol to the @@ -69,7 +67,5 @@ public interface IndicationListenerSBLIM extends EventListener { * @param pSenderIP * The internet address of the indication sender. */ - public void indicationOccured(String pIndicationURL, CIMInstance pIndication, - InetAddress pSenderIP); - + public void indicationOccured(String pIndicationURL, CIMInstance pIndication, InetAddress pSenderIP); } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/LogAndTraceManager.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/LogAndTraceManager.java index f7aa039..107687b 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/LogAndTraceManager.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/LogAndTraceManager.java @@ -45,22 +45,20 @@ import java.io.OutputStream; import java.util.Collections; import java.util.List; - import org.metricshub.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; /** * Class LogAndTraceManager provides the means to register/unregister log and * trace listeners. It is the entry point for application that want to redirect * the CIM Client's log and trace messages into their own logging framework. - * + * */ public class LogAndTraceManager { - private static LogAndTraceManager cManager = new LogAndTraceManager(); /** * Returns the singleton instance of the manager. - * + * * @return The manager */ public static LogAndTraceManager getManager() { @@ -74,7 +72,7 @@ private LogAndTraceManager() { /** * Adds a listener for log messages. The listener will be notified of any * log event. - * + * * @param pListener * The listener */ @@ -85,7 +83,7 @@ public void addLogListener(LogListener pListener) { /** * Remove a listener. This listener will not be notified of log events * anymore. - * + * * @param pListener * The listener */ @@ -104,7 +102,7 @@ public void clearLogListeners() { /** * Gets the registered log listeners including the internal console and file * loggers. - * + * * @return An unmodifiable list of listeners */ public List getLogListeners() { @@ -114,7 +112,7 @@ public List getLogListeners() { /** * Adds a listener for log messages. The listener will be notified of any * trace event. - * + * * @param pListener * The listener */ @@ -125,7 +123,7 @@ public void addTraceListener(TraceListener pListener) { /** * Removes a listener. This listener will not be notified of trace events * anymore. - * + * * @param pListener * The listener */ @@ -144,7 +142,7 @@ public void clearTraceListeners() { /** * Gets the registered trace listeners including the internal console and * file loggers. - * + * * @return A unmodifiable list of listeners */ public List getTraceListeners() { @@ -154,7 +152,7 @@ public List getTraceListeners() { /** * Adds a listener for CIM-XML trace messages. The listener will be notified * of any CIM-XML trace event. - * + * * @param pListener * The listener */ @@ -165,7 +163,7 @@ public void addCIMXMLTraceListener(CIMXMLTraceListener pListener) { /** * Removes a CIM-XML trace listener. This listener will not be notified of * CIM-XML trace events anymore. - * + * * @param pListener * The listener */ @@ -182,12 +180,11 @@ public void clearCIMXMLTraceListeners() { /** * Gets the registered CIM-XML trace listeners. - * + * * @return A unmodifiable list of listeners */ public List getCIMXMLTraceListeners() { - return Collections - .unmodifiableList(LogAndTraceBroker.getBroker().getCIMXMLTraceListeners()); + return Collections.unmodifiableList(LogAndTraceBroker.getBroker().getCIMXMLTraceListeners()); } /** @@ -195,7 +192,7 @@ public List getCIMXMLTraceListeners() { * null means that tracing is effectively disabled. Otherwise * the CIM-XML tracing can be activated either globally or per-connection * via the "sblim.wbem.cimxmlTracing" configuration property. - * + * * @return The CIM-XML trace stream */ public OutputStream getXmlTraceStream() { @@ -207,12 +204,11 @@ public OutputStream getXmlTraceStream() { * null means that tracing is effectively disabled. Otherwise * the CIM-XML tracing can be activated either globally or per-connection * via the "sblim.wbem.cimxmlTracing" configuration property. - * + * * @param pStream * The CIM-XML trace stream */ public void setXmlTraceStream(OutputStream pStream) { LogAndTraceBroker.getBroker().setXmlTraceStream(pStream); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/LogListener.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/LogListener.java index 6a647ef..7e24c27 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/LogListener.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/LogListener.java @@ -45,14 +45,13 @@ /** * The interface LogListener must be implemented if you want to attach your own * logging framework to the CIM Client. - * + * * @see LogAndTraceManager */ public interface LogListener { - /** * Receive a message. - * + * * @param pLevel * One of the message level identifiers, e.g. SEVERE * @param pMessageKey diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/TraceListener.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/TraceListener.java index 04adebc..d8adedf 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/TraceListener.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/TraceListener.java @@ -46,14 +46,13 @@ /** * The interface TraceListener must be implemented if you want to attach your * own logging framework to the CIM Client. - * + * * @see LogAndTraceManager */ public interface TraceListener { - /** * Receive a trace message. - * + * * @param pLevel * One of the message level identifiers, e.g. FINE * @param pOrigin @@ -66,7 +65,7 @@ public interface TraceListener { /** * Receive a trace message. - * + * * @param pLevel * One of the message level identifiers, e.g. SEVERE * @param pOrigin @@ -77,5 +76,4 @@ public interface TraceListener { * The throwable associated with the message */ public void trace(Level pLevel, StackTraceElement pOrigin, String pMessage, Throwable pThrown); - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/WBEMClientSBLIM.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/WBEMClientSBLIM.java index 056329c..12f1910 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/WBEMClientSBLIM.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/WBEMClientSBLIM.java @@ -50,10 +50,8 @@ import java.net.URI; import java.util.Locale; import java.util.Properties; - import javax.net.SocketFactory; import javax.security.auth.Subject; - import org.metricshub.wbem.javax.cim.CIMInstance; import org.metricshub.wbem.javax.cim.CIMObjectPath; import org.metricshub.wbem.javax.wbem.CloseableIterator; @@ -63,16 +61,15 @@ /** * Class WBEMClientSBLIM contains the SBLIM CIM Client specific extensions to * the WBEMClient interface. - * + * * @see WBEMClient - * + * */ public interface WBEMClientSBLIM extends WBEMClient { - /** * Initialize the client connection. This must be called before any * operations. This must only be called once. - * + * * @param pUri * The protocol and host to use. Any other fields will be * ignored. @@ -86,8 +83,7 @@ public interface WBEMClientSBLIM extends WBEMClient { * @throws WBEMException * If the protocol adapter or security cannot be initialized. */ - public void initialize(URI pUri, Subject pSubject, Locale[] pLocales) - throws IllegalArgumentException, WBEMException; + public void initialize(URI pUri, Subject pSubject, Locale[] pLocales) throws IllegalArgumentException, WBEMException; /** * Returns the client specific configuration properties. Note that only @@ -96,7 +92,7 @@ public void initialize(URI pUri, Subject pSubject, Locale[] pLocales) * class.
      * If the no client specific configuration is set, this method returns * null - * + * * @return The configuration properties * @see System#getProperties() */ @@ -110,11 +106,11 @@ public void initialize(URI pUri, Subject pSubject, Locale[] pLocales) * properties not specified here are taken from the global properties. The * global settings can be accessed via the java.lang.System * class. - * + * * @param pProperties * The session specific properties. null resets this * client to the global settings. - * + * * @see System#setProperties(Properties) */ public void setProperties(Properties pProperties); @@ -125,10 +121,10 @@ public void initialize(URI pUri, Subject pSubject, Locale[] pLocales) * otherwise client specific value if one was set or otherwise the global * value if one was set or otherwise the default value. Valid property names * can be found in the WBEMConfigurationProperties interface. - * + * * @param pKey * The name of the configuration property - * + * * @return The value of the given configuration property * @see WBEMConfigurationProperties */ @@ -141,7 +137,7 @@ public void initialize(URI pUri, Subject pSubject, Locale[] pLocales) * class. Valid property names can be found in the * WBEMConfigurationProperties interface. Unknown properties * are ignored. - * + * * @param pKey * The name of the configuration property * @param pValue @@ -160,7 +156,7 @@ public void initialize(URI pUri, Subject pSubject, Locale[] pLocales) * getProperties().
      * If the no client specific configuration is set, this method returns * null - * + * * @return The configuration properties * @see System#getProperties() * @see #getProperties() @@ -176,11 +172,11 @@ public void initialize(URI pUri, Subject pSubject, Locale[] pLocales) * specified here are taken from the client or global properties. The global * settings can be accessed via the java.lang.System class, the * client setting via getProperties(). - * + * * @param pProperties * The thread specific properties. null remove the * local setting of the current thread. - * + * * @see System#setProperties(Properties) * @see #setProperties(Properties) */ @@ -194,7 +190,7 @@ public void initialize(URI pUri, Subject pSubject, Locale[] pLocales) * getProperties(). Valid property names can be found in the * WBEMConfigurationProperties interface. Unknown properties * are ignored. - * + * * @param pKey * The name of the configuration property * @param pValue @@ -209,7 +205,7 @@ public void initialize(URI pUri, Subject pSubject, Locale[] pLocales) /** * Gets the custom socket factory if one is set. The client uses this * factory for socket creation instead of the default one. - * + * * @return The custom factory used for socket creation. null * indicates set the JRE default factory is used. */ @@ -218,7 +214,7 @@ public void initialize(URI pUri, Subject pSubject, Locale[] pLocales) /** * Sets a custom socket factory. The client will use this factory for socket * creation instead of the JRE default. - * + * * @param pFactory * The factory to use for socket creation. null * resets to the JRE default factory. @@ -229,7 +225,7 @@ public void initialize(URI pUri, Subject pSubject, Locale[] pLocales) /** * Enumerate the names of the instances of CIM namespaces. - * + * * @param pNamespace * The Interop Namespace, if known. If null, the default Interop * Namespace names defined by DSP1033 are used. @@ -237,18 +233,17 @@ public void initialize(URI pUri, Subject pSubject, Locale[] pLocales) * @throws WBEMException * If unsuccessful, one of the following status codes must be * returned. The ORDERED list is: - * + * *
       	 *      CIM_ERR_FAILED (some other unspecified error occurred)
       	 * 
      */ - public CloseableIterator enumerateNamespaces(String pNamespace) - throws WBEMException; + public CloseableIterator enumerateNamespaces(String pNamespace) throws WBEMException; /** * Returns an indication of whether the client is active (initialized and * not closed) or inactive (not initialized or closed). - * + * * @return true if client is active, false * otherwise. */ @@ -256,7 +251,7 @@ public CloseableIterator enumerateNamespaces(String pNamespace) /** * Sends the indication to the specified recipient. - * + * * @param pRecipient * URI of indication recipient. * @param pIndication @@ -266,7 +261,7 @@ public CloseableIterator enumerateNamespaces(String pNamespace) * @throws WBEMException * If unsuccessful, one of the following status codes must be * returned. The ORDERED list is: - * + * *
       	 *      CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
       	 *            or otherwise incorrect parameters)
      diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/WBEMConfigurationProperties.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/WBEMConfigurationProperties.java
      index e1a36c4..aaea277 100644
      --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/WBEMConfigurationProperties.java
      +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/WBEMConfigurationProperties.java
      @@ -77,10 +77,9 @@
       /**
        * The interface WBEMConfigurationProperties contains the names of all
        * configuration properties that are recognized by the CIM Client.
      - * 
      + *
        */
       public interface WBEMConfigurationProperties {
      -
       	/**
       	 * A URL string giving the location of the CIM client config file. 
      *
      @@ -300,7 +299,7 @@ public interface WBEMConfigurationProperties { * Type: String
      * Recognition: On next authentication
      * Range: - * + * * org.sblim.cimclient.internal.http.WwwAuthInfo, org.sblim.cimclient.internal.http.PegasusLocalAuthInfo or any self-written subclass of org.sblim.cimclient.internal.http.AuthorizationInfo *
      * Default: org.sblim.cimclient.internal.http.WwwAuthInfo
      @@ -315,12 +314,12 @@ public interface WBEMConfigurationProperties { * WWW-Authenticate field of an HTTP 401 response when authentication
      * fails. The following two strings are examples:
      *
      - * - * + * + * * Basic realm="Secure Area" * Digest realm="testrealm@host.com",qop="auth,auth-int",nonce="dcd98b7102dd2f0e8b11d0f600bfb0c093",opaque="5ccc069c403ebaf9f0171e9517f40e41" - * - * + * + * * Type: String
      * Recognition: On next authentication
      * Range: Basic, Digest
      @@ -632,19 +631,19 @@ public interface WBEMConfigurationProperties { * event the application does not set one via the LogAndTraceManager class. * This stream can either be standard output (System.out), standard error * output (System.err) or a filename to be opened by the client. - * + * * Note: This property has no effect unless sblim.wbem.cimxmlTracing is set * to true. - * + * * Note: This property has no effect if the application already set the * stream prior to client initialization. If the application sets the stream * after client initialization, the stream specified by this property is * overridden. - * + * * Note: If a filename is specified, it is opened and all CIM-XML * communication is written to it - no checks are made for an existing file * or for filling up the disk. USE WITH CAUTION. - * + * * Type: String
      * Recognition: Startup
      * Range: System.out, System.err, filename
      @@ -653,7 +652,7 @@ public interface WBEMConfigurationProperties { public static final String CIMXML_TRACE_STREAM = "sblim.wbem.cimxmlTraceStream"; /** - * + * * Tells the XML builder how to sign embedded objects. This is necessary due to * the non-consequent handling of embedded objects on different CIMOMs. * "AttribOnly" - only the EmbeddedObject="instance/object" is used @@ -663,101 +662,102 @@ public interface WBEMConfigurationProperties { * "EmbObjAndEmbInstQuali" - * on qualified CIM-XML elements the EmbeddedObject qualifier is used * for embedded classes and the EmbeddedInstance="className" qualifier - * is used for embedded instances + * is used for embedded instances * Type: String * Recognition: Anytime * Range: AttribOnly, EmbObjQuali, EmbObjAndEmbInstQuali * Default: AttribOnly - * + * */ public static final String CIMXML_EMBOBJBUILDER = "sblim.wbem.cimxmlEmbObjBuilder"; /** - * + * * If set the type of valueless EmbeddedObjects are mapped to CLASS_T. It should work well * with OpenPegasus-2.7.0. - * If unset no type mapping is done for valuless EmbeddedObjects. - * + * If unset no type mapping is done for valuless EmbeddedObjects. + * * Type: Boolean * Default: true - * + * */ public static final String CIMXML_PARSER_STRICT_EMBOBJ_TYPES = "sblim.wbem.cimxmlParser.strictEmbObjTypes"; /** - * + * * If set to false, the embedded object entity in all requests is in mixed case * (EmbeddedObject) per DSP0203. If set to true, the embedded object entity is in - * upper case (EMBEDDEDOBJECT) - this works with some older CIMOMs, such as OpenPegasus + * upper case (EMBEDDEDOBJECT) - this works with some older CIMOMs, such as OpenPegasus * 2.6.1 and 2.7.0. - * + * * <!ENTITY % EmbeddedObject "EmbeddedObject (object|instance) #IMPLIED"> - * + * * Type: Boolean * Recognition: Startup * Range: true, false * Default: true - * + * */ - public static final String CIMXML_BUILDER_UPPERCASE_EMBOBJ_ENTITIES = "sblim.wbem.cimxmlBuilder.upperCaseEmbObjEntities"; + public static final String CIMXML_BUILDER_UPPERCASE_EMBOBJ_ENTITIES = + "sblim.wbem.cimxmlBuilder.upperCaseEmbObjEntities"; /** - * + * * If set to true, SSL handshakes are performed after an SSL socket is created by the * socket factory. If set to false, handshakes are not performed, which is useful if * if the handshake has already taken place. - * + * * Type: Boolean * Recognition: Anytime * Default: true - * + * */ public static final String PERFORM_SSL_HANDSHAKE = "sblim.wbem.performSslHandshake"; /** - * + * * If set to false, SSL handshakes are not synchronized. If set to true, SSL handshakes * are synchronized as a workaround for an IBMJSSE1 problem with thread-safe handshakes. - * - * Note: This property has no affect unless sblim.wbem.performSslHandshake is set to + * + * Note: This property has no affect unless sblim.wbem.performSslHandshake is set to * true. - * + * * Type: Boolean * Recognition: Anytime * Default: false - * + * */ public static final String SYNCHRONIZED_SSL_HANDSHAKE = "sblim.wbem.synchronizedSslHandshake"; /** - * - * If set to true, socket connections are attempted with the timeout value defined by + * + * If set to true, socket connections are attempted with the timeout value defined by * sblim.wbem.socketConnectTimeout. If set to false, socket connections are attempted * without a timeout. Using a timeout for socket connections is the preferred method - * but may introduce intermittent, significant performance impacts during the connection - * process in Java 5+ (see Sun bug 5092063). - * + * but may introduce intermittent, significant performance impacts during the connection + * process in Java 5+ (see Sun bug 5092063). + * * Type: Boolean * Recognition: Anytime * Default: true - * + * */ public static final String SOCKET_CONNECT_WITH_TIMEOUT = "sblim.wbem.socketConnectWithTimeout"; /** - * + * * The timeout for socket connect requests. A timeout of zero is interpreted * as infinite timeout. - * + * * Note: This property has no effect unless socket connection with timeout is * enabled (see the sblim.wbem.socketConnectWithTimeout property). - * + * * Type: Integer * Unit: Milliseconds * Recognition: Anytime * Range: 0 .. Integer.MAX_VALUE * Default: 0 - * + * */ public static final String SOCKET_CONNECT_TIMEOUT = "sblim.wbem.socketConnectTimeout"; @@ -774,47 +774,47 @@ public interface WBEMConfigurationProperties { public static final String SOCKET_IDLE_TIMEOUT = "sblim.wbem.socketIdleTimeout"; /** - * + * * Turn on/off usage of the default user/password, which can be used * if the CIMOM requires a "garbage" credential. If set to false, * user-supplied credentials will be applied. If set to true, * default credentials will be applied when both the user-supplied * principal and credential are null/empty. - * + * * Type: Boolean * Recognition: Startup * Default: false - * + * */ public static final String KEY_CREDENTIALS_DEFAULT_ENABLED = "sblim.wbem.default.authorization.enabled"; /** - * + * * The name of the user for the "garbage" credential. - * + * * Note: This property has no effect unless default authorization is * enabled (see the sblim.wbem.default.authorization.enabled property) * AND both the user-supplied principal and credential are null/empty. - * + * * Type: String * Recognition: Startup * Default: "default" - * + * */ public static final String KEY_DEFAULT_PRINCIPAL = "sblim.wbem.default.principal"; /** - * + * * The credential of the user for the "garbage" credential. - * + * * Note: This property has no effect unless default authorization is * enabled (see the sblim.wbem.default.authorization.enabled property) * AND both the user-supplied principal and credential are null/empty. - * + * * Type: String * Recognition: Startup * Default: "default" - * + * */ public static final String KEY_DEFAULT_CREDENTIAL = "sblim.wbem.default.credential"; @@ -942,191 +942,192 @@ public interface WBEMConfigurationProperties { public static final String LISTENER_MAX_QUEUED_EVENTS = "sblim.wbem.listenerMaxQueuedEvents"; /** - * + * * If set to true, reliable indication support is enabled and indications - * are processed accordingly. If set to false, reliable indication + * are processed accordingly. If set to false, reliable indication * support is disabled and indications are passed directly to listener. - * + * * If reliable indication support is enabled, incoming indications are - * handled as documented in DSP1054 which includes queuing unexpected - * indications, caching all indications for the duration of their sequence - * identifier lifetime, and logging missing, duplicate and out-of-order + * handled as documented in DSP1054 which includes queuing unexpected + * indications, caching all indications for the duration of their sequence + * identifier lifetime, and logging missing, duplicate and out-of-order * indications. - * + * * The sequence identifier lifetime is defined as: * DeliveryRetryAttempts * DeliveryRetryInterval * 10 * These values can be set by the sblim.wbem.listenerDeliveryRetryAttempts * and sblim.wbem.listenerDeliveryRetryInterval properties below. - * + * * Unexpected indications are queued in either a linked list or a hash * table based on the sblim.wbem.listenerReliableIndicationHashtableCapacity - * property below. The linked list is better suited for a small number of - * listener destinations per WBEMListener while the hash table is better + * property below. The linked list is better suited for a small number of + * listener destinations per WBEMListener while the hash table is better * suited for a large number. - * + * * Type: Boolean * Recognition: On next creation of a WBEMListener * Default: false - * + * */ public static final String LISTENER_ENABLE_RELIABLE_INDICATIONS = "sblim.wbem.listenerEnableReliableIndications"; /** - * + * * The default value to use for the CIM_IndicationService DeliveryRetryAttempts * property. See DSP1054 for details on reliable indications. - * + * * Note: This property has no effect unless reliable indication support is * enabled. See the sblim.wbem.listenerEnableReliableIndications property. - * + * * Type: Long * Unit: Count * Recognition: On next creation of a WBEMListener * Range: 1 .. 1000 * Default: 3 - * + * */ public static final String LISTENER_DELIVERY_RETRY_ATTEMPTS = "sblim.wbem.listenerDeliveryRetryAttempts"; /** - * + * * The default value to use for the CIM_IndicationService DeliveryRetryInterval * property. See DSP1054 for details on reliable indications. - * + * * Note: This property has no effect unless reliable indication support is * enabled. See the sblim.wbem.listenerEnableReliableIndications property. - * + * * Type: Long * Unit: Seconds * Recognition: On next creation of a WBEMListener * Range: 1 .. 86400 * Default: 20 - * + * */ public static final String LISTENER_DELIVERY_RETRY_INTERVAL = "sblim.wbem.listenerDeliveryRetryInterval"; /** - * + * * The default value to use for the reliable indication handler's initial * hash table capacity. A value of 0 indicates use a linked list instead. * Linked lists are better suited for a small number of listener destinations * per WBEMListener while hash tables are better suited for a large number. - * + * * Note: This property has no effect unless reliable indication support is * enabled. See the sblim.wbem.listenerEnableReliableIndications property. - * + * * Type: Integer * Unit: Count * Recognition: On next creation of a WBEMListener * Range: 0 .. 25000 * Default: 0 - * + * */ - public static final String LISTENER_RELIABLE_INDICATION_HASHTABLE_CAPACITY = "sblim.wbem.listenerReliableIndicationHashtableCapacity"; + public static final String LISTENER_RELIABLE_INDICATION_HASHTABLE_CAPACITY = + "sblim.wbem.listenerReliableIndicationHashtableCapacity"; /** - * + * * The filter to use for tracing of incoming indications at the FINE level. - * + * * If string is empty, no tracing of incoming indications will occur. If * string is not empty, it identifies one or more properties to be included * in the trace of all incoming indications. An optional class can be used * to filter the output to include only those indications that contain the * substring. For example, to trace the SequenceContext and SequenceNumber * properties of all alerts, use the following: - * + * * alert:sequencecontext,sequencenumber - * + * * To trace the IndicationTime of all indications, use the following: - * + * * indicationtime - * + * * Note: This property has no effect unless tracing is enabled. See the * sblim.wbem.traceFileLevel property. - * + * * Type: String * Recognition: On next creation of WBEMListener * Format: [class:]property[,property]* - * + * */ public static final String LISTENER_INDICATION_TRACE_FILTER = "sblim.wbem.listenerIndicationTraceFilter"; /** - * + * * If set to true, a property will be added to all indications that identifies * the sender's IP address. If set to false, the property will not be added. - * + * * The property is a CIMProperty with: * name = "SBLIMJCC_SenderIPAddress" * data type = CIMDataType.STRING_T * value = String returned by InetAddress.getHostAddress() (i.e. 1.2.3.4) - * + * * Type: Boolean * Recognition: On next creation of a WBEMListener * Default: false - * + * */ public static final String LISTENER_ADD_SENDER_IP_ADDRESS = "sblim.wbem.listenerAddSenderIPAddress"; /** - * + * * If set to true, numeric string values passed to the java.lang.Double * constructor or its parseDouble method will be checked to make sure they * are not in the range that hangs Java 6- (see Sun bug 4421494). If * set to false, the string values will not be checked. - * + * * Note: This property should only be set to true if running on Java 5 or * Java 6 prior to update 24. - * + * * Type: Boolean * Recognition: Startup * Default: true - * + * */ public static final String VERIFY_JAVA_LANG_DOUBLE_STRINGS = "sblim.wbem.verifyJavaLangDoubleStrings"; /** - * + * * If set to true, numeric key data types in a CIMInstance's CIMObjectPath * will be synchronized to match those of the corresponding keys within * the CIMInstance's CIMProperty[]. If set to false, the numeric key data - * types will not be synchronized. - * + * types will not be synchronized. + * * Note: Only numeric key data types in CIMInstances from CIMOM responses * are synchronized, application calls to the CIMInstance constructor are * not affected. - * + * * Type: Boolean * Recognition: Startup * Default: false - * + * */ public static final String SYNCHRONIZE_NUMERIC_KEY_DATA_TYPES = "sblim.wbem.synchronizeNumericKeyDataTypes"; /** - * + * * If set to true, gzip encoding is enabled. If set to false, gzip encoding * is not enabled. When enabled, outgoing requests include the HTTP header * "Accept-Encoding: gzip" to indicate to the CIMOM that the client handles * message bodies compressed with gzip. If the incoming response includes * "Content-Encoding: gzip" the message body will be decompressed with gzip * before being processed. - * + * * Note: This property does not affect indications or outgoing requests. - * + * * Type: Boolean * Recognition: Anytime * Default: false - * + * */ public static final String ENABLE_GZIP_ENCODING = "sblim.wbem.enableGzipEncoding"; /** - * + * * If set to true, the CIM-XML parser will allow empty LOCALNAMESPACEPATH * elements in incoming responses. If set to false, the parser will not * allow empty LOCALNAMESPACEPATH elements. - * + * * Note: Some older CIMOMs sent empty LOCALNAMESPACEPATHs, relying on the * client to provide the local namespace path. This is a violation of * DSP0201, which dictates that LOCALNAMESPACEPATH must contain at least @@ -1134,14 +1135,15 @@ public interface WBEMConfigurationProperties { * client can adhere to the CIM-XML specifications. Set this property to * true if "LOCALNAMESPACEPATH requires NAMESPACE" exceptions occur while * interacting with one of these older CIMOMs. - * + * * Type: Boolean * Recognition: Anytime * Default: false - * + * */ - public static final String CIMXML_PARSER_ALLOW_EMPTY_LOCALNAMESPACEPATH = "sblim.wbem.cimxmlParser.allowEmptyLocalNameSpacePath"; - + public static final String CIMXML_PARSER_ALLOW_EMPTY_LOCALNAMESPACEPATH = + "sblim.wbem.cimxmlParser.allowEmptyLocalNameSpacePath"; + /** * AMMO-863 *

      diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/WBEMListenerSBLIM.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/WBEMListenerSBLIM.java index 66ae31a..9a96ead 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/WBEMListenerSBLIM.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/WBEMListenerSBLIM.java @@ -61,8 +61,8 @@ import java.util.HashMap; import java.util.Map; import java.util.Properties; - import org.metricshub.wbem.javax.wbem.listener.IndicationListener; +import org.metricshub.wbem.javax.wbem.listener.WBEMListener; import org.metricshub.wbem.javax.wbem.listener.WBEMListenerConstants; import org.metricshub.wbem.sblim.cimclient.internal.http.HttpConnectionHandler; import org.metricshub.wbem.sblim.cimclient.internal.http.HttpServerConnection; @@ -70,22 +70,20 @@ import org.metricshub.wbem.sblim.cimclient.internal.util.WBEMConstants; import org.metricshub.wbem.sblim.cimclient.internal.wbem.indications.CIMEventDispatcher; import org.metricshub.wbem.sblim.cimclient.internal.wbem.indications.CIMIndicationHandler; -import org.metricshub.wbem.javax.wbem.listener.WBEMListener; /** * Class WBEMListenerSBLIM is the SBLIM implementation of the WBEMListener * interface. - * + * */ public class WBEMListenerSBLIM implements WBEMListener { /** * The real implementation of a listener that starts a HTTP server and * processes incoming indications - * + * */ public class WBEMListenerImpl { - private EventListener iIndicationListener; private HttpServerConnection iConnection; @@ -96,7 +94,7 @@ public class WBEMListenerImpl { /** * Ctor. - * + * * @param pLocalAddress * The local address to bind the port to. If null the port is * bound to all local addresses. For use on multi-homed @@ -114,9 +112,14 @@ public class WBEMListenerImpl { * The configuration. * @throws IOException */ - public WBEMListenerImpl(String pLocalAddress, int pPort, boolean pSSL, - EventListener pIndicationListener, Properties pProperties) throws IOException { - + public WBEMListenerImpl( + String pLocalAddress, + int pPort, + boolean pSSL, + EventListener pIndicationListener, + Properties pProperties + ) + throws IOException { // Merge any properties passed via addListener if (pProperties != null) { for (Enumeration e = pProperties.keys(); e.hasMoreElements();) { @@ -126,16 +129,20 @@ public WBEMListenerImpl(String pLocalAddress, int pPort, boolean pSSL, } } WBEMConfiguration config = WBEMListenerSBLIM.this.iConfiguration; - if (!(pIndicationListener instanceof IndicationListener) - && !(pIndicationListener instanceof IndicationListenerSBLIM)) throw new IllegalArgumentException( - "Listener must be instance of IndicationListener or IndicationListenerSBLIM"); + if ( + !(pIndicationListener instanceof IndicationListener) && + !(pIndicationListener instanceof IndicationListenerSBLIM) + ) throw new IllegalArgumentException( + "Listener must be instance of IndicationListener or IndicationListenerSBLIM" + ); this.iIndicationListener = pIndicationListener; - CIMEventDispatcher eventDispatcher = new CIMEventDispatcher(this.iIndicationListener, - config.getListenerMaxQueuedEvents()); + CIMEventDispatcher eventDispatcher = new CIMEventDispatcher( + this.iIndicationListener, + config.getListenerMaxQueuedEvents() + ); this.iIndicationHandler = new CIMIndicationHandler(eventDispatcher, config); this.iConnectionHandler = new HttpConnectionHandler(this.iIndicationHandler, config); - this.iConnection = new HttpServerConnection(this.iConnectionHandler, pLocalAddress, - pPort, pSSL, config); + this.iConnection = new HttpServerConnection(this.iConnectionHandler, pLocalAddress, pPort, pSSL, config); } @Override @@ -165,27 +172,29 @@ public void stop() { /** * Returns the listener we forward the indications to. - * + * * @return The listener. */ public IndicationListener getIndicationListener() { - return (this.iIndicationListener instanceof IndicationListener) ? (IndicationListener) this.iIndicationListener - : null; + return (this.iIndicationListener instanceof IndicationListener) + ? (IndicationListener) this.iIndicationListener + : null; } /** * Returns the listener we forward the indications to. - * + * * @return The listener. */ public IndicationListenerSBLIM getIndicationListenerSBLIM() { - return (this.iIndicationListener instanceof IndicationListenerSBLIM) ? (IndicationListenerSBLIM) this.iIndicationListener - : null; + return (this.iIndicationListener instanceof IndicationListenerSBLIM) + ? (IndicationListenerSBLIM) this.iIndicationListener + : null; } /** * Returns the listener port. - * + * * @return The listener port. */ public int getListenerPort() { @@ -194,7 +203,7 @@ public int getListenerPort() { /** * Get the IPs blocked by the listener. - * + * * @return The comma-separated list of blocked IPs. */ public String getBlockedIPs() { @@ -203,7 +212,7 @@ public String getBlockedIPs() { /** * Set the IPs to be blocked by the listener. - * + * * @param pIPs * The comma-separated list of blocked IPs. */ @@ -225,29 +234,28 @@ public WBEMListenerSBLIM() { /* * (non-Javadoc) - * + * * @see org.metricshub.wbem.javax.wbem.listener.WBEMListener#addListener(javax.wbem.listener. * IndicationListener, int, java.lang.String) */ - public int addListener(IndicationListener pListener, int pPort, String pTransport) - throws IOException { + public int addListener(IndicationListener pListener, int pPort, String pTransport) throws IOException { return addListener((EventListener) pListener, pPort, pTransport, null, null); } /* * (non-Javadoc) - * + * * @see org.metricshub.wbem.javax.wbem.listener.WBEMListener#addListener(javax.wbem.listener. * IndicationListener, int, java.lang.String, java.lang.String) */ - public int addListener(IndicationListener pListener, int pPort, String pTransport, - String pLocalAddr) throws IOException { + public int addListener(IndicationListener pListener, int pPort, String pTransport, String pLocalAddr) + throws IOException { return addListener((EventListener) pListener, pPort, pTransport, pLocalAddr, null); } /** * Add a new listener using the specified port. - * + * * @param pListener * The Indication Listener that will be called when an indication * is received. @@ -265,16 +273,20 @@ public int addListener(IndicationListener pListener, int pPort, String pTranspor * @throws IOException * This exception is thrown when binding to pPort fails. */ - public int addListener(IndicationListener pListener, int pPort, String pTransport, - String pLocalAddr, Properties pConfigurationProperties) throws IOException { - - return addListener((EventListener) pListener, pPort, pTransport, pLocalAddr, - pConfigurationProperties); + public int addListener( + IndicationListener pListener, + int pPort, + String pTransport, + String pLocalAddr, + Properties pConfigurationProperties + ) + throws IOException { + return addListener((EventListener) pListener, pPort, pTransport, pLocalAddr, pConfigurationProperties); } /** * Add a new listener using the specified port. - * + * * @param pListener * The SBLIM Indication Listener that will be called when an * indication is received. @@ -286,14 +298,13 @@ public int addListener(IndicationListener pListener, int pPort, String pTranspor * @throws IOException * This exception is thrown when binding to pPort fails. */ - public int addListener(IndicationListenerSBLIM pListener, int pPort, String pTransport) - throws IOException { + public int addListener(IndicationListenerSBLIM pListener, int pPort, String pTransport) throws IOException { return addListener((EventListener) pListener, pPort, pTransport, null, null); } /** * Add a new listener using the specified port and local address. - * + * * @param pListener * The SBLIM Indication Listener that will be called when an * indication is received. @@ -309,15 +320,15 @@ public int addListener(IndicationListenerSBLIM pListener, int pPort, String pTra * @throws IOException * This exception is thrown when binding to pPort fails. */ - public int addListener(IndicationListenerSBLIM pListener, int pPort, String pTransport, - String pLocalAddr) throws IOException { + public int addListener(IndicationListenerSBLIM pListener, int pPort, String pTransport, String pLocalAddr) + throws IOException { return addListener((EventListener) pListener, pPort, pTransport, pLocalAddr, null); } /** * Add a new listener using the specified port, local address and * properties. - * + * * @param pListener * The SBLIM Indication Listener that will be called when an * indication is received. @@ -335,18 +346,22 @@ public int addListener(IndicationListenerSBLIM pListener, int pPort, String pTra * @throws IOException * This exception is thrown when binding to pPort fails. */ - public int addListener(IndicationListenerSBLIM pListener, int pPort, String pTransport, - String pLocalAddr, Properties pConfigurationProperties) throws IOException { - - return addListener((EventListener) pListener, pPort, pTransport, pLocalAddr, - pConfigurationProperties); + public int addListener( + IndicationListenerSBLIM pListener, + int pPort, + String pTransport, + String pLocalAddr, + Properties pConfigurationProperties + ) + throws IOException { + return addListener((EventListener) pListener, pPort, pTransport, pLocalAddr, pConfigurationProperties); } /** * Add a new listener using the specified port, local address and * properties. This is the worker routine for all public addListener * methods. - * + * * @param pListener * The indication listener (IndicationListener or * IndicationListenerSBLIM) that will be called when @@ -365,19 +380,25 @@ public int addListener(IndicationListenerSBLIM pListener, int pPort, String pTra * @throws IOException * This exception is thrown when binding to pPort fails. */ - private synchronized int addListener(EventListener pListener, int pPort, String pTransport, - String pLocalAddr, Properties pConfigurationProperties) throws IOException { - - if (pPort > 0 && this.iPortMap.containsKey(Integer.valueOf(pPort))) { throw new BindException( - "Port already in use."); } + private synchronized int addListener( + EventListener pListener, + int pPort, + String pTransport, + String pLocalAddr, + Properties pConfigurationProperties + ) + throws IOException { + if (pPort > 0 && this.iPortMap.containsKey(Integer.valueOf(pPort))) { + throw new BindException("Port already in use."); + } boolean ssl; - if (pTransport.equalsIgnoreCase(WBEMConstants.HTTP)) ssl = false; - else if (pTransport.equalsIgnoreCase(WBEMConstants.HTTPS)) ssl = true; - else throw new IllegalArgumentException("Unknown transport: " + pTransport - + "! Valid values are http and https."); + if (pTransport.equalsIgnoreCase(WBEMConstants.HTTP)) ssl = false; else if ( + pTransport.equalsIgnoreCase(WBEMConstants.HTTPS) + ) ssl = true; else throw new IllegalArgumentException( + "Unknown transport: " + pTransport + "! Valid values are http and https." + ); - WBEMListenerImpl listener = new WBEMListenerImpl(pLocalAddr, pPort, ssl, pListener, - pConfigurationProperties); + WBEMListenerImpl listener = new WBEMListenerImpl(pLocalAddr, pPort, ssl, pListener, pConfigurationProperties); listener.start(); this.iPortMap.put(Integer.valueOf(listener.getListenerPort()), listener); @@ -387,14 +408,15 @@ else throw new IllegalArgumentException("Unknown transport: " + pTransport /** * Get the IPs blocked by the listener associated with the specified port. - * + * * @param pPort * The port. * @return The comma-separated list of blocked IPs. */ public String getBlockedIPs(int pPort) { - if (pPort <= 0 || !this.iPortMap.containsKey(Integer.valueOf(pPort))) { throw new IllegalArgumentException( - "Port not in use."); } + if (pPort <= 0 || !this.iPortMap.containsKey(Integer.valueOf(pPort))) { + throw new IllegalArgumentException("Port not in use."); + } WBEMListenerImpl listener = this.iPortMap.get(Integer.valueOf(pPort)); return listener != null ? listener.getBlockedIPs() : null; } @@ -425,15 +447,16 @@ public synchronized void removeListener(int pPort) { /** * Set the IPs to be blocked by the listener associated with the specified * port. - * + * * @param pPort * The port. * @param pIPs * The comma-separated list of blocked IPs. */ public void setBlockedIPs(int pPort, String pIPs) { - if (pPort <= 0 || !this.iPortMap.containsKey(Integer.valueOf(pPort))) { throw new IllegalArgumentException( - "Port not in use."); } + if (pPort <= 0 || !this.iPortMap.containsKey(Integer.valueOf(pPort))) { + throw new IllegalArgumentException("Port not in use."); + } WBEMListenerImpl listener = this.iPortMap.get(Integer.valueOf(pPort)); if (listener != null) { listener.setBlockedIPs(pIPs); @@ -444,14 +467,11 @@ public void setProperty(String pName, String pValue) { if (pName.startsWith("javax.wbem.")) { // Process JSR48 properties if (pName.equals(WBEMListenerConstants.PROP_LISTENER_KEYSTORE)) { - this.iConfiguration.setDomainProperty(WBEMConfigurationProperties.KEYSTORE_PATH, - pValue); + this.iConfiguration.setDomainProperty(WBEMConfigurationProperties.KEYSTORE_PATH, pValue); } else if (pName.equals(WBEMListenerConstants.PROP_LISTENER_KEYSTORE_PASSWORD)) { - this.iConfiguration.setDomainProperty( - WBEMConfigurationProperties.KEYSTORE_PASSWORD, pValue); + this.iConfiguration.setDomainProperty(WBEMConfigurationProperties.KEYSTORE_PASSWORD, pValue); } else if (pName.equals(WBEMListenerConstants.PROP_LISTENER_TRUSTSTORE)) { - this.iConfiguration.setDomainProperty(WBEMConfigurationProperties.TRUSTSTORE_PATH, - pValue); + this.iConfiguration.setDomainProperty(WBEMConfigurationProperties.TRUSTSTORE_PATH, pValue); } else { throw new IllegalArgumentException(pName); } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/discovery/AdvertisementCatalog.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/discovery/AdvertisementCatalog.java index b1100e1..54daae7 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/discovery/AdvertisementCatalog.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/discovery/AdvertisementCatalog.java @@ -23,6 +23,16 @@ package org.metricshub.wbem.sblim.cimclient.discovery; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Set; +import java.util.logging.Level; /*- * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ * WBEM Java Client @@ -44,21 +54,9 @@ */ import javax.security.auth.Subject; - import org.metricshub.wbem.javax.wbem.client.WBEMClient; import org.metricshub.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Locale; -import java.util.logging.Level; -import java.util.Map; -import java.util.Set; - /** * Class AdvertisementCatalog implements a catalog for WBEM service * advertisements. In practice we usually have multiple advertisements for a @@ -67,7 +65,7 @@ * of this by indexing services by the unique service id and therefore surfacing * which advertisements belong to the same service. The application might then * choose it's preferred communication mechanism. - * + * * No thread synchronization provided, this is the responsibility of * the caller. * @since 2.0.2 @@ -78,19 +76,18 @@ public class AdvertisementCatalog { * Interface EventListener specifies listener that are called when an * advertisement is added to or removed from the catalog, expires or is * renewed. - * + * */ public static interface EventListener { - /** * Called when an advertisement is added to the catalog that has not * been a member of the catalog before. - * + * * @param pEvent * The type of the event. One of the constants * EVENT_ADD, EVENT_REMOVE, EVENT_EXPIRE, EVENT_RENEW * in AdvertisementCatalog. - * + * * @param pAdvertisment * The added advertisement */ @@ -100,19 +97,18 @@ public static interface EventListener { /** * Class AdvertisementDecorator decorates a WBEMAdvertisement with state * information required by the AdvertisementCatalog class - * + * * @pattern Decorator * iAvertisement!=null */ private static class AdvertisementDecorator implements WBEMServiceAdvertisement { - private WBEMServiceAdvertisement iAdvertisement; private boolean iRefresh = false; /** * Ctor. - * + * * @param pAdvertisement * The advertisement to decorate */ @@ -123,7 +119,7 @@ protected AdvertisementDecorator(WBEMServiceAdvertisement pAdvertisement) { /** * Returns advertisement - * + * * @return The value of advertisement. */ protected WBEMServiceAdvertisement getAdvertisementXXX() { @@ -132,7 +128,7 @@ protected WBEMServiceAdvertisement getAdvertisementXXX() { /** * Returns refresh - * + * * @return The value of refresh. */ protected boolean isRefresh() { @@ -141,7 +137,7 @@ protected boolean isRefresh() { /** * Sets advertisement - * + * * @param pAdvertisement * The new value of advertisement. */ @@ -151,7 +147,7 @@ protected void setAdvertisement(WBEMServiceAdvertisement pAdvertisement) { /** * Sets refresh - * + * * @param pRefresh * The new value of refresh. */ @@ -161,7 +157,7 @@ protected void setRefresh(boolean pRefresh) { /* * (non-Javadoc) - * + * * @see java.lang.Object#equals(java.lang.Object) */ @Override @@ -171,7 +167,7 @@ public boolean equals(Object pObj) { /* * (non-Javadoc) - * + * * @see java.lang.Object#hashCode() */ @Override @@ -280,13 +276,13 @@ public void setExpired(boolean pExpired) { * Ctor. */ public AdvertisementCatalog() { - /**/ + /**/ } /** * Adds a listener for "add" events. The listener will be called whenever a * advertisement is added to the catalog. - * + * * @param pListener * The listener */ @@ -297,7 +293,7 @@ public void addEventListener(EventListener pListener) { /** * Adds new advertisements to the catalog. Existing advertisements sharing * concrete type, url and directory are replaced. - * + * * @param pAdvertisements * The new advertisements */ @@ -310,8 +306,7 @@ public void addAdvertisements(WBEMServiceAdvertisement[] pAdvertisements) { WBEMProtocol protocol = makeProtocol(advertisement); String serviceId = advertisement.getAttribute(WBEMServiceAdvertisement.SERVICE_ID); { - List innerList = this.iCatalogByDirectory - .get(advertisement.getDirectory()); + List innerList = this.iCatalogByDirectory.get(advertisement.getDirectory()); if (innerList == null) { innerList = new ArrayList(); this.iCatalogByDirectory.put(advertisement.getDirectory(), innerList); @@ -331,8 +326,7 @@ public void addAdvertisements(WBEMServiceAdvertisement[] pAdvertisements) { } } { - Map innerMap = this.iCatalogById - .get(serviceId); + Map innerMap = this.iCatalogById.get(serviceId); if (innerMap == null) { innerMap = new HashMap(); this.iCatalogById.put(serviceId, innerMap); @@ -340,8 +334,7 @@ public void addAdvertisements(WBEMServiceAdvertisement[] pAdvertisements) { innerMap.put(protocol, advertisement); } } catch (Exception e) { - LogAndTraceBroker.getBroker().trace(Level.FINE, - "Incomplete advertisement for" + url, e); + LogAndTraceBroker.getBroker().trace(Level.FINE, "Incomplete advertisement for" + url, e); } } } @@ -349,7 +342,7 @@ public void addAdvertisements(WBEMServiceAdvertisement[] pAdvertisements) { /** * Returns the advertisement from the catalog corresponding to a given id * and with the protocol preferred most. - * + * * @param pId * The service id * @param pProtocols @@ -358,13 +351,16 @@ public void addAdvertisements(WBEMServiceAdvertisement[] pAdvertisements) { * protocols this service returns null. * @return The corresponding advertisement */ - public WBEMServiceAdvertisement getAdvertisement(final String pId, - final WBEMProtocol[] pProtocols) { + public WBEMServiceAdvertisement getAdvertisement(final String pId, final WBEMProtocol[] pProtocols) { Map innerMap = this.iCatalogById.get(pId); - if (innerMap == null) { return null; } + if (innerMap == null) { + return null; + } for (int i = 0; i < pProtocols.length; ++i) { WBEMServiceAdvertisement advertisement = innerMap.get(pProtocols[i]); - if (advertisement != null) { return advertisement; } + if (advertisement != null) { + return advertisement; + } } return null; } @@ -372,35 +368,39 @@ public WBEMServiceAdvertisement getAdvertisement(final String pId, /** * Returns the advertisements from the catalog corresponding to a given * directory - * + * * @param pDirectory * The directory service * @return The corresponding advertisements */ public WBEMServiceAdvertisement[] getAdvertisementsByDirectory(String pDirectory) { List result = this.iCatalogByDirectory.get(pDirectory); - return (result != null ? (WBEMServiceAdvertisement[]) result - .toArray(new WBEMServiceAdvertisement[result.size()]) - : new WBEMServiceAdvertisement[] {}); + return ( + result != null + ? (WBEMServiceAdvertisement[]) result.toArray(new WBEMServiceAdvertisement[result.size()]) + : new WBEMServiceAdvertisement[] {} + ); } /** * Returns the advertisements from the catalog corresponding to a given id - * + * * @param pId * The service id * @return The corresponding advertisements */ public WBEMServiceAdvertisement[] getAdvertisementsById(String pId) { Map innerMap = this.iCatalogById.get(pId); - if (innerMap == null) { return null; } + if (innerMap == null) { + return null; + } Collection advertisements = innerMap.values(); return advertisements.toArray(new WBEMServiceAdvertisement[advertisements.size()]); } /** * Returns an array of service ids known by this catalog - * + * * @return The service ids */ public String[] getKnownIds() { @@ -412,14 +412,13 @@ public String[] getKnownIds() { * Refreshes the advertisements from a given directory. All existing * advertisements from this directory are deleted first before the new ones * are added. - * + * * @param pDirectory * The directory services we got the advertisements from * @param pAdvertisements * The advertisements */ - public void refreshAdvertisements(final String[] pDirectory, - WBEMServiceAdvertisement[] pAdvertisements) { + public void refreshAdvertisements(final String[] pDirectory, WBEMServiceAdvertisement[] pAdvertisements) { for (int i = 0; i < pDirectory.length; ++i) { markRefresh(pDirectory[i]); } @@ -431,7 +430,7 @@ public void refreshAdvertisements(final String[] pDirectory, /** * Removes a listener - * + * * @param pListener * The listener to remove */ @@ -441,14 +440,13 @@ public void removeEventListener(EventListener pListener) { /** * Removes the expired advertisements from the catalog. - * + * * @param pDirectory * When not null only the expired advertisements of * the given directory are removed. Otherwise all expired * advertisements are removed. */ public void removeExpired(String pDirectory) { - if (pDirectory == null) { Iterator iter = this.iCatalogByDirectory.keySet().iterator(); while (iter.hasNext()) { @@ -464,8 +462,7 @@ public void removeExpired(String pDirectory) { if (decorator.isExpired()) { iter.remove(); notifyEventListeners(EVENT_REMOVE, decorator); - Map innerMap = this.iCatalogById - .get(decorator.getServiceId()); + Map innerMap = this.iCatalogById.get(decorator.getServiceId()); innerMap.remove(makeProtocol(decorator)); } } @@ -473,15 +470,15 @@ public void removeExpired(String pDirectory) { /* * (non-Javadoc) - * + * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuffer result = new StringBuffer(); result.append("AdvertisementCatalog:"); - Iterator>> outer = this.iCatalogById - .entrySet().iterator(); + Iterator>> outer = + this.iCatalogById.entrySet().iterator(); while (outer.hasNext()) { Map.Entry> entry = outer.next(); if (entry.getValue() == null) { @@ -491,8 +488,7 @@ public String toString() { result.append(entry.getKey()); result.append("\""); Map innerMap = entry.getValue(); - Iterator> inner = innerMap.entrySet() - .iterator(); + Iterator> inner = innerMap.entrySet().iterator(); while (inner.hasNext()) { Map.Entry innerEntry = inner.next(); result.append("["); @@ -506,7 +502,9 @@ public String toString() { private void expire(String pDirectory) { List advertisementList = this.iCatalogByDirectory.get(pDirectory); - if (advertisementList == null) { return; } + if (advertisementList == null) { + return; + } Iterator iter = advertisementList.iterator(); while (iter.hasNext()) { AdvertisementDecorator advertisement = iter.next(); @@ -518,12 +516,16 @@ private void expire(String pDirectory) { } } - private AdvertisementDecorator findAdvertisement(List pList, - WBEMServiceAdvertisement pAdvertisement) { + private AdvertisementDecorator findAdvertisement( + List pList, + WBEMServiceAdvertisement pAdvertisement + ) { Iterator iter = pList.iterator(); while (iter.hasNext()) { AdvertisementDecorator entry = iter.next(); - if (entry.getServiceUrl().equals(pAdvertisement.getServiceUrl())) { return entry; } + if (entry.getServiceUrl().equals(pAdvertisement.getServiceUrl())) { + return entry; + } } return null; } @@ -531,8 +533,7 @@ private AdvertisementDecorator findAdvertisement(List pL private WBEMProtocol makeProtocol(WBEMServiceAdvertisement advertisement) { String presentation = advertisement.getAttribute(WBEMServiceAdvertisement.COMM_MECHANISM); if ("OTHER".equalsIgnoreCase(presentation)) { - presentation = advertisement - .getAttribute(WBEMServiceAdvertisement.OTHER_COMM_MECHN_DESC); + presentation = advertisement.getAttribute(WBEMServiceAdvertisement.OTHER_COMM_MECHN_DESC); } String transport = advertisement.getServiceUrl().split(":", 2)[0]; WBEMProtocol protocol = new WBEMProtocol(transport, presentation); @@ -541,7 +542,9 @@ private WBEMProtocol makeProtocol(WBEMServiceAdvertisement advertisement) { private void markRefresh(String pDirectory) { List advertisementList = this.iCatalogByDirectory.get(pDirectory); - if (advertisementList == null) { return; } + if (advertisementList == null) { + return; + } Iterator iter = advertisementList.iterator(); while (iter.hasNext()) { AdvertisementDecorator advertisement = iter.next(); @@ -555,5 +558,4 @@ private void notifyEventListeners(int pEvent, WBEMServiceAdvertisement pAdvertis iter.next().advertisementEvent(pEvent, pAdvertisement); } } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/discovery/Discoverer.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/discovery/Discoverer.java index 92f333f..274eaaf 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/discovery/Discoverer.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/discovery/Discoverer.java @@ -43,15 +43,14 @@ /** * Interface Discoverer offers methodology for discovering WBEM services. - * + * * Implementations SHALL ensure thread-safety * @since 2.0.2 */ public interface Discoverer { - /** * Finds WBEM services using a given list of directory servers - * + * * @param pDirectoryUrls * An array of directory servers. For SLP this would be a list of * DA URLs. @@ -63,7 +62,7 @@ public interface Discoverer { * Finds directory services. The semantics of this method might be protocol * specific. E.g. for SLP this sends a multicast into the local subnet * looking first for directory agent, second for service agents. - * + * * @return A String[] containing the URLs of the directories * @since 2.0.3 */ diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/discovery/DiscovererFactory.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/discovery/DiscovererFactory.java index 47b40bc..fa747b0 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/discovery/DiscovererFactory.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/discovery/DiscovererFactory.java @@ -41,20 +41,18 @@ */ import java.util.Locale; - -import org.metricshub.wbem.sblim.cimclient.internal.discovery.slp.DiscovererSLP; import org.metricshub.wbem.sblim.cimclient.discovery.Discoverer; +import org.metricshub.wbem.sblim.cimclient.internal.discovery.slp.DiscovererSLP; /** * Class DiscovererFactory is responsible for creating concrete instances of the * Discoverer interface. - * + * * This class is thread-safe. - * + * * @since 2.0.2 */ public class DiscovererFactory { - /** * The Service Location Protocol (SLP) */ @@ -64,7 +62,7 @@ public class DiscovererFactory { /** * Returns the concrete Discoverer for a given discovery protocol. - * + * * @param pProtocol The discovery protocol, e.g. "SLP" * @return The corresponding discoverer * @throws IllegalArgumentException On unsupported protocols @@ -79,7 +77,7 @@ public static Discoverer getDiscoverer(String pProtocol) throws IllegalArgumentE /** * Return an array of all supported discovery protocols - * + * * @return The supported protocols */ public static String[] getSupportedProtocols() { @@ -87,5 +85,6 @@ public static String[] getSupportedProtocols() { } private DiscovererFactory() { - /**/} + /**/ + } } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/discovery/WBEMProtocol.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/discovery/WBEMProtocol.java index a1f31c7..ebe1956 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/discovery/WBEMProtocol.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/discovery/WBEMProtocol.java @@ -43,19 +43,18 @@ /** * Class WBEMProtocol encapsulates a transport/presentation protocol pair. E.g. * "HTTPS/CIM-XML" - * + * * iTransport != null
      iPresentation != null
      * @since 2.0.2 */ public class WBEMProtocol { - private String iTransport; private String iPresentation; /** * Ctor. - * + * * @param pTransport * The transport protocol (e.g. HTTP, HTTPS, RMI) * @param pPresentation @@ -68,7 +67,7 @@ public WBEMProtocol(String pTransport, String pPresentation) { /** * Returns the presentation protocol (e.g. CIM-XML) - * + * * @return The value. */ public String getPresentation() { @@ -77,7 +76,7 @@ public String getPresentation() { /** * Sets the presentation protocol - * + * * @param pPresentation * The new value (e.g. CIM-XML) */ @@ -87,7 +86,7 @@ public void setPresentation(String pPresentation) { /** * Returns transport protocol (e.g. HTTP) - * + * * @return The value. */ public String getTransport() { @@ -96,7 +95,7 @@ public String getTransport() { /** * Sets the transport protocol - * + * * @param pTransport * The new value (e.g. HTTP). */ @@ -106,22 +105,21 @@ public void setTransport(String pTransport) { /* * (non-Javadoc) - * + * * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object pObj) { if (pObj instanceof WBEMProtocol) { WBEMProtocol that = (WBEMProtocol) pObj; - return (this.iTransport.equals(that.iTransport)) - && (this.iPresentation.equals(that.iPresentation)); + return (this.iTransport.equals(that.iTransport)) && (this.iPresentation.equals(that.iPresentation)); } return false; } /* * (non-Javadoc) - * + * * @see java.lang.Object#hashCode() */ @Override @@ -131,12 +129,11 @@ public int hashCode() { /* * (non-Javadoc) - * + * * @see java.lang.Object#toString() */ @Override public String toString() { return this.iTransport + "/" + this.iPresentation; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/discovery/WBEMServiceAdvertisement.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/discovery/WBEMServiceAdvertisement.java index 803a842..4fb64aa 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/discovery/WBEMServiceAdvertisement.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/discovery/WBEMServiceAdvertisement.java @@ -43,11 +43,9 @@ */ import java.util.Locale; -import java.util.Set; import java.util.Map.Entry; - +import java.util.Set; import javax.security.auth.Subject; - import org.metricshub.wbem.javax.wbem.client.WBEMClient; /** @@ -58,13 +56,12 @@ * attribute by name. This design was chosen because the set of attributes might * be extended by DMTF and vendor implementations. It's also unclear if upcoming * new discovery protocols will have the same set of attributes as SLP. - * + * * Immutable * This class is thread-safe * @since 2.0.2 */ public interface WBEMServiceAdvertisement { - /** * template-type (string): The scheme name of the service scheme. The scheme * name consists of the service type name and an optional naming authority @@ -249,13 +246,13 @@ public interface WBEMServiceAdvertisement { * MUST be the CIM_RegisteredProfile.RegisteredName property value when it * is used as a Dependent in the CIM_SubProfileRequiresProfile association * for the specified Profile Name (used as the antecedent). - * + * */ public static final String REG_PROF_SUPP = "RegisteredProfilesSupported"; /** * Gets the URL of the directory from which this advertisement was received - * + * * @return The directory URL */ public abstract String getDirectory(); @@ -264,28 +261,28 @@ public interface WBEMServiceAdvertisement { * Returns the concrete service type. E.g. for the SLP advertised service * service:wbem:https this method would return * https. - * + * * @return The concrete service type */ public abstract String getConcreteServiceType(); /** * Returns the interop namespaces - * + * * @return The interop namespaces */ public abstract String[] getInteropNamespaces(); /** * Returns the service url, e.g. http://9.155.62.79:5988 - * + * * @return The service url */ public abstract String getServiceUrl(); /** * Return the attribute value for a given attribute name - * + * * @param pAttributeName * The attribute name * @return The value @@ -294,7 +291,7 @@ public interface WBEMServiceAdvertisement { /** * Return the set of attributes of this advertisement - * + * * @return A Set<Map.Entry<String, String>> containing the name * value pairs of the attributes. */ @@ -302,14 +299,14 @@ public interface WBEMServiceAdvertisement { /** * Returns the service id - * + * * @return The service id */ public abstract String getServiceId(); /** * Returns the expiration state of the advertisement. - * + * * @return true when advertisement is expired. */ public abstract boolean isExpired(); @@ -319,7 +316,7 @@ public interface WBEMServiceAdvertisement { * application to mark an advertisement as expired, e.g. when it's no longer * reported by the corresponding directory. Used for this purpose by * AdvertisementCatalog. - * + * * @param pExpired * The new value */ @@ -330,7 +327,7 @@ public interface WBEMServiceAdvertisement { * that is subject of this advertisement. On every call to this method a new * client will be created. The client is not stored or cached anywhere in * this class. - * + * * @param pSubject * The credential for authenticating with the service * @param pLocales diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cim/CIMElementSorter.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cim/CIMElementSorter.java index 29a43e9..ee9f515 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cim/CIMElementSorter.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cim/CIMElementSorter.java @@ -44,7 +44,6 @@ import java.util.Arrays; import java.util.Comparator; - import org.metricshub.wbem.javax.cim.CIMElement; /** @@ -52,12 +51,11 @@ * name in them. */ public class CIMElementSorter implements Comparator { - private static final Comparator COMPARATOR = new CIMElementSorter(); /** * Sorts the passed CIMElement array, the passed array is not copied. - * + * * @param pArray * the array which will be sorted if it's not null * @return pArray @@ -65,7 +63,7 @@ public class CIMElementSorter implements Comparator { public static CIMElement[] sort(CIMElement[] pArray) { if (pArray == null || pArray.length == 0) return null; synchronized (pArray) { - Arrays.sort(pArray /* , COMPARATOR */); + Arrays.sort(pArray/* , COMPARATOR */); } return pArray; } @@ -73,7 +71,7 @@ public static CIMElement[] sort(CIMElement[] pArray) { /** * Finds CIMElement, named pName, in pArray which must be a sorted array of * CIMElements. - * + * * @param pArray * @param pName * @return the CIMElement if found, otherwise null @@ -91,7 +89,7 @@ public static CIMElement find(CIMElement[] pArray, String pName) { /** * Finds the index of CIMElement, named pName, in pArray which must be a * sorted array of CIMElements. - * + * * @param pArray * @param pName * @return the index, just like in case of Arrays.binarySearch() @@ -111,11 +109,8 @@ public int compare(Object pObj0, Object pObj1) { // ebak: handling null objects if (pObj0 == null) return pObj1 == null ? 0 : 1; if (pObj1 == null) return -1; - String name0 = pObj0 instanceof CIMElement ? ((CIMElement) pObj0).getName() - : (String) pObj0; - String name1 = pObj1 instanceof CIMElement ? ((CIMElement) pObj1).getName() - : (String) pObj1; + String name0 = pObj0 instanceof CIMElement ? ((CIMElement) pObj0).getName() : (String) pObj0; + String name1 = pObj1 instanceof CIMElement ? ((CIMElement) pObj1).getName() : (String) pObj1; return name0.compareToIgnoreCase(name1); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cim/CIMHelper.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cim/CIMHelper.java index e048802..5d0af54 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cim/CIMHelper.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cim/CIMHelper.java @@ -48,32 +48,31 @@ import java.math.BigInteger; import java.net.URI; import java.net.URISyntaxException; - import org.metricshub.wbem.javax.cim.CIMDataType; import org.metricshub.wbem.javax.cim.CIMInstance; import org.metricshub.wbem.javax.cim.CIMObjectPath; -import org.metricshub.wbem.sblim.cimclient.internal.util.WBEMConstants; import org.metricshub.wbem.javax.cim.CIMProperty; import org.metricshub.wbem.javax.cim.UnsignedInteger16; import org.metricshub.wbem.javax.cim.UnsignedInteger32; import org.metricshub.wbem.javax.cim.UnsignedInteger64; import org.metricshub.wbem.javax.cim.UnsignedInteger8; +import org.metricshub.wbem.sblim.cimclient.internal.util.WBEMConstants; /** * Class CIMHelper provides convenience methods that are missing from the * official JSR48 API - * + * */ public abstract class CIMHelper { private CIMHelper() { - // no instances + // no instances } /** * Creates a URI of a CIMOM from a given CIM object path, adding default * port if port not parsable. - * + * * @param pPath * The CIM object path. * @return The URI. @@ -94,7 +93,7 @@ public static URI createCimomUri(CIMObjectPath pPath) throws URISyntaxException /** * Creates a URI of a CIMOM from a given URI, adding default port if port * not specified. - * + * * @param pUri * The URI. * @return The URI. @@ -112,30 +111,31 @@ public static URI createCimomUri(URI pUri) throws URISyntaxException { } private static CIMDataType CIMScalarDataTypes[] = { - /* 00 */CIMDataType.UINT8_T, - /* 01 */CIMDataType.SINT8_T, - /* 02 */CIMDataType.UINT16_T, - /* 03 */CIMDataType.SINT16_T, - /* 04 */CIMDataType.UINT32_T, - /* 05 */CIMDataType.SINT32_T, - /* 06 */CIMDataType.UINT64_T, - /* 07 */CIMDataType.SINT64_T, - /* 08 */CIMDataType.STRING_T, - /* 09 */CIMDataType.BOOLEAN_T, - /* 10 */CIMDataType.REAL32_T, - /* 11 */CIMDataType.REAL64_T, - /* 12 */CIMDataType.DATETIME_T, - /* 13 */CIMDataType.CHAR16_T, - /* 14 */new CIMDataType(""), - /* 15 */CIMDataType.OBJECT_T, - /* 16 */null, - /* 17 */CIMDataType.CLASS_T }; + /* 00 */CIMDataType.UINT8_T, + /* 01 */CIMDataType.SINT8_T, + /* 02 */CIMDataType.UINT16_T, + /* 03 */CIMDataType.SINT16_T, + /* 04 */CIMDataType.UINT32_T, + /* 05 */CIMDataType.SINT32_T, + /* 06 */CIMDataType.UINT64_T, + /* 07 */CIMDataType.SINT64_T, + /* 08 */CIMDataType.STRING_T, + /* 09 */CIMDataType.BOOLEAN_T, + /* 10 */CIMDataType.REAL32_T, + /* 11 */CIMDataType.REAL64_T, + /* 12 */CIMDataType.DATETIME_T, + /* 13 */CIMDataType.CHAR16_T, + /* 14 */new CIMDataType(""), + /* 15 */CIMDataType.OBJECT_T, + /* 16 */null, + /* 17 */CIMDataType.CLASS_T + }; /** * Returns the CIMDataType of a scalar of the specified data type. This * should be used in lieu of "new CIMDataType(pType)" which is not supported * by the JSR48 standard. - * + * * @param pType * Data type. * @return CIMDataType corresponding to data type. @@ -146,30 +146,31 @@ public static CIMDataType ScalarDataType(int pType) { } private static CIMDataType CIMArrayDataTypes[] = { - /* 00 */CIMDataType.UINT8_ARRAY_T, - /* 01 */CIMDataType.SINT8_ARRAY_T, - /* 02 */CIMDataType.UINT16_ARRAY_T, - /* 03 */CIMDataType.SINT16_ARRAY_T, - /* 04 */CIMDataType.UINT32_ARRAY_T, - /* 05 */CIMDataType.SINT32_ARRAY_T, - /* 06 */CIMDataType.UINT64_ARRAY_T, - /* 07 */CIMDataType.SINT64_ARRAY_T, - /* 08 */CIMDataType.STRING_ARRAY_T, - /* 09 */CIMDataType.BOOLEAN_ARRAY_T, - /* 10 */CIMDataType.REAL32_ARRAY_T, - /* 11 */CIMDataType.REAL64_ARRAY_T, - /* 12 */CIMDataType.DATETIME_ARRAY_T, - /* 13 */CIMDataType.CHAR16_ARRAY_T, - /* 14 */new CIMDataType("", 0), - /* 15 */CIMDataType.OBJECT_ARRAY_T, - /* 16 */null, - /* 17 */CIMDataType.CLASS_ARRAY_T }; + /* 00 */CIMDataType.UINT8_ARRAY_T, + /* 01 */CIMDataType.SINT8_ARRAY_T, + /* 02 */CIMDataType.UINT16_ARRAY_T, + /* 03 */CIMDataType.SINT16_ARRAY_T, + /* 04 */CIMDataType.UINT32_ARRAY_T, + /* 05 */CIMDataType.SINT32_ARRAY_T, + /* 06 */CIMDataType.UINT64_ARRAY_T, + /* 07 */CIMDataType.SINT64_ARRAY_T, + /* 08 */CIMDataType.STRING_ARRAY_T, + /* 09 */CIMDataType.BOOLEAN_ARRAY_T, + /* 10 */CIMDataType.REAL32_ARRAY_T, + /* 11 */CIMDataType.REAL64_ARRAY_T, + /* 12 */CIMDataType.DATETIME_ARRAY_T, + /* 13 */CIMDataType.CHAR16_ARRAY_T, + /* 14 */new CIMDataType("", 0), + /* 15 */CIMDataType.OBJECT_ARRAY_T, + /* 16 */null, + /* 17 */CIMDataType.CLASS_ARRAY_T + }; /** * Returns the CIMDataType of an unbounded array of the specified data type. * This should be used in lieu of "new CIMDataType(pType,0)" which is not * supported by the JSR48 standard. - * + * * @param pType * Data type. * @return CIMDataType corresponding to data type. @@ -184,7 +185,7 @@ public static CIMDataType UnboundedArrayDataType(int pType) { * CIMInstance where the data types of all numeric keys in the * CIMObjectPath match those of the corresponding keys within * the CIMProperty[]. - * + * * The need for this conversion mechanism arises from a deficiency in the * CIM-XML specs, where the TYPE (sint8, uint8, etc.) is required for * PROPERTY but not for KEYVALUE. If a CIMOM sends a KEYVALUE of @@ -192,7 +193,7 @@ public static CIMDataType UnboundedArrayDataType(int pType) { * sint64, uint64 or real64. This can cause problems (i.e. * ClassCastException) down the line if the TYPE of the corresponding * PROPERTY is different. - * + * * @param pObjectPath * Instance object path. * @param pProps @@ -200,7 +201,9 @@ public static CIMDataType UnboundedArrayDataType(int pType) { * @return CIMInstance with numeric key data types synchronized. */ public static CIMInstance CIMInstanceWithSynchonizedNumericKeyDataTypes( - CIMObjectPath pObjectPath, CIMProperty[] pProps) { + CIMObjectPath pObjectPath, + CIMProperty[] pProps + ) { CIMInstance inst = new CIMInstance(pObjectPath, pProps); CIMProperty[] oldKeys = inst.getKeys(); CIMProperty[] newKeys = new CIMProperty[oldKeys.length]; @@ -209,21 +212,43 @@ public static CIMInstance CIMInstanceWithSynchonizedNumericKeyDataTypes( for (int i = 0; i < oldKeys.length; i++) { CIMDataType oldType = oldKeys[i].getDataType(); CIMProperty prop = inst.getProperty(oldKeys[i].getName()); - if (oldType != null && prop != null && prop.getDataType() != null - && !prop.getDataType().equals(oldType) && isNumericObject(oldType) - && isNumericObject(prop.getDataType())) { + if ( + oldType != null && + prop != null && + prop.getDataType() != null && + !prop.getDataType().equals(oldType) && + isNumericObject(oldType) && + isNumericObject(prop.getDataType()) + ) { update = true; - newKeys[i] = new CIMProperty(oldKeys[i].getName(), prop.getDataType(), + newKeys[i] = + new CIMProperty( + oldKeys[i].getName(), + prop.getDataType(), translateNumericObject(oldKeys[i].getValue(), oldType, prop.getDataType()), - oldKeys[i].isKey(), oldKeys[i].isPropagated(), oldKeys[i].getOriginClass()); + oldKeys[i].isKey(), + oldKeys[i].isPropagated(), + oldKeys[i].getOriginClass() + ); } else { newKeys[i] = oldKeys[i]; } } - return (update ? inst.deriveInstance(new CIMObjectPath(pObjectPath.getScheme(), pObjectPath - .getHost(), pObjectPath.getPort(), pObjectPath.getNamespace(), pObjectPath - .getObjectName(), newKeys)) : inst); + return ( + update + ? inst.deriveInstance( + new CIMObjectPath( + pObjectPath.getScheme(), + pObjectPath.getHost(), + pObjectPath.getPort(), + pObjectPath.getNamespace(), + pObjectPath.getObjectName(), + newKeys + ) + ) + : inst + ); } private static boolean isNumericObject(CIMDataType type) { @@ -243,8 +268,7 @@ private static boolean isNumericObject(CIMDataType type) { return false; } - private static Object translateNumericObject(Object oldValue, CIMDataType oldType, - CIMDataType newType) { + private static Object translateNumericObject(Object oldValue, CIMDataType oldType, CIMDataType newType) { if (oldValue == null) return null; int from = oldType.getType(), to = newType.getType(); diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cim/CIMInstanceBuilder.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cim/CIMInstanceBuilder.java index 4413836..9cf6c06 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cim/CIMInstanceBuilder.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cim/CIMInstanceBuilder.java @@ -46,7 +46,6 @@ import java.util.ArrayList; import java.util.List; - import org.metricshub.wbem.javax.cim.CIMObjectPath; import org.metricshub.wbem.javax.cim.CIMProperty; @@ -60,23 +59,21 @@ * ( VALUE.NAMEDINSTANCE->INSTANCE->PROPERTY* )
      * The implementation merges the properties from both params.
      * From CIMObjectPath's keys only the type and value information is considered.
      - * + * */ public class CIMInstanceBuilder { - private CIMProperty[] iProperties; private static final Object[] EMPTY_RPOP_A = new CIMProperty[0]; /** * Ctor. - * + * * @param pPath * @param pProps * @throws IllegalArgumentException */ - public CIMInstanceBuilder(CIMObjectPath pPath, CIMProperty[] pProps) - throws IllegalArgumentException { + public CIMInstanceBuilder(CIMObjectPath pPath, CIMProperty[] pProps) throws IllegalArgumentException { this.iProperties = pProps != null ? pProps : new CIMProperty[0]; CIMElementSorter.sort(this.iProperties); addPathKeys(pPath); @@ -84,7 +81,7 @@ public CIMInstanceBuilder(CIMObjectPath pPath, CIMProperty[] pProps) /** * Extends the keys of the passed CIMObjectPath. - * + * * @param pPath * @return the new CIMObjectPath */ @@ -99,13 +96,19 @@ public CIMObjectPath setKeys(CIMObjectPath pPath) { * CIMObjectPath( String scheme, String host, String port, String * namespace, String objectName, CIMProperty[] keys ) */ - return new CIMObjectPath(pPath.getScheme(), pPath.getHost(), pPath.getPort(), pPath - .getNamespace(), pPath.getObjectName(), (CIMProperty[]) keys.toArray(EMPTY_RPOP_A)); + return new CIMObjectPath( + pPath.getScheme(), + pPath.getHost(), + pPath.getPort(), + pPath.getNamespace(), + pPath.getObjectName(), + (CIMProperty[]) keys.toArray(EMPTY_RPOP_A) + ); } /** * getAllPropertis - * + * * @return all properties in an ordered way */ public CIMProperty[] getAllPropertis() { @@ -122,8 +125,7 @@ private void addPathKeys(CIMObjectPath pPath) throws IllegalArgumentException { CIMProperty[] newArray = new CIMProperty[this.iProperties.length + 1]; System.arraycopy(this.iProperties, 0, newArray, 0, pos); newArray[pos] = key; - System.arraycopy(this.iProperties, pos, newArray, pos + 1, this.iProperties.length - - pos); + System.arraycopy(this.iProperties, pos, newArray, pos + 1, this.iProperties.length - pos); this.iProperties = newArray; } else { CIMProperty prop = this.iProperties[pos]; @@ -134,10 +136,15 @@ private void addPathKeys(CIMObjectPath pPath) throws IllegalArgumentException { } private static CIMProperty mkKey(CIMProperty pProp) { - return new CIMProperty(pProp.getName(), pProp.getDataType(), pProp.getValue(), - true, pProp.isPropagated(), pProp.getOriginClass()); + return new CIMProperty( + pProp.getName(), + pProp.getDataType(), + pProp.getValue(), + true, + pProp.isPropagated(), + pProp.getOriginClass() + ); } - /* * private static void typeAndValueCheck(CIMProperty pPathProp, CIMProperty * pArrayProp) throws IllegalArgumentException { CIMDataType pType = diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cim/CIMOctetString.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cim/CIMOctetString.java index f75d9a3..9e8f891 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cim/CIMOctetString.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cim/CIMOctetString.java @@ -62,7 +62,6 @@ * representations in common. */ public class CIMOctetString { - private UnsignedInteger8 iBytes[]; private String iASCIIString; @@ -75,7 +74,7 @@ public class CIMOctetString { /** * Constructs a CIMOctetString from the given byte array. - * + * * @param pBytes * Byte array representation of octet string. * @throws IllegalArgumentException @@ -83,37 +82,40 @@ public class CIMOctetString { public CIMOctetString(UnsignedInteger8 pBytes[]) throws IllegalArgumentException { // Minimum (empty) byte array is { 0x00 0x00 0x00 0x04 } if (pBytes == null || pBytes.length < 4) throw new IllegalArgumentException( - "Array of bytes must contain at least four bytes"); + "Array of bytes must contain at least four bytes" + ); // Verify there are no null entries in byte array - for (int i = pBytes.length - 1; i >= 0; i--) - if (pBytes[i] == null) throw new IllegalArgumentException( - "Array of bytes must not contain any null bytes"); + for (int i = pBytes.length - 1; i >= 0; i--) if (pBytes[i] == null) throw new IllegalArgumentException( + "Array of bytes must not contain any null bytes" + ); // Calculate length - this.iLength = pBytes[3].byteValue() + (pBytes[2].byteValue() * 0x100) - + (pBytes[1].byteValue() * 0x10000) + (pBytes[0].byteValue() * 0x1000000); + this.iLength = + pBytes[3].byteValue() + + (pBytes[2].byteValue() * 0x100) + + (pBytes[1].byteValue() * 0x10000) + + (pBytes[0].byteValue() * 0x1000000); // Verify calculated length matches actual length if (this.iLength != pBytes.length) throw new IllegalArgumentException( - "Array of bytes contains invalid length: found " + this.iLength + ", expected " - + pBytes.length); + "Array of bytes contains invalid length: found " + this.iLength + ", expected " + pBytes.length + ); // Save byte array in new object this.iBytes = new UnsignedInteger8[this.iLength]; - for (int i = this.iLength - 1; i >= 0; i--) - this.iBytes[i] = pBytes[i]; + for (int i = this.iLength - 1; i >= 0; i--) this.iBytes[i] = pBytes[i]; } /** * Constructs a CIMOctetString from the given string. - * + * * @param pString * String representation of octet string. * @param pIsHex * true if string is hexadecimal string, * false if string is ASCII string. - * + * * @throws IllegalArgumentException */ public CIMOctetString(String pString, boolean pIsHex) throws IllegalArgumentException { @@ -122,32 +124,38 @@ public CIMOctetString(String pString, boolean pIsHex) throws IllegalArgumentExce if (pIsHex) { // Minimum (empty) hexadecimal string is "0x00000004" if (pString.length() < 10) throw new IllegalArgumentException( - "Hexadecimal string must contain \"0x\" and at least four pairs of hex digits"); + "Hexadecimal string must contain \"0x\" and at least four pairs of hex digits" + ); // Verify hexadecimal string starts with "0x" if (pString.charAt(0) != '0' || pString.charAt(1) != 'x') throw new IllegalArgumentException( - "Hexadecimal string must begin with \"0x\""); + "Hexadecimal string must begin with \"0x\"" + ); // Calculate length try { this.iLength = Integer.parseInt(pString.substring(2, 10), 16); } catch (NumberFormatException e) { - throw new IllegalArgumentException( - "Hexadecimal string length could not be parsed: " + e.toString()); + throw new IllegalArgumentException("Hexadecimal string length could not be parsed: " + e.toString()); } // Verify calculated length matches actual length if ((this.iLength * 2) + 2 != pString.length()) throw new IllegalArgumentException( - "Hexadecimal string contains invalid length: found " + this.iLength - + ", expected " + ((pString.length() - 2 / 2))); + "Hexadecimal string contains invalid length: found " + + this.iLength + + ", expected " + + ((pString.length() - 2 / 2)) + ); // Verify remainder of hexadecimal string contains only hexadecimal // digits for (int i = pString.length() - 1; i >= 10; i--) { char ch = pString.charAt(i); - if (!((ch >= '0' && ch <= '9') || (ch >= 'a' && ch <= 'f') || (ch >= 'A' && ch <= 'F'))) throw new IllegalArgumentException( - "Hexadecimal string could not be parsed, invalid character \'" + ch - + "\' at index " + i); + if ( + !((ch >= '0' && ch <= '9') || (ch >= 'a' && ch <= 'f') || (ch >= 'A' && ch <= 'F')) + ) throw new IllegalArgumentException( + "Hexadecimal string could not be parsed, invalid character \'" + ch + "\' at index " + i + ); } // Save hexadecimal string in new object @@ -169,10 +177,10 @@ public CIMOctetString(String pString, boolean pIsHex) throws IllegalArgumentExce * are equal. If the octet strings have no representations in common, this * method will build the missing one, starting with byte array and then * hexadecmial string. - * + * * NOTE: The ASCII string representation is only considered if both octet * strings were constructed with an ASCII string. - * + * * @param pObj * The object to be compared a CIM element. * @return true if the specified CIM octet string equals this @@ -191,8 +199,9 @@ public synchronized boolean equals(Object pObj) { // Verify byte arrays match if both non-null if (this.iBytes != null && that.iBytes != null) { - for (int i = this.iLength - 1; i >= 0; i--) - if (this.iBytes[i].byteValue() != that.iBytes[i].byteValue()) return false; + for (int i = this.iLength - 1; i >= 0; i--) if ( + this.iBytes[i].byteValue() != that.iBytes[i].byteValue() + ) return false; numCompares++; } @@ -203,8 +212,7 @@ public synchronized boolean equals(Object pObj) { } // Verify ASCII strings match if both non-null - if (this.iASCIIString != null && that.iASCIIString != null - && this.iReplacementChar == that.iReplacementChar) { + if (this.iASCIIString != null && that.iASCIIString != null && this.iReplacementChar == that.iReplacementChar) { if (!this.iASCIIString.equalsIgnoreCase(that.iASCIIString)) return false; numCompares++; } @@ -218,8 +226,9 @@ public synchronized boolean equals(Object pObj) { if (this.iBytes != null && that.iBytes == null) { that.getBytes(); if (this.iBytes != null && that.iBytes != null) { - for (int i = this.iLength - 1; i >= 0; i--) - if (this.iBytes[i].byteValue() != that.iBytes[i].byteValue()) return false; + for (int i = this.iLength - 1; i >= 0; i--) if ( + this.iBytes[i].byteValue() != that.iBytes[i].byteValue() + ) return false; numCompares++; } } @@ -230,8 +239,9 @@ public synchronized boolean equals(Object pObj) { if (this.iBytes == null && that.iBytes != null) { getBytes(); if (this.iBytes != null && that.iBytes != null) { - for (int i = this.iLength - 1; i >= 0; i--) - if (this.iBytes[i].byteValue() != that.iBytes[i].byteValue()) return false; + for (int i = this.iLength - 1; i >= 0; i--) if ( + this.iBytes[i].byteValue() != that.iBytes[i].byteValue() + ) return false; numCompares++; } } @@ -269,7 +279,7 @@ public synchronized boolean equals(Object pObj) { * characters replaced by pReplacementChar. If the ASCII string * has not yet been created, it is created from the byte array or * hexadecimal string. - * + * * @param pReplacementChar * Replacement character for non-printable characters which must * be between 0x20 and 0x7E, inclusive. @@ -281,7 +291,8 @@ public synchronized String getASCIIString(char pReplacementChar) { // Verify replacement character is printable if (pReplacementChar <= 0x1F || pReplacementChar >= 0x7F) throw new IllegalArgumentException( - "Replacement character not printable"); + "Replacement character not printable" + ); // If we already did this once, return previous string if (this.iASCIIString != null && this.iReplacementChar == pReplacementChar) return this.iASCIIString; @@ -291,14 +302,12 @@ public synchronized String getASCIIString(char pReplacementChar) { if (this.iBytes != null) { for (int i = 4; i < this.iBytes.length; i++) { char ch = (char) this.iBytes[i].byteValue(); - if (ch <= 0x1F || ch >= 0x7F) str.append(pReplacementChar); - else str.append(ch); + if (ch <= 0x1F || ch >= 0x7F) str.append(pReplacementChar); else str.append(ch); } } else /* (this.iHexString != null) */{ for (int i = 10; i < this.iHexString.length(); i += 2) { char ch = (char) Integer.parseInt(this.iHexString.substring(i, i + 2), 16); - if (ch <= 0x1F || ch >= 0x7F) str.append(pReplacementChar); - else str.append(ch); + if (ch <= 0x1F || ch >= 0x7F) str.append(pReplacementChar); else str.append(ch); } } @@ -314,7 +323,7 @@ public synchronized String getASCIIString(char pReplacementChar) { * Returns byte array representation of octet string. If the byte array has * not yet been created, it is created from the hexadecimal string or ASCII * string. - * + * * @return Byte array representation of octet string. */ public synchronized UnsignedInteger8[] getBytes() { @@ -333,7 +342,7 @@ public synchronized UnsignedInteger8[] getBytes() { * Returns hexadecimal string representation of octet string. If the * hexadecimal string has not yet been created, it is created from the byte * array or ASCII string. - * + * * @return Hexadecimal string representation of octet string. */ public synchronized String getHexString() { @@ -350,7 +359,7 @@ public synchronized String getHexString() { /** * Returns hash code value for octet string. - * + * * @return Hash code value for octet string. */ @Override @@ -361,7 +370,7 @@ public int hashCode() { /** * Returns length of octet string, where length is number of octets plus * four. - * + * * @return Length of octet string. */ public int length() { @@ -370,7 +379,7 @@ public int length() { /** * Returns string representation of octet string. - * + * * @return String representation of octet string. */ @Override @@ -384,8 +393,7 @@ private void convertBytesToHexString() { // Append length String len = Integer.toHexString(this.iLength); - for (int i = 8 - len.length(); i > 0; i--) - str.append('0'); + for (int i = 8 - len.length(); i > 0; i--) str.append('0'); str.append(len); // Append string @@ -397,7 +405,6 @@ private void convertBytesToHexString() { // Save hexadecimal string in new object this.iHexString = new String(str); - // debug("convertBytesToHexString: from {" + toBytesString() + "} to \"" // + this.iHexString + "\""); } @@ -412,12 +419,10 @@ private void convertHexStringToBytes() { try { s = Short.parseShort(this.iHexString.substring(idxStr, idxStr + 2), 16); } catch (NumberFormatException e) { - throw new IllegalArgumentException("Hex string length could not be parsed: " - + e.toString()); + throw new IllegalArgumentException("Hex string length could not be parsed: " + e.toString()); } this.iBytes[idxByte] = new UnsignedInteger8(s); } - // debug("convertHexStringToBytes: from \"" + this.iHexString + // "\" to {" + toBytesString() + "}"); } @@ -433,9 +438,8 @@ private void convertASCIIStringToBytes() { this.iBytes[3] = new UnsignedInteger8((short) (this.iLength & 0xFF)); // Convert each character in ASCII string to byte - for (int idxStr = 0, idxByte = 4; idxStr < this.iASCIIString.length(); idxStr++, idxByte++) - this.iBytes[idxByte] = new UnsignedInteger8((short) (this.iASCIIString.charAt(idxStr))); - + for (int idxStr = 0, idxByte = 4; idxStr < this.iASCIIString.length(); idxStr++, idxByte++) this.iBytes[idxByte] = + new UnsignedInteger8((short) (this.iASCIIString.charAt(idxStr))); // debug("convertASCIIStringToBytes: from \"" + this.iASCIIString + // "\" to {" + toBytesString() + "}"); } @@ -446,8 +450,7 @@ private void convertASCIIStringToHexString() { // Append length String len = Integer.toHexString(this.iLength); - for (int i = 8 - len.length(); i > 0; i--) - str.append('0'); + for (int i = 8 - len.length(); i > 0; i--) str.append('0'); str.append(len); // Append string @@ -459,11 +462,9 @@ private void convertASCIIStringToHexString() { // Save hexadecimal string in new object this.iHexString = new String(str); - // debug("convertASCIIStringToHexString: from \"" + this.iASCIIString + // "\" to \"" + this.iHexString + "\""); } - // private String toBytesString() { // StringBuilder str = new StringBuilder(); // diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cim/CIMQualifiedElementInterfaceImpl.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cim/CIMQualifiedElementInterfaceImpl.java index eefe45c..932649a 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cim/CIMQualifiedElementInterfaceImpl.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cim/CIMQualifiedElementInterfaceImpl.java @@ -55,18 +55,16 @@ import java.io.Serializable; import java.util.ArrayList; import java.util.Arrays; - import org.metricshub.wbem.javax.cim.CIMDataType; -import org.metricshub.wbem.javax.cim.CIMQualifier; import org.metricshub.wbem.javax.cim.CIMFlavor; import org.metricshub.wbem.javax.cim.CIMQualifiedElementInterface; +import org.metricshub.wbem.javax.cim.CIMQualifier; /** * Class CIMQualifiedElementInterfaceImpl is responsible for implementing the * functionality of javax.cim.CIMQualifiedElementInterface */ public class CIMQualifiedElementInterfaceImpl implements CIMQualifiedElementInterface, Serializable { - /** * serialVersionUID */ @@ -78,17 +76,25 @@ public class CIMQualifiedElementInterfaceImpl implements CIMQualifiedElementInte private boolean iEmbeddedObject; - private static final CIMQualifier KEY = new CIMQualifier("Key", - CIMDataType.BOOLEAN_T, Boolean.TRUE, CIMFlavor.DISABLEOVERRIDE); + private static final CIMQualifier KEY = new CIMQualifier( + "Key", + CIMDataType.BOOLEAN_T, + Boolean.TRUE, + CIMFlavor.DISABLEOVERRIDE + ); private static final CIMQualifier ASSOCIATION = new CIMQualifier( - "Association", CIMDataType.BOOLEAN_T, Boolean.TRUE, CIMFlavor.DISABLEOVERRIDE); + "Association", + CIMDataType.BOOLEAN_T, + Boolean.TRUE, + CIMFlavor.DISABLEOVERRIDE + ); private static final CIMQualifier[] EMPTY_QA = new CIMQualifier[0]; /** * Ctor. This constructor doesn't modify the passed qualifier list. - * + * * @param pQualifiers */ public CIMQualifiedElementInterfaceImpl(CIMQualifier[] pQualifiers) { @@ -98,7 +104,7 @@ public CIMQualifiedElementInterfaceImpl(CIMQualifier[] pQualifiers) { /** * Ctor. This constructor modifies the qualifier list according to the * pIsKeyed flag. - * + * * @param pQualifiers * @param pIsKeyed */ @@ -110,13 +116,12 @@ public CIMQualifiedElementInterfaceImpl(CIMQualifier[] pQualifiers, boolean p * Ctor. This constructor is able to not remove the EmbeddedObject * qualifier. It is useful for the XML parser to parse EmbeddedObject * qualified elements without values. - * + * * @param pQualifiers * @param pIsKeyed * @param pKeepEmbObj */ - public CIMQualifiedElementInterfaceImpl(CIMQualifier[] pQualifiers, boolean pIsKeyed, - boolean pKeepEmbObj) { + public CIMQualifiedElementInterfaceImpl(CIMQualifier[] pQualifiers, boolean pIsKeyed, boolean pKeepEmbObj) { this(pQualifiers, pIsKeyed, pKeepEmbObj, false); } @@ -125,14 +130,18 @@ public CIMQualifiedElementInterfaceImpl(CIMQualifier[] pQualifiers, boolean p * qualifier. It is useful for the XML parser to parse EmbeddedObject * qualified elements without values. It also adds or removes the * Association qualifier depending on the value of pIsAssociation. - * + * * @param pQualifiers * @param pIsKeyed * @param pKeepEmbObj * @param pIsAssociation */ - public CIMQualifiedElementInterfaceImpl(CIMQualifier[] pQualifiers, boolean pIsKeyed, - boolean pKeepEmbObj, boolean pIsAssociation) { + public CIMQualifiedElementInterfaceImpl( + CIMQualifier[] pQualifiers, + boolean pIsKeyed, + boolean pKeepEmbObj, + boolean pIsAssociation + ) { if (pKeepEmbObj) { this.iQualis = (CIMQualifier[]) CIMElementSorter.sort(pQualifiers); this.iEmbeddedObject = CIMElementSorter.findIdx(this.iQualis, "EmbeddedObject") >= 0; @@ -164,7 +173,7 @@ public int hashCode() { /** * Sets the Qualifiers. If there is an EmbeddedObject qualifier, * corresponding flag is set. - * + * * @param pQualiA */ private void setQualis(CIMQualifier[] pQualiA) { @@ -182,7 +191,7 @@ private void setQualis(CIMQualifier[] pQualiA) { * if pValue is false and boolean qualifier exists it is removed.
      * if pValue is true and boolean qualifier exists, it's value is changed to * true, if boolean qualifier doesn't exist it is added. - * + * * @param pQuali * @param pValue */ @@ -210,22 +219,18 @@ private void insertQuali(CIMQualifier pQuali, int idx) { int origLength = this.iQualis == null ? 0 : this.iQualis.length; CIMQualifier[] qualis = new CIMQualifier[origLength + 1]; int srcIdx = 0, dstIdx = 0; - while (srcIdx < idx) - qualis[dstIdx++] = this.iQualis[srcIdx++]; + while (srcIdx < idx) qualis[dstIdx++] = this.iQualis[srcIdx++]; qualis[dstIdx++] = pQuali; - while (srcIdx < origLength) - qualis[dstIdx++] = this.iQualis[srcIdx++]; + while (srcIdx < origLength) qualis[dstIdx++] = this.iQualis[srcIdx++]; this.iQualis = qualis; } private void removeQuali(int idx) { CIMQualifier[] qualis = new CIMQualifier[this.iQualis.length - 1]; int srcIdx = 0, dstIdx = 0; - while (srcIdx < idx) - qualis[dstIdx++] = this.iQualis[srcIdx++]; + while (srcIdx < idx) qualis[dstIdx++] = this.iQualis[srcIdx++]; ++srcIdx; - while (srcIdx < this.iQualis.length) - qualis[dstIdx++] = this.iQualis[srcIdx++]; + while (srcIdx < this.iQualis.length) qualis[dstIdx++] = this.iQualis[srcIdx++]; this.iQualis = qualis; } @@ -236,7 +241,7 @@ private void removeQuali(int idx) { /** * Returns true if the "key" Qualifier with true value presents. - * + * * @return true/false */ public boolean isKeyed() { @@ -245,7 +250,7 @@ public boolean isKeyed() { /** * Returns true if the "EmbeddedObject" qualifier with true value presents. - * + * * @return true/false */ public boolean isEmbeddedObject() { @@ -291,7 +296,7 @@ public CIMQualifier[] getQualifiers() { /** * getQualifiers - helps filtering based on the propagated flag. - * + * * @param pLocalOnly * @return CIMQualifier[] */ @@ -300,8 +305,7 @@ public CIMQualifier[] getQualifiers(boolean pLocalOnly) { if (!pLocalOnly) return this.iQualis; if (this.iLocalOnlyQualis == null) { ArrayList> qualiL = new ArrayList>(this.iQualis.length); - for (int i = 0; i < this.iQualis.length; i++) - if (!this.iQualis[i].isPropagated()) qualiL.add(this.iQualis[i]); + for (int i = 0; i < this.iQualis.length; i++) if (!this.iQualis[i].isPropagated()) qualiL.add(this.iQualis[i]); this.iLocalOnlyQualis = qualiL.toArray(new CIMQualifier[qualiL.size()]); } return this.iLocalOnlyQualis; @@ -323,5 +327,4 @@ public boolean hasQualifierValue(String pName, Object pValue) { Object value = getQualifierValue(pName); return value == null ? pValue == null : value.equals(pValue); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cim/CIMVersion.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cim/CIMVersion.java index bbd8836..a272c98 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cim/CIMVersion.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cim/CIMVersion.java @@ -53,7 +53,6 @@ * product name, etc. of the Java CIM Client */ public class CIMVersion { - private static String PRODUCT_NAME = "n/a"; private static String VERSION = "n/a"; @@ -92,7 +91,7 @@ public class CIMVersion { /** * Gets the build date - * + * * @return The build date */ public static String getBuildDate() { @@ -101,7 +100,7 @@ public static String getBuildDate() { /** * Gets the build time - * + * * @return The build time */ public static String getBuildTime() { @@ -110,7 +109,7 @@ public static String getBuildTime() { /** * Gets the copyright statement - * + * * @return THe copyright */ public static String getCopyright() { @@ -119,7 +118,7 @@ public static String getCopyright() { /** * Gets the product name - * + * * @return The product name */ public static String getProductName() { @@ -128,7 +127,7 @@ public static String getProductName() { /** * Gets the version - * + * * @return The version */ public static String getVersion() { @@ -137,7 +136,7 @@ public static String getVersion() { /** * toString - * + * * @see java.lang.Object#toString() */ @Override @@ -147,7 +146,7 @@ public String toString() { /** * main - * + * * @param args */ public static void main(String[] args) { diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cim/DTStringReader.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cim/DTStringReader.java index bd669b0..b58dc8b 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cim/DTStringReader.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cim/DTStringReader.java @@ -47,10 +47,9 @@ /** * Class DTString helps parsing CIMDateTime Strings. - * + * */ public class DTStringReader { - private String iDateTimeStr; private StringReader iReader; @@ -61,7 +60,7 @@ public class DTStringReader { /** * Ctor. - * + * * @param pDateTimeStr */ public DTStringReader(String pDateTimeStr) { @@ -71,7 +70,7 @@ public DTStringReader(String pDateTimeStr) { /** * read - * + * * @param pLen * - number of characters to be read from the string * @param pFieldName @@ -81,8 +80,7 @@ public DTStringReader(String pDateTimeStr) { * @return int * @throws IllegalArgumentException */ - public int read(int pLen, String pFieldName, boolean pAllowUnsignificant) - throws IllegalArgumentException { + public int read(int pLen, String pFieldName, boolean pAllowUnsignificant) throws IllegalArgumentException { char[] buf = new char[pLen]; int read; try { @@ -93,15 +91,14 @@ public int read(int pLen, String pFieldName, boolean pAllowUnsignificant) throw new IllegalArgumentException(msg); } if (read != pLen) { - String msg = "Length of " + pFieldName + " field should be " + pLen + " but only" - + read + " characters could be read!"; + String msg = + "Length of " + pFieldName + " field should be " + pLen + " but only" + read + " characters could be read!"; throw new IllegalArgumentException(msg); } // Not significant check if (pAllowUnsignificant) { int cnt = 0; - for (int i = 0; i < buf.length; i++) - if (buf[i] == '*') ++cnt; + for (int i = 0; i < buf.length; i++) if (buf[i] == '*') ++cnt; if (cnt == buf.length) { this.iUnsignificant = true; return -1; @@ -113,21 +110,22 @@ public int read(int pLen, String pFieldName, boolean pAllowUnsignificant) try { res = Integer.parseInt(field); } catch (NumberFormatException e) { - String msg = "Illegal " + pFieldName + " field \"" + field + "\" in \"" - + this.iDateTimeStr + "\"!"; + String msg = "Illegal " + pFieldName + " field \"" + field + "\" in \"" + this.iDateTimeStr + "\"!"; throw new IllegalArgumentException(msg); } - if (res < 0) throw new IllegalArgumentException("Negative value is not allowed for " - + pFieldName + " in " + this.iDateTimeStr + "!"); + if (res < 0) throw new IllegalArgumentException( + "Negative value is not allowed for " + pFieldName + " in " + this.iDateTimeStr + "!" + ); // Java 7 parseInt began allowing plus sign if (field.indexOf('+') != -1) throw new IllegalArgumentException( - "Plus sign is not allowed for " + pFieldName + " in " + this.iDateTimeStr + "!"); + "Plus sign is not allowed for " + pFieldName + " in " + this.iDateTimeStr + "!" + ); return res; } /** * readAndCheck - * + * * @param pLen * - number of digits to read * @param pFieldName @@ -142,19 +140,28 @@ public int read(int pLen, String pFieldName, boolean pAllowUnsignificant) * @return int * @throws IllegalArgumentException */ - public int readAndCheck(int pLen, String pFieldName, int pMin, int pMax, - boolean pAllowUnsignificant) throws IllegalArgumentException { + public int readAndCheck(int pLen, String pFieldName, int pMin, int pMax, boolean pAllowUnsignificant) + throws IllegalArgumentException { int val = read(pLen, pFieldName, pAllowUnsignificant); if (pAllowUnsignificant && val == -1) return val; - if (val < pMin || val > pMax) throw new IllegalArgumentException(pFieldName - + " must be between " + pMin + " and " + pMax + ", but " + val + " was read from " - + this.iDateTimeStr + " !"); + if (val < pMin || val > pMax) throw new IllegalArgumentException( + pFieldName + + " must be between " + + pMin + + " and " + + pMax + + ", but " + + val + + " was read from " + + this.iDateTimeStr + + " !" + ); return val; } /** * read - * + * * @return a char, 0 if failed */ public char read() { @@ -172,22 +179,21 @@ public char read() { /** * read - Throws an IllegalArgumentException if the read character is not c. - * + * * @param c * - contains the character which should be read from the String. * @throws IllegalArgumentException */ public void read(char c) throws IllegalArgumentException { if (read() != c) { - String msg = "'" + c + "' expected at position " + getPos() + " in " - + this.iDateTimeStr + "!"; + String msg = "'" + c + "' expected at position " + getPos() + " in " + this.iDateTimeStr + "!"; throw new IllegalArgumentException(msg); } } /** * getPos - * + * * @return the position in the reader */ public int getPos() { @@ -196,11 +202,10 @@ public int getPos() { /** * isUnsignificant - * + * * @return boolean */ public boolean isUnsignificant() { return this.iUnsignificant; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cim/DTStringWriter.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cim/DTStringWriter.java index 095d3bc..2e2ea07 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cim/DTStringWriter.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cim/DTStringWriter.java @@ -48,12 +48,11 @@ * Class DTStringWriter helps making CIMDateTime Strings. */ public class DTStringWriter { - private StringBuffer iBuf = new StringBuffer(); /** * writeInt - writes an integer, the upper digits are filled with zeros - * + * * @param pNum * -1 means that asterisks have to be printed * @param pDigits @@ -77,7 +76,7 @@ public void write(int pDigits, int pNum) { /** * writeSignedInt - used for utc writing - * + * * @param pNum * @param pDigits */ @@ -93,20 +92,19 @@ public void writeSigned(int pDigits, int pNum) { /** * writeUSec - * + * * @param pUSec * @param pUnsignificantDigits */ public void writeUSec(int pUSec, int pUnsignificantDigits) { int digits = 6 - pUnsignificantDigits; write(digits, pUSec); - for (int i = 0; i < pUnsignificantDigits; i++) - write('*'); + for (int i = 0; i < pUnsignificantDigits; i++) write('*'); } /** * writeChar - * + * * @param pChar */ public void write(char pChar) { @@ -115,7 +113,7 @@ public void write(char pChar) { /** * write - * + * * @param pStr */ public void write(String pStr) { diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/CIMClientXML_HelperImpl.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/CIMClientXML_HelperImpl.java index d9ea7ad..ffc3edd 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/CIMClientXML_HelperImpl.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/CIMClientXML_HelperImpl.java @@ -80,14 +80,19 @@ import java.util.Iterator; import java.util.Random; import java.util.Vector; - +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; import org.metricshub.wbem.javax.cim.CIMArgument; import org.metricshub.wbem.javax.cim.CIMClass; import org.metricshub.wbem.javax.cim.CIMDataType; import org.metricshub.wbem.javax.cim.CIMInstance; +import org.metricshub.wbem.javax.cim.CIMNamedElementInterface; import org.metricshub.wbem.javax.cim.CIMObjectPath; +import org.metricshub.wbem.javax.cim.CIMProperty; import org.metricshub.wbem.javax.cim.CIMQualifierType; import org.metricshub.wbem.javax.cim.CIMValuedElement; +import org.metricshub.wbem.javax.cim.UnsignedInteger32; import org.metricshub.wbem.javax.wbem.WBEMException; import org.metricshub.wbem.sblim.cimclient.internal.logging.TimeStamp; import org.metricshub.wbem.sblim.cimclient.internal.util.MOF; @@ -120,14 +125,6 @@ import org.metricshub.wbem.sblim.cimclient.internal.wbem.operations.CIMSetInstanceOp; import org.metricshub.wbem.sblim.cimclient.internal.wbem.operations.CIMSetPropertyOp; import org.metricshub.wbem.sblim.cimclient.internal.wbem.operations.CIMSetQualifierTypeOp; -import org.metricshub.wbem.javax.cim.CIMNamedElementInterface; -import org.metricshub.wbem.javax.cim.CIMProperty; -import org.metricshub.wbem.javax.cim.UnsignedInteger32; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; - import org.w3c.dom.Document; import org.w3c.dom.Element; import org.xml.sax.InputSource; @@ -140,7 +137,6 @@ public class CIMClientXML_HelperImpl { private static class Counter { - private int iCounter; protected Counter(int pCounter) { @@ -206,7 +202,7 @@ private static String valueStr(CIMValuedElement pE) { /** * Ctor. - * + * * @throws ParserConfigurationException */ public CIMClientXML_HelperImpl() throws ParserConfigurationException { @@ -216,7 +212,7 @@ public CIMClientXML_HelperImpl() throws ParserConfigurationException { /** * getDocumentBuilder - * + * * @return DocumentBuilder */ public DocumentBuilder getDocumentBuilder() { @@ -225,7 +221,7 @@ public DocumentBuilder getDocumentBuilder() { /** * newDocument - * + * * @return Document */ public Document newDocument() { @@ -234,7 +230,7 @@ public Document newDocument() { /** * parse - * + * * @param pIS * @return Document * @throws IOException @@ -247,7 +243,7 @@ public Document parse(InputSource pIS) throws IOException, SAXException { /** * Serializes a given DOM document as (CIM-)XML to a given output stream - * + * * @param pOS * The output stream * @param pDoc @@ -263,7 +259,7 @@ public static void serialize(OutputStream pOS, Document pDoc) throws IOException * Serializes a given DOM document as (CIM-)XML to a given output stream. * The document is pretty wrapped and indented and surrounded with markers * for the begin and end. - * + * * @param pOS * The output stream * @param pDoc @@ -278,7 +274,7 @@ public static void dumpDocument(OutputStream pOS, Document pDoc) throws IOExcept * Serializes a given DOM document as (CIM-)XML to a given output stream. * The document is pretty wrapped and indented and surrounded with markers * for the begin and end. - * + * * @param pOS * The output stream * @param pDoc @@ -288,10 +284,11 @@ public static void dumpDocument(OutputStream pOS, Document pDoc) throws IOExcept * etc.) * @throws IOException */ - public static void dumpDocument(OutputStream pOS, Document pDoc, String pOrigin) - throws IOException { + public static void dumpDocument(OutputStream pOS, Document pDoc, String pOrigin) throws IOException { // debug - if (pOS == null) { return; } + if (pOS == null) { + return; + } if (pOrigin == null) pOrigin = "unknown"; pOS.write("<--- ".getBytes()); pOS.write(pOrigin.getBytes()); @@ -306,15 +303,14 @@ public static void dumpDocument(OutputStream pOS, Document pDoc, String pOrigin) /** * createCIMMessage - * + * * @param pDoc * @param pRequestE * @return Element */ public Element createCIMMessage(Document pDoc, Element pRequestE) { Element cimE = CIMXMLBuilderImpl.createCIM(pDoc); - Element messageE = CIMXMLBuilderImpl.createMESSAGE(pDoc, cimE, String.valueOf(getNextId()), - VERSION); + Element messageE = CIMXMLBuilderImpl.createMESSAGE(pDoc, cimE, String.valueOf(getNextId()), VERSION); if (pRequestE != null) { messageE.appendChild(pRequestE); } @@ -323,7 +319,7 @@ public Element createCIMMessage(Document pDoc, Element pRequestE) { /** * createMultiReq - * + * * @param pDoc * @return Element */ @@ -334,7 +330,7 @@ public Element createMultiReq(Document pDoc) { /** * associatorNames_request - * + * * @param pDoc * @param pObjectName * @param pAssocClass @@ -344,23 +340,25 @@ public Element createMultiReq(Document pDoc) { * @return Element * @throws WBEMException */ - public Element associatorNames_request(Document pDoc, CIMObjectPath pObjectName, - String pAssocClass, String pResultClass, String pRole, String pResultRole) - throws WBEMException { - + public Element associatorNames_request( + Document pDoc, + CIMObjectPath pObjectName, + String pAssocClass, + String pResultClass, + String pRole, + String pResultRole + ) + throws WBEMException { // obtain data String className = pObjectName.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name"); CIMProperty[] keysA = pObjectName.getKeys(); Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, - ASSOCIATOR_NAMES); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, ASSOCIATOR_NAMES); CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pObjectName); - Element iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, "ObjectName"); + Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ObjectName"); Element instancenameE = CIMXMLBuilderImpl.createINSTANCENAME(pDoc, iparamvalueE, className); for (int i = 0; i < keysA.length; i++) { CIMProperty prop = keysA[i]; @@ -393,15 +391,14 @@ public Element associatorNames_request(Document pDoc, CIMObjectPath pObjectName, /** * associatorNames_response - * + * * @param pDoc * @param pPathA * @return Element */ public static Element associatorNames_response(Document pDoc, CIMObjectPath[] pPathA) { Element simpRspE = CIMXMLBuilderImpl.createSIMPLERSP(pDoc, null); - Element iMethRspE = CIMXMLBuilderImpl.createIMETHODRESPONSE(pDoc, simpRspE, - "associatorNames"); + Element iMethRspE = CIMXMLBuilderImpl.createIMETHODRESPONSE(pDoc, simpRspE, "associatorNames"); Element iRetValE = CIMXMLBuilderImpl.createIRETURNVALUE(pDoc, iMethRspE); try { for (int i = 0; i < pPathA.length; i++) { @@ -415,7 +412,7 @@ public static Element associatorNames_response(Document pDoc, CIMObjectPath[] pP /** * associatorInstances_request - * + * * @param pDoc * @param pObjectName * @param pAssocClass @@ -427,24 +424,31 @@ public static Element associatorNames_response(Document pDoc, CIMObjectPath[] pP * @return Element * @throws WBEMException */ - public Element associatorInstances_request(Document pDoc, CIMObjectPath pObjectName, - String pAssocClass, String pResultClass, String pRole, String pResultRole, - boolean pIncludeClassOrigin, String[] pPropertyList) throws WBEMException { - + public Element associatorInstances_request( + Document pDoc, + CIMObjectPath pObjectName, + String pAssocClass, + String pResultClass, + String pRole, + String pResultRole, + boolean pIncludeClassOrigin, + String[] pPropertyList + ) + throws WBEMException { String className = pObjectName.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name"); CIMProperty[] keysA = pObjectName.getKeys(); // Make sure keys are populated - if (keysA.length == 0) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "associatorInstances requires keys for the instance to be populated"); + if (keysA.length == 0) throw new WBEMException( + WBEMException.CIM_ERR_INVALID_PARAMETER, + "associatorInstances requires keys for the instance to be populated" + ); Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "Associators"); CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pObjectName); - Element iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, "ObjectName"); + Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ObjectName"); Element instancenameE = CIMXMLBuilderImpl.createINSTANCENAME(pDoc, iparamvalueE, className); for (int i = 0; i < keysA.length; i++) { CIMProperty prop = keysA[i]; @@ -472,8 +476,7 @@ public Element associatorInstances_request(Document pDoc, CIMObjectPath pObjectN CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pResultRole); } - iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, "IncludeClassOrigin"); + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "IncludeClassOrigin"); CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeClassOrigin); if (pPropertyList != null) { @@ -489,7 +492,7 @@ public Element associatorInstances_request(Document pDoc, CIMObjectPath pObjectN /** * associatorClasses_request - * + * * @param pDoc * @param pObjectName * @param pAssocClass @@ -502,25 +505,31 @@ public Element associatorInstances_request(Document pDoc, CIMObjectPath pObjectN * @return Element * @throws WBEMException */ - public Element associatorClasses_request(Document pDoc, CIMObjectPath pObjectName, - String pAssocClass, String pResultClass, String pRole, String pResultRole, - boolean pIncludeQualifiers, boolean pIncludeClassOrigin, String[] pPropertyList) - throws WBEMException { - + public Element associatorClasses_request( + Document pDoc, + CIMObjectPath pObjectName, + String pAssocClass, + String pResultClass, + String pRole, + String pResultRole, + boolean pIncludeQualifiers, + boolean pIncludeClassOrigin, + String[] pPropertyList + ) + throws WBEMException { String className = pObjectName.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name"); // Make sure keys are not populated if (pObjectName.getKeys().length != 0) throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, - "Keys should not be populated for associatorClasses"); + WBEMException.CIM_ERR_INVALID_PARAMETER, + "Keys should not be populated for associatorClasses" + ); Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "Associators"); CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pObjectName); - Element iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, "ObjectName"); + Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ObjectName"); CIMXMLBuilderImpl.createINSTANCENAME(pDoc, iparamvalueE, className); @@ -543,8 +552,7 @@ public Element associatorClasses_request(Document pDoc, CIMObjectPath pObjectNam iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "IncludeQualifiers"); CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeQualifiers); - iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, "IncludeClassOrigin"); + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "IncludeClassOrigin"); CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeClassOrigin); if (pPropertyList != null) { @@ -560,7 +568,7 @@ public Element associatorClasses_request(Document pDoc, CIMObjectPath pObjectNam /** * associators_request - * + * * @param pDoc * @param pObjectName * @param pAssocClass @@ -573,22 +581,27 @@ public Element associatorClasses_request(Document pDoc, CIMObjectPath pObjectNam * @return Element * @throws WBEMException */ - public Element associators_request(Document pDoc, CIMObjectPath pObjectName, - String pAssocClass, String pResultClass, String pRole, String pResultRole, - boolean pIncludeQualifiers, boolean pIncludeClassOrigin, String[] pPropertyList) - throws WBEMException { - + public Element associators_request( + Document pDoc, + CIMObjectPath pObjectName, + String pAssocClass, + String pResultClass, + String pRole, + String pResultRole, + boolean pIncludeQualifiers, + boolean pIncludeClassOrigin, + String[] pPropertyList + ) + throws WBEMException { // obtain data String className = pObjectName.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name"); CIMProperty[] keysA = pObjectName.getKeys(); Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "Associators"); CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pObjectName); - Element iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, "ObjectName"); + Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ObjectName"); Element instancenameE = CIMXMLBuilderImpl.createINSTANCENAME(pDoc, iparamvalueE, className); for (int i = 0; i < keysA.length; i++) { CIMProperty prop = keysA[i]; @@ -620,8 +633,7 @@ public Element associators_request(Document pDoc, CIMObjectPath pObjectName, iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "IncludeQualifiers"); CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeQualifiers); - iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, "IncludeClassOrigin"); + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "IncludeClassOrigin"); CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeClassOrigin); if (pPropertyList != null) { @@ -638,13 +650,12 @@ public Element associators_request(Document pDoc, CIMObjectPath pObjectName, /** * associators_response - * + * * @param pDoc * @param pNamedElementA * @return Element */ - public static Element associators_response(Document pDoc, - CIMNamedElementInterface[] pNamedElementA) { + public static Element associators_response(Document pDoc, CIMNamedElementInterface[] pNamedElementA) { Element simpRspE = CIMXMLBuilderImpl.createSIMPLERSP(pDoc, null); Element iMethRspE = CIMXMLBuilderImpl.createIMETHODRESPONSE(pDoc, simpRspE, "associators"); Element iRetValE = CIMXMLBuilderImpl.createIRETURNVALUE(pDoc, iMethRspE); @@ -653,8 +664,7 @@ public static Element associators_response(Document pDoc, CIMNamedElementInterface namedElement = pNamedElementA[i]; CIMObjectPath op = namedElement.getObjectPath(); String nameSpace = op == null ? null : op.getNamespace(); - CIMXMLBuilderImpl - .createVALUEOBJECTWITHPATH(pDoc, iRetValE, namedElement, nameSpace); + CIMXMLBuilderImpl.createVALUEOBJECTWITHPATH(pDoc, iRetValE, namedElement, nameSpace); /* * CIMXMLBuilderImpl.createCLASSPATH( pDoc, iRetValE, * pClassA[i].getObjectPath() ); @@ -670,22 +680,19 @@ public static Element associators_response(Document pDoc, /** * enumerateInstanceNames_request - * + * * @param pDoc * @param pPath * @return Element * @throws WBEMException */ - public Element enumerateInstanceNames_request(Document pDoc, CIMObjectPath pPath) - throws WBEMException { + public Element enumerateInstanceNames_request(Document pDoc, CIMObjectPath pPath) throws WBEMException { // obtain data String className = pPath.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name"); Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, - "EnumerateInstanceNames"); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "EnumerateInstanceNames"); CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ClassName"); @@ -696,7 +703,7 @@ public Element enumerateInstanceNames_request(Document pDoc, CIMObjectPath pPath /** * enumerateInstances_request - * + * * @param pDoc * @param pPath * @param pDeepInheritance @@ -707,18 +714,22 @@ public Element enumerateInstanceNames_request(Document pDoc, CIMObjectPath pPath * @return Element * @throws WBEMException */ - public Element enumerateInstances_request(Document pDoc, CIMObjectPath pPath, - boolean pDeepInheritance, boolean pLocalOnly, boolean pIncludeQualifiers, - boolean pIncludeClassOrigin, String[] pPropertyList) throws WBEMException { - + public Element enumerateInstances_request( + Document pDoc, + CIMObjectPath pPath, + boolean pDeepInheritance, + boolean pLocalOnly, + boolean pIncludeQualifiers, + boolean pIncludeClassOrigin, + String[] pPropertyList + ) + throws WBEMException { // obtain data String className = pPath.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name"); Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, - "EnumerateInstances"); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "EnumerateInstances"); CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ClassName"); @@ -732,8 +743,7 @@ public Element enumerateInstances_request(Document pDoc, CIMObjectPath pPath, iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "IncludeQualifiers"); CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeQualifiers); - iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, "IncludeClassOrigin"); + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "IncludeClassOrigin"); CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeClassOrigin); if (pPropertyList != null) { @@ -748,7 +758,7 @@ public Element enumerateInstances_request(Document pDoc, CIMObjectPath pPath, /** * getInstance_request - * + * * @param pDoc * @param pName * @param pLocalOnly @@ -758,20 +768,24 @@ public Element enumerateInstances_request(Document pDoc, CIMObjectPath pPath, * @return Element * @throws WBEMException */ - public Element getInstance_request(Document pDoc, CIMObjectPath pName, boolean pLocalOnly, - boolean pIncludeQualifiers, boolean pIncludeClassOrigin, String[] pPropertyList) - throws WBEMException { + public Element getInstance_request( + Document pDoc, + CIMObjectPath pName, + boolean pLocalOnly, + boolean pIncludeQualifiers, + boolean pIncludeClassOrigin, + String[] pPropertyList + ) + throws WBEMException { // obtain data String className = pName.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name"); Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "GetInstance"); CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pName); - Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - "InstanceName"); + Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "InstanceName"); CIMXMLBuilderImpl.createINSTANCENAME(pDoc, iparamvalueE, pName); iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "LocalOnly"); @@ -780,8 +794,7 @@ public Element getInstance_request(Document pDoc, CIMObjectPath pName, boolean p iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "IncludeQualifiers"); CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeQualifiers); - iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, "IncludeClassOrigin"); + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "IncludeClassOrigin"); CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeClassOrigin); if (pPropertyList != null) { @@ -797,26 +810,22 @@ public Element getInstance_request(Document pDoc, CIMObjectPath pName, boolean p /** * deleteInstance_request - * + * * @param pDoc * @param pName * @return Element * @throws WBEMException */ public Element deleteInstance_request(Document pDoc, CIMObjectPath pName) throws WBEMException { - // obtain data String className = pName.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name"); Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, - "DeleteInstance"); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "DeleteInstance"); CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pName); - Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - "InstanceName"); + Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "InstanceName"); CIMXMLBuilderImpl.createINSTANCENAME(pDoc, iparamvalueE, pName); return simplereqE; @@ -824,7 +833,7 @@ public Element deleteInstance_request(Document pDoc, CIMObjectPath pName) throws /** * getClass_request - * + * * @param pDoc * @param pName * @param pLocalOnly @@ -834,14 +843,18 @@ public Element deleteInstance_request(Document pDoc, CIMObjectPath pName) throws * @return Element * @throws WBEMException */ - public Element getClass_request(Document pDoc, CIMObjectPath pName, boolean pLocalOnly, - boolean pIncludeQualifiers, boolean pIncludeClassOrigin, String[] pPropertyList) - throws WBEMException { - + public Element getClass_request( + Document pDoc, + CIMObjectPath pName, + boolean pLocalOnly, + boolean pIncludeQualifiers, + boolean pIncludeClassOrigin, + String[] pPropertyList + ) + throws WBEMException { // obtain data String className = pName.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name"); Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "GetClass"); @@ -855,8 +868,7 @@ public Element getClass_request(Document pDoc, CIMObjectPath pName, boolean pLoc iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "IncludeQualifiers"); CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeQualifiers); - iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, "IncludeClassOrigin"); + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "IncludeClassOrigin"); CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeClassOrigin); if (pPropertyList != null) { @@ -872,7 +884,7 @@ public Element getClass_request(Document pDoc, CIMObjectPath pName, boolean pLoc /** * createInstance_request - * + * * @param pDoc * @param pName * @param pInstance @@ -880,18 +892,14 @@ public Element getClass_request(Document pDoc, CIMObjectPath pName, boolean pLoc * @throws WBEMException */ public Element createInstance_request(Document pDoc, CIMObjectPath pName, CIMInstance pInstance) - throws WBEMException { - + throws WBEMException { String className = pInstance.getObjectPath().getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name"); Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, - "CreateInstance"); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "CreateInstance"); CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pName); - Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - "NewInstance"); + Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "NewInstance"); CIMXMLBuilderImpl.createINSTANCE(pDoc, iparamvalueE, pInstance); @@ -900,7 +908,7 @@ public Element createInstance_request(Document pDoc, CIMObjectPath pName, CIMIns /** * invokeMethod_request - * + * * @param pDoc * @param pLocalPath * @param pMethodName @@ -908,13 +916,16 @@ public Element createInstance_request(Document pDoc, CIMObjectPath pName, CIMIns * @return Element * @throws WBEMException */ - public Element invokeMethod_request(Document pDoc, CIMObjectPath pLocalPath, - String pMethodName, CIMArgument[] pInArgs) throws WBEMException { - + public Element invokeMethod_request( + Document pDoc, + CIMObjectPath pLocalPath, + String pMethodName, + CIMArgument[] pInArgs + ) + throws WBEMException { // obtain data String className = pLocalPath.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name"); CIMProperty[] keysA = pLocalPath.getKeys(); Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); @@ -936,7 +947,7 @@ public Element invokeMethod_request(Document pDoc, CIMObjectPath pLocalPath, /** * invokeMethod_response - * + * * @param pDoc * @param pMethodName * @param pLocalPath @@ -945,11 +956,15 @@ public Element invokeMethod_request(Document pDoc, CIMObjectPath pLocalPath, * @return Element * @throws WBEMException */ - public static Element invokeMethod_response(Document pDoc, String pMethodName, - CIMObjectPath pLocalPath, Object pRetVal, CIMArgument[] pOutArgA) - throws WBEMException { - if (pMethodName == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null method name"); + public static Element invokeMethod_response( + Document pDoc, + String pMethodName, + CIMObjectPath pLocalPath, + Object pRetVal, + CIMArgument[] pOutArgA + ) + throws WBEMException { + if (pMethodName == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null method name"); Element simpleRspE = CIMXMLBuilderImpl.createSIMPLERSP(pDoc, null); Element methodRspE = CIMXMLBuilderImpl.createMETHODRESPONSE(pDoc, simpleRspE, pMethodName); @@ -962,8 +977,13 @@ public static Element invokeMethod_response(Document pDoc, String pMethodName, /** * @param pLocalPath */ - private static void buildParamValues(Document pDoc, Element pParentE, CIMObjectPath pLocalPath, - CIMArgument[] pArgA) throws WBEMException { + private static void buildParamValues( + Document pDoc, + Element pParentE, + CIMObjectPath pLocalPath, + CIMArgument[] pArgA + ) + throws WBEMException { if (pArgA == null) return; for (int i = 0; i < pArgA.length; i++) { CIMArgument arg = pArgA[i]; @@ -991,20 +1011,17 @@ private static void buildParamValues(Document pDoc, Element pParentE, CIMObjectP /** * createIndication_response - * + * * @param error * @return Document */ public Document createIndication_response(CIMError error) { - // CIMXMLBuilderImpl.create XML Document doc = this.iBuilder.newDocument(); Element cimE = CIMXMLBuilderImpl.createCIM(doc); - Element messageE = CIMXMLBuilderImpl.createMESSAGE(doc, cimE, String.valueOf(getNextId()), - "1.0"); + Element messageE = CIMXMLBuilderImpl.createMESSAGE(doc, cimE, String.valueOf(getNextId()), "1.0"); Element simpleexprspE = CIMXMLBuilderImpl.createSIMPLEEXPRSP(doc, messageE); - Element expmethodresponseE = CIMXMLBuilderImpl.createEXPMETHODRESPONSE(doc, simpleexprspE, - "ExportIndication"); + Element expmethodresponseE = CIMXMLBuilderImpl.createEXPMETHODRESPONSE(doc, simpleexprspE, "ExportIndication"); if (error == null) { CIMXMLBuilderImpl.createIRETURNVALUE(doc, expmethodresponseE); } else { @@ -1016,18 +1033,16 @@ public Document createIndication_response(CIMError error) { /** * createClass_request - * + * * @param pDoc * @param pPath * @param pClass * @return Element * @throws WBEMException */ - public Element createClass_request(Document pDoc, CIMObjectPath pPath, CIMClass pClass) - throws WBEMException { + public Element createClass_request(Document pDoc, CIMObjectPath pPath, CIMClass pClass) throws WBEMException { String className = pPath.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name"); Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "CreateClass"); @@ -1042,27 +1057,23 @@ public Element createClass_request(Document pDoc, CIMObjectPath pPath, CIMClass /** * getQualifier_request - * + * * @param pDoc * @param pPath * @param pQt * @return Element * @throws WBEMException */ - public Element getQualifier_request(Document pDoc, CIMObjectPath pPath, String pQt) - throws WBEMException { + public Element getQualifier_request(Document pDoc, CIMObjectPath pPath, String pQt) throws WBEMException { // obtain data String className = pPath.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name"); Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl - .createIMETHODCALL(pDoc, simplereqE, "GetQualifier"); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "GetQualifier"); CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); - Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - "QualifierName"); + Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "QualifierName"); CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pPath.getObjectName()); return simplereqE; @@ -1071,26 +1082,23 @@ public Element getQualifier_request(Document pDoc, CIMObjectPath pPath, String p /** * createQualifierType_request : This has been replaced by * setQualifierType_request - * + * * @param pDoc * @param pPath * @param pQt * @return Element * @throws WBEMException */ - public Element createQualifierType_request(Document pDoc, CIMObjectPath pPath, - CIMQualifierType pQt) throws WBEMException { + public Element createQualifierType_request(Document pDoc, CIMObjectPath pPath, CIMQualifierType pQt) + throws WBEMException { String className = pPath.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name"); Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl - .createIMETHODCALL(pDoc, simplereqE, "SetQualifier"); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "SetQualifier"); CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); - Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - "QualifierDeclaration"); + Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "QualifierDeclaration"); CIMXMLBuilderImpl.createQUALIFIER_DECLARATION(pDoc, iparamvalueE, pQt); return simplereqE; @@ -1098,7 +1106,7 @@ public Element createQualifierType_request(Document pDoc, CIMObjectPath pPath, /** * deleteClass_request - * + * * @param pDoc * @param pPath * @return Element @@ -1106,8 +1114,7 @@ public Element createQualifierType_request(Document pDoc, CIMObjectPath pPath, */ public Element deleteClass_request(Document pDoc, CIMObjectPath pPath) throws WBEMException { String className = pPath.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name"); Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "DeleteClass"); @@ -1122,33 +1129,29 @@ public Element deleteClass_request(Document pDoc, CIMObjectPath pPath) throws WB /** * deleteQualifierType_request - * + * * @param pDoc * @param pPath * @return Element * @throws WBEMException */ - public Element deleteQualifierType_request(Document pDoc, CIMObjectPath pPath) - throws WBEMException { + public Element deleteQualifierType_request(Document pDoc, CIMObjectPath pPath) throws WBEMException { // obtain data String className = pPath.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name"); Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, - "DeleteQualifier"); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "DeleteQualifier"); CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); - Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - "QualifierName"); + Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "QualifierName"); CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pPath.getObjectName()); return simplereqE; } /** * enumerateClasses_request - * + * * @param pDoc * @param pPath * @param pDeepInheritance @@ -1157,18 +1160,20 @@ public Element deleteQualifierType_request(Document pDoc, CIMObjectPath pPath) * @param pIncludeClassOrigin * @return Element */ - public Element enumerateClasses_request(Document pDoc, CIMObjectPath pPath, - boolean pDeepInheritance, boolean pLocalOnly, boolean pIncludeQualifiers, - boolean pIncludeClassOrigin) { - + public Element enumerateClasses_request( + Document pDoc, + CIMObjectPath pPath, + boolean pDeepInheritance, + boolean pLocalOnly, + boolean pIncludeQualifiers, + boolean pIncludeClassOrigin + ) { Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, - "EnumerateClasses"); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "EnumerateClasses"); CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); Element iparamvalueE; - if (pPath != null && pPath.getObjectName() != null - && pPath.getObjectName().trim().length() != 0) { + if (pPath != null && pPath.getObjectName() != null && pPath.getObjectName().trim().length() != 0) { String className = pPath.getObjectName(); iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ClassName"); CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, className); @@ -1182,23 +1187,21 @@ public Element enumerateClasses_request(Document pDoc, CIMObjectPath pPath, iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "IncludeQualifiers"); CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeQualifiers); - iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, "IncludeClassOrigin"); + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "IncludeClassOrigin"); CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeClassOrigin); return simplereqE; } /** * enumerateClasses_response - * + * * @param pDoc * @param pClA * @return Element */ public static Element enumerateClasses_response(Document pDoc, CIMClass[] pClA) { Element simpRspE = CIMXMLBuilderImpl.createSIMPLERSP(pDoc, null); - Element iMethRspE = CIMXMLBuilderImpl.createIMETHODRESPONSE(pDoc, simpRspE, - "enumerateClasses"); + Element iMethRspE = CIMXMLBuilderImpl.createIMETHODRESPONSE(pDoc, simpRspE, "enumerateClasses"); Element iRetValE = CIMXMLBuilderImpl.createIRETURNVALUE(pDoc, iMethRspE); try { for (int i = 0; i < pClA.length; i++) { @@ -1212,15 +1215,14 @@ public static Element enumerateClasses_response(Document pDoc, CIMClass[] pClA) /** * enumerateInstances_response - * + * * @param pDoc * @param pInstA * @return Element */ public static Element enumerateInstances_response(Document pDoc, CIMInstance[] pInstA) { Element simpRspE = CIMXMLBuilderImpl.createSIMPLERSP(pDoc, null); - Element iMethRspE = CIMXMLBuilderImpl.createIMETHODRESPONSE(pDoc, simpRspE, - "enumerateInstances"); + Element iMethRspE = CIMXMLBuilderImpl.createIMETHODRESPONSE(pDoc, simpRspE, "enumerateInstances"); Element iRetValE = CIMXMLBuilderImpl.createIRETURNVALUE(pDoc, iMethRspE); try { for (int i = 0; i < pInstA.length; i++) { @@ -1234,24 +1236,20 @@ public static Element enumerateInstances_response(Document pDoc, CIMInstance[] p /** * enumerateClassNames_request - * + * * @param pDoc * @param pPath * @param pDeepInheritance * @return Element */ - public Element enumerateClassNames_request(Document pDoc, CIMObjectPath pPath, - boolean pDeepInheritance) { - + public Element enumerateClassNames_request(Document pDoc, CIMObjectPath pPath, boolean pDeepInheritance) { Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, - "EnumerateClassNames"); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "EnumerateClassNames"); CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); Element iparamvalueE; - if (pPath != null && pPath.getObjectName() != null - && pPath.getObjectName().trim().length() != 0) { + if (pPath != null && pPath.getObjectName() != null && pPath.getObjectName().trim().length() != 0) { String className = pPath.getObjectName(); iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ClassName"); CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, className); @@ -1265,26 +1263,23 @@ public Element enumerateClassNames_request(Document pDoc, CIMObjectPath pPath, /** * getProperty_request - * + * * @param pDoc * @param pPath * @param pPropertyName * @return Element * @throws WBEMException */ - public Element getProperty_request(Document pDoc, CIMObjectPath pPath, String pPropertyName) - throws WBEMException { + public Element getProperty_request(Document pDoc, CIMObjectPath pPath, String pPropertyName) throws WBEMException { // obtain data String className = pPath.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name"); Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "GetProperty"); CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); - Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - "InstanceName"); + Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "InstanceName"); CIMXMLBuilderImpl.createINSTANCENAME(pDoc, iparamvalueE, pPath); if (pPropertyName != null) { @@ -1297,7 +1292,7 @@ public Element getProperty_request(Document pDoc, CIMObjectPath pPath, String pP /** * referenceNames_request - * + * * @param pDoc * @param pPath * @param pResultClass @@ -1305,19 +1300,16 @@ public Element getProperty_request(Document pDoc, CIMObjectPath pPath, String pP * @return Element * @throws WBEMException */ - public Element referenceNames_request(Document pDoc, CIMObjectPath pPath, String pResultClass, - String pRole) throws WBEMException { + public Element referenceNames_request(Document pDoc, CIMObjectPath pPath, String pResultClass, String pRole) + throws WBEMException { String className = pPath.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name"); Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, - "ReferenceNames"); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "ReferenceNames"); CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); - Element iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, "ObjectName"); + Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ObjectName"); CIMXMLBuilderImpl.createOBJECTNAME(pDoc, iparamvalueE, pPath); if (pResultClass != null) { @@ -1334,7 +1326,7 @@ public Element referenceNames_request(Document pDoc, CIMObjectPath pPath, String /** * referenceClasses_request - * + * * @param pDoc * @param pPath * @param pResultClass @@ -1345,25 +1337,30 @@ public Element referenceNames_request(Document pDoc, CIMObjectPath pPath, String * @return Element * @throws WBEMException */ - public Element referenceClasses_request(Document pDoc, CIMObjectPath pPath, - String pResultClass, String pRole, boolean pIncludeQualifiers, - boolean pIncludeClassOrigin, String[] pPropertyList) throws WBEMException { - + public Element referenceClasses_request( + Document pDoc, + CIMObjectPath pPath, + String pResultClass, + String pRole, + boolean pIncludeQualifiers, + boolean pIncludeClassOrigin, + String[] pPropertyList + ) + throws WBEMException { String className = pPath.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name"); // Make sure keys are not populated if (pPath.getKeys().length != 0) throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, - "Keys should not be populated for referenceClasses"); + WBEMException.CIM_ERR_INVALID_PARAMETER, + "Keys should not be populated for referenceClasses" + ); Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "References"); CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); - Element iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, "ObjectName"); + Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ObjectName"); // createOBJECTNAME will internally call createINSTANCENAME but as there // are no keys Element containing keys will not be populated CIMXMLBuilderImpl.createOBJECTNAME(pDoc, iparamvalueE, pPath); @@ -1380,8 +1377,7 @@ public Element referenceClasses_request(Document pDoc, CIMObjectPath pPath, iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "IncludeQualifiers"); CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeQualifiers); - iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, "IncludeClassOrigin"); + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "IncludeClassOrigin"); CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeClassOrigin); if (pPropertyList != null) { @@ -1396,7 +1392,7 @@ public Element referenceClasses_request(Document pDoc, CIMObjectPath pPath, /** * referenceInstances_request - * + * * @param pDoc * @param pPath * @param pResultClass @@ -1406,25 +1402,29 @@ public Element referenceClasses_request(Document pDoc, CIMObjectPath pPath, * @return Element * @throws WBEMException */ - public Element referenceInstances_request(Document pDoc, CIMObjectPath pPath, - String pResultClass, String pRole, boolean pIncludeClassOrigin, String[] pPropertyList) - throws WBEMException { - + public Element referenceInstances_request( + Document pDoc, + CIMObjectPath pPath, + String pResultClass, + String pRole, + boolean pIncludeClassOrigin, + String[] pPropertyList + ) + throws WBEMException { String className = pPath.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name"); // keys are required for CIMInstance if (pPath.getKeys().length == 0) throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, - "refrenceInstances requires keys for the instance to be populated"); + WBEMException.CIM_ERR_INVALID_PARAMETER, + "refrenceInstances requires keys for the instance to be populated" + ); Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "References"); CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); - Element iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, "ObjectName"); + Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ObjectName"); // createOBJECTNAME will internally call createINSTANCENAME to populate // Element containing keys CIMXMLBuilderImpl.createOBJECTNAME(pDoc, iparamvalueE, pPath); @@ -1438,8 +1438,7 @@ public Element referenceInstances_request(Document pDoc, CIMObjectPath pPath, CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pRole); } - iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, "IncludeClassOrigin"); + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "IncludeClassOrigin"); CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeClassOrigin); if (pPropertyList != null) { @@ -1454,7 +1453,7 @@ public Element referenceInstances_request(Document pDoc, CIMObjectPath pPath, /** * references_request - * + * * @param pDoc * @param pPath * @param pResultClass @@ -1465,12 +1464,18 @@ public Element referenceInstances_request(Document pDoc, CIMObjectPath pPath, * @return Element * @throws WBEMException */ - public Element references_request(Document pDoc, CIMObjectPath pPath, String pResultClass, - String pRole, boolean pIncludeQualifiers, boolean pIncludeClassOrigin, - String[] pPropertyList) throws WBEMException { + public Element references_request( + Document pDoc, + CIMObjectPath pPath, + String pResultClass, + String pRole, + boolean pIncludeQualifiers, + boolean pIncludeClassOrigin, + String[] pPropertyList + ) + throws WBEMException { String className = pPath.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name"); Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "References"); @@ -1493,8 +1498,7 @@ public Element references_request(Document pDoc, CIMObjectPath pPath, String pRe iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "IncludeQualifiers"); CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeQualifiers); - iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, "IncludeClassOrigin"); + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "IncludeClassOrigin"); CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeClassOrigin); if (pPropertyList != null) { @@ -1510,25 +1514,22 @@ public Element references_request(Document pDoc, CIMObjectPath pPath, String pRe /** * setClass_request - * + * * @param pDoc * @param pPath * @param pClass * @return Element * @throws WBEMException */ - public Element setClass_request(Document pDoc, CIMObjectPath pPath, CIMClass pClass) - throws WBEMException { + public Element setClass_request(Document pDoc, CIMObjectPath pPath, CIMClass pClass) throws WBEMException { String className = pPath.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name"); Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "ModifyClass"); CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); - Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - "ModifiedClass"); + Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ModifiedClass"); CIMXMLBuilderImpl.createCLASS(pDoc, iparamvalueE, pClass); return simplereqE; @@ -1536,7 +1537,7 @@ public Element setClass_request(Document pDoc, CIMObjectPath pPath, CIMClass pCl /** * setInstance_request - * + * * @param pDoc * @param pPath * @param pInstance @@ -1545,19 +1546,22 @@ public Element setClass_request(Document pDoc, CIMObjectPath pPath, CIMClass pCl * @return Element * @throws WBEMException */ - public Element setInstance_request(Document pDoc, CIMObjectPath pPath, CIMInstance pInstance, - boolean pIncludeQualifiers, String[] pPropertyList) throws WBEMException { + public Element setInstance_request( + Document pDoc, + CIMObjectPath pPath, + CIMInstance pInstance, + boolean pIncludeQualifiers, + String[] pPropertyList + ) + throws WBEMException { String className = pPath.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name"); Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, - "ModifyInstance"); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "ModifyInstance"); CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); - Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - "ModifiedInstance"); + Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ModifiedInstance"); CIMXMLBuilderImpl.createVALUENAMEDINSTANCE(pDoc, iparamvalueE, pPath, pInstance); iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "IncludeQualifiers"); @@ -1576,7 +1580,7 @@ public Element setInstance_request(Document pDoc, CIMObjectPath pPath, CIMInstan /** * setProperty_request - * + * * @param pDoc * @param pPath * @param pPropertyName @@ -1584,18 +1588,16 @@ public Element setInstance_request(Document pDoc, CIMObjectPath pPath, CIMInstan * @return Element * @throws WBEMException */ - public Element setProperty_request(Document pDoc, CIMObjectPath pPath, String pPropertyName, - Object pNewValue) throws WBEMException { + public Element setProperty_request(Document pDoc, CIMObjectPath pPath, String pPropertyName, Object pNewValue) + throws WBEMException { String className = pPath.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name"); Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "SetProperty"); CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); - Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - "InstanceName"); + Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "InstanceName"); CIMXMLBuilderImpl.createINSTANCENAME(pDoc, iparamvalueE, pPath); if (pPropertyName != null) { @@ -1613,28 +1615,25 @@ public Element setProperty_request(Document pDoc, CIMObjectPath pPath, String pP /** * setQualifierType_request - * + * * @param pDoc * @param pPath * @param pQt * @return Element * @throws WBEMException */ - public Element setQualifierType_request(Document pDoc, CIMObjectPath pPath, - CIMQualifierType pQt) throws WBEMException { + public Element setQualifierType_request(Document pDoc, CIMObjectPath pPath, CIMQualifierType pQt) + throws WBEMException { // Make sure class name exists, it is required to uniquely identify // qualifier in namespace String className = pPath.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name"); Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl - .createIMETHODCALL(pDoc, simplereqE, "SetQualifier"); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "SetQualifier"); CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); - Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - "QualifierDeclaration"); + Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "QualifierDeclaration"); CIMXMLBuilderImpl.createQUALIFIER_DECLARATION(pDoc, iparamvalueE, pQt); return simplereqE; @@ -1642,18 +1641,15 @@ public Element setQualifierType_request(Document pDoc, CIMObjectPath pPath, /** * enumQualifierTypes_request - * + * * @param pDoc * @param pPath * @return Element * @throws WBEMException */ - public Element enumQualifierTypes_request(Document pDoc, CIMObjectPath pPath) - throws WBEMException { - + public Element enumQualifierTypes_request(Document pDoc, CIMObjectPath pPath) throws WBEMException { Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, - "EnumerateQualifiers"); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "EnumerateQualifiers"); CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); return simplereqE; @@ -1661,17 +1657,16 @@ public Element enumQualifierTypes_request(Document pDoc, CIMObjectPath pPath) /** * enumQualifierTypes_response - * + * * @param pDoc * @param pQualiTypeA * @return Element * @throws WBEMException */ - public static Element enumQualifierTypes_response(Document pDoc, - CIMQualifierType[] pQualiTypeA) throws WBEMException { + public static Element enumQualifierTypes_response(Document pDoc, CIMQualifierType[] pQualiTypeA) + throws WBEMException { Element simpRspE = CIMXMLBuilderImpl.createSIMPLERSP(pDoc, null); - Element iMethRspE = CIMXMLBuilderImpl.createIMETHODRESPONSE(pDoc, simpRspE, - "associatorNames"); + Element iMethRspE = CIMXMLBuilderImpl.createIMETHODRESPONSE(pDoc, simpRspE, "associatorNames"); Element iRetValE = CIMXMLBuilderImpl.createIRETURNVALUE(pDoc, iMethRspE); for (int i = 0; i < pQualiTypeA.length; i++) { CIMXMLBuilderImpl.createQUALIFIER_DECLARATION(pDoc, iRetValE, pQualiTypeA[i]); @@ -1681,21 +1676,19 @@ public static Element enumQualifierTypes_response(Document pDoc, /** * execQuery_request - * + * * @param pDoc * @param pPath * @param pQuery * @param pQueryLanguage * @return Element */ - public Element execQuery_request(Document pDoc, CIMObjectPath pPath, String pQuery, - String pQueryLanguage) { + public Element execQuery_request(Document pDoc, CIMObjectPath pPath, String pQuery, String pQueryLanguage) { Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "ExecQuery"); CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); - Element querylanguageE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - "QueryLanguage"); + Element querylanguageE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "QueryLanguage"); CIMXMLBuilderImpl.createVALUE(pDoc, querylanguageE, pQueryLanguage); Element queryE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "Query"); @@ -1706,15 +1699,13 @@ public Element execQuery_request(Document pDoc, CIMObjectPath pPath, String pQue /** * performBatchOperation_request - * + * * @param pDoc * @param pOperations * @return Element * @throws WBEMException */ - public Element performBatchOperation_request(Document pDoc, Vector pOperations) - throws WBEMException { - + public Element performBatchOperation_request(Document pDoc, Vector pOperations) throws WBEMException { Element messageE = createCIMMessage(pDoc, null); if (pOperations.size() > 1) { Element multireqE = createMultiReq(pDoc); @@ -1730,32 +1721,45 @@ public Element performBatchOperation_request(Document pDoc, Vector if (op instanceof CIMAssociatorsOp) { CIMAssociatorsOp associatorsOp = (CIMAssociatorsOp) op; - requestE = associators_request(pDoc, associatorsOp.getObjectName(), - associatorsOp.getAssocClass(), associatorsOp.getResultClass(), - associatorsOp.getRole(), associatorsOp.getResultRole(), associatorsOp - .isIncludeQualifiers(), associatorsOp.isIncludeClassOrigin(), - associatorsOp.getPropertyList()); + requestE = + associators_request( + pDoc, + associatorsOp.getObjectName(), + associatorsOp.getAssocClass(), + associatorsOp.getResultClass(), + associatorsOp.getRole(), + associatorsOp.getResultRole(), + associatorsOp.isIncludeQualifiers(), + associatorsOp.isIncludeClassOrigin(), + associatorsOp.getPropertyList() + ); } else if (op instanceof CIMAssociatorNamesOp) { CIMAssociatorNamesOp associatorNamesOp = (CIMAssociatorNamesOp) op; - requestE = associatorNames_request(pDoc, associatorNamesOp.getObjectName(), - associatorNamesOp.getAssocClass(), associatorNamesOp.getResultClass(), - associatorNamesOp.getRole(), associatorNamesOp.getResultRole()); + requestE = + associatorNames_request( + pDoc, + associatorNamesOp.getObjectName(), + associatorNamesOp.getAssocClass(), + associatorNamesOp.getResultClass(), + associatorNamesOp.getRole(), + associatorNamesOp.getResultRole() + ); } else if (op instanceof CIMCreateClassOp) { CIMCreateClassOp createClassOp = (CIMCreateClassOp) op; - requestE = createClass_request(pDoc, createClassOp.getObjectName(), - createClassOp.getCimClass()); + requestE = createClass_request(pDoc, createClassOp.getObjectName(), createClassOp.getCimClass()); } else if (op instanceof CIMCreateInstanceOp) { CIMCreateInstanceOp createInstanceOp = (CIMCreateInstanceOp) op; - requestE = createInstance_request(pDoc, createInstanceOp.getObjectName(), - createInstanceOp.getInstance()); + requestE = createInstance_request(pDoc, createInstanceOp.getObjectName(), createInstanceOp.getInstance()); } else if (op instanceof CIMCreateNameSpaceOp) { CIMCreateNameSpaceOp createNameSpaceOp = (CIMCreateNameSpaceOp) op; String namespace = createNameSpaceOp.getNameSpace(); int j = namespace.lastIndexOf('/'); - if (j < 0) throw new WBEMException(WBEMException.CIM_ERR_NOT_FOUND, - "Invalid namespace. Must contain at least /"); + if (j < 0) throw new WBEMException( + WBEMException.CIM_ERR_NOT_FOUND, + "Invalid namespace. Must contain at least /" + ); String parentNs = namespace.substring(0, j); namespace = namespace.substring(j + 1); @@ -1768,16 +1772,23 @@ public Element performBatchOperation_request(Document pDoc, Vector * Vector(); v.add(prop); inst.setProperties(v); */ - CIMInstance inst = new CIMInstance(new CIMObjectPath(null, null, null, null, - "CIM_NameSpace", null), new CIMProperty[] { new CIMProperty( - "NameSpace", CIMDataType.STRING_T, namespace, true, false, null) }); + CIMInstance inst = new CIMInstance( + new CIMObjectPath(null, null, null, null, "CIM_NameSpace", null), + new CIMProperty[] { + new CIMProperty("NameSpace", CIMDataType.STRING_T, namespace, true, false, null) + } + ); CIMObjectPath object = new CIMObjectPath(null, null, null, parentNs, null, null); requestE = createInstance_request(pDoc, object, inst); } else if (op instanceof CIMCreateQualifierTypeOp) { CIMCreateQualifierTypeOp createQualifierTypeOp = (CIMCreateQualifierTypeOp) op; - requestE = createQualifierType_request(pDoc, createQualifierTypeOp - .getObjectName(), createQualifierTypeOp.getQualifierType()); + requestE = + createQualifierType_request( + pDoc, + createQualifierTypeOp.getObjectName(), + createQualifierTypeOp.getQualifierType() + ); } else if (op instanceof CIMDeleteClassOp) { CIMDeleteClassOp deleteClassOp = (CIMDeleteClassOp) op; requestE = deleteClass_request(pDoc, deleteClassOp.getObjectName()); @@ -1789,99 +1800,163 @@ public Element performBatchOperation_request(Document pDoc, Vector requestE = deleteClass_request(pDoc, deleteQualifierTypeOp.getObjectName()); } else if (op instanceof CIMEnumClassesOp) { CIMEnumClassesOp enumClassesOp = (CIMEnumClassesOp) op; - requestE = enumerateClasses_request(pDoc, enumClassesOp.getObjectName(), - enumClassesOp.isDeep(), enumClassesOp.isLocalOnly(), enumClassesOp - .isIncludeQualifiers(), enumClassesOp.isIncludeClassOrigin()); + requestE = + enumerateClasses_request( + pDoc, + enumClassesOp.getObjectName(), + enumClassesOp.isDeep(), + enumClassesOp.isLocalOnly(), + enumClassesOp.isIncludeQualifiers(), + enumClassesOp.isIncludeClassOrigin() + ); } else if (op instanceof CIMEnumClassNamesOp) { CIMEnumClassNamesOp enumClassNamesOp = (CIMEnumClassNamesOp) op; - requestE = enumerateClassNames_request(pDoc, enumClassNamesOp.getObjectName(), - enumClassNamesOp.isDeep()); + requestE = enumerateClassNames_request(pDoc, enumClassNamesOp.getObjectName(), enumClassNamesOp.isDeep()); } else if (op instanceof CIMEnumInstanceNamesOp) { CIMEnumInstanceNamesOp enumInstanceNamesOp = (CIMEnumInstanceNamesOp) op; - requestE = enumerateInstanceNames_request(pDoc, enumInstanceNamesOp - .getObjectName()); + requestE = enumerateInstanceNames_request(pDoc, enumInstanceNamesOp.getObjectName()); } else if (op instanceof CIMEnumInstancesOp) { CIMEnumInstancesOp enumInstancesOp = (CIMEnumInstancesOp) op; - requestE = enumerateInstances_request(pDoc, enumInstancesOp.getObjectName(), - enumInstancesOp.isDeep(), enumInstancesOp.isLocalOnly(), - enumInstancesOp.isIncludeQualifiers(), enumInstancesOp - .isIncludeClassOrigin(), enumInstancesOp.getPropertyList()); + requestE = + enumerateInstances_request( + pDoc, + enumInstancesOp.getObjectName(), + enumInstancesOp.isDeep(), + enumInstancesOp.isLocalOnly(), + enumInstancesOp.isIncludeQualifiers(), + enumInstancesOp.isIncludeClassOrigin(), + enumInstancesOp.getPropertyList() + ); } else if (op instanceof CIMEnumNameSpaceOp) { CIMEnumNameSpaceOp enumNameSpaceOp = (CIMEnumNameSpaceOp) op; // ebak: here we have to set CIMObjectPath's objectname // enumNameSpaceOp.getObjectName().setObjectName("CIM_NameSpace"); CIMObjectPath objPath = enumNameSpaceOp.getObjectName(); - objPath = new CIMObjectPath(objPath.getScheme(), objPath.getHost(), objPath - .getPort(), objPath.getNamespace(), "CIM_NameSpace", objPath.getKeys()); + objPath = + new CIMObjectPath( + objPath.getScheme(), + objPath.getHost(), + objPath.getPort(), + objPath.getNamespace(), + "CIM_NameSpace", + objPath.getKeys() + ); requestE = enumerateInstanceNames_request(pDoc, enumNameSpaceOp.getObjectName()); } else if (op instanceof CIMEnumQualifierTypesOp) { CIMEnumQualifierTypesOp enumQualifierTypesOp = (CIMEnumQualifierTypesOp) op; - requestE = enumQualifierTypes_request(pDoc, enumQualifierTypesOp - .getObjectName()); + requestE = enumQualifierTypes_request(pDoc, enumQualifierTypesOp.getObjectName()); } else if (op instanceof CIMExecQueryOp) { CIMExecQueryOp execQueryOp = (CIMExecQueryOp) op; - requestE = execQuery_request(pDoc, execQueryOp.getObjectName(), execQueryOp - .getQuery(), execQueryOp.getQueryLanguage()); + requestE = + execQuery_request( + pDoc, + execQueryOp.getObjectName(), + execQueryOp.getQuery(), + execQueryOp.getQueryLanguage() + ); } else if (op instanceof CIMGetPropertyOp) { CIMGetPropertyOp getPropertyOp = (CIMGetPropertyOp) op; - requestE = getInstance_request(pDoc, getPropertyOp.getObjectName(), false, - false, false, new String[] { getPropertyOp.getPropertyName() }); - + requestE = + getInstance_request( + pDoc, + getPropertyOp.getObjectName(), + false, + false, + false, + new String[] { getPropertyOp.getPropertyName() } + ); } else if (op instanceof CIMGetClassOp) { CIMGetClassOp getClassOp = (CIMGetClassOp) op; - requestE = getClass_request(pDoc, getClassOp.getObjectName(), getClassOp - .isLocalOnly(), getClassOp.isIncludeQualifiers(), getClassOp - .isIncludeClassOrigin(), getClassOp.getPropertyList()); + requestE = + getClass_request( + pDoc, + getClassOp.getObjectName(), + getClassOp.isLocalOnly(), + getClassOp.isIncludeQualifiers(), + getClassOp.isIncludeClassOrigin(), + getClassOp.getPropertyList() + ); } else if (op instanceof CIMGetInstanceOp) { CIMGetInstanceOp getInstanceOp = (CIMGetInstanceOp) op; - requestE = getInstance_request(pDoc, getInstanceOp.getObjectName(), - getInstanceOp.isLocalOnly(), getInstanceOp.isIncludeQualifiers(), - getInstanceOp.isIncludeClassOrigin(), getInstanceOp.getPropertyList()); + requestE = + getInstance_request( + pDoc, + getInstanceOp.getObjectName(), + getInstanceOp.isLocalOnly(), + getInstanceOp.isIncludeQualifiers(), + getInstanceOp.isIncludeClassOrigin(), + getInstanceOp.getPropertyList() + ); } else if (op instanceof CIMGetQualifierTypeOp) { CIMGetQualifierTypeOp getQualifierTypeOp = (CIMGetQualifierTypeOp) op; - requestE = getQualifier_request(pDoc, getQualifierTypeOp.getObjectName(), - getQualifierTypeOp.getQualifierType()); + requestE = + getQualifier_request(pDoc, getQualifierTypeOp.getObjectName(), getQualifierTypeOp.getQualifierType()); } else if (op instanceof CIMInvokeMethodOp) { CIMInvokeMethodOp invokeMethodOp = (CIMInvokeMethodOp) op; - requestE = invokeMethod_request(pDoc, invokeMethodOp.getObjectName(), - invokeMethodOp.getMethodCall(), invokeMethodOp.getInParams()); + requestE = + invokeMethod_request( + pDoc, + invokeMethodOp.getObjectName(), + invokeMethodOp.getMethodCall(), + invokeMethodOp.getInParams() + ); } else if (op instanceof CIMReferenceNamesOp) { CIMReferenceNamesOp referenceNamesOp = (CIMReferenceNamesOp) op; - requestE = referenceNames_request(pDoc, referenceNamesOp.getObjectName(), - referenceNamesOp.getResultClass(), referenceNamesOp.getResultRole()); + requestE = + referenceNames_request( + pDoc, + referenceNamesOp.getObjectName(), + referenceNamesOp.getResultClass(), + referenceNamesOp.getResultRole() + ); } else if (op instanceof CIMReferencesOp) { CIMReferencesOp referencesOp = (CIMReferencesOp) op; - requestE = references_request(pDoc, referencesOp.getObjectName(), referencesOp - .getResultClass(), referencesOp.getRole(), referencesOp - .isIncludeQualifiers(), referencesOp.isIncludeClassOrigin(), - referencesOp.getPropertyList()); + requestE = + references_request( + pDoc, + referencesOp.getObjectName(), + referencesOp.getResultClass(), + referencesOp.getRole(), + referencesOp.isIncludeQualifiers(), + referencesOp.isIncludeClassOrigin(), + referencesOp.getPropertyList() + ); } else if (op instanceof CIMSetClassOp) { CIMSetClassOp setClassOp = (CIMSetClassOp) op; - requestE = setClass_request(pDoc, setClassOp.getObjectName(), setClassOp - .getCimClass()); + requestE = setClass_request(pDoc, setClassOp.getObjectName(), setClassOp.getCimClass()); } else if (op instanceof CIMSetInstanceOp) { CIMSetInstanceOp setInstanceOp = (CIMSetInstanceOp) op; - requestE = setInstance_request(pDoc, setInstanceOp.getObjectName(), - setInstanceOp.getInstance(), setInstanceOp.isIncludeQualifiers(), - setInstanceOp.getPropertyList()); + requestE = + setInstance_request( + pDoc, + setInstanceOp.getObjectName(), + setInstanceOp.getInstance(), + setInstanceOp.isIncludeQualifiers(), + setInstanceOp.getPropertyList() + ); } else if (op instanceof CIMSetPropertyOp) { CIMSetPropertyOp setPropertyOp = (CIMSetPropertyOp) op; - requestE = setProperty_request(pDoc, setPropertyOp.getObjectName(), - setPropertyOp.getPropertyName(), setPropertyOp.getCimValue()); + requestE = + setProperty_request( + pDoc, + setPropertyOp.getObjectName(), + setPropertyOp.getPropertyName(), + setPropertyOp.getCimValue() + ); } else if (op instanceof CIMSetQualifierTypeOp) { CIMSetQualifierTypeOp setQualifierTypeOp = (CIMSetQualifierTypeOp) op; - requestE = setQualifierType_request(pDoc, setQualifierTypeOp.getObjectName(), - setQualifierTypeOp.getQualifierType()); + requestE = + setQualifierType_request(pDoc, setQualifierTypeOp.getObjectName(), setQualifierTypeOp.getQualifierType()); } if (requestE == null) throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, "Illegal batch operation number (" - + i + ") " + op.getClass()); + WBEMException.CIM_ERR_INVALID_PARAMETER, + "Illegal batch operation number (" + i + ") " + op.getClass() + ); messageE.appendChild(requestE); } catch (WBEMException e) { throw e; } catch (Exception e) { - throw new WBEMException(WBEMException.CIM_ERR_FAILED, "At batch operation (" + i - + ')', null, e); + throw new WBEMException(WBEMException.CIM_ERR_FAILED, "At batch operation (" + i + ')', null, e); } i++; } @@ -1891,7 +1966,7 @@ public Element performBatchOperation_request(Document pDoc, Vector /** * Sets the message id counter to a given value. For use in units tests * only. - * + * * @param pId * The new value */ @@ -1904,7 +1979,7 @@ public void setId(int pId) { * the current thread it will choose a start value randomly. Afterwards the * id is incremented by 1. Be aware that different threads will have * distinct id counters. - * + * * @return The next message id */ private int getNextId() { @@ -1916,7 +1991,7 @@ private int getNextId() { /** * pAssociatorPaths_request - * + * * @param pDoc * @param pPath * @param pAssocClass @@ -1931,22 +2006,28 @@ private int getNextId() { * @return Element * @throws WBEMException */ - public Element OpenAssociatorInstancePaths_request(Document pDoc, CIMObjectPath pPath, - String pAssocClass, String pResultClass, String pRole, String pResultRole, - String pFilterQueryLanguage, String pFilterQuery, UnsignedInteger32 pOperationTimeout, - boolean pContinueOnError, UnsignedInteger32 pMaxObjectCount) throws WBEMException { - + public Element OpenAssociatorInstancePaths_request( + Document pDoc, + CIMObjectPath pPath, + String pAssocClass, + String pResultClass, + String pRole, + String pResultRole, + String pFilterQueryLanguage, + String pFilterQuery, + UnsignedInteger32 pOperationTimeout, + boolean pContinueOnError, + UnsignedInteger32 pMaxObjectCount + ) + throws WBEMException { String className = pPath.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name"); Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, - "OpenAssociatorInstancePaths"); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "OpenAssociatorInstancePaths"); CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); - Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - INSTANCE_NAME); + Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, INSTANCE_NAME); CIMXMLBuilderImpl.createINSTANCENAME(pDoc, iparamvalueE, pPath); if (pAssocClass != null) { @@ -1966,8 +2047,7 @@ public Element OpenAssociatorInstancePaths_request(Document pDoc, CIMObjectPath CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pResultRole); } if (pFilterQueryLanguage != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - FILTER_QUERY_LANGUAGE); + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, FILTER_QUERY_LANGUAGE); CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pFilterQueryLanguage); } if (pFilterQuery != null) { @@ -1975,8 +2055,7 @@ public Element OpenAssociatorInstancePaths_request(Document pDoc, CIMObjectPath CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pFilterQuery); } if (pOperationTimeout != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - OPERATION_TIMEOUT); + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, OPERATION_TIMEOUT); CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pOperationTimeout); } @@ -1984,8 +2063,7 @@ public Element OpenAssociatorInstancePaths_request(Document pDoc, CIMObjectPath CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pContinueOnError); if (pMaxObjectCount != null) { - iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, MAX_OBJECT_COUNT); + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, MAX_OBJECT_COUNT); CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pMaxObjectCount); } @@ -1994,7 +2072,7 @@ public Element OpenAssociatorInstancePaths_request(Document pDoc, CIMObjectPath /** * OpenAssociatorInstances_request - * + * * @param pDoc * @param pPath * @param pAssocClass @@ -2011,24 +2089,31 @@ public Element OpenAssociatorInstancePaths_request(Document pDoc, CIMObjectPath * @return Element OpenAssociatorInstances_request * @throws WBEMException */ - public Element OpenAssociatorInstances_request(Document pDoc, CIMObjectPath pPath, - String pAssocClass, String pResultClass, String pRole, String pResultRole, - boolean pIncludeClassOrigin, String[] pPropertyList, String pFilterQueryLanguage, - String pFilterQuery, UnsignedInteger32 pOperationTimeout, boolean pContinueOnError, - UnsignedInteger32 pMaxObjectCount) throws WBEMException { - + public Element OpenAssociatorInstances_request( + Document pDoc, + CIMObjectPath pPath, + String pAssocClass, + String pResultClass, + String pRole, + String pResultRole, + boolean pIncludeClassOrigin, + String[] pPropertyList, + String pFilterQueryLanguage, + String pFilterQuery, + UnsignedInteger32 pOperationTimeout, + boolean pContinueOnError, + UnsignedInteger32 pMaxObjectCount + ) + throws WBEMException { String className = pPath.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name"); Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, - "OpenAssociatorInstances"); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "OpenAssociatorInstances"); CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); - Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - INSTANCE_NAME); + Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, INSTANCE_NAME); // createINSTANCENAME will take care of keyBindings CIMXMLBuilderImpl.createINSTANCENAME(pDoc, iparamvalueE, pPath); @@ -2048,19 +2133,16 @@ public Element OpenAssociatorInstances_request(Document pDoc, CIMObjectPath pPat iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, RESULT_ROLE); CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pResultRole); } - iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, INCLUDE_CLASS_ORIGIN); + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, INCLUDE_CLASS_ORIGIN); CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeClassOrigin); if (pPropertyList != null) { iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, PROPERTY_LIST); Element valuearrayE = CIMXMLBuilderImpl.createVALUEARRAY(pDoc, iparamvalueE); - for (int i = 0; i < pPropertyList.length; i++) - CIMXMLBuilderImpl.createVALUE(pDoc, valuearrayE, pPropertyList[i]); + for (int i = 0; i < pPropertyList.length; i++) CIMXMLBuilderImpl.createVALUE(pDoc, valuearrayE, pPropertyList[i]); } if (pFilterQueryLanguage != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - FILTER_QUERY_LANGUAGE); + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, FILTER_QUERY_LANGUAGE); CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pFilterQueryLanguage); } if (pFilterQuery != null) { @@ -2068,8 +2150,7 @@ public Element OpenAssociatorInstances_request(Document pDoc, CIMObjectPath pPat CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pFilterQuery); } if (pOperationTimeout != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - OPERATION_TIMEOUT); + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, OPERATION_TIMEOUT); CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pOperationTimeout); } @@ -2077,8 +2158,7 @@ public Element OpenAssociatorInstances_request(Document pDoc, CIMObjectPath pPat CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pContinueOnError); if (pMaxObjectCount != null) { - iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, MAX_OBJECT_COUNT); + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, MAX_OBJECT_COUNT); CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pMaxObjectCount); } @@ -2087,7 +2167,7 @@ public Element OpenAssociatorInstances_request(Document pDoc, CIMObjectPath pPat /** * OpenEnumerateInstancePaths_request - * + * * @param pDoc * @param pPath * @param pFilterQueryLanguage @@ -2098,25 +2178,28 @@ public Element OpenAssociatorInstances_request(Document pDoc, CIMObjectPath pPat * @return Element * @throws WBEMException */ - public Element OpenEnumerateInstancePaths_request(Document pDoc, CIMObjectPath pPath, - String pFilterQueryLanguage, String pFilterQuery, UnsignedInteger32 pOperationTimeout, - boolean pContinueOnError, UnsignedInteger32 pMaxObjectCount) throws WBEMException { - + public Element OpenEnumerateInstancePaths_request( + Document pDoc, + CIMObjectPath pPath, + String pFilterQueryLanguage, + String pFilterQuery, + UnsignedInteger32 pOperationTimeout, + boolean pContinueOnError, + UnsignedInteger32 pMaxObjectCount + ) + throws WBEMException { String className = pPath.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name"); Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, - "OpenEnumerateInstancePaths"); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "OpenEnumerateInstancePaths"); CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, CLASS_NAME); CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, className); if (pFilterQueryLanguage != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - FILTER_QUERY_LANGUAGE); + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, FILTER_QUERY_LANGUAGE); CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pFilterQueryLanguage); } if (pFilterQuery != null) { @@ -2124,8 +2207,7 @@ public Element OpenEnumerateInstancePaths_request(Document pDoc, CIMObjectPath p CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pFilterQuery); } if (pOperationTimeout != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - OPERATION_TIMEOUT); + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, OPERATION_TIMEOUT); CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pOperationTimeout); } @@ -2133,8 +2215,7 @@ public Element OpenEnumerateInstancePaths_request(Document pDoc, CIMObjectPath p CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pContinueOnError); if (pMaxObjectCount != null) { - iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, MAX_OBJECT_COUNT); + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, MAX_OBJECT_COUNT); CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pMaxObjectCount); } @@ -2143,7 +2224,7 @@ public Element OpenEnumerateInstancePaths_request(Document pDoc, CIMObjectPath p /** * OpenEnumerateInstances_request - * + * * @param pDoc * @param pPath * @param pPropertyList @@ -2157,18 +2238,24 @@ public Element OpenEnumerateInstancePaths_request(Document pDoc, CIMObjectPath p * @return Element * @throws WBEMException */ - public Element OpenEnumerateInstances_request(Document pDoc, CIMObjectPath pPath, - boolean pDeepInheritance, boolean pIncludeClassOrigin, String[] pPropertyList, - String pFilterQueryLanguage, String pFilterQuery, UnsignedInteger32 pOperationTimeout, - boolean pContinueOnError, UnsignedInteger32 pMaxObjectCount) throws WBEMException { - + public Element OpenEnumerateInstances_request( + Document pDoc, + CIMObjectPath pPath, + boolean pDeepInheritance, + boolean pIncludeClassOrigin, + String[] pPropertyList, + String pFilterQueryLanguage, + String pFilterQuery, + UnsignedInteger32 pOperationTimeout, + boolean pContinueOnError, + UnsignedInteger32 pMaxObjectCount + ) + throws WBEMException { String className = pPath.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name"); Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, - "OpenEnumerateInstances"); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "OpenEnumerateInstances"); CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, CLASS_NAME); @@ -2177,20 +2264,17 @@ public Element OpenEnumerateInstances_request(Document pDoc, CIMObjectPath pPath iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, DEEP_INHERITANCE); CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pDeepInheritance); - iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, INCLUDE_CLASS_ORIGIN); + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, INCLUDE_CLASS_ORIGIN); CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeClassOrigin); if (pPropertyList != null) { iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, PROPERTY_LIST); Element valuearrayE = CIMXMLBuilderImpl.createVALUEARRAY(pDoc, iparamvalueE); - for (int i = 0; i < pPropertyList.length; i++) - CIMXMLBuilderImpl.createVALUE(pDoc, valuearrayE, pPropertyList[i]); + for (int i = 0; i < pPropertyList.length; i++) CIMXMLBuilderImpl.createVALUE(pDoc, valuearrayE, pPropertyList[i]); } if (pFilterQueryLanguage != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - FILTER_QUERY_LANGUAGE); + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, FILTER_QUERY_LANGUAGE); CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pFilterQueryLanguage); } if (pFilterQuery != null) { @@ -2198,8 +2282,7 @@ public Element OpenEnumerateInstances_request(Document pDoc, CIMObjectPath pPath CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pFilterQuery); } if (pOperationTimeout != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - OPERATION_TIMEOUT); + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, OPERATION_TIMEOUT); CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pOperationTimeout); } @@ -2207,8 +2290,7 @@ public Element OpenEnumerateInstances_request(Document pDoc, CIMObjectPath pPath CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pContinueOnError); if (pMaxObjectCount != null) { - iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, MAX_OBJECT_COUNT); + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, MAX_OBJECT_COUNT); CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pMaxObjectCount); } @@ -2217,60 +2299,51 @@ public Element OpenEnumerateInstances_request(Document pDoc, CIMObjectPath pPath /** * EnumerationCount_request - * + * * @param pDoc * @param pPath * @param pEnumerationContext * @return Element * @throws WBEMException */ - public Element EnumerationCount_request(Document pDoc, CIMObjectPath pPath, - String pEnumerationContext) throws WBEMException { - + public Element EnumerationCount_request(Document pDoc, CIMObjectPath pPath, String pEnumerationContext) + throws WBEMException { String className = pPath.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name"); Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, - "EnumerationCount"); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "EnumerationCount"); CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); if (pEnumerationContext != null) { - Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - ENUMERATION_CONTEXT); + Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, ENUMERATION_CONTEXT); CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pEnumerationContext); } return simplereqE; - } /** * CloseEnumeration_request - * + * * @param pDoc * @param pPath * @param pEnumerationContext * @return Element * @throws WBEMException */ - public Element CloseEnumeration_request(Document pDoc, CIMObjectPath pPath, - String pEnumerationContext) throws WBEMException { - + public Element CloseEnumeration_request(Document pDoc, CIMObjectPath pPath, String pEnumerationContext) + throws WBEMException { String className = pPath.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name"); Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, - "CloseEnumeration"); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "CloseEnumeration"); CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); if (pEnumerationContext != null) { - Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - ENUMERATION_CONTEXT); + Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, ENUMERATION_CONTEXT); CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pEnumerationContext); } return simplereqE; @@ -2278,7 +2351,7 @@ public Element CloseEnumeration_request(Document pDoc, CIMObjectPath pPath, /** * referencePaths_request - * + * * @param pDoc * @param pPath * @param pResultClass @@ -2291,22 +2364,26 @@ public Element CloseEnumeration_request(Document pDoc, CIMObjectPath pPath, * @return Element referencePaths_request * @throws WBEMException */ - public Element OpenReferenceInstancePaths_request(Document pDoc, CIMObjectPath pPath, - String pResultClass, String pRole, String pFilterQueryLanguage, String pFilterQuery, - UnsignedInteger32 pOperationTimeout, boolean pContinueOnError, - UnsignedInteger32 pMaxObjectCount) throws WBEMException { - + public Element OpenReferenceInstancePaths_request( + Document pDoc, + CIMObjectPath pPath, + String pResultClass, + String pRole, + String pFilterQueryLanguage, + String pFilterQuery, + UnsignedInteger32 pOperationTimeout, + boolean pContinueOnError, + UnsignedInteger32 pMaxObjectCount + ) + throws WBEMException { String className = pPath.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name"); Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, - "OpenReferenceInstancePaths"); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "OpenReferenceInstancePaths"); CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); - Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - INSTANCE_NAME); + Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, INSTANCE_NAME); CIMXMLBuilderImpl.createINSTANCENAME(pDoc, iparamvalueE, pPath); if (pResultClass != null) { @@ -2318,8 +2395,7 @@ public Element OpenReferenceInstancePaths_request(Document pDoc, CIMObjectPath p CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pRole); } if (pFilterQueryLanguage != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - FILTER_QUERY_LANGUAGE); + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, FILTER_QUERY_LANGUAGE); CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pFilterQueryLanguage); } if (pFilterQuery != null) { @@ -2327,8 +2403,7 @@ public Element OpenReferenceInstancePaths_request(Document pDoc, CIMObjectPath p CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pFilterQuery); } if (pOperationTimeout != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - OPERATION_TIMEOUT); + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, OPERATION_TIMEOUT); CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pOperationTimeout); } @@ -2336,18 +2411,16 @@ public Element OpenReferenceInstancePaths_request(Document pDoc, CIMObjectPath p CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pContinueOnError); if (pMaxObjectCount != null) { - iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, MAX_OBJECT_COUNT); + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, MAX_OBJECT_COUNT); CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pMaxObjectCount); } return simplereqE; - } /** * references_request - * + * * @param pDoc * @param pPath * @param pResultClass @@ -2362,22 +2435,28 @@ public Element OpenReferenceInstancePaths_request(Document pDoc, CIMObjectPath p * @return Element references_request * @throws WBEMException */ - public Element OpenReferenceInstances_request(Document pDoc, CIMObjectPath pPath, - String pResultClass, String pRole, boolean pIncludeClassOrigin, String[] pPropertyList, - String pFilterQueryLanguage, String pFilterQuery, UnsignedInteger32 pOperationTimeout, - boolean pContinueOnError, UnsignedInteger32 pMaxObjectCount) throws WBEMException { - + public Element OpenReferenceInstances_request( + Document pDoc, + CIMObjectPath pPath, + String pResultClass, + String pRole, + boolean pIncludeClassOrigin, + String[] pPropertyList, + String pFilterQueryLanguage, + String pFilterQuery, + UnsignedInteger32 pOperationTimeout, + boolean pContinueOnError, + UnsignedInteger32 pMaxObjectCount + ) + throws WBEMException { String className = pPath.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name"); Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, - "OpenReferenceInstances"); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "OpenReferenceInstances"); CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); - Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - INSTANCE_NAME); + Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, INSTANCE_NAME); CIMXMLBuilderImpl.createINSTANCENAME(pDoc, iparamvalueE, pPath); if (pResultClass != null) { @@ -2389,20 +2468,17 @@ public Element OpenReferenceInstances_request(Document pDoc, CIMObjectPath pPath CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pRole); } - iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, INCLUDE_CLASS_ORIGIN); + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, INCLUDE_CLASS_ORIGIN); CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeClassOrigin); if (pPropertyList != null) { iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, PROPERTY_LIST); Element valuearrayE = CIMXMLBuilderImpl.createVALUEARRAY(pDoc, iparamvalueE); - for (int i = 0; i < pPropertyList.length; i++) - CIMXMLBuilderImpl.createVALUE(pDoc, valuearrayE, pPropertyList[i]); + for (int i = 0; i < pPropertyList.length; i++) CIMXMLBuilderImpl.createVALUE(pDoc, valuearrayE, pPropertyList[i]); } if (pFilterQueryLanguage != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - FILTER_QUERY_LANGUAGE); + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, FILTER_QUERY_LANGUAGE); CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pFilterQueryLanguage); } if (pFilterQuery != null) { @@ -2410,8 +2486,7 @@ public Element OpenReferenceInstances_request(Document pDoc, CIMObjectPath pPath CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pFilterQuery); } if (pOperationTimeout != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - OPERATION_TIMEOUT); + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, OPERATION_TIMEOUT); CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pOperationTimeout); } @@ -2419,8 +2494,7 @@ public Element OpenReferenceInstances_request(Document pDoc, CIMObjectPath pPath CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pContinueOnError); if (pMaxObjectCount != null) { - iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, MAX_OBJECT_COUNT); + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, MAX_OBJECT_COUNT); CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pMaxObjectCount); } @@ -2429,7 +2503,7 @@ public Element OpenReferenceInstances_request(Document pDoc, CIMObjectPath pPath /** * OpenQueryInstances_request - * + * * @param pDoc * @param pPath * @param pFilterQuery @@ -2442,18 +2516,23 @@ public Element OpenReferenceInstances_request(Document pDoc, CIMObjectPath pPath * @return Element OpenQueryInstances_request * @throws WBEMException */ - public Element OpenQueryInstances_request(Document pDoc, CIMObjectPath pPath, - String pFilterQuery, String pFilterQueryLanguage, boolean pReturnQueryResultClass, - UnsignedInteger32 pOperationTimeout, boolean pContinueOnError, - UnsignedInteger32 pMaxObjectCount, CIMClass pQueryResultClass) throws WBEMException { - + public Element OpenQueryInstances_request( + Document pDoc, + CIMObjectPath pPath, + String pFilterQuery, + String pFilterQueryLanguage, + boolean pReturnQueryResultClass, + UnsignedInteger32 pOperationTimeout, + boolean pContinueOnError, + UnsignedInteger32 pMaxObjectCount, + CIMClass pQueryResultClass + ) + throws WBEMException { String className = pPath.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name"); Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, - "OpenQueryInstances"); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "OpenQueryInstances"); CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); Element iparamvalueE; @@ -2463,17 +2542,14 @@ public Element OpenQueryInstances_request(Document pDoc, CIMObjectPath pPath, CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pFilterQuery); } if (pFilterQueryLanguage != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - FILTER_QUERY_LANGUAGE); + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, FILTER_QUERY_LANGUAGE); CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pFilterQueryLanguage); } - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - RETURN_QUERY_RESULT_CLASS); + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, RETURN_QUERY_RESULT_CLASS); CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pReturnQueryResultClass); if (pOperationTimeout != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - OPERATION_TIMEOUT); + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, OPERATION_TIMEOUT); CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pOperationTimeout); } @@ -2481,13 +2557,11 @@ public Element OpenQueryInstances_request(Document pDoc, CIMObjectPath pPath, CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pContinueOnError); if (pMaxObjectCount != null) { - iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, MAX_OBJECT_COUNT); + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, MAX_OBJECT_COUNT); CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pMaxObjectCount); } if (pQueryResultClass != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - QUERY_RESULT_CLASS); + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, QUERY_RESULT_CLASS); CIMXMLBuilderImpl.createCLASS(pDoc, iparamvalueE, pQueryResultClass); } return simplereqE; @@ -2495,7 +2569,7 @@ public Element OpenQueryInstances_request(Document pDoc, CIMObjectPath pPath, /** * PullInstancesWithPath_request - * + * * @param pDoc * @param pPath * @param pContext @@ -2503,29 +2577,29 @@ public Element OpenQueryInstances_request(Document pDoc, CIMObjectPath pPath, * @return Element PullInstancesWithPath_request * @throws WBEMException */ - public Element PullInstancesWithPath_request(Document pDoc, CIMObjectPath pPath, - String pContext, UnsignedInteger32 pMaxObjectCount) throws WBEMException { - + public Element PullInstancesWithPath_request( + Document pDoc, + CIMObjectPath pPath, + String pContext, + UnsignedInteger32 pMaxObjectCount + ) + throws WBEMException { String className = pPath.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name"); Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, - "PullInstancesWithPath"); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "PullInstancesWithPath"); CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); Element iparamvalueE; if (pContext != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - ENUMERATION_CONTEXT); + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, ENUMERATION_CONTEXT); CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pContext); } if (pMaxObjectCount != null) { - iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, MAX_OBJECT_COUNT); + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, MAX_OBJECT_COUNT); CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pMaxObjectCount); } @@ -2534,7 +2608,7 @@ public Element PullInstancesWithPath_request(Document pDoc, CIMObjectPath pPath, /** * PullInstancePaths_request - * + * * @param pDoc * @param pPath * @param pContext @@ -2542,30 +2616,30 @@ public Element PullInstancesWithPath_request(Document pDoc, CIMObjectPath pPath, * @return Element PullInstancePaths * @throws WBEMException */ - public Element PullInstancePaths_request(Document pDoc, CIMObjectPath pPath, String pContext, - UnsignedInteger32 pMaxObjectCount) throws WBEMException { - + public Element PullInstancePaths_request( + Document pDoc, + CIMObjectPath pPath, + String pContext, + UnsignedInteger32 pMaxObjectCount + ) + throws WBEMException { String className = pPath.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name"); Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, - "PullInstancePaths"); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "PullInstancePaths"); CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); Element iparamvalueE; if (pContext != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - ENUMERATION_CONTEXT); + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, ENUMERATION_CONTEXT); CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pContext); } if (pMaxObjectCount != null) { - iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, MAX_OBJECT_COUNT); + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, MAX_OBJECT_COUNT); CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pMaxObjectCount); } @@ -2574,7 +2648,7 @@ public Element PullInstancePaths_request(Document pDoc, CIMObjectPath pPath, Str /** * PullInstances_request - * + * * @param pDoc * @param pPath * @param pContext @@ -2582,29 +2656,30 @@ public Element PullInstancePaths_request(Document pDoc, CIMObjectPath pPath, Str * @return Element PullInstances_request * @throws WBEMException */ - public Element PullInstances_request(Document pDoc, CIMObjectPath pPath, String pContext, - UnsignedInteger32 pMaxObjectCount) throws WBEMException { + public Element PullInstances_request( + Document pDoc, + CIMObjectPath pPath, + String pContext, + UnsignedInteger32 pMaxObjectCount + ) + throws WBEMException { String className = pPath.getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, - "null class name"); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name"); Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc); - Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, - "PullInstances"); + Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "PullInstances"); CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath); Element iparamvalueE; if (pContext != null) { - iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, - ENUMERATION_CONTEXT); + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, ENUMERATION_CONTEXT); CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pContext); } if (pMaxObjectCount != null) { - iparamvalueE = CIMXMLBuilderImpl - .createIPARAMVALUE(pDoc, imethodcallE, MAX_OBJECT_COUNT); + iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, MAX_OBJECT_COUNT); CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pMaxObjectCount); } @@ -2613,19 +2688,16 @@ public Element PullInstances_request(Document pDoc, CIMObjectPath pPath, String /** * sendIndication_request - * + * * @param pDoc * @param pIndication * @return Element sendIndication_request * @throws WBEMException */ - public Element sendIndication_request(Document pDoc, CIMInstance pIndication) - throws WBEMException { + public Element sendIndication_request(Document pDoc, CIMInstance pIndication) throws WBEMException { Element simpleexpreqE = CIMXMLBuilderImpl.createSIMPLEEXPREQ(pDoc); - Element expmethodcallE = CIMXMLBuilderImpl.createEXPMETHODCALL(pDoc, simpleexpreqE, - "ExportIndication"); - Element expparamvalueE = CIMXMLBuilderImpl.createEXPPARAMVALUE(pDoc, expmethodcallE, - "NewIndication"); + Element expmethodcallE = CIMXMLBuilderImpl.createEXPMETHODCALL(pDoc, simpleexpreqE, "ExportIndication"); + Element expparamvalueE = CIMXMLBuilderImpl.createEXPPARAMVALUE(pDoc, expmethodcallE, "NewIndication"); CIMXMLBuilderImpl.createINSTANCE(pDoc, expparamvalueE, pIndication); diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/CIMMessage.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/CIMMessage.java index b064249..9b091d4 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/CIMMessage.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/CIMMessage.java @@ -46,14 +46,12 @@ */ import java.util.Hashtable; - import org.w3c.dom.Document; /** * Class CIMMessage is used by the CIM-XML DOM parser. */ public class CIMMessage { - protected Document iDoc; protected Hashtable iElements; @@ -74,11 +72,13 @@ public class CIMMessage { protected boolean iIsRequest = false; - protected CIMMessage() { /**/} + protected CIMMessage() { + /**/ + } /** * Ctor. - * + * * @param pCimVersion * @param pDtdVersion * @param pId @@ -93,7 +93,7 @@ public CIMMessage(String pCimVersion, String pDtdVersion, String pId, String pMe /** * getCIMVersion - * + * * @return String */ public String getCIMVersion() { @@ -102,7 +102,7 @@ public String getCIMVersion() { /** * getDTDVersion - * + * * @return String */ public String getDTDVersion() { @@ -111,7 +111,7 @@ public String getDTDVersion() { /** * isCIMOperation - * + * * @return String */ public boolean isCIMOperation() { @@ -120,7 +120,7 @@ public boolean isCIMOperation() { /** * isCIMExport - * + * * @return String */ public boolean isCIMExport() { @@ -129,7 +129,7 @@ public boolean isCIMExport() { /** * setId - * + * * @param pId */ public void setId(String pId) { @@ -138,21 +138,19 @@ public void setId(String pId) { /** * setMethod - * + * * @param pMethod */ public void setMethod(String pMethod) { - this.iMethod = pMethod; - this.iIsCIMExport = (pMethod.toUpperCase().endsWith("EXPREQ") || pMethod.toUpperCase() - .endsWith("EXPRSP")); + this.iIsCIMExport = (pMethod.toUpperCase().endsWith("EXPREQ") || pMethod.toUpperCase().endsWith("EXPRSP")); this.iIsRequest = (pMethod.toUpperCase().endsWith("REQ")); this.iIsSimple = pMethod.toUpperCase().startsWith("SIMPLE"); } /** * setCIMVersion - * + * * @param pCimVersion */ public void setCIMVersion(String pCimVersion) { @@ -161,7 +159,7 @@ public void setCIMVersion(String pCimVersion) { /** * setDTDVersion - * + * * @param pDtdVersion */ public void setDTDVersion(String pDtdVersion) { @@ -170,7 +168,7 @@ public void setDTDVersion(String pDtdVersion) { /** * setIsRequest - * + * * @param pValue */ public void setIsRequest(boolean pValue) { @@ -179,7 +177,7 @@ public void setIsRequest(boolean pValue) { /** * getId - * + * * @return String */ public String getId() { @@ -188,7 +186,7 @@ public String getId() { /** * getProtocolVersion - * + * * @return String */ public String getProtocolVersion() { diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/CIMRequest.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/CIMRequest.java index a87d204..e5bc5fe 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/CIMRequest.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/CIMRequest.java @@ -46,15 +46,13 @@ */ import java.util.Vector; - import org.metricshub.wbem.javax.cim.CIMObjectPath; /** * Class CIMRequest is used by the CIM-XML DOM parser. - * + * */ public class CIMRequest extends CIMMessage { - protected Vector iRequests = new Vector(0); protected Vector iParamValue = new Vector(0); @@ -68,11 +66,13 @@ public class CIMRequest extends CIMMessage { /** * Ctor. */ - public CIMRequest() { /**/} + public CIMRequest() { + /**/ + } /** * Ctor. - * + * * @param pCimVersion * @param pDtdVersion * @param pId @@ -84,17 +84,16 @@ public CIMRequest(String pCimVersion, String pDtdVersion, String pId, String pMe /** * addParamValue - * + * * @param v */ public void addParamValue(Object v) { - if (v instanceof Vector) this.iParamValue.addAll((Vector) v); - else this.iParamValue.add(v); + if (v instanceof Vector) this.iParamValue.addAll((Vector) v); else this.iParamValue.add(v); } /** * addRequest - * + * * @param request */ public void addRequest(CIMRequest request) { @@ -103,7 +102,7 @@ public void addRequest(CIMRequest request) { /** * getMethodName - * + * * @return String */ public String getMethodName() { @@ -112,7 +111,7 @@ public String getMethodName() { /** * getNameSpace - * + * * @return String */ public String getNameSpace() { @@ -121,7 +120,7 @@ public String getNameSpace() { /** * getObjectPath - * + * * @return String */ public CIMObjectPath getObjectPath() { @@ -130,7 +129,7 @@ public CIMObjectPath getObjectPath() { /** * getParamValue - * + * * @return String */ public Vector getParamValue() { @@ -139,7 +138,7 @@ public Vector getParamValue() { /** * setMethodName - * + * * @param methodName */ public void setMethodName(String methodName) { @@ -148,7 +147,7 @@ public void setMethodName(String methodName) { /** * setNameSpace - * + * * @param namespace */ public void setNameSpace(String namespace) { @@ -157,7 +156,7 @@ public void setNameSpace(String namespace) { /** * setObjectPath - * + * * @param path */ public void setObjectPath(CIMObjectPath path) { diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/CIMResponse.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/CIMResponse.java index 22cab16..7206e5e 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/CIMResponse.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/CIMResponse.java @@ -49,14 +49,12 @@ import java.util.List; import java.util.Vector; - import org.metricshub.wbem.javax.wbem.WBEMException; /** * Represent a CIMReponse message. */ public class CIMResponse extends CIMMessage { - protected Vector iResponses = new Vector(0); protected WBEMException iError = null; @@ -67,14 +65,16 @@ public class CIMResponse extends CIMMessage { /** * Constructs a CIMResponse object. - * + * */ - public CIMResponse() { /**/} + public CIMResponse() { + /**/ + } /** * Constructs a CIMResponse object with the specified CIMVersion, DTDVersion * and method. - * + * * @param pCimVersion * @param pDtdVersion * @param pId @@ -86,7 +86,7 @@ public CIMResponse(String pCimVersion, String pDtdVersion, String pId, String pM /** * Constructs a CIM Response message from a given CIM Request. - * + * * @param request */ public CIMResponse(CIMRequest request) { @@ -97,7 +97,7 @@ public CIMResponse(CIMRequest request) { /** * addParamValue - * + * * @param o */ public void addParamValue(Object o) { @@ -106,7 +106,7 @@ public void addParamValue(Object o) { /** * addParamValue - * + * * @param v */ public void addParamValue(Vector v) { @@ -115,7 +115,7 @@ public void addParamValue(Vector v) { /** * addResponse - * + * * @param response */ public void addResponse(CIMResponse response) { @@ -124,7 +124,7 @@ public void addResponse(CIMResponse response) { /** * addReturnValue - * + * * @param o */ public void addReturnValue(Object o) { @@ -133,7 +133,7 @@ public void addReturnValue(Object o) { /** * Verify the status code for this CIMResponse. - * + * * @throws WBEMException * if the status code is other than success. */ @@ -143,7 +143,7 @@ public void checkError() throws WBEMException { /** * getAllResponses - * + * * @return List */ public List getAllResponses() { @@ -152,7 +152,7 @@ public List getAllResponses() { /** * getException - * + * * @return WBEMException */ public WBEMException getException() { @@ -161,7 +161,7 @@ public WBEMException getException() { /** * isSuccessful - * + * * @return boolean */ public boolean isSuccessful() { @@ -170,18 +170,17 @@ public boolean isSuccessful() { /** * getFirstResponse - * + * * @return CIMResponse */ public CIMResponse getFirstResponse() { - if (this.iResponses != null && this.iResponses.size() > 0) return this.iResponses - .elementAt(0); + if (this.iResponses != null && this.iResponses.size() > 0) return this.iResponses.elementAt(0); return null; } /** * getParamValues - * + * * @return List */ public List getParamValues() { @@ -190,7 +189,7 @@ public List getParamValues() { /** * getFirstReturnValue - * + * * @return List */ public List getFirstReturnValue() { @@ -199,7 +198,7 @@ public List getFirstReturnValue() { /** * setError - * + * * @param error */ public void setError(WBEMException error) { @@ -208,7 +207,7 @@ public void setError(WBEMException error) { /** * setParamValue - * + * * @param paramValue */ public void setParamValue(Vector paramValue) { @@ -217,11 +216,10 @@ public void setParamValue(Vector paramValue) { /** * setReturnValue - * + * * @param returnValue */ public void setReturnValue(Vector returnValue) { this.iReturnValue = returnValue; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/CIMXMLBuilderImpl.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/CIMXMLBuilderImpl.java index 89e1dc7..1d6a179 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/CIMXMLBuilderImpl.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/CIMXMLBuilderImpl.java @@ -80,17 +80,24 @@ import java.io.IOException; import java.util.regex.Matcher; import java.util.regex.Pattern; - +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; import org.metricshub.wbem.javax.cim.CIMArgument; import org.metricshub.wbem.javax.cim.CIMClass; import org.metricshub.wbem.javax.cim.CIMClassProperty; import org.metricshub.wbem.javax.cim.CIMDataType; +import org.metricshub.wbem.javax.cim.CIMFlavor; import org.metricshub.wbem.javax.cim.CIMInstance; import org.metricshub.wbem.javax.cim.CIMMethod; +import org.metricshub.wbem.javax.cim.CIMNamedElementInterface; import org.metricshub.wbem.javax.cim.CIMObjectPath; import org.metricshub.wbem.javax.cim.CIMParameter; +import org.metricshub.wbem.javax.cim.CIMProperty; +import org.metricshub.wbem.javax.cim.CIMQualifiedElementInterface; import org.metricshub.wbem.javax.cim.CIMQualifier; import org.metricshub.wbem.javax.cim.CIMQualifierType; +import org.metricshub.wbem.javax.cim.CIMScope; import org.metricshub.wbem.javax.cim.CIMTypedElement; import org.metricshub.wbem.javax.cim.CIMValuedElement; import org.metricshub.wbem.javax.wbem.WBEMException; @@ -98,16 +105,6 @@ import org.metricshub.wbem.sblim.cimclient.internal.util.MOF; import org.metricshub.wbem.sblim.cimclient.internal.util.WBEMConfiguration; import org.metricshub.wbem.sblim.cimclient.internal.wbem.CIMError; -import org.metricshub.wbem.javax.cim.CIMFlavor; -import org.metricshub.wbem.javax.cim.CIMNamedElementInterface; -import org.metricshub.wbem.javax.cim.CIMProperty; -import org.metricshub.wbem.javax.cim.CIMQualifiedElementInterface; -import org.metricshub.wbem.javax.cim.CIMScope; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; - import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Text; @@ -116,7 +113,6 @@ * Class CIMXMLBuilderImpl is the core class for building CIM-XML documents. */ public class CIMXMLBuilderImpl { - private static final int MAJOR_CIM_VERSION = 2; private static final int MINOR_CIM_VERSION = 0; @@ -127,7 +123,7 @@ public class CIMXMLBuilderImpl { /** * createCIM - * + * * @param pDoc * @return Element */ @@ -149,7 +145,7 @@ public static Element createCIM(Document pDoc) { /** * createVALUE - * + * * @param pDoc * @param pParentE * @return Element @@ -164,7 +160,7 @@ public static Element createVALUE(Document pDoc, Element pParentE) { /** * createVALUE - * + * * @param pDoc * @param pParentE * @param pValue @@ -182,7 +178,7 @@ public static Element createVALUE(Document pDoc, Element pParentE, String pValue /** * createVALUE - * + * * @param pDoc * @param pParentE * @param pValue @@ -194,7 +190,7 @@ public static Element createVALUE(Document pDoc, Element pParentE, boolean pValu /** * createVALUEARRAY - * + * * @param pDoc * @param pParentE * @return Element @@ -208,7 +204,7 @@ public static Element createVALUEARRAY(Document pDoc, Element pParentE) { /** * createVALUEREFERENCE - * + * * @param pDoc * @param pParentE * @return Element @@ -223,7 +219,7 @@ public static Element createVALUEREFERENCE(Document pDoc, Element pParentE) { /** * createVALUEREFARRAY - * + * * @param pDoc * @param pParentE * @return Element @@ -240,7 +236,7 @@ public static Element createVALUEREFARRAY(Document pDoc, Element pParentE) { // //////////////////////////////////////////////////////////////////////////////////////// /** * createPROPERTY - * + * * @param pDoc * @param pParentE * @param pName @@ -265,15 +261,14 @@ public static Element createPROPERTY(Document pDoc, Element pParentE, String pNa /** * createPROPERTYARRAY - * + * * @param pDoc * @param pParentE * @param pName * @param pType * @return Element */ - public static Element createPROPERTYARRAY(Document pDoc, Element pParentE, String pName, - String pType) { + public static Element createPROPERTYARRAY(Document pDoc, Element pParentE, String pName, String pType) { // // // 0) e.setAttribute( - "REFERENCECLASS", pReferenceclass); + if (pReferenceclass != null && pReferenceclass.length() > 0) e.setAttribute("REFERENCECLASS", pReferenceclass); pParentE.appendChild(e); return e; } @@ -322,7 +315,7 @@ public static Element createPROPERTYREFERENCE(Document pDoc, Element pParentE, S /** * createNAMESPACE - * + * * @param pDoc * @param pParentE * @param pName @@ -341,7 +334,7 @@ public static Element createNAMESPACE(Document pDoc, Element pParentE, String pN /** * createLOCALINSTANCEPATH - * + * * @param pDoc * @param pParentE * @return Element @@ -355,7 +348,7 @@ public static Element createLOCALINSTANCEPATH(Document pDoc, Element pParentE) { /** * createCLASSNAME - * + * * @param pDoc * @param pParentE * @param pName @@ -375,25 +368,22 @@ public static Element createCLASSNAME(Document pDoc, Element pParentE, String pN /** * createCLASS - * + * * @param pDoc * @param pParentE * @param pName * @param pSuperClass * @return Element */ - public static Element createCLASS(Document pDoc, Element pParentE, String pName, - String pSuperClass) { + public static Element createCLASS(Document pDoc, Element pParentE, String pName, String pSuperClass) { // // Element e = pDoc.createElement("CLASS"); if (pName != null) { e.setAttribute("NAME", pName); - } if (pSuperClass != null && pSuperClass.length() > 0) { e.setAttribute("SUPERCLASS", pSuperClass); - } if (pParentE != null) pParentE.appendChild(e); return e; @@ -401,7 +391,7 @@ public static Element createCLASS(Document pDoc, Element pParentE, String pName, /** * createINSTANCENAME - * + * * @param pDoc * @param pParentE * @param pClassName @@ -420,7 +410,7 @@ public static Element createINSTANCENAME(Document pDoc, Element pParentE, String /** * createKEYBINDING - * + * * @param pDoc * @param pParentE * @param pName @@ -437,18 +427,16 @@ public static Element createKEYBINDING(Document pDoc, Element pParentE, String p return e; } - private static final Pattern NUM_PAT = Pattern.compile("^[su]int(8|16|32|64)$", - Pattern.CASE_INSENSITIVE); + private static final Pattern NUM_PAT = Pattern.compile("^[su]int(8|16|32|64)$", Pattern.CASE_INSENSITIVE); /** * * getValueTypeStr - * + * * @param pTypeStr * @return String */ private static String getValueTypeStr(String pTypeStr) { - if (pTypeStr == null || MOF.DT_STR.equalsIgnoreCase(pTypeStr)) return MOF.DT_STR; if (MOF.DT_BOOL.equalsIgnoreCase(pTypeStr)) return MOF.DT_BOOL; Matcher m = NUM_PAT.matcher(pTypeStr); @@ -458,15 +446,14 @@ private static String getValueTypeStr(String pTypeStr) { /** * createKEYVALUE - * + * * @param pDoc * @param pParentE * @param pValueType * @param pValue * @return KEYVALUE */ - public static Element createKEYVALUE(Document pDoc, Element pParentE, String pValueType, - String pValue) { + public static Element createKEYVALUE(Document pDoc, Element pParentE, String pValueType, String pValue) { /* * @@ -489,7 +476,7 @@ public static Element createKEYVALUE(Document pDoc, Element pParentE, String pVa /** * createINSTANCE - * + * * @param pDoc * @param pParentE * @param pClassName @@ -510,15 +497,14 @@ public static Element createINSTANCE(Document pDoc, Element pParentE, String pCl /** * createQUALIFIER - * + * * @param pDoc * @param pParentE * @param pName * @param pType * @return Element */ - public static Element createQUALIFIER(Document pDoc, Element pParentE, String pName, - String pType) { + public static Element createQUALIFIER(Document pDoc, Element pParentE, String pName, String pType) { // // // @@ -563,7 +548,7 @@ public static Element createMESSAGE(Document pDoc, Element pParentE, String pId, /** * createSIMPLEREQ - * + * * @param pDoc * @param pParentE * @return Element @@ -577,7 +562,7 @@ public static Element createSIMPLEREQ(Document pDoc, Element pParentE) { /** * createSIMPLEREQ - * + * * @param pDoc * @return Element */ @@ -589,7 +574,7 @@ public static Element createSIMPLEREQ(Document pDoc) { /** * createMULTIREQ - * + * * @param pDoc * @return Element */ @@ -601,7 +586,7 @@ public static Element createMULTIREQ(Document pDoc) { /** * createMETHODCALL - * + * * @param pDoc * @param pParentE * @param pName @@ -621,15 +606,14 @@ public static Element createMETHODCALL(Document pDoc, Element pParentE, String p /** * createPARAMVALUE - * + * * @param pDoc * @param pParentE * @param pArg * @return Element * @throws WBEMException */ - public static Element createPARAMVALUE(Document pDoc, Element pParentE, CIMArgument pArg) - throws WBEMException { + public static Element createPARAMVALUE(Document pDoc, Element pParentE, CIMArgument pArg) throws WBEMException { // ) // @@ -648,7 +632,7 @@ public static Element createPARAMVALUE(Document pDoc, Element pParentE, CIMArgum /** * createSIMPLERSP - * + * * @param pDoc * @param pParentE * @return Element @@ -663,7 +647,7 @@ public static Element createSIMPLERSP(Document pDoc, Element pParentE) { /** * createSIMPLEEXPRSP - * + * * @param pDoc * @param pParentE * @return Element @@ -678,7 +662,7 @@ public static Element createSIMPLEEXPRSP(Document pDoc, Element pParentE) { /** * createMETHODRESPONSE - * + * * @param pDoc * @param pParentE * @param pName @@ -700,7 +684,7 @@ public static Element createMETHODRESPONSE(Document pDoc, Element pParentE, Stri /** * createIMETHODRESPONSE - * + * * @param pDoc * @param pParentE * @param pName @@ -721,7 +705,7 @@ public static Element createIMETHODRESPONSE(Document pDoc, Element pParentE, Str /** * createEXPMETHODRESPONSE - * + * * @param pDoc * @param pParentE * @param pName @@ -741,7 +725,7 @@ public static Element createEXPMETHODRESPONSE(Document pDoc, Element pParentE, S /** * createIRETURNVALUE - * + * * @param pDoc * @param pParentE * @return Element @@ -762,17 +746,16 @@ public static Element createIRETURNVALUE(Document pDoc, Element pParentE) { * !ATTLIST RETURNVALUE * %ParamType; #IMPLIED * - * + * * createRETURNVALUE - * + * * @param pDoc * @param pParentE * @param pValue * @return Element * @throws WBEMException */ - public static Element createRETURNVALUE(Document pDoc, Element pParentE, Object pValue) - throws WBEMException { + public static Element createRETURNVALUE(Document pDoc, Element pParentE, Object pValue) throws WBEMException { Element retValE = pDoc.createElement("RETURNVALUE"); CIMDataType type = CIMDataType.getDataType(pValue); retValE.setAttribute("PARAMTYPE", getTypeStr(type)); @@ -783,7 +766,7 @@ public static Element createRETURNVALUE(Document pDoc, Element pParentE, Object /** * createIMETHODCALL - * + * * @param pDoc * @param pParentE * @param pName @@ -802,7 +785,7 @@ public static Element createIMETHODCALL(Document pDoc, Element pParentE, String /** * createIPARAMVALUE - * + * * @param pDoc * @param pParentE * @param pName @@ -823,7 +806,7 @@ public static Element createIPARAMVALUE(Document pDoc, Element pParentE, String /** * createERROR - * + * * @param doc * @param parentE * @param error @@ -852,7 +835,7 @@ public static Element createERROR(Document doc, Element parentE, CIMError error) * ENTITY % QualifierFlavor "OVERRIDABLE (true|false) 'true' TOSUBCLASS * (true|false) 'true' TOINSTANCE (true|false) 'false' TRANSLATABLE * (true|false) 'false'" - * + * * @param pElement * @param pFlavors */ @@ -874,15 +857,19 @@ private static void setFlavors(Element pElement, int pFlavors) { /** * createQUALIFIER_DECLARATION - * + * * @param pDoc * @param pParentE * @param pQualifierType * @return Element * @throws WBEMException */ - public static Element createQUALIFIER_DECLARATION(Document pDoc, Element pParentE, - CIMQualifierType pQualifierType) throws WBEMException { + public static Element createQUALIFIER_DECLARATION( + Document pDoc, + Element pParentE, + CIMQualifierType pQualifierType + ) + throws WBEMException { // // pQualifier) throws WBEMException { + public static Element createQUALIFIER(Document pDoc, Element pParentE, CIMQualifier pQualifier) + throws WBEMException { // // [] pQualifiersA) throws WBEMException { + public static void createQUALIFIERS(Document pDoc, Element pParentE, CIMQualifier[] pQualifiersA) + throws WBEMException { if (pQualifiersA == null) return; for (int i = 0; i < pQualifiersA.length; i++) { createQUALIFIER(pDoc, pParentE, pQualifiersA[i]); @@ -972,14 +957,14 @@ public static void createQUALIFIERS(Document pDoc, Element pParentE, /** * createPROPERTIES - * + * * @param pDoc * @param pParentE * @param pProperties * @throws WBEMException */ - public static void createPROPERTIES(Document pDoc, Element pParentE, - CIMProperty[] pProperties) throws WBEMException { + public static void createPROPERTIES(Document pDoc, Element pParentE, CIMProperty[] pProperties) + throws WBEMException { if (pProperties == null) return; for (int i = 0; i < pProperties.length; i++) { createPROPERTY(pDoc, pParentE, pProperties[i]); @@ -987,16 +972,22 @@ public static void createPROPERTIES(Document pDoc, Element pParentE, } private static final CIMQualifiedElementInterfaceImpl KEYQUALIFIERS_IMPL = new CIMQualifiedElementInterfaceImpl( - null, true); + null, + true + ); - static final CIMQualifier EMB_OBJ_QUALI = new CIMQualifier("EmbeddedObject", - CIMDataType.BOOLEAN_T, Boolean.TRUE, CIMFlavor.DISABLEOVERRIDE); + static final CIMQualifier EMB_OBJ_QUALI = new CIMQualifier( + "EmbeddedObject", + CIMDataType.BOOLEAN_T, + Boolean.TRUE, + CIMFlavor.DISABLEOVERRIDE + ); // ebak: embedded object: CLASS_T or INSTANCE_T? /** * isCIMObject - * + * * @param typeCode * @return boolean */ @@ -1006,7 +997,7 @@ public static boolean isCIMObject(int typeCode) { /** * isCIMObject - * + * * @param pType * @return boolean */ @@ -1016,7 +1007,7 @@ public static boolean isCIMObject(CIMDataType pType) { /** * getEmbObjTypeStr - * + * * @param pType * @return String */ @@ -1036,7 +1027,7 @@ private static Document getDoc() { /** * cimObjectToXMLString - for embedded object support - * + * * @param pObj * @return String * @throws WBEMException @@ -1052,36 +1043,38 @@ public static String cimObjectToXMLString(Object pObj) throws WBEMException { doc = getDoc(); e = createINSTANCE(doc, null, (CIMInstance) pObj); } else { - throw new WBEMException(WBEMException.CIM_ERR_FAILED, pObj.getClass().getName() - + " parameter is not suitable for this method!"); + throw new WBEMException( + WBEMException.CIM_ERR_FAILED, + pObj.getClass().getName() + " parameter is not suitable for this method!" + ); } doc.appendChild(e); ByteArrayOutputStream os = new ByteArrayOutputStream(); try { CimXmlSerializer.serialize(os, doc.getDocumentElement(), false); } catch (IOException ex) { - throw new WBEMException(WBEMException.CIM_ERR_FAILED, - "XML serialization failed with IOException!", null, ex); + throw new WBEMException(WBEMException.CIM_ERR_FAILED, "XML serialization failed with IOException!", null, ex); } return os.toString(); } /** * cimObjectArrayToXMLString - for embedded object support - * + * * @param pObj * @return String[] * @throws WBEMException */ public static String[] cimObjectArrayToXMLString(Object pObj) throws WBEMException { if (pObj == null) return null; - if (!(pObj instanceof Object[])) throw new WBEMException(WBEMException.CIM_ERR_FAILED, - "Object[] parameter is required for this method!"); + if (!(pObj instanceof Object[])) throw new WBEMException( + WBEMException.CIM_ERR_FAILED, + "Object[] parameter is required for this method!" + ); Object[] objA = (Object[]) pObj; String[] strA = new String[objA.length]; // here we don't deal with the consistency check of the Object[] - for (int i = 0; i < objA.length; i++) - strA[i] = cimObjectToXMLString(objA[i]); + for (int i = 0; i < objA.length; i++) strA[i] = cimObjectToXMLString(objA[i]); return strA; } @@ -1090,7 +1083,6 @@ static boolean embObjQualified(CIMQualifiedElementInterface pQualid) { } static class EmbObjBuilder { - private static final int ATTRIB_ONLY = 0, EO_QUALI = 1, EO_AND_EI_QUALI = 2; private int iSignMethod; @@ -1102,11 +1094,12 @@ static class EmbObjBuilder { private boolean iXMLQualified; private static final boolean iUpperCaseEmbObjEntities = WBEMConfiguration - .getGlobalConfiguration().upperCaseEmbObjEntities(); + .getGlobalConfiguration() + .upperCaseEmbObjEntities(); /** * Ctor. - * + * * @param pDoc * @param pTypedE */ @@ -1116,7 +1109,7 @@ public EmbObjBuilder(Document pDoc, CIMTypedElement pTypedE) { /** * Ctor. - * + * * @param pDoc * @param pTypedE * @param pXMLQualified @@ -1139,7 +1132,7 @@ public EmbObjBuilder(Document pDoc, CIMTypedElement pTypedE, boolean pXMLQualifi /** * getTypeStr - * + * * @return String */ public String getTypeStr() { @@ -1148,7 +1141,7 @@ public String getTypeStr() { /** * isArray - * + * * @return String */ public boolean isArray() { @@ -1158,12 +1151,11 @@ public boolean isArray() { private Object getValue() { if (!(this.iTypedE instanceof CIMValuedElement)) return null; return ((CIMValuedElement) this.iTypedE).getValue(); - } /** * addSign - * + * * @param pElement * @throws WBEMException */ @@ -1177,10 +1169,10 @@ public void addSign(Element pElement) throws WBEMException { qualified = null; } if (this.iSignMethod == ATTRIB_ONLY || (qualified == null && !this.iXMLQualified)) { - pElement.setAttribute(iUpperCaseEmbObjEntities ? "EMBEDDEDOBJECT" - : "EmbeddedObject", - this.iTypedE.getDataType().getType() == CIMDataType.OBJECT ? "instance" - : "object"); + pElement.setAttribute( + iUpperCaseEmbObjEntities ? "EMBEDDEDOBJECT" : "EmbeddedObject", + this.iTypedE.getDataType().getType() == CIMDataType.OBJECT ? "instance" : "object" + ); } else { if (this.iSignMethod == EO_AND_EI_QUALI) { addEmbObjOrEmbInstQuali(pElement); @@ -1201,8 +1193,8 @@ private void addEmbObjOrEmbInstQuali(Element pElement) throws WBEMException { inst = (CIMInstance) getValue(); } String className = inst == null ? "" : inst.getClassName(); - signQuali = new CIMQualifier("EmbeddedInstance", CIMDataType.STRING_T, - className, CIMFlavor.DISABLEOVERRIDE); + signQuali = + new CIMQualifier("EmbeddedInstance", CIMDataType.STRING_T, className, CIMFlavor.DISABLEOVERRIDE); } else { // class signQuali = EMB_OBJ_QUALI; } @@ -1211,7 +1203,7 @@ private void addEmbObjOrEmbInstQuali(Element pElement) throws WBEMException { /** * addValue - * + * * @param pElement * @throws WBEMException */ @@ -1227,20 +1219,18 @@ public void addValue(Element pElement) throws WBEMException { } createVALUE(this.iDoc, pElement, value); } - } /** * createPROPERTY - * + * * @param pDoc * @param pParentE * @param pProperty * @return Element * @throws WBEMException */ - public static Element createPROPERTY(Document pDoc, Element pParentE, CIMProperty pProperty) - throws WBEMException { + public static Element createPROPERTY(Document pDoc, Element pParentE, CIMProperty pProperty) throws WBEMException { CIMDataType propType = pProperty.getDataType(); Element propertyE; EmbObjBuilder embObjBuilder = new EmbObjBuilder(pDoc, pProperty, true); @@ -1248,15 +1238,13 @@ public static Element createPROPERTY(Document pDoc, Element pParentE, CIMPropert if (propType.isArray()) { propertyE = createPROPERTYARRAY(pDoc, pParentE, pProperty.getName(), typeStr); } else if (propType.getType() == CIMDataType.REFERENCE) { - propertyE = createPROPERTYREFERENCE(pDoc, pParentE, pProperty.getName(), propType - .getRefClassName()); + propertyE = createPROPERTYREFERENCE(pDoc, pParentE, pProperty.getName(), propType.getRefClassName()); } else { propertyE = createPROPERTY(pDoc, pParentE, pProperty.getName(), typeStr); } String classorigin = pProperty.getOriginClass(); - if (classorigin != null && classorigin.length() > 0) propertyE.setAttribute("CLASSORIGIN", - classorigin); + if (classorigin != null && classorigin.length() > 0) propertyE.setAttribute("CLASSORIGIN", classorigin); if (pProperty.isPropagated()) propertyE.setAttribute("PROPAGATED", MOF.TRUE); // FIXME: here key qualifier should be added if the property is a key @@ -1264,8 +1252,7 @@ public static Element createPROPERTY(Document pDoc, Element pParentE, CIMPropert if (pProperty instanceof CIMClassProperty) { createQUALIFIERS(pDoc, propertyE, ((CIMClassProperty) pProperty).getQualifiers()); } else { // CIMProperty - if (pProperty.isKey()) createQUALIFIERS(pDoc, propertyE, KEYQUALIFIERS_IMPL - .getQualifiers()); + if (pProperty.isKey()) createQUALIFIERS(pDoc, propertyE, KEYQUALIFIERS_IMPL.getQualifiers()); } embObjBuilder.addValue(propertyE); return propertyE; @@ -1273,18 +1260,19 @@ public static Element createPROPERTY(Document pDoc, Element pParentE, CIMPropert /** * createVALUEARRAY - * + * * @param pDoc * @param pParentE * @param pValA * @return Element * @throws WBEMException */ - public static Element createVALUEARRAY(Document pDoc, Element pParentE, Object[] pValA) - throws WBEMException { - Element valuearrayE = (pValA != null && pValA.length > 0 && (pValA[0] instanceof CIMObjectPath || pValA[0] instanceof CIMInstance)) ? createVALUEREFARRAY( - pDoc, pParentE) - : createVALUEARRAY(pDoc, pParentE); + public static Element createVALUEARRAY(Document pDoc, Element pParentE, Object[] pValA) throws WBEMException { + Element valuearrayE = ( + pValA != null && pValA.length > 0 && (pValA[0] instanceof CIMObjectPath || pValA[0] instanceof CIMInstance) + ) + ? createVALUEREFARRAY(pDoc, pParentE) + : createVALUEARRAY(pDoc, pParentE); if (pValA != null) for (int i = 0; i < pValA.length; i++) { createVALUE(pDoc, valuearrayE, pValA[i]); @@ -1295,15 +1283,14 @@ public static Element createVALUEARRAY(Document pDoc, Element pParentE, Object[] /** * createVALUE - * + * * @param pDoc * @param pParentE * @param pArgValue * @return Element * @throws WBEMException */ - public static Element createVALUE(Document pDoc, Element pParentE, Object pArgValue) - throws WBEMException { + public static Element createVALUE(Document pDoc, Element pParentE, Object pArgValue) throws WBEMException { if (pArgValue == null) return null; Element valueE = null; @@ -1357,23 +1344,21 @@ public static Element createVALUE(Document pDoc, Element pParentE, Object pArgVa /** * createINSTANCE - * + * * @param pDoc * @param pParentE * @param pInstance * @return Element * @throws WBEMException */ - public static Element createINSTANCE(Document pDoc, Element pParentE, CIMInstance pInstance) - throws WBEMException { + public static Element createINSTANCE(Document pDoc, Element pParentE, CIMInstance pInstance) throws WBEMException { // // String className = pInstance.getObjectPath().getObjectName(); - if (className == null) throw new WBEMException(WBEMException.CIM_ERR_FAILED, - "null class name"); + if (className == null) throw new WBEMException(WBEMException.CIM_ERR_FAILED, "null class name"); Element instanceE = createINSTANCE(pDoc, pParentE, className); @@ -1388,15 +1373,14 @@ public static Element createINSTANCE(Document pDoc, Element pParentE, CIMInstanc /** * createOBJECTPATH - * + * * @param pDoc * @param pParentE * @param pPath * @return Element * @throws WBEMException */ - public static Element createOBJECTPATH(Document pDoc, Element pParentE, CIMObjectPath pPath) - throws WBEMException { + public static Element createOBJECTPATH(Document pDoc, Element pParentE, CIMObjectPath pPath) throws WBEMException { Element objectpathE = pDoc.createElement("OBJECTPATH"); CIMProperty[] keys = pPath.getKeys(); @@ -1412,34 +1396,36 @@ public static Element createOBJECTPATH(Document pDoc, Element pParentE, CIMObjec /** * createOBJECTNAME - * + * * @param pDoc * @param pParentE * @param pPath * @return Element * @throws WBEMException */ - public static Element createOBJECTNAME(Document pDoc, Element pParentE, CIMObjectPath pPath) - throws WBEMException { - + public static Element createOBJECTNAME(Document pDoc, Element pParentE, CIMObjectPath pPath) throws WBEMException { CIMProperty[] keys = pPath.getKeys(); - if (keys.length > 0) { return createINSTANCENAME(pDoc, pParentE, pPath); } + if (keys.length > 0) { + return createINSTANCENAME(pDoc, pParentE, pPath); + } if (pPath.getObjectName() == null) throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name"); + WBEMException.CIM_ERR_INVALID_PARAMETER, + "null class name" + ); return createCLASSNAME(pDoc, pParentE, pPath.getObjectName()); } /** * createLOCALINSTANCEPATH - * + * * @param pDoc * @param pParentE * @param pPath * @return Element * @throws WBEMException */ - public static Element createLOCALINSTANCEPATH(Document pDoc, Element pParentE, - CIMObjectPath pPath) throws WBEMException { + public static Element createLOCALINSTANCEPATH(Document pDoc, Element pParentE, CIMObjectPath pPath) + throws WBEMException { Element localinstancepathE = pDoc.createElement("LOCALINSTANCEPATH"); createLOCALNAMESPACEPATH(pDoc, localinstancepathE, pPath); @@ -1451,7 +1437,7 @@ public static Element createLOCALINSTANCEPATH(Document pDoc, Element pParentE, /** * createLOCALCLASSPATH - * + * * @param pDoc * @param pParentE * @param pPath @@ -1459,13 +1445,15 @@ public static Element createLOCALINSTANCEPATH(Document pDoc, Element pParentE, * @throws WBEMException */ public static Element createLOCALCLASSPATH(Document pDoc, Element pParentE, CIMObjectPath pPath) - throws WBEMException { + throws WBEMException { Element localinstancepathE = pDoc.createElement("LOCALCLASSPATH"); createLOCALNAMESPACEPATH(pDoc, localinstancepathE, pPath); if (pPath.getObjectName() == null) throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name"); + WBEMException.CIM_ERR_INVALID_PARAMETER, + "null class name" + ); createCLASSNAME(pDoc, localinstancepathE, pPath.getObjectName()); pParentE.appendChild(localinstancepathE); @@ -1474,7 +1462,7 @@ public static Element createLOCALCLASSPATH(Document pDoc, Element pParentE, CIMO /** * createLOCALOBJECTPATH - * + * * @param pDoc * @param pParentE * @param pPath @@ -1482,16 +1470,17 @@ public static Element createLOCALCLASSPATH(Document pDoc, Element pParentE, CIMO * @throws WBEMException */ public static Element createLOCALOBJECTPATH(Document pDoc, Element pParentE, CIMObjectPath pPath) - throws WBEMException { - + throws WBEMException { CIMProperty[] keys = pPath.getKeys(); - if (keys.length > 0) { return createLOCALINSTANCEPATH(pDoc, pParentE, pPath); } + if (keys.length > 0) { + return createLOCALINSTANCEPATH(pDoc, pParentE, pPath); + } return createLOCALCLASSPATH(pDoc, pParentE, pPath); } /** * createVALUEREFERENCE - * + * * @param pDoc * @param pParentE * @param pPath @@ -1499,7 +1488,7 @@ public static Element createLOCALOBJECTPATH(Document pDoc, Element pParentE, CIM * @throws WBEMException */ public static Element createVALUEREFERENCE(Document pDoc, Element pParentE, CIMObjectPath pPath) - throws WBEMException { + throws WBEMException { Element objectpathE = pDoc.createElement("VALUE.REFERENCE"); String ns = pPath.getNamespace(); @@ -1524,7 +1513,7 @@ public static Element createVALUEREFERENCE(Document pDoc, Element pParentE, CIMO /** * createINSTANCENAME - * + * * @param doc * @param parentE * @param instanceOP @@ -1532,8 +1521,7 @@ public static Element createVALUEREFERENCE(Document pDoc, Element pParentE, CIMO * @throws WBEMException */ public static Element createINSTANCENAME(Document doc, Element parentE, CIMObjectPath instanceOP) - throws WBEMException { - + throws WBEMException { Element instancenameE = doc.createElement("INSTANCENAME"); String classname = instanceOP.getObjectName(); if (classname != null) { @@ -1554,28 +1542,40 @@ public static Element createINSTANCENAME(Document doc, Element parentE, CIMObjec * KEYVALUE? | VALUE.REFERENCE?)> Handling direct KEYVALUE and * VALUE.REFERENCE children is difficult, KEYBINDING can wrap them * -> dropping out KEYVALUE? | VALUE.REFERENCE?. - * + * * - * + * * - non * reference values can be null - * + * * - reference * value shouldn't be null */ - if (propType == null) { throw new WBEMException( + if (propType == null) { + throw new WBEMException( WBEMException.CIM_ERR_INVALID_PARAMETER, - "Type of property or key cannot be a null! " + propName + " in ObjectPath " - + instanceOP.toString() + " has null type."); } + "Type of property or key cannot be a null! " + + propName + + " in ObjectPath " + + instanceOP.toString() + + " has null type." + ); + } if (propValue == null) { - if (propType.getType() == CIMDataType.REFERENCE) { throw new WBEMException( + if (propType.getType() == CIMDataType.REFERENCE) { + throw new WBEMException( WBEMException.CIM_ERR_INVALID_PARAMETER, - "Value of reference cannot be null! " + propName + " in ObjectPath " - + instanceOP.toString() + " has null value."); } + "Value of reference cannot be null! " + + propName + + " in ObjectPath " + + instanceOP.toString() + + " has null value." + ); + } } Element keybindingE = createKEYBINDING(doc, instancenameE, propName); @@ -1596,7 +1596,7 @@ public static Element createINSTANCENAME(Document doc, Element parentE, CIMObjec /** * createCLASSPATH - * + * * @param pDoc * @param pParentE * @param pPath @@ -1615,14 +1615,14 @@ public static Element createCLASSPATH(Document pDoc, Element pParentE, CIMObject /** * createPARAMETERS - * + * * @param pDoc * @param pParentE * @param pParameters * @throws WBEMException */ - public static void createPARAMETERS(Document pDoc, Element pParentE, - CIMParameter[] pParameters) throws WBEMException { + public static void createPARAMETERS(Document pDoc, Element pParentE, CIMParameter[] pParameters) + throws WBEMException { if (pParameters == null) return; for (int i = 0; i < pParameters.length; i++) { createPARAMETER(pDoc, pParentE, pParameters[i]); @@ -1631,15 +1631,15 @@ public static void createPARAMETERS(Document pDoc, Element pParentE, /** * createPARAMETER - * + * * @param pDoc * @param pParentE * @param pParameter * @return Element * @throws WBEMException */ - public static Element createPARAMETER(Document pDoc, Element pParentE, - CIMParameter pParameter) throws WBEMException { + public static Element createPARAMETER(Document pDoc, Element pParentE, CIMParameter pParameter) + throws WBEMException { Element parameterE; CIMDataType type = pParameter.getDataType(); int typeCode = type.getType(); @@ -1650,7 +1650,9 @@ public static Element createPARAMETER(Document pDoc, Element pParentE, parameterE = pDoc.createElement("PARAMETER.REFARRAY"); String refclass = type.getRefClassName(); if (refclass != null && refclass.length() > 0) parameterE.setAttribute( - "REFERENCECLASS", type.getRefClassName()); + "REFERENCECLASS", + type.getRefClassName() + ); } else { parameterE = pDoc.createElement("PARAMETER.ARRAY"); parameterE.setAttribute("TYPE", typeStr); @@ -1660,7 +1662,9 @@ public static Element createPARAMETER(Document pDoc, Element pParentE, parameterE = pDoc.createElement("PARAMETER.REFERENCE"); String refclass = type.getRefClassName(); if (refclass != null && refclass.length() > 0) parameterE.setAttribute( - "REFERENCECLASS", type.getRefClassName()); + "REFERENCECLASS", + type.getRefClassName() + ); } else { parameterE = pDoc.createElement("PARAMETER"); parameterE.setAttribute("TYPE", typeStr); @@ -1676,15 +1680,15 @@ public static Element createPARAMETER(Document pDoc, Element pParentE, /** * createMETHODS - * + * * @param pDoc * @param pParentE * @param pMethods * @param pClassName * @throws WBEMException */ - public static void createMETHODS(Document pDoc, Element pParentE, CIMMethod[] pMethods, - String pClassName) throws WBEMException { + public static void createMETHODS(Document pDoc, Element pParentE, CIMMethod[] pMethods, String pClassName) + throws WBEMException { for (int i = 0; i < pMethods.length; i++) { createMETHOD(pDoc, pParentE, pMethods[i], pClassName); } @@ -1692,7 +1696,7 @@ public static void createMETHODS(Document pDoc, Element pParentE, CIMMethod[] /** * createMETHOD - * + * * @param pDoc * @param pParentE * @param pMethod @@ -1700,8 +1704,8 @@ public static void createMETHODS(Document pDoc, Element pParentE, CIMMethod[] * @return Element * @throws WBEMException */ - public static Element createMETHOD(Document pDoc, Element pParentE, CIMMethod pMethod, - String pClassName) throws WBEMException { + public static Element createMETHOD(Document pDoc, Element pParentE, CIMMethod pMethod, String pClassName) + throws WBEMException { Element methodE = pDoc.createElement("METHOD"); methodE.setAttribute("NAME", pMethod.getName()); @@ -1710,8 +1714,7 @@ public static Element createMETHOD(Document pDoc, Element pParentE, CIMMethod methodE.setAttribute("TYPE", typeStr); String classorigin = pMethod.getOriginClass(); - if (classorigin != null && classorigin.length() != 0) methodE.setAttribute("CLASSORIGIN", - classorigin); + if (classorigin != null && classorigin.length() != 0) methodE.setAttribute("CLASSORIGIN", classorigin); // 17459 if (pMethod.isPropagated()) { @@ -1739,16 +1742,14 @@ public static Element createMETHOD(Document pDoc, Element pParentE, CIMMethod /** * createCLASS - * + * * @param pDoc * @param pParentE * @param pClass * @return Element * @throws WBEMException */ - public static Element createCLASS(Document pDoc, Element pParentE, CIMClass pClass) - throws WBEMException { - + public static Element createCLASS(Document pDoc, Element pParentE, CIMClass pClass) throws WBEMException { Element classE = createCLASS(pDoc, pParentE, pClass.getName(), pClass.getSuperClassName()); createQUALIFIERS(pDoc, classE, pClass.getQualifiers()); @@ -1761,7 +1762,7 @@ public static Element createCLASS(Document pDoc, Element pParentE, CIMClass pCla /** * createHOST - * + * * @param pDoc * @param pParentE * @param pHost @@ -1779,7 +1780,7 @@ public static Element createHOST(Document pDoc, Element pParentE, String pHost) /** * createNAMESPACEPATH - * + * * @param pDoc * @param pParentE * @param pPath @@ -1807,15 +1808,14 @@ public static Element createNAMESPACEPATH(Document pDoc, Element pParentE, CIMOb /** * createINSTANCEPATH - * + * * @param pDoc * @param pParentE * @param pPath * @return Element * @throws WBEMException */ - public static Element createINSTANCEPATH(Document pDoc, Element pParentE, CIMObjectPath pPath) - throws WBEMException { + public static Element createINSTANCEPATH(Document pDoc, Element pParentE, CIMObjectPath pPath) throws WBEMException { Element instancepathE = pDoc.createElement("INSTANCEPATH"); createNAMESPACEPATH(pDoc, instancepathE, pPath); @@ -1826,7 +1826,7 @@ public static Element createINSTANCEPATH(Document pDoc, Element pParentE, CIMObj /** * createVALUENAMEDINSTANCE - * + * * @param pDoc * @param pParentE * @param pPath @@ -1834,8 +1834,13 @@ public static Element createINSTANCEPATH(Document pDoc, Element pParentE, CIMObj * @return Element * @throws WBEMException */ - public static Element createVALUENAMEDINSTANCE(Document pDoc, Element pParentE, - CIMObjectPath pPath, CIMInstance pInst) throws WBEMException { + public static Element createVALUENAMEDINSTANCE( + Document pDoc, + Element pParentE, + CIMObjectPath pPath, + CIMInstance pInst + ) + throws WBEMException { Element valuenamedinstanceE = pDoc.createElement("VALUE.NAMEDINSTANCE"); createINSTANCENAME(pDoc, valuenamedinstanceE, pPath); createINSTANCE(pDoc, valuenamedinstanceE, pInst); @@ -1846,15 +1851,15 @@ public static Element createVALUENAMEDINSTANCE(Document pDoc, Element pParentE, /** * createVALUENAMEDINSTANCE - * + * * @param pDoc * @param pParentE * @param pInst * @return Element * @throws WBEMException */ - public static Element createVALUENAMEDINSTANCE(Document pDoc, Element pParentE, - CIMInstance pInst) throws WBEMException { + public static Element createVALUENAMEDINSTANCE(Document pDoc, Element pParentE, CIMInstance pInst) + throws WBEMException { Element valuenamedinstanceE = pDoc.createElement("VALUE.NAMEDINSTANCE"); createINSTANCENAME(pDoc, valuenamedinstanceE, pInst.getObjectPath()); createINSTANCE(pDoc, valuenamedinstanceE, pInst); @@ -1863,17 +1868,29 @@ public static Element createVALUENAMEDINSTANCE(Document pDoc, Element pParentE, return valuenamedinstanceE; } - private static CIMObjectPath changeNameSpace(CIMNamedElementInterface pNamedElement, - String pNameSpace) { + private static CIMObjectPath changeNameSpace(CIMNamedElementInterface pNamedElement, String pNameSpace) { CIMObjectPath path = pNamedElement.getObjectPath(); - return new CIMObjectPath(path.getScheme(), path.getHost(), path.getPort(), pNameSpace, path - .getObjectName(), path.getKeys()); + return new CIMObjectPath( + path.getScheme(), + path.getHost(), + path.getPort(), + pNameSpace, + path.getObjectName(), + path.getKeys() + ); } private static CIMClass changeClassNameSpace(CIMClass pClass, String pNameSpace) { CIMObjectPath newOp = changeNameSpace(pClass, pNameSpace); - return new CIMClass(newOp, pClass.getSuperClassName(), pClass.getQualifiers(), pClass - .getProperties(), pClass.getMethods(), pClass.isAssociation(), pClass.isKeyed()); + return new CIMClass( + newOp, + pClass.getSuperClassName(), + pClass.getQualifiers(), + pClass.getProperties(), + pClass.getMethods(), + pClass.isAssociation(), + pClass.isKeyed() + ); } private static CIMInstance changeInstanceNameSpace(CIMInstance pInst, String pNameSpace) { @@ -1883,7 +1900,7 @@ private static CIMInstance changeInstanceNameSpace(CIMInstance pInst, String pNa /** * createVALUEOBJECTWITHPATH - * + * * @param pDoc * @param pParentE * @param pObj @@ -1891,14 +1908,13 @@ private static CIMInstance changeInstanceNameSpace(CIMInstance pInst, String pNa * @return Element * @throws WBEMException */ - public static Element createVALUEOBJECTWITHPATH(Document pDoc, Element pParentE, Object pObj, - String pNameSpace) throws WBEMException { + public static Element createVALUEOBJECTWITHPATH(Document pDoc, Element pParentE, Object pObj, String pNameSpace) + throws WBEMException { Element valueobjectwithpathE = pDoc.createElement("VALUE.OBJECTWITHPATH"); if (pObj instanceof CIMClass) { CIMClass clazz = (CIMClass) pObj; - if (clazz.getObjectPath().getNamespace() == null - || clazz.getObjectPath().getNamespace().length() == 0) { + if (clazz.getObjectPath().getNamespace() == null || clazz.getObjectPath().getNamespace().length() == 0) { // ebak: changing the namespace in clazz's objectPath // clazz.getObjectPath().setNameSpace(pNameSpace); clazz = changeClassNameSpace(clazz, pNameSpace); @@ -1908,8 +1924,7 @@ public static Element createVALUEOBJECTWITHPATH(Document pDoc, Element pParentE, createCLASS(pDoc, valueobjectwithpathE, clazz); } else if (pObj instanceof CIMInstance) { CIMInstance inst = (CIMInstance) pObj; - if (inst.getObjectPath().getNamespace() == null - || inst.getObjectPath().getNamespace().length() == 0) { + if (inst.getObjectPath().getNamespace() == null || inst.getObjectPath().getNamespace().length() == 0) { // ebak: changing the namespace ins inst's objectPath // inst.getObjectPath().setNameSpace(pNameSpace); inst = changeInstanceNameSpace(inst, pNameSpace); @@ -1924,7 +1939,7 @@ public static Element createVALUEOBJECTWITHPATH(Document pDoc, Element pParentE, /** * createVALUEOBJECTWITHLOCALPATH - * + * * @param pDoc * @param pParentE * @param pObj @@ -1932,14 +1947,13 @@ public static Element createVALUEOBJECTWITHPATH(Document pDoc, Element pParentE, * @return Element * @throws WBEMException */ - public static Element createVALUEOBJECTWITHLOCALPATH(Document pDoc, Element pParentE, - Object pObj, String pNameSpace) throws WBEMException { + public static Element createVALUEOBJECTWITHLOCALPATH(Document pDoc, Element pParentE, Object pObj, String pNameSpace) + throws WBEMException { Element valueobjectwithpathE = pDoc.createElement("VALUE.OBJECTWITHLOCALPATH"); if (pObj instanceof CIMClass) { CIMClass clazz = (CIMClass) pObj; - if (clazz.getObjectPath().getNamespace() == null - || clazz.getObjectPath().getNamespace().length() == 0) { + if (clazz.getObjectPath().getNamespace() == null || clazz.getObjectPath().getNamespace().length() == 0) { // ebak: changing clazz's objectPath // clazz.getObjectPath().setNameSpace(pNameSpace); clazz = changeClassNameSpace(clazz, pNameSpace); @@ -1948,8 +1962,7 @@ public static Element createVALUEOBJECTWITHLOCALPATH(Document pDoc, Element pPar createCLASS(pDoc, valueobjectwithpathE, clazz); } else if (pObj instanceof CIMInstance) { CIMInstance inst = (CIMInstance) pObj; - if (inst.getObjectPath().getNamespace() == null - || inst.getObjectPath().getNamespace().length() == 0) { + if (inst.getObjectPath().getNamespace() == null || inst.getObjectPath().getNamespace().length() == 0) { // inst.getObjectPath().setNameSpace(pNameSpace); inst = changeInstanceNameSpace(inst, pNameSpace); } @@ -1963,7 +1976,7 @@ public static Element createVALUEOBJECTWITHLOCALPATH(Document pDoc, Element pPar /** * createIRETURNVALUE_ERROR - * + * * @param doc * @param parentE * @param error @@ -1978,15 +1991,15 @@ public static Element createIRETURNVALUE_ERROR(Document doc, Element parentE, CI /** * createIRETURNVALUE_GETINSTANCE - * + * * @param pDoc * @param pParentE * @param pInst * @return Element * @throws WBEMException */ - public static Element createIRETURNVALUE_GETINSTANCE(Document pDoc, Element pParentE, - CIMInstance pInst) throws WBEMException { + public static Element createIRETURNVALUE_GETINSTANCE(Document pDoc, Element pParentE, CIMInstance pInst) + throws WBEMException { Element ireturnvalueE = pDoc.createElement("IRETURNVALUE"); createINSTANCENAME(pDoc, ireturnvalueE, pInst.getObjectPath()); @@ -1995,15 +2008,19 @@ public static Element createIRETURNVALUE_GETINSTANCE(Document pDoc, Element pPar /** * createIRETURNVALUE_ASSOCIATORS_NAMES - * + * * @param pDoc * @param pParentE * @param pResultSet * @return Element * @throws Exception */ - public static Element createIRETURNVALUE_ASSOCIATORS_NAMES(Document pDoc, Element pParentE, - CIMObjectPath[] pResultSet) throws Exception { + public static Element createIRETURNVALUE_ASSOCIATORS_NAMES( + Document pDoc, + Element pParentE, + CIMObjectPath[] pResultSet + ) + throws Exception { Element ireturnvalueE = pDoc.createElement("IRETURNVALUE"); if (pResultSet != null) { @@ -2011,8 +2028,10 @@ public static Element createIRETURNVALUE_ASSOCIATORS_NAMES(Document pDoc, Elemen CIMObjectPath path = pResultSet[i]; if (path.getHost() == null || "".equals(path.getHost())) createLOCALOBJECTPATH( - pDoc, ireturnvalueE, path); - else createOBJECTPATH(pDoc, ireturnvalueE, path); + pDoc, + ireturnvalueE, + path + ); else createOBJECTPATH(pDoc, ireturnvalueE, path); } } pParentE.appendChild(ireturnvalueE); @@ -2021,7 +2040,7 @@ public static Element createIRETURNVALUE_ASSOCIATORS_NAMES(Document pDoc, Elemen /** * createIRETURNVALUE_ASSOCIATORS - * + * * @param pDoc * @param pParentE * @param pResultSet @@ -2029,8 +2048,13 @@ public static Element createIRETURNVALUE_ASSOCIATORS_NAMES(Document pDoc, Elemen * @return Element * @throws Exception */ - public static Element createIRETURNVALUE_ASSOCIATORS(Document pDoc, Element pParentE, - Object[] pResultSet, String pNameSpace) throws Exception { + public static Element createIRETURNVALUE_ASSOCIATORS( + Document pDoc, + Element pParentE, + Object[] pResultSet, + String pNameSpace + ) + throws Exception { Element ireturnvalueE = pDoc.createElement("IRETURNVALUE"); if (pResultSet != null) { for (int i = 0; i < pResultSet.length; i++) { @@ -2041,8 +2065,7 @@ public static Element createIRETURNVALUE_ASSOCIATORS(Document pDoc, Element pPar } else if (obj instanceof CIMInstance) { op = ((CIMInstance) obj).getObjectPath(); } else { - throw new WBEMException(WBEMException.CIM_ERR_FAILED, - "object in result set neither class nor instance!"); + throw new WBEMException(WBEMException.CIM_ERR_FAILED, "object in result set neither class nor instance!"); } if (op.getHost() == null || "".equals(op.getHost())) { createVALUEOBJECTWITHLOCALPATH(pDoc, ireturnvalueE, obj, pNameSpace); @@ -2057,7 +2080,7 @@ public static Element createIRETURNVALUE_ASSOCIATORS(Document pDoc, Element pPar /** * createIRETURNVALUE_ENUMERATE_INSTANCENAME - * + * * @param pDoc * @param pParentE * @param pResultSet @@ -2065,8 +2088,13 @@ public static Element createIRETURNVALUE_ASSOCIATORS(Document pDoc, Element pPar * @return Element * @throws Exception */ - public static Element createIRETURNVALUE_ENUMERATE_INSTANCENAME(Document pDoc, - Element pParentE, Object[] pResultSet, String pNameSpace) throws Exception { + public static Element createIRETURNVALUE_ENUMERATE_INSTANCENAME( + Document pDoc, + Element pParentE, + Object[] pResultSet, + String pNameSpace + ) + throws Exception { Element ireturnvalueE = pDoc.createElement("IRETURNVALUE"); if (pResultSet != null) { for (int i = 0; i < pResultSet.length; i++) { @@ -2077,8 +2105,7 @@ public static Element createIRETURNVALUE_ENUMERATE_INSTANCENAME(Document pDoc, } else if (obj instanceof CIMInstance) { op = ((CIMInstance) obj).getObjectPath(); } else { - throw new WBEMException(WBEMException.CIM_ERR_FAILED, - "object in result set neither class nor instance!"); + throw new WBEMException(WBEMException.CIM_ERR_FAILED, "object in result set neither class nor instance!"); } if (op.getHost() == null || "".equals(op.getHost())) { createVALUEOBJECTWITHLOCALPATH(pDoc, ireturnvalueE, obj, pNameSpace); @@ -2093,15 +2120,14 @@ public static Element createIRETURNVALUE_ENUMERATE_INSTANCENAME(Document pDoc, /** * createIRETURNVALUE - * + * * @param pDoc * @param pParentE * @param pResultSet * @return Element * @throws WBEMException */ - public static Element createIRETURNVALUE(Document pDoc, Element pParentE, Object[] pResultSet) - throws WBEMException { + public static Element createIRETURNVALUE(Document pDoc, Element pParentE, Object[] pResultSet) throws WBEMException { Element ireturnvalueE = pDoc.createElement("IRETURNVALUE"); if (pResultSet != null && pResultSet.length > 0) { Object obj = pResultSet[0]; @@ -2125,14 +2151,13 @@ public static Element createIRETURNVALUE(Document pDoc, Element pParentE, Object /** * createIRETURNVALUE_ENUMERATE_CLASSNAME - * + * * @param pDoc * @param pParentE * @param pResultSet * @return Element */ - public static Element createIRETURNVALUE_ENUMERATE_CLASSNAME(Document pDoc, Element pParentE, - CIMClass[] pResultSet) { + public static Element createIRETURNVALUE_ENUMERATE_CLASSNAME(Document pDoc, Element pParentE, CIMClass[] pResultSet) { Element ireturnvalueE = pDoc.createElement("IRETURNVALUE"); if (pResultSet != null && pResultSet.length > 0) { for (int i = 0; i < pResultSet.length; i++) { @@ -2149,7 +2174,7 @@ public static Element createIRETURNVALUE_ENUMERATE_CLASSNAME(Document pDoc, Elem /** * createIndication_response - * + * * @param doc * @param ID * @param error @@ -2158,7 +2183,6 @@ public static Element createIRETURNVALUE_ENUMERATE_CLASSNAME(Document pDoc, Elem // ebak: [ 1656285 ] IndicationHandler does not accept non-Integer message // ID public static Element createIndication_response(Document doc, String ID, CIMError error) { - // xmlBuilder.create XML Element cimE = createCIM(doc); Element messageE = createMESSAGE(doc, cimE, ID, "1.0"); @@ -2175,15 +2199,19 @@ public static Element createIndication_response(Document doc, String ID, CIMErro /** * createIRETURNVALUE_ENUMERATE_INSTANCE - * + * * @param pDoc * @param pParentE * @param pResultSet * @return Element * @throws WBEMException */ - public static Element createIRETURNVALUE_ENUMERATE_INSTANCE(Document pDoc, Element pParentE, - CIMInstance[] pResultSet) throws WBEMException { + public static Element createIRETURNVALUE_ENUMERATE_INSTANCE( + Document pDoc, + Element pParentE, + CIMInstance[] pResultSet + ) + throws WBEMException { Element ireturnvalueE = pDoc.createElement("IRETURNVALUE"); if (pResultSet != null && pResultSet.length > 0) { for (int i = 0; i < pResultSet.length; i++) { @@ -2196,7 +2224,7 @@ public static Element createIRETURNVALUE_ENUMERATE_INSTANCE(Document pDoc, Eleme /** * getTypeStr - * + * * @param pType * @return String */ @@ -2208,7 +2236,7 @@ public static String getTypeStr(CIMDataType pType) { /** * getOpTypeStr - * + * * @param pType * @return String */ @@ -2220,14 +2248,13 @@ public static String getOpTypeStr(CIMDataType pType) { /** * createLOCALNAMESPACEPATH - * + * * @param pDoc * @param pParentE * @param pName * @return Element */ - public static Element createLOCALNAMESPACEPATH(Document pDoc, Element pParentE, - CIMObjectPath pName) { + public static Element createLOCALNAMESPACEPATH(Document pDoc, Element pParentE, CIMObjectPath pName) { if (pName == null) return null; // TODO: name(ObjectPath) should not be null, should an exception be // thrown? @@ -2237,9 +2264,11 @@ public static Element createLOCALNAMESPACEPATH(Document pDoc, Element pParentE, String nameSpace = pName.getNamespace(); if (nameSpace != null) { String[] nsA = NAMESPACE_SPLIT_PATTERN.split(nameSpace); - for (int i = 0; i < nsA.length; i++) - if (nsA[i] != null && nsA[i].length() > 0) createNAMESPACE(pDoc, - localnamespacepathE, nsA[i]); + for (int i = 0; i < nsA.length; i++) if (nsA[i] != null && nsA[i].length() > 0) createNAMESPACE( + pDoc, + localnamespacepathE, + nsA[i] + ); } pParentE.appendChild(localnamespacepathE); @@ -2248,7 +2277,7 @@ public static Element createLOCALNAMESPACEPATH(Document pDoc, Element pParentE, /** * createSIMPLEEXPREQ - * + * * @param pDoc * @return Element */ @@ -2260,7 +2289,7 @@ public static Element createSIMPLEEXPREQ(Document pDoc) { /** * createEXPMETHODCALL - * + * * @param pDoc * @param pParentE * @param pName @@ -2279,7 +2308,7 @@ public static Element createEXPMETHODCALL(Document pDoc, Element pParentE, Strin /** * createEXPPARAMVALUE - * + * * @param pDoc * @param pParentE * @param pName diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/CIMXMLParseException.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/CIMXMLParseException.java index 72424de..fdd4238 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/CIMXMLParseException.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/CIMXMLParseException.java @@ -48,10 +48,9 @@ /** * Class CIMXMLParseException is used by the CIM-XML DOM parser. - * + * */ public class CIMXMLParseException extends IOException { - private static final long serialVersionUID = 1237082621297618586L; /** @@ -63,7 +62,7 @@ public CIMXMLParseException() { /** * Ctor. - * + * * @param reason */ public CIMXMLParseException(String reason) { diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/CIMXMLParserImpl.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/CIMXMLParserImpl.java index e97b6bf..aa3cd0e 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/CIMXMLParserImpl.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/CIMXMLParserImpl.java @@ -125,19 +125,27 @@ import java.util.TreeMap; import java.util.Vector; import java.util.logging.Level; - import org.metricshub.wbem.javax.cim.CIMArgument; import org.metricshub.wbem.javax.cim.CIMClass; import org.metricshub.wbem.javax.cim.CIMClassProperty; import org.metricshub.wbem.javax.cim.CIMDataType; +import org.metricshub.wbem.javax.cim.CIMDateTime; import org.metricshub.wbem.javax.cim.CIMDateTimeAbsolute; import org.metricshub.wbem.javax.cim.CIMDateTimeInterval; +import org.metricshub.wbem.javax.cim.CIMFlavor; import org.metricshub.wbem.javax.cim.CIMInstance; import org.metricshub.wbem.javax.cim.CIMMethod; +import org.metricshub.wbem.javax.cim.CIMNamedElementInterface; import org.metricshub.wbem.javax.cim.CIMObjectPath; import org.metricshub.wbem.javax.cim.CIMParameter; +import org.metricshub.wbem.javax.cim.CIMProperty; import org.metricshub.wbem.javax.cim.CIMQualifier; import org.metricshub.wbem.javax.cim.CIMQualifierType; +import org.metricshub.wbem.javax.cim.CIMScope; +import org.metricshub.wbem.javax.cim.UnsignedInteger16; +import org.metricshub.wbem.javax.cim.UnsignedInteger32; +import org.metricshub.wbem.javax.cim.UnsignedInteger64; +import org.metricshub.wbem.javax.cim.UnsignedInteger8; import org.metricshub.wbem.javax.wbem.WBEMException; import org.metricshub.wbem.sblim.cimclient.internal.cim.CIMHelper; import org.metricshub.wbem.sblim.cimclient.internal.cim.CIMQualifiedElementInterfaceImpl; @@ -146,15 +154,6 @@ import org.metricshub.wbem.sblim.cimclient.internal.util.Util; import org.metricshub.wbem.sblim.cimclient.internal.util.WBEMConfiguration; import org.metricshub.wbem.sblim.cimclient.internal.util.XMLHostStr; -import org.metricshub.wbem.javax.cim.CIMDateTime; -import org.metricshub.wbem.javax.cim.CIMFlavor; -import org.metricshub.wbem.javax.cim.CIMNamedElementInterface; -import org.metricshub.wbem.javax.cim.CIMProperty; -import org.metricshub.wbem.javax.cim.CIMScope; -import org.metricshub.wbem.javax.cim.UnsignedInteger16; -import org.metricshub.wbem.javax.cim.UnsignedInteger32; -import org.metricshub.wbem.javax.cim.UnsignedInteger64; -import org.metricshub.wbem.javax.cim.UnsignedInteger8; import org.w3c.dom.Attr; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -166,10 +165,9 @@ /** * Class CIMXMLParserImpl is the main class of CIM-XML DOM parser. - * + * */ public class CIMXMLParserImpl { - /* * ebak: local object path - should be used by parseLOCALCLASSPATH(), * parseLOCALINSTANCEPATH(), parseCLASSNAME(), parseINSTANCENAME(), @@ -179,7 +177,7 @@ public class CIMXMLParserImpl { /** * setLocalObjectPath - * + * * @param pLocalOp * - empty fields of parsed objectpaths will be substituted by * fields coming from this parameter @@ -194,7 +192,7 @@ public static void setLocalObjectPath(CIMObjectPath pLocalOp) { /** * parseCIM - * + * * @param pCimE * @return CIMMessage * @throws CIMXMLParseException @@ -203,13 +201,11 @@ public static CIMMessage parseCIM(Element pCimE) throws CIMXMLParseException { // // Attr cim_cimversionA = (Attr) searchAttribute(pCimE, "CIMVERSION"); - if (cim_cimversionA == null) throw new CIMXMLParseException( - "CIM element missing CIMVERSION attribute!"); + if (cim_cimversionA == null) throw new CIMXMLParseException("CIM element missing CIMVERSION attribute!"); String cimversion = cim_cimversionA.getNodeValue(); Attr cim_dtdversionA = (Attr) searchAttribute(pCimE, "DTDVERSION"); - if (cim_dtdversionA == null) throw new CIMXMLParseException( - "CIM element missing DTDVERSION attribute!"); + if (cim_dtdversionA == null) throw new CIMXMLParseException("CIM element missing DTDVERSION attribute!"); String dtdversion = cim_dtdversionA.getNodeValue(); // MESSAGE @@ -223,7 +219,8 @@ public static CIMMessage parseCIM(Element pCimE) throws CIMXMLParseException { // DECLARATION if (searchNodes(pCimE, "DECLARATION", 0, 1, false) != null) throw new CIMXMLParseException( - "DECLARATION element not supported!"); + "DECLARATION element not supported!" + ); throw new CIMXMLParseException("CIM element missing required child element!"); } @@ -234,7 +231,7 @@ public static CIMMessage parseCIM(Element pCimE) throws CIMXMLParseException { /** * parseVALUE - supports the non-standard TYPE attribute - * + * * @param pValueE * @return TypedValue, type is null if no TYPE attribute was found, the * value is always String, the caller method have to convert it. @@ -260,7 +257,7 @@ public static TypedValue parseVALUE(Element pValueE) throws CIMXMLParseException /** * parseVALUEARRAY - supports the non-standard TYPE attribute - * + * * @param pValueArrayE * @return TypedValue, type is null if no TYPE attribute was found, the * value is always String[], the caller method have to convert it. @@ -283,21 +280,21 @@ public static TypedValue parseVALUEARRAY(Element pValueArrayE) throws CIMXMLPars resStringV.add((String) parseVALUE((Element) n).getValue()); } else if (name.equals("VALUE.NULL")) { resStringV.add(null); - } else if (NODENAME_HASH.containsKey(name)) { throw new CIMXMLParseException( - "VALUE.ARRAY element contains invalid child element " + name + "!"); } + } else if (NODENAME_HASH.containsKey(name)) { + throw new CIMXMLParseException("VALUE.ARRAY element contains invalid child element " + name + "!"); + } } return new TypedValue(type, resStringV.toArray(new String[0])); } /** * parseVALUEREFERENCE - * + * * @param pValuereferenceE * @return CIMObjectPath * @throws CIMXMLParseException */ - public static CIMObjectPath parseVALUEREFERENCE(Element pValuereferenceE) - throws CIMXMLParseException { + public static CIMObjectPath parseVALUEREFERENCE(Element pValuereferenceE) throws CIMXMLParseException { // @@ -322,8 +319,16 @@ public static CIMObjectPath parseVALUEREFERENCE(Element pValuereferenceE) if (op != null && op.getNamespace() != null) { // LocalPathBuilder includes default namespace in CLASSNAME // elements, needs to be stripped - op = new CIMObjectPath(op.getScheme(), op.getHost(), op.getPort(), null, op - .getObjectName(), op.getKeys(), op.getXmlSchemaName()); + op = + new CIMObjectPath( + op.getScheme(), + op.getHost(), + op.getPort(), + null, + op.getObjectName(), + op.getKeys(), + op.getXmlSchemaName() + ); } return op; } @@ -336,8 +341,7 @@ public static CIMObjectPath parseVALUEREFERENCE(Element pValuereferenceE) } // LOCALINSTANCEPATH - Element localinstancepathA[] = searchNodes(pValuereferenceE, "LOCALINSTANCEPATH", 0, 1, - false); + Element localinstancepathA[] = searchNodes(pValuereferenceE, "LOCALINSTANCEPATH", 0, 1, false); if (localinstancepathA != null) { CIMObjectPath op = parseLOCALINSTANCEPATH(localinstancepathA[0]); return op; @@ -350,8 +354,16 @@ public static CIMObjectPath parseVALUEREFERENCE(Element pValuereferenceE) if (op != null && op.getNamespace() != null) { // LocalPathBuilder includes default namespace in INSTANCENAME // elements, needs to be stripped - op = new CIMObjectPath(op.getScheme(), op.getHost(), op.getPort(), null, op - .getObjectName(), op.getKeys(), op.getXmlSchemaName()); + op = + new CIMObjectPath( + op.getScheme(), + op.getHost(), + op.getPort(), + null, + op.getObjectName(), + op.getKeys(), + op.getXmlSchemaName() + ); } return op; } @@ -361,13 +373,12 @@ public static CIMObjectPath parseVALUEREFERENCE(Element pValuereferenceE) /** * parseVALUEREFARRAY - * + * * @param pValueRefArrayE * @return CIMObjectPath[] * @throws CIMXMLParseException */ - public static CIMObjectPath[] parseVALUEREFARRAY(Element pValueRefArrayE) - throws CIMXMLParseException { + public static CIMObjectPath[] parseVALUEREFARRAY(Element pValueRefArrayE) throws CIMXMLParseException { // // Process node list here, order of VALUE.REFERENCE/VALUE.NULL IS @@ -383,21 +394,21 @@ public static CIMObjectPath[] parseVALUEREFARRAY(Element pValueRefArrayE) resObjectPathV.add(parseVALUEREFERENCE((Element) n)); } else if (name.equals("VALUE.NULL")) { resObjectPathV.add(null); - } else if (NODENAME_HASH.containsKey(name)) { throw new CIMXMLParseException( - "VALUE.REFARRAY element contains invalid child element " + name + "!"); } + } else if (NODENAME_HASH.containsKey(name)) { + throw new CIMXMLParseException("VALUE.REFARRAY element contains invalid child element " + name + "!"); + } } return resObjectPathV.toArray(new CIMObjectPath[0]); } /** * parseVALUEOBJECT - * + * * @param pValueObjectE * @return CIMNamedElementInterface (CIMClass|CIMInstance) * @throws CIMXMLParseException */ - public static CIMNamedElementInterface parseVALUEOBJECT(Element pValueObjectE) - throws CIMXMLParseException { + public static CIMNamedElementInterface parseVALUEOBJECT(Element pValueObjectE) throws CIMXMLParseException { // // CLASS @@ -421,25 +432,26 @@ public static CIMNamedElementInterface parseVALUEOBJECT(Element pValueObjectE) /** * parseVALUENAMEDINSTANCE - * + * * @param pValueNamedInstanceE * @return CIMInstance * @throws CIMXMLParseException */ - public static CIMInstance parseVALUENAMEDINSTANCE(Element pValueNamedInstanceE) - throws CIMXMLParseException { + public static CIMInstance parseVALUENAMEDINSTANCE(Element pValueNamedInstanceE) throws CIMXMLParseException { // // INSTANCENAME Element instancenameA[] = searchNodes(pValueNamedInstanceE, "INSTANCENAME", 1, 1, true); - if (instancenameA == null) { throw new CIMXMLParseException( - "VALUE.NAMEDINSTANCE element missing INSTANCENAME child element!"); } + if (instancenameA == null) { + throw new CIMXMLParseException("VALUE.NAMEDINSTANCE element missing INSTANCENAME child element!"); + } CIMObjectPath op = parseINSTANCENAME(instancenameA[0]); // INSTANCE Element instanceA[] = searchNodes(pValueNamedInstanceE, "INSTANCE", 1, 1, true); - if (instanceA == null) { throw new CIMXMLParseException( - "VALUE.NAMEDINSTANCE element missing INSTANCE child element!"); } + if (instanceA == null) { + throw new CIMXMLParseException("VALUE.NAMEDINSTANCE element missing INSTANCE child element!"); + } CIMInstance inst = parseINSTANCE(instanceA[0], op); // BB mod checkOtherNodes(pValueNamedInstanceE, nodesVALUENAMEDINSTANCE); return inst; @@ -449,25 +461,26 @@ public static CIMInstance parseVALUENAMEDINSTANCE(Element pValueNamedInstanceE) /** * parseVALUEINSTANCEWITHPATH - * + * * @param pValueNamedInstanceE * @return CIMInstance * @throws CIMXMLParseException */ - public static CIMInstance parseVALUEINSTANCEWITHPATH(Element pValueNamedInstanceE) - throws CIMXMLParseException { + public static CIMInstance parseVALUEINSTANCEWITHPATH(Element pValueNamedInstanceE) throws CIMXMLParseException { // // INSTANCEPATH Element instancepathA[] = searchNodes(pValueNamedInstanceE, "INSTANCEPATH", 1, 1, true); - if (instancepathA == null) { throw new CIMXMLParseException( - "VALUE.INSTANCEWITHPATH element missing INSTANCEPATH child element!"); } + if (instancepathA == null) { + throw new CIMXMLParseException("VALUE.INSTANCEWITHPATH element missing INSTANCEPATH child element!"); + } CIMObjectPath op = parseINSTANCEPATH(instancepathA[0]); // INSTANCE Element instanceA[] = searchNodes(pValueNamedInstanceE, "INSTANCE", 1, 1, true); - if (instanceA == null) { throw new CIMXMLParseException( - "VALUE.INSTANCEWITHPATH element missing INSTANCE child element!"); } + if (instanceA == null) { + throw new CIMXMLParseException("VALUE.INSTANCEWITHPATH element missing INSTANCE child element!"); + } CIMInstance inst = parseINSTANCE(instanceA[0], op); // BB mod checkOtherNodes(pValueNamedInstanceE, nodesVALUEINSTANCEWITHPATH); return inst; @@ -477,13 +490,12 @@ public static CIMInstance parseVALUEINSTANCEWITHPATH(Element pValueNamedInstance /** * parseVALUENAMEDOBJECT - * + * * @param pValueNamedObjectE * @return CIMNamedElementInterface * @throws CIMXMLParseException */ - public static CIMNamedElementInterface parseVALUENAMEDOBJECT(Element pValueNamedObjectE) - throws CIMXMLParseException { + public static CIMNamedElementInterface parseVALUENAMEDOBJECT(Element pValueNamedObjectE) throws CIMXMLParseException { // // CLASS @@ -501,8 +513,9 @@ public static CIMNamedElementInterface parseVALUENAMEDOBJECT(Element pValueNamed // INSTANCE Element instanceA[] = searchNodes(pValueNamedObjectE, "INSTANCE", 0, 1, true); - if (instanceA == null) { throw new CIMXMLParseException( - "VALUE.NAMEDOBJECT element missing INSTANCE child element!"); } + if (instanceA == null) { + throw new CIMXMLParseException("VALUE.NAMEDOBJECT element missing INSTANCE child element!"); + } CIMInstance inst = parseINSTANCE(instanceA[0], op); // BB mod checkOtherNodes(pValueNamedObjectE, nodesVALUENAMEDOBJECTi); return inst; @@ -517,13 +530,13 @@ public static CIMNamedElementInterface parseVALUENAMEDOBJECT(Element pValueNamed /** * parseVALUEOBJECTWITHPATH - * + * * @param pValueObjectWithPathE * @return CIMNamedElementInterface * @throws CIMXMLParseException */ public static CIMNamedElementInterface parseVALUEOBJECTWITHPATH(Element pValueObjectWithPathE) - throws CIMXMLParseException { + throws CIMXMLParseException { // @@ -534,8 +547,9 @@ public static CIMNamedElementInterface parseVALUEOBJECTWITHPATH(Element pValueOb // CLASS Element classA[] = searchNodes(pValueObjectWithPathE, "CLASS", 0, 1, true); - if (classA == null) { throw new CIMXMLParseException( - "VALUE.OBJECTWITHPATH element missing CLASS child element!"); } + if (classA == null) { + throw new CIMXMLParseException("VALUE.OBJECTWITHPATH element missing CLASS child element!"); + } CIMClass obj = parseCLASS(classA[0], op); checkOtherNodes(pValueObjectWithPathE, nodesVALUEOBJECTWITHPATHcls); @@ -549,44 +563,43 @@ public static CIMNamedElementInterface parseVALUEOBJECTWITHPATH(Element pValueOb // INSTANCE Element instanceA[] = searchNodes(pValueObjectWithPathE, "INSTANCE", 0, 1, true); - if (instanceA == null) { throw new CIMXMLParseException( - "VALUE.OBJECTWITHPATH element missing INSTANCE child element!"); } + if (instanceA == null) { + throw new CIMXMLParseException("VALUE.OBJECTWITHPATH element missing INSTANCE child element!"); + } CIMInstance inst = parseINSTANCE(instanceA[0], op); // BB mod checkOtherNodes(pValueObjectWithPathE, nodesVALUEOBJECTWITHPATHins); return inst; } - throw new CIMXMLParseException( - "VALUE.OBJECTWITHPATH element missing required child element!"); + throw new CIMXMLParseException("VALUE.OBJECTWITHPATH element missing required child element!"); } private static final String nodesVALUEOBJECTWITHLOCALPATHcls[] = { "LOCALCLASSPATH", "CLASS" }; - private static final String nodesVALUEOBJECTWITHLOCALPATHins[] = { "LOCALINSTANCEPATH", - "INSTANCE" }; + private static final String nodesVALUEOBJECTWITHLOCALPATHins[] = { "LOCALINSTANCEPATH", "INSTANCE" }; /** * parseVALUEOBJECTWITHLOCALPATH - * + * * @param pValueObjectWithLocalPathE * @return CIMNamedElementInterface * @throws CIMXMLParseException */ - public static CIMNamedElementInterface parseVALUEOBJECTWITHLOCALPATH( - Element pValueObjectWithLocalPathE) throws CIMXMLParseException { + public static CIMNamedElementInterface parseVALUEOBJECTWITHLOCALPATH(Element pValueObjectWithLocalPathE) + throws CIMXMLParseException { // // LOCALCLASSPATH - Element localclasspathA[] = searchNodes(pValueObjectWithLocalPathE, "LOCALCLASSPATH", 0, 1, - true); + Element localclasspathA[] = searchNodes(pValueObjectWithLocalPathE, "LOCALCLASSPATH", 0, 1, true); if (localclasspathA != null) { CIMObjectPath op = parseLOCALCLASSPATH(localclasspathA[0]); // CLASS Element classA[] = searchNodes(pValueObjectWithLocalPathE, "CLASS", 0, 1, true); - if (classA == null) { throw new CIMXMLParseException( - "VALUE.OBJECTWITHLOCALPATH element missing CLASS child element!"); } + if (classA == null) { + throw new CIMXMLParseException("VALUE.OBJECTWITHLOCALPATH element missing CLASS child element!"); + } CIMClass obj = parseCLASS(classA[0], op); checkOtherNodes(pValueObjectWithLocalPathE, nodesVALUEOBJECTWITHLOCALPATHcls); @@ -594,22 +607,21 @@ public static CIMNamedElementInterface parseVALUEOBJECTWITHLOCALPATH( } // LOCALINSTANCEPATH - Element localinstancepathA[] = searchNodes(pValueObjectWithLocalPathE, "LOCALINSTANCEPATH", - 0, 1, true); + Element localinstancepathA[] = searchNodes(pValueObjectWithLocalPathE, "LOCALINSTANCEPATH", 0, 1, true); if (localinstancepathA != null) { CIMObjectPath op = parseLOCALINSTANCEPATH(localinstancepathA[0]); // INSTANCE Element instanceA[] = searchNodes(pValueObjectWithLocalPathE, "INSTANCE", 0, 1, true); - if (instanceA == null) { throw new CIMXMLParseException( - "VALUE.OBJECTWITHLOCALPATH element missing INSTANCE child element!"); } + if (instanceA == null) { + throw new CIMXMLParseException("VALUE.OBJECTWITHLOCALPATH element missing INSTANCE child element!"); + } CIMInstance inst = parseINSTANCE(instanceA[0], op); // BB mod checkOtherNodes(pValueObjectWithLocalPathE, nodesVALUEOBJECTWITHLOCALPATHins); return inst; } - throw new CIMXMLParseException( - "VALUE.OBJECTWITHLOCALPATH element missing required child element!"); + throw new CIMXMLParseException("VALUE.OBJECTWITHLOCALPATH element missing required child element!"); } // //////////////////////////////////////////////////////////////////////////////////////// @@ -620,67 +632,69 @@ public static CIMNamedElementInterface parseVALUEOBJECTWITHLOCALPATH( /** * parseNAMESPACEPATH - * + * * @param pNameSpacePathE * @return CIMObjectPath * @throws CIMXMLParseException */ - public static CIMObjectPath parseNAMESPACEPATH(Element pNameSpacePathE) - throws CIMXMLParseException { + public static CIMObjectPath parseNAMESPACEPATH(Element pNameSpacePathE) throws CIMXMLParseException { // // HOST Element hostA[] = searchNodes(pNameSpacePathE, "HOST", 1, 1, true); - if (hostA == null) { throw new CIMXMLParseException( - "NAMESPACEPATH element missing HOST child element!"); } + if (hostA == null) { + throw new CIMXMLParseException("NAMESPACEPATH element missing HOST child element!"); + } XMLHostStr xmlHostStr = new XMLHostStr(parseHOST(hostA[0])); // LOCALNAMESPACE - Element localnamespacepathA[] = searchNodes(pNameSpacePathE, "LOCALNAMESPACEPATH", 1, 1, - true); - if (localnamespacepathA == null) { throw new CIMXMLParseException( - "NAMESPACEPATH element missing LOCALNAMESPACEPATH child element!"); } + Element localnamespacepathA[] = searchNodes(pNameSpacePathE, "LOCALNAMESPACEPATH", 1, 1, true); + if (localnamespacepathA == null) { + throw new CIMXMLParseException("NAMESPACEPATH element missing LOCALNAMESPACEPATH child element!"); + } String nameSpace = parseLOCALNAMESPACEPATH(localnamespacepathA[0]); /* * CIMObjectPath( String scheme, String host, String port, String * namespace, String objectName, CIMProperty[] keys ) */ checkOtherNodes(pNameSpacePathE, nodesNAMESPACEPATH); - return new CIMObjectPath(xmlHostStr.getProtocol(), xmlHostStr.getHost(), xmlHostStr - .getPort(), nameSpace, null, null); + return new CIMObjectPath( + xmlHostStr.getProtocol(), + xmlHostStr.getHost(), + xmlHostStr.getPort(), + nameSpace, + null, + null + ); } /** * parseLOCALNAMESPACEPATH - * + * * @param pLocalNameSpaceE * @return String * @throws CIMXMLParseException */ - public static String parseLOCALNAMESPACEPATH(Element pLocalNameSpaceE) - throws CIMXMLParseException { + public static String parseLOCALNAMESPACEPATH(Element pLocalNameSpaceE) throws CIMXMLParseException { // - Element[] nameSpaceElementA = searchNodes(pLocalNameSpaceE, "NAMESPACE", 1, - Integer.MAX_VALUE, false); + Element[] nameSpaceElementA = searchNodes(pLocalNameSpaceE, "NAMESPACE", 1, Integer.MAX_VALUE, false); if (nameSpaceElementA == null) { - if (WBEMConfiguration.getGlobalConfiguration().allowEmptyLocalNameSpacePath() - && cLocalPathBuilder != null) return cLocalPathBuilder.getBasePath() - .getNamespace(); - throw new CIMXMLParseException( - "LOCALNAMESPACEPATH element missing NAMESPACE child element!"); + if ( + WBEMConfiguration.getGlobalConfiguration().allowEmptyLocalNameSpacePath() && cLocalPathBuilder != null + ) return cLocalPathBuilder.getBasePath().getNamespace(); + throw new CIMXMLParseException("LOCALNAMESPACEPATH element missing NAMESPACE child element!"); } StringBuffer sb = new StringBuffer(); for (int i = 0; i < nameSpaceElementA.length; i++) { Element namespaceE = nameSpaceElementA[i]; String s = parseNAMESPACE(namespaceE); - if (i > 0) sb.append("/" + s); - else sb.append(s); + if (i > 0) sb.append("/" + s); else sb.append(s); } return sb.toString(); } /** * parseHOST - * + * * @param pHostE * @return String */ @@ -696,7 +710,7 @@ public static String parseHOST(Element pHostE) { /** * parseNAMESPACE - * + * * @param pNameSpaceE * @return String * @throws CIMXMLParseException @@ -706,8 +720,7 @@ public static String parseNAMESPACE(Element pNameSpaceE) throws CIMXMLParseExcep // Attr namespace_nameA = (Attr) searchAttribute(pNameSpaceE, "NAME"); - if (namespace_nameA == null) throw new CIMXMLParseException( - "NAMESPACE element missing NAME attribute!"); + if (namespace_nameA == null) throw new CIMXMLParseException("NAMESPACE element missing NAME attribute!"); String n = namespace_nameA.getValue(); checkOtherNodes(pNameSpaceE, nodesNAMESPACE); return n; @@ -717,7 +730,7 @@ public static String parseNAMESPACE(Element pNameSpaceE) throws CIMXMLParseExcep /** * parseCLASSPATH - * + * * @param pClassPathE * @return CIMObjectPath * @throws CIMXMLParseException @@ -727,46 +740,55 @@ public static CIMObjectPath parseCLASSPATH(Element pClassPathE) throws CIMXMLPar // NAMESPACEPATH Element namespacepathA[] = searchNodes(pClassPathE, "NAMESPACEPATH", 1, 1, true); - if (namespacepathA == null) { throw new CIMXMLParseException( - "CLASSPATH element missing NAMESPACEPATH child element!"); } + if (namespacepathA == null) { + throw new CIMXMLParseException("CLASSPATH element missing NAMESPACEPATH child element!"); + } CIMObjectPath nsPath = parseNAMESPACEPATH(namespacepathA[0]); // CLASSNAME Element classnameA[] = searchNodes(pClassPathE, "CLASSNAME", 1, 1, true); - if (classnameA == null) { throw new CIMXMLParseException( - "CLASSPATH element missing CLASSNAME child element!"); } + if (classnameA == null) { + throw new CIMXMLParseException("CLASSPATH element missing CLASSNAME child element!"); + } String className = parseClassName(classnameA[0]); /* * CIMObjectPath( String scheme, String host, String port, String * namespace, String objectName, CIMProperty[] keys ) */ checkOtherNodes(pClassPathE, nodesCLASSPATH); - return new CIMObjectPath(nsPath.getScheme(), nsPath.getHost(), nsPath.getPort(), nsPath - .getNamespace(), className, null); + return new CIMObjectPath( + nsPath.getScheme(), + nsPath.getHost(), + nsPath.getPort(), + nsPath.getNamespace(), + className, + null + ); } private static final String nodesLOCALCLASSPATH[] = { "LOCALNAMESPACEPATH", "CLASSNAME" }; /** * parseLOCALCLASSPATH - * + * * @param pClassPathE * @return CIMObjectPath * @throws CIMXMLParseException */ - public static CIMObjectPath parseLOCALCLASSPATH(Element pClassPathE) - throws CIMXMLParseException { + public static CIMObjectPath parseLOCALCLASSPATH(Element pClassPathE) throws CIMXMLParseException { // // NAMESPACEPATH Element localnamespacepathA[] = searchNodes(pClassPathE, "LOCALNAMESPACEPATH", 1, 1, true); - if (localnamespacepathA == null) { throw new CIMXMLParseException( - "LOCALCLASSPATH element missing LOCALNAMESPACEPATH child element!"); } + if (localnamespacepathA == null) { + throw new CIMXMLParseException("LOCALCLASSPATH element missing LOCALNAMESPACEPATH child element!"); + } String nameSpace = parseLOCALNAMESPACEPATH(localnamespacepathA[0]); // CLASSNAME Element classnameA[] = searchNodes(pClassPathE, "CLASSNAME", 1, 1, true); - if (classnameA == null) { throw new CIMXMLParseException( - "LOCALCLASSPATH element missing CLASSNAME child element!"); } + if (classnameA == null) { + throw new CIMXMLParseException("LOCALCLASSPATH element missing CLASSNAME child element!"); + } CIMObjectPath op = parseCLASSNAME(classnameA[0]); checkOtherNodes(pClassPathE, nodesLOCALCLASSPATH); return cLocalPathBuilder.build(op.getObjectName(), nameSpace); @@ -776,7 +798,7 @@ public static CIMObjectPath parseLOCALCLASSPATH(Element pClassPathE) /** * parseClassName - * + * * @param pClassNameE * @return String * @throws CIMXMLParseException @@ -785,15 +807,14 @@ public static String parseClassName(Element pClassNameE) throws CIMXMLParseExcep // // Attr classname_nameA = (Attr) searchAttribute(pClassNameE, "NAME"); - if (classname_nameA == null) throw new CIMXMLParseException( - "CLASSNAME element missing NAME attribute!"); + if (classname_nameA == null) throw new CIMXMLParseException("CLASSNAME element missing NAME attribute!"); checkOtherNodes(pClassNameE, nodesCLASSNAME); return classname_nameA.getNodeValue(); } /** * parseCLASSNAME - * + * * @param pClassNameE * @return CIMObjectPath * @throws CIMXMLParseException @@ -806,55 +827,62 @@ public static CIMObjectPath parseCLASSNAME(Element pClassNameE) throws CIMXMLPar /** * parseINSTANCEPATH - * + * * @param pInstancePathE * @return CIMObjectPath * @throws CIMXMLParseException */ - public static CIMObjectPath parseINSTANCEPATH(Element pInstancePathE) - throws CIMXMLParseException { + public static CIMObjectPath parseINSTANCEPATH(Element pInstancePathE) throws CIMXMLParseException { // // NAMESPACEPATH Element namespacepathA[] = searchNodes(pInstancePathE, "NAMESPACEPATH", 1, 1, true); - if (namespacepathA == null) { throw new CIMXMLParseException( - "INSTANCEPATH element missing NAMESPACEPATH child element!"); } + if (namespacepathA == null) { + throw new CIMXMLParseException("INSTANCEPATH element missing NAMESPACEPATH child element!"); + } CIMObjectPath nsPath = parseNAMESPACEPATH(namespacepathA[0]); // INSTANCENAME Element instancenameA[] = searchNodes(pInstancePathE, "INSTANCENAME", 1, 1, true); - if (instancenameA == null) { throw new CIMXMLParseException( - "INSTANCEPATH element missing INSTANCENAME child element!"); } + if (instancenameA == null) { + throw new CIMXMLParseException("INSTANCEPATH element missing INSTANCENAME child element!"); + } CIMObjectPath op = parseINSTANCENAME(instancenameA[0]); // ebak: change host and namespace checkOtherNodes(pInstancePathE, nodesINSTANCEPATH); - return new CIMObjectPath(nsPath.getScheme(), nsPath.getHost(), nsPath.getPort(), nsPath - .getNamespace(), op.getObjectName(), op.getKeys()); + return new CIMObjectPath( + nsPath.getScheme(), + nsPath.getHost(), + nsPath.getPort(), + nsPath.getNamespace(), + op.getObjectName(), + op.getKeys() + ); } private static final String nodesLOCALINSTANCEPATH[] = { "LOCALNAMESPACEPATH", "INSTANCENAME" }; /** * parseLOCALINSTANCEPATH - * + * * @param pLocalInstancePathE * @return CIMObjectPath * @throws CIMXMLParseException */ - public static CIMObjectPath parseLOCALINSTANCEPATH(Element pLocalInstancePathE) - throws CIMXMLParseException { + public static CIMObjectPath parseLOCALINSTANCEPATH(Element pLocalInstancePathE) throws CIMXMLParseException { // // LOCALNAMESPACEPATH - Element localnamespacepathA[] = searchNodes(pLocalInstancePathE, "LOCALNAMESPACEPATH", 1, - 1, true); - if (localnamespacepathA == null) { throw new CIMXMLParseException( - "LOCALINSTANCEPATH element missing LOCALNAMESPACEPATH child element!"); } + Element localnamespacepathA[] = searchNodes(pLocalInstancePathE, "LOCALNAMESPACEPATH", 1, 1, true); + if (localnamespacepathA == null) { + throw new CIMXMLParseException("LOCALINSTANCEPATH element missing LOCALNAMESPACEPATH child element!"); + } String nameSpace = parseLOCALNAMESPACEPATH(localnamespacepathA[0]); // INSTANCENAME Element instancenameA[] = searchNodes(pLocalInstancePathE, "INSTANCENAME", 1, 1, true); - if (instancenameA == null) { throw new CIMXMLParseException( - "LOCALINSTANCEPATH element missing INSTANCENAME child element!"); } + if (instancenameA == null) { + throw new CIMXMLParseException("LOCALINSTANCEPATH element missing INSTANCENAME child element!"); + } CIMObjectPath op = parseINSTANCENAME(instancenameA[0]); /* * CIMObjectPath(String objectName, String namespace, CIMProperty[] @@ -868,23 +896,22 @@ public static CIMObjectPath parseLOCALINSTANCEPATH(Element pLocalInstancePathE) /** * parseINSTANCENAME - * + * * @param pInstanceNameE * @return CIMObjectPath * @throws CIMXMLParseException */ - public static CIMObjectPath parseINSTANCENAME(Element pInstanceNameE) - throws CIMXMLParseException { + public static CIMObjectPath parseINSTANCENAME(Element pInstanceNameE) throws CIMXMLParseException { // // Attr instance_classnameA = (Attr) searchAttribute(pInstanceNameE, "CLASSNAME"); if (instance_classnameA == null) throw new CIMXMLParseException( - "INSTANCENAME element missing CLASSNAME attribute!"); + "INSTANCENAME element missing CLASSNAME attribute!" + ); String opClassName = instance_classnameA.getNodeValue(); // KEYBINDING - Element[] keyBindingElementA = searchNodes(pInstanceNameE, "KEYBINDING", 0, - Integer.MAX_VALUE, false); + Element[] keyBindingElementA = searchNodes(pInstanceNameE, "KEYBINDING", 0, Integer.MAX_VALUE, false); if (keyBindingElementA != null) { CIMProperty[] keys = new CIMProperty[keyBindingElementA.length]; for (int i = 0; i < keyBindingElementA.length; i++) { @@ -899,8 +926,7 @@ public static CIMObjectPath parseINSTANCENAME(Element pInstanceNameE) if (keyvalueA != null) { CIMProperty[] keys = new CIMProperty[1]; TypedValue propTypedVal = parseKEYVALUE(keyvalueA[0]); - keys[0] = new CIMProperty("", propTypedVal.getType(), propTypedVal.getValue(), - true, false, null); + keys[0] = new CIMProperty("", propTypedVal.getType(), propTypedVal.getValue(), true, false, null); return cLocalPathBuilder.build(opClassName, null, keys); } @@ -909,8 +935,7 @@ public static CIMObjectPath parseINSTANCENAME(Element pInstanceNameE) if (valuereferenceA != null) { CIMProperty[] keys = new CIMProperty[1]; CIMObjectPath op = parseVALUEREFERENCE(valuereferenceA[0]); - keys[0] = new CIMProperty("", new CIMDataType(op.getObjectName()), op, - true, false, null); + keys[0] = new CIMProperty("", new CIMDataType(op.getObjectName()), op, true, false, null); return cLocalPathBuilder.build(opClassName, null, keys); } @@ -921,7 +946,7 @@ public static CIMObjectPath parseINSTANCENAME(Element pInstanceNameE) /** * parseOBJECTPATH - * + * * @param pObjectPathE * @return CIMObjectPath * @throws CIMXMLParseException @@ -948,7 +973,7 @@ public static CIMObjectPath parseOBJECTPATH(Element pObjectPathE) throws CIMXMLP /** * parseKEYBINDING - * + * * @param pKeyBindingE * @return CIMProperty * @throws CIMXMLParseException @@ -958,37 +983,34 @@ public static CIMProperty parseKEYBINDING(Element pKeyBindingE) throws CIMXML // Attr keybinding_nameA = (Attr) searchAttribute(pKeyBindingE, "NAME"); - if (keybinding_nameA == null) throw new CIMXMLParseException( - "KEYBINDING element missing NAME attribute!"); + if (keybinding_nameA == null) throw new CIMXMLParseException("KEYBINDING element missing NAME attribute!"); String propName = keybinding_nameA.getValue(); // KEYVALUE Element keyvalueA[] = searchNodes(pKeyBindingE, "KEYVALUE", 0, 1, false); if (keyvalueA != null) { TypedValue propTypedVal = parseKEYVALUE(keyvalueA[0]); - return new CIMProperty(propName, propTypedVal.getType(), propTypedVal - .getValue(), true, false, null); + return new CIMProperty(propName, propTypedVal.getType(), propTypedVal.getValue(), true, false, null); } // VALUE.REFERENCE Element valuereferenceA[] = searchNodes(pKeyBindingE, "VALUE.REFERENCE", 0, 1, false); if (valuereferenceA != null) { CIMObjectPath op = parseVALUEREFERENCE(valuereferenceA[0]); - return new CIMProperty(propName, new CIMDataType(op.getObjectName()), - op, true, false, null); + return new CIMProperty(propName, new CIMDataType(op.getObjectName()), op, true, false, null); } throw new CIMXMLParseException("KEYBINDING element missing required child element!"); } private static final TreeMap TYPESTR_MAP = new TreeMap( - new Comparator() { - - public int compare(Object pO1, Object pO2) { - return ((String) pO1).compareToIgnoreCase((String) pO2); - } + new Comparator() { - }); + public int compare(Object pO1, Object pO2) { + return ((String) pO1).compareToIgnoreCase((String) pO2); + } + } + ); static { TYPESTR_MAP.put(MOF.DT_UINT8, CIMDataType.UINT8_T); @@ -1016,7 +1038,7 @@ public int compare(Object pO1, Object pO2) { /** * parseScalarTypeStr - * + * * @param pTypeStr * @return CIMDataType * @throws CIMXMLParseException @@ -1027,7 +1049,7 @@ public static CIMDataType parseScalarTypeStr(String pTypeStr) throws CIMXMLParse /** * parseArrayTypeStr - * + * * @param pTypeStr * @return CIMDataType * @throws CIMXMLParseException @@ -1038,20 +1060,18 @@ public static CIMDataType parseArrayTypeStr(String pTypeStr) throws CIMXMLParseE /** * parseTypeStr - * + * * @param pTypeStr * @param pArray * @return CIMDataType * @throws CIMXMLParseException */ - public static CIMDataType parseTypeStr(String pTypeStr, boolean pArray) - throws CIMXMLParseException { + public static CIMDataType parseTypeStr(String pTypeStr, boolean pArray) throws CIMXMLParseException { if (pTypeStr == null) return pArray ? CIMDataType.STRING_ARRAY_T : CIMDataType.STRING_T; CIMDataType type = TYPESTR_MAP.get(pTypeStr); if (type == null) throw new CIMXMLParseException("Unknown TYPE string:" + pTypeStr); if (pArray) { - if (type.getType() == CIMDataType.REFERENCE) return new CIMDataType(type - .getRefClassName(), 0); + if (type.getType() == CIMDataType.REFERENCE) return new CIMDataType(type.getRefClassName(), 0); return CIMHelper.UnboundedArrayDataType(type.getType()); } return type; @@ -1059,7 +1079,7 @@ public static CIMDataType parseTypeStr(String pTypeStr, boolean pArray) /** * parseKEYVALUE - * + * * @param pKeyValueE * @return TypedValue * @throws CIMXMLParseException @@ -1094,27 +1114,25 @@ public static TypedValue parseKEYVALUE(Element pKeyValueE) throws CIMXMLParseExc * parser will be removed. */ private static class ValueTypeHandler { - private CIMDataType iType; private Object iValue; /** - * + * * Ctor. - * + * * @param pValueTypeStr * @param pValueStr * @throws CIMXMLParseException */ public ValueTypeHandler(String pValueTypeStr, String pValueStr) throws CIMXMLParseException { - - if (pValueTypeStr == null) throw new CIMXMLParseException( - "KEYVALUE element missing VALUETYPE attribute!"); + if (pValueTypeStr == null) throw new CIMXMLParseException("KEYVALUE element missing VALUETYPE attribute!"); if (pValueTypeStr.equals("numeric")) { if (!setUInt64(pValueStr) && !setSInt64(pValueStr) && !setReal64(pValueStr)) throw new CIMXMLParseException( - "Unparseable \"number\" value: " + pValueStr + " !"); + "Unparseable \"number\" value: " + pValueStr + " !" + ); } else if (pValueTypeStr.equals(MOF.DT_STR)) { if (!setDTAbsolute(pValueStr) && !setDTInterval(pValueStr)) { this.iValue = pValueStr; @@ -1122,18 +1140,25 @@ public ValueTypeHandler(String pValueTypeStr, String pValueStr) throws CIMXMLPar } } else if (pValueTypeStr.equals(MOF.DT_BOOL)) { if (!setBoolean(pValueStr)) throw new CIMXMLParseException( - "Unparseable \"boolean\" value: " + pValueStr + " !"); + "Unparseable \"boolean\" value: " + pValueStr + " !" + ); } else { - throw new CIMXMLParseException("KEYVALUE element's VALUETYPE attribute must be " - + MOF.DT_STR + ", " + MOF.DT_BOOL + " or numeric! " + pValueStr - + " is not allowed!"); + throw new CIMXMLParseException( + "KEYVALUE element's VALUETYPE attribute must be " + + MOF.DT_STR + + ", " + + MOF.DT_BOOL + + " or numeric! " + + pValueStr + + " is not allowed!" + ); } } /** - * + * * getType - * + * * @return CIMDataType */ public CIMDataType getType() { @@ -1141,9 +1166,9 @@ public CIMDataType getType() { } /** - * + * * getValue - * + * * @return Object */ public Object getValue() { @@ -1220,12 +1245,17 @@ private static String attribute(Element pElement, String pName) { return attrib; } - private static final String[] nodesCLASS = { "QUALIFIER", "PROPERTY", "PROPERTY.ARRAY", - "PROPERTY.REFERENCE", "METHOD" }; + private static final String[] nodesCLASS = { + "QUALIFIER", + "PROPERTY", + "PROPERTY.ARRAY", + "PROPERTY.REFERENCE", + "METHOD" + }; /** * parseCLASS - * + * * @param pClassE * @return CIMClass * @throws CIMXMLParseException @@ -1236,21 +1266,19 @@ public static CIMClass parseCLASS(Element pClassE) throws CIMXMLParseException { /** * parseCLASS - * + * * @param pClassE * @param pObjectPath * @return CIMClass * @throws CIMXMLParseException */ - public static CIMClass parseCLASS(Element pClassE, CIMObjectPath pObjectPath) - throws CIMXMLParseException { + public static CIMClass parseCLASS(Element pClassE, CIMObjectPath pObjectPath) throws CIMXMLParseException { // // Attr class_nameA = (Attr) searchAttribute(pClassE, "NAME"); - if (class_nameA == null) throw new CIMXMLParseException( - "CLASS element missing NAME attribute!"); + if (class_nameA == null) throw new CIMXMLParseException("CLASS element missing NAME attribute!"); String name = class_nameA.getNodeValue(); // Attr superclass_nameA = (Attr)searchAttribute(classE, "SUPERCLASS"); @@ -1280,9 +1308,9 @@ public static CIMClass parseCLASS(Element pClassE, CIMObjectPath pObjectPath) /* * CIMClass( String name, String superclass, CIMQualifier[] qualifiers, * CIMClassProperty[] props, CIMMethod[] methods ) - * + * * return new CIMClass( name, superClass, qualis, props, methods ); - * + * * This constructor can provide localPath info. CIMClass( CIMObjectPath * path, String superclass, CIMQualifier[] qualifiers, * CIMClassProperty[] props, CIMMethod[] pMethods, boolean @@ -1291,24 +1319,28 @@ public static CIMClass parseCLASS(Element pClassE, CIMObjectPath pObjectPath) checkOtherNodes(pClassE, nodesCLASS); return new CIMClass( - pObjectPath == null ? cLocalPathBuilder.build(name, null) : pObjectPath, - superClass, qualis, props, methods, hasAssocQuali(qualis), hasKeyProp(props)); + pObjectPath == null ? cLocalPathBuilder.build(name, null) : pObjectPath, + superClass, + qualis, + props, + methods, + hasAssocQuali(qualis), + hasKeyProp(props) + ); } private static boolean hasAssocQuali(CIMQualifier[] pQualis) { if (pQualis == null) return false; for (int i = 0; i < pQualis.length; i++) { CIMQualifier quali = pQualis[i]; - if ("ASSOCIATION".equalsIgnoreCase(quali.getName()) - && Boolean.TRUE.equals(quali.getValue())) return true; + if ("ASSOCIATION".equalsIgnoreCase(quali.getName()) && Boolean.TRUE.equals(quali.getValue())) return true; } return false; } private static boolean hasKeyProp(CIMProperty[] pProps) { if (pProps == null) return false; - for (int i = 0; i < pProps.length; i++) - if (pProps[i].isKey()) return true; + for (int i = 0; i < pProps.length; i++) if (pProps[i].isKey()) return true; return false; } @@ -1354,12 +1386,17 @@ private static CIMParameter[] parseParameters(Element pMethodE) throws CIMXML return paramV.toArray(new CIMParameter[0]); } - private static final String nodesMETHOD[] = { "QUALIFIER", "PARAMETER", "PARAMETER.REFERENCE", - "PARAMETER.ARRAY", "PARAMETER.REFARRAY" }; + private static final String nodesMETHOD[] = { + "QUALIFIER", + "PARAMETER", + "PARAMETER.REFERENCE", + "PARAMETER.ARRAY", + "PARAMETER.REFARRAY" + }; /** * parseMETHOD - * + * * @param pMethodE * @return CIMMethod * @throws CIMXMLParseException @@ -1377,8 +1414,7 @@ public static CIMMethod parseMETHOD(Element pMethodE) throws CIMXMLParse if (name == null) throw new CIMXMLParseException("METHOD element missing NAME attribute!"); EmbObjHandler embObjHandler = new EmbObjHandler(pMethodE); CIMDataType type = embObjHandler.getType(); - if (type != null && type.isArray()) throw new CIMXMLParseException( - "Method's type cannot be Array!"); + if (type != null && type.isArray()) throw new CIMXMLParseException("Method's type cannot be Array!"); String classOrigin = attribute(pMethodE, "CLASSORIGIN"); String propagatedStr = pMethodE.getAttribute("PROPAGATED"); boolean propagated = "true".equalsIgnoreCase(propagatedStr); @@ -1389,47 +1425,41 @@ public static CIMMethod parseMETHOD(Element pMethodE) throws CIMXMLParse CIMParameter[] params = parseParameters(pMethodE); // CIMMethod(String name, CIMDataType type, CIMQualifier[] qualifiers, // CIMParameter[] parameters, boolean propagated, String originClass) - return new CIMMethod(name, type, embObjHandler.getQualifiers(), params, propagated, - classOrigin); + return new CIMMethod(name, type, embObjHandler.getQualifiers(), params, propagated, classOrigin); } private static final String nodesPARAMETER[] = { "QUALIFIER" }; /** * parsePARAMETER - * + * * @param pParamE * @return CIMParameter * @throws CIMXMLParseException */ public static CIMParameter parsePARAMETER(Element pParamE) throws CIMXMLParseException { String name = attribute(pParamE, "NAME"); - if (name == null) throw new CIMXMLParseException( - "PARAMETER element missing NAME attribute!"); - if (attribute(pParamE, "TYPE") == null) throw new CIMXMLParseException( - "PARAMETER element missing TYPE attribute!"); + if (name == null) throw new CIMXMLParseException("PARAMETER element missing NAME attribute!"); + if (attribute(pParamE, "TYPE") == null) throw new CIMXMLParseException("PARAMETER element missing TYPE attribute!"); checkOtherNodes(pParamE, nodesPARAMETER); EmbObjHandler iEmbObjHandler = new EmbObjHandler(pParamE); // CIMParameter(String name, CIMDataType type, CIMQualifier[] // qualifiers) - return new CIMParameter(name, iEmbObjHandler.getType(), iEmbObjHandler - .getQualifiers()); + return new CIMParameter(name, iEmbObjHandler.getType(), iEmbObjHandler.getQualifiers()); } private static final String nodesPARAMETERREFERENCE[] = { "QUALIFIER" }; /** * parsePARAMETERREFERENCE - * + * * @param pParamE * @return CIMParameter * @throws CIMXMLParseException */ - public static CIMParameter parsePARAMETERREFERENCE(Element pParamE) - throws CIMXMLParseException { + public static CIMParameter parsePARAMETERREFERENCE(Element pParamE) throws CIMXMLParseException { String name = attribute(pParamE, "NAME"); - if (name == null) throw new CIMXMLParseException( - "PARAMETER.REFERENCE element missing NAME attribute!"); + if (name == null) throw new CIMXMLParseException("PARAMETER.REFERENCE element missing NAME attribute!"); String referenceClass = attribute(pParamE, "REFERENCECLASS"); CIMDataType type = new CIMDataType(referenceClass != null ? referenceClass : ""); checkOtherNodes(pParamE, nodesPARAMETERREFERENCE); @@ -1442,45 +1472,40 @@ public static CIMParameter parsePARAMETERREFERENCE(Element pParamE) /** * parsePARAMETERARRAY - * + * * @param pParamE * @return CIMParameter * @throws CIMXMLParseException */ - public static CIMParameter parsePARAMETERARRAY(Element pParamE) - throws CIMXMLParseException { + public static CIMParameter parsePARAMETERARRAY(Element pParamE) throws CIMXMLParseException { String name = attribute(pParamE, "NAME"); - if (name == null) throw new CIMXMLParseException( - "PARAMETER.ARRAY element missing NAME attribute!"); + if (name == null) throw new CIMXMLParseException("PARAMETER.ARRAY element missing NAME attribute!"); if (attribute(pParamE, "TYPE") == null) throw new CIMXMLParseException( - "PARAMETER.ARRAY element missing TYPE attribute!"); + "PARAMETER.ARRAY element missing TYPE attribute!" + ); String arraySizeStr = pParamE.getAttribute("ARRAYSIZE"); try { if (arraySizeStr.length() > 0) Integer.parseInt(arraySizeStr); } catch (NumberFormatException e) { - throw new CIMXMLParseException(arraySizeStr - + " is not a valid ARRAYSIZE attribute for PARAMETER.ARRAY!"); + throw new CIMXMLParseException(arraySizeStr + " is not a valid ARRAYSIZE attribute for PARAMETER.ARRAY!"); } checkOtherNodes(pParamE, nodesPARAMETERARRAY); EmbObjHandler iEmbObjHandler = new EmbObjHandler(pParamE); - return new CIMParameter(name, iEmbObjHandler.getArrayType(), iEmbObjHandler - .getQualifiers()); + return new CIMParameter(name, iEmbObjHandler.getArrayType(), iEmbObjHandler.getQualifiers()); } private static final String nodesPARAMETERREFARRAY[] = { "QUALIFIER" }; /** * parsePARAMETERREFARRAY - * + * * @param pParamE * @return CIMParameter * @throws CIMXMLParseException */ - public static CIMParameter parsePARAMETERREFARRAY(Element pParamE) - throws CIMXMLParseException { + public static CIMParameter parsePARAMETERREFARRAY(Element pParamE) throws CIMXMLParseException { String name = attribute(pParamE, "NAME"); - if (name == null) throw new CIMXMLParseException( - "PARAMETER.REFARRAY element missing NAME attribute!"); + if (name == null) throw new CIMXMLParseException("PARAMETER.REFARRAY element missing NAME attribute!"); String referenceClass = attribute(pParamE, "REFERENCECLASS"); @@ -1489,12 +1514,10 @@ public static CIMParameter parsePARAMETERREFARRAY(Element pParamE) try { if (arraySizeStr.length() > 0) arraySize = Integer.parseInt(arraySizeStr); } catch (NumberFormatException e) { - throw new CIMXMLParseException(arraySizeStr - + " is not a valid ARRAYSIZE attribute for PARAMETER.REFARRAY!"); + throw new CIMXMLParseException(arraySizeStr + " is not a valid ARRAYSIZE attribute for PARAMETER.REFARRAY!"); } - CIMDataType type = new CIMDataType((referenceClass != null) ? referenceClass : "", - arraySize); + CIMDataType type = new CIMDataType((referenceClass != null) ? referenceClass : "", arraySize); // QUALIFIER checkOtherNodes(pParamE, nodesPARAMETERREFARRAY); @@ -1504,7 +1527,7 @@ public static CIMParameter parsePARAMETERREFARRAY(Element pParamE) /** * parseINSTANCE - * + * * @param pInstanceE * @return CIMInstance * @throws CIMXMLParseException @@ -1513,27 +1536,24 @@ public static CIMInstance parseINSTANCE(Element pInstanceE) throws CIMXMLParseEx return parseINSTANCE(pInstanceE, null); } - private static final String[] nodesINSTANCE = { "QUALIFIER", "PROPERTY", "PROPERTY.ARRAY", - "PROPERTY.REFERENCE" }; + private static final String[] nodesINSTANCE = { "QUALIFIER", "PROPERTY", "PROPERTY.ARRAY", "PROPERTY.REFERENCE" }; /** * parseINSTANCE - * + * * @param pInstanceE * @param pObjPath * @return CIMInstance * @throws CIMXMLParseException */ - public static CIMInstance parseINSTANCE(Element pInstanceE, CIMObjectPath pObjPath) - throws CIMXMLParseException { + public static CIMInstance parseINSTANCE(Element pInstanceE, CIMObjectPath pObjPath) throws CIMXMLParseException { // // // BB mod CIMInstance inst = new CIMInstance(); String className = attribute(pInstanceE, "CLASSNAME"); - if (className == null) throw new CIMXMLParseException( - "INSTANCE element missing CLASSNAME attribute!"); + if (className == null) throw new CIMXMLParseException("INSTANCE element missing CLASSNAME attribute!"); // QUALIFIER // FIXME: in JSR48 CIMInstance doesn't have qualifiers // CIMQualifier[] qualis = parseQUALIFIERS(pInstanceE); @@ -1542,10 +1562,10 @@ public static CIMInstance parseINSTANCE(Element pInstanceE, CIMObjectPath pObjPa checkOtherNodes(pInstanceE, nodesINSTANCE); - if (pObjPath == null) return new CIMInstance(cLocalPathBuilder.build(className, null), - props); - if (WBEMConfiguration.getGlobalConfiguration().synchronizeNumericKeyDataTypes()) return CIMHelper - .CIMInstanceWithSynchonizedNumericKeyDataTypes(pObjPath, props); + if (pObjPath == null) return new CIMInstance(cLocalPathBuilder.build(className, null), props); + if ( + WBEMConfiguration.getGlobalConfiguration().synchronizeNumericKeyDataTypes() + ) return CIMHelper.CIMInstanceWithSynchonizedNumericKeyDataTypes(pObjPath, props); return new CIMInstance(pObjPath, props); } @@ -1553,7 +1573,7 @@ public static CIMInstance parseINSTANCE(Element pInstanceE, CIMObjectPath pObjPa * ebak: Access to enclosing method parseQUALIFIERS(Element) from the type * CIMXMLParserImpl is emulated by a synthetic accessor method. Increasing * its visibility will improve your performance - * + * * @param pElement * @return CIMQualifier[] * @throws CIMXMLParseException @@ -1579,7 +1599,7 @@ public static CIMQualifier[] parseQUALIFIERS(Element pElement) throws CIMXMLP * TOINSTANCE (true|false) 'false' * TRANSLATABLE (true|false) 'false'" * - * + * * @param pElement * @return int - CIMFlavor bit mixture */ @@ -1597,8 +1617,7 @@ private static TypedValue parseSingleValue(Element pElement) throws CIMXMLParseE private static final int VALUE = 1, VALUEA = 2, VALUEREF = 4, VALUEREFA = 8; - private static TypedValue parseSingleValue(Element pElement, int pMask) - throws CIMXMLParseException { + private static TypedValue parseSingleValue(Element pElement, int pMask) throws CIMXMLParseException { boolean foundSingleValue = false; String typeStr = attribute(pElement, "TYPE"); // ebak: there was an ESS fix in the base implementation @@ -1635,8 +1654,7 @@ private static TypedValue parseSingleValue(Element pElement, int pMask) if (valStrA != null) { Object[] values = new Object[valStrA.length]; for (int i = 0; i < valStrA.length; i++) { - values[i] = createJavaObject(type == null ? null : type.toString(), - valStrA[i]); + values[i] = createJavaObject(type == null ? null : type.toString(), valStrA[i]); } value = values; } @@ -1654,9 +1672,8 @@ private static TypedValue parseSingleValue(Element pElement, int pMask) } } if (!foundSingleValue) { - if (value instanceof Object[]) type = CIMDataType.STRING_ARRAY_T; - else if (value != null) type = CIMDataType.STRING_T; - else type = CIMDataType.STRING_T; // /throw new + if (value instanceof Object[]) type = CIMDataType.STRING_ARRAY_T; else if (value != null) type = + CIMDataType.STRING_T; else type = CIMDataType.STRING_T; // /throw new // CIMXMLParseException("null // type with null value!"); } @@ -1667,7 +1684,7 @@ private static TypedValue parseSingleValue(Element pElement, int pMask) /** * parseQUALIFIER - * + * * @param pQualifierE * @return CIMQualifier * @throws CIMXMLParseException @@ -1677,41 +1694,40 @@ public static CIMQualifier parseQUALIFIER(Element pQualifierE) throws CIMXMLP // String name = attribute(pQualifierE, "NAME"); - if (name == null) throw new CIMXMLParseException( - "QUALIFIER element missing NAME attribute!"); + if (name == null) throw new CIMXMLParseException("QUALIFIER element missing NAME attribute!"); String typeStr = attribute(pQualifierE, "TYPE"); if (typeStr == null && !hasTypeAttrsInNodes(pQualifierE)) throw new CIMXMLParseException( - "QUALIFIER element missing TYPE attribute!"); + "QUALIFIER element missing TYPE attribute!" + ); boolean propagated = MOF.TRUE.equalsIgnoreCase(pQualifierE.getAttribute("PROPAGATED")); // FLAVORS int flavors = parseFLAVORS(pQualifierE); // VALUE - if (searchNodes(pQualifierE, "VALUE", 0, 1, false) != null - || searchNodes(pQualifierE, "VALUE.ARRAY", 0, 1, false) != null) { + if ( + searchNodes(pQualifierE, "VALUE", 0, 1, false) != null || + searchNodes(pQualifierE, "VALUE.ARRAY", 0, 1, false) != null + ) { TypedValue typedValue = parseSingleValue(pQualifierE); - if (typedValue.getType() == null) throw new CIMXMLParseException( - "Qualifier's type is null!"); + if (typedValue.getType() == null) throw new CIMXMLParseException("Qualifier's type is null!"); // CIMQualifier(String pName, CIMDataType pType, Object pValue, int // pFlavor) - return new CIMQualifier(name, typedValue.getType(), typedValue.getValue(), - flavors, propagated); + return new CIMQualifier(name, typedValue.getType(), typedValue.getValue(), flavors, propagated); } checkOtherNodes(pQualifierE, nodesQUALIFIER); CIMDataType type = parseScalarTypeStr(typeStr); - return new CIMQualifier(name, type != null ? type : CIMDataType.STRING_T, null, - flavors, propagated); + return new CIMQualifier(name, type != null ? type : CIMDataType.STRING_T, null, flavors, propagated); } /** * parseQUALIFIERDECLARATION - * + * * @param pQualifierTypeE * @return CIMQualifierType * @throws CIMXMLParseException */ public static CIMQualifierType parseQUALIFIERDECLARATION(Element pQualifierTypeE) - throws CIMXMLParseException { + throws CIMXMLParseException { // // parseQUALIFIERDECLARATION(Element pQualif // %QualifierFlavor;> String name = attribute(pQualifierTypeE, "NAME"); - if (name == null) throw new CIMXMLParseException( - "QUALIFIER.DECLARATION element missing NAME attribute!"); + if (name == null) throw new CIMXMLParseException("QUALIFIER.DECLARATION element missing NAME attribute!"); String type = attribute(pQualifierTypeE, "TYPE"); if (type == null && !hasTypeAttrsInNodes(pQualifierTypeE)) throw new CIMXMLParseException( - "QUALIFIER.DECLARATION element missing TYPE attribute!"); + "QUALIFIER.DECLARATION element missing TYPE attribute!" + ); // SCOPES // ebak: there should be only 1 scope node @@ -1753,15 +1769,15 @@ public static CIMQualifierType parseQUALIFIERDECLARATION(Element pQualif boolean isArray = hasTrueAttribute(pQualifierTypeE, "ISARRAY"); String arraySizeStr = attribute(pQualifierTypeE, "ARRAYSIZE"); try { - int arraySize = (arraySizeStr == null ? (isArray ? 0 : -1) : Integer - .parseInt(arraySizeStr)); + int arraySize = (arraySizeStr == null ? (isArray ? 0 : -1) : Integer.parseInt(arraySizeStr)); if (isArray || arraySize >= 0) { - qdType = (arraySize > 0) ? new CIMDataType(qdType.getType(), arraySize) + qdType = + (arraySize > 0) + ? new CIMDataType(qdType.getType(), arraySize) : CIMHelper.UnboundedArrayDataType(qdType.getType()); } } catch (NumberFormatException e) { - throw new CIMXMLParseException(arraySizeStr - + " is not a valid ARRAYSIZE attribute for QUALIFIER.DECLARATION!"); + throw new CIMXMLParseException(arraySizeStr + " is not a valid ARRAYSIZE attribute for QUALIFIER.DECLARATION!"); } } else { nodes = new String[] { "SCOPE" }; @@ -1772,8 +1788,13 @@ public static CIMQualifierType parseQUALIFIERDECLARATION(Element pQualif checkOtherNodes(pQualifierTypeE, nodes); // FIXME: ebak: what about the flavors? - return new CIMQualifierType(new CIMObjectPath(null, null, null, null, name, null), - qdType, qdValue, scopes, 0); + return new CIMQualifierType( + new CIMObjectPath(null, null, null, null, name, null), + qdType, + qdValue, + scopes, + 0 + ); } private static boolean hasTrueAttribute(Element pElement, String pName) { @@ -1790,7 +1811,7 @@ private static boolean getBoolAttribute(Element pElement, String pName, boolean /** * parseSCOPES - * + * * @param pScopeE * @return int */ @@ -1806,15 +1827,13 @@ public static int parseSCOPES(Element pScopeE) { return scopes; } - private static Vector> parseClassPropsToVec(Element pElement) - throws CIMXMLParseException { + private static Vector> parseClassPropsToVec(Element pElement) throws CIMXMLParseException { Element[] propElementA = searchNodes(pElement, "PROPERTY"); Vector> propVec = new Vector>(); if (propElementA != null) { for (int i = 0; i < propElementA.length; i++) { Element propertyE = propElementA[i]; propVec.add(parseCLASSPROPERTY(propertyE)); - } } @@ -1840,7 +1859,7 @@ private static Vector> parseClassPropsToVec(Element pElement /** * parsePROPERTIES - * + * * @param pElement * @return CIMProperty[] * @throws CIMXMLParseException @@ -1857,28 +1876,34 @@ public static CIMProperty[] parsePROPERTIES(Element pElement) throws CIMXMLPa CIMProperty[] retA = new CIMProperty[arraySize]; for (int i = 0; i < arraySize; i++) { CIMClassProperty prop = classPropVec.get(i); - retA[i] = new CIMProperty(prop.getName(), prop.getDataType(), prop.getValue(), - prop.isKey(), prop.isPropagated(), prop.getOriginClass()); + retA[i] = + new CIMProperty( + prop.getName(), + prop.getDataType(), + prop.getValue(), + prop.isKey(), + prop.isPropagated(), + prop.getOriginClass() + ); } return retA; } /** * parseCLASSPROPERTIES - * + * * @param pElement * @return CIMClassProperty[] * @throws CIMXMLParseException */ - public static CIMClassProperty[] parseCLASSPROPERTIES(Element pElement) - throws CIMXMLParseException { + public static CIMClassProperty[] parseCLASSPROPERTIES(Element pElement) throws CIMXMLParseException { Vector> classPropVec = parseClassPropsToVec(pElement); return classPropVec.toArray(new CIMClassProperty[0]); } /** * parsePROPERTY - * + * * @param pPropertyE * @return CIMProperty * @throws CIMXMLParseException @@ -1888,7 +1913,6 @@ public static CIMProperty parsePROPERTY(Element pPropertyE) throws CIMXMLPars } private static class EmbObjHandler { - private CIMQualifier[] iQualiA; private boolean iHasEmbObjAttr, iHasEmbInstAttr, iHasEmbObjQuali, iHasEmbInstQuali, iKeyed; @@ -1899,12 +1923,11 @@ private static class EmbObjHandler { private Element iElement; - private boolean iStrictParsing = WBEMConfiguration.getGlobalConfiguration() - .strictEmbObjTypes(); + private boolean iStrictParsing = WBEMConfiguration.getGlobalConfiguration().strictEmbObjTypes(); /** * Ctor. - * + * * @param pElement * @throws CIMXMLParseException */ @@ -1980,27 +2003,28 @@ private void handleAttribs() throws CIMXMLParseException { } else if ("instance".equalsIgnoreCase(embObjAttrStr)) { this.iHasEmbObjAttr = false; this.iHasEmbInstAttr = true; - } else throw new CIMXMLParseException("EmbeddedObject attribute cannot contain \"" - + embObjAttrStr + "\" value!"); + } else throw new CIMXMLParseException("EmbeddedObject attribute cannot contain \"" + embObjAttrStr + "\" value!"); } /** * getQualifiers - * + * * @return CIMQualifier[] * @throws CIMXMLParseException */ public CIMQualifier[] getQualifiers() throws CIMXMLParseException { transform(); CIMQualifiedElementInterfaceImpl qualiImpl = new CIMQualifiedElementInterfaceImpl( - this.iQualiA, isKeyed(), this.iType == null - || this.iType.getType() == CIMDataType.STRING); + this.iQualiA, + isKeyed(), + this.iType == null || this.iType.getType() == CIMDataType.STRING + ); return qualiImpl.getQualifiers(); } /** * isKeyed - * + * * @return boolean */ public boolean isKeyed() { @@ -2009,17 +2033,16 @@ public boolean isKeyed() { /** * isEmbeddedObject - * + * * @return boolean */ private boolean isEmbeddedObject() { - return this.iHasEmbObjAttr || this.iHasEmbInstAttr || this.iHasEmbObjQuali - || this.iHasEmbInstQuali; + return this.iHasEmbObjAttr || this.iHasEmbInstAttr || this.iHasEmbObjQuali || this.iHasEmbInstQuali; } /** * isEmbeddedClass - * + * * @return boolean */ private boolean isEmbeddedClass() { @@ -2028,7 +2051,7 @@ private boolean isEmbeddedClass() { /** * isEmbeddedInstance - * + * * @return boolean */ private boolean isEmbeddedInstance() { @@ -2037,7 +2060,7 @@ private boolean isEmbeddedInstance() { /** * getType - * + * * @return CIMDataType * @throws CIMXMLParseException */ @@ -2048,19 +2071,18 @@ public CIMDataType getType() throws CIMXMLParseException { /** * getArrayType - * + * * @return CIMDataType * @throws CIMXMLParseException */ public CIMDataType getArrayType() throws CIMXMLParseException { transform(); - return this.iType.isArray() ? this.iType : CIMHelper.UnboundedArrayDataType(this.iType - .getType()); + return this.iType.isArray() ? this.iType : CIMHelper.UnboundedArrayDataType(this.iType.getType()); } /** * getValue - * + * * @return Object * @throws CIMXMLParseException */ @@ -2074,24 +2096,22 @@ private void transform() throws CIMXMLParseException { if (this.iRawValue == null) { if (isEmbeddedObject()) { if (this.iRawType != CIMDataType.STRING_T) throw new CIMXMLParseException( - "Embedded Object CIM-XML element's type must be string. " - + this.iRawType + " is invalid!"); + "Embedded Object CIM-XML element's type must be string. " + this.iRawType + " is invalid!" + ); if (this.iStrictParsing) { /* * In case of strict parsing Object means CIMClass, * Instance means CIMInstance. Pegasus 2.7.0 seems to * handle it this way. */ - this.iType = isEmbeddedInstance() ? CIMDataType.OBJECT_T - : CIMDataType.CLASS_T; + this.iType = isEmbeddedInstance() ? CIMDataType.OBJECT_T : CIMDataType.CLASS_T; } else { /* * for valueless EmbeddedObject="object" the type is * undeterminable since Pegasus's CIMObject can contain * both CIMClass and CIMInstance */ - this.iType = isEmbeddedInstance() ? CIMDataType.OBJECT_T - : CIMDataType.STRING_T; + this.iType = isEmbeddedInstance() ? CIMDataType.OBJECT_T : CIMDataType.STRING_T; } } else { this.iType = this.iRawType; @@ -2115,26 +2135,24 @@ private void transformEmbObj() throws CIMXMLParseException { this.iType = getCIMObjAType((Object[]) this.iValue); } if (isEmbeddedInstance() && this.iType.getType() != CIMDataType.OBJECT) throw new CIMXMLParseException( - this.iElement.getNodeName() - + " element is an EmbeddedInstance with non INSTANCE value. " - + "It's not valid!"); - if (isEmbeddedClass() && this.iType.getType() != CIMDataType.CLASS - && this.iType.getType() != CIMDataType.OBJECT) throw new CIMXMLParseException( - this.iElement.getNodeName() - + " element is an EmbeddedObject with non CLASS/INSTANCE value. It's not valid!"); + this.iElement.getNodeName() + " element is an EmbeddedInstance with non INSTANCE value. " + "It's not valid!" + ); + if ( + isEmbeddedClass() && this.iType.getType() != CIMDataType.CLASS && this.iType.getType() != CIMDataType.OBJECT + ) throw new CIMXMLParseException( + this.iElement.getNodeName() + " element is an EmbeddedObject with non CLASS/INSTANCE value. It's not valid!" + ); } private void transformNormObj() throws CIMXMLParseException { if (this.iRawValue instanceof String) { this.iType = this.iRawType; - this.iValue = createJavaObject(this.iType == null ? null : this.iType.toString(), - (String) this.iRawValue); + this.iValue = createJavaObject(this.iType == null ? null : this.iType.toString(), (String) this.iRawValue); } else { String[] rawValueA = (String[]) this.iRawValue; String typeStr = this.iRawType.toString(); Object[] objA = new Object[rawValueA.length]; - for (int i = 0; i < objA.length; i++) - objA[i] = createJavaObject(typeStr, rawValueA[i]); + for (int i = 0; i < objA.length; i++) objA[i] = createJavaObject(typeStr, rawValueA[i]); this.iType = CIMHelper.UnboundedArrayDataType(this.iRawType.getType()); this.iValue = objA; } @@ -2142,7 +2160,7 @@ private void transformNormObj() throws CIMXMLParseException { /** * parseXmlStr - * + * * @param pXmlStr * @return CIMClass or CIMInstance * @throws CIMXMLParseException @@ -2164,7 +2182,7 @@ public static Object parseXmlStr(String pXmlStr) throws CIMXMLParseException { /** * parseXmlStrA - * + * * @param pXmlStrA * @return Object[] * @throws CIMXMLParseException @@ -2181,23 +2199,21 @@ public static Object[] parseXmlStrA(String[] pXmlStrA) throws CIMXMLParseExcepti /** * getCIMObjType - * + * * @param pCIMObj * @return CIMDataType * @throws CIMXMLParseException */ public static CIMDataType getCIMObjType(Object pCIMObj) throws CIMXMLParseException { - if (pCIMObj == null) throw new CIMXMLParseException( - "cannot have null CIM object! (CIMClass or CIMInstance)"); + if (pCIMObj == null) throw new CIMXMLParseException("cannot have null CIM object! (CIMClass or CIMInstance)"); if (pCIMObj instanceof CIMInstance) return CIMDataType.OBJECT_T; if (pCIMObj instanceof CIMClass) return CIMDataType.CLASS_T; - throw new CIMXMLParseException(pCIMObj.getClass().getName() - + " is not a CIM object! (CIMClass or CIMInstance)"); + throw new CIMXMLParseException(pCIMObj.getClass().getName() + " is not a CIM object! (CIMClass or CIMInstance)"); } /** * getCIMObjAType - * + * * @param pCIMObjA * @return CIMDataType * @throws CIMXMLParseException @@ -2210,36 +2226,35 @@ public static CIMDataType getCIMObjAType(Object[] pCIMObjA) throws CIMXMLParseEx CIMDataType currType = getCIMObjType(pCIMObjA[i]); if (type == null) { type = currType; - } else if (type != currType) { throw new CIMXMLParseException( - "Embedded Object arrays with different types are not supported"); } + } else if (type != currType) { + throw new CIMXMLParseException("Embedded Object arrays with different types are not supported"); + } } if (type == CIMDataType.OBJECT_T) return CIMDataType.OBJECT_ARRAY_T; if (type == CIMDataType.CLASS_T) return CIMDataType.CLASS_ARRAY_T; return CIMDataType.STRING_ARRAY_T; } - } private static final String nodesPROPERTY[] = { "QUALIFIER", "VALUE" }; /** * parseCLASSPROPERTY - * + * * @param pPropertyE * @return CIMClassProperty * @throws CIMXMLParseException */ - public static CIMClassProperty parseCLASSPROPERTY(Element pPropertyE) - throws CIMXMLParseException { + public static CIMClassProperty parseCLASSPROPERTY(Element pPropertyE) throws CIMXMLParseException { // // Attr property_nameA = (Attr) searchAttribute(pPropertyE, "NAME"); - if (property_nameA == null) throw new CIMXMLParseException( - "PROPERTY element missing NAME attribute!"); + if (property_nameA == null) throw new CIMXMLParseException("PROPERTY element missing NAME attribute!"); String name = property_nameA.getNodeValue(); if (attribute(pPropertyE, "TYPE") == null && !hasTypeAttrsInNodes(pPropertyE)) throw new CIMXMLParseException( - "PROPERTY element missing TYPE attribute!"); + "PROPERTY element missing TYPE attribute!" + ); String classOrigin = pPropertyE.getAttribute("CLASSORIGIN"); if (classOrigin != null && classOrigin.length() == 0) classOrigin = null; @@ -2259,20 +2274,25 @@ public static CIMClassProperty parseCLASSPROPERTY(Element pPropertyE) * CIMQualifier[] pQualifiers, boolean pKey, boolean propagated, String * originClass) */ - return new CIMClassProperty(name, embObjHandler.getType(), - embObjHandler.getValue(), embObjHandler.getQualifiers(), embObjHandler.isKeyed(), - propagated, classOrigin); + return new CIMClassProperty( + name, + embObjHandler.getType(), + embObjHandler.getValue(), + embObjHandler.getQualifiers(), + embObjHandler.isKeyed(), + propagated, + classOrigin + ); } /** * parsePROPERTYARRAY - * + * * @param pPropertyArrayE * @return CIMProperty * @throws CIMXMLParseException */ - public static CIMProperty parsePROPERTYARRAY(Element pPropertyArrayE) - throws CIMXMLParseException { + public static CIMProperty parsePROPERTYARRAY(Element pPropertyArrayE) throws CIMXMLParseException { return parseCLASSPROPERTYARRAY(pPropertyArrayE); } @@ -2280,37 +2300,34 @@ public static CIMProperty parsePROPERTYARRAY(Element pPropertyArrayE) /** * parseCLASSPROPERTYARRAY - * + * * @param pPropArrayE * @return CIMClassProperty * @throws CIMXMLParseException */ - public static CIMClassProperty parseCLASSPROPERTYARRAY(Element pPropArrayE) - throws CIMXMLParseException { + public static CIMClassProperty parseCLASSPROPERTYARRAY(Element pPropArrayE) throws CIMXMLParseException { // // String name = attribute(pPropArrayE, "NAME"); - if (name == null) throw new CIMXMLParseException( - "PROPERTY.ARRAY element missing NAME attribute!"); + if (name == null) throw new CIMXMLParseException("PROPERTY.ARRAY element missing NAME attribute!"); if (attribute(pPropArrayE, "TYPE") == null && !hasTypeAttrsInNodes(pPropArrayE)) throw new CIMXMLParseException( - "PROPERTY.ARRAY element missing TYPE attribute!"); + "PROPERTY.ARRAY element missing TYPE attribute!" + ); String valueArraysizeStr = pPropArrayE.getAttribute("ARRAYSIZE"); try { if (valueArraysizeStr.length() > 0) Integer.parseInt(valueArraysizeStr); } catch (NumberFormatException e) { - throw new CIMXMLParseException(valueArraysizeStr - + " is not a valid ARRAYSIZE attribute for VALUE.ARRAY!"); + throw new CIMXMLParseException(valueArraysizeStr + " is not a valid ARRAYSIZE attribute for VALUE.ARRAY!"); } String classOrigin = pPropArrayE.getAttribute("CLASSORIGIN"); if (classOrigin != null && classOrigin.length() == 0) classOrigin = null; String valuePropagatedStr = pPropArrayE.getAttribute("PROPAGATED"); - boolean propagated = (valuePropagatedStr != null && valuePropagatedStr - .equalsIgnoreCase(MOF.TRUE)); + boolean propagated = (valuePropagatedStr != null && valuePropagatedStr.equalsIgnoreCase(MOF.TRUE)); // only QUALIFIER(s) and 0/1 VALUE.ARRAY searchNodes(pPropArrayE, "VALUE.ARRAY", 0, 1, true); @@ -2319,20 +2336,25 @@ public static CIMClassProperty parseCLASSPROPERTYARRAY(Element pPropArra // QUALIFIER // ebak: EmbeddedObject support EmbObjHandler embObjHandler = new EmbObjHandler(pPropArrayE); - return new CIMClassProperty(name, embObjHandler.getArrayType(), embObjHandler - .getValue(), embObjHandler.getQualifiers(), embObjHandler.isKeyed(), propagated, - classOrigin); + return new CIMClassProperty( + name, + embObjHandler.getArrayType(), + embObjHandler.getValue(), + embObjHandler.getQualifiers(), + embObjHandler.isKeyed(), + propagated, + classOrigin + ); } /** * parsePROPERTYREFERENCE - * + * * @param pPropRefE * @return CIMProperty * @throws CIMXMLParseException */ - public static CIMProperty parsePROPERTYREFERENCE(Element pPropRefE) - throws CIMXMLParseException { + public static CIMProperty parsePROPERTYREFERENCE(Element pPropRefE) throws CIMXMLParseException { return parseCLASSPROPERTYREFERENCE(pPropRefE); } @@ -2340,20 +2362,18 @@ public static CIMProperty parsePROPERTYREFERENCE(Element pPropRefE) /** * parseCLASSPROPERTYREFERENCE - * + * * @param pPropRefE * @return CIMClassProperty * @throws CIMXMLParseException */ - public static CIMClassProperty parseCLASSPROPERTYREFERENCE(Element pPropRefE) - throws CIMXMLParseException { + public static CIMClassProperty parseCLASSPROPERTYREFERENCE(Element pPropRefE) throws CIMXMLParseException { // // String name = attribute(pPropRefE, "NAME"); - if (name == null) throw new CIMXMLParseException( - "PROPERTY.REFERENCE element missing NAME attribute!"); + if (name == null) throw new CIMXMLParseException("PROPERTY.REFERENCE element missing NAME attribute!"); String classOrigin = pPropRefE.getAttribute("CLASSORIGIN"); if (classOrigin != null && classOrigin.length() == 0) classOrigin = null; @@ -2374,13 +2394,12 @@ public static CIMClassProperty parseCLASSPROPERTYREFERENCE(Element pProp // return a CIMProperty without a CIMValue checkOtherNodes(pPropRefE, nodesPROPERTYREFERENCE); CIMQualifiedElementInterfaceImpl qualiImpl = new CIMQualifiedElementInterfaceImpl(qualis); - return new CIMClassProperty(name, type, value, qualis, qualiImpl.isKeyed(), - propagated, classOrigin); + return new CIMClassProperty(name, type, value, qualis, qualiImpl.isKeyed(), propagated, classOrigin); } /** * parseMESSAGE - * + * * @param pCimVersion * @param pDtdVersion * @param pMessageE @@ -2388,7 +2407,7 @@ public static CIMClassProperty parseCLASSPROPERTYREFERENCE(Element pProp * @throws CIMXMLParseException */ public static CIMMessage parseMESSAGE(String pCimVersion, String pDtdVersion, Element pMessageE) - throws CIMXMLParseException { + throws CIMXMLParseException { // // @@ -2398,11 +2417,9 @@ public static CIMMessage parseMESSAGE(String pCimVersion, String pDtdVersion, El String id = idA.getNodeValue(); Attr protocolA = (Attr) searchAttribute(pMessageE, "PROTOCOLVERSION"); - if (protocolA == null) throw new CIMXMLParseException( - "MESSAGE element missing PROTOCOLVERSION attribute!"); + if (protocolA == null) throw new CIMXMLParseException("MESSAGE element missing PROTOCOLVERSION attribute!"); // TODO if (pCimVersion.equals("2.0") && pDtdVersion.equals("2.0")) { - // Attr message_idA = (Attr)searchAttribute(messageE, "ID"); // String messadeID = message_idA.getNodeValue(); @@ -2482,41 +2499,51 @@ public static CIMMessage parseMESSAGE(String pCimVersion, String pDtdVersion, El throw new CIMXMLParseException("DTD not supported"); } - private static final String nodesPARAMVALUE[] = { "VALUE", "VALUE.REFERENCE", "VALUE.ARRAY", - "VALUE.REFARRAY", "CLASSNAME", "INSTANCENAME", "CLASS", "INSTANCE", - "VALUE.NAMEDINSTANCE" }; + private static final String nodesPARAMVALUE[] = { + "VALUE", + "VALUE.REFERENCE", + "VALUE.ARRAY", + "VALUE.REFARRAY", + "CLASSNAME", + "INSTANCENAME", + "CLASS", + "INSTANCE", + "VALUE.NAMEDINSTANCE" + }; /** * parsePARAMVALUE - * + * * @param pParamValueE * @return CIMArgument * @throws CIMXMLParseException */ - public static CIMArgument parsePARAMVALUE(Element pParamValueE) - throws CIMXMLParseException { + public static CIMArgument parsePARAMVALUE(Element pParamValueE) throws CIMXMLParseException { // ) // String name = attribute(pParamValueE, "NAME"); - if (name == null) throw new CIMXMLParseException( - "PARAMVALUE element missing NAME attribute!"); + if (name == null) throw new CIMXMLParseException("PARAMVALUE element missing NAME attribute!"); // FIXME: ebak: The base implementation didn't contain VALUE.REFARRAY // handling. Why? // ebak: embedded object support, different parsing for VALUE and // VALUE.ARRAY sub elements - if (searchNodes(pParamValueE, "VALUE.REFERENCE", 0, 1, false) != null - || searchNodes(pParamValueE, "VALUE.REFARRAY", 0, 1, false) != null) { + if ( + searchNodes(pParamValueE, "VALUE.REFERENCE", 0, 1, false) != null || + searchNodes(pParamValueE, "VALUE.REFARRAY", 0, 1, false) != null + ) { TypedValue typedValue = parseSingleValue(pParamValueE, VALUEREF | VALUEREFA); CIMDataType type = typedValue.getType(); Object value = typedValue.getValue(); if (type == null) throw new CIMXMLParseException("PARAMVALUE element type is null!"); return new CIMArgument(name, type, value); } - if (searchNodes(pParamValueE, "VALUE", 0, 1, false) != null - || searchNodes(pParamValueE, "VALUE.ARRAY", 0, 1, false) != null - || !hasNodes(pParamValueE)) { + if ( + searchNodes(pParamValueE, "VALUE", 0, 1, false) != null || + searchNodes(pParamValueE, "VALUE.ARRAY", 0, 1, false) != null || + !hasNodes(pParamValueE) + ) { EmbObjHandler embObjHandler = new EmbObjHandler(pParamValueE); return new CIMArgument(name, embObjHandler.getType(), embObjHandler.getValue()); } @@ -2552,8 +2579,7 @@ public static CIMArgument parsePARAMVALUE(Element pParamValueE) } // VALUE.NAMEDINSTANCE - Element valuenamedisntanceA[] = searchNodes(pParamValueE, "VALUE.NAMEDINSTANCE", 0, 1, - false); + Element valuenamedisntanceA[] = searchNodes(pParamValueE, "VALUE.NAMEDINSTANCE", 0, 1, false); if (valuenamedisntanceA != null) { CIMInstance inst = parseVALUENAMEDINSTANCE(valuenamedisntanceA[0]); return new CIMArgument(name, CIMDataType.OBJECT_T, inst); @@ -2562,19 +2588,26 @@ public static CIMArgument parsePARAMVALUE(Element pParamValueE) return new CIMArgument(name, CIMDataType.STRING_T, null); } - private static final String nodesIPARAMVALUE[] = { "VALUE", "VALUE.ARRAY", "VALUE.REFERENCE", - "CLASSNAME", "INSTANCENAME", "QUALIFIER.DECLARATION", "CLASS", "INSTANCE", - "VALUE.NAMEDINSTANCE" }; + private static final String nodesIPARAMVALUE[] = { + "VALUE", + "VALUE.ARRAY", + "VALUE.REFERENCE", + "CLASSNAME", + "INSTANCENAME", + "QUALIFIER.DECLARATION", + "CLASS", + "INSTANCE", + "VALUE.NAMEDINSTANCE" + }; /** * parseIPARAMVALUE - * + * * @param pParamValueE * @return CIMArgument * @throws CIMXMLParseException */ - public static CIMArgument parseIPARAMVALUE(Element pParamValueE) - throws CIMXMLParseException { + public static CIMArgument parseIPARAMVALUE(Element pParamValueE) throws CIMXMLParseException { // @@ -2582,15 +2615,17 @@ public static CIMArgument parseIPARAMVALUE(Element pParamValueE) // %CIMName;> String name = attribute(pParamValueE, "NAME"); - if (name == null) throw new CIMXMLParseException( - "IPARAMVALUE element missing NAME attribute!"); + if (name == null) throw new CIMXMLParseException("IPARAMVALUE element missing NAME attribute!"); // this can parse VALUE, VALUE.ARRAY and VALUE.REFERENCE - if (searchNodes(pParamValueE, "VALUE", 0, 1, false) != null - || searchNodes(pParamValueE, "VALUE.ARRAY", 0, 1, false) != null - || searchNodes(pParamValueE, "VALUE.REFERENCE", 0, 1, false) != null) { + if ( + searchNodes(pParamValueE, "VALUE", 0, 1, false) != null || + searchNodes(pParamValueE, "VALUE.ARRAY", 0, 1, false) != null || + searchNodes(pParamValueE, "VALUE.REFERENCE", 0, 1, false) != null + ) { TypedValue typedValue = parseSingleValue(pParamValueE, VALUE | VALUEA | VALUEREF); - if (typedValue.getType() != null) { return new CIMArgument(name, typedValue - .getType(), typedValue.getValue()); } + if (typedValue.getType() != null) { + return new CIMArgument(name, typedValue.getType(), typedValue.getValue()); + } } // we can have different types too which cannot be handled by // parseSingleValue() @@ -2612,8 +2647,7 @@ public static CIMArgument parseIPARAMVALUE(Element pParamValueE) } // QUALIFIER.DECLARATION - Element qualiDeclarationA[] = searchNodes(pParamValueE, "QUALIFIER.DECLARATION", 0, 1, - false); + Element qualiDeclarationA[] = searchNodes(pParamValueE, "QUALIFIER.DECLARATION", 0, 1, false); if (qualiDeclarationA != null) { CIMQualifierType qualiType = parseQUALIFIERDECLARATION(qualiDeclarationA[0]); // FIXME: ebak: Does it surely have to be mapped to type: @@ -2636,8 +2670,7 @@ public static CIMArgument parseIPARAMVALUE(Element pParamValueE) } // VALUE.NAMEDINSTANCE - Element valuenamedisntanceA[] = searchNodes(pParamValueE, "VALUE.NAMEDINSTANCE", 0, 1, - false); + Element valuenamedisntanceA[] = searchNodes(pParamValueE, "VALUE.NAMEDINSTANCE", 0, 1, false); if (valuenamedisntanceA != null) { CIMInstance inst = parseVALUENAMEDINSTANCE(valuenamedisntanceA[0]); return new CIMArgument(name, CIMDataType.OBJECT_T, inst); @@ -2649,7 +2682,7 @@ public static CIMArgument parseIPARAMVALUE(Element pParamValueE) /** * parseSIMPLERSP - * + * * @param pSimpleRspE * @return CIMResponse * @throws CIMXMLParseException @@ -2660,19 +2693,21 @@ public static CIMResponse parseSIMPLERSP(Element pSimpleRspE) throws CIMXMLParse // METHODRESPONSE Element methodresponseA[] = searchNodes(pSimpleRspE, "METHODRESPONSE", 0, 1, false); if (methodresponseA != null) { - - return parseMETHODRESPONSE(methodresponseA[0]); } + return parseMETHODRESPONSE(methodresponseA[0]); + } // IMETHODRESPONSE Element imethodresponseA[] = searchNodes(pSimpleRspE, "IMETHODRESPONSE", 0, 1, false); - if (imethodresponseA != null) { return parseIMETHODRESPONSE(imethodresponseA[0]); } + if (imethodresponseA != null) { + return parseIMETHODRESPONSE(imethodresponseA[0]); + } throw new CIMXMLParseException("SIMPLERSP element missing required child element!"); } /** * parseMULTIRSP - * + * * @param pSimpleRspE * @return CIMResponse * @throws CIMXMLParseException @@ -2680,8 +2715,7 @@ public static CIMResponse parseSIMPLERSP(Element pSimpleRspE) throws CIMXMLParse public static CIMResponse parseMULTIRSP(Element pSimpleRspE) throws CIMXMLParseException { // - Element[] multiRespElementA = searchNodes(pSimpleRspE, "SIMPLERSP", 2, Integer.MAX_VALUE, - false); + Element[] multiRespElementA = searchNodes(pSimpleRspE, "SIMPLERSP", 2, Integer.MAX_VALUE, false); if (multiRespElementA != null) { CIMResponse multiRsp = new CIMResponse(); for (int i = 0; i < multiRespElementA.length; i++) { @@ -2700,7 +2734,7 @@ public static CIMResponse parseMULTIRSP(Element pSimpleRspE) throws CIMXMLParseE /** * parseSIMPLEREQ - * + * * @param pSimpleReqE * @return CIMRequest * @throws CIMXMLParseException @@ -2718,20 +2752,19 @@ public static CIMRequest parseSIMPLEREQ(Element pSimpleReqE) throws CIMXMLParseE // IMETHODCALL Element imethodcallA[] = searchNodes(pSimpleReqE, "IMETHODCALL", 0, 1, true); if (imethodcallA != null) { - if (request != null) { throw new CIMXMLParseException( - "SIMPLEREQ element cannot have METHODCALL and IMETHODCALL child elements!"); } + if (request != null) { + throw new CIMXMLParseException("SIMPLEREQ element cannot have METHODCALL and IMETHODCALL child elements!"); + } request = parseIMETHODCALL(imethodcallA[0]); } - if (request == null) throw new CIMXMLParseException( - "SIMPLEREQ element missing required child element!"); + if (request == null) throw new CIMXMLParseException("SIMPLEREQ element missing required child element!"); // CORRELATOR Element[] correlatorA = searchNodes(pSimpleReqE, "CORRELATOR", 0, Integer.MAX_VALUE, true); if (correlatorA != null) { - for (int i = 0; i < correlatorA.length; i++) - // TODO: return to WBEMClient API if JSR48 changes - parseCORRELATOR(correlatorA[i]); + for (int i = 0; i < correlatorA.length; i++) // TODO: return to WBEMClient API if JSR48 changes + parseCORRELATOR(correlatorA[i]); } checkOtherNodes(pSimpleReqE, nodesSIMPLEREQ); @@ -2740,7 +2773,7 @@ public static CIMRequest parseSIMPLEREQ(Element pSimpleReqE) throws CIMXMLParseE /** * parseMULTIREQ - * + * * @param pMultiReqE * @return CIMRequest * @throws CIMXMLParseException @@ -2748,8 +2781,7 @@ public static CIMRequest parseSIMPLEREQ(Element pSimpleReqE) throws CIMXMLParseE public static CIMRequest parseMULTIREQ(Element pMultiReqE) throws CIMXMLParseException { // - Element[] methodReqElementA = searchNodes(pMultiReqE, "SIMPLEREQ", 2, Integer.MAX_VALUE, - false); + Element[] methodReqElementA = searchNodes(pMultiReqE, "SIMPLEREQ", 2, Integer.MAX_VALUE, false); if (methodReqElementA != null) { CIMRequest multiReq = new CIMRequest(); for (int i = 0; i < methodReqElementA.length; i++) { @@ -2764,12 +2796,11 @@ public static CIMRequest parseMULTIREQ(Element pMultiReqE) throws CIMXMLParseExc throw new CIMXMLParseException("MULTIREQ element missing SIMPLEREQ child element!"); } - private static final String nodesMETHODCALL[] = { "LOCALCLASSPATH", "LOCALINSTANCEPATH", - "PARAMVALUE" }; + private static final String nodesMETHODCALL[] = { "LOCALCLASSPATH", "LOCALINSTANCEPATH", "PARAMVALUE" }; /** * parseMETHODCALL - * + * * @param pMethodCallE * @return CIMRequest * @throws CIMXMLParseException @@ -2782,8 +2813,7 @@ public static CIMRequest parseMETHODCALL(Element pMethodCallE) throws CIMXMLPars CIMRequest request = new CIMRequest(); String methodname = attribute(pMethodCallE, "NAME"); - if (methodname == null) throw new CIMXMLParseException( - "METHODCALL element missing NAME attribute!"); + if (methodname == null) throw new CIMXMLParseException("METHODCALL element missing NAME attribute!"); request.setMethodName(methodname); // EXPMETHODCALL @@ -2799,18 +2829,17 @@ public static CIMRequest parseMETHODCALL(Element pMethodCallE) throws CIMXMLPars Element localinstancepathA[] = searchNodes(pMethodCallE, "LOCALINSTANCEPATH", 0, 1, true); if (localinstancepathA != null) { if (localclasspathFound) throw new CIMXMLParseException( - "METHODCALL element cannot have both LOCALCLASSPATH and LOCALINSTANCEPATH child elements!"); + "METHODCALL element cannot have both LOCALCLASSPATH and LOCALINSTANCEPATH child elements!" + ); CIMObjectPath path = parseLOCALINSTANCEPATH(localinstancepathA[0]); request.setObjectPath(path); } else { - if (!localclasspathFound) throw new CIMXMLParseException( - "METHODCALL element missing required child element!"); + if (!localclasspathFound) throw new CIMXMLParseException("METHODCALL element missing required child element!"); } - Element[] paramValueElementA = searchNodes(pMethodCallE, "PARAMVALUE", 0, - Integer.MAX_VALUE, true); + Element[] paramValueElementA = searchNodes(pMethodCallE, "PARAMVALUE", 0, Integer.MAX_VALUE, true); if (paramValueElementA != null) { CIMArgument[] argA = new CIMArgument[paramValueElementA.length]; @@ -2829,7 +2858,7 @@ public static CIMRequest parseMETHODCALL(Element pMethodCallE) throws CIMXMLPars /** * parseIMETHODCALL - * + * * @param pIMethodCallE * @return CIMRequest * @throws CIMXMLParseException @@ -2842,8 +2871,7 @@ public static CIMRequest parseIMETHODCALL(Element pIMethodCallE) throws CIMXMLPa CIMRequest request = new CIMRequest(); String methodname = attribute(pIMethodCallE, "NAME"); // ebak: // CIMName->NAME - if (methodname == null) throw new CIMXMLParseException( - "IMETHODCALL element missing NAME attribute!"); + if (methodname == null) throw new CIMXMLParseException("IMETHODCALL element missing NAME attribute!"); request.setMethodName(methodname); // METHODCALL @@ -2853,8 +2881,7 @@ public static CIMRequest parseIMETHODCALL(Element pIMethodCallE) throws CIMXMLPa request.setNameSpace(nameSpace); } - Element[] iParamValElementA = searchNodes(pIMethodCallE, "IPARAMVALUE", 0, - Integer.MAX_VALUE, true); // ebak: + Element[] iParamValElementA = searchNodes(pIMethodCallE, "IPARAMVALUE", 0, Integer.MAX_VALUE, true); // ebak: // PARAMVALUE->IPARAMVALUE if (iParamValElementA != null) { @@ -2870,12 +2897,22 @@ public static CIMRequest parseIMETHODCALL(Element pIMethodCallE) throws CIMXMLPa if (value instanceof CIMObjectPath) { CIMObjectPath op = (CIMObjectPath) value; if (op.getNamespace() == null || op.getNamespace().length() == 0) { - arg = new CIMArgument(arg.getName(), arg.getDataType(), - // CIMObjectPath(String scheme, String host, String + arg = + new CIMArgument( + arg.getName(), + arg.getDataType(), + // CIMObjectPath(String scheme, String host, String // port, String namespace, String objectName, // CIMProperty[] keys) - new CIMObjectPath(op.getScheme(), op.getHost(), op.getPort(), - request.getNameSpace(), op.getObjectName(), op.getKeys())); + new CIMObjectPath( + op.getScheme(), + op.getHost(), + op.getPort(), + request.getNameSpace(), + op.getObjectName(), + op.getKeys() + ) + ); } } argA[i] = arg; @@ -2891,7 +2928,7 @@ public static CIMRequest parseIMETHODCALL(Element pIMethodCallE) throws CIMXMLPa /** * parseSIMPLEEXPREQ - * + * * @param pSimpleExpReqE * @return CIMRequest * @throws CIMXMLParseException @@ -2905,17 +2942,14 @@ public static CIMRequest parseSIMPLEEXPREQ(Element pSimpleExpReqE) throws CIMXML if (expmethodcallA != null) { request = parseEXPMETHODCALL(expmethodcallA[0]); } else { - throw new CIMXMLParseException( - "SIMPLEEXPREQ element missing EXPMETHODCALL child element!"); + throw new CIMXMLParseException("SIMPLEEXPREQ element missing EXPMETHODCALL child element!"); } // CORRELATOR - Element[] correlatorA = searchNodes(pSimpleExpReqE, "CORRELATOR", 0, Integer.MAX_VALUE, - true); + Element[] correlatorA = searchNodes(pSimpleExpReqE, "CORRELATOR", 0, Integer.MAX_VALUE, true); if (correlatorA != null) { - for (int i = 0; i < correlatorA.length; i++) - // TODO: return to WBEMClient API if JSR48 changes - parseCORRELATOR(correlatorA[i]); + for (int i = 0; i < correlatorA.length; i++) // TODO: return to WBEMClient API if JSR48 changes + parseCORRELATOR(correlatorA[i]); } checkOtherNodes(pSimpleExpReqE, nodesSIMPLEEXPREQ); @@ -2924,7 +2958,7 @@ public static CIMRequest parseSIMPLEEXPREQ(Element pSimpleExpReqE) throws CIMXML /** * parseMULTIEXPREQ - * + * * @param pMultiExpReqE * @return CIMRequest * @throws CIMXMLParseException @@ -2932,8 +2966,7 @@ public static CIMRequest parseSIMPLEEXPREQ(Element pSimpleExpReqE) throws CIMXML public static CIMRequest parseMULTIEXPREQ(Element pMultiExpReqE) throws CIMXMLParseException { // - Element[] methodReqElementA = searchNodes(pMultiExpReqE, "SIMPLEEXPREQ", 2, - Integer.MAX_VALUE, false); + Element[] methodReqElementA = searchNodes(pMultiExpReqE, "SIMPLEEXPREQ", 2, Integer.MAX_VALUE, false); if (methodReqElementA != null) { CIMRequest multiReq = new CIMRequest(); for (int i = 0; i < methodReqElementA.length; i++) { @@ -2952,24 +2985,21 @@ public static CIMRequest parseMULTIEXPREQ(Element pMultiExpReqE) throws CIMXMLPa /** * parseEXPMETHODCALL - * + * * @param pExpMethodCallE * @return CIMRequest * @throws CIMXMLParseException */ - public static CIMRequest parseEXPMETHODCALL(Element pExpMethodCallE) - throws CIMXMLParseException { + public static CIMRequest parseEXPMETHODCALL(Element pExpMethodCallE) throws CIMXMLParseException { // // EXPMETHODCALL CIMRequest request = new CIMRequest(); String methodname = attribute(pExpMethodCallE, "NAME"); - if (methodname == null) throw new CIMXMLParseException( - "EXPMETHODCALL element missing NAME attribute!"); + if (methodname == null) throw new CIMXMLParseException("EXPMETHODCALL element missing NAME attribute!"); request.setMethodName(methodname); - Element[] paramValElementA = searchNodes(pExpMethodCallE, "EXPPARAMVALUE", 0, - Integer.MAX_VALUE, false); + Element[] paramValElementA = searchNodes(pExpMethodCallE, "EXPPARAMVALUE", 0, Integer.MAX_VALUE, false); Vector v = new Vector(); if (paramValElementA != null) { for (int i = 0; i < paramValElementA.length; i++) { @@ -2987,19 +3017,19 @@ public static CIMRequest parseEXPMETHODCALL(Element pExpMethodCallE) /** * parseEXPPARAMVALUE - * + * * @param pExpParamValueE * @return CIMInstance * @throws CIMXMLParseException */ - public static CIMInstance parseEXPPARAMVALUE(Element pExpParamValueE) - throws CIMXMLParseException { + public static CIMInstance parseEXPPARAMVALUE(Element pExpParamValueE) throws CIMXMLParseException { // // // INSTANCE if (attribute(pExpParamValueE, "NAME") == null) throw new CIMXMLParseException( - "EXPPARAMVALUE element missing NAME attribute!"); + "EXPPARAMVALUE element missing NAME attribute!" + ); Element[] instanceA = searchNodes(pExpParamValueE, "INSTANCE", 0, 1, false); if (instanceA != null) { @@ -3016,16 +3046,16 @@ public static CIMInstance parseEXPPARAMVALUE(Element pExpParamValueE) /** * parseMETHODRESPONSE - * + * * @param pMethodResponseE * @return CIMResponse * @throws CIMXMLParseException */ - public static CIMResponse parseMETHODRESPONSE(Element pMethodResponseE) - throws CIMXMLParseException { + public static CIMResponse parseMETHODRESPONSE(Element pMethodResponseE) throws CIMXMLParseException { // if (attribute(pMethodResponseE, "NAME") == null) throw new CIMXMLParseException( - "METHODRESPONSE element missing NAME attribute!"); + "METHODRESPONSE element missing NAME attribute!" + ); CIMResponse response = new CIMResponse(); @@ -3049,8 +3079,7 @@ public static CIMResponse parseMETHODRESPONSE(Element pMethodResponseE) } // PARAMVALUE - Element[] paramValElementA = searchNodes(pMethodResponseE, "PARAMVALUE", 0, - Integer.MAX_VALUE, true); + Element[] paramValElementA = searchNodes(pMethodResponseE, "PARAMVALUE", 0, Integer.MAX_VALUE, true); if (paramValElementA != null) { Vector v = new Vector(); for (int i = 0; i < paramValElementA.length; i++) { @@ -3087,16 +3116,16 @@ public static CIMResponse parseMETHODRESPONSE(Element pMethodResponseE) /** * parseIMETHODRESPONSE - * + * * @param pIMethodResponseE * @return CIMResponse * @throws CIMXMLParseException */ - public static CIMResponse parseIMETHODRESPONSE(Element pIMethodResponseE) - throws CIMXMLParseException { + public static CIMResponse parseIMETHODRESPONSE(Element pIMethodResponseE) throws CIMXMLParseException { // if (attribute(pIMethodResponseE, "NAME") == null) throw new CIMXMLParseException( - "IMETHODRESPONSE element missing NAME attribute!"); + "IMETHODRESPONSE element missing NAME attribute!" + ); CIMResponse response = new CIMResponse(); // ERROR @@ -3119,8 +3148,7 @@ public static CIMResponse parseIMETHODRESPONSE(Element pIMethodResponseE) } // PARAMVALUE - Element[] paramValElementA = searchNodes(pIMethodResponseE, "PARAMVALUE", 0, - Integer.MAX_VALUE, true); + Element[] paramValElementA = searchNodes(pIMethodResponseE, "PARAMVALUE", 0, Integer.MAX_VALUE, true); if (paramValElementA != null) { Vector v = new Vector(); for (int i = 0; i < paramValElementA.length; i++) { @@ -3139,7 +3167,7 @@ public static CIMResponse parseIMETHODRESPONSE(Element pIMethodResponseE) /** * parseERROR - * + * * @param pErrorE * @return WBEMException * @throws CIMXMLParseException @@ -3149,15 +3177,13 @@ public static WBEMException parseERROR(Element pErrorE) throws CIMXMLParseExcept // Attr error_codeA = (Attr) searchAttribute(pErrorE, "CODE"); - if (error_codeA == null) throw new CIMXMLParseException( - "ERROR element missing CODE attribute!"); + if (error_codeA == null) throw new CIMXMLParseException("ERROR element missing CODE attribute!"); String code = error_codeA.getNodeValue(); int errorCode = 0; try { if (code.length() > 0) errorCode = Integer.parseInt(code); } catch (Exception e) { - LogAndTraceBroker.getBroker().trace(Level.WARNING, - "exception while parsing error code from XML", e); + LogAndTraceBroker.getBroker().trace(Level.WARNING, "exception while parsing error code from XML", e); errorCode = WBEMException.CIM_ERR_FAILED; } Attr error_descriptionA = (Attr) searchAttribute(pErrorE, "DESCRIPTION"); @@ -3181,17 +3207,19 @@ public static WBEMException parseERROR(Element pErrorE) throws CIMXMLParseExcept // throw new CIMException(CIMException.getErrorName(errorCode), // description.substring(description.indexOf(':')+1)); - if (!rtnV.isEmpty()) return new WBEMException(errorCode, "ErrorCode:" + errorCode - + " description:" + description, rtnV.toArray(new CIMInstance[0])); - return new WBEMException(errorCode, "ErrorCode:" + errorCode + " description:" - + description); + if (!rtnV.isEmpty()) return new WBEMException( + errorCode, + "ErrorCode:" + errorCode + " description:" + description, + rtnV.toArray(new CIMInstance[0]) + ); + return new WBEMException(errorCode, "ErrorCode:" + errorCode + " description:" + description); } private static final String nodesRETURNVALUE[] = { "VALUE", "VALUE.REFERENCE" }; /** * parseRETURNVALUE - * + * * @param pRetValE * @return Object * @throws CIMXMLParseException @@ -3214,14 +3242,26 @@ public static Object parseRETURNVALUE(Element pRetValE) throws CIMXMLParseExcept return null; } - private static final String nodesIRETURNVALUE[] = { "CLASSNAME", "INSTANCENAME", "VALUE", - "VALUE.OBJECTWITHPATH", "VALUE.OBJECTWITHLOCALPATH", "VALUE.OBJECT", "OBJECTPATH", - "QUALIFIER.DECLARATION", "VALUE.ARRAY", "VALUE.REFERENCE", "CLASS", "INSTANCE", - "INSTANCEPATH", "VALUE.NAMEDINSTANCE" }; + private static final String nodesIRETURNVALUE[] = { + "CLASSNAME", + "INSTANCENAME", + "VALUE", + "VALUE.OBJECTWITHPATH", + "VALUE.OBJECTWITHLOCALPATH", + "VALUE.OBJECT", + "OBJECTPATH", + "QUALIFIER.DECLARATION", + "VALUE.ARRAY", + "VALUE.REFERENCE", + "CLASS", + "INSTANCE", + "INSTANCEPATH", + "VALUE.NAMEDINSTANCE" + }; /** * parseIRETURNVALUE - * + * * @param pIRetValE * @return Vector * @throws CIMXMLParseException @@ -3257,8 +3297,7 @@ public static Vector parseIRETURNVALUE(Element pIRetValE) throws CIMXMLP } // CLASSNAME - Element[] classNameElementA = searchNodes(pIRetValE, "CLASSNAME", 0, Integer.MAX_VALUE, - false); + Element[] classNameElementA = searchNodes(pIRetValE, "CLASSNAME", 0, Integer.MAX_VALUE, false); if (classNameElementA != null) { for (int i = 0; i < classNameElementA.length; i++) { Element classnameE = classNameElementA[i]; @@ -3269,8 +3308,7 @@ public static Vector parseIRETURNVALUE(Element pIRetValE) throws CIMXMLP } // INSTANCENAME - Element[] instNameElementA = searchNodes(pIRetValE, "INSTANCENAME", 0, Integer.MAX_VALUE, - false); + Element[] instNameElementA = searchNodes(pIRetValE, "INSTANCENAME", 0, Integer.MAX_VALUE, false); if (instNameElementA != null) { for (int i = 0; i < instNameElementA.length; i++) { Element instancenameE = instNameElementA[i]; @@ -3281,8 +3319,7 @@ public static Vector parseIRETURNVALUE(Element pIRetValE) throws CIMXMLP } // INSTANCEPATH - Element[] instpathElementA = searchNodes(pIRetValE, "INSTANCEPATH", 0, Integer.MAX_VALUE, - false); + Element[] instpathElementA = searchNodes(pIRetValE, "INSTANCEPATH", 0, Integer.MAX_VALUE, false); if (instpathElementA != null) { for (int i = 0; i < instpathElementA.length; i++) { Element instancePathE = instpathElementA[i]; @@ -3293,8 +3330,7 @@ public static Vector parseIRETURNVALUE(Element pIRetValE) throws CIMXMLP } // OBJECTPATH - Element[] objPathElementA = searchNodes(pIRetValE, "OBJECTPATH", 0, Integer.MAX_VALUE, - false); + Element[] objPathElementA = searchNodes(pIRetValE, "OBJECTPATH", 0, Integer.MAX_VALUE, false); if (objPathElementA != null) { for (int i = 0; i < objPathElementA.length; i++) { Element objectpathE = objPathElementA[i]; @@ -3334,8 +3370,7 @@ public static Vector parseIRETURNVALUE(Element pIRetValE) throws CIMXMLP } // VALUE.OBJECT - Element[] valObjElementA = searchNodes(pIRetValE, "VALUE.OBJECT", 0, Integer.MAX_VALUE, - false); + Element[] valObjElementA = searchNodes(pIRetValE, "VALUE.OBJECT", 0, Integer.MAX_VALUE, false); if (valObjElementA != null) { for (int i = 0; i < valObjElementA.length; i++) { Element valueobjectE = valObjElementA[i]; @@ -3346,8 +3381,7 @@ public static Vector parseIRETURNVALUE(Element pIRetValE) throws CIMXMLP } // VALUE.NAMEDINSTANCE - Element[] valNamedInstElementA = searchNodes(pIRetValE, "VALUE.NAMEDINSTANCE", 0, - Integer.MAX_VALUE, false); + Element[] valNamedInstElementA = searchNodes(pIRetValE, "VALUE.NAMEDINSTANCE", 0, Integer.MAX_VALUE, false); if (valNamedInstElementA != null) { for (int i = 0; i < valNamedInstElementA.length; i++) { Element valuenamedisntanceE = valNamedInstElementA[i]; @@ -3358,8 +3392,7 @@ public static Vector parseIRETURNVALUE(Element pIRetValE) throws CIMXMLP } // VALUE.INSTANCEWITHPATH - Element[] valInstWithPathElementA = searchNodes(pIRetValE, "VALUE.INSTANCEWITHPATH", 0, - Integer.MAX_VALUE, false); + Element[] valInstWithPathElementA = searchNodes(pIRetValE, "VALUE.INSTANCEWITHPATH", 0, Integer.MAX_VALUE, false); if (valInstWithPathElementA != null) { for (int i = 0; i < valInstWithPathElementA.length; i++) { Element valueinstancewithpathE = valInstWithPathElementA[i]; @@ -3370,8 +3403,7 @@ public static Vector parseIRETURNVALUE(Element pIRetValE) throws CIMXMLP } // VALUE.OBJECTWITHPATH - Element[] valObjWithPathElementA = searchNodes(pIRetValE, "VALUE.OBJECTWITHPATH", 0, - Integer.MAX_VALUE, false); + Element[] valObjWithPathElementA = searchNodes(pIRetValE, "VALUE.OBJECTWITHPATH", 0, Integer.MAX_VALUE, false); if (valObjWithPathElementA != null) { for (int i = 0; i < valObjWithPathElementA.length; i++) { Element valueobjectwithpathE = valObjWithPathElementA[i]; @@ -3382,8 +3414,13 @@ public static Vector parseIRETURNVALUE(Element pIRetValE) throws CIMXMLP } // VALUE.OBJECTWITHLOCALPATH - Element[] valObjWithLocalPathElementA = searchNodes(pIRetValE, "VALUE.OBJECTWITHLOCALPATH", - 0, Integer.MAX_VALUE, false); + Element[] valObjWithLocalPathElementA = searchNodes( + pIRetValE, + "VALUE.OBJECTWITHLOCALPATH", + 0, + Integer.MAX_VALUE, + false + ); if (valObjWithLocalPathElementA != null) { for (int i = 0; i < valObjWithLocalPathElementA.length; i++) { Element valueobjectwithlocalpathE = valObjWithLocalPathElementA[i]; @@ -3394,8 +3431,7 @@ public static Vector parseIRETURNVALUE(Element pIRetValE) throws CIMXMLP } // QUALIFIER.DECLARATION - Element[] qualiDeclElementA = searchNodes(pIRetValE, "QUALIFIER.DECLARATION", 0, - Integer.MAX_VALUE, false); + Element[] qualiDeclElementA = searchNodes(pIRetValE, "QUALIFIER.DECLARATION", 0, Integer.MAX_VALUE, false); if (qualiDeclElementA != null) { for (int i = 0; i < qualiDeclElementA.length; i++) { Element qualifierdeclarationE = qualiDeclElementA[i]; @@ -3410,7 +3446,7 @@ public static Vector parseIRETURNVALUE(Element pIRetValE) throws CIMXMLP /** * parseObject - * + * * @param pRootE * @return Object * @throws CIMXMLParseException @@ -3470,7 +3506,7 @@ public static Object parseObject(Element pRootE) throws CIMXMLParseException { /** * hasNodes - * + * * @param pParentE * @return boolean */ @@ -3486,11 +3522,11 @@ private static boolean hasNodes(Element pParentE) { /** * hasTypeAttrsInNodes - * + * * SVC CIMOM sends typed CIM-XML elements in a non-standard way. The TYPE * attribute is included in the VALUE or VALUE.ARRAY element not in the * enclosing element as the standard says. - * + * * @param pParentE * @return boolean */ @@ -3502,8 +3538,7 @@ private static boolean hasTypeAttrsInNodes(Element pParentE) { String name = n.getNodeName(); if ("VALUE".equalsIgnoreCase(name) || "VALUE.ARRAY".equalsIgnoreCase(name)) { NamedNodeMap nm = n.getAttributes(); - if (nm != null - && (nm.getNamedItem("TYPE") != null || nm.getNamedItem("PARAMTYPE") != null)) return true; + if (nm != null && (nm.getNamedItem("TYPE") != null || nm.getNamedItem("PARAMTYPE") != null)) return true; } } return false; @@ -3512,35 +3547,87 @@ private static boolean hasTypeAttrsInNodes(Element pParentE) { private static final HashMap NODENAME_HASH = new HashMap(); private static void initNodeNameHash(String[] pEnumA) { - for (int i = 0; i < pEnumA.length; i++) - NODENAME_HASH.put(pEnumA[i], pEnumA[i]); + for (int i = 0; i < pEnumA.length; i++) NODENAME_HASH.put(pEnumA[i], pEnumA[i]); } static { - initNodeNameHash(new String[] { "CIM", "DECLARATION", "DECLGROUP", "DECLGROUP.WITHNAME", - "DECLGROUP.WITHPATH", "QUALIFIER.DECLARATION", "SCOPE", "VALUE", "VALUE.ARRAY", - "VALUE.REFERENCE", "VALUE.REFARRAY", "VALUE.OBJECT", "VALUE.NAMEDINSTANCE", - "VALUE.NAMEDOBJECT", "VALUE.OBJECTWITHLOCALPATH", "VALUE.OBJECTWITHPATH", - "VALUE.NULL", "VALUE.INSTANCEWITHPATH", "NAMESPACEPATH", "LOCALNAMESPACEPATH", - "HOST", "NAMESPACE", "CLASSPATH", "LOCALCLASSPATH", "CLASSNAME", "INSTANCEPATH", - "LOCALINSTANCEPATH", "INSTANCENAME", "OBJECTPATH", "KEYBINDING", "KEYVALUE", - "CLASS", "INSTANCE", "QUALIFIER", "PROPERTY", "PROPERTY.ARRAY", - "PROPERTY.REFERENCE", "METHOD", "PARAMETER", "PARAMETER.REFERENCE", - "PARAMETER.ARRAY", "PARAMETER.REFARRAY", "MESSAGE", "MULTIREQ", "MULTIEXPREQ", - "SIMPLEREQ", "SIMPLEEXPREQ", "IMETHODCALL", "METHODCALL", "EXPMETHODCALL", - "PARAMVALUE", "IPARAMVALUE", "EXPPARAMVALUE", "MULTIRSP", "MULTIEXPRSP", - "SIMPLERSP", "SIMPLEEXPRSP", "METHODRESPONSE", "EXPMETHODRESPONSE", - "IMETHODRESPONSE", "ERROR", "RETURNVALUE", "IRETURNVALUE", "CORRELATOR" }); + initNodeNameHash( + new String[] { + "CIM", + "DECLARATION", + "DECLGROUP", + "DECLGROUP.WITHNAME", + "DECLGROUP.WITHPATH", + "QUALIFIER.DECLARATION", + "SCOPE", + "VALUE", + "VALUE.ARRAY", + "VALUE.REFERENCE", + "VALUE.REFARRAY", + "VALUE.OBJECT", + "VALUE.NAMEDINSTANCE", + "VALUE.NAMEDOBJECT", + "VALUE.OBJECTWITHLOCALPATH", + "VALUE.OBJECTWITHPATH", + "VALUE.NULL", + "VALUE.INSTANCEWITHPATH", + "NAMESPACEPATH", + "LOCALNAMESPACEPATH", + "HOST", + "NAMESPACE", + "CLASSPATH", + "LOCALCLASSPATH", + "CLASSNAME", + "INSTANCEPATH", + "LOCALINSTANCEPATH", + "INSTANCENAME", + "OBJECTPATH", + "KEYBINDING", + "KEYVALUE", + "CLASS", + "INSTANCE", + "QUALIFIER", + "PROPERTY", + "PROPERTY.ARRAY", + "PROPERTY.REFERENCE", + "METHOD", + "PARAMETER", + "PARAMETER.REFERENCE", + "PARAMETER.ARRAY", + "PARAMETER.REFARRAY", + "MESSAGE", + "MULTIREQ", + "MULTIEXPREQ", + "SIMPLEREQ", + "SIMPLEEXPREQ", + "IMETHODCALL", + "METHODCALL", + "EXPMETHODCALL", + "PARAMVALUE", + "IPARAMVALUE", + "EXPPARAMVALUE", + "MULTIRSP", + "MULTIEXPRSP", + "SIMPLERSP", + "SIMPLEEXPRSP", + "METHODRESPONSE", + "EXPMETHODRESPONSE", + "IMETHODRESPONSE", + "ERROR", + "RETURNVALUE", + "IRETURNVALUE", + "CORRELATOR" + } + ); } /** * checkOtherNodes - * + * * @param pParentE * @param pAllowedChildNodes */ - private static void checkOtherNodes(Element pParentE, String[] pAllowedChildNodes) - throws CIMXMLParseException { + private static void checkOtherNodes(Element pParentE, String[] pAllowedChildNodes) throws CIMXMLParseException { NodeList nl = pParentE.getChildNodes(); if (nl == null || nl.getLength() == 0) return; for (int i = 0; i < nl.getLength(); i++) { @@ -3554,15 +3641,15 @@ private static void checkOtherNodes(Element pParentE, String[] pAllowedChildNode break; } } - if (!found && NODENAME_HASH.containsKey(name)) throw new CIMXMLParseException(pParentE - .getNodeName() - + " element contains invalid child element " + name + "!"); + if (!found && NODENAME_HASH.containsKey(name)) throw new CIMXMLParseException( + pParentE.getNodeName() + " element contains invalid child element " + name + "!" + ); } } /** * searchNodes - * + * * @param pParentE * @param pTagName * @return Element[] @@ -3584,7 +3671,7 @@ public static Element[] searchNodes(Element pParentE, String pTagName) { /** * searchNodes - * + * * @param pParentE * @param pTagName * @param pMin @@ -3593,14 +3680,15 @@ public static Element[] searchNodes(Element pParentE, String pTagName) { * @return Element[] * @throws CIMXMLParseException */ - public static Element[] searchNodes(Element pParentE, String pTagName, int pMin, int pMax, - boolean pAllowOtherNodes) throws CIMXMLParseException { + public static Element[] searchNodes(Element pParentE, String pTagName, int pMin, int pMax, boolean pAllowOtherNodes) + throws CIMXMLParseException { // return all child nodes immediately below parent, null if none found NodeList nl = pParentE.getChildNodes(); if (nl == null || nl.getLength() == 0) { - if (pMin > 0) throw new CIMXMLParseException(pParentE.getNodeName() - + " element must have at least " + pMin + " " + pTagName + " child element(s)!"); + if (pMin > 0) throw new CIMXMLParseException( + pParentE.getNodeName() + " element must have at least " + pMin + " " + pTagName + " child element(s)!" + ); return null; } @@ -3616,13 +3704,20 @@ public static Element[] searchNodes(Element pParentE, String pTagName, int pMin, } } - if (resElementV.size() < pMin) throw new CIMXMLParseException(pParentE.getNodeName() - + " element must have at least " + pMin + " " + pTagName + " child element(s)!"); - if (resElementV.size() > pMax) throw new CIMXMLParseException(pParentE.getNodeName() - + " element can have no more than " + pMax + " " + pTagName + " child element(s)!"); + if (resElementV.size() < pMin) throw new CIMXMLParseException( + pParentE.getNodeName() + " element must have at least " + pMin + " " + pTagName + " child element(s)!" + ); + if (resElementV.size() > pMax) throw new CIMXMLParseException( + pParentE.getNodeName() + " element can have no more than " + pMax + " " + pTagName + " child element(s)!" + ); if (resElementV.size() > 0 && !pAllowOtherNodes && otherNode != null) throw new CIMXMLParseException( - pParentE.getNodeName() + " element cannot have " + otherNode - + " child element(s) when it already has " + pTagName + " element(s)!"); + pParentE.getNodeName() + + " element cannot have " + + otherNode + + " child element(s) when it already has " + + pTagName + + " element(s)!" + ); if (resElementV.size() == 0) return null; return resElementV.toArray(new Element[0]); @@ -3630,7 +3725,7 @@ public static Element[] searchNodes(Element pParentE, String pTagName, int pMin, /** * searchFirstNode - * + * * @param pParentE * @param pTagName * @return Node @@ -3641,14 +3736,16 @@ public static Node searchFirstNode(Element pParentE, String pTagName) { NodeList nl = pParentE.getChildNodes(); for (int i = 0; i < nl.getLength(); i++) { Node n = nl.item(i); - if (n.getNodeName().equals(pTagName)) { return n; } + if (n.getNodeName().equals(pTagName)) { + return n; + } } return null; } /** * searchAttribute - * + * * @param pParentN * @param pAttrName * @return Node @@ -3661,7 +3758,7 @@ public static Node searchAttribute(Node pParentN, String pAttrName) { /** * searchFirstChild - * + * * @param pParentE * @return Node */ @@ -3673,14 +3770,13 @@ public static Node searchFirstChild(Element pParentE) { /** * createJavaObject - * + * * @param pTypeStr * @param pValue * @return Object * @throws CIMXMLParseException */ - public static Object createJavaObject(String pTypeStr, String pValue) - throws CIMXMLParseException { + public static Object createJavaObject(String pTypeStr, String pValue) throws CIMXMLParseException { // return a java object with the specific type if (pTypeStr == null) pTypeStr = MOF.DT_STR; if (MOF.NULL.equalsIgnoreCase(pTypeStr)) return null; @@ -3692,8 +3788,8 @@ public static Object createJavaObject(String pTypeStr, String pValue) pValue = pValue.toLowerCase(); if (pValue.startsWith("0x") || pValue.startsWith("+0x") || pValue.startsWith("-0x")) { radix = 16; - if (pValue.startsWith("-")) pValue = "-" + pValue.substring(3); - else pValue = pValue.substring(pValue.indexOf('x') + 1); + if (pValue.startsWith("-")) pValue = "-" + pValue.substring(3); else pValue = + pValue.substring(pValue.indexOf('x') + 1); } } @@ -3734,7 +3830,8 @@ public static Object createJavaObject(String pTypeStr, String pValue) case CIMDataType.REAL64: if (WBEMConfiguration.getGlobalConfiguration().verifyJavaLangDoubleStrings()) { if (Util.isBadDoubleString(pValue)) throw new IllegalArgumentException( - "Double value string hangs older JVMs!\n" + pValue); + "Double value string hangs older JVMs!\n" + pValue + ); } o = new Double(pValue); break; @@ -3760,16 +3857,23 @@ private static CIMDateTime getDateTime(String pValue) throws CIMXMLParseExceptio try { return new CIMDateTimeInterval(pValue); } catch (IllegalArgumentException eInt) { - throw new CIMXMLParseException("Failed to parse dateTime string: " + pValue + "!\n" - + "CIMDateTimeAbsolute parsing error:\n" + eAbs.getMessage() + "\n" - + "CIMDateTimeInterval parsing error:\n" + eInt.getMessage()); + throw new CIMXMLParseException( + "Failed to parse dateTime string: " + + pValue + + "!\n" + + "CIMDateTimeAbsolute parsing error:\n" + + eAbs.getMessage() + + "\n" + + "CIMDateTimeInterval parsing error:\n" + + eInt.getMessage() + ); } } } /** * parseSIMPLEEXPRSP - * + * * @param pSimpleExpRspE * @return CIMResponse * @throws CIMXMLParseException @@ -3781,13 +3885,12 @@ public static CIMResponse parseSIMPLEEXPRSP(Element pSimpleExpRspE) throws CIMXM Element[] expmethodresponseA = searchNodes(pSimpleExpRspE, "EXPMETHODRESPONSE", 1, 1, false); if (expmethodresponseA != null) return parseEXPMETHODRESPONSE(expmethodresponseA[0]); - throw new CIMXMLParseException( - "SIMPLEEXPRSP element missing EXPMETHODRESPONSE child element!"); + throw new CIMXMLParseException("SIMPLEEXPRSP element missing EXPMETHODRESPONSE child element!"); } /** * parseMULTIEXPRSP - * + * * @param pMultiExpRspE * @return CIMResponse * @throws CIMXMLParseException @@ -3795,8 +3898,7 @@ public static CIMResponse parseSIMPLEEXPRSP(Element pSimpleExpRspE) throws CIMXM public static CIMResponse parseMULTIEXPRSP(Element pMultiExpRspE) throws CIMXMLParseException { // - Element[] multiExpRespElementA = searchNodes(pMultiExpRspE, "SIMPLEEXPRSP", 2, - Integer.MAX_VALUE, false); + Element[] multiExpRespElementA = searchNodes(pMultiExpRspE, "SIMPLEEXPRSP", 2, Integer.MAX_VALUE, false); if (multiExpRespElementA != null) { CIMResponse multiExpRsp = new CIMResponse(); for (int i = 0; i < multiExpRespElementA.length; i++) { @@ -3815,19 +3917,19 @@ public static CIMResponse parseMULTIEXPRSP(Element pMultiExpRspE) throws CIMXMLP /** * parseEXPMETHODRESPONSE - * + * * @param pExpMethodResponseE * @return CIMResponse * @throws CIMXMLParseException */ - public static CIMResponse parseEXPMETHODRESPONSE(Element pExpMethodResponseE) - throws CIMXMLParseException { + public static CIMResponse parseEXPMETHODRESPONSE(Element pExpMethodResponseE) throws CIMXMLParseException { // CIMResponse response = new CIMResponse(); if (attribute(pExpMethodResponseE, "NAME") == null) throw new CIMXMLParseException( - "EXPMETHODRESPONSE element missing NAME attribute!"); + "EXPMETHODRESPONSE element missing NAME attribute!" + ); // ERROR Element[] errorA = searchNodes(pExpMethodResponseE, "ERROR", 0, 1, false); @@ -3856,7 +3958,7 @@ public static CIMResponse parseEXPMETHODRESPONSE(Element pExpMethodResponseE) /** * parseCORRELATOR - * + * * @param pCorrelatorE * @throws CIMXMLParseException * */ @@ -3864,11 +3966,9 @@ public static void parseCORRELATOR(Element pCorrelatorE) throws CIMXMLParseExcep // // String name = attribute(pCorrelatorE, "NAME"); - if (name == null) throw new CIMXMLParseException( - "CORRELATOR element missing NAME attribute!"); + if (name == null) throw new CIMXMLParseException("CORRELATOR element missing NAME attribute!"); String type = attribute(pCorrelatorE, "TYPE"); - if (type == null) throw new CIMXMLParseException( - "CORRELATOR element missing TYPE attribute!"); + if (type == null) throw new CIMXMLParseException("CORRELATOR element missing TYPE attribute!"); // VALUE Element[] valueA = searchNodes(pCorrelatorE, "VALUE", 1, 1, false); diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/CimXmlSerializer.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/CimXmlSerializer.java index 3b34eb7..1cd1c92 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/CimXmlSerializer.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/CimXmlSerializer.java @@ -48,7 +48,6 @@ import java.io.OutputStream; import java.io.OutputStreamWriter; import java.nio.charset.Charset; - import org.metricshub.wbem.sblim.cimclient.internal.util.WBEMConstants; import org.w3c.dom.Document; import org.w3c.dom.NamedNodeMap; @@ -58,35 +57,33 @@ * Class CimXmlSerializer implements a XML serializer for DOM documents that is * specialized for CIM-XML. It might not be used as a general purpose serializer * since it doesn't support any DOM or XML features not required by CIM-XML. - * + * */ public class CimXmlSerializer { /** * Class XmlWriter implements a writer on an output stream that escapes XML * values according to the CIM-XML requirements. - * + * */ private static class XmlWriter { - private BufferedWriter iWriter; /** * Ctor. - * + * * @param pOut * The output stream the serialized document is written to * @param pCharsetName * The encoding the use for the output stream */ public XmlWriter(OutputStream pOut, String pCharsetName) { - this.iWriter = new BufferedWriter(new OutputStreamWriter(pOut, Charset.forName( - pCharsetName).newEncoder())); + this.iWriter = new BufferedWriter(new OutputStreamWriter(pOut, Charset.forName(pCharsetName).newEncoder())); } /** * Writes text to the stream - * + * * @param pText * The text * @throws IOException @@ -97,7 +94,7 @@ public void write(String pText) throws IOException { /** * Closes the stream - * + * * @throws IOException */ public void close() throws IOException { @@ -106,7 +103,7 @@ public void close() throws IOException { /** * Flushes the buffer to the stream - * + * * @throws IOException */ public void flush() throws IOException { @@ -160,23 +157,25 @@ public void flush() throws IOException { * * * - * + * * @param pText * The text * @throws IOException */ public void writeValue(final String pText) throws IOException { - if (pText == null) { return; } + if (pText == null) { + return; + } boolean escapeSpace = true; final int oneBeforeLast = pText.length() - 2; for (int i = 0; i < pText.length(); ++i) { - char currentChar = pText.charAt(i); boolean isSpace = false; if (isHighSurrogate(currentChar)) { - if (i > oneBeforeLast || !isLowSurrogate(pText.charAt(i + 1))) { throw new IOException( - "Illegal Unicode character"); } + if (i > oneBeforeLast || !isLowSurrogate(pText.charAt(i + 1))) { + throw new IOException("Illegal Unicode character"); + } this.iWriter.write(pText, i++, 2); } else if (currentChar < ' ') { writeAsHex(currentChar); @@ -220,15 +219,12 @@ private void writeAsHex(char pChar) throws IOException { } private boolean isHighSurrogate(char pChar) { - return pChar >= WBEMConstants.UTF16_MIN_HIGH_SURROGATE - && pChar <= WBEMConstants.UTF16_MAX_HIGH_SURROGATE; + return pChar >= WBEMConstants.UTF16_MIN_HIGH_SURROGATE && pChar <= WBEMConstants.UTF16_MAX_HIGH_SURROGATE; } private boolean isLowSurrogate(char pChar) { - return pChar >= WBEMConstants.UTF16_MIN_LOW_SURROGATE - && pChar <= WBEMConstants.UTF16_MAX_LOW_SURROGATE; + return pChar >= WBEMConstants.UTF16_MIN_LOW_SURROGATE && pChar <= WBEMConstants.UTF16_MAX_LOW_SURROGATE; } - } private boolean iPretty; @@ -252,7 +248,7 @@ private CimXmlSerializer(boolean pPretty) { * and then serializes the document node. If you want to suppress this * header just call {@link #serialize(OutputStream, Node, boolean)} on the * document node. - * + * * @param pOS * The output stream * @param pDoc @@ -263,9 +259,7 @@ private CimXmlSerializer(boolean pPretty) { * @throws IOException * Whenever something goes wrong */ - public static void serialize(OutputStream pOS, Document pDoc, boolean pPretty) - throws IOException { - + public static void serialize(OutputStream pOS, Document pDoc, boolean pPretty) throws IOException { try { XmlWriter writer = new XmlWriter(pOS, WBEMConstants.UTF8); writer.write("\n"); @@ -280,7 +274,7 @@ public static void serialize(OutputStream pOS, Document pDoc, boolean pPretty) /** * Serializes a given DOM node as (CIM-)XML to a given output stream - * + * * @param pOS * The output stream * @param pNode @@ -292,7 +286,6 @@ public static void serialize(OutputStream pOS, Document pDoc, boolean pPretty) * Whenever something goes wrong */ public static void serialize(OutputStream pOS, Node pNode, boolean pPretty) throws IOException { - try { XmlWriter writer = new XmlWriter(pOS, WBEMConstants.UTF8); new CimXmlSerializer(pPretty).serializeNode(writer, pNode); @@ -369,7 +362,9 @@ private void serializeNode(XmlWriter pWriter, Node pNode) throws IOException { int end = value.indexOf(this.CDATA_END, idx); // invalid CDATA - if (end == -1) { throw new IOException("CDATA section not closed: " + value); } + if (end == -1) { + throw new IOException("CDATA section not closed: " + value); + } // write CDATA (not escaped) pWriter.write(value.substring(idx, end + this.CDATA_END.length())); @@ -380,7 +375,9 @@ private void serializeNode(XmlWriter pWriter, Node pNode) throws IOException { } private String indent() { - if (!this.iPretty) { return ""; } + if (!this.iPretty) { + return ""; + } StringBuffer result = new StringBuffer(); result.append('\n'); for (int i = 0; i < this.iIndent; ++i) { diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/LocalPathBuilder.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/LocalPathBuilder.java index 9b16f2a..11402e0 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/LocalPathBuilder.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/LocalPathBuilder.java @@ -47,12 +47,11 @@ * Class LocalPathBuilder helps CIM-XML parsers to build local CIMObjectPathes. */ public class LocalPathBuilder { - private CIMObjectPath iBasePath; /** * Ctor. - * + * * @param pBasePath */ public LocalPathBuilder(CIMObjectPath pBasePath) { @@ -61,7 +60,7 @@ public LocalPathBuilder(CIMObjectPath pBasePath) { /** * getBasePath - * + * * @return CIMObjectPath */ public CIMObjectPath getBasePath() { @@ -70,7 +69,7 @@ public CIMObjectPath getBasePath() { /** * build - * + * * @param pObjPathStr * @return CIMObjectPath */ @@ -80,7 +79,7 @@ public CIMObjectPath build(String pObjPathStr) { /** * build - * + * * @param pObjName * @param pNameSpace * @return CIMObjectPath @@ -91,7 +90,7 @@ public CIMObjectPath build(String pObjName, String pNameSpace) { /** * build - * + * * @param pObjName * @param pNameSpace * @param pKeys @@ -103,21 +102,20 @@ public CIMObjectPath build(String pObjName, String pNameSpace, CIMProperty[] /** * build - * + * * @param pHost * @param pNameSpace * @param pObjName * @param pKeys * @return CIMObjectPath */ - public CIMObjectPath build(String pHost, String pNameSpace, String pObjName, - CIMProperty[] pKeys) { + public CIMObjectPath build(String pHost, String pNameSpace, String pObjName, CIMProperty[] pKeys) { return build(this.iBasePath, pHost, pNameSpace, pObjName, pKeys); } /** * build - * + * * @param pScheme * @param pHost * @param pPort @@ -126,27 +124,40 @@ public CIMObjectPath build(String pHost, String pNameSpace, String pObjName, * @param pKeys * @return CIMObjectPath */ - public CIMObjectPath build(String pScheme, String pHost, String pPort, String pNameSpace, - String pObjName, CIMProperty[] pKeys) { + public CIMObjectPath build( + String pScheme, + String pHost, + String pPort, + String pNameSpace, + String pObjName, + CIMProperty[] pKeys + ) { return build(this.iBasePath, pScheme, pHost, pPort, pNameSpace, pObjName, pKeys); } /** * build - * + * * @param pBasePath * @param pObjPathStr * @return CIMObjectPath */ public static CIMObjectPath build(CIMObjectPath pBasePath, String pObjPathStr) { CIMObjectPath path = new CIMObjectPath(pObjPathStr); - return build(pBasePath, path.getScheme(), path.getHost(), path.getPort(), path - .getNamespace(), path.getObjectName(), path.getKeys()); + return build( + pBasePath, + path.getScheme(), + path.getHost(), + path.getPort(), + path.getNamespace(), + path.getObjectName(), + path.getKeys() + ); } /** * build - * + * * @param pBasePath * @param pObjName * @param pNameSpace @@ -158,21 +169,25 @@ public static CIMObjectPath build(CIMObjectPath pBasePath, String pObjName, Stri /** * build - * + * * @param pBasePath * @param pObjName * @param pNameSpace * @param pKeys * @return CIMObjectPath */ - public static CIMObjectPath build(CIMObjectPath pBasePath, String pObjName, String pNameSpace, - CIMProperty[] pKeys) { + public static CIMObjectPath build( + CIMObjectPath pBasePath, + String pObjName, + String pNameSpace, + CIMProperty[] pKeys + ) { return build(pBasePath, null, null, null, pNameSpace, pObjName, pKeys); } /** * build - * + * * @param pBasePath * @param pHost * @param pNameSpace @@ -180,14 +195,19 @@ public static CIMObjectPath build(CIMObjectPath pBasePath, String pObjName, Stri * @param pKeys * @return CIMObjectPath */ - public static CIMObjectPath build(CIMObjectPath pBasePath, String pHost, String pNameSpace, - String pObjName, CIMProperty[] pKeys) { + public static CIMObjectPath build( + CIMObjectPath pBasePath, + String pHost, + String pNameSpace, + String pObjName, + CIMProperty[] pKeys + ) { return build(pBasePath, null, pHost, null, pNameSpace, pObjName, pKeys); } /** * build - * + * * @param pBasePath * @param pScheme * @param pHost @@ -197,16 +217,24 @@ public static CIMObjectPath build(CIMObjectPath pBasePath, String pHost, String * @param pKeys * @return CIMObjectPath */ - public static CIMObjectPath build(CIMObjectPath pBasePath, String pScheme, String pHost, - String pPort, String pNameSpace, String pObjName, CIMProperty[] pKeys) { - if (pBasePath == null) return new CIMObjectPath(pScheme, pHost, pPort, pNameSpace, - pObjName, pKeys); - return new CIMObjectPath(pScheme == null ? pBasePath.getScheme() : pScheme, - pHost == null ? pBasePath.getHost() : pHost, pPort == null ? pBasePath.getPort() - : pPort, pNameSpace == null ? pBasePath.getNamespace() : pNameSpace, - pObjName == null ? pBasePath.getObjectName() : pObjName, pKeys // local - // objectpath shouldn't contain keys + public static CIMObjectPath build( + CIMObjectPath pBasePath, + String pScheme, + String pHost, + String pPort, + String pNameSpace, + String pObjName, + CIMProperty[] pKeys + ) { + if (pBasePath == null) return new CIMObjectPath(pScheme, pHost, pPort, pNameSpace, pObjName, pKeys); + return new CIMObjectPath( + pScheme == null ? pBasePath.getScheme() : pScheme, + pHost == null ? pBasePath.getHost() : pHost, + pPort == null ? pBasePath.getPort() : pPort, + pNameSpace == null ? pBasePath.getNamespace() : pNameSpace, + pObjName == null ? pBasePath.getObjectName() : pObjName, + pKeys // local + // objectpath shouldn't contain keys ); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/TypedValue.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/TypedValue.java index 6a98cef..aaadb82 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/TypedValue.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/TypedValue.java @@ -43,17 +43,16 @@ /** * Class TypedValue is required for the CIM-XML DOM parser. - * + * */ public class TypedValue { - private CIMDataType iType; private Object iValue; /** * Ctor. - * + * * @param pType * @param pValue */ @@ -64,7 +63,7 @@ public TypedValue(CIMDataType pType, Object pValue) { /** * getType - * + * * @return CIMDataType */ public CIMDataType getType() { @@ -73,11 +72,10 @@ public CIMDataType getType() { /** * getValue - * + * * @return Object */ public Object getValue() { return this.iValue; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/CIMObjectFactory.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/CIMObjectFactory.java index e3bc52a..417d268 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/CIMObjectFactory.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/CIMObjectFactory.java @@ -54,13 +54,19 @@ import java.io.ByteArrayInputStream; import java.util.ArrayList; import java.util.HashMap; - +import javax.xml.parsers.SAXParser; +import javax.xml.parsers.SAXParserFactory; import org.metricshub.wbem.javax.cim.CIMClass; import org.metricshub.wbem.javax.cim.CIMDataType; +import org.metricshub.wbem.javax.cim.CIMDateTime; import org.metricshub.wbem.javax.cim.CIMDateTimeAbsolute; import org.metricshub.wbem.javax.cim.CIMDateTimeInterval; import org.metricshub.wbem.javax.cim.CIMInstance; import org.metricshub.wbem.javax.cim.CIMObjectPath; +import org.metricshub.wbem.javax.cim.UnsignedInteger16; +import org.metricshub.wbem.javax.cim.UnsignedInteger32; +import org.metricshub.wbem.javax.cim.UnsignedInteger64; +import org.metricshub.wbem.javax.cim.UnsignedInteger8; import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node.ClassNode; import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node.InstanceNode; import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node.Node; @@ -69,14 +75,6 @@ import org.metricshub.wbem.sblim.cimclient.internal.util.MOF; import org.metricshub.wbem.sblim.cimclient.internal.util.Util; import org.metricshub.wbem.sblim.cimclient.internal.util.WBEMConfiguration; -import org.metricshub.wbem.javax.cim.CIMDateTime; -import org.metricshub.wbem.javax.cim.UnsignedInteger16; -import org.metricshub.wbem.javax.cim.UnsignedInteger32; -import org.metricshub.wbem.javax.cim.UnsignedInteger64; -import org.metricshub.wbem.javax.cim.UnsignedInteger8; -import javax.xml.parsers.SAXParser; -import javax.xml.parsers.SAXParserFactory; - import org.xml.sax.SAXException; /** @@ -87,30 +85,30 @@ public class CIMObjectFactory { /** * getEmbbeddedObjectA - * + * * @param pType * @param pValueArrayNode * @param pSession * @return CIMInstance[], CIMClass[], String[] or null * @throws SAXException */ - public static Object[] getEmbeddedObjA(CIMDataType pType, ValueArrayNode pValueArrayNode, - SAXSession pSession) throws SAXException { + public static Object[] getEmbeddedObjA(CIMDataType pType, ValueArrayNode pValueArrayNode, SAXSession pSession) + throws SAXException { if (pValueArrayNode == null) return null; return getEmbeddedObjA(pType, (String[]) pValueArrayNode.getValue(), pSession); } /** * getEmbeddedObjectA - * + * * @param pType * @param pValueStrA * @param pSession * @return CIMInstance[], CIMClass[], String[] or null * @throws SAXException */ - public static Object[] getEmbeddedObjA(CIMDataType pType, String[] pValueStrA, - SAXSession pSession) throws SAXException { + public static Object[] getEmbeddedObjA(CIMDataType pType, String[] pValueStrA, SAXSession pSession) + throws SAXException { embeddedObjTypeCheck(pType); if (pValueStrA == null || pValueStrA.length == 0) return null; CIMDataType type = null; @@ -122,35 +120,36 @@ public static Object[] getEmbeddedObjA(CIMDataType pType, String[] pValueStrA, } else { CIMDataType type2 = getCIMObjScalarType(obj, false); if (type2 != null && type != type2) throw new SAXException( - "Embedded Object array contains both Instance and Class objects. " - + "This is not handled!"); + "Embedded Object array contains both Instance and Class objects. " + "This is not handled!" + ); } objAL.add(obj); } if (type == CIMDataType.OBJECT_T) { return objAL.toArray(EMPTY_INST_A); - } else if (type == CIMDataType.CLASS_T) { return objAL.toArray(EMPTY_CLASS_A); } + } else if (type == CIMDataType.CLASS_T) { + return objAL.toArray(EMPTY_CLASS_A); + } return objAL.toArray(EMPTY_STR_A); } /** * getEmbeddedObject - * + * * @param pType * @param pValueStr * @param pSession * @return CIMInstance, CIMClass or null * @throws SAXException */ - public static Object getEmbeddedObj(CIMDataType pType, String pValueStr, SAXSession pSession) - throws SAXException { + public static Object getEmbeddedObj(CIMDataType pType, String pValueStr, SAXSession pSession) throws SAXException { embeddedObjTypeCheck(pType); return parseEmbeddedObj(pValueStr, pSession); } /** * getEmbeddedObj - * + * * @param pType * @param pValObj * @param pSession @@ -158,9 +157,10 @@ public static Object getEmbeddedObj(CIMDataType pType, String pValueStr, SAXSess * String[] or null * @throws SAXException */ - public static Object getEmbeddedObj(CIMDataType pType, Object pValObj, SAXSession pSession) - throws SAXException { - if (pValObj instanceof String) { return getEmbeddedObj(pType, (String) pValObj, pSession); } + public static Object getEmbeddedObj(CIMDataType pType, Object pValObj, SAXSession pSession) throws SAXException { + if (pValObj instanceof String) { + return getEmbeddedObj(pType, (String) pValObj, pSession); + } return getEmbeddedObjA(pType, (String[]) pValObj, pSession); } @@ -178,7 +178,7 @@ public static Object[] getObjectArray(CIMDataType pType, ArrayList pAL) /** * getObject - * + * * @param pType * @param pValueStr * @return Object @@ -197,7 +197,7 @@ public static Object getObject(CIMDataType pType, String pValueStr) throws SAXEx /** * getObject - * + * * @param pType * @param pValueNode * @return Object @@ -210,43 +210,42 @@ public static Object getObject(CIMDataType pType, ValueNode pValueNode) throws S /** * getObject - * + * * @param pType * @param pValueArrayNode * @return Object * @throws SAXException */ - public static Object getObject(CIMDataType pType, ValueArrayNode pValueArrayNode) - throws SAXException { + public static Object getObject(CIMDataType pType, ValueArrayNode pValueArrayNode) throws SAXException { if (pValueArrayNode == null) return null; ArrayList objAL = new ArrayList(pValueArrayNode.size()); - for (int i = 0; i < pValueArrayNode.size(); i++) - objAL.add(getObject(pType, (String) pValueArrayNode.elementAt(i))); + for (int i = 0; i < pValueArrayNode.size(); i++) objAL.add(getObject(pType, (String) pValueArrayNode.elementAt(i))); return getObjectArray(pType, objAL); } /** * getCIMObjType - * + * * @param pObj * @param pNullToString * @return CIMDataType OBJECT_T, CLASS_T, STRING_T * @throws SAXException */ - public static CIMDataType getCIMObjScalarType(Object pObj, boolean pNullToString) - throws SAXException { + public static CIMDataType getCIMObjScalarType(Object pObj, boolean pNullToString) throws SAXException { if (pObj == null) return pNullToString ? CIMDataType.STRING_T : null; if (pObj instanceof CIMInstance) { return CIMDataType.OBJECT_T; } else if (pObj instanceof CIMClass) { return CIMDataType.CLASS_T; - } else if (pObj instanceof String) { return CIMDataType.STRING_T; } + } else if (pObj instanceof String) { + return CIMDataType.STRING_T; + } throw new SAXException(pObj.getClass().getName() + " is not a CIMObject!"); } /** * getCIMObjType - * + * * @param pObj * @return CIMDataType OBJECT_T, OBJECT_ARRAY_T * @throws SAXException @@ -257,7 +256,7 @@ public static CIMDataType getCIMObjScalarType(Object pObj) throws SAXException { /** * getCIMObjArrayType - * + * * @param pObj * @return CIMDataType: OBJECT_ARRAY_T, CLASS_T array, STRING_ARRAY_T * @throws SAXException @@ -268,27 +267,28 @@ public static CIMDataType getCIMObjArrayType(Object pObj) throws SAXException { /** * getArrayCIMObjType - * + * * @param pObj * @param pNullToString * @return CIMDataType: OBJECT_ARRAY_T, CLASS_T array, STRING_ARRAY_T or * null * @throws SAXException */ - public static CIMDataType getCIMObjArrayType(Object pObj, boolean pNullToString) - throws SAXException { + public static CIMDataType getCIMObjArrayType(Object pObj, boolean pNullToString) throws SAXException { if (pObj == null) return pNullToString ? CIMDataType.STRING_ARRAY_T : null; if (pObj instanceof CIMInstance[]) { return CIMDataType.OBJECT_ARRAY_T; } else if (pObj instanceof CIMClass[]) { return CIMDataType.CLASS_ARRAY_T; - } else if (pObj instanceof String[]) { return CIMDataType.STRING_ARRAY_T; } + } else if (pObj instanceof String[]) { + return CIMDataType.STRING_ARRAY_T; + } throw new SAXException(pObj.getClass().getName() + " is not a CIMObject array!"); } /** * getType - * + * * @param pTypeStr * @return CIMDataType * @throws SAXException @@ -297,8 +297,7 @@ public static CIMDataType getType(String pTypeStr) throws SAXException { if (pTypeStr == null) return null; createTypeStrMap(); CIMDataType type = cTypeStrMap.get(pTypeStr); - if (type == null && !cTypeStrMap.containsKey(pTypeStr)) throw new SAXException(pTypeStr - + " is invalid PARAMTYPE!"); + if (type == null && !cTypeStrMap.containsKey(pTypeStr)) throw new SAXException(pTypeStr + " is invalid PARAMTYPE!"); return type; } @@ -338,11 +337,11 @@ public static CIMDataType getType(String pTypeStr) throws SAXException { private static void embeddedObjTypeCheck(CIMDataType pType) throws SAXException { if (pType.getType() != CIMDataType.STRING) throw new SAXException( - "TYPE attribute should be 'string' for EmbeddedObjects!"); + "TYPE attribute should be 'string' for EmbeddedObjects!" + ); } - private static Object parseEmbeddedObj(String pValueStr, SAXSession pSession) - throws SAXException { + private static Object parseEmbeddedObj(String pValueStr, SAXSession pSession) throws SAXException { if (pValueStr == null || pValueStr.length() == 0) return null; XMLDefaultHandlerImpl ourHandler = new XMLDefaultHandlerImpl(pSession, true); // XML String of embedded Object is parsed by the SAX parser @@ -356,15 +355,18 @@ private static Object parseEmbeddedObj(String pValueStr, SAXSession pSession) throw new SAXException("Exception occurred during embedded object parsing!", e); } Node node = ourHandler.getRootNode(); - if (node instanceof InstanceNode) { return ((InstanceNode) node).getCIMInstance(); } - if (node instanceof ClassNode) { return ((ClassNode) node).getCIMClass(); } - throw new SAXException(node.getNodeName() - + " root element is unexpected for Embedded Object XML String!"); + if (node instanceof InstanceNode) { + return ((InstanceNode) node).getCIMInstance(); + } + if (node instanceof ClassNode) { + return ((ClassNode) node).getCIMClass(); + } + throw new SAXException(node.getNodeName() + " root element is unexpected for Embedded Object XML String!"); } private static HashMap cTypeStrMap; - private synchronized static void createTypeStrMap() { + private static synchronized void createTypeStrMap() { if (cTypeStrMap != null) return; cTypeStrMap = new HashMap(); cTypeStrMap.put(MOF.DT_UINT8, CIMDataType.UINT8_T); @@ -385,10 +387,9 @@ private synchronized static void createTypeStrMap() { } private interface ValueFactory { - /** * make - * + * * @param pStr * @return Object */ @@ -396,7 +397,7 @@ private interface ValueFactory { /** * make - * + * * @param pAL * @return Object[] */ @@ -409,182 +410,229 @@ private static void putFactory(int pTypeCode, ValueFactory pFactory) { cValFactoryA[pTypeCode] = pFactory; } - private synchronized static void createValFactoryA() { + private static synchronized void createValFactoryA() { if (cValFactoryA != null) return; cValFactoryA = new ValueFactory[64]; // unsigned integers - putFactory(CIMDataType.UINT8, new ValueFactory() { + putFactory( + CIMDataType.UINT8, + new ValueFactory() { - public Object make(String pStr) { - return new UnsignedInteger8(pStr); - } + public Object make(String pStr) { + return new UnsignedInteger8(pStr); + } - public Object[] make(ArrayList pAL) { - return pAL.toArray(EMPTY_UINT8_A); + public Object[] make(ArrayList pAL) { + return pAL.toArray(EMPTY_UINT8_A); + } } - }); - putFactory(CIMDataType.UINT16, new ValueFactory() { + ); + putFactory( + CIMDataType.UINT16, + new ValueFactory() { - public Object make(String pStr) { - return new UnsignedInteger16(pStr); - } + public Object make(String pStr) { + return new UnsignedInteger16(pStr); + } - public Object[] make(ArrayList pAL) { - return pAL.toArray(EMPTY_UINT16_A); + public Object[] make(ArrayList pAL) { + return pAL.toArray(EMPTY_UINT16_A); + } } - }); - putFactory(CIMDataType.UINT32, new ValueFactory() { + ); + putFactory( + CIMDataType.UINT32, + new ValueFactory() { - public Object make(String pStr) { - return new UnsignedInteger32(pStr); - } + public Object make(String pStr) { + return new UnsignedInteger32(pStr); + } - public Object[] make(ArrayList pAL) { - return pAL.toArray(EMPTY_UINT32_A); + public Object[] make(ArrayList pAL) { + return pAL.toArray(EMPTY_UINT32_A); + } } - }); - putFactory(CIMDataType.UINT64, new ValueFactory() { + ); + putFactory( + CIMDataType.UINT64, + new ValueFactory() { - public Object make(String pStr) { - return new UnsignedInteger64(pStr); - } + public Object make(String pStr) { + return new UnsignedInteger64(pStr); + } - public Object[] make(ArrayList pAL) { - return pAL.toArray(EMPTY_UINT64_A); + public Object[] make(ArrayList pAL) { + return pAL.toArray(EMPTY_UINT64_A); + } } - }); + ); // signed integers - putFactory(CIMDataType.SINT8, new ValueFactory() { + putFactory( + CIMDataType.SINT8, + new ValueFactory() { - public Object make(String pStr) { - return new Byte(pStr); - } + public Object make(String pStr) { + return new Byte(pStr); + } - public Object[] make(ArrayList pAL) { - return pAL.toArray(EMPTY_BYTE_A); + public Object[] make(ArrayList pAL) { + return pAL.toArray(EMPTY_BYTE_A); + } } - }); - putFactory(CIMDataType.SINT16, new ValueFactory() { + ); + putFactory( + CIMDataType.SINT16, + new ValueFactory() { - public Object make(String pStr) { - return new Short(pStr); - } + public Object make(String pStr) { + return new Short(pStr); + } - public Object[] make(ArrayList pAL) { - return pAL.toArray(EMPTY_SHORT_A); + public Object[] make(ArrayList pAL) { + return pAL.toArray(EMPTY_SHORT_A); + } } - }); - putFactory(CIMDataType.SINT32, new ValueFactory() { + ); + putFactory( + CIMDataType.SINT32, + new ValueFactory() { - public Object make(String pStr) { - return new Integer(pStr); - } + public Object make(String pStr) { + return new Integer(pStr); + } - public Object[] make(ArrayList pAL) { - return pAL.toArray(EMPTY_INT_A); + public Object[] make(ArrayList pAL) { + return pAL.toArray(EMPTY_INT_A); + } } - }); - putFactory(CIMDataType.SINT64, new ValueFactory() { + ); + putFactory( + CIMDataType.SINT64, + new ValueFactory() { - public Object make(String pStr) { - return new Long(pStr); - } + public Object make(String pStr) { + return new Long(pStr); + } - public Object[] make(ArrayList pAL) { - return pAL.toArray(EMPTY_LONG_A); + public Object[] make(ArrayList pAL) { + return pAL.toArray(EMPTY_LONG_A); + } } - }); + ); // floats - putFactory(CIMDataType.REAL32, new ValueFactory() { - - public Object make(String pStr) { - return new Float(pStr); - } + putFactory( + CIMDataType.REAL32, + new ValueFactory() { - public Object[] make(ArrayList pAL) { - return pAL.toArray(EMPTY_FLOAT_A); - } - }); - putFactory(CIMDataType.REAL64, new ValueFactory() { + public Object make(String pStr) { + return new Float(pStr); + } - public Object make(String pStr) { - if (WBEMConfiguration.getGlobalConfiguration().verifyJavaLangDoubleStrings()) { - if (Util.isBadDoubleString(pStr)) throw new IllegalArgumentException( - "Double value string hangs older JVMs!\n" + pStr); + public Object[] make(ArrayList pAL) { + return pAL.toArray(EMPTY_FLOAT_A); } - return new Double(pStr); } + ); + putFactory( + CIMDataType.REAL64, + new ValueFactory() { + + public Object make(String pStr) { + if (WBEMConfiguration.getGlobalConfiguration().verifyJavaLangDoubleStrings()) { + if (Util.isBadDoubleString(pStr)) throw new IllegalArgumentException( + "Double value string hangs older JVMs!\n" + pStr + ); + } + return new Double(pStr); + } - public Object[] make(ArrayList pAL) { - return pAL.toArray(EMPTY_DOUBLE_A); + public Object[] make(ArrayList pAL) { + return pAL.toArray(EMPTY_DOUBLE_A); + } } - }); + ); // char - putFactory(CIMDataType.CHAR16, new ValueFactory() { - - public Object make(String pStr) { - if (pStr == null || pStr.length() == 0) throw new IllegalArgumentException( - "Cannot make Character from empty String!"); - return Character.valueOf(pStr.charAt(0)); - } + putFactory( + CIMDataType.CHAR16, + new ValueFactory() { + + public Object make(String pStr) { + if (pStr == null || pStr.length() == 0) throw new IllegalArgumentException( + "Cannot make Character from empty String!" + ); + return Character.valueOf(pStr.charAt(0)); + } - public Object[] make(ArrayList pAL) { - return pAL.toArray(EMPTY_CHAR_A); + public Object[] make(ArrayList pAL) { + return pAL.toArray(EMPTY_CHAR_A); + } } - }); + ); // string - putFactory(CIMDataType.STRING, new ValueFactory() { + putFactory( + CIMDataType.STRING, + new ValueFactory() { - public Object make(String pStr) { - return pStr; - } + public Object make(String pStr) { + return pStr; + } - public Object[] make(ArrayList pAL) { - return pAL.toArray(EMPTY_STR_A); + public Object[] make(ArrayList pAL) { + return pAL.toArray(EMPTY_STR_A); + } } - }); + ); // boolean - putFactory(CIMDataType.BOOLEAN, new ValueFactory() { + putFactory( + CIMDataType.BOOLEAN, + new ValueFactory() { - public Object make(String pStr) { - return Boolean.valueOf(pStr); - } + public Object make(String pStr) { + return Boolean.valueOf(pStr); + } - public Object[] make(ArrayList pAL) { - return pAL.toArray(EMPTY_BOOL_A); + public Object[] make(ArrayList pAL) { + return pAL.toArray(EMPTY_BOOL_A); + } } - }); + ); // datetime - putFactory(CIMDataType.DATETIME, new ValueFactory() { + putFactory( + CIMDataType.DATETIME, + new ValueFactory() { - public Object make(String pStr) { - try { - return new CIMDateTimeAbsolute(pStr); - } catch (IllegalArgumentException eA) { + public Object make(String pStr) { try { - return new CIMDateTimeInterval(pStr); - } catch (IllegalArgumentException eI) { - throw new IllegalArgumentException("CIMDataTimeAbsolute:" + eA.getMessage() - + "\nCIMDateTimeInterval:" + eI.getMessage()); + return new CIMDateTimeAbsolute(pStr); + } catch (IllegalArgumentException eA) { + try { + return new CIMDateTimeInterval(pStr); + } catch (IllegalArgumentException eI) { + throw new IllegalArgumentException( + "CIMDataTimeAbsolute:" + eA.getMessage() + "\nCIMDateTimeInterval:" + eI.getMessage() + ); + } } } - } - public Object[] make(ArrayList pAL) { - return pAL.toArray(EMPTY_DT_A); + public Object[] make(ArrayList pAL) { + return pAL.toArray(EMPTY_DT_A); + } } - }); + ); // reference - putFactory(CIMDataType.REFERENCE, new ValueFactory() { + putFactory( + CIMDataType.REFERENCE, + new ValueFactory() { - public Object make(String pStr) { - return new CIMObjectPath(pStr); - } + public Object make(String pStr) { + return new CIMObjectPath(pStr); + } - public Object[] make(ArrayList pAL) { - return pAL.toArray(EMPTY_OP_A); + public Object[] make(ArrayList pAL) { + return pAL.toArray(EMPTY_OP_A); + } } - }); + ); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/EmbObjHandler.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/EmbObjHandler.java index b24608b..e5dda83 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/EmbObjHandler.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/EmbObjHandler.java @@ -67,7 +67,6 @@ */ public class EmbObjHandler { - private String iNodeName; private CIMDataType iRawType; @@ -86,7 +85,7 @@ public class EmbObjHandler { /** * Generic initialization. - * + * * @param pHandler * @param pNodeName * @param pAttribs @@ -96,21 +95,27 @@ public class EmbObjHandler { * @return EmbObjHandler * @throws SAXException */ - public static EmbObjHandler init(EmbObjHandler pHandler, String pNodeName, Attributes pAttribs, - SAXSession pSession, QualifiedNodeHandler pQNodeHandler, boolean pCheckEmbObjAttrib) - throws SAXException { + public static EmbObjHandler init( + EmbObjHandler pHandler, + String pNodeName, + Attributes pAttribs, + SAXSession pSession, + QualifiedNodeHandler pQNodeHandler, + boolean pCheckEmbObjAttrib + ) + throws SAXException { if (pHandler == null) pHandler = new EmbObjHandler(); pHandler.initInst(pNodeName, pAttribs, pSession, pQNodeHandler, pCheckEmbObjAttrib); return pHandler; } private EmbObjHandler() { - // init() used for instantiation + // init() used for instantiation } /** * Generic instance initialization. - * + * * @param pNodeName * @param pAttribs * @param pSession @@ -118,8 +123,14 @@ private EmbObjHandler() { * @param pCheckEmbObjAttrib * @throws SAXException */ - public void initInst(String pNodeName, Attributes pAttribs, SAXSession pSession, - QualifiedNodeHandler pQNodeHandler, boolean pCheckEmbObjAttrib) throws SAXException { + public void initInst( + String pNodeName, + Attributes pAttribs, + SAXSession pSession, + QualifiedNodeHandler pQNodeHandler, + boolean pCheckEmbObjAttrib + ) + throws SAXException { this.iSession = pSession; this.iNodeName = pNodeName; this.iQualiHandler = pQNodeHandler; @@ -156,8 +167,8 @@ public void initInst(String pNodeName, Attributes pAttribs, SAXSession pSession, this.iHasEmbObjAttr = true; } else { throw new SAXException( - "EmbeddedObject attribute's value must be \"object\" or \"instance\". " - + embObjStr + " is invalid!"); + "EmbeddedObject attribute's value must be \"object\" or \"instance\". " + embObjStr + " is invalid!" + ); } } else { this.iHasEmbInstAttr = this.iHasEmbObjAttr = false; @@ -167,39 +178,38 @@ public void initInst(String pNodeName, Attributes pAttribs, SAXSession pSession, /** * isEmbeddedObject For this function Object means CLASS or INSTANCE. Object * can have other meanings at different places !!! :( - * + * * @return boolean */ private boolean isEmbeddedObject() { - return this.iHasEmbInstAttr - || this.iHasEmbObjAttr - || (this.iQualiHandler != null && (this.iQualiHandler.isEmbeddedObject() || this.iQualiHandler - .isEmbeddedInstance())); + return ( + this.iHasEmbInstAttr || + this.iHasEmbObjAttr || + (this.iQualiHandler != null && (this.iQualiHandler.isEmbeddedObject() || this.iQualiHandler.isEmbeddedInstance())) + ); } /** * isEmbeddedClass - * + * * @return boolean */ private boolean isEmbeddedClass() { - return this.iHasEmbObjAttr - || (this.iQualiHandler != null && this.iQualiHandler.isEmbeddedObject()); + return this.iHasEmbObjAttr || (this.iQualiHandler != null && this.iQualiHandler.isEmbeddedObject()); } /** * isEmbeddedInstance - * + * * @return boolean */ private boolean isEmbeddedInstance() { - return this.iHasEmbInstAttr - || (this.iQualiHandler != null && this.iQualiHandler.isEmbeddedInstance()); + return this.iHasEmbInstAttr || (this.iQualiHandler != null && this.iQualiHandler.isEmbeddedInstance()); } /** * getValue - * + * * @return Object * @throws SAXException */ @@ -210,7 +220,7 @@ public Object getValue() throws SAXException { /** * getType - * + * * @return Object * @throws SAXException */ @@ -221,7 +231,7 @@ public CIMDataType getType() throws SAXException { /** * getRawType - * + * * @return the type which is retrieved from the XML attributes */ public CIMDataType getRawType() { @@ -230,27 +240,30 @@ public CIMDataType getRawType() { /** * getArrayType useful e.g. for PROPERTY.ARRAY - * + * * @return CIMDataType * @throws SAXException */ public CIMDataType getArrayType() throws SAXException { transform(); - return this.iType.isArray() ? this.iType : CIMHelper.UnboundedArrayDataType(this.iType - .getType()); + return this.iType.isArray() ? this.iType : CIMHelper.UnboundedArrayDataType(this.iType.getType()); } /** * addValueNode - * + * * @param pValueNode * - can be ValueNode ore ValueArrayNode for Embedded Objects */ public void addValueNode(AbstractValueNode pValueNode) { - if (isEmbeddedObject() - && !(pValueNode == null || pValueNode instanceof ValueNode || pValueNode instanceof ValueArrayNode)) throw new IllegalArgumentException( - "pValueNode's type can be ValueNode or ValueArrayNode or it can be null. " - + pValueNode.getClass().getName() + " is an invalid type!"); + if ( + isEmbeddedObject() && + !(pValueNode == null || pValueNode instanceof ValueNode || pValueNode instanceof ValueArrayNode) + ) throw new IllegalArgumentException( + "pValueNode's type can be ValueNode or ValueArrayNode or it can be null. " + + pValueNode.getClass().getName() + + " is an invalid type!" + ); this.iAbsValNode = pValueNode; } @@ -259,8 +272,8 @@ private void transform() throws SAXException { if (this.iAbsValNode == null) { if (isEmbeddedObject()) { if (this.iRawType != CIMDataType.STRING_T) throw new SAXException( - "Embedded Object CIM-XML element's type must be string. " + this.iRawType - + " is invalid!"); + "Embedded Object CIM-XML element's type must be string. " + this.iRawType + " is invalid!" + ); if (this.iSession.strictEmbObjParsing()) { /* * Here the assumption is that Object = CLASS, Instance = @@ -296,17 +309,17 @@ private void transformEmbObj() throws SAXException { this.iValue = CIMObjectFactory.getEmbeddedObj(this.iRawType, valueStr, this.iSession); this.iType = CIMObjectFactory.getCIMObjScalarType(this.iValue); } else { // ValueArrayNode - this.iValue = CIMObjectFactory.getEmbeddedObjA(this.iRawType, - (ValueArrayNode) this.iAbsValNode, this.iSession); + this.iValue = CIMObjectFactory.getEmbeddedObjA(this.iRawType, (ValueArrayNode) this.iAbsValNode, this.iSession); this.iType = CIMObjectFactory.getCIMObjArrayType(this.iValue); } if (isEmbeddedInstance() && this.iType.getType() != CIMDataType.OBJECT) throw new SAXException( - this.iNodeName + " element is an EmbeddedInstance with non INSTANCE value. " - + "It's not valid!"); - if (isEmbeddedClass() && this.iType.getType() != CIMDataType.CLASS - && this.iType.getType() != CIMDataType.OBJECT) throw new SAXException( - this.iNodeName - + " element is an EmbeddedObject with non CLASS/INSTANCE value. It's not valid!"); + this.iNodeName + " element is an EmbeddedInstance with non INSTANCE value. " + "It's not valid!" + ); + if ( + isEmbeddedClass() && this.iType.getType() != CIMDataType.CLASS && this.iType.getType() != CIMDataType.OBJECT + ) throw new SAXException( + this.iNodeName + " element is an EmbeddedObject with non CLASS/INSTANCE value. It's not valid!" + ); } private void transformNormObj() throws SAXException { @@ -315,8 +328,7 @@ private void transformNormObj() throws SAXException { this.iValue = CIMObjectFactory.getObject(this.iType, (ValueNode) this.iAbsValNode); } else if (this.iAbsValNode instanceof ValueArrayNode) { this.iType = CIMHelper.UnboundedArrayDataType(this.iRawType.getType()); - this.iValue = CIMObjectFactory.getObject(this.iRawType, - (ValueArrayNode) this.iAbsValNode); + this.iValue = CIMObjectFactory.getObject(this.iRawType, (ValueArrayNode) this.iAbsValNode); } else { this.iValue = this.iAbsValNode.getValue(); if (this.iAbsValNode instanceof ArrayIf) { @@ -335,14 +347,13 @@ private void transformNormObj() throws SAXException { * Required to handle the output XML of some non-standard CIMOMs like SVC * which adds the TYPE attribute to the sub VALUE or VALUE.ARRAY XML * element. - * + * * @throws SAXException */ private void setType() throws SAXException { if (this.iType != null || this.iRawType != null) return; this.iRawType = this.iAbsValNode.getType(); - if (this.iRawType == null) this.iRawType = (this.iAbsValNode instanceof ArrayIf ? CIMDataType.STRING_ARRAY_T - : CIMDataType.STRING_T); + if (this.iRawType == null) this.iRawType = + (this.iAbsValNode instanceof ArrayIf ? CIMDataType.STRING_ARRAY_T : CIMDataType.STRING_T); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/NodeConstIf.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/NodeConstIf.java index 21ac4eb..4f82cc2 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/NodeConstIf.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/NodeConstIf.java @@ -49,21 +49,20 @@ /** * Class NodeConstIf - * + * */ public interface NodeConstIf { - /** * The CIM element is the root element of every XML Document that is valid * with respect to this schema.
      - * - * + * + * * <!ELEMENT CIM (MESSAGE|DECLARATION)> * <!ATTLIST CIM * CIMVERSION CDATA #REQUIRED * DTDVERSION CDATA #REQUIRED> - * - * + * + * * @see String */ public static final String CIM = "CIM"; @@ -71,12 +70,12 @@ public interface NodeConstIf { /** * The DECLARATION element defines a set of one or more declarations of CIM * objects.
      - * - * - * + * + * + * * <!ELEMENT DECLARATION (DECLGROUP|DECLGROUP.WITHNAME|DECLGROUP.WITHPATH)+> - * - * + * + * * @see String */ public static final String DECLARATION = "DECLARATION"; @@ -84,11 +83,11 @@ public interface NodeConstIf { /** * The DECLGROUP element defines a logical set of CIM Class, Instance and * Qualifier declarations.
      - * - * + * + * * <!ELEMENT DECLGROUP ((LOCALNAMESPACEPATH|NAMESPACEPATH)?,QUALIFIER.DECLARATION*,VALUE.OBJECT*)> - * - * + * + * * @see String */ public static final String DECLGROUP = "DECLGROUP"; @@ -96,11 +95,11 @@ public interface NodeConstIf { /** * The DECLGROUP.WITHNAME element defines a logical set of CIM Class, * Instance and Qualifier declarations.
      - * - * + * + * * <!ELEMENT DECLGROUP.WITHNAME ((LOCALNAMESPACEPATH|NAMESPACEPATH)?,QUALIFIER.DECLARATION*,VALUE.NAMEDOBJECT*)> - * - * + * + * * @see String */ public static final String DECLGROUP_WITHNAME = "DECLGROUP.WITHNAME"; @@ -108,11 +107,11 @@ public interface NodeConstIf { /** * The DECLGROUP.WITHPATH element defines a logical set of CIM Class and * Instance declarations.
      - * - * + * + * * <!ELEMENT DECLGROUP.WITHPATH (VALUE.OBJECTWITHPATH|VALUE.OBJECTWITHLOCALPATH)*> - * - * + * + * * @see String */ public static final String DECLGROUP_WITHPATH = "DECLGROUP.WITHPATH"; @@ -120,8 +119,8 @@ public interface NodeConstIf { /** * The QUALIFIER.DECLARATION element defines a single CIM Qualifier * declaration.
      - * - * + * + * * <!ELEMENT QUALIFIER.DECLARATION (SCOPE?,(VALUE|VALUE.ARRAY)?)> * <!ATTLIST QUALIFIER.DECLARATION * %CIMName; @@ -129,8 +128,8 @@ public interface NodeConstIf { * ISARRAY (true|false) #IMPLIED * %ArraySize; * %QualifierFlavor;> - * - * + * + * * @see String */ public static final String QUALIFIER_DECLARATION = "QUALIFIER.DECLARATION"; @@ -139,8 +138,8 @@ public interface NodeConstIf { * The SCOPE element defines the scope of a QUALIFIER.DECLARATION in the * case that there are restrictions on the scope of the Qualifier * declaration.
      - * - * + * + * * <!ELEMENT SCOPE EMPTY> * <!ATTLIST SCOPE * CLASS (true|false) "false" @@ -150,8 +149,8 @@ public interface NodeConstIf { * METHOD (true|false) "false" * PARAMETER (true|false) "false" * INDICATION (true|false) "false"> - * - * + * + * * @see String */ public static final String SCOPE = "SCOPE"; @@ -160,11 +159,11 @@ public interface NodeConstIf { * The VALUE element is used to define a single (non-array) non-reference * non-NULL CIM Property value, CIM Qualifier value, CIM Method return * value, or CIM Method Parameter value.
      - * - * + * + * * <!ELEMENT VALUE (#PCDATA)> - * - * + * + * * @see String */ public static final String VALUE = "VALUE"; @@ -172,12 +171,12 @@ public interface NodeConstIf { /** * The VALUE.ARRAY element is used to represent the value of a CIM Property * or Qualifier that has an array type.
      - * - * - * + * + * + * * <!ELEMENT VALUE.ARRAY (VALUE|VALUE.NULL)*> - * - * + * + * * @see String */ public static final String VALUE_ARRAY = "VALUE.ARRAY"; @@ -185,11 +184,11 @@ public interface NodeConstIf { /** * The VALUE.REFERENCE element is used to define a single CIM reference * Property value.
      - * - * + * + * * <!ELEMENT VALUE.REFERENCE (CLASSPATH|LOCALCLASSPATH|CLASSNAME|INSTANCEPATH|LOCALINSTANCEPATH|INSTANCENAME)> - * - * + * + * * @see String */ public static final String VALUE_REFERENCE = "VALUE.REFERENCE"; @@ -197,11 +196,11 @@ public interface NodeConstIf { /** * The VALUE.REFARRAY element is used to represent the value of an array of * CIM references.
      - * - * + * + * * <!ELEMENT VALUE.REFARRAY (VALUE.REFERENCE|VALUE.NULL)*> - * - * + * + * * @see String */ public static final String VALUE_REFARRAY = "VALUE.REFARRAY"; @@ -209,11 +208,11 @@ public interface NodeConstIf { /** * The VALUE.OBJECT element is used to define a value which is comprised of * a single CIM Class or Instance definition.
      - * - * + * + * * <!ELEMENT VALUE.OBJECT (CLASS|INSTANCE)> - * - * + * + * * @see String */ public static final String VALUE_OBJECT = "VALUE.OBJECT"; @@ -221,12 +220,12 @@ public interface NodeConstIf { /** * The VALUE.NAMEDINSTANCE element is used to define a value which is * comprised of a single named CIM Instance definition.
      - * - * - * + * + * + * * <!ELEMENT VALUE.NAMEDINSTANCE (INSTANCENAME,INSTANCE)> - * - * + * + * * @see String */ public static final String VALUE_NAMEDINSTANCE = "VALUE.NAMEDINSTANCE"; @@ -234,11 +233,11 @@ public interface NodeConstIf { /** * The VALUE.NAMEDOBJECT element is used to define a value which is * comprised of a single named CIM Class or Instance definition.
      - * - * + * + * * <!ELEMENT VALUE.NAMEDOBJECT (CLASS|(INSTANCENAME,INSTANCE))> - * - * + * + * * @see String */ public static final String VALUE_NAMEDOBJECT = "VALUE.NAMEDOBJECT"; @@ -247,11 +246,11 @@ public interface NodeConstIf { * The VALUE.OBJECTWITHLOCALPATH element is used to define a value which is * comprised of a single CIM Object (Class or Instance) definition with * additional information that defines the local path to that Object.
      - * - * + * + * * <!ELEMENT VALUE.OBJECTWITHLOCALPATH ((LOCALCLASSPATH,CLASS)|(LOCALINSTANCEPATH,INSTANCE))> - * - * + * + * * @see String */ public static final String VALUE_OBJECTWITHLOCALPATH = "VALUE.OBJECTWITHLOCALPATH"; @@ -260,22 +259,22 @@ public interface NodeConstIf { * The VALUE.OBJECTWITHPATH element is used to define a value which is * comprised of a single CIM Object (Class or Instance) definition with * additional information that defines the absolute path to that Object.
      - * - * + * + * * <!ELEMENT VALUE.OBJECTWITHPATH ((CLASSPATH,CLASS)|(INSTANCEPATH,INSTANCE))> - * - * + * + * * @see String */ public static final String VALUE_OBJECTWITHPATH = "VALUE.OBJECTWITHPATH"; /** * The VALUE.NULL element is used to represent a NULL value.
      - * - * + * + * * <!ELEMENT VALUE.NULL EMPTY> - * - * + * + * * @see String */ public static final String VALUE_NULL = "VALUE.NULL"; @@ -284,22 +283,22 @@ public interface NodeConstIf { * The VALUE.INSTANCEWITHPATH element is used to define value that comprises * a single CIM instance definition with additional information that defines * the absolute path to that object.
      - * - * + * + * * <!ELEMENT VALUE.INSTANCEWITHPATH (INSTANCEPATH, INSTANCE)> - * - * + * + * * @see String */ public static final String VALUE_INSTANCEWITHPATH = "VALUE.INSTANCEWITHPATH"; /** * The NAMESPACEPATH element is used to define a Namespace Path.
      - * - * + * + * * <!ELEMENT NAMESPACEPATH (HOST,LOCALNAMESPACEPATH)> - * - * + * + * * @see String */ public static final String NAMESPACEPATH = "NAMESPACEPATH"; @@ -307,22 +306,22 @@ public interface NodeConstIf { /** * The LOCALNAMESPACEPATH element is used to define a local Namespace path * (one without a Host component).
      - * - * + * + * * <!ELEMENT LOCALNAMESPACEPATH (NAMESPACE+)> - * - * + * + * * @see String */ public static final String LOCALNAMESPACEPATH = "LOCALNAMESPACEPATH"; /** * The HOST element is used to define a single Host.
      - * - * + * + * * <!ELEMENT HOST (#PCDATA)> - * - * + * + * * @see String */ public static final String HOST = "HOST"; @@ -330,72 +329,72 @@ public interface NodeConstIf { /** * The NAMESPACE element is used to define a single Namespace component of a * Namespace path.
      - * - * + * + * * <!ELEMENT NAMESPACE EMPTY> * <!ATTLIST NAMESPACE * %CIMName;> - * - * + * + * * @see String */ public static final String NAMESPACE = "NAMESPACE"; /** * The CLASSPATH element defines the absolute path to a CIM Class.
      - * - * + * + * * <!ELEMENT CLASSPATH (NAMESPACEPATH,CLASSNAME)> - * - * + * + * * @see String */ public static final String CLASSPATH = "CLASSPATH"; /** * The LOCALCLASSPATH element defines the a local path to a CIM Class.
      - * - * - * + * + * + * * <!ELEMENT LOCALCLASSPATH (LOCALNAMESPACEPATH, CLASSNAME)> - * - * - * + * + * + * * @see String */ public static final String LOCALCLASSPATH = "LOCALCLASSPATH"; /** * The CLASSNAME element defines the qualifying name of a CIM Class.
      - * - * + * + * * <!ELEMENT CLASSNAME EMPTY> * <!ATTLIST CLASSNAME * %CIMName;> - * - * + * + * * @see String */ public static final String CLASSNAME = "CLASSNAME"; /** * The INSTANCEPATH element defines the absolute path to a CIM Instance.
      - * - * + * + * * <!ELEMENT INSTANCEPATH (NAMESPACEPATH,INSTANCENAME)> - * - * + * + * * @see String */ public static final String INSTANCEPATH = "INSTANCEPATH"; /** * The LOCALINSTANCEPATH element defines the local path to a CIM Instance.
      - * - * + * + * * <!ELEMENT LOCALINSTANCEPATH (LOCALNAMESPACEPATH,INSTANCENAME)> - * - * + * + * * @see String */ public static final String LOCALINSTANCEPATH = "LOCALINSTANCEPATH"; @@ -403,13 +402,13 @@ public interface NodeConstIf { /** * The INSTANCENAME element defines the location of a CIM Instance within a * Namespace.
      - * - * + * + * * <!ELEMENT INSTANCENAME (KEYBINDING*|KEYVALUE?|VALUE.REFERENCE?)> * <!ATTLIST INSTANCENAME * %ClassName;> - * - * + * + * * @see String */ public static final String INSTANCENAME = "INSTANCENAME"; @@ -417,24 +416,24 @@ public interface NodeConstIf { /** * The OBJECTPATH element is used to define a full path to a single CIM * Object (Class or Instance).
      - * - * + * + * * <!ELEMENT OBJECTPATH (INSTANCEPATH|CLASSPATH)> - * - * + * + * * @see String */ public static final String OBJECTPATH = "OBJECTPATH"; /** * The KEYBINDING element defines a single key property value binding.
      - * - * + * + * * <!ELEMENT KEYBINDING (KEYVALUE|VALUE.REFERENCE)> * <!ATTLIST KEYBINDING * %CIMName;> - * - * + * + * * @see String */ public static final String KEYBINDING = "KEYBINDING"; @@ -442,50 +441,50 @@ public interface NodeConstIf { /** * The KEYVALUE element defines a single property key value when the key * property is a non-reference type.
      - * - * + * + * * <!ELEMENT KEYVALUE (#PCDATA)> * <!ATTLIST KEYVALUE * VALUETYPE (string|boolean|numeric) "string" * %CIMType; #IMPLIED> - * - * + * + * * @see String */ public static final String KEYVALUE = "KEYVALUE"; /** * The CLASS element defines a single CIM Class.
      - * - * + * + * * <!ELEMENT CLASS (QUALIFIER*,(PROPERTY|PROPERTY.ARRAY|PROPERTY.REFERENCE)*,METHOD*)> * <!ATTLIST CLASS * %CIMName; * %SuperClass;> - * - * + * + * * @see String */ public static final String CLASS = "CLASS"; /** * The INSTANCE element defines a single CIM Instance of a CIM Class.
      - * - * + * + * * <!ELEMENT INSTANCE (QUALIFIER*,(PROPERTY|PROPERTY.ARRAY|PROPERTY.REFERENCE)*)> * <!ATTLIST INSTANCE * %ClassName; * xml:lang NMTOKEN #IMPLIED> - * - * + * + * * @see String */ public static final String INSTANCE = "INSTANCE"; /** * The QUALIFIER element defines a single CIM Qualifier.
      - * - * + * + * * <!ELEMENT QUALIFIER ((VALUE|VALUE.ARRAY)?)> * <!ATTLIST QUALIFIER * %CIMName; @@ -493,8 +492,8 @@ public interface NodeConstIf { * %Propagated; * %QualifierFlavor; * xml:lang NMTOKEN #IMPLIED> - * - * + * + * * @see String */ public static final String QUALIFIER = "QUALIFIER"; @@ -503,8 +502,8 @@ public interface NodeConstIf { * The PROPERTY element defines the value in a CIM Instance or the * definition in a CIM Class of a single (non-array) CIM Property that is * not a reference.
      - * - * + * + * * <!ELEMENT PROPERTY (QUALIFIER*,VALUE?)> * <!ATTLIST PROPERTY * %CIMName; @@ -513,8 +512,8 @@ public interface NodeConstIf { * %Propagated; * %EmbeddedObject; * xml:lang NMTOKEN #IMPLIED> - * - * + * + * * @see String */ public static final String PROPERTY = "PROPERTY"; @@ -522,8 +521,8 @@ public interface NodeConstIf { /** * The PROPERTY.ARRAY element defines the value in a CIM Instance or the * definition in a CIM Class of a single CIM Property with an array type.
      - * - * + * + * * <!ELEMENT PROPERTY.ARRAY (QUALIFIER*,VALUE.ARRAY?)> * <!ATTLIST PROPERTY.ARRAY * %CIMName; @@ -533,8 +532,8 @@ public interface NodeConstIf { * %Propagated; * %EmbeddedObject; * xml:lang NMTOKEN #IMPLIED> - * - * + * + * * @see String */ public static final String PROPERTY_ARRAY = "PROPERTY.ARRAY"; @@ -543,33 +542,33 @@ public interface NodeConstIf { * The PROPERTY.REFERENCE element defines the value in a CIM Instance or the * definition in a CIM Class of a single CIM Property with reference * semantics.
      - * - * + * + * * <!ELEMENT PROPERTY.REFERENCE (QUALIFIER*,VALUE.REFERENCE?)> * <!ATTLIST PROPERTY.REFERENCE * %CIMName; * %ReferenceClass; * %ClassOrigin; * %Propagated;> - * - * + * + * * @see String */ public static final String PROPERTY_REFERENCE = "PROPERTY.REFERENCE"; /** - * + * * The METHOD element defines a single CIM Method.
      - * - * + * + * * <!ELEMENT METHOD (QUALIFIER*,(PARAMETER|PARAMETER.REFERENCE|PARAMETER.ARRAY|PARAMETER.REFARRAY)*)> * <!ATTLIST METHOD * %CIMName; * %CIMType; #IMPLIED * %ClassOrigin; * %Propagated;> - * - * + * + * * @see String */ public static final String METHOD = "METHOD"; @@ -577,14 +576,14 @@ public interface NodeConstIf { /** * The PARAMETER element defines a single (non-array, non-reference) * Parameter to a CIM Method.
      - * - * + * + * * <!ELEMENT PARAMETER (QUALIFIER*)> * <!ATTLIST PARAMETER * %CIMName; * %CIMType; #REQUIRED> - * - * + * + * * @see String */ public static final String PARAMETER = "PARAMETER"; @@ -592,14 +591,14 @@ public interface NodeConstIf { /** * The PARAMETER.REFERENCE element defines a single reference Parameter to a * CIM Method.
      - * - * + * + * * <!ELEMENT PARAMETER.REFERENCE (QUALIFIER*)> * <!ATTLIST PARAMETER.REFERENCE * %CIMName; * %ReferenceClass;> - * - * + * + * * @see String */ public static final String PARAMETER_REFERENCE = "PARAMETER.REFERENCE"; @@ -607,15 +606,15 @@ public interface NodeConstIf { /** * The PARAMETER.ARRAY element defines a single Parameter to a CIM Method * that has an array type.
      - * - * + * + * * <!ELEMENT PARAMETER.ARRAY (QUALIFIER*)> * <!ATTLIST PARAMETER.ARRAY * %CIMName; * %CIMType; #REQUIRED * %ArraySize;> - * - * + * + * * @see String */ public static final String PARAMETER_ARRAY = "PARAMETER.ARRAY"; @@ -623,15 +622,15 @@ public interface NodeConstIf { /** * The PARAMETER.REFARRAY element defines a single Parameter to a CIM Method * that has an array of references type.
      - * - * + * + * * <!ELEMENT PARAMETER.REFARRAY (QUALIFIER*)> * <!ATTLIST PARAMETER.REFARRAY * %CIMName; * %ReferenceClass; * %ArraySize;> - * - * + * + * * @see String */ public static final String PARAMETER_REFARRAY = "PARAMETER.REFARRAY"; @@ -642,71 +641,71 @@ public interface NodeConstIf { /** * The MESSAGE element models a single CIM message.
      - * - * + * + * * <!ELEMENT MESSAGE (SIMPLEREQ|MULTIREQ|SIMPLERSP|MULTIRSP|SIMPLEEXPREQ|MULTIEXPREQ|SIMPLEEXPRSP|MULTIEXPRSP)> * <!ATTLIST MESSAGE * ID CDATA #REQUIRED * PROTOCOLVERSION CDATA #REQUIRED>> - * - * + * + * * @see String */ public static final String MESSAGE = "MESSAGE"; /** * The MULTIREQ element defines a Multiple CIM Operation request.
      - * - * + * + * * <!ELEMENT MULTIREQ (SIMPLEREQ,SIMPLEREQ+)> - * - * + * + * * @see String */ public static final String MULTIREQ = "MULTIREQ"; /** * The MULTIEXPREQ element defines a Multiple CIM Export request.
      - * - * + * + * * <!ELEMENT MULTIEXPREQ (SIMPLEEXPREQ,SIMPLEEXPREQ+)> - * - * + * + * * @see String */ public static final String MULTIEXPREQ = "MULTIEXPREQ"; /** * The SIMPLEREQ element defines a Simple CIM Operation request.
      - * - * + * + * * <!ELEMENT SIMPLEREQ (METHODCALL|IMETHODCALL)> - * - * + * + * * @see String */ public static final String SIMPLEREQ = "SIMPLEREQ"; /** * The SIMPLEEXPREQ element defines a Simple CIM Export request.
      - * - * + * + * * <!ELEMENT SIMPLEEXPREQ (EXPMETHODCALL)> - * - * + * + * * @see String */ public static final String SIMPLEEXPREQ = "SIMPLEEXPREQ"; /** * The IMETHODCALL element defines a single intrinsic method invocation.
      - * - * + * + * * <!ELEMENT IMETHODCALL (LOCALNAMESPACEPATH,IPARAMVALUE*)> * <!ATTLIST IMETHODCALL * %CIMName;> - * - * + * + * * @see String */ public static final String IMETHODCALL = "IMETHODCALL"; @@ -714,26 +713,26 @@ public interface NodeConstIf { /** * The METHODCALL element defines a single method invocation on a Class or * Instance.
      - * - * + * + * * <!ELEMENT METHODCALL ((LOCALCLASSPATH|LOCALINSTANCEPATH),PARAMVALUE*)> * <!ATTLIST METHODCALL * %CIMName;> - * - * + * + * * @see String */ public static final String METHODCALL = "METHODCALL"; /** * The EXPMETHODCALL element defines a single export method invocation.
      - * - * + * + * * <!ELEMENT EXPMETHODCALL (EXPPARAMVALUE*)> * <!ATTLIST EXPMETHODCALL * %CIMName;> - * - * + * + * * @see String */ public static final String EXPMETHODCALL = "EXPMETHODCALL"; @@ -741,15 +740,15 @@ public interface NodeConstIf { /** * The PARAMVALUE element defines a single extrinsic method named parameter * value.
      - * - * + * + * * <!ELEMENT PARAMVALUE (VALUE|VALUE.REFERENCE|VALUE.ARRAY|VALUE.REFARRAY)?> * <!ATTLIST PARAMVALUE * %CIMName; * %ParamType; #IMPLIED * %EmbeddedObject;> - * - * + * + * * @see String */ public static final String PARAMVALUE = "PARAMVALUE"; @@ -757,13 +756,13 @@ public interface NodeConstIf { /** * The IPARAMVALUE element defines a single intrinsic method named parameter * value.
      - * - * + * + * * <!ELEMENT IPARAMVALUE (VALUE|VALUE.ARRAY|VALUE.REFERENCE|CLASSNAME|INSTANCENAME|QUALIFIER.DECLARATION|CLASS|INSTANCE|VALUE.NAMEDINSTANCE)?> * <!ATTLIST IPARAMVALUE * %CIMName;> - * - * + * + * * @see String */ public static final String IPARAMVALUE = "IPARAMVALUE"; @@ -771,57 +770,57 @@ public interface NodeConstIf { /** * The EXPPARAMVALUE element defines a single export method named parameter * value.
      - * - * + * + * * <!ELEMENT EXPPARAMVALUE (INSTANCE?)> * <!ATTLIST EXPPARAMVALUE * %CIMName;> - * - * + * + * * @see String */ public static final String EXPPARAMVALUE = "EXPPARAMVALUE"; /** * The MULTIRSP element defines a Multiple CIM Operation response.
      - * - * + * + * * <!ELEMENT MULTIRSP (SIMPLERSP,SIMPLERSP+)> - * - * + * + * * @see String */ public static final String MULTIRSP = "MULTIRSP"; /** * The MULTIEXPRSP element defines a Multiple CIM Export response.
      - * - * + * + * * <!ELEMENT MULTIEXPRSP (SIMPLEEXPRSP,SIMPLEEXPRSP+)> - * - * + * + * * @see String */ public static final String MULTIEXPRSP = "MULTIEXPRSP"; /** * The SIMPLERSP element defines a Simple CIM Operation response.
      - * - * + * + * * <!ELEMENT SIMPLERSP (METHODRESPONSE|IMETHODRESPONSE)> - * - * + * + * * @see String */ public static final String SIMPLERSP = "SIMPLERSP"; /** * The SIMPLEEXPRSP element defines a Simple CIM Export response.
      - * - * + * + * * <!ELEMENT SIMPLEEXPRSP (EXPMETHODRESPONSE)> - * - * + * + * * @see String */ public static final String SIMPLEEXPRSP = "SIMPLEEXPRSP"; @@ -829,14 +828,14 @@ public interface NodeConstIf { /** * The METHODRESPONSE defines the response to a single CIM extrinsic method * invocation.
      - * - * - * + * + * + * * <!ELEMENT METHODRESPONSE (ERROR|(RETURNVALUE?,PARAMVALUE*))> * <!ATTLIST METHODRESPONSE %CIMName;> - * - * - * + * + * + * * @see String */ public static final String METHODRESPONSE = "METHODRESPONSE"; @@ -844,13 +843,13 @@ public interface NodeConstIf { /** * The EXPMETHODRESPONSE defines the response to a single export method * invocation.
      - * - * + * + * * <!ELEMENT EXPMETHODRESPONSE (ERROR|IRETURNVALUE?)> * <!ATTLIST EXPMETHODRESPONSE * %CIMName;> - * - * + * + * * @see String */ public static final String EXPMETHODRESPONSE = "EXPMETHODRESPONSE"; @@ -858,13 +857,13 @@ public interface NodeConstIf { /** * The IMETHODRESPONSE defines the response to a single intrinsic CIM method * invocation.
      - * - * + * + * * <!ELEMENT IMETHODRESPONSE (ERROR|IRETURNVALUE?)> * <!ATTLIST IMETHODRESPONSE * %CIMName;> - * - * + * + * * @see String */ public static final String IMETHODRESPONSE = "IMETHODRESPONSE"; @@ -872,14 +871,14 @@ public interface NodeConstIf { /** * The ERROR element is used to define a fundamental error which prevented a * method from executing normally.
      - * - * + * + * * <!ELEMENT ERROR (INSTANCE*) * <!ATTLIST ERROR * CODE CDATA #REQUIRED * DESCRIPTION CDATA #IMPLIED> - * - * + * + * * @see String */ public static final String ERROR = "ERROR"; @@ -887,14 +886,14 @@ public interface NodeConstIf { /** * The RETURNVALUE element specifies the value returned from an extrinsic * method call.
      - * - * + * + * * <!ELEMENT RETURNVALUE (VALUE|VALUE.REFERENCE)?> * <!ATTLIST RETURNVALUE * %EmbeddedObject; * %ParamType; #IMPLIED> - * - * + * + * * @see String */ public static final String RETURNVALUE = "RETURNVALUE"; @@ -902,25 +901,25 @@ public interface NodeConstIf { /** * The IRETURNVALUE element specifies the value returned from an intrinsic * method call.
      - * - * + * + * * <!ELEMENT IRETURNVALUE (CLASSNAME*|INSTANCENAME*|VALUE*|VALUE.OBJECTWITHPATH*|VALUE.OBJECTWITHLOCALPATH*VALUE.OBJECT*|OBJECTPATH*|QUALIFIER.DECLARATION*|VALUE.ARRAY?|VALUE.REFERENCE?|CLASS*|INSTANCE*|VALUE.NAMEDINSTANCE*)> - * - * + * + * * @see String */ public static final String IRETURNVALUE = "IRETURNVALUE"; /** * The CORRELATOR element represents a server-defined operation correlator.
      - * - * + * + * * <!ELEMENT CORRELATOR (VALUE)> * <!ATTLIST CORRELATOR * %CIMName; * %CIMType; #REQUIRED> - * - * + * + * * @see String */ public static final String CORRELATOR = "CORRELATOR"; diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/NodeFactory.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/NodeFactory.java index c21cd6d..53c7d7c 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/NodeFactory.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/NodeFactory.java @@ -47,18 +47,17 @@ */ import java.util.HashMap; - import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node.*; /** * Class NodeFactory is responsible for Node instance construction. - * + * */ public class NodeFactory implements NodeConstIf { /** * getNodeInstance - * + * * @param pNodeName * Should be an XML element name constant which is defined in * NodeConstIf @@ -72,7 +71,7 @@ public static Node getNodeInstance(String pNodeName) { /** * getEnum - * + * * @param pNodeName * @return The corresponding String constant for an XML element name. It * must be used, because the Node subclasses use reference based @@ -85,406 +84,631 @@ public static String getEnum(String pNodeName) { private static HashMap cParserMap; private interface FactoryEntry { - /** * create - * + * * @return Node */ public Node create(); } - private synchronized static void createParserMap() { + private static synchronized void createParserMap() { if (cParserMap != null) return; cParserMap = new HashMap(); - cParserMap.put(CIM, new FactoryEntry() { + cParserMap.put( + CIM, + new FactoryEntry() { - public Node create() { - return new CIMNode(); + public Node create() { + return new CIMNode(); + } } - }); + ); // DECLARATION - not implemented // DECLGROUP - not implemented // DECLGROUP.WITHNAME - not implemented // DECLGROUP.WITHPATH - not implemented - cParserMap.put(QUALIFIER_DECLARATION, new FactoryEntry() { - - public Node create() { - return new QualiDeclNode(); - } - }); - cParserMap.put(SCOPE, new FactoryEntry() { - - public Node create() { - return new ScopeNode(); - } - }); - cParserMap.put(VALUE, new FactoryEntry() { - - public Node create() { - return new ValueNode(); - } - }); - cParserMap.put(VALUE_ARRAY, new FactoryEntry() { - - public Node create() { - return new ValueArrayNode(); - } - }); - cParserMap.put(VALUE_REFERENCE, new FactoryEntry() { - - public Node create() { - return new ValueReferenceNode(); - } - }); - cParserMap.put(VALUE_REFARRAY, new FactoryEntry() { - - public Node create() { - return new ValueRefArrayNode(); - } - }); - cParserMap.put(VALUE_OBJECT, new FactoryEntry() { - - public Node create() { - return new ValueObjectNode(); - } - }); - cParserMap.put(VALUE_NAMEDINSTANCE, new FactoryEntry() { - - public Node create() { - return new ValueNamedInstanceNode(); - } - }); - cParserMap.put(VALUE_OBJECTWITHLOCALPATH, new FactoryEntry() { - - public Node create() { - return new ValueObjectWithLocalPathNode(); - } - }); - cParserMap.put(VALUE_OBJECTWITHPATH, new FactoryEntry() { - - public Node create() { - return new ValueObjectWithPathNode(); - } - }); - cParserMap.put(VALUE_NULL, new FactoryEntry() { - - public Node create() { - return new ValueNullNode(); - } - }); - cParserMap.put(VALUE_INSTANCEWITHPATH, new FactoryEntry() { - - public Node create() { - return new ValueInstanceWithPathNode(); - } - }); - cParserMap.put(NAMESPACEPATH, new FactoryEntry() { - - public Node create() { - return new NameSpacePathNode(); - } - }); - cParserMap.put(LOCALNAMESPACEPATH, new FactoryEntry() { - - public Node create() { - return new LocalNameSpacePathNode(); - } - }); - cParserMap.put(HOST, new FactoryEntry() { - - public Node create() { - return new HostNode(); - } - }); - cParserMap.put(NAMESPACE, new FactoryEntry() { - - public Node create() { - return new NameSpaceNode(); - } - }); - cParserMap.put(CLASSPATH, new FactoryEntry() { - - public Node create() { - return new ClassPathNode(); - } - }); - cParserMap.put(LOCALCLASSPATH, new FactoryEntry() { - - public Node create() { - return new LocalClassPathNode(); - } - }); - cParserMap.put(CLASSNAME, new FactoryEntry() { - - public Node create() { - return new ClassNameNode(); - } - }); - cParserMap.put(INSTANCEPATH, new FactoryEntry() { - - public Node create() { - return new InstancePathNode(); - } - }); - cParserMap.put(LOCALINSTANCEPATH, new FactoryEntry() { - - public Node create() { - return new LocalInstancePathNode(); - } - }); - cParserMap.put(INSTANCENAME, new FactoryEntry() { - - public Node create() { - return new InstanceNameNode(); - } - }); - cParserMap.put(OBJECTPATH, new FactoryEntry() { - - public Node create() { - return new ObjectPathNode(); - } - }); - cParserMap.put(KEYBINDING, new FactoryEntry() { - - public Node create() { - return new KeyBindingNode(); - } - }); - cParserMap.put(KEYVALUE, new FactoryEntry() { - - public Node create() { - return new KeyValueNode(); - } - }); - cParserMap.put(CLASS, new FactoryEntry() { - - public Node create() { - return new ClassNode(); - } - }); - cParserMap.put(INSTANCE, new FactoryEntry() { - - public Node create() { - return new InstanceNode(); - } - }); - cParserMap.put(QUALIFIER, new FactoryEntry() { - - public Node create() { - return new QualifierNode(); - } - }); - cParserMap.put(PROPERTY, new FactoryEntry() { - - public Node create() { - return new PropertyNode(); - } - }); - cParserMap.put(PROPERTY_ARRAY, new FactoryEntry() { - - public Node create() { - return new PropertyArrayNode(); - } - }); - cParserMap.put(PROPERTY_REFERENCE, new FactoryEntry() { - - public Node create() { - return new PropertyReferenceNode(); - } - }); - cParserMap.put(METHOD, new FactoryEntry() { - - public Node create() { - return new MethodNode(); - } - }); - cParserMap.put(PARAMETER, new FactoryEntry() { - - public Node create() { - return new ParameterNode(); - } - }); - cParserMap.put(PARAMETER_REFERENCE, new FactoryEntry() { - - public Node create() { - return new ParameterReferenceNode(); - } - }); - cParserMap.put(PARAMETER_ARRAY, new FactoryEntry() { - - public Node create() { - return new ParameterArrayNode(); - } - }); - cParserMap.put(PARAMETER_REFARRAY, new FactoryEntry() { - - public Node create() { - return new ParameterRefArrayNode(); - } - }); - cParserMap.put(MESSAGE, new FactoryEntry() { - - public Node create() { - return new MessageNode(); - } - }); - cParserMap.put(MULTIREQ, new FactoryEntry() { - - public Node create() { - return new MultiReqNode(); - } - }); - cParserMap.put(MULTIEXPREQ, new FactoryEntry() { - - public Node create() { - return new MultiExpReqNode(); - } - }); - cParserMap.put(SIMPLEREQ, new FactoryEntry() { - - public Node create() { - return new SimpleReqNode(); - } - }); - cParserMap.put(SIMPLEEXPREQ, new FactoryEntry() { - - public Node create() { - return new SimpleExpReqNode(); - } - }); - cParserMap.put(IMETHODCALL, new FactoryEntry() { - - public Node create() { - return new IMethodCallNode(); - } - }); - cParserMap.put(METHODCALL, new FactoryEntry() { - - public Node create() { - return new MethodCallNode(); - } - }); - cParserMap.put(EXPMETHODCALL, new FactoryEntry() { - - public Node create() { - return new ExpMethodCallNode(); - } - }); - cParserMap.put(PARAMVALUE, new FactoryEntry() { - - public Node create() { - return new ParamValueNode(); - } - }); - cParserMap.put(IPARAMVALUE, new FactoryEntry() { - - public Node create() { - return new IParamValueNode(); - } - }); - cParserMap.put(EXPPARAMVALUE, new FactoryEntry() { - - public Node create() { - return new ExpParamValueNode(); - } - }); - cParserMap.put(MULTIRSP, new FactoryEntry() { - - public Node create() { - return new MultiRspNode(); - } - }); - cParserMap.put(MULTIEXPRSP, new FactoryEntry() { - - public Node create() { - return new MultiExpRspNode(); - } - }); - cParserMap.put(SIMPLERSP, new FactoryEntry() { - - public Node create() { - return new SimpleRspNode(); - } - }); - cParserMap.put(SIMPLEEXPRSP, new FactoryEntry() { - - public Node create() { - return new SimpleExpRspNode(); - } - }); - cParserMap.put(METHODRESPONSE, new FactoryEntry() { - - public Node create() { - return new MethodResponseNode(); - } - }); - cParserMap.put(EXPMETHODRESPONSE, new FactoryEntry() { - - public Node create() { - return new ExpMethodResponseNode(); - } - }); - cParserMap.put(IMETHODRESPONSE, new FactoryEntry() { - - public Node create() { - return new IMethodResponseNode(); - } - }); - cParserMap.put(ERROR, new FactoryEntry() { - - public Node create() { - return new ErrorNode(); - } - }); - cParserMap.put(RETURNVALUE, new FactoryEntry() { - - public Node create() { - return new ReturnValueNode(); - } - }); - cParserMap.put(IRETURNVALUE, new FactoryEntry() { - - public Node create() { - return new IReturnValueNode(); - } - }); - cParserMap.put(CORRELATOR, new FactoryEntry() { - - public Node create() { - return new CorrelatorNode(); - } - }); + cParserMap.put( + QUALIFIER_DECLARATION, + new FactoryEntry() { + + public Node create() { + return new QualiDeclNode(); + } + } + ); + cParserMap.put( + SCOPE, + new FactoryEntry() { + + public Node create() { + return new ScopeNode(); + } + } + ); + cParserMap.put( + VALUE, + new FactoryEntry() { + + public Node create() { + return new ValueNode(); + } + } + ); + cParserMap.put( + VALUE_ARRAY, + new FactoryEntry() { + + public Node create() { + return new ValueArrayNode(); + } + } + ); + cParserMap.put( + VALUE_REFERENCE, + new FactoryEntry() { + + public Node create() { + return new ValueReferenceNode(); + } + } + ); + cParserMap.put( + VALUE_REFARRAY, + new FactoryEntry() { + + public Node create() { + return new ValueRefArrayNode(); + } + } + ); + cParserMap.put( + VALUE_OBJECT, + new FactoryEntry() { + + public Node create() { + return new ValueObjectNode(); + } + } + ); + cParserMap.put( + VALUE_NAMEDINSTANCE, + new FactoryEntry() { + + public Node create() { + return new ValueNamedInstanceNode(); + } + } + ); + cParserMap.put( + VALUE_OBJECTWITHLOCALPATH, + new FactoryEntry() { + + public Node create() { + return new ValueObjectWithLocalPathNode(); + } + } + ); + cParserMap.put( + VALUE_OBJECTWITHPATH, + new FactoryEntry() { + + public Node create() { + return new ValueObjectWithPathNode(); + } + } + ); + cParserMap.put( + VALUE_NULL, + new FactoryEntry() { + + public Node create() { + return new ValueNullNode(); + } + } + ); + cParserMap.put( + VALUE_INSTANCEWITHPATH, + new FactoryEntry() { + + public Node create() { + return new ValueInstanceWithPathNode(); + } + } + ); + cParserMap.put( + NAMESPACEPATH, + new FactoryEntry() { + + public Node create() { + return new NameSpacePathNode(); + } + } + ); + cParserMap.put( + LOCALNAMESPACEPATH, + new FactoryEntry() { + + public Node create() { + return new LocalNameSpacePathNode(); + } + } + ); + cParserMap.put( + HOST, + new FactoryEntry() { + + public Node create() { + return new HostNode(); + } + } + ); + cParserMap.put( + NAMESPACE, + new FactoryEntry() { + + public Node create() { + return new NameSpaceNode(); + } + } + ); + cParserMap.put( + CLASSPATH, + new FactoryEntry() { + + public Node create() { + return new ClassPathNode(); + } + } + ); + cParserMap.put( + LOCALCLASSPATH, + new FactoryEntry() { + + public Node create() { + return new LocalClassPathNode(); + } + } + ); + cParserMap.put( + CLASSNAME, + new FactoryEntry() { + + public Node create() { + return new ClassNameNode(); + } + } + ); + cParserMap.put( + INSTANCEPATH, + new FactoryEntry() { + + public Node create() { + return new InstancePathNode(); + } + } + ); + cParserMap.put( + LOCALINSTANCEPATH, + new FactoryEntry() { + + public Node create() { + return new LocalInstancePathNode(); + } + } + ); + cParserMap.put( + INSTANCENAME, + new FactoryEntry() { + + public Node create() { + return new InstanceNameNode(); + } + } + ); + cParserMap.put( + OBJECTPATH, + new FactoryEntry() { + + public Node create() { + return new ObjectPathNode(); + } + } + ); + cParserMap.put( + KEYBINDING, + new FactoryEntry() { + + public Node create() { + return new KeyBindingNode(); + } + } + ); + cParserMap.put( + KEYVALUE, + new FactoryEntry() { + + public Node create() { + return new KeyValueNode(); + } + } + ); + cParserMap.put( + CLASS, + new FactoryEntry() { + + public Node create() { + return new ClassNode(); + } + } + ); + cParserMap.put( + INSTANCE, + new FactoryEntry() { + + public Node create() { + return new InstanceNode(); + } + } + ); + cParserMap.put( + QUALIFIER, + new FactoryEntry() { + + public Node create() { + return new QualifierNode(); + } + } + ); + cParserMap.put( + PROPERTY, + new FactoryEntry() { + + public Node create() { + return new PropertyNode(); + } + } + ); + cParserMap.put( + PROPERTY_ARRAY, + new FactoryEntry() { + + public Node create() { + return new PropertyArrayNode(); + } + } + ); + cParserMap.put( + PROPERTY_REFERENCE, + new FactoryEntry() { + + public Node create() { + return new PropertyReferenceNode(); + } + } + ); + cParserMap.put( + METHOD, + new FactoryEntry() { + + public Node create() { + return new MethodNode(); + } + } + ); + cParserMap.put( + PARAMETER, + new FactoryEntry() { + + public Node create() { + return new ParameterNode(); + } + } + ); + cParserMap.put( + PARAMETER_REFERENCE, + new FactoryEntry() { + + public Node create() { + return new ParameterReferenceNode(); + } + } + ); + cParserMap.put( + PARAMETER_ARRAY, + new FactoryEntry() { + + public Node create() { + return new ParameterArrayNode(); + } + } + ); + cParserMap.put( + PARAMETER_REFARRAY, + new FactoryEntry() { + + public Node create() { + return new ParameterRefArrayNode(); + } + } + ); + cParserMap.put( + MESSAGE, + new FactoryEntry() { + + public Node create() { + return new MessageNode(); + } + } + ); + cParserMap.put( + MULTIREQ, + new FactoryEntry() { + + public Node create() { + return new MultiReqNode(); + } + } + ); + cParserMap.put( + MULTIEXPREQ, + new FactoryEntry() { + + public Node create() { + return new MultiExpReqNode(); + } + } + ); + cParserMap.put( + SIMPLEREQ, + new FactoryEntry() { + + public Node create() { + return new SimpleReqNode(); + } + } + ); + cParserMap.put( + SIMPLEEXPREQ, + new FactoryEntry() { + + public Node create() { + return new SimpleExpReqNode(); + } + } + ); + cParserMap.put( + IMETHODCALL, + new FactoryEntry() { + + public Node create() { + return new IMethodCallNode(); + } + } + ); + cParserMap.put( + METHODCALL, + new FactoryEntry() { + + public Node create() { + return new MethodCallNode(); + } + } + ); + cParserMap.put( + EXPMETHODCALL, + new FactoryEntry() { + + public Node create() { + return new ExpMethodCallNode(); + } + } + ); + cParserMap.put( + PARAMVALUE, + new FactoryEntry() { + + public Node create() { + return new ParamValueNode(); + } + } + ); + cParserMap.put( + IPARAMVALUE, + new FactoryEntry() { + + public Node create() { + return new IParamValueNode(); + } + } + ); + cParserMap.put( + EXPPARAMVALUE, + new FactoryEntry() { + + public Node create() { + return new ExpParamValueNode(); + } + } + ); + cParserMap.put( + MULTIRSP, + new FactoryEntry() { + + public Node create() { + return new MultiRspNode(); + } + } + ); + cParserMap.put( + MULTIEXPRSP, + new FactoryEntry() { + + public Node create() { + return new MultiExpRspNode(); + } + } + ); + cParserMap.put( + SIMPLERSP, + new FactoryEntry() { + + public Node create() { + return new SimpleRspNode(); + } + } + ); + cParserMap.put( + SIMPLEEXPRSP, + new FactoryEntry() { + + public Node create() { + return new SimpleExpRspNode(); + } + } + ); + cParserMap.put( + METHODRESPONSE, + new FactoryEntry() { + + public Node create() { + return new MethodResponseNode(); + } + } + ); + cParserMap.put( + EXPMETHODRESPONSE, + new FactoryEntry() { + + public Node create() { + return new ExpMethodResponseNode(); + } + } + ); + cParserMap.put( + IMETHODRESPONSE, + new FactoryEntry() { + + public Node create() { + return new IMethodResponseNode(); + } + } + ); + cParserMap.put( + ERROR, + new FactoryEntry() { + + public Node create() { + return new ErrorNode(); + } + } + ); + cParserMap.put( + RETURNVALUE, + new FactoryEntry() { + + public Node create() { + return new ReturnValueNode(); + } + } + ); + cParserMap.put( + IRETURNVALUE, + new FactoryEntry() { + + public Node create() { + return new IReturnValueNode(); + } + } + ); + cParserMap.put( + CORRELATOR, + new FactoryEntry() { + + public Node create() { + return new CorrelatorNode(); + } + } + ); } private static final HashMap NODENAME_HASH = new HashMap(); private static void initNodeNameHash(String[] pEnumA) { - for (int i = 0; i < pEnumA.length; i++) - NODENAME_HASH.put(pEnumA[i], pEnumA[i]); + for (int i = 0; i < pEnumA.length; i++) NODENAME_HASH.put(pEnumA[i], pEnumA[i]); } static { - initNodeNameHash(new String[] { CIM, DECLARATION, DECLGROUP, DECLGROUP_WITHNAME, - DECLGROUP_WITHPATH, QUALIFIER_DECLARATION, SCOPE, VALUE, VALUE_ARRAY, - VALUE_REFERENCE, VALUE_REFARRAY, VALUE_OBJECT, VALUE_NAMEDINSTANCE, - VALUE_NAMEDOBJECT, VALUE_OBJECTWITHLOCALPATH, VALUE_OBJECTWITHPATH, VALUE_NULL, + initNodeNameHash( + new String[] { + CIM, + DECLARATION, + DECLGROUP, + DECLGROUP_WITHNAME, + DECLGROUP_WITHPATH, + QUALIFIER_DECLARATION, + SCOPE, + VALUE, + VALUE_ARRAY, + VALUE_REFERENCE, + VALUE_REFARRAY, + VALUE_OBJECT, + VALUE_NAMEDINSTANCE, + VALUE_NAMEDOBJECT, + VALUE_OBJECTWITHLOCALPATH, + VALUE_OBJECTWITHPATH, + VALUE_NULL, VALUE_INSTANCEWITHPATH, - - NAMESPACEPATH, LOCALNAMESPACEPATH, HOST, NAMESPACE, CLASSPATH, LOCALCLASSPATH, - CLASSNAME, INSTANCEPATH, LOCALINSTANCEPATH, INSTANCENAME, OBJECTPATH, KEYBINDING, + NAMESPACEPATH, + LOCALNAMESPACEPATH, + HOST, + NAMESPACE, + CLASSPATH, + LOCALCLASSPATH, + CLASSNAME, + INSTANCEPATH, + LOCALINSTANCEPATH, + INSTANCENAME, + OBJECTPATH, + KEYBINDING, KEYVALUE, - - CLASS, INSTANCE, QUALIFIER, PROPERTY, PROPERTY_ARRAY, PROPERTY_REFERENCE, METHOD, - PARAMETER, PARAMETER_REFERENCE, PARAMETER_ARRAY, PARAMETER_REFARRAY, - + CLASS, + INSTANCE, + QUALIFIER, + PROPERTY, + PROPERTY_ARRAY, + PROPERTY_REFERENCE, + METHOD, + PARAMETER, + PARAMETER_REFERENCE, + PARAMETER_ARRAY, + PARAMETER_REFARRAY, /* * TABLE stuff is missing yet */ - MESSAGE, MULTIREQ, MULTIEXPREQ, SIMPLEREQ, SIMPLEEXPREQ, IMETHODCALL, METHODCALL, - EXPMETHODCALL, PARAMVALUE, IPARAMVALUE, EXPPARAMVALUE, MULTIRSP, MULTIEXPRSP, - SIMPLERSP, SIMPLEEXPRSP, METHODRESPONSE, EXPMETHODRESPONSE, IMETHODRESPONSE, ERROR, - RETURNVALUE, IRETURNVALUE, CORRELATOR }); + MESSAGE, + MULTIREQ, + MULTIEXPREQ, + SIMPLEREQ, + SIMPLEEXPREQ, + IMETHODCALL, + METHODCALL, + EXPMETHODCALL, + PARAMVALUE, + IPARAMVALUE, + EXPPARAMVALUE, + MULTIRSP, + MULTIEXPRSP, + SIMPLERSP, + SIMPLEEXPRSP, + METHODRESPONSE, + EXPMETHODRESPONSE, + IMETHODRESPONSE, + ERROR, + RETURNVALUE, + IRETURNVALUE, + CORRELATOR + } + ); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/NodePool.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/NodePool.java index 37724be..4263f02 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/NodePool.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/NodePool.java @@ -41,7 +41,6 @@ */ import java.util.HashMap; - import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node.Node; /** @@ -49,7 +48,6 @@ * which can be reused later without instantiating new ones. */ public class NodePool { - private HashMap iPoolMap = new HashMap(512); private int iHitCnt = 0; @@ -58,7 +56,7 @@ public class NodePool { /** * addNode - * + * * @param pNode */ public void addNode(Node pNode) { @@ -72,7 +70,7 @@ public void addNode(Node pNode) { /** * getNode - * + * * @param pNodeName * @return Node */ @@ -83,14 +81,13 @@ public Node getNode(String pNodeName) { return null; } Node node = ps.get(); - if (node == null) ++this.iMissCnt; - else ++this.iHitCnt; + if (node == null) ++this.iMissCnt; else ++this.iHitCnt; return node; } /** * getHitCnt - * + * * @return int */ public int getHitCnt() { @@ -99,17 +96,15 @@ public int getHitCnt() { /** * getMissCnt - * + * * @return int */ public int getMissCnt() { return this.iMissCnt; } - } class PoolStack { - private static final int CAPACITY = 8, MAX_USECNT = CAPACITY - 1, MAX_IDX = MAX_USECNT; private Node[] iNodeA = new Node[CAPACITY]; @@ -118,7 +113,7 @@ class PoolStack { /** * Ctor. - * + * * @param pNode */ public PoolStack(Node pNode) { @@ -127,7 +122,7 @@ public PoolStack(Node pNode) { /** * put - * + * * @param pNode */ public void put(Node pNode) { @@ -138,7 +133,7 @@ public void put(Node pNode) { /** * get - * + * * @return Node */ public Node get() { @@ -155,5 +150,4 @@ private void decIdx() { private void incIdx() { this.iIdx = (this.iIdx == MAX_IDX ? 0 : this.iIdx + 1); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/SAXHelper.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/SAXHelper.java index bc3c7e5..f1d8265 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/SAXHelper.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/SAXHelper.java @@ -43,19 +43,17 @@ */ import java.io.InputStreamReader; - import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; - import org.metricshub.wbem.javax.cim.CIMArgument; import org.metricshub.wbem.javax.cim.CIMObjectPath; import org.metricshub.wbem.javax.wbem.WBEMException; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node.AbstractMessageNode; import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node.CIMNode; import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node.MessageNode; import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node.SimpleRspNode; import org.metricshub.wbem.sblim.cimclient.internal.http.io.TrailerException; import org.metricshub.wbem.sblim.cimclient.internal.wbem.CIMError; -import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node.AbstractMessageNode; import org.xml.sax.InputSource; /** @@ -66,15 +64,19 @@ public class SAXHelper { /** * parseInvokeMethodResponse - * + * * @param pIs * @param pOutArgs * @param pDefPath * @return Object, any kind of JSR48 value class * @throws Exception */ - public static Object parseInvokeMethodResponse(InputStreamReader pIs, - CIMArgument[] pOutArgs, CIMObjectPath pDefPath) throws Exception { + public static Object parseInvokeMethodResponse( + InputStreamReader pIs, + CIMArgument[] pOutArgs, + CIMObjectPath pDefPath + ) + throws Exception { XMLDefaultHandlerImpl hndlr = new XMLDefaultHandlerImpl(pDefPath); SAXParserFactory factory = SAXParserFactory.newInstance(); SAXParser saxParser = factory.newSAXParser(); @@ -89,15 +91,12 @@ public static Object parseInvokeMethodResponse(InputStreamReader pIs, AbstractMessageNode absMsgNode = msgNode.getAbstractMessageNode(); SimpleRspNode simpRspNode = (SimpleRspNode) absMsgNode; CIMError cimErr = simpRspNode.getCIMError(); - if (cimErr != null) throw new WBEMException(cimErr.getCode(), cimErr.getDescription(), - cimErr.getCIMInstances()); + if (cimErr != null) throw new WBEMException(cimErr.getCode(), cimErr.getDescription(), cimErr.getCIMInstances()); CIMArgument[] outArgs = simpRspNode.getCIMArguments(); if (pOutArgs != null && outArgs != null) { int len = Math.min(pOutArgs.length, outArgs.length); - for (int i = 0; i < len; i++) - pOutArgs[i] = outArgs[i]; + for (int i = 0; i < len; i++) pOutArgs[i] = outArgs[i]; } return simpRspNode.getReturnValueCount() == 0 ? null : simpRspNode.readReturnValue(); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/SAXSession.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/SAXSession.java index 547b3a1..6d2cb2e 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/SAXSession.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/SAXSession.java @@ -48,15 +48,13 @@ * CIM-XML SAX parsing session. */ public class SAXSession { - private CIMObjectPath iDefLocalPath; - private boolean iStrictEmbObjParsing = WBEMConfiguration.getGlobalConfiguration() - .strictEmbObjTypes(); + private boolean iStrictEmbObjParsing = WBEMConfiguration.getGlobalConfiguration().strictEmbObjTypes(); /** * Ctor. - * + * * @param pDefLocalPath */ public SAXSession(CIMObjectPath pDefLocalPath) { @@ -65,7 +63,7 @@ public SAXSession(CIMObjectPath pDefLocalPath) { /** * getDefLocalPath - * + * * @return CIMObjectPath */ public CIMObjectPath getDefLocalPath() { @@ -74,11 +72,10 @@ public CIMObjectPath getDefLocalPath() { /** * strictEmbObjParsing - * + * * @return boolean */ public boolean strictEmbObjParsing() { return this.iStrictEmbObjParsing; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/XMLDefaultHandlerImpl.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/XMLDefaultHandlerImpl.java index 6677a78..6dddad2 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/XMLDefaultHandlerImpl.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/XMLDefaultHandlerImpl.java @@ -47,12 +47,11 @@ import java.util.ArrayList; import java.util.logging.Level; - import org.metricshub.wbem.javax.cim.CIMObjectPath; import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node.CIMNode; import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node.Node; -import org.metricshub.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node.NonVolatileIf; +import org.metricshub.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; import org.xml.sax.Attributes; import org.xml.sax.SAXException; import org.xml.sax.helpers.DefaultHandler; @@ -62,7 +61,6 @@ * for SAX and PULL style XML parsing. */ public class XMLDefaultHandlerImpl extends DefaultHandler { - private Node iRootNode; private NodeStack iNodeStack = new NodeStack(); @@ -79,12 +77,11 @@ public class XMLDefaultHandlerImpl extends DefaultHandler { * NodeStack */ static class NodeStack { - private ArrayList iAL = new ArrayList(); /** * push - * + * * @param pNode */ public void push(Node pNode) { @@ -93,7 +90,7 @@ public void push(Node pNode) { /** * pop - * + * * @return Node */ public Node pop() { @@ -103,19 +100,18 @@ public Node pop() { /** * peek - * + * * @return Node */ public Node peek() { if (this.iAL.size() == 0) return null; return this.iAL.get(this.iAL.size() - 1); } - } /** * Ctor. - * + * * @param pSession * - stores common variables for the whole parsing session * @param pAnyRoot @@ -129,7 +125,7 @@ public XMLDefaultHandlerImpl(SAXSession pSession, boolean pAnyRoot) { /** * Ctor. - * + * * @param pLocalPath * - CIMObjectPathes without local paths will be extended by this * value @@ -143,7 +139,7 @@ public XMLDefaultHandlerImpl(CIMObjectPath pLocalPath, boolean pAnyRoot) { /** * Ctor. - * + * * @param pLocalPath * - CIMObjectPathes without local paths will be extended by this * value @@ -164,23 +160,21 @@ public XMLDefaultHandlerImpl() { * @param localName */ @Override - public void startElement(String uri, String localName, String qName, Attributes attributes) - throws SAXException { + public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { this.iStrBuf = null; String nodeNameEnum = NodeFactory.getEnum(qName); if (nodeNameEnum == null) { - LogAndTraceBroker.getBroker() - .trace( - Level.FINEST, - "Ignoring unrecognized starting CIM-XML element found during parsing: " - + qName); + LogAndTraceBroker + .getBroker() + .trace(Level.FINEST, "Ignoring unrecognized starting CIM-XML element found during parsing: " + qName); return; } Node parentNode = getPeekNode(); if (parentNode == null) { if (!this.iAnyRoot && nodeNameEnum != NodeConstIf.CIM) throw new SAXException( - "First node of CIM-XML document must be CIM! " + nodeNameEnum + " is invalid!"); + "First node of CIM-XML document must be CIM! " + nodeNameEnum + " is invalid!" + ); } if (parentNode != null) parentNode.testChild(nodeNameEnum); // let's look for a Node instance in the pool @@ -217,8 +211,9 @@ public void characters(char ch[], int start, int length) { public void endElement(String uri, String localName, String qName) throws SAXException { String nodeNameEnum = NodeFactory.getEnum(qName); if (nodeNameEnum == null) { - LogAndTraceBroker.getBroker().trace(Level.FINEST, - "Ignoring unrecognized ending CIM-XML element found during parsing: " + qName); + LogAndTraceBroker + .getBroker() + .trace(Level.FINEST, "Ignoring unrecognized ending CIM-XML element found during parsing: " + qName); return; } Node peekNode = this.iNodeStack.pop(); @@ -253,7 +248,7 @@ public void endDocument() { /** * getCIMNode - * + * * @return CIMNode, the root Element of the parsed CIM-XML document */ public CIMNode getCIMNode() { @@ -262,7 +257,7 @@ public CIMNode getCIMNode() { /** * getRootNode - * + * * @return Node, the root element of the parsed CIM-XML stream */ public Node getRootNode() { @@ -271,7 +266,7 @@ public Node getRootNode() { /** * getNodePoolHits - * + * * @return int */ public int getNodePoolHits() { @@ -280,7 +275,7 @@ public int getNodePoolHits() { /** * getNodePoolMisses - * + * * @return int */ public int getNodePoolMisses() { diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractArrayValueNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractArrayValueNode.java index adfada9..a368cce 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractArrayValueNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractArrayValueNode.java @@ -48,11 +48,10 @@ public abstract class AbstractArrayValueNode extends AbstractValueNode implement /** * Ctor. - * + * * @param pNameEnum */ public AbstractArrayValueNode(String pNameEnum) { super(pNameEnum); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractMessageNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractMessageNode.java index f5bd86e..5e79fa0 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractMessageNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractMessageNode.java @@ -49,7 +49,7 @@ public abstract class AbstractMessageNode extends Node implements NonVolatileIf /** * Ctor. - * + * * @param pNameEnum */ public AbstractMessageNode(String pNameEnum) { @@ -61,7 +61,6 @@ public AbstractMessageNode(String pNameEnum) { */ @Override public void childParsed(Node pChild) { - // not needed + // not needed } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractMethodCallNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractMethodCallNode.java index ce80e34..14499e4 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractMethodCallNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractMethodCallNode.java @@ -48,7 +48,6 @@ */ import java.util.ArrayList; - import org.metricshub.wbem.javax.cim.CIMArgument; import org.metricshub.wbem.javax.cim.CIMObjectPath; import org.metricshub.wbem.sblim.cimclient.internal.cim.CIMElementSorter; @@ -61,14 +60,13 @@ * ELEMENT IMETHODCALL (LOCALNAMESPACEPATH, IPARAMVALUE*) * ATTLIST IMETHODCALL * %CIMName; - * + * * ELEMENT METHODCALL ((LOCALINSTANCEPATH | LOCALCLASSPATH), PARAMVALUE*) * ATTLIST METHODCALL * %CIMName; * */ public abstract class AbstractMethodCallNode extends Node implements NonVolatileIf, ObjectPathIf { - private String iName; protected CIMObjectPath iPath; @@ -85,7 +83,7 @@ public abstract class AbstractMethodCallNode extends Node implements NonVolatile /** * Ctor. - * + * * @param pNameEnum */ public AbstractMethodCallNode(String pNameEnum) { @@ -107,7 +105,7 @@ public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { * @param pChild */ public void addChild(Node pChild) { - // nothing to do + // nothing to do } @Override @@ -125,7 +123,7 @@ public void childParsed(Node pChild) { */ @Override public void parseData(String pData) { - // no data + // no data } protected abstract void testSpecChild(String pNodeNameEnum) throws SAXException; @@ -137,7 +135,7 @@ public void testChild(String pNodeNameEnum) throws SAXException { /** * getName - * + * * @return String, name of the called method */ public String getName() { @@ -152,7 +150,7 @@ public CIMObjectPath getCIMObjectPath() { /** * getCIMArguments - * + * * @return CIMArgument[] */ public CIMArgument[] getCIMArguments() { @@ -163,7 +161,7 @@ public CIMArgument[] getCIMArguments() { /** * getArgumentCount - * + * * @return int */ public int getArgumentCount() { @@ -173,7 +171,7 @@ public int getArgumentCount() { /** * getArgument - * + * * @param pName * @return CIMArgument */ @@ -184,7 +182,7 @@ public CIMArgument getArgument(String pName) { /** * getArgument - * + * * @param pIdx * @return CIMArgument */ @@ -195,12 +193,10 @@ public CIMArgument getArgument(int pIdx) { @Override public String toString() { - StringBuffer buf = new StringBuffer("Name: " + getName() + "\nPath: " + getCIMObjectPath() - + "\nParamValues:\n"); + StringBuffer buf = new StringBuffer("Name: " + getName() + "\nPath: " + getCIMObjectPath() + "\nParamValues:\n"); for (int i = 0; i < getArgumentCount(); i++) { buf.append(" " + getArgument(i) + "\n"); } return buf.toString(); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractMultiRspNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractMultiRspNode.java index 1a1d94e..4577636 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractMultiRspNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractMultiRspNode.java @@ -48,7 +48,7 @@ public abstract class AbstractMultiRspNode extends AbstractResponseNode { /** * Ctor. - * + * * @param pNameEnum */ public AbstractMultiRspNode(String pNameEnum) { @@ -57,16 +57,15 @@ public AbstractMultiRspNode(String pNameEnum) { /** * getResponseCount - * + * * @return the number of retrievable responses */ public abstract int getResponseCount(); /** * readResponse - * + * * @return AbstractSimpleRspNode */ public abstract AbstractSimpleRspNode readResponse(); - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractObjectNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractObjectNode.java index 3f744d7..88829f8 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractObjectNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractObjectNode.java @@ -47,16 +47,14 @@ * classes. */ public abstract class AbstractObjectNode extends Node implements ValueIf { - protected CIMObjectPath iLocalPath; /** * Ctor. - * + * * @param pNameEnum */ public AbstractObjectNode(String pNameEnum) { super(pNameEnum); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractObjectPathNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractObjectPathNode.java index 896915a..31b1785 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractObjectPathNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractObjectPathNode.java @@ -1,15 +1,15 @@ /** * (C) Copyright IBM Corp. 2006, 2009 * - * THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE - * ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + * THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + * ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE * CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. * * You can obtain a current copy of the Eclipse Public License from * http://www.opensource.org/licenses/eclipse-1.0.php * - * @author : Endre Bak, ebak@de.ibm.com - * + * @author : Endre Bak, ebak@de.ibm.com + * * Flag Date Prog Description * ------------------------------------------------------------------------------- * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant @@ -47,11 +47,10 @@ public abstract class AbstractObjectPathNode extends AbstractPathNode { /** * Ctor. - * + * * @param pNameEnum */ public AbstractObjectPathNode(String pNameEnum) { super(pNameEnum); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractParamValueNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractParamValueNode.java index 5fa88ef..74e96e5 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractParamValueNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractParamValueNode.java @@ -51,7 +51,7 @@ public abstract class AbstractParamValueNode extends Node implements TypedIf, Va /** * Ctor. - * + * * @param pNameEnum */ public AbstractParamValueNode(String pNameEnum) { @@ -60,9 +60,8 @@ public AbstractParamValueNode(String pNameEnum) { /** * getCIMArgument - * + * * @return CIMArgument */ public abstract CIMArgument getCIMArgument(); - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractParameterNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractParameterNode.java index 87140b2..a498461 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractParameterNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractParameterNode.java @@ -55,7 +55,6 @@ * ParameterNode, ParameterRefArrayNode and ParameterReferenceNode classes. */ public abstract class AbstractParameterNode extends Node implements TypedIf { - private String iName; protected QualifiedNodeHandler iQualiHandler; @@ -64,7 +63,7 @@ public abstract class AbstractParameterNode extends Node implements TypedIf { /** * Ctor. - * + * * @param pNameEnum */ public AbstractParameterNode(String pNameEnum) { @@ -83,8 +82,9 @@ public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { @Override public void testChild(String pNodeNameEnum) throws SAXException { - if (pNodeNameEnum != QUALIFIER) throw new SAXException(getNodeName() + " cannot have " - + pNodeNameEnum + " child node!"); + if (pNodeNameEnum != QUALIFIER) throw new SAXException( + getNodeName() + " cannot have " + pNodeNameEnum + " child node!" + ); } @Override @@ -97,27 +97,29 @@ public void childParsed(Node pChild) { */ @Override public void parseData(String pData) { - // no data + // no data } /** * getCIMParameter - * + * * @return CIMParameter */ public CIMParameter getCIMParameter() { /* * CIMParameter(String name, CIMDataType type, CIMQualifier[] * qualifiers) - * + * * Not dealing with embedded object is faster. Here we don't have to do * anything with embedded object qualifier, since parameter doesn't have * value. - * + * * Strict embObj type parsing requires different behavior. */ - return new CIMParameter(this.iName, getType(), this.iQualiHandler - .getQualis(!this.iSession.strictEmbObjParsing())); + return new CIMParameter( + this.iName, + getType(), + this.iQualiHandler.getQualis(!this.iSession.strictEmbObjParsing()) + ); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractPathNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractPathNode.java index 58dfb19..67979e0 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractPathNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractPathNode.java @@ -47,7 +47,7 @@ public abstract class AbstractPathNode extends Node implements ObjectPathIf, Val /** * Ctor. - * + * * @param pNameEnum */ public AbstractPathNode(String pNameEnum) { @@ -61,5 +61,4 @@ public AbstractPathNode(String pNameEnum) { public Object getValue() { return getCIMObjectPath(); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractPropertyNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractPropertyNode.java index 72e34e8..3aab3e1 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractPropertyNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractPropertyNode.java @@ -46,9 +46,9 @@ */ import org.metricshub.wbem.javax.cim.CIMClassProperty; +import org.metricshub.wbem.javax.cim.CIMProperty; import org.metricshub.wbem.javax.cim.CIMQualifier; import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.metricshub.wbem.javax.cim.CIMProperty; import org.xml.sax.Attributes; import org.xml.sax.SAXException; @@ -57,7 +57,6 @@ * PropertyReferenceNode classes. */ public abstract class AbstractPropertyNode extends Node implements TypedIf, ValueIf { - // common attributes private String iName; @@ -69,7 +68,7 @@ public abstract class AbstractPropertyNode extends Node implements TypedIf, Valu /** * Ctor. - * + * * @param pNameEnum */ public AbstractPropertyNode(String pNameEnum) { @@ -78,15 +77,14 @@ public AbstractPropertyNode(String pNameEnum) { /** * hasValue - * + * * @return true if it has a value child node */ protected abstract boolean hasValueNode(); protected abstract void childValueNodeParsed(Node pChild) throws SAXException; - protected abstract void specificInit(Attributes pAttribs, SAXSession pSession) - throws SAXException; + protected abstract void specificInit(Attributes pAttribs, SAXSession pSession) throws SAXException; protected abstract String getChildValueNodeNameEnum(); @@ -103,10 +101,12 @@ public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { public void testChild(String pNodeNameEnum) throws SAXException { String valueNodeNameEnum = getChildValueNodeNameEnum(); if (pNodeNameEnum == valueNodeNameEnum) { - if (hasValueNode()) throw new SAXException(getNodeName() + " node can have only one " - + valueNodeNameEnum + " child node!"); - } else if (pNodeNameEnum != QUALIFIER) throw new SAXException(getNodeName() - + " node cannot have " + pNodeNameEnum + " child node!"); + if (hasValueNode()) throw new SAXException( + getNodeName() + " node can have only one " + valueNodeNameEnum + " child node!" + ); + } else if (pNodeNameEnum != QUALIFIER) throw new SAXException( + getNodeName() + " node cannot have " + pNodeNameEnum + " child node!" + ); } /** @@ -114,7 +114,7 @@ public void testChild(String pNodeNameEnum) throws SAXException { */ @Override public void parseData(String pData) { - // no data + // no data } @Override @@ -131,7 +131,7 @@ protected CIMQualifier[] getQualis() { /** * getCIMProperty - * + * * @return CIMProperty */ public CIMProperty getCIMProperty() { @@ -139,13 +139,19 @@ public CIMProperty getCIMProperty() { * CIMProperty( String name, CIMDataType type, Object value, boolean * key, boolean propagated, String originClass ) */ - return new CIMProperty(this.iName, getType(), getValue(), this.iQualiHandler - .isKeyed(), this.iPropagated, this.iClassOrigin); + return new CIMProperty( + this.iName, + getType(), + getValue(), + this.iQualiHandler.isKeyed(), + this.iPropagated, + this.iClassOrigin + ); } /** * getCIMClassProperty - * + * * @return CIMClassProperty */ public CIMClassProperty getCIMClassProperty() { @@ -154,8 +160,14 @@ public CIMClassProperty getCIMClassProperty() { * CIMQualifier[] pQualifiers, boolean pKey, boolean propagated, String * originClass) ); */ - return new CIMClassProperty(this.iName, getType(), getValue(), getQualis(), - this.iQualiHandler.isKeyed(), this.iPropagated, this.iClassOrigin); + return new CIMClassProperty( + this.iName, + getType(), + getValue(), + getQualis(), + this.iQualiHandler.isKeyed(), + this.iPropagated, + this.iClassOrigin + ); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractResponseNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractResponseNode.java index d8ad8de..9573537 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractResponseNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractResponseNode.java @@ -47,11 +47,10 @@ public abstract class AbstractResponseNode extends AbstractMessageNode { /** * Ctor. - * + * * @param pNameEnum */ public AbstractResponseNode(String pNameEnum) { super(pNameEnum); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractScalarValueNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractScalarValueNode.java index 1ec4555..9ec5aeb 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractScalarValueNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractScalarValueNode.java @@ -50,11 +50,10 @@ public abstract class AbstractScalarValueNode extends AbstractValueNode { /** * Ctor. - * + * * @param pNameEnum */ public AbstractScalarValueNode(String pNameEnum) { super(pNameEnum); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractSimpleRspNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractSimpleRspNode.java index 93fccaf..66d0282 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractSimpleRspNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractSimpleRspNode.java @@ -47,12 +47,11 @@ * Class AbstractSimpleRspNode is the superclass of SimpleExpRspNode and * SimpleRspNode classes. */ -public abstract class AbstractSimpleRspNode extends AbstractResponseNode implements ErrorIf, - RetValPipeIf { +public abstract class AbstractSimpleRspNode extends AbstractResponseNode implements ErrorIf, RetValPipeIf { /** * Ctor. - * + * * @param pNameEnum */ public AbstractSimpleRspNode(String pNameEnum) { @@ -63,9 +62,8 @@ public AbstractSimpleRspNode(String pNameEnum) { /** * getCIMArguments - * + * * @return CIMArgument[] */ public abstract CIMArgument[] getCIMArguments(); - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractValueNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractValueNode.java index 5dd0b2b..5ed3995 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractValueNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/AbstractValueNode.java @@ -48,11 +48,10 @@ public abstract class AbstractValueNode extends Node implements TypedIf, ValueIf /** * Ctor. - * + * * @param pNameEnum */ public AbstractValueNode(String pNameEnum) { super(pNameEnum); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ArrayIf.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ArrayIf.java index e6f84d9..7a6f2e3 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ArrayIf.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ArrayIf.java @@ -43,20 +43,18 @@ * It is implemented by the AbstractArrayValueNode class. */ public interface ArrayIf { - /** * size - * + * * @return int */ public int size(); /** * elementAt - * + * * @param pIdx * @return Object */ public Object elementAt(int pIdx); - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/CIMNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/CIMNode.java index a3e7308..4be78ce 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/CIMNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/CIMNode.java @@ -80,11 +80,13 @@ public void addChild(Node pChild) { @Override public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { this.iCimVersion = pAttribs.getValue("CIMVERSION"); - if (this.iCimVersion == null) { throw new SAXException( - "CIMVERSION attribute is mandatory for " + getNodeName() + " node!"); } + if (this.iCimVersion == null) { + throw new SAXException("CIMVERSION attribute is mandatory for " + getNodeName() + " node!"); + } this.iDtdVersion = pAttribs.getValue("DTDVERSION"); - if (this.iDtdVersion == null) { throw new SAXException( - "DTDVERSION attribute is mandatory for " + getNodeName() + " node!"); } + if (this.iDtdVersion == null) { + throw new SAXException("DTDVERSION attribute is mandatory for " + getNodeName() + " node!"); + } this.iContent = null; } @@ -103,15 +105,15 @@ public void testChild(String pNodeNameEnum) throws SAXException { throw new SAXException(msg); } if (pNodeNameEnum == MESSAGE) return; - String msg = (pNodeNameEnum == DECLARATION) ? "DECLARATION child node not supported by CIM node!" - : pNodeNameEnum + " cannot be a child node of CIM node!"; + String msg = (pNodeNameEnum == DECLARATION) + ? "DECLARATION child node not supported by CIM node!" + : pNodeNameEnum + " cannot be a child node of CIM node!"; throw new SAXException(msg); } @Override public void testCompletness() throws SAXException { - if (this.iContent == null) throw new SAXException( - "CIM node must have a MESSAGE or a DECLARATION child!"); + if (this.iContent == null) throw new SAXException("CIM node must have a MESSAGE or a DECLARATION child!"); } /** @@ -119,12 +121,12 @@ public void testCompletness() throws SAXException { */ @Override public void childParsed(Node pChild) { - // nothing to do here + // nothing to do here } /** * getCimVersion - * + * * @return String */ public String getCimVersion() { @@ -133,7 +135,7 @@ public String getCimVersion() { /** * getDtdVersion - * + * * @return String */ public String getDtdVersion() { @@ -142,13 +144,12 @@ public String getDtdVersion() { /** * getMessageNode - * + * * @return MessageNode or null */ public MessageNode getMessageNode() { return (this.iContent instanceof MessageNode) ? (MessageNode) this.iContent : null; } - // not implemented yet // public DeclarationNode getDeclarationNode() {} diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ClassNameNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ClassNameNode.java index 2de56ec..6913c93 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ClassNameNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ClassNameNode.java @@ -56,7 +56,6 @@ * */ public class ClassNameNode extends AbstractPathNode { - private String iClassName; private CIMObjectPath iLocalPath; @@ -79,7 +78,7 @@ public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { */ @Override public void parseData(String pData) { - // no data + // no data } /** @@ -92,7 +91,7 @@ public void testChild(String pNodeNameEnum) throws SAXException { @Override public void testCompletness() { - // no child nodes to test + // no child nodes to test } /** @@ -100,12 +99,12 @@ public void testCompletness() { */ @Override public void childParsed(Node pChild) { - // nothing to do + // nothing to do } /** * getClassName - * + * * @return String */ public String getClassName() { @@ -115,5 +114,4 @@ public String getClassName() { public CIMObjectPath getCIMObjectPath() { return LocalPathBuilder.build(this.iLocalPath, this.iClassName, null); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ClassNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ClassNode.java index add4f08..b5c1f00 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ClassNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ClassNode.java @@ -47,7 +47,6 @@ */ import java.util.ArrayList; - import org.metricshub.wbem.javax.cim.CIMClass; import org.metricshub.wbem.javax.cim.CIMClassProperty; import org.metricshub.wbem.javax.cim.CIMMethod; @@ -62,12 +61,11 @@ *
        * ELEMENT CLASS (QUALIFIER*, (PROPERTY | PROPERTY.ARRAY | PROPERTY.REFERENCE)*, METHOD*)
        * ATTLIST CLASS
      - * %CIMName; 
      + * %CIMName;
        * %SuperClass;
        * 
      */ public class ClassNode extends AbstractObjectNode { - private String iName; private String iSuperClass; @@ -103,18 +101,15 @@ public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { */ @Override public void parseData(String pData) { - // no data + // no data } - private static final String[] ALLOWED_CHILDREN = { QUALIFIER, PROPERTY, PROPERTY_ARRAY, - PROPERTY_REFERENCE, METHOD }; + private static final String[] ALLOWED_CHILDREN = { QUALIFIER, PROPERTY, PROPERTY_ARRAY, PROPERTY_REFERENCE, METHOD }; @Override public void testChild(String pNodeNameEnum) throws SAXException { - for (int i = 0; i < ALLOWED_CHILDREN.length; i++) - if (ALLOWED_CHILDREN[i] == pNodeNameEnum) return; - throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum - + " child node!"); + for (int i = 0; i < ALLOWED_CHILDREN.length; i++) if (ALLOWED_CHILDREN[i] == pNodeNameEnum) return; + throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum + " child node!"); } @Override @@ -133,12 +128,12 @@ public void childParsed(Node pChild) { @Override public void testCompletness() { - // all child nodes are optional + // all child nodes are optional } /** * getCIMClass - * + * * @return CIMClass */ public CIMClass getCIMClass() { @@ -148,10 +143,15 @@ public CIMClass getCIMClass() { * CIMClassProperty[] props, CIMMethod[] pMethods, boolean * pIsAssociation, boolean pIsKeyed ) */ - return new CIMClass(LocalPathBuilder.build(this.iLocalPath, this.iName, null), - this.iSuperClass, this.iQualiHandler.getQualis(), this.iCIMClassPropAL - .toArray(EMPTY_PA), this.iCIMMethodAL.toArray(EMPTY_MA), this.iQualiHandler - .isAssociation(), this.iKeyed); + return new CIMClass( + LocalPathBuilder.build(this.iLocalPath, this.iName, null), + this.iSuperClass, + this.iQualiHandler.getQualis(), + this.iCIMClassPropAL.toArray(EMPTY_PA), + this.iCIMMethodAL.toArray(EMPTY_MA), + this.iQualiHandler.isAssociation(), + this.iKeyed + ); } private static final CIMMethod[] EMPTY_MA = new CIMMethod[0]; @@ -160,14 +160,20 @@ public CIMClass getCIMClass() { /** * getCIMClass - * + * * @param pObjPath * @return CIMClass with the provided object path */ public CIMClass getCIMClass(CIMObjectPath pObjPath) { - return new CIMClass(pObjPath, this.iSuperClass, this.iQualiHandler.getQualis(), - this.iCIMClassPropAL.toArray(EMPTY_PA), this.iCIMMethodAL.toArray(EMPTY_MA), - this.iQualiHandler.isAssociation(), this.iKeyed); + return new CIMClass( + pObjPath, + this.iSuperClass, + this.iQualiHandler.getQualis(), + this.iCIMClassPropAL.toArray(EMPTY_PA), + this.iCIMMethodAL.toArray(EMPTY_MA), + this.iQualiHandler.isAssociation(), + this.iKeyed + ); } /** @@ -177,5 +183,4 @@ public CIMClass getCIMClass(CIMObjectPath pObjPath) { public Object getValue() { return getCIMClass(); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ClassPathNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ClassPathNode.java index 060e9a5..3c4accf 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ClassPathNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ClassPathNode.java @@ -55,7 +55,6 @@ * ELEMENT CLASSPATH (NAMESPACEPATH, CLASSNAME) */ public class ClassPathNode extends AbstractObjectPathNode { - // child nodes: private boolean iHasNameSpacePath, iHasClassName; @@ -89,19 +88,21 @@ public void init(Attributes pAttribs, SAXSession pSession) { */ @Override public void parseData(String pData) { - // no data + // no data } @Override public void testChild(String pNodeNameEnum) throws SAXException { if (pNodeNameEnum == NAMESPACEPATH) { - if (this.iHasNameSpacePath) throw new SAXException( - "CLASSPATH node already has a NAMESPACEPATH child node!"); + if (this.iHasNameSpacePath) throw new SAXException("CLASSPATH node already has a NAMESPACEPATH child node!"); } else if (pNodeNameEnum == CLASSNAME) { - if (this.iHasClassName) throw new SAXException( - "CLASSPATH node already has a CLASSNAME child node!"); - } else throw new SAXException("CLASSPATH node cannot have " + pNodeNameEnum - + " child node!" + " It can have NAMESPACEPATH and CLASSNAME child nodes only!"); + if (this.iHasClassName) throw new SAXException("CLASSPATH node already has a CLASSNAME child node!"); + } else throw new SAXException( + "CLASSPATH node cannot have " + + pNodeNameEnum + + " child node!" + + " It can have NAMESPACEPATH and CLASSNAME child nodes only!" + ); } @Override @@ -119,10 +120,8 @@ public void childParsed(Node pChild) { @Override public void testCompletness() throws SAXException { - if (!this.iHasNameSpacePath) throw new SAXException( - "NAMESPACEPATH child node is mandatory for CLASSPATH node!"); - if (!this.iHasClassName) throw new SAXException( - "CLASSNAME child node is mandatory for CLASSPATH node!"); + if (!this.iHasNameSpacePath) throw new SAXException("NAMESPACEPATH child node is mandatory for CLASSPATH node!"); + if (!this.iHasClassName) throw new SAXException("CLASSNAME child node is mandatory for CLASSPATH node!"); } public CIMObjectPath getCIMObjectPath() { @@ -130,8 +129,13 @@ public CIMObjectPath getCIMObjectPath() { * CIMObjectPath( String scheme, String host, String port, String * namespace, String objectName, CIMProperty[] keys ) */ - return new CIMObjectPath(this.iHostStr.getProtocol(), this.iHostStr.getHost(), - this.iHostStr.getPort(), this.iLocalNameSpacePathStr, this.iClassNameStr, null); + return new CIMObjectPath( + this.iHostStr.getProtocol(), + this.iHostStr.getHost(), + this.iHostStr.getPort(), + this.iLocalNameSpacePathStr, + this.iClassNameStr, + null + ); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/CorrelatorNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/CorrelatorNode.java index 361198a..3589d30 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/CorrelatorNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/CorrelatorNode.java @@ -51,7 +51,6 @@ * */ public class CorrelatorNode extends Node implements TypedIf, ValueIf { - // private String iName; private CIMDataType iType; @@ -83,15 +82,15 @@ public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { */ @Override public void parseData(String pData) { - // no data + // no data } @Override public void testChild(String pNodeNameEnum) throws SAXException { - if (pNodeNameEnum != VALUE) throw new SAXException(pNodeNameEnum - + " cannot be the child node of " + getNodeName() + " node!"); - if (this.iHasValue) throw new SAXException(getNodeName() - + " node can have only one child node!"); + if (pNodeNameEnum != VALUE) throw new SAXException( + pNodeNameEnum + " cannot be the child node of " + getNodeName() + " node!" + ); + if (this.iHasValue) throw new SAXException(getNodeName() + " node can have only one child node!"); } @Override @@ -102,8 +101,7 @@ public void childParsed(Node pChild) { @Override public void testCompletness() throws SAXException { - if (!this.iHasValue) throw new SAXException(getNodeName() - + " node must have one VALUE child node!"); + if (!this.iHasValue) throw new SAXException(getNodeName() + " node must have one VALUE child node!"); } public CIMDataType getType() { @@ -113,5 +111,4 @@ public CIMDataType getType() { public Object getValue() { return this.iValue; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ErrorIf.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ErrorIf.java index 5906660..2ae221e 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ErrorIf.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ErrorIf.java @@ -45,12 +45,10 @@ * This interface is implemented by Nodes which can provide CIMError info. */ public interface ErrorIf { - /** * getCIMError - * + * * @return CIMError */ public CIMError getCIMError(); - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ErrorNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ErrorNode.java index cee89ba..35f50bf 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ErrorNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ErrorNode.java @@ -47,7 +47,6 @@ */ import java.util.ArrayList; - import org.metricshub.wbem.javax.cim.CIMInstance; import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; import org.metricshub.wbem.sblim.cimclient.internal.wbem.CIMError; @@ -63,7 +62,6 @@ * */ public class ErrorNode extends Node implements ErrorIf { - private int iCode; private String iDesc; @@ -84,13 +82,11 @@ public ErrorNode() { public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { this.iCIMInstAL = null; String code = pAttribs.getValue("CODE"); - if (code == null) throw new SAXException(getNodeName() - + " node must have a CODE attribute!"); + if (code == null) throw new SAXException(getNodeName() + " node must have a CODE attribute!"); try { this.iCode = Integer.parseInt(code); } catch (NumberFormatException e) { - throw new SAXException("Failed to parse CODE attribute in " + getNodeName() + " node!", - e); + throw new SAXException("Failed to parse CODE attribute in " + getNodeName() + " node!", e); } this.iDesc = pAttribs.getValue("DESCRIPTION"); } @@ -100,13 +96,14 @@ public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { */ @Override public void parseData(String pData) { - // no data + // no data } @Override public void testChild(String pNodeNameEnum) throws SAXException { - if (pNodeNameEnum != INSTANCE) throw new SAXException(getNodeName() + " node cannot have " - + pNodeNameEnum + " child node!"); + if (pNodeNameEnum != INSTANCE) throw new SAXException( + getNodeName() + " node cannot have " + pNodeNameEnum + " child node!" + ); } @Override @@ -117,15 +114,15 @@ public void childParsed(Node pChild) { @Override public void testCompletness() { - // no mandatory child nodes + // no mandatory child nodes } private static final CIMInstance[] EMPTY_IA = new CIMInstance[0]; public CIMError getCIMError() { - if (this.iCIMInstAL != null) { return new CIMError(this.iCode, this.iDesc, this.iCIMInstAL - .toArray(EMPTY_IA)); } + if (this.iCIMInstAL != null) { + return new CIMError(this.iCode, this.iDesc, this.iCIMInstAL.toArray(EMPTY_IA)); + } return new CIMError(this.iCode, this.iDesc); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ExpMethodCallNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ExpMethodCallNode.java index 2fd6cc3..a701e89 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ExpMethodCallNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ExpMethodCallNode.java @@ -45,7 +45,6 @@ */ import java.util.ArrayList; - import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; import org.xml.sax.Attributes; import org.xml.sax.SAXException; @@ -59,10 +58,9 @@ */ /** * Class ExpMethodCallNode is responsible for - * + * */ public class ExpMethodCallNode extends Node implements NonVolatileIf { - private String iName; private ArrayList iExpParamValNodeAList; @@ -93,14 +91,14 @@ public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { */ @Override public void parseData(String pData) { - // no data + // no data } @Override public void testChild(String pNodeNameEnum) throws SAXException { - if (pNodeNameEnum != EXPPARAMVALUE) throw new SAXException(getNodeName() - + " node can have " + EXPPARAMVALUE + " child only! " + pNodeNameEnum - + " is invalid!"); + if (pNodeNameEnum != EXPPARAMVALUE) throw new SAXException( + getNodeName() + " node can have " + EXPPARAMVALUE + " child only! " + pNodeNameEnum + " is invalid!" + ); } /** @@ -108,22 +106,21 @@ public void testChild(String pNodeNameEnum) throws SAXException { */ @Override public void childParsed(Node pChild) { - // nothing to do yet + // nothing to do yet } @Override public void testCompletness() { - // no mandatory child + // no mandatory child } /** * getName - * + * * @return String */ public String getName() { return this.iName; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ExpMethodResponseNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ExpMethodResponseNode.java index 27bef4d..a0af686 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ExpMethodResponseNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ExpMethodResponseNode.java @@ -57,7 +57,6 @@ * */ public class ExpMethodResponseNode extends Node implements ErrorIf, RetValPipeIf, NonVolatileIf { - private String iName; private ErrorNode iErrorNode; @@ -72,8 +71,8 @@ public ExpMethodResponseNode() { } public void addChild(Node pChild) { - if (pChild instanceof ErrorNode) this.iErrorNode = (ErrorNode) pChild; - else this.iRetValNode = (IReturnValueNode) pChild; + if (pChild instanceof ErrorNode) this.iErrorNode = (ErrorNode) pChild; else this.iRetValNode = + (IReturnValueNode) pChild; } /** @@ -91,21 +90,24 @@ public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { */ @Override public void parseData(String pData) { - // no data + // no data } @Override public void testChild(String pNodeNameEnum) throws SAXException { if (pNodeNameEnum == ERROR || pNodeNameEnum == IRETURNVALUE) { Node node; - if (this.iErrorNode != null) node = this.iErrorNode; - else if (this.iRetValNode != null) node = this.iRetValNode; - else node = null; - if (node != null) throw new SAXException(pNodeNameEnum + " child node is invalid for " - + getNodeName() + " node, since it already has a " + node.getNodeName() - + " child node!"); - } else throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum - + " child node!"); + if (this.iErrorNode != null) node = this.iErrorNode; else if (this.iRetValNode != null) node = + this.iRetValNode; else node = null; + if (node != null) throw new SAXException( + pNodeNameEnum + + " child node is invalid for " + + getNodeName() + + " node, since it already has a " + + node.getNodeName() + + " child node!" + ); + } else throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum + " child node!"); } /** @@ -113,12 +115,12 @@ public void testChild(String pNodeNameEnum) throws SAXException { */ @Override public void childParsed(Node pChild) { - // nothing to do yet + // nothing to do yet } @Override public void testCompletness() { - // no mandatory child nodes + // no mandatory child nodes } public CIMError getCIMError() { @@ -135,7 +137,7 @@ public Object readReturnValue() { /** * getName - * + * * @return String */ public String getName() { diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ExpParamValueNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ExpParamValueNode.java index 0204136..10d703d 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ExpParamValueNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ExpParamValueNode.java @@ -56,7 +56,6 @@ * */ public class ExpParamValueNode extends Node implements NonVolatileIf { - private String iName; private Node iChildNode; @@ -86,15 +85,15 @@ public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { */ @Override public void parseData(String pData) { - // no data + // no data } @Override public void testChild(String pNodeNameEnum) throws SAXException { - if (this.iChildNode != null) throw new SAXException(getNodeName() - + " node can have only one child node!"); - if (pNodeNameEnum != INSTANCE) throw new SAXException(getNodeName() + " node cannot have " - + pNodeNameEnum + " child node!"); + if (this.iChildNode != null) throw new SAXException(getNodeName() + " node can have only one child node!"); + if (pNodeNameEnum != INSTANCE) throw new SAXException( + getNodeName() + " node cannot have " + pNodeNameEnum + " child node!" + ); } /** @@ -102,21 +101,20 @@ public void testChild(String pNodeNameEnum) throws SAXException { */ @Override public void childParsed(Node pChild) { - // nothing to do yet + // nothing to do yet } @Override public void testCompletness() { - // child node is optional + // child node is optional } /** * getName - * + * * @return String */ public String getName() { return this.iName; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/HostNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/HostNode.java index 58adab7..e19ecc0 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/HostNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/HostNode.java @@ -51,7 +51,6 @@ * ELEMENT HOST (#PCDATA) */ public class HostNode extends Node { - private String iHost; /** @@ -89,23 +88,21 @@ public void testChild(String pNodeNameEnum) throws SAXException { */ @Override public void childParsed(Node pChild) { - // no child node + // no child node } @Override public void testCompletness() throws SAXException { - if (this.iHost == null) throw new SAXException( - "HOST node must contain the host name as #PCDATA!"); + if (this.iHost == null) throw new SAXException("HOST node must contain the host name as #PCDATA!"); } /** * getHostStr - * + * * @return String which may contain the protocol, host and port */ public String getHostStr() { return this.iHost; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/IMethodCallNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/IMethodCallNode.java index 7fc0f18..ca11707 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/IMethodCallNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/IMethodCallNode.java @@ -62,16 +62,16 @@ public IMethodCallNode() { @Override protected void testSpecChild(String pNodeNameEnum) throws SAXException { if (pNodeNameEnum == LOCALNAMESPACEPATH) { - if (this.iPath != null) throw new SAXException(getNodeName() - + " node can have only one " + pNodeNameEnum + " child node!"); - } else if (pNodeNameEnum != IPARAMVALUE) throw new SAXException(getNodeName() - + " node cannot have " + pNodeNameEnum + " child node!"); + if (this.iPath != null) throw new SAXException( + getNodeName() + " node can have only one " + pNodeNameEnum + " child node!" + ); + } else if (pNodeNameEnum != IPARAMVALUE) throw new SAXException( + getNodeName() + " node cannot have " + pNodeNameEnum + " child node!" + ); } @Override public void testCompletness() throws SAXException { - if (this.iPath == null) throw new SAXException( - "IMETHODCALL node must have a LOCALNAMESPACEPATH child node!"); + if (this.iPath == null) throw new SAXException("IMETHODCALL node must have a LOCALNAMESPACEPATH child node!"); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/IMethodResponseNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/IMethodResponseNode.java index b671249..d9f22c6 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/IMethodResponseNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/IMethodResponseNode.java @@ -47,7 +47,6 @@ */ import java.util.ArrayList; - import org.metricshub.wbem.javax.cim.CIMArgument; import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; import org.metricshub.wbem.sblim.cimclient.internal.wbem.CIMError; @@ -58,15 +57,14 @@ *
        * ELEMENT IMETHODRESPONSE (ERROR|IRETURNVALUE?)
        * ATTLIST IMETHODRESPONSE
      - *   %CIMName; 
      + *   %CIMName;
        * 
      */ /** * Class IMethodResponseNode is responsible for - * + * */ public class IMethodResponseNode extends Node implements ErrorIf, RetValPipeIf, NonVolatileIf { - private String iName; private ErrorNode iErrorNode; @@ -114,34 +112,44 @@ public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { */ @Override public void parseData(String pData) { - // no data + // no data } @Override public void testChild(String pNodeNameEnum) throws SAXException { if (pNodeNameEnum == ERROR) { String ownedNodeName; - if (this.iHasRetVal) ownedNodeName = IRETURNVALUE; - else if (this.iHasError) ownedNodeName = ERROR; - else if (this.iCIMArgAL != null && this.iCIMArgAL.size() > 0) ownedNodeName = PARAMVALUE; - else ownedNodeName = null; - if (ownedNodeName != null) throw new SAXException(pNodeNameEnum - + " child node is invalid for " + getNodeName() - + " node, since it already has a " + ownedNodeName + " child node!"); + if (this.iHasRetVal) ownedNodeName = IRETURNVALUE; else if (this.iHasError) ownedNodeName = ERROR; else if ( + this.iCIMArgAL != null && this.iCIMArgAL.size() > 0 + ) ownedNodeName = PARAMVALUE; else ownedNodeName = null; + if (ownedNodeName != null) throw new SAXException( + pNodeNameEnum + + " child node is invalid for " + + getNodeName() + + " node, since it already has a " + + ownedNodeName + + " child node!" + ); } else if (pNodeNameEnum == IRETURNVALUE) { String ownedNodeName; - if (this.iHasRetVal) ownedNodeName = IRETURNVALUE; - else if (this.iHasError) ownedNodeName = ERROR; - else ownedNodeName = null; - if (ownedNodeName != null) throw new SAXException(pNodeNameEnum - + " child node is invalid for " + getNodeName() - + " node, since it already has a " + ownedNodeName + " child node!"); + if (this.iHasRetVal) ownedNodeName = IRETURNVALUE; else if (this.iHasError) ownedNodeName = + ERROR; else ownedNodeName = null; + if (ownedNodeName != null) throw new SAXException( + pNodeNameEnum + + " child node is invalid for " + + getNodeName() + + " node, since it already has a " + + ownedNodeName + + " child node!" + ); } else if (pNodeNameEnum == PARAMVALUE) { - if (this.iHasError) throw new SAXException(pNodeNameEnum - + " child node is invalid for " + getNodeName() - + " node, since it already has an ERROR child node!"); - } else throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum - + " child node!"); + if (this.iHasError) throw new SAXException( + pNodeNameEnum + + " child node is invalid for " + + getNodeName() + + " node, since it already has an ERROR child node!" + ); + } else throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum + " child node!"); } /** @@ -155,8 +163,7 @@ public void childParsed(Node pChild) { } else if (pChild instanceof IReturnValueNode) { this.iHasRetVal = true; this.iRetValNode = (IReturnValueNode) pChild; - } else - // Values of parameters should be stored in array + } else // Values of parameters should be stored in array if (pChild instanceof ParamValueNode) { if (this.iCIMArgAL == null) this.iCIMArgAL = new ArrayList>(); this.iCIMArgAL.add(((ParamValueNode) pChild).getCIMArgument()); @@ -165,7 +172,7 @@ public void childParsed(Node pChild) { @Override public void testCompletness() { - // no mandatory child nodes + // no mandatory child nodes } public CIMError getCIMError() { @@ -182,7 +189,7 @@ public Object readReturnValue() { /** * getName - * + * * @return String */ public String getName() { @@ -192,12 +199,11 @@ public String getName() { /** * getCIMArguments : returns the array of parsed parameters and their values * : String name, CIMDataType type, Object value - * + * * @return CIMArgument<?>[] */ public CIMArgument[] getCIMArguments() { if (this.iCIMArgAL == null || this.iCIMArgAL.size() == 0) return null; return this.iCIMArgAL.toArray(EMPTY_ARG_A); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/IParamValueNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/IParamValueNode.java index 553ee7d..f7865fe 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/IParamValueNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/IParamValueNode.java @@ -54,9 +54,9 @@ /** * FIXME: Why hasn't it got TYPE attribute? For VALUE and VALUE.ARRAY it would * be necessary. - * + * *
      - * 
      + *
        * ELEMENT IPARAMVALUE (VALUE | VALUE.ARRAY | VALUE.REFERENCE | INSTANCENAME | CLASSNAME |
        *   QUALIFIER.DECLARATION | CLASS | INSTANCE | VALUE.NAMEDINSTANCE)?
        * ATTLIST IPARAMVALUE
      @@ -64,7 +64,6 @@
        * 
      */ public class IParamValueNode extends AbstractParamValueNode { - private String iName; /** @@ -98,11 +97,20 @@ public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { */ @Override public void parseData(String pData) { - // no data + // no data } - private static final String[] ALLOWED_CHILDREN = { VALUE, VALUE_ARRAY, VALUE_REFERENCE, - INSTANCENAME, CLASSNAME, QUALIFIER_DECLARATION, CLASS, INSTANCE, VALUE_NAMEDINSTANCE }; + private static final String[] ALLOWED_CHILDREN = { + VALUE, + VALUE_ARRAY, + VALUE_REFERENCE, + INSTANCENAME, + CLASSNAME, + QUALIFIER_DECLARATION, + CLASS, + INSTANCE, + VALUE_NAMEDINSTANCE + }; @Override public void testChild(String pNodeNameEnum) throws SAXException { @@ -113,31 +121,28 @@ public void testChild(String pNodeNameEnum) throws SAXException { break; } } - if (!allowed) throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum - + " child node!"); + if (!allowed) throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum + " child node!"); /* * this kind of check is not so strict (ValueNode.getValue() can return * null) */ - if (this.iValue != null) throw new SAXException(getNodeName() - + " node cannot have more than one child node!"); - + if (this.iValue != null) throw new SAXException(getNodeName() + " node cannot have more than one child node!"); } @Override public void childParsed(Node pChild) { this.iValue = ((ValueIf) pChild).getValue(); this.iIsArray = pChild instanceof ArrayIf; - if (pChild instanceof TypedIf) this.iType = ((TypedIf) pChild).getType(); - else if (pChild instanceof ObjectPathIf) this.iType = CIMDataType - .getDataType(((ObjectPathIf) pChild).getCIMObjectPath()); - else if (pChild instanceof ValueIf) this.iType = CIMDataType.getDataType(((ValueIf) pChild) - .getValue()); + if (pChild instanceof TypedIf) this.iType = ((TypedIf) pChild).getType(); else if ( + pChild instanceof ObjectPathIf + ) this.iType = CIMDataType.getDataType(((ObjectPathIf) pChild).getCIMObjectPath()); else if ( + pChild instanceof ValueIf + ) this.iType = CIMDataType.getDataType(((ValueIf) pChild).getValue()); } @Override public void testCompletness() { - // child node is optional + // child node is optional } @Override @@ -147,7 +152,7 @@ public CIMArgument getCIMArgument() { /** * getName - * + * * @return String */ public String getName() { @@ -155,12 +160,10 @@ public String getName() { } public CIMDataType getType() { - return this.iType == null ? (this.iIsArray ? CIMDataType.STRING_ARRAY_T - : CIMDataType.STRING_T) : this.iType; + return this.iType == null ? (this.iIsArray ? CIMDataType.STRING_ARRAY_T : CIMDataType.STRING_T) : this.iType; } public Object getValue() { return this.iValue; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/IReturnValueNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/IReturnValueNode.java index 3760369..4e41fbd 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/IReturnValueNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/IReturnValueNode.java @@ -46,14 +46,13 @@ */ import java.util.LinkedList; - import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; import org.xml.sax.Attributes; import org.xml.sax.SAXException; /** *
      - * 
      + *
        * ELEMENT IRETURNVALUE (
        *   CLASSNAME* | INSTANCENAME* | VALUE* | VALUE.OBJECTWITHPATH* | VALUE.OBJECTWITHLOCALPATH* |
        *   VALUE.OBJECT* | OBJECTPATH* | QUALIFIER.DECLARATION* | VALUE.ARRAY? | VALUE.REFERENCE? |
      @@ -62,7 +61,6 @@
        * 
      */ public class IReturnValueNode extends Node implements RetValPipeIf, NonVolatileIf { - private String iChildNameEnum; private LinkedList iChildValueLL; @@ -77,7 +75,9 @@ public IReturnValueNode() { /** * @param pChild */ - public void addChild(Node pChild) { /* we don't need it here */} + public void addChild(Node pChild) { + /* we don't need it here */ + } /** * @param pAttribs @@ -97,13 +97,26 @@ public void init(Attributes pAttribs, SAXSession pSession) { */ @Override public void parseData(String pData) { - // no data + // no data } - private static final String[] ALLOWED_CHILDREN = { CLASSNAME, INSTANCENAME, INSTANCEPATH, - VALUE, VALUE_OBJECTWITHPATH, VALUE_OBJECTWITHLOCALPATH, VALUE_OBJECT, OBJECTPATH, - QUALIFIER_DECLARATION, VALUE_ARRAY, VALUE_REFERENCE, CLASS, INSTANCE, - VALUE_NAMEDINSTANCE, VALUE_INSTANCEWITHPATH }; + private static final String[] ALLOWED_CHILDREN = { + CLASSNAME, + INSTANCENAME, + INSTANCEPATH, + VALUE, + VALUE_OBJECTWITHPATH, + VALUE_OBJECTWITHLOCALPATH, + VALUE_OBJECT, + OBJECTPATH, + QUALIFIER_DECLARATION, + VALUE_ARRAY, + VALUE_REFERENCE, + CLASS, + INSTANCE, + VALUE_NAMEDINSTANCE, + VALUE_INSTANCEWITHPATH + }; // private static final String[] SINGLE_CHILDREN = { VALUE_ARRAY, // VALUE_REFERENCE }; @@ -114,19 +127,23 @@ public void parseData(String pData) { @Override public void testChild(String pNodeNameEnum) throws SAXException { if (this.iChildNameEnum != null) { - if (pNodeNameEnum != this.iChildNameEnum) throw new SAXException(getNodeName() - + " node cannot have " + pNodeNameEnum + " child node, since it already has " - + this.iChildNameEnum + " child node(s)!"); + if (pNodeNameEnum != this.iChildNameEnum) throw new SAXException( + getNodeName() + + " node cannot have " + + pNodeNameEnum + + " child node, since it already has " + + this.iChildNameEnum + + " child node(s)!" + ); if (this.iChildNameEnum == VALUE_ARRAY || this.iChildNameEnum == VALUE_REFERENCE) throw new SAXException( - getNodeName() + " node can have only one " + this.iChildNameEnum - + " child node!"); + getNodeName() + " node can have only one " + this.iChildNameEnum + " child node!" + ); } else { boolean found = false; for (int i = 0; i < ALLOWED_CHILDREN.length; i++) { if ((found = (pNodeNameEnum == ALLOWED_CHILDREN[i])) == true) break; } - if (!found) throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum - + " child node!"); + if (!found) throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum + " child node!"); } } @@ -141,7 +158,7 @@ public void childParsed(Node pChild) { @Override public void testCompletness() { - // child nodes are optional + // child nodes are optional } public int getReturnValueCount() { @@ -151,5 +168,4 @@ public int getReturnValueCount() { public Object readReturnValue() { return this.iChildValueLL == null ? null : this.iChildValueLL.removeFirst(); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/InstanceNameNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/InstanceNameNode.java index 8de2296..476915e 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/InstanceNameNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/InstanceNameNode.java @@ -46,11 +46,10 @@ */ import java.util.ArrayList; - import org.metricshub.wbem.javax.cim.CIMObjectPath; +import org.metricshub.wbem.javax.cim.CIMProperty; import org.metricshub.wbem.sblim.cimclient.internal.cimxml.LocalPathBuilder; import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.metricshub.wbem.javax.cim.CIMProperty; import org.xml.sax.Attributes; import org.xml.sax.SAXException; @@ -63,7 +62,6 @@ * */ public class InstanceNameNode extends AbstractPathNode { - private String iClassName; private ArrayList> iCIMPropAL; @@ -92,46 +90,53 @@ public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { */ @Override public void parseData(String pData) { - // no data + // no data } private static final String[] ALLOWED_CHILDREN = { KEYBINDING, KEYVALUE, VALUE_REFERENCE }; @Override public void testChild(String pNodeNameEnum) throws SAXException { - for (int i = 0; i < ALLOWED_CHILDREN.length; i++) - if (ALLOWED_CHILDREN[i] == pNodeNameEnum) { - if (this.iNodeName != null && this.iNodeName != pNodeNameEnum) throw new SAXException( - getNodeName() + " node cannot have " + pNodeNameEnum - + " child node, it already has a " + this.iNodeName + "!"); - if (pNodeNameEnum != KEYBINDING) { - if (this.iNodeName != null) throw new SAXException(getNodeName() - + " node can have only one " + pNodeNameEnum + " child node!"); - } - this.iNodeName = pNodeNameEnum; - return; + for (int i = 0; i < ALLOWED_CHILDREN.length; i++) if (ALLOWED_CHILDREN[i] == pNodeNameEnum) { + if (this.iNodeName != null && this.iNodeName != pNodeNameEnum) throw new SAXException( + getNodeName() + " node cannot have " + pNodeNameEnum + " child node, it already has a " + this.iNodeName + "!" + ); + if (pNodeNameEnum != KEYBINDING) { + if (this.iNodeName != null) throw new SAXException( + getNodeName() + " node can have only one " + pNodeNameEnum + " child node!" + ); } - throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum - + " child node!"); + this.iNodeName = pNodeNameEnum; + return; + } + throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum + " child node!"); } @Override public void childParsed(Node pChild) { if (this.iCIMPropAL == null) this.iCIMPropAL = new ArrayList>(); - if (pChild instanceof KeyBindingNode) this.iCIMPropAL.add(((KeyBindingNode) pChild) - .getCIMProperty()); - else this.iCIMPropAL.add(new CIMProperty("", ((AbstractScalarValueNode) pChild) - .getType(), ((AbstractScalarValueNode) pChild).getValue(), true, false, null)); + if (pChild instanceof KeyBindingNode) this.iCIMPropAL.add( + ((KeyBindingNode) pChild).getCIMProperty() + ); else this.iCIMPropAL.add( + new CIMProperty( + "", + ((AbstractScalarValueNode) pChild).getType(), + ((AbstractScalarValueNode) pChild).getValue(), + true, + false, + null + ) + ); } @Override public void testCompletness() { - // no mandatory child nodes + // no mandatory child nodes } /** * getClassName - * + * * @return String */ public String getClassName() { @@ -142,7 +147,7 @@ public String getClassName() { /** * getKeys - * + * * @return CIMProperty[] */ public CIMProperty[] getKeys() { @@ -157,5 +162,4 @@ public CIMObjectPath getCIMObjectPath() { */ return LocalPathBuilder.build(this.iLocalPath, this.iClassName, null, getKeys()); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/InstanceNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/InstanceNode.java index aa603f9..a2b33f6 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/InstanceNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/InstanceNode.java @@ -46,14 +46,13 @@ */ import java.util.ArrayList; - import org.metricshub.wbem.javax.cim.CIMInstance; import org.metricshub.wbem.javax.cim.CIMObjectPath; +import org.metricshub.wbem.javax.cim.CIMProperty; import org.metricshub.wbem.sblim.cimclient.internal.cim.CIMHelper; import org.metricshub.wbem.sblim.cimclient.internal.cimxml.LocalPathBuilder; import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; import org.metricshub.wbem.sblim.cimclient.internal.util.WBEMConfiguration; -import org.metricshub.wbem.javax.cim.CIMProperty; import org.xml.sax.Attributes; import org.xml.sax.SAXException; @@ -66,7 +65,6 @@ * */ public class InstanceNode extends AbstractObjectNode { - private String iClassName; /** @@ -97,18 +95,15 @@ public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { */ @Override public void parseData(String pData) { - // no data + // no data } - private static final String[] ALLOWED_CHILDREN = { QUALIFIER, PROPERTY, PROPERTY_ARRAY, - PROPERTY_REFERENCE }; + private static final String[] ALLOWED_CHILDREN = { QUALIFIER, PROPERTY, PROPERTY_ARRAY, PROPERTY_REFERENCE }; @Override public void testChild(String pNodeNameEnum) throws SAXException { - for (int i = 0; i < ALLOWED_CHILDREN.length; i++) - if (ALLOWED_CHILDREN[i] == pNodeNameEnum) return; - throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum - + " child node!"); + for (int i = 0; i < ALLOWED_CHILDREN.length; i++) if (ALLOWED_CHILDREN[i] == pNodeNameEnum) return; + throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum + " child node!"); } @Override @@ -120,28 +115,28 @@ public void childParsed(Node pChild) { @Override public void testCompletness() { - // all child nodes are optional + // all child nodes are optional } /** * getCIMInstance - * + * * @return CIMInstance */ public CIMInstance getCIMInstance() { - return new CIMInstance(LocalPathBuilder.build(this.iLocalPath, this.iClassName, null), - getProps()); + return new CIMInstance(LocalPathBuilder.build(this.iLocalPath, this.iClassName, null), getProps()); } /** * getCIMInstance - * + * * @param pObjPath * @return CIMInstance with the provided object path */ public CIMInstance getCIMInstance(CIMObjectPath pObjPath) { - if (WBEMConfiguration.getGlobalConfiguration().synchronizeNumericKeyDataTypes()) return CIMHelper - .CIMInstanceWithSynchonizedNumericKeyDataTypes(pObjPath, getProps()); + if ( + WBEMConfiguration.getGlobalConfiguration().synchronizeNumericKeyDataTypes() + ) return CIMHelper.CIMInstanceWithSynchonizedNumericKeyDataTypes(pObjPath, getProps()); return new CIMInstance(pObjPath, getProps()); } @@ -159,5 +154,4 @@ private CIMProperty[] getProps() { if (this.iCIMPropAL == null) return null; return this.iCIMPropAL.toArray(EMPTY_PA); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/InstancePathNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/InstancePathNode.java index 3f34d17..b911b7a 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/InstancePathNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/InstancePathNode.java @@ -46,9 +46,9 @@ */ import org.metricshub.wbem.javax.cim.CIMObjectPath; +import org.metricshub.wbem.javax.cim.CIMProperty; import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; import org.metricshub.wbem.sblim.cimclient.internal.util.XMLHostStr; -import org.metricshub.wbem.javax.cim.CIMProperty; import org.xml.sax.Attributes; import org.xml.sax.SAXException; @@ -56,7 +56,6 @@ * ELEMENT INSTANCEPATH (NAMESPACEPATH, INSTANCENAME) */ public class InstancePathNode extends AbstractObjectPathNode { - // INSTANCEPATH private boolean iHasInstancePath; @@ -94,12 +93,11 @@ public void init(Attributes pAttribs, SAXSession pSession) { public void testChild(String pNodeNameEnum) throws SAXException { if (pNodeNameEnum == NAMESPACEPATH) { if (this.iHasInstancePath) throw new SAXException( - "INSTANCEPATH node can have only one NAMESPACEPATH child node!"); + "INSTANCEPATH node can have only one NAMESPACEPATH child node!" + ); } else if (pNodeNameEnum == INSTANCENAME) { - if (this.iHasInstanceName) throw new SAXException( - "INSTANCEPATH node can have only one INSTANCENAME child node!"); - } else throw new SAXException("INSTANCEPATH node cannot have " + pNodeNameEnum - + " child node!"); + if (this.iHasInstanceName) throw new SAXException("INSTANCEPATH node can have only one INSTANCENAME child node!"); + } else throw new SAXException("INSTANCEPATH node cannot have " + pNodeNameEnum + " child node!"); } /** @@ -107,7 +105,7 @@ public void testChild(String pNodeNameEnum) throws SAXException { */ @Override public void parseData(String pData) { - // no data + // no data } @Override @@ -127,10 +125,8 @@ public void childParsed(Node pChild) { @Override public void testCompletness() throws SAXException { - if (!this.iHasInstancePath) throw new SAXException( - "INSTANCEPATH node must have a NAMESPACEPATH child node!"); - if (!this.iHasInstanceName) throw new SAXException( - "INSTANCEPATH node must have an INSTANCENAME child node!"); + if (!this.iHasInstancePath) throw new SAXException("INSTANCEPATH node must have a NAMESPACEPATH child node!"); + if (!this.iHasInstanceName) throw new SAXException("INSTANCEPATH node must have an INSTANCENAME child node!"); } public CIMObjectPath getCIMObjectPath() { @@ -138,9 +134,13 @@ public CIMObjectPath getCIMObjectPath() { * CIMObjectPath( String scheme, String host, String port, String * namespace, String objectName, CIMProperty[] keys ) */ - return new CIMObjectPath(this.iHostStr.getProtocol(), this.iHostStr.getHost(), - this.iHostStr.getPort(), this.iLocalNameSpacePathStr, this.iClassNameStr, - this.iKeys); + return new CIMObjectPath( + this.iHostStr.getProtocol(), + this.iHostStr.getHost(), + this.iHostStr.getPort(), + this.iLocalNameSpacePathStr, + this.iClassNameStr, + this.iKeys + ); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/KeyBindingNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/KeyBindingNode.java index d4da725..1fc4c54 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/KeyBindingNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/KeyBindingNode.java @@ -45,8 +45,8 @@ */ import org.metricshub.wbem.javax.cim.CIMDataType; -import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; import org.metricshub.wbem.javax.cim.CIMProperty; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; import org.xml.sax.Attributes; import org.xml.sax.SAXException; @@ -54,7 +54,6 @@ * ELEMENT KEYBINDING (KEYVALUE | VALUE.REFERENCE) ATTLIST KEYBINDING %CIMName; */ public class KeyBindingNode extends Node { - private String iName; // child element @@ -86,15 +85,15 @@ public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { */ @Override public void parseData(String pData) { - // no data + // no data } @Override public void testChild(String pNodeNameEnum) throws SAXException { if (this.iHasChild) throw new SAXException("KEYBINDING node can only have one child node!"); if (pNodeNameEnum != KEYVALUE && pNodeNameEnum != VALUE_REFERENCE) throw new SAXException( - "KEYBINDING node's child node can be KEYVALUE or VALUE_REFERENCE but not " - + pNodeNameEnum); + "KEYBINDING node's child node can be KEYVALUE or VALUE_REFERENCE but not " + pNodeNameEnum + ); } @Override @@ -107,13 +106,12 @@ public void childParsed(Node pChild) { @Override public void testCompletness() throws SAXException { - if (!this.iHasChild) throw new SAXException( - "KEYBINDING node must have a KEYVALUE or VALUE_REFERENCE child node!"); + if (!this.iHasChild) throw new SAXException("KEYBINDING node must have a KEYVALUE or VALUE_REFERENCE child node!"); } /** * getCIMProperty - * + * * @return CIMProperty */ public CIMProperty getCIMProperty() { @@ -123,5 +121,4 @@ public CIMProperty getCIMProperty() { // ) return new CIMProperty(this.iName, this.iType, this.iValue, true, false, null); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/KeyValueNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/KeyValueNode.java index f323511..e075e32 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/KeyValueNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/KeyValueNode.java @@ -53,12 +53,12 @@ import org.metricshub.wbem.javax.cim.CIMDataType; import org.metricshub.wbem.javax.cim.CIMDateTimeAbsolute; import org.metricshub.wbem.javax.cim.CIMDateTimeInterval; +import org.metricshub.wbem.javax.cim.UnsignedInteger64; import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.CIMObjectFactory; import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; import org.metricshub.wbem.sblim.cimclient.internal.util.MOF; import org.metricshub.wbem.sblim.cimclient.internal.util.Util; import org.metricshub.wbem.sblim.cimclient.internal.util.WBEMConfiguration; -import org.metricshub.wbem.javax.cim.UnsignedInteger64; import org.xml.sax.Attributes; import org.xml.sax.SAXException; @@ -67,7 +67,6 @@ * numeric) "string" %CIMType; #IMPLIED */ public class KeyValueNode extends AbstractScalarValueNode { - private CIMDataType iType; private String iValueTypeStr; @@ -119,12 +118,12 @@ public void testChild(String pNodeNameEnum) throws SAXException { */ @Override public void childParsed(Node pChild) { - // no child + // no child } @Override public void testCompletness() { - // nothing to do + // nothing to do } public Object getValue() { @@ -144,18 +143,27 @@ private void setTypeAndValue(String pValue) throws SAXException { if (this.iValueTypeStr.equals("numeric")) { if (!setUInt64(pValue) && !setSInt64(pValue) && !setReal64(pValue)) throw new SAXException( - "Unparseable \"number\" value in " + getNodeName() + " node: " + pValue + "!"); + "Unparseable \"number\" value in " + getNodeName() + " node: " + pValue + "!" + ); } else if (this.iValueTypeStr.equals(MOF.DT_STR)) { if (!setDTAbsolute(pValue) && !setDTInterval(pValue)) { this.iValue = pValue; this.iType = CIMDataType.STRING_T; } } else if (this.iValueTypeStr.equals(MOF.DT_BOOL)) { - if (!setBoolean(pValue)) throw new SAXException("Unparseable \"boolean\" value in " - + getNodeName() + " node: " + pValue + "!"); + if (!setBoolean(pValue)) throw new SAXException( + "Unparseable \"boolean\" value in " + getNodeName() + " node: " + pValue + "!" + ); } else { - throw new SAXException("KEYVALUE node's VALUETYPE attribute must be " + MOF.DT_STR - + ", " + MOF.DT_BOOL + " or numeric! " + pValue + " is not allowed!"); + throw new SAXException( + "KEYVALUE node's VALUETYPE attribute must be " + + MOF.DT_STR + + ", " + + MOF.DT_BOOL + + " or numeric! " + + pValue + + " is not allowed!" + ); } } @@ -217,5 +225,4 @@ private boolean setDTInterval(String pValue) { this.iType = CIMDataType.DATETIME_T; return true; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/LocalClassPathNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/LocalClassPathNode.java index bf0fbb3..9cacb6e 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/LocalClassPathNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/LocalClassPathNode.java @@ -56,7 +56,6 @@ * ELEMENT LOCALCLASSPATH (LOCALNAMESPACEPATH, CLASSNAME) */ public class LocalClassPathNode extends AbstractObjectPathNode { - // LOCALNAMESPACEPATH private boolean iHasLocalNameSpacePath, iHasClassName; @@ -91,20 +90,23 @@ public void init(Attributes pAttribs, SAXSession pSession) { */ @Override public void parseData(String pData) { - // no data + // no data } @Override public void testChild(String pNodeNameEnum) throws SAXException { if (pNodeNameEnum == LOCALNAMESPACEPATH) { if (this.iHasLocalNameSpacePath) throw new SAXException( - "LOCALCLASSPATH node already has a LOCALNAMESPACEPATH child node!"); + "LOCALCLASSPATH node already has a LOCALNAMESPACEPATH child node!" + ); } else if (pNodeNameEnum == CLASSNAME) { - if (this.iHasClassName) throw new SAXException( - "LOCALCLASSPATH node already has a CLASSNAME child node!"); - } else throw new SAXException("LOCALCLASSPATH node cannot have " + pNodeNameEnum - + " child node!" - + " It can have LOCALNAMESPACEPATH and CLASSNAME child nodes only!"); + if (this.iHasClassName) throw new SAXException("LOCALCLASSPATH node already has a CLASSNAME child node!"); + } else throw new SAXException( + "LOCALCLASSPATH node cannot have " + + pNodeNameEnum + + " child node!" + + " It can have LOCALNAMESPACEPATH and CLASSNAME child nodes only!" + ); } @Override @@ -121,13 +123,12 @@ public void childParsed(Node pChild) { @Override public void testCompletness() throws SAXException { if (!this.iHasLocalNameSpacePath) throw new SAXException( - "LOCALNAMESPACE child node is mandatory for LOCALCLASSPATH node!"); - if (!this.iHasClassName) throw new SAXException( - "CLASSNAME child node is mandatory for LOCALCLASSPATH node!"); + "LOCALNAMESPACE child node is mandatory for LOCALCLASSPATH node!" + ); + if (!this.iHasClassName) throw new SAXException("CLASSNAME child node is mandatory for LOCALCLASSPATH node!"); } public CIMObjectPath getCIMObjectPath() { return LocalPathBuilder.build(this.iLocalPath, this.iClassNameStr, this.iNameSpaceStr); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/LocalInstancePathNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/LocalInstancePathNode.java index f4eb1d4..74b4c91 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/LocalInstancePathNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/LocalInstancePathNode.java @@ -46,9 +46,9 @@ */ import org.metricshub.wbem.javax.cim.CIMObjectPath; +import org.metricshub.wbem.javax.cim.CIMProperty; import org.metricshub.wbem.sblim.cimclient.internal.cimxml.LocalPathBuilder; import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.metricshub.wbem.javax.cim.CIMProperty; import org.xml.sax.Attributes; import org.xml.sax.SAXException; @@ -56,7 +56,6 @@ * ELEMENT LOCALINSTANCEPATH (LOCALNAMESPACEPATH, INSTANCENAME) */ public class LocalInstancePathNode extends AbstractObjectPathNode { - // LOCALNAMESPACEPATH private boolean iHasLocalNameSpacePath; @@ -96,19 +95,20 @@ public void init(Attributes pAttribs, SAXSession pSession) { */ @Override public void parseData(String pData) { - // no data + // no data } @Override public void testChild(String pNodeNameEnum) throws SAXException { if (pNodeNameEnum == LOCALNAMESPACEPATH) { - if (this.iHasLocalNameSpacePath) throw new SAXException(getNodeName() - + " node can have only one LOCALNAMESPACEPATH child node!"); + if (this.iHasLocalNameSpacePath) throw new SAXException( + getNodeName() + " node can have only one LOCALNAMESPACEPATH child node!" + ); } else if (pNodeNameEnum == INSTANCENAME) { - if (this.iHasInstanceName) throw new SAXException(getNodeName() - + " node can have only one INSTANCENAME child node!"); - } else throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum - + " child node!"); + if (this.iHasInstanceName) throw new SAXException( + getNodeName() + " node can have only one INSTANCENAME child node!" + ); + } else throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum + " child node!"); } @Override @@ -126,17 +126,15 @@ public void childParsed(Node pChild) { @Override public void testCompletness() throws SAXException { - if (!this.iHasLocalNameSpacePath) throw new SAXException(getNodeName() - + " node must have a LOCALNAMESPACEPATH child node!"); - if (!this.iHasInstanceName) throw new SAXException(getNodeName() - + " node must have a INSTANCENAME child node!"); + if (!this.iHasLocalNameSpacePath) throw new SAXException( + getNodeName() + " node must have a LOCALNAMESPACEPATH child node!" + ); + if (!this.iHasInstanceName) throw new SAXException(getNodeName() + " node must have a INSTANCENAME child node!"); } public CIMObjectPath getCIMObjectPath() { // CIMObjectPath(String objectName, String namespace, CIMProperty[] // keys) - return LocalPathBuilder.build(this.iLocalPath, this.iClassNameStr, this.iNameSpaceStr, - this.iKeys); + return LocalPathBuilder.build(this.iLocalPath, this.iClassNameStr, this.iNameSpaceStr, this.iKeys); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/LocalNameSpacePathNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/LocalNameSpacePathNode.java index 4948b9d..dd12394 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/LocalNameSpacePathNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/LocalNameSpacePathNode.java @@ -56,7 +56,6 @@ * ELEMENT LOCALNAMESPACEPATH (NAMESPACE+) */ public class LocalNameSpacePathNode extends AbstractPathNode { - private StringBuffer iNameSpaceStrBuf; private String iNameSpaceStr; @@ -89,14 +88,14 @@ public void init(Attributes pAttribs, SAXSession pSession) { */ @Override public void parseData(String pData) { - // no data + // no data } @Override public void testChild(String pNodeNameEnum) throws SAXException { - if (pNodeNameEnum != NAMESPACE) throw new SAXException(getNodeName() - + " node can have NAMESPACE child node only! " + pNodeNameEnum - + " child node is invalid!"); + if (pNodeNameEnum != NAMESPACE) throw new SAXException( + getNodeName() + " node can have NAMESPACE child node only! " + pNodeNameEnum + " child node is invalid!" + ); } @Override @@ -112,27 +111,30 @@ public void childParsed(Node pChild) { @Override public void testCompletness() throws SAXException { if (this.iNameSpaceStrBuf == null) { - if (WBEMConfiguration.getGlobalConfiguration().allowEmptyLocalNameSpacePath() - && this.iLocalPath != null && this.iLocalPath.getNamespace() != null) return; - throw new SAXException(getNodeName() - + " node must have at least one NAMESPACE child node!"); + if ( + WBEMConfiguration.getGlobalConfiguration().allowEmptyLocalNameSpacePath() && + this.iLocalPath != null && + this.iLocalPath.getNamespace() != null + ) return; + throw new SAXException(getNodeName() + " node must have at least one NAMESPACE child node!"); } } /** * getNameSpace - * + * * @return String */ public String getNameSpace() { if (this.iNameSpaceStr != null) return this.iNameSpaceStr; - return this.iNameSpaceStr = (this.iNameSpaceStrBuf == null ? this.iLocalPath.getNamespace() - : this.iNameSpaceStrBuf.toString()); + return ( + this.iNameSpaceStr = + (this.iNameSpaceStrBuf == null ? this.iLocalPath.getNamespace() : this.iNameSpaceStrBuf.toString()) + ); } public CIMObjectPath getCIMObjectPath() { if (this.iNameSpacePath != null) return this.iNameSpacePath; return this.iNameSpacePath = new CIMObjectPath(null, null, null, getNameSpace(), null, null); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/MessageNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/MessageNode.java index 94ea368..6b297da 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/MessageNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/MessageNode.java @@ -57,7 +57,6 @@ * */ public class MessageNode extends Node implements NonVolatileIf { - private String iID; private String iProtocolVersion; @@ -84,7 +83,8 @@ public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { if (this.iID == null) throw new SAXException("ID attribute is mandatory for MESSAGE node!"); this.iProtocolVersion = pAttribs.getValue("PROTOCOLVERSION"); if (this.iProtocolVersion == null) throw new SAXException( - "PROTOCOLVERSION attribute is mandatory for MESSAGE node!"); + "PROTOCOLVERSION attribute is mandatory for MESSAGE node!" + ); this.iAbstractMsgNode = null; } @@ -93,18 +93,24 @@ public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { */ @Override public void parseData(String pData) { - // no data + // no data } - private static final String[] ALLOWED_CHILDREN = { SIMPLEREQ, MULTIREQ, SIMPLERSP, MULTIRSP, - SIMPLEEXPREQ, MULTIEXPREQ, SIMPLEEXPRSP, MULTIEXPRSP }; + private static final String[] ALLOWED_CHILDREN = { + SIMPLEREQ, + MULTIREQ, + SIMPLERSP, + MULTIRSP, + SIMPLEEXPREQ, + MULTIEXPREQ, + SIMPLEEXPRSP, + MULTIEXPRSP + }; @Override public void testChild(String pNodeNameEnum) throws SAXException { - if (this.iAbstractMsgNode != null) throw new SAXException( - "MESSAGE node can have only one child node!"); - for (int i = 0; i < ALLOWED_CHILDREN.length; i++) - if (pNodeNameEnum == ALLOWED_CHILDREN[i]) return; + if (this.iAbstractMsgNode != null) throw new SAXException("MESSAGE node can have only one child node!"); + for (int i = 0; i < ALLOWED_CHILDREN.length; i++) if (pNodeNameEnum == ALLOWED_CHILDREN[i]) return; throw new SAXException("MESSAGE node cannot have " + pNodeNameEnum + " child node!"); } @@ -113,22 +119,20 @@ public void testChild(String pNodeNameEnum) throws SAXException { */ @Override public void childParsed(Node pChild) { - // nothing to do + // nothing to do } @Override public void testCompletness() throws SAXException { - if (this.iAbstractMsgNode == null) throw new SAXException( - "MESSAGE node must have a child node!"); + if (this.iAbstractMsgNode == null) throw new SAXException("MESSAGE node must have a child node!"); } /** * getAbstractMessageNode - * + * * @return AbstractMessageNode */ public AbstractMessageNode getAbstractMessageNode() { return this.iAbstractMsgNode; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/MethodCallNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/MethodCallNode.java index cdae094..ec3d8d6 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/MethodCallNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/MethodCallNode.java @@ -62,16 +62,18 @@ public MethodCallNode() { @Override protected void testSpecChild(String pNodeNameEnum) throws SAXException { if (pNodeNameEnum == LOCALCLASSPATH || pNodeNameEnum == LOCALINSTANCEPATH) { - if (this.iPath != null) throw new SAXException(getNodeName() - + " node can have only one LOCALINSTANCEPATH or LOCALCLASSPATH child node!"); - } else if (pNodeNameEnum != PARAMVALUE) throw new SAXException(getNodeName() - + " node cannot have " + pNodeNameEnum + " child node!"); + if (this.iPath != null) throw new SAXException( + getNodeName() + " node can have only one LOCALINSTANCEPATH or LOCALCLASSPATH child node!" + ); + } else if (pNodeNameEnum != PARAMVALUE) throw new SAXException( + getNodeName() + " node cannot have " + pNodeNameEnum + " child node!" + ); } @Override public void testCompletness() throws SAXException { if (this.iPath == null) throw new SAXException( - "METHODCALL node must have a LOCALINSTANCEPATH or LOCALCLASSPATH child node!"); + "METHODCALL node must have a LOCALINSTANCEPATH or LOCALCLASSPATH child node!" + ); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/MethodNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/MethodNode.java index bb07d2d..2914ee6 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/MethodNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/MethodNode.java @@ -49,7 +49,6 @@ */ import java.util.ArrayList; - import org.metricshub.wbem.javax.cim.CIMDataType; import org.metricshub.wbem.javax.cim.CIMMethod; import org.metricshub.wbem.javax.cim.CIMParameter; @@ -60,7 +59,7 @@ /** *
      - * 
      + *
        * ELEMENT METHOD (QUALIFIER*, (PARAMETER | PARAMETER.REFERENCE | PARAMETER.ARRAY | PARAMETER.REFARRAY)*)
        * ATTLIST METHOD
        *   %CIMName;
      @@ -70,7 +69,6 @@
        * 
      */ public class MethodNode extends Node { - private String iName; private CIMDataType iType; @@ -101,16 +99,15 @@ public MethodNode() { public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { this.iSession = pSession; this.iQualiHandler = QualifiedNodeHandler.init(this.iQualiHandler); - this.iEmbObjHandler = EmbObjHandler.init(this.iEmbObjHandler, getNodeName(), pAttribs, - this.iSession, this.iQualiHandler, true); + this.iEmbObjHandler = + EmbObjHandler.init(this.iEmbObjHandler, getNodeName(), pAttribs, this.iSession, this.iQualiHandler, true); if (this.iCIMParamAL != null) this.iCIMParamAL.clear(); this.iName = getCIMName(pAttribs); this.iType = getCIMType(pAttribs, true); - if (this.iType != null && this.iType.isArray()) throw new SAXException( - "METHOD node's TYPE cannot be an array!"); + if (this.iType != null && this.iType.isArray()) throw new SAXException("METHOD node's TYPE cannot be an array!"); this.iClassOrigin = getClassOrigin(pAttribs); this.iPropagated = getPropagated(pAttribs); } @@ -120,18 +117,21 @@ public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { */ @Override public void parseData(String pData) { - // no data + // no data } - private static final String[] ALLOWED_CHILDREN = { QUALIFIER, PARAMETER, PARAMETER_REFERENCE, - PARAMETER_ARRAY, PARAMETER_REFARRAY }; + private static final String[] ALLOWED_CHILDREN = { + QUALIFIER, + PARAMETER, + PARAMETER_REFERENCE, + PARAMETER_ARRAY, + PARAMETER_REFARRAY + }; @Override public void testChild(String pNodeNameEnum) throws SAXException { - for (int i = 0; i < ALLOWED_CHILDREN.length; i++) - if (pNodeNameEnum.equalsIgnoreCase(ALLOWED_CHILDREN[i])) return; - throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum - + " child node!"); + for (int i = 0; i < ALLOWED_CHILDREN.length; i++) if (pNodeNameEnum.equalsIgnoreCase(ALLOWED_CHILDREN[i])) return; + throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum + " child node!"); } @Override @@ -145,31 +145,35 @@ public void childParsed(Node pChild) { public void testCompletness() throws SAXException { this.iType = this.iEmbObjHandler.getType(); if (this.iType != null && this.iType.isArray()) throw new SAXException( - "METHOD node's TYPE attribute cannot be an array!"); + "METHOD node's TYPE attribute cannot be an array!" + ); } /** * getCIMMethod - * + * * @return CIMMethod */ public CIMMethod getCIMMethod() { /* * CIMMethod( String name, CIMDataType type, CIMQualifier[] qualifiers, * CIMParameter[] parameters, boolean propagated, String originClass ); - * + * * EmbeddedObject qualifier mustn't be removed. Return type cannot be * changed. - * + * * The situation changed by the introduction of the strict embedded * object type parsing. */ - return new CIMMethod(this.iName, this.iType, this.iQualiHandler - .getQualis(!this.iSession.strictEmbObjParsing()), this.iCIMParamAL == null ? null - : (CIMParameter[]) this.iCIMParamAL.toArray(EMPTY_PA), this.iPropagated, - this.iClassOrigin); + return new CIMMethod( + this.iName, + this.iType, + this.iQualiHandler.getQualis(!this.iSession.strictEmbObjParsing()), + this.iCIMParamAL == null ? null : (CIMParameter[]) this.iCIMParamAL.toArray(EMPTY_PA), + this.iPropagated, + this.iClassOrigin + ); } private static final CIMParameter[] EMPTY_PA = new CIMParameter[0]; - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/MethodResponseNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/MethodResponseNode.java index b74a306..8d23e10 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/MethodResponseNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/MethodResponseNode.java @@ -49,7 +49,6 @@ */ import java.util.ArrayList; - import org.metricshub.wbem.javax.cim.CIMArgument; import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; import org.metricshub.wbem.sblim.cimclient.internal.wbem.CIMError; @@ -64,7 +63,6 @@ * */ public class MethodResponseNode extends Node implements ErrorIf, RetValPipeIf, NonVolatileIf { - private String iName; private CIMError iError; @@ -88,7 +86,7 @@ public MethodResponseNode() { * @param pChild */ public void addChild(Node pChild) { - // nothing to do + // nothing to do } /** @@ -109,34 +107,44 @@ public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { */ @Override public void parseData(String pData) { - // no data + // no data } @Override public void testChild(String pNodeNameEnum) throws SAXException { if (pNodeNameEnum == ERROR) { String ownedNodeName; - if (this.iHasRetVal) ownedNodeName = RETURNVALUE; - else if (this.iHasError) ownedNodeName = ERROR; - else if (this.iCIMArgAL != null && this.iCIMArgAL.size() > 0) ownedNodeName = PARAMVALUE; - else ownedNodeName = null; - if (ownedNodeName != null) throw new SAXException(pNodeNameEnum - + " child node is invalid for " + getNodeName() - + " node, since it already has a " + ownedNodeName + " child node!"); + if (this.iHasRetVal) ownedNodeName = RETURNVALUE; else if (this.iHasError) ownedNodeName = ERROR; else if ( + this.iCIMArgAL != null && this.iCIMArgAL.size() > 0 + ) ownedNodeName = PARAMVALUE; else ownedNodeName = null; + if (ownedNodeName != null) throw new SAXException( + pNodeNameEnum + + " child node is invalid for " + + getNodeName() + + " node, since it already has a " + + ownedNodeName + + " child node!" + ); } else if (pNodeNameEnum == RETURNVALUE) { String ownedNodeName; - if (this.iHasRetVal) ownedNodeName = RETURNVALUE; - else if (this.iHasError) ownedNodeName = ERROR; - else ownedNodeName = null; - if (ownedNodeName != null) throw new SAXException(pNodeNameEnum - + " child node is invalid for " + getNodeName() - + " node, since it already has a " + ownedNodeName + " child node!"); + if (this.iHasRetVal) ownedNodeName = RETURNVALUE; else if (this.iHasError) ownedNodeName = + ERROR; else ownedNodeName = null; + if (ownedNodeName != null) throw new SAXException( + pNodeNameEnum + + " child node is invalid for " + + getNodeName() + + " node, since it already has a " + + ownedNodeName + + " child node!" + ); } else if (pNodeNameEnum == PARAMVALUE) { - if (this.iHasError) throw new SAXException(pNodeNameEnum - + " child node is invalid for " + getNodeName() - + " node, since it already has an ERROR child node!"); - } else throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum - + " child node!"); + if (this.iHasError) throw new SAXException( + pNodeNameEnum + + " child node is invalid for " + + getNodeName() + + " node, since it already has an ERROR child node!" + ); + } else throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum + " child node!"); } @Override @@ -155,7 +163,7 @@ public void childParsed(Node pChild) { @Override public void testCompletness() { - // no mandatory child + // no mandatory child } public CIMError getCIMError() { @@ -167,7 +175,7 @@ public CIMError getCIMError() { /** * getCIMArguments : returns the array of parsed parameters and their values * : String name, CIMDataType type, Object value - * + * * @return CIMArgument<?>[] */ public CIMArgument[] getCIMArguments() { @@ -187,11 +195,10 @@ public Object readReturnValue() { /** * getName - * + * * @return String */ public String getName() { return this.iName; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/MultiExpReqNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/MultiExpReqNode.java index c9087f9..bd522a5 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/MultiExpReqNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/MultiExpReqNode.java @@ -45,7 +45,6 @@ */ import java.util.ArrayList; - import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; import org.xml.sax.Attributes; import org.xml.sax.SAXException; @@ -54,7 +53,6 @@ * ELEMENT MULTIEXPREQ (SIMPLEEXPREQ, SIMPLEEXPREQ+) */ public class MultiExpReqNode extends AbstractMessageNode { - private ArrayList iSimpleExpReqAList; /** @@ -84,20 +82,20 @@ public void init(Attributes pAttribs, SAXSession pSession) { */ @Override public void parseData(String pData) { - // no data + // no data } @Override public void testChild(String pNodeNameEnum) throws SAXException { if (pNodeNameEnum != SIMPLEEXPREQ) throw new SAXException( - "MULTIEXPREQ node can have SIMPLEEXPREQ child nodes only! " + pNodeNameEnum - + " child node is invalid!"); + "MULTIEXPREQ node can have SIMPLEEXPREQ child nodes only! " + pNodeNameEnum + " child node is invalid!" + ); } @Override public void testCompletness() throws SAXException { if (this.iSimpleExpReqAList == null || this.iSimpleExpReqAList.size() < 2) throw new SAXException( - "MULTIEXPREQ node must have at least two SIMPLEEXPREQ child nodes!"); + "MULTIEXPREQ node must have at least two SIMPLEEXPREQ child nodes!" + ); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/MultiExpRspNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/MultiExpRspNode.java index 8a08d4e..5d5450b 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/MultiExpRspNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/MultiExpRspNode.java @@ -46,7 +46,6 @@ */ import java.util.ArrayList; - import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; import org.xml.sax.Attributes; import org.xml.sax.SAXException; @@ -55,7 +54,6 @@ * ELEMENT MULTIEXPRSP (SIMPLEEXPRSP, SIMPLEEXPRSP+) */ public class MultiExpRspNode extends AbstractMessageNode { - private ArrayList iSimpleExpRspAList; /** @@ -85,20 +83,20 @@ public void init(Attributes pAttribs, SAXSession pSession) { */ @Override public void parseData(String pData) { - // no data + // no data } @Override public void testChild(String pNodeNameEnum) throws SAXException { - if (pNodeNameEnum != SIMPLEEXPRSP) throw new SAXException(getNodeName() - + " node can have SIMPLEEXPRSP child node only! " + pNodeNameEnum - + " child node is invalid!"); + if (pNodeNameEnum != SIMPLEEXPRSP) throw new SAXException( + getNodeName() + " node can have SIMPLEEXPRSP child node only! " + pNodeNameEnum + " child node is invalid!" + ); } @Override public void testCompletness() throws SAXException { if (this.iSimpleExpRspAList == null || this.iSimpleExpRspAList.size() < 2) throw new SAXException( - getNodeName() + " node must have at least two SIMPLEEXPRSP child nodes!"); + getNodeName() + " node must have at least two SIMPLEEXPRSP child nodes!" + ); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/MultiReqNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/MultiReqNode.java index 960d1c6..e82fd9b 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/MultiReqNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/MultiReqNode.java @@ -45,7 +45,6 @@ */ import java.util.ArrayList; - import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; import org.xml.sax.Attributes; import org.xml.sax.SAXException; @@ -54,7 +53,6 @@ * ELEMENT MULTIREQ (SIMPLEREQ, SIMPLEREQ+) */ public class MultiReqNode extends AbstractMessageNode { - private ArrayList iSimpleReqAList; /** @@ -84,29 +82,29 @@ public void init(Attributes pAttribs, SAXSession pSession) { */ @Override public void parseData(String pData) { - // no data + // no data } @Override public void testChild(String pNodeNameEnum) throws SAXException { if (pNodeNameEnum != SIMPLEREQ) throw new SAXException( - "MULTIREQ node can have SIMPLEREQ child nodes only! " + pNodeNameEnum - + " child node is invalid!"); + "MULTIREQ node can have SIMPLEREQ child nodes only! " + pNodeNameEnum + " child node is invalid!" + ); } @Override public void testCompletness() throws SAXException { if (this.iSimpleReqAList == null || this.iSimpleReqAList.size() < 2) throw new SAXException( - "MULTIREQ node must have at least 2 SIMPLEREQ child nodes!"); + "MULTIREQ node must have at least 2 SIMPLEREQ child nodes!" + ); } /** * size - * + * * @return int */ public int size() { return this.iSimpleReqAList == null ? 0 : this.iSimpleReqAList.size(); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/MultiRspNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/MultiRspNode.java index 441a2a6..be11eae 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/MultiRspNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/MultiRspNode.java @@ -45,7 +45,6 @@ */ import java.util.ArrayList; - import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; import org.xml.sax.Attributes; import org.xml.sax.SAXException; @@ -54,7 +53,6 @@ * ELEMENT MULTIRSP (SIMPLERSP, SIMPLERSP+) */ public class MultiRspNode extends AbstractMessageNode { - private ArrayList iSimpleRspAList; /** @@ -84,20 +82,21 @@ public void init(Attributes pAttribs, SAXSession pSession) { */ @Override public void parseData(String pData) { - // no data + // no data } @Override public void testChild(String pNodeNameEnum) throws SAXException { - if (pNodeNameEnum != SIMPLERSP) throw new SAXException(getNodeName() + " node cannot have " - + pNodeNameEnum + " child node!"); + if (pNodeNameEnum != SIMPLERSP) throw new SAXException( + getNodeName() + " node cannot have " + pNodeNameEnum + " child node!" + ); } @Override public void testCompletness() throws SAXException { if (this.iSimpleRspAList == null || this.iSimpleRspAList.size() < 2) throw new SAXException( - getNodeName() + " node must have at least two SIMPLERSP child nodes!"); + getNodeName() + " node must have at least two SIMPLERSP child nodes!" + ); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/NameSpaceNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/NameSpaceNode.java index 2289772..48bf4f2 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/NameSpaceNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/NameSpaceNode.java @@ -50,10 +50,9 @@ /** * ELEMENT NAMESPACE EMPTY ATTRLIST NAMESPACE %CIMName; - * + * */ public class NameSpaceNode extends Node { - private String iNameSpaceValue; /** @@ -76,7 +75,7 @@ public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { */ @Override public void parseData(String pData) { - // no data + // no data } /** @@ -92,21 +91,20 @@ public void testChild(String pNodeNameEnum) throws SAXException { */ @Override public void childParsed(Node pChild) { - // no child + // no child } @Override public void testCompletness() { - // no child + // no child } /** * getNameSpace - * + * * @return String */ public String getNameSpace() { return this.iNameSpaceValue; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/NameSpacePathNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/NameSpacePathNode.java index 344e5d9..bf83b8d 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/NameSpacePathNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/NameSpacePathNode.java @@ -53,7 +53,6 @@ * ELEMENT NAMESPACEPATH (HOST, LOCALNAMESPACEPATH) */ public class NameSpacePathNode extends Node { - // HOST private boolean iHasHost; @@ -87,19 +86,18 @@ public void init(Attributes pAttribs, SAXSession pSession) { */ @Override public void parseData(String pData) { - // no data + // no data } @Override public void testChild(String pNodeNameEnum) throws SAXException { if (pNodeNameEnum == HOST) { - if (this.iHasHost) throw new SAXException(getNodeName() - + " node can have only one HOST child node!"); + if (this.iHasHost) throw new SAXException(getNodeName() + " node can have only one HOST child node!"); } else if (pNodeNameEnum == LOCALNAMESPACEPATH) { - if (this.iHasLocalNameSpacePath) throw new SAXException(getNodeName() - + " node can have only one LOCALNAMESPACEPATH child node!"); - } else throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum - + " child node!"); + if (this.iHasLocalNameSpacePath) throw new SAXException( + getNodeName() + " node can have only one LOCALNAMESPACEPATH child node!" + ); + } else throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum + " child node!"); } @Override @@ -115,15 +113,15 @@ public void childParsed(Node pChild) { @Override public void testCompletness() throws SAXException { - if (!this.iHasHost) throw new SAXException("HOST child node is mandatory for " - + getNodeName() + " node!"); + if (!this.iHasHost) throw new SAXException("HOST child node is mandatory for " + getNodeName() + " node!"); if (!this.iHasLocalNameSpacePath) throw new SAXException( - "LOCALNAMESPACEPATH child node is mandatory for " + getNodeName() + " node!"); + "LOCALNAMESPACEPATH child node is mandatory for " + getNodeName() + " node!" + ); } /** * getHostStr - * + * * @return String which may contain the protocol, host and port */ public String getHostStr() { @@ -132,11 +130,10 @@ public String getHostStr() { /** * getLocalNameSpacePath - * + * * @return String */ public String getLocalNameSpacePath() { return this.iLocalNameSpacePathStr; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/Node.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/Node.java index c7d541a..a7f9d9c 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/Node.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/Node.java @@ -53,12 +53,12 @@ */ import org.metricshub.wbem.javax.cim.CIMDataType; +import org.metricshub.wbem.javax.cim.CIMFlavor; import org.metricshub.wbem.sblim.cimclient.internal.cim.CIMHelper; import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.CIMObjectFactory; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.NodeConstIf; import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; import org.metricshub.wbem.sblim.cimclient.internal.util.MOF; -import org.metricshub.wbem.javax.cim.CIMFlavor; -import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.NodeConstIf; import org.xml.sax.Attributes; import org.xml.sax.SAXException; @@ -67,14 +67,13 @@ * contains helper functions for the implementations. */ public abstract class Node implements NodeConstIf { - private String iNameEnum; private boolean iCompleted; /** * Ctor. - * + * * @param pNameEnum * The name of the node which must be a String constant which is * defined inside this class (because the implementation compares @@ -86,7 +85,7 @@ public Node(String pNameEnum) { /** * getNodeName - * + * * @return The name of the node. This name have to be one of the String * constant defined in the class. */ @@ -98,7 +97,7 @@ public String getNodeName() { * The SAX ContentHandler implementation calls this method after testChild() * and addChild() calls. The implementation must reset it's instance unless * it implements NonVolatileIf - * + * * @param pAttribs * @param pSession * - stores variables which are common for the whole SAX parsing @@ -109,7 +108,7 @@ public String getNodeName() { /** * XML element's data have to be passed - * + * * @param pData * - String which is concatenated in SAX's * DefaultHandler.characters() implementation. @@ -120,7 +119,7 @@ public String getNodeName() { /** * It have to be called by SAX's DefaultHandler implementation when it * detects a new child element (startElement()). - * + * * @param pNodeNameEnum * - the name of the child element, it must be one of the String * constant defined in class Node, because the implementer @@ -135,7 +134,7 @@ public String getNodeName() { * It have to be called by SAX's DefaultHandler.endElement(). It's task is * to check that the Element is built up correctly. The implementer function * can do some post processing here. testCompletness - * + * * @throws SAXException * It must be thrown when the Node is not valid. */ @@ -143,7 +142,7 @@ public String getNodeName() { /** * Have to be called by SAX's DefaultHandler.endElement() - * + * * @param pChild * @throws SAXException * - parent Nodes can make conversions here (e.g. type string @@ -154,7 +153,7 @@ public String getNodeName() { /** * completed - * + * * @return true if the parsing of the node is completed */ public boolean isCompleted() { @@ -179,7 +178,7 @@ public void clearCompleted() { /** * ENTITY % CIMName "NAME CDATA #REQUIRED" - * + * * @param pAttribs * @return String * @throws SAXException @@ -192,7 +191,7 @@ public static String getCIMName(Attributes pAttribs) throws SAXException { /** * ENTITY % ClassName "CLASSNAME CDATA #REQUIRED" - * + * * @param pAttribs * @return String * @throws SAXException @@ -205,7 +204,7 @@ public static String getClassName(Attributes pAttribs) throws SAXException { /** * ENTITY % ReferenceClass "REFERENCECLASS CDATA #IMPLIED" - * + * * @param pAttribs * @return String */ @@ -215,7 +214,7 @@ public static String getReferenceClass(Attributes pAttribs) { /** * ENTITY % ClassOrigin "CLASSORIGIN CDATA #IMPLIED - * + * * @param pAttribs * @return String */ @@ -225,7 +224,7 @@ public static String getClassOrigin(Attributes pAttribs) { /** * ENTITY % Propagated "PROPAGATED (true|false) 'false'" getPropagated - * + * * @param pAttribs * @return boolean */ @@ -236,7 +235,7 @@ public static boolean getPropagated(Attributes pAttribs) { /** * ENTITY % ArraySize "ARRAYSIZE CDATA #IMPLIED" - * + * * @param pAttribs * @return int * @throws SAXException @@ -246,8 +245,7 @@ public static int getArraySize(Attributes pAttribs) throws SAXException { // 0 - unbounded size int size = 0; try { - size = arraySizeStr == null || arraySizeStr.length() == 0 ? 0 : Integer - .parseInt(arraySizeStr); + size = arraySizeStr == null || arraySizeStr.length() == 0 ? 0 : Integer.parseInt(arraySizeStr); } catch (NumberFormatException e) { throw new SAXException(arraySizeStr + " is not a valid ARRAYSIZE attribute!"); } @@ -259,14 +257,13 @@ public static int getArraySize(Attributes pAttribs) throws SAXException { * ENTITY % CIMType "TYPE * (boolean|string|char16|uint8|sint8|uint16|sint16|uint32 * |sint32|uint64|sint64|datetime|real32|real64)" getCIMType - * + * * @param pAttribs * @param pOptional * @return CIMDataType * @throws SAXException */ - public static CIMDataType getCIMType(Attributes pAttribs, boolean pOptional) - throws SAXException { + public static CIMDataType getCIMType(Attributes pAttribs, boolean pOptional) throws SAXException { String typeStr = pAttribs.getValue("TYPE"); if (typeStr == null) { if (pOptional) return null; @@ -274,16 +271,15 @@ public static CIMDataType getCIMType(Attributes pAttribs, boolean pOptional) } CIMDataType type = CIMObjectFactory.getType(typeStr); if (type == null) throw new SAXException(typeStr + " is not a valid TYPE attribute!"); - if (type.getType() == CIMDataType.REFERENCE) throw new SAXException( - "TYPE attribute cannot be \"reference\"!"); + if (type.getType() == CIMDataType.REFERENCE) throw new SAXException("TYPE attribute cannot be \"reference\"!"); // Is it array? // Yes if ISARRAY is true or ARRAYSIZE>-1. boolean isArray = hasTrueAttribute(pAttribs, "ISARRAY"); String arraySizeStr = pAttribs.getValue("ARRAYSIZE"); int arraySize; try { - arraySize = (arraySizeStr == null || arraySizeStr.length() == 0 ? (isArray ? 0 : -1) - : Integer.parseInt(arraySizeStr)); + arraySize = + (arraySizeStr == null || arraySizeStr.length() == 0 ? (isArray ? 0 : -1) : Integer.parseInt(arraySizeStr)); } catch (NumberFormatException e) { throw new SAXException(arraySizeStr + " is not a valid ARRAYSIZE attribute!"); } @@ -296,7 +292,7 @@ public static CIMDataType getCIMType(Attributes pAttribs, boolean pOptional) /** * getCIMType(pAttribs, pOptional=false); - * + * * @param pAttribs * @return CIMDataType * @throws SAXException @@ -309,7 +305,7 @@ public static CIMDataType getCIMType(Attributes pAttribs) throws SAXException { * ENTITY % ParamType "PARAMTYPE ( * boolean|string|char16|uint8|sint8|uint16|sint16 * |uint32|sint32|uint64|sint64|datetime| real32|real64|reference) - * + * * @param pAttribs * @return CIMDataType * @throws SAXException @@ -327,7 +323,7 @@ public static CIMDataType getParamType(Attributes pAttribs) throws SAXException * TOINSTANCE (true|false) 'false' * TRANSLATABLE (true|false) 'false'" * - * + * * @param pAttribs * @return int - CIMFlavor bit mixture */ @@ -341,7 +337,7 @@ public int getQualifierFlavor(Attributes pAttribs) { /** * hasTrueAttribute - * + * * @param pAttribs * @param pName * @return boolean @@ -352,7 +348,7 @@ public static boolean hasTrueAttribute(Attributes pAttribs, String pName) { /** * getBoolAttribute - * + * * @param pAttribs * @param pName * @param pDefVal @@ -367,26 +363,32 @@ public static boolean getBoolAttribute(Attributes pAttribs, String pName, boolea /** * duplicatedNode - * + * * @param pParsedNodeName * @param pNewNodeName * @throws SAXException */ public void duplicatedNode(String pParsedNodeName, String pNewNodeName) throws SAXException { - throw new SAXException(getNodeName() + " has a " + pParsedNodeName - + " child node which disallows an additional " + pNewNodeName + " child node!"); + throw new SAXException( + getNodeName() + + " has a " + + pParsedNodeName + + " child node which disallows an additional " + + pNewNodeName + + " child node!" + ); } /** * illegalChildNodePair - * + * * @param pNodeName0 * @param pNodeName1 * @throws SAXException */ public void illegalChildNodePair(String pNodeName0, String pNodeName1) throws SAXException { - throw new SAXException(pNodeName0 + ", " + pNodeName1 + " child node pair is illegal for " - + getNodeName() + " node!"); + throw new SAXException( + pNodeName0 + ", " + pNodeName1 + " child node pair is illegal for " + getNodeName() + " node!" + ); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/NonVolatileIf.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/NonVolatileIf.java index d99dd16..1c597a5 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/NonVolatileIf.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/NonVolatileIf.java @@ -45,13 +45,11 @@ * IRETURNVALUE) */ public interface NonVolatileIf { - /** * Have to be called by SAX's DefaultHandler.startElement() after * testChild() call. - * + * * @param pChild */ public abstract void addChild(Node pChild); - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ObjectPathIf.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ObjectPathIf.java index 6eaef1a..9a3e8a4 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ObjectPathIf.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ObjectPathIf.java @@ -45,10 +45,9 @@ * It's implemented by Nodes which can construct a CIMObjectPath. */ public interface ObjectPathIf { - /** * getCIMObjectPath - * + * * @return CIMObjectPath */ CIMObjectPath getCIMObjectPath(); diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ObjectPathNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ObjectPathNode.java index 4bdb6ce..3ab39c4 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ObjectPathNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ObjectPathNode.java @@ -52,7 +52,6 @@ * ELEMENT OBJECTPATH (INSTANCEPATH | CLASSPATH) */ public class ObjectPathNode extends AbstractPathNode { - // (INSTANCEPATH | CLASSPATH) private CIMObjectPath iObjPath; @@ -80,17 +79,21 @@ public void init(Attributes pAttribs, SAXSession pSession) { */ @Override public void parseData(String pData) { - // no data + // no data } @Override public void testChild(String pNodeNameEnum) throws SAXException { - if (this.iObjPath != null) throw new SAXException(getNodeName() - + " node can have only one INSTANCEPATH or CLASSPATH child node!" + " Additional " - + pNodeNameEnum + " child node is invalid!"); + if (this.iObjPath != null) throw new SAXException( + getNodeName() + + " node can have only one INSTANCEPATH or CLASSPATH child node!" + + " Additional " + + pNodeNameEnum + + " child node is invalid!" + ); if (pNodeNameEnum != CLASSPATH && pNodeNameEnum != INSTANCEPATH) throw new SAXException( - getNodeName() + " node child node can be CLASSPATH or INSTANCEPATH but a " - + pNodeNameEnum + " node was found!"); + getNodeName() + " node child node can be CLASSPATH or INSTANCEPATH but a " + pNodeNameEnum + " node was found!" + ); } @Override @@ -100,12 +103,12 @@ public void childParsed(Node pChild) { @Override public void testCompletness() throws SAXException { - if (this.iObjPath == null) throw new SAXException(getNodeName() - + " node must have a INSTANCEPATH or CLASSPATH child node!"); + if (this.iObjPath == null) throw new SAXException( + getNodeName() + " node must have a INSTANCEPATH or CLASSPATH child node!" + ); } public CIMObjectPath getCIMObjectPath() { return this.iObjPath; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ParamValueNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ParamValueNode.java index 883e421..e890107 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ParamValueNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ParamValueNode.java @@ -60,7 +60,6 @@ * PARAMVALUE %CIMName; %ParamType; #IMPLIED %EmbeddedObject; #IMPLIED - new */ public class ParamValueNode extends AbstractParamValueNode { - private String iName; private EmbObjHandler iEmbObjHandler; @@ -83,8 +82,7 @@ public ParamValueNode() { @Override public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { - this.iEmbObjHandler = EmbObjHandler.init(this.iEmbObjHandler, getNodeName(), pAttribs, - pSession, null, true); + this.iEmbObjHandler = EmbObjHandler.init(this.iEmbObjHandler, getNodeName(), pAttribs, pSession, null, true); this.iHasChild = false; this.iHasTypeValue = false; this.iName = getCIMName(pAttribs); @@ -97,11 +95,20 @@ public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { */ @Override public void parseData(String pData) { - // no data + // no data } - private static final String[] ALLOWED_CHILDREN = { VALUE, VALUE_REFERENCE, VALUE_ARRAY, - VALUE_REFARRAY, CLASSNAME, INSTANCENAME, CLASS, INSTANCE, VALUE_NAMEDINSTANCE }; + private static final String[] ALLOWED_CHILDREN = { + VALUE, + VALUE_REFERENCE, + VALUE_ARRAY, + VALUE_REFARRAY, + CLASSNAME, + INSTANCENAME, + CLASS, + INSTANCE, + VALUE_NAMEDINSTANCE + }; @Override public void testChild(String pNodeNameEnum) throws SAXException { @@ -112,17 +119,19 @@ public void testChild(String pNodeNameEnum) throws SAXException { break; } } - if (!allowed) throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum - + " child node!"); - if (this.iHasChild) throw new SAXException(getNodeName() - + " node cannot have more than one child node!"); + if (!allowed) throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum + " child node!"); + if (this.iHasChild) throw new SAXException(getNodeName() + " node cannot have more than one child node!"); // type check CIMDataType rawType = this.iEmbObjHandler.getRawType(); if (rawType != null) { if (pNodeNameEnum == VALUE_REFERENCE || pNodeNameEnum == VALUE_REFARRAY) { if (rawType.getType() != CIMDataType.REFERENCE) throw new SAXException( - "PARAMVALUE node's PARAMTYPE attribute is not reference (" + rawType - + "), but a " + pNodeNameEnum + " child node is found!"); + "PARAMVALUE node's PARAMTYPE attribute is not reference (" + + rawType + + "), but a " + + pNodeNameEnum + + " child node is found!" + ); } } } @@ -133,11 +142,11 @@ public void childParsed(Node pChild) { this.iEmbObjHandler.addValueNode((AbstractValueNode) pChild); } else { this.iValue = ((ValueIf) pChild).getValue(); - if (pChild instanceof TypedIf) this.iType = ((TypedIf) pChild).getType(); - else if (pChild instanceof ObjectPathIf) this.iType = CIMDataType - .getDataType(((ObjectPathIf) pChild).getCIMObjectPath()); - else if (pChild instanceof ValueIf) this.iType = CIMDataType - .getDataType(((ValueIf) pChild).getValue()); + if (pChild instanceof TypedIf) this.iType = ((TypedIf) pChild).getType(); else if ( + pChild instanceof ObjectPathIf + ) this.iType = CIMDataType.getDataType(((ObjectPathIf) pChild).getCIMObjectPath()); else if ( + pChild instanceof ValueIf + ) this.iType = CIMDataType.getDataType(((ValueIf) pChild).getValue()); this.iHasTypeValue = true; } this.iHasChild = true; @@ -158,7 +167,7 @@ public CIMDataType getType() { /** * getCIMArgument - * + * * @return CIMArgument */ @Override @@ -175,5 +184,4 @@ public CIMArgument getCIMArgument() { public Object getValue() { return this.iValue; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ParameterArrayNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ParameterArrayNode.java index 2c80f8c..7837af3 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ParameterArrayNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ParameterArrayNode.java @@ -57,7 +57,6 @@ * */ public class ParameterArrayNode extends AbstractParameterNode { - private CIMDataType iType; private EmbObjHandler iEmbObjHandler; @@ -71,10 +70,9 @@ public ParameterArrayNode() { @Override protected void specificInit(Attributes pAttribs) throws SAXException { - if (getCIMType(pAttribs, true) == null) throw new SAXException( - "PARAMETER.ARRAY element missing TYPE attribute!"); - this.iEmbObjHandler = EmbObjHandler.init(this.iEmbObjHandler, getNodeName(), pAttribs, - this.iSession, this.iQualiHandler, true); + if (getCIMType(pAttribs, true) == null) throw new SAXException("PARAMETER.ARRAY element missing TYPE attribute!"); + this.iEmbObjHandler = + EmbObjHandler.init(this.iEmbObjHandler, getNodeName(), pAttribs, this.iSession, this.iQualiHandler, true); } @Override @@ -85,5 +83,4 @@ public void testCompletness() throws SAXException { public CIMDataType getType() { return this.iType; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ParameterNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ParameterNode.java index 7f2239e..2b98633 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ParameterNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ParameterNode.java @@ -51,7 +51,6 @@ * ELEMENT PARAMETER (QUALIFIER*) ATTLIST PARAMETER %CIMName; %CIMType; */ public class ParameterNode extends AbstractParameterNode { - private CIMDataType iType; private EmbObjHandler iEmbObjHandler; @@ -65,21 +64,18 @@ public ParameterNode() { @Override protected void specificInit(Attributes pAttribs) throws SAXException { - if (getCIMType(pAttribs, true) == null) throw new SAXException( - "PARAMETER element missing TYPE attribute!"); - this.iEmbObjHandler = EmbObjHandler.init(this.iEmbObjHandler, getNodeName(), pAttribs, - this.iSession, this.iQualiHandler, true); + if (getCIMType(pAttribs, true) == null) throw new SAXException("PARAMETER element missing TYPE attribute!"); + this.iEmbObjHandler = + EmbObjHandler.init(this.iEmbObjHandler, getNodeName(), pAttribs, this.iSession, this.iQualiHandler, true); } @Override public void testCompletness() throws SAXException { this.iType = this.iEmbObjHandler.getType(); - if (this.iType.isArray()) throw new SAXException( - "PARAMETER node's TYPE attribute cannot be an array!"); + if (this.iType.isArray()) throw new SAXException("PARAMETER node's TYPE attribute cannot be an array!"); } public CIMDataType getType() { return this.iType; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ParameterRefArrayNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ParameterRefArrayNode.java index 6d8d383..9a3add4 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ParameterRefArrayNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ParameterRefArrayNode.java @@ -59,7 +59,6 @@ * */ public class ParameterRefArrayNode extends AbstractParameterNode { - private CIMDataType iType; /** @@ -73,14 +72,14 @@ public ParameterRefArrayNode() { protected void specificInit(Attributes pAttribs) throws SAXException { String refClass = getReferenceClass(pAttribs); this.iType = new CIMDataType(refClass != null ? refClass : "", getArraySize(pAttribs)); - } @Override - public void testCompletness() { /* */} + public void testCompletness() { + /* */ + } public CIMDataType getType() { return this.iType; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ParameterReferenceNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ParameterReferenceNode.java index 20bd71a..37603db 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ParameterReferenceNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ParameterReferenceNode.java @@ -54,7 +54,6 @@ * */ public class ParameterReferenceNode extends AbstractParameterNode { - private CIMDataType iType; /** @@ -71,10 +70,11 @@ protected void specificInit(Attributes pAttribs) { } @Override - public void testCompletness() { /* */} + public void testCompletness() { + /* */ + } public CIMDataType getType() { return this.iType; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/PropertyArrayNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/PropertyArrayNode.java index 07147ba..ffcb26c 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/PropertyArrayNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/PropertyArrayNode.java @@ -56,7 +56,7 @@ /** *
        * ELEMENT PROPERTY.ARRAY (QUALIFIER*, VALUE.ARRAY?)
      - * ATTLIST PROPERTY.ARRAY 
      + * ATTLIST PROPERTY.ARRAY
        *   %CIMName;
        *   %CIMType;              #REQUIRED
        *   %ArraySize;
      @@ -67,7 +67,6 @@
        * 
      */ public class PropertyArrayNode extends AbstractPropertyNode { - // VALUE.ARRAY // required for super.testChild() private boolean iHasValueArray; @@ -90,15 +89,16 @@ public PropertyArrayNode() { @Override protected void specificInit(Attributes pAttribs, SAXSession pSession) throws SAXException { this.iHasTypeAttribute = (getCIMType(pAttribs, true) != null); - this.iEmbObjHandler = EmbObjHandler.init(this.iEmbObjHandler, getNodeName(), pAttribs, - pSession, this.iQualiHandler, true); + this.iEmbObjHandler = + EmbObjHandler.init(this.iEmbObjHandler, getNodeName(), pAttribs, pSession, this.iQualiHandler, true); this.iHasValueArray = false; } @Override protected void childValueNodeParsed(Node pChild) throws SAXException { if (!this.iHasTypeAttribute && ((ValueArrayNode) pChild).getType() == null) throw new SAXException( - "PROPERTY.ARRAY element missing TYPE attribute!"); + "PROPERTY.ARRAY element missing TYPE attribute!" + ); this.iEmbObjHandler.addValueNode((ValueArrayNode) pChild); this.iHasValueArray = true; } @@ -135,5 +135,4 @@ protected boolean hasValueNode() { protected CIMQualifier[] getQualis() { return this.iQualiHandler.getQualis(this.iType == CIMDataType.STRING_ARRAY_T); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/PropertyNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/PropertyNode.java index 2887239..092158c 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/PropertyNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/PropertyNode.java @@ -56,7 +56,7 @@ /** *
        * ELEMENT PROPERTY (QUALIFIER*, VALUE?)
      - * ATTLIST PROPERTY 
      + * ATTLIST PROPERTY
        *   %CIMName;
        *   %ClassOrigin;
        *   %Propagated;
      @@ -66,7 +66,6 @@
        * 
      */ public class PropertyNode extends AbstractPropertyNode { - private CIMDataType iType; // VALUE element @@ -88,8 +87,8 @@ public PropertyNode() { @Override protected void specificInit(Attributes pAttribs, SAXSession pSession) throws SAXException { this.iHasTypeAttribute = (getCIMType(pAttribs, true) != null); - this.iEmbObjHandler = EmbObjHandler.init(this.iEmbObjHandler, getNodeName(), pAttribs, - pSession, this.iQualiHandler, true); + this.iEmbObjHandler = + EmbObjHandler.init(this.iEmbObjHandler, getNodeName(), pAttribs, pSession, this.iQualiHandler, true); this.iHasValue = false; } @@ -97,7 +96,8 @@ protected void specificInit(Attributes pAttribs, SAXSession pSession) throws SAX public void childValueNodeParsed(Node pChild) throws SAXException { this.iHasValue = true; if (!this.iHasTypeAttribute && ((ValueNode) pChild).getType() == null) throw new SAXException( - "PROPERTY element missing TYPE attribute!"); + "PROPERTY element missing TYPE attribute!" + ); this.iEmbObjHandler.addValueNode((ValueNode) pChild); } @@ -132,5 +132,4 @@ public CIMDataType getType() { public Object getValue() { return this.iValue; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/PropertyReferenceNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/PropertyReferenceNode.java index 027e1ca..95f2844 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/PropertyReferenceNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/PropertyReferenceNode.java @@ -52,17 +52,16 @@ /** *
      - * 
      + *
        * ELEMENT PROPERTY.REFERENCE (QUALIFIER*, (VALUE.REFERENCE)?)
        * ATTLIST PROPERTY.REFERENCE
      - *   %CIMName; 
      - *   %ReferenceClass; 
      + *   %CIMName;
      + *   %ReferenceClass;
        *   %ClassOrigin;
        *   %Propagated;
        * 
      */ public class PropertyReferenceNode extends AbstractPropertyNode { - private String iRefClassName; // VALUE.REFERENCE @@ -108,11 +107,10 @@ protected void specificInit(Attributes pAttribs, SAXSession pSession) { @Override public void testCompletness() { - // + // } public CIMDataType getType() { return new CIMDataType(this.iRefClassName != null ? this.iRefClassName : ""); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/QualiDeclNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/QualiDeclNode.java index 4858f34..dafadd8 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/QualiDeclNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/QualiDeclNode.java @@ -61,8 +61,8 @@ /** *
        * ELEMENT QUALIFIER.DECLARATION (SCOPE?, (VALUE | VALUE.ARRAY)?)
      - * ATTLIST QUALIFIER.DECLARATION 
      - * 	%CIMName;               
      + * ATTLIST QUALIFIER.DECLARATION
      + * 	%CIMName;
        * 	%CIMType;               #REQUIRED
        * 	ISARRAY    (true|false) #IMPLIED
        * 	%ArraySize;
      @@ -70,7 +70,6 @@
        * 
      */ public class QualiDeclNode extends Node implements TypedIf, ValueIf { - // child nodes // SCOPE private boolean iHasScope; @@ -98,7 +97,7 @@ public QualiDeclNode() { /** * getName - * + * * @return String */ public String getName() { @@ -111,7 +110,7 @@ public CIMDataType getType() { /** * getFlavor - * + * * @return int - CIMFlavor bitset */ public int getFlavor() { @@ -137,35 +136,42 @@ public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { */ @Override public void parseData(String pData) { - // no data + // no data } @Override public void testChild(String pNodeNameEnum) throws SAXException { if (pNodeNameEnum == VALUE || pNodeNameEnum == VALUE_ARRAY) { - if (this.iValueNodeName != null) throw new SAXException("Cannot add " + pNodeNameEnum - + " node, this " + getNodeName() + " node has already got a " - + this.iValueNodeName + " node!"); + if (this.iValueNodeName != null) throw new SAXException( + "Cannot add " + + pNodeNameEnum + + " node, this " + + getNodeName() + + " node has already got a " + + this.iValueNodeName + + " node!" + ); } else if (pNodeNameEnum == SCOPE) { - if (this.iHasScope) throw new SAXException("Cannot add " + pNodeNameEnum - + " node, this " + getNodeName() + " node has already got one!"); - } else throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum - + " child node!"); + if (this.iHasScope) throw new SAXException( + "Cannot add " + pNodeNameEnum + " node, this " + getNodeName() + " node has already got one!" + ); + } else throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum + " child node!"); } /** * Required to handle the output XML of some non-standard CIMOMs like SVC * which adds the TYPE attribute to the sub VALUE or VALUE.ARRAY XML * element. - * + * * @param pTypedIf * @throws SAXException */ private void setType(TypedIf pTypedIf) throws SAXException { if (this.iType != null) return; this.iType = pTypedIf.getType(); - if (this.iType == null) throw new SAXException("Unknown type for Qualifier declaration in " - + getNodeName() + " node!"); + if (this.iType == null) throw new SAXException( + "Unknown type for Qualifier declaration in " + getNodeName() + " node!" + ); } @Override @@ -180,8 +186,7 @@ public void childParsed(Node pChild) throws SAXException { setType(valAChild); this.iValue = CIMObjectFactory.getObject(this.iType, valAChild); // making array type - if (!this.iType.isArray()) this.iType = CIMHelper.UnboundedArrayDataType(this.iType - .getType()); + if (!this.iType.isArray()) this.iType = CIMHelper.UnboundedArrayDataType(this.iType.getType()); } else if (pChild instanceof ValueNode) { ValueNode valChild = (ValueNode) pChild; setType(valChild); @@ -190,18 +195,18 @@ public void childParsed(Node pChild) throws SAXException { this.iValue = null; } } - } @Override public void testCompletness() throws SAXException { - if (this.iType == null) throw new SAXException("Unknown type for Qualifier declaration in " - + getNodeName() + " node!"); + if (this.iType == null) throw new SAXException( + "Unknown type for Qualifier declaration in " + getNodeName() + " node!" + ); } /** * getCIMQualifierType - * + * * @return CIMQualifierType */ public CIMQualifierType getCIMQualifierType() { @@ -209,12 +214,16 @@ public CIMQualifierType getCIMQualifierType() { * CIMQualifierType( CIMObjectPath pPath, CIMDataType pType, Object * pValue, int pScope, int pFlavor ) */ - return new CIMQualifierType(new CIMObjectPath(null, null, null, null, this.iName, - null), this.iType, this.iValue, this.iScope, this.iFlavor); + return new CIMQualifierType( + new CIMObjectPath(null, null, null, null, this.iName, null), + this.iType, + this.iValue, + this.iScope, + this.iFlavor + ); } public Object getValue() { return getCIMQualifierType(); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/QualifiedNodeHandler.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/QualifiedNodeHandler.java index db2dc73..3c94404 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/QualifiedNodeHandler.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/QualifiedNodeHandler.java @@ -50,7 +50,6 @@ */ import java.util.ArrayList; - import org.metricshub.wbem.javax.cim.CIMDataType; import org.metricshub.wbem.javax.cim.CIMQualifier; import org.metricshub.wbem.sblim.cimclient.GenericExts; @@ -61,7 +60,6 @@ * elements. */ public class QualifiedNodeHandler { - private static final Boolean TRUE = Boolean.TRUE; private ArrayList> iQualiAL; @@ -74,7 +72,7 @@ public class QualifiedNodeHandler { /** * init - * + * * @param pQNH * - if it's null it returns with a new instance otherwise it * inits and returns pQNH @@ -97,7 +95,7 @@ public void init() { /** * addQualifierNode - * + * * @param pNode * @return false if pNode is not instance of QualifierNode */ @@ -116,8 +114,9 @@ public boolean addQualifierNode(Node pNode) { } else if ("ASSOCIATION".equalsIgnoreCase(quali.getName())) { this.iHasAssocQuali = true; } - } else if (CIMDataType.STRING_T.equals(quali.getDataType()) - && "EMBEDDEDINSTANCE".equalsIgnoreCase(quali.getName())) { + } else if ( + CIMDataType.STRING_T.equals(quali.getDataType()) && "EMBEDDEDINSTANCE".equalsIgnoreCase(quali.getName()) + ) { this.iHasEmbInstQuali = true; } this.iQualiAL.add(quali); @@ -127,7 +126,7 @@ public boolean addQualifierNode(Node pNode) { /** * getQualis - * + * * @return CIMQualifier[] */ public CIMQualifier[] getQualis() { @@ -136,7 +135,7 @@ public CIMQualifier[] getQualis() { /** * getQualis - * + * * @param pIncludeEmbObj * @return CIMQualifier[] */ @@ -147,7 +146,7 @@ public CIMQualifier[] getQualis(boolean pIncludeEmbObj) { /** * isKeyed - * + * * @return boolean */ public boolean isKeyed() { @@ -156,7 +155,7 @@ public boolean isKeyed() { /** * isAssociation - * + * * @return boolean */ public boolean isAssociation() { @@ -165,7 +164,7 @@ public boolean isAssociation() { /** * isEmbeddedObject - * + * * @return boolean */ public boolean isEmbeddedObject() { @@ -174,7 +173,7 @@ public boolean isEmbeddedObject() { /** * isEmbeddedInstance - * + * * @return boolean */ public boolean isEmbeddedInstance() { @@ -189,9 +188,8 @@ private void makeQualiImpl(boolean pIncludeEmbObj) { this.iQualiImpl = new CIMQualifiedElementInterfaceImpl(null); return; } - this.iQualiImpl = new CIMQualifiedElementInterfaceImpl(this.iQualiAL.toArray(EMPTY_QA), - this.iHasKeyQuali, pIncludeEmbObj); + this.iQualiImpl = + new CIMQualifiedElementInterfaceImpl(this.iQualiAL.toArray(EMPTY_QA), this.iHasKeyQuali, pIncludeEmbObj); this.iQualiAL = null; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/QualifierNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/QualifierNode.java index 7090da9..0e91c22 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/QualifierNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/QualifierNode.java @@ -61,7 +61,7 @@ /** *
        * ELEMENT QUALIFIER ((VALUE | VALUE.ARRAY)?)
      - * ATTLIST QUALIFIER 
      + * ATTLIST QUALIFIER
        *  %CIMName;
        *  %CIMType;              #REQUIRED
        *  %Propagated;
      @@ -70,7 +70,6 @@
        * 
      */ public class QualifierNode extends Node { - private String iName; private CIMDataType iType; @@ -111,15 +110,17 @@ public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { */ @Override public void parseData(String pData) { - // no data + // no data } @Override public void testChild(String pNodeNameEnum) throws SAXException { - if (this.iQuali != null) throw new SAXException(getNodeName() - + " node can have only one VALUE or VALUE.ARRAY child node!"); + if (this.iQuali != null) throw new SAXException( + getNodeName() + " node can have only one VALUE or VALUE.ARRAY child node!" + ); if (pNodeNameEnum != VALUE && pNodeNameEnum != VALUE_ARRAY) throw new SAXException( - pNodeNameEnum + " child node is not valid for " + getNodeName() + " node!"); + pNodeNameEnum + " child node is not valid for " + getNodeName() + " node!" + ); } @Override @@ -133,8 +134,7 @@ public void childParsed(Node pChild) throws SAXException { // create array value value = CIMObjectFactory.getObject(this.iType, valANode); // constructs array type - type = this.iType.isArray() ? this.iType : CIMHelper.UnboundedArrayDataType(this.iType - .getType()); + type = this.iType.isArray() ? this.iType : CIMHelper.UnboundedArrayDataType(this.iType.getType()); } else if (absValNode instanceof ValueNode) { ValueNode valNode = (ValueNode) absValNode; setType(valNode); @@ -145,23 +145,22 @@ public void childParsed(Node pChild) throws SAXException { type = CIMDataType.STRING_T; value = null; } - this.iQuali = new CIMQualifier(this.iName, type, value, this.iFlavor, - this.iPropagated); + this.iQuali = new CIMQualifier(this.iName, type, value, this.iFlavor, this.iPropagated); } @Override public void testCompletness() { - // child node is optional, hence commented to support - // servers that do not implement default value to qualifier node - /* - * if (iQuali == null) throw new SAXException(getNodeName() + " must have a - * VALUE or VALUE.ARRAY child node!"); - */ + // child node is optional, hence commented to support + // servers that do not implement default value to qualifier node + /* + * if (iQuali == null) throw new SAXException(getNodeName() + " must have a + * VALUE or VALUE.ARRAY child node!"); + */ } /** * getQualifier - * + * * @return CIMQualifier */ public CIMQualifier getQualifier() { @@ -172,15 +171,15 @@ public CIMQualifier getQualifier() { * Required to handle the output XML of some non-standard CIMOMs like SVC * which adds the TYPE attribute to the sub VALUE or VALUE.ARRAY XML * element. - * + * * @param pTypedIf * @throws SAXException */ private void setType(TypedIf pTypedIf) throws SAXException { if (this.iType != null) return; this.iType = pTypedIf.getType(); - if (this.iType == null) throw new SAXException("Unknown type for Qualifier declaration in " - + getNodeName() + " node!"); + if (this.iType == null) throw new SAXException( + "Unknown type for Qualifier declaration in " + getNodeName() + " node!" + ); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/RetValPipeIf.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/RetValPipeIf.java index d7e1d98..6dbfdce 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/RetValPipeIf.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/RetValPipeIf.java @@ -43,19 +43,17 @@ * RetValPipeIf is a FIFO interface which helps PULL parsing. */ public interface RetValPipeIf { - /** * getReturnValueCount - * + * * @return the currently available return values */ public abstract int getReturnValueCount(); /** * readReturnValue - * + * * @return a return value Object from a FIFO */ public abstract Object readReturnValue(); - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ReturnValueNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ReturnValueNode.java index 2dc244f..e5aa07c 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ReturnValueNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ReturnValueNode.java @@ -61,7 +61,6 @@ * */ public class ReturnValueNode extends Node implements TypedIf, ValueIf { - private EmbObjHandler iEmbObjHandler; private CIMDataType iType; @@ -82,8 +81,7 @@ public ReturnValueNode() { public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { this.iType = null; this.iValue = null; - this.iEmbObjHandler = EmbObjHandler.init(this.iEmbObjHandler, getNodeName(), pAttribs, - pSession, null, true); + this.iEmbObjHandler = EmbObjHandler.init(this.iEmbObjHandler, getNodeName(), pAttribs, pSession, null, true); this.iHasValue = false; } @@ -92,16 +90,14 @@ public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { */ @Override public void parseData(String pData) { - // no data + // no data } @Override public void testChild(String pNodeNameEnum) throws SAXException { if (pNodeNameEnum == VALUE || pNodeNameEnum == VALUE_REFERENCE) { - if (this.iHasValue) throw new SAXException(getNodeName() - + " node can have only one child node!"); - } else throw new SAXException(pNodeNameEnum + " cannot be the child node of " - + getNodeName() + " node!"); + if (this.iHasValue) throw new SAXException(getNodeName() + " node can have only one child node!"); + } else throw new SAXException(pNodeNameEnum + " cannot be the child node of " + getNodeName() + " node!"); } @Override @@ -109,8 +105,12 @@ public void childParsed(Node pChild) throws SAXException { AbstractValueNode valNode = (AbstractValueNode) pChild; if (valNode instanceof ValueReferenceNode) { if (this.iType != null && this.iType.getType() != CIMDataType.REFERENCE) throw new SAXException( - getNodeName() + " node's child node is VALUE.REFERENCE " - + "but its type based on PARAMTYPE attribute is " + this.iType + "!"); + getNodeName() + + " node's child node is VALUE.REFERENCE " + + "but its type based on PARAMTYPE attribute is " + + this.iType + + "!" + ); ValueReferenceNode valRefNode = (ValueReferenceNode) valNode; this.iValue = valRefNode.getCIMObjectPath(); this.iType = valRefNode.getType(); @@ -138,5 +138,4 @@ public CIMDataType getType() { public Object getValue() { return this.iValue; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ScopeNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ScopeNode.java index 465b28c..a505987 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ScopeNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ScopeNode.java @@ -22,8 +22,6 @@ package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node; -import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; - /*- * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ * WBEM Java Client @@ -45,6 +43,7 @@ */ import org.metricshub.wbem.javax.cim.CIMScope; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; import org.xml.sax.Attributes; import org.xml.sax.SAXException; @@ -62,7 +61,6 @@ * */ public class ScopeNode extends Node { - private int iScope; /** @@ -74,7 +72,7 @@ public ScopeNode() { /** * getScope - * + * * @return int - set of CIMScope bits */ public int getScope() { @@ -101,7 +99,7 @@ public void init(Attributes pAttribs, SAXSession pSession) { */ @Override public void parseData(String pData) { - // no data + // no data } /** @@ -117,12 +115,11 @@ public void testChild(String pNodeNameEnum) throws SAXException { */ @Override public void childParsed(Node pChild) { - // no child + // no child } @Override public void testCompletness() { - // Nothing to test, since it doesn't have any child node. + // Nothing to test, since it doesn't have any child node. } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/SimpleExpReqNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/SimpleExpReqNode.java index 2c99bb2..97b47d2 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/SimpleExpReqNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/SimpleExpReqNode.java @@ -52,7 +52,6 @@ * ELEMENT SIMPLEEXPREQ (CORRELATOR*, EXPMETHODCALL) */ public class SimpleExpReqNode extends AbstractMessageNode { - private ExpMethodCallNode iMethodCallNode; /** @@ -85,22 +84,20 @@ public void init(Attributes pAttribs, SAXSession pSession) { */ @Override public void parseData(String pData) { - // no data + // no data } @Override public void testChild(String pNodeNameEnum) throws SAXException { if (pNodeNameEnum == EXPMETHODCALL) { - if (this.iMethodCallNode != null) throw new SAXException(getNodeName() - + " node can have only one child node!"); - } else if (pNodeNameEnum != CORRELATOR) throw new SAXException(getNodeName() - + " node cannot have " + pNodeNameEnum + " child node!"); + if (this.iMethodCallNode != null) throw new SAXException(getNodeName() + " node can have only one child node!"); + } else if (pNodeNameEnum != CORRELATOR) throw new SAXException( + getNodeName() + " node cannot have " + pNodeNameEnum + " child node!" + ); } @Override public void testCompletness() throws SAXException { - if (this.iMethodCallNode == null) throw new SAXException(getNodeName() - + " node must have a child node!"); + if (this.iMethodCallNode == null) throw new SAXException(getNodeName() + " node must have a child node!"); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/SimpleExpRspNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/SimpleExpRspNode.java index 15f3724..c7a366d 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/SimpleExpRspNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/SimpleExpRspNode.java @@ -58,7 +58,6 @@ * */ public class SimpleExpRspNode extends AbstractSimpleRspNode { - private ExpMethodResponseNode iExpMethodRspNode; /** @@ -87,22 +86,22 @@ public void init(Attributes pAttribs, SAXSession pSession) { */ @Override public void parseData(String pData) { - // no data + // no data } @Override public void testChild(String pNodeNameEnum) throws SAXException { - if (this.iExpMethodRspNode != null) throw new SAXException(getNodeName() - + " node can have only one child node!"); - if (pNodeNameEnum != EXPMETHODRESPONSE) throw new SAXException(getNodeName() - + " node's child node can be EXPMETHODRESPONSE only! " + pNodeNameEnum - + " is invalid!"); + if (this.iExpMethodRspNode != null) throw new SAXException(getNodeName() + " node can have only one child node!"); + if (pNodeNameEnum != EXPMETHODRESPONSE) throw new SAXException( + getNodeName() + " node's child node can be EXPMETHODRESPONSE only! " + pNodeNameEnum + " is invalid!" + ); } @Override public void testCompletness() throws SAXException { - if (this.iExpMethodRspNode == null) throw new SAXException(getNodeName() - + " node must have an EXPMETHODRESPONSE child node!"); + if (this.iExpMethodRspNode == null) throw new SAXException( + getNodeName() + " node must have an EXPMETHODRESPONSE child node!" + ); } @Override @@ -125,5 +124,4 @@ public int getReturnValueCount() { public Object readReturnValue() { return this.iExpMethodRspNode == null ? null : this.iExpMethodRspNode.readReturnValue(); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/SimpleReqNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/SimpleReqNode.java index 442fcf9..bc25437 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/SimpleReqNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/SimpleReqNode.java @@ -54,7 +54,6 @@ * ELEMENT SIMPLEREQ (CORRELATOR*, (METHODCALL | IMETHODCALL)) */ public class SimpleReqNode extends AbstractMessageNode { - private AbstractMethodCallNode iMethodCallNode; /** @@ -87,7 +86,7 @@ public void init(Attributes pAttribs, SAXSession pSession) { */ @Override public void parseData(String pData) { - // no data + // no data } /** @@ -96,25 +95,23 @@ public void parseData(String pData) { @Override public void testChild(String pNodeNameEnum) throws SAXException { if (pNodeNameEnum == IMETHODCALL || pNodeNameEnum == METHODCALL) { - if (this.iMethodCallNode != null) throw new SAXException( - "SIMPLEREQ node can have only one child node!"); + if (this.iMethodCallNode != null) throw new SAXException("SIMPLEREQ node can have only one child node!"); } else if (pNodeNameEnum != CORRELATOR) throw new SAXException( - "SIMPLEREQ node cannot have " + pNodeNameEnum + " child node!"); + "SIMPLEREQ node cannot have " + pNodeNameEnum + " child node!" + ); } @Override public void testCompletness() throws SAXException { - if (this.iMethodCallNode == null) throw new SAXException( - "SIMPLEREQ node must have a child node!"); + if (this.iMethodCallNode == null) throw new SAXException("SIMPLEREQ node must have a child node!"); } /** * getAbstractMethodCallNode - * + * * @return AbstractMethodCallNode */ public AbstractMethodCallNode getAbstractMethodCallNode() { return this.iMethodCallNode; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/SimpleRspNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/SimpleRspNode.java index 4218e61..2feccaf 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/SimpleRspNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/SimpleRspNode.java @@ -55,13 +55,12 @@ /** *
        * ELEMENT SIMPLERSP (METHODRESPONSE | IMETHODRESPONSE)
      - * 
      + *
        * ELEMENT METHODRESPONSE (ERROR|(RETURNVALUE?,PARAMVALUE*))
        * ELEMENT IMETHODRESPONSE (ERROR|IRETURNVALUE?) *
        * 
      */ public class SimpleRspNode extends AbstractSimpleRspNode { - private Node iChildNode; /** @@ -90,52 +89,54 @@ public void init(Attributes pAttribs, SAXSession pSession) { */ @Override public void parseData(String pData) { - // no data + // no data } @Override public void testChild(String pNodeNameEnum) throws SAXException { - if (this.iChildNode != null) throw new SAXException(getNodeName() - + " node can have only one child node!"); + if (this.iChildNode != null) throw new SAXException(getNodeName() + " node can have only one child node!"); if (pNodeNameEnum != METHODRESPONSE && pNodeNameEnum != IMETHODRESPONSE) throw new SAXException( - getNodeName() + " node cannot have " + pNodeNameEnum + " child node!"); + getNodeName() + " node cannot have " + pNodeNameEnum + " child node!" + ); } @Override public void testCompletness() throws SAXException { - if (this.iChildNode == null) throw new SAXException(getNodeName() - + " node must have a child node!"); + if (this.iChildNode == null) throw new SAXException(getNodeName() + " node must have a child node!"); } @Override public CIMError getCIMError() { - if (this.iChildNode instanceof ErrorIf) { return ((ErrorIf) this.iChildNode).getCIMError(); } + if (this.iChildNode instanceof ErrorIf) { + return ((ErrorIf) this.iChildNode).getCIMError(); + } return null; } /** * getCIMArguments : returns the array of parsed parameters and their values * : String name, CIMDataType type, Object value - * + * * @return CIMArgument<?>[] */ @Override public CIMArgument[] getCIMArguments() { - if (this.iChildNode instanceof MethodResponseNode) return ((MethodResponseNode) this.iChildNode) - .getCIMArguments(); - else if (this.iChildNode instanceof IMethodResponseNode) return ((IMethodResponseNode) this.iChildNode) - .getCIMArguments(); + if (this.iChildNode instanceof MethodResponseNode) return ( + (MethodResponseNode) this.iChildNode + ).getCIMArguments(); else if (this.iChildNode instanceof IMethodResponseNode) return ( + (IMethodResponseNode) this.iChildNode + ).getCIMArguments(); return null; } public int getReturnValueCount() { - if (this.iChildNode instanceof RetValPipeIf) { return ((RetValPipeIf) this.iChildNode) - .getReturnValueCount(); } + if (this.iChildNode instanceof RetValPipeIf) { + return ((RetValPipeIf) this.iChildNode).getReturnValueCount(); + } return 0; } public Object readReturnValue() { return ((RetValPipeIf) this.iChildNode).readReturnValue(); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/TypedIf.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/TypedIf.java index 88d3487..a32d70e 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/TypedIf.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/TypedIf.java @@ -45,10 +45,9 @@ * TypedIf is implemented by those classes which can provide a CIMDataType. */ public interface TypedIf { - /** * getType - * + * * @return null if the type is unknown */ public CIMDataType getType(); diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueArrayNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueArrayNode.java index 8c5dcf9..0dbd832 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueArrayNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueArrayNode.java @@ -48,7 +48,6 @@ */ import java.util.ArrayList; - import org.metricshub.wbem.javax.cim.CIMDataType; import org.metricshub.wbem.sblim.cimclient.GenericExts; import org.metricshub.wbem.sblim.cimclient.internal.cim.CIMHelper; @@ -61,7 +60,6 @@ * For non-standard CIMOMs the TYPE and PARAMTYPE attributes are handled. */ public class ValueArrayNode extends AbstractArrayValueNode { - // VALUE * private ArrayList iValueAL; @@ -87,8 +85,7 @@ public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { CIMDataType scalarType = getCIMType(pAttribs, true); if (scalarType == null) scalarType = getParamType(pAttribs); // make array type - this.iType = scalarType == null ? null : CIMHelper.UnboundedArrayDataType(scalarType - .getType()); + this.iType = scalarType == null ? null : CIMHelper.UnboundedArrayDataType(scalarType.getType()); } /** @@ -96,26 +93,27 @@ public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { */ @Override public void parseData(String pData) { - // no data + // no data } @Override public void testChild(String pNodeNameEnum) throws SAXException { if (pNodeNameEnum != VALUE && pNodeNameEnum != VALUE_NULL) throw new SAXException( - "Only VALUE and VALUE.NULL nodes can be added to VALUE.ARRAY nodes but " - + pNodeNameEnum + " found!"); + "Only VALUE and VALUE.NULL nodes can be added to VALUE.ARRAY nodes but " + pNodeNameEnum + " found!" + ); } @Override public void childParsed(Node pChild) { if (this.iValueAL == null) this.iValueAL = new ArrayList(); - if (pChild instanceof ValueNode) this.iValueAL.add(((ValueNode) pChild).getValue()); - else if (pChild instanceof ValueNullNode) this.iValueAL.add(null); + if (pChild instanceof ValueNode) this.iValueAL.add(((ValueNode) pChild).getValue()); else if ( + pChild instanceof ValueNullNode + ) this.iValueAL.add(null); } @Override public void testCompletness() { - // Nothing to test, since it is OK if it doesn't have child node. + // Nothing to test, since it is OK if it doesn't have child node. } /** @@ -150,5 +148,4 @@ public CIMDataType getType() { public Object getValue() { return this.iValueAL == null ? EMPTY_SA : this.iValueAL.toArray(EMPTY_SA); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueIf.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueIf.java index 0fc079c..2bc89e8 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueIf.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueIf.java @@ -43,13 +43,12 @@ * ValueIf should be implemented by Nodes which are able to return JSR48 value * objects. (like: CIMDataTime, Integer, String, CIMClass, CIMInstance, * UnsignetInteger8, ...) - * + * */ public interface ValueIf { - /** * getValue - * + * * @return if type is unknown it returns a String */ public Object getValue(); diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueInstanceWithPathNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueInstanceWithPathNode.java index 3f7d858..5339d5f 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueInstanceWithPathNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueInstanceWithPathNode.java @@ -50,9 +50,9 @@ /** *
        * ELEMENT VALUE.INSTANCEWITHPATH (INSTANCEPATH, INSTANCE)
      - * 
      + *
        * ELEMENT INSTANCEPATH (NAMESPACEPATH,INSTANCENAME)
      - *    
      + *
        * ELEMENT INSTANCE (QUALIFIER*, (PROPERTY | PROPERTY.ARRAY | PROPERTY.REFERENCE)*)
        * ATTLIST INSTANCE
        *   %ClassName;
      @@ -60,7 +60,6 @@
        * 
      */ public class ValueInstanceWithPathNode extends AbstractScalarValueNode { - // INSTANCEPATH private CIMObjectPath iCIMInstPath; @@ -90,20 +89,21 @@ public void init(Attributes pAttribs, SAXSession pSession) { */ @Override public void parseData(String pData) { - // no data + // no data } @Override public void testChild(String pNodeNameEnum) throws SAXException { if (pNodeNameEnum == INSTANCEPATH) { if (this.iCIMInstPath != null) throw new SAXException( - "VALUE.INSTANCEWITHPATH node can have only one INSTANCEPATH node, but another one was found!"); + "VALUE.INSTANCEWITHPATH node can have only one INSTANCEPATH node, but another one was found!" + ); } else if (pNodeNameEnum == INSTANCE) { if (this.iCIMInstance != null) throw new SAXException( - "VALUE.INSTANCEWITHPATH node can have only one INSTANCE node, but another one was found!"); + "VALUE.INSTANCEWITHPATH node can have only one INSTANCE node, but another one was found!" + ); } else { - throw new SAXException("VALUE.INSTANCEWITHPATH node cannot have " + pNodeNameEnum - + " child node!"); + throw new SAXException("VALUE.INSTANCEWITHPATH node cannot have " + pNodeNameEnum + " child node!"); } } @@ -119,9 +119,11 @@ public void childParsed(Node pChild) { @Override public void testCompletness() throws SAXException { if (this.iCIMInstPath == null) throw new SAXException( - "VALUE.INSTANCEWITHPATH node must have an INSTANCEPATH child node!"); + "VALUE.INSTANCEWITHPATH node must have an INSTANCEPATH child node!" + ); if (this.iCIMInstance == null) throw new SAXException( - "VALUE.INSTANCEWITHPATH node must have an INSTANCE child node!"); + "VALUE.INSTANCEWITHPATH node must have an INSTANCE child node!" + ); } /** @@ -133,14 +135,16 @@ public Object getValue() { * INSTANCENAME contains the key properties only, INSTANCE contains * non-key properties too. */ - if (WBEMConfiguration.getGlobalConfiguration().synchronizeNumericKeyDataTypes()) return CIMHelper - .CIMInstanceWithSynchonizedNumericKeyDataTypes(this.iCIMInstPath, this.iCIMInstance - .getProperties()); + if ( + WBEMConfiguration.getGlobalConfiguration().synchronizeNumericKeyDataTypes() + ) return CIMHelper.CIMInstanceWithSynchonizedNumericKeyDataTypes( + this.iCIMInstPath, + this.iCIMInstance.getProperties() + ); return new CIMInstance(this.iCIMInstPath, this.iCIMInstance.getProperties()); } public CIMDataType getType() { return CIMDataType.OBJECT_T; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueNamedInstanceNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueNamedInstanceNode.java index dd774be..1026448 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueNamedInstanceNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueNamedInstanceNode.java @@ -57,21 +57,20 @@ /** *
        * ELEMENT VALUE.NAMEDINSTANCE (INSTANCENAME, INSTANCE)
      - * 
      + *
        * ELEMENT INSTANCENAME (KEYBINDING* | KEYVALUE? | VALUE.REFERENCE?)
        * ATTLIST INSTANCENAME
        *   %ClassName;
      - *   
      + *
        * ELEMENT INSTANCE (QUALIFIER*, (PROPERTY | PROPERTY.ARRAY | PROPERTY.REFERENCE)*)
        * ATTLIST INSTANCE
        *   %ClassName;
      - *   xml:lang   NMTOKEN      #IMPLIED 
      + *   xml:lang   NMTOKEN      #IMPLIED
        * FIXME: Why INSTANCE has qualifiers? CIMInstance doesn't have!
        * FIXME: InstanceName and instance provides redundant information. Why?
        * 
      */ public class ValueNamedInstanceNode extends AbstractScalarValueNode { - // INSTANCENAME private CIMObjectPath iCIMInstPath; @@ -101,20 +100,21 @@ public void init(Attributes pAttribs, SAXSession pSession) { */ @Override public void parseData(String pData) { - // no data + // no data } @Override public void testChild(String pNodeNameEnum) throws SAXException { if (pNodeNameEnum == INSTANCENAME) { if (this.iCIMInstPath != null) throw new SAXException( - "VALUE.NAMEDINSTANCE node can have only one INSTANCENAME node, but another one was found!"); + "VALUE.NAMEDINSTANCE node can have only one INSTANCENAME node, but another one was found!" + ); } else if (pNodeNameEnum == INSTANCE) { if (this.iCIMInstance != null) throw new SAXException( - "VALUE.NAMEDINSTANCE node can have only one INSTANCE node, but another one was found!"); + "VALUE.NAMEDINSTANCE node can have only one INSTANCE node, but another one was found!" + ); } else { - throw new SAXException("VALUE.NAMEDINSTANCE node cannot have " + pNodeNameEnum - + " child node!"); + throw new SAXException("VALUE.NAMEDINSTANCE node cannot have " + pNodeNameEnum + " child node!"); } } @@ -130,9 +130,9 @@ public void childParsed(Node pChild) { @Override public void testCompletness() throws SAXException { if (this.iCIMInstPath == null) throw new SAXException( - "VALUE.NAMEDINSTANCE node must have an INSTANCENAME child node!"); - if (this.iCIMInstance == null) throw new SAXException( - "VALUE.NAMEDINSTANCE node must have an INSTANCE child node!"); + "VALUE.NAMEDINSTANCE node must have an INSTANCENAME child node!" + ); + if (this.iCIMInstance == null) throw new SAXException("VALUE.NAMEDINSTANCE node must have an INSTANCE child node!"); } /** @@ -145,14 +145,16 @@ public Object getValue() { * INSTANCENAME contains the key properties only, INSTANCE contains the * non-key properties too. */ - if (WBEMConfiguration.getGlobalConfiguration().synchronizeNumericKeyDataTypes()) return CIMHelper - .CIMInstanceWithSynchonizedNumericKeyDataTypes(this.iCIMInstPath, this.iCIMInstance - .getProperties()); + if ( + WBEMConfiguration.getGlobalConfiguration().synchronizeNumericKeyDataTypes() + ) return CIMHelper.CIMInstanceWithSynchonizedNumericKeyDataTypes( + this.iCIMInstPath, + this.iCIMInstance.getProperties() + ); return new CIMInstance(this.iCIMInstPath, this.iCIMInstance.getProperties()); } public CIMDataType getType() { return CIMDataType.OBJECT_T; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueNode.java index ca92305..3f3be50 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueNode.java @@ -55,7 +55,6 @@ * For non-standard CIMOMs the TYPE and PARAMTYPE attributes are supported. */ public class ValueNode extends AbstractScalarValueNode { - private CIMDataType iType; private String iData; @@ -96,12 +95,12 @@ public void testChild(String pNodeNameEnum) throws SAXException { */ @Override public void childParsed(Node pChild) { - // no child + // no child } @Override public void testCompletness() { - // no child nodes + // no child nodes } /** @@ -127,5 +126,4 @@ public Object getValue() { public CIMDataType getType() { return this.iType; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueNullNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueNullNode.java index 32f5069..3e1217b 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueNullNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueNullNode.java @@ -65,7 +65,7 @@ public ValueNullNode() { */ @Override public void init(Attributes pAttribs, SAXSession pSession) { - // no attributes + // no attributes } /** @@ -73,7 +73,7 @@ public void init(Attributes pAttribs, SAXSession pSession) { */ @Override public void parseData(String pData) { - // no data + // no data } /** @@ -89,12 +89,12 @@ public void testChild(String pNodeNameEnum) throws SAXException { */ @Override public void childParsed(Node pChild) { - // no child + // no child } @Override public void testCompletness() { - // nothing to test + // nothing to test } /** @@ -109,5 +109,4 @@ public CIMDataType getType() { // type is unknown return null; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueObjectNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueObjectNode.java index 7f820eb..28412ec 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueObjectNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueObjectNode.java @@ -48,8 +48,8 @@ import org.metricshub.wbem.javax.cim.CIMClass; import org.metricshub.wbem.javax.cim.CIMDataType; -import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; import org.metricshub.wbem.javax.cim.CIMNamedElementInterface; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; import org.xml.sax.Attributes; import org.xml.sax.SAXException; @@ -57,7 +57,6 @@ * ELEMENT VALUE.OBJECT (CLASS | INSTANCE) */ public class ValueObjectNode extends AbstractScalarValueNode { - private CIMNamedElementInterface iCIMObject; /** @@ -82,30 +81,29 @@ public void init(Attributes pAttribs, SAXSession pSession) { */ @Override public void parseData(String pData) { - // no data + // no data } @Override public void testChild(String pNodeNameEnum) throws SAXException { - if (this.iCIMObject != null) throw new SAXException("This " + getNodeName() - + " node can have only one child but an additional " + pNodeNameEnum - + " node found!"); + if (this.iCIMObject != null) throw new SAXException( + "This " + getNodeName() + " node can have only one child but an additional " + pNodeNameEnum + " node found!" + ); if (pNodeNameEnum != CLASS && pNodeNameEnum != INSTANCE) throw new SAXException( - getNodeName() + " node child node can be CLASS or INSTANCE but a " + pNodeNameEnum - + " node was found!"); + getNodeName() + " node child node can be CLASS or INSTANCE but a " + pNodeNameEnum + " node was found!" + ); } @Override public void childParsed(Node pChild) { AbstractObjectNode objNode = (AbstractObjectNode) pChild; - if (objNode instanceof ClassNode) this.iCIMObject = ((ClassNode) objNode).getCIMClass(); - else this.iCIMObject = ((InstanceNode) objNode).getCIMInstance(); + if (objNode instanceof ClassNode) this.iCIMObject = ((ClassNode) objNode).getCIMClass(); else this.iCIMObject = + ((InstanceNode) objNode).getCIMInstance(); } @Override public void testCompletness() throws SAXException { - if (this.iCIMObject == null) throw new SAXException( - "VALUE.OBJECT node must have a CLASS or INSTANCE child node!"); + if (this.iCIMObject == null) throw new SAXException("VALUE.OBJECT node must have a CLASS or INSTANCE child node!"); } /** @@ -120,5 +118,4 @@ public CIMDataType getType() { if (this.iCIMObject instanceof CIMClass) return CIMDataType.CLASS_T; return CIMDataType.OBJECT_T; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueObjectWithLocalPathNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueObjectWithLocalPathNode.java index 91f5ff0..ec9fc4c 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueObjectWithLocalPathNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueObjectWithLocalPathNode.java @@ -46,9 +46,9 @@ import org.metricshub.wbem.javax.cim.CIMClass; import org.metricshub.wbem.javax.cim.CIMDataType; +import org.metricshub.wbem.javax.cim.CIMNamedElementInterface; import org.metricshub.wbem.javax.cim.CIMObjectPath; import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.metricshub.wbem.javax.cim.CIMNamedElementInterface; import org.xml.sax.Attributes; import org.xml.sax.SAXException; @@ -57,7 +57,6 @@ * (LOCALINSTANCEPATH, INSTANCE)) */ public class ValueObjectWithLocalPathNode extends AbstractScalarValueNode { - // ObjectPath element private String iPathNodeNameEnum; @@ -92,29 +91,24 @@ public void init(Attributes pAttribs, SAXSession pSession) { */ @Override public void parseData(String pData) { - // no data + // no data } @Override public void testChild(String pNodeNameEnum) throws SAXException { if (pNodeNameEnum == LOCALCLASSPATH) { - if (this.iPathNodeNameEnum != null) duplicatedNode(this.iPathNodeNameEnum, - LOCALCLASSPATH); + if (this.iPathNodeNameEnum != null) duplicatedNode(this.iPathNodeNameEnum, LOCALCLASSPATH); if (this.iObjNodeNameEnum == INSTANCE) illegalChildNodePair(LOCALCLASSPATH, INSTANCE); } else if (pNodeNameEnum == CLASS) { if (this.iObjNodeNameEnum != null) duplicatedNode(this.iObjNodeNameEnum, CLASS); - if (this.iPathNodeNameEnum == LOCALINSTANCEPATH) illegalChildNodePair( - LOCALINSTANCEPATH, CLASS); + if (this.iPathNodeNameEnum == LOCALINSTANCEPATH) illegalChildNodePair(LOCALINSTANCEPATH, CLASS); } else if (pNodeNameEnum == LOCALINSTANCEPATH) { - if (this.iPathNodeNameEnum != null) duplicatedNode(this.iPathNodeNameEnum, - LOCALINSTANCEPATH); + if (this.iPathNodeNameEnum != null) duplicatedNode(this.iPathNodeNameEnum, LOCALINSTANCEPATH); if (this.iObjNodeNameEnum == CLASS) illegalChildNodePair(LOCALINSTANCEPATH, CLASS); } else if (pNodeNameEnum == INSTANCE) { if (this.iObjNodeNameEnum != null) duplicatedNode(this.iObjNodeNameEnum, INSTANCE); - if (this.iPathNodeNameEnum == LOCALCLASSPATH) illegalChildNodePair(LOCALCLASSPATH, - INSTANCE); - } else throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum - + " child!"); + if (this.iPathNodeNameEnum == LOCALCLASSPATH) illegalChildNodePair(LOCALCLASSPATH, INSTANCE); + } else throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum + " child!"); } @Override @@ -125,8 +119,9 @@ public void childParsed(Node pChild) throws SAXException { } else { // ClassNode or InstanceNode, iObjPath must be available // here this.iObjNodeNameEnum = pChild.getNodeName(); - if (this.iPathNodeNameEnum == null) throw new SAXException(getNodeName() - + " first child should contain an object path!"); + if (this.iPathNodeNameEnum == null) throw new SAXException( + getNodeName() + " first child should contain an object path!" + ); if (pChild instanceof ClassNode) { this.iCIMObj = ((ClassNode) pChild).getCIMClass(this.iObjPath); } else { @@ -137,10 +132,12 @@ public void childParsed(Node pChild) throws SAXException { @Override public void testCompletness() throws SAXException { - if (this.iPathNodeNameEnum == null) throw new SAXException(getNodeName() - + " node must have a LOCALCLASSPATH or a LOCALINSTANCEPATH child node!"); - if (this.iObjNodeNameEnum == null) throw new SAXException(getNodeName() - + " node must have a CLASS or INSTANCE child node!"); + if (this.iPathNodeNameEnum == null) throw new SAXException( + getNodeName() + " node must have a LOCALCLASSPATH or a LOCALINSTANCEPATH child node!" + ); + if (this.iObjNodeNameEnum == null) throw new SAXException( + getNodeName() + " node must have a CLASS or INSTANCE child node!" + ); } /** @@ -155,5 +152,4 @@ public CIMDataType getType() { if (this.iCIMObj instanceof CIMClass) return CIMDataType.CLASS_T; return CIMDataType.OBJECT_T; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueObjectWithPathNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueObjectWithPathNode.java index 4f876fd..48fdfe6 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueObjectWithPathNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueObjectWithPathNode.java @@ -46,9 +46,9 @@ import org.metricshub.wbem.javax.cim.CIMClass; import org.metricshub.wbem.javax.cim.CIMDataType; +import org.metricshub.wbem.javax.cim.CIMNamedElementInterface; import org.metricshub.wbem.javax.cim.CIMObjectPath; import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; -import org.metricshub.wbem.javax.cim.CIMNamedElementInterface; import org.xml.sax.Attributes; import org.xml.sax.SAXException; @@ -56,7 +56,6 @@ * ELEMENT VALUE.OBJECTWITHPATH ((CLASSPATH, CLASS) | (INSTANCEPATH, INSTANCE)) */ public class ValueObjectWithPathNode extends AbstractScalarValueNode { - // ObjectPath element private String iPathNodeNameEnum; @@ -91,7 +90,7 @@ public void init(Attributes pAttribs, SAXSession pSession) { */ @Override public void parseData(String pData) { - // no data + // no data } @Override @@ -108,9 +107,7 @@ public void testChild(String pNodeNameEnum) throws SAXException { } else if (pNodeNameEnum == INSTANCE) { if (this.iObjNodeNameEnum != null) duplicatedNode(this.iObjNodeNameEnum, INSTANCE); if (this.iPathNodeNameEnum == CLASSPATH) illegalChildNodePair(CLASSPATH, INSTANCE); - } else throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum - + " child!"); - + } else throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum + " child!"); } @Override @@ -121,8 +118,9 @@ public void childParsed(Node pChild) throws SAXException { } else { // ClassNode or InstanceNode, iObjPath must be available // here this.iObjNodeNameEnum = pChild.getNodeName(); - if (this.iPathNodeNameEnum == null) throw new SAXException(getNodeName() - + " first child should contain an object path!"); + if (this.iPathNodeNameEnum == null) throw new SAXException( + getNodeName() + " first child should contain an object path!" + ); if (pChild instanceof ClassNode) { this.iCIMObj = ((ClassNode) pChild).getCIMClass(this.iObjPath); } else { @@ -133,10 +131,12 @@ public void childParsed(Node pChild) throws SAXException { @Override public void testCompletness() throws SAXException { - if (this.iPathNodeNameEnum == null) throw new SAXException(getNodeName() - + " node must have a CLASSPATH or a INSTANCEPATH child node!"); - if (this.iObjNodeNameEnum == null) throw new SAXException(getNodeName() - + " node must have a CLASS or INSTANCE child node!"); + if (this.iPathNodeNameEnum == null) throw new SAXException( + getNodeName() + " node must have a CLASSPATH or a INSTANCEPATH child node!" + ); + if (this.iObjNodeNameEnum == null) throw new SAXException( + getNodeName() + " node must have a CLASS or INSTANCE child node!" + ); } /** @@ -151,5 +151,4 @@ public CIMDataType getType() { if (this.iCIMObj instanceof CIMClass) return CIMDataType.CLASS_T; return CIMDataType.OBJECT_T; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueRefArrayNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueRefArrayNode.java index 2601e9c..509f9e7 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueRefArrayNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueRefArrayNode.java @@ -50,7 +50,6 @@ */ import java.util.ArrayList; - import org.metricshub.wbem.javax.cim.CIMDataType; import org.metricshub.wbem.javax.cim.CIMObjectPath; import org.metricshub.wbem.sblim.cimclient.GenericExts; @@ -62,7 +61,6 @@ * ELEMENT VALUE.REFARRAY (VALUE.REFERENCE|VALUE.NULL)* */ public class ValueRefArrayNode extends AbstractArrayValueNode { - private ArrayList iCIMObjPathAL; /** @@ -87,28 +85,27 @@ public void init(Attributes pAttribs, SAXSession pSession) { */ @Override public void parseData(String pData) { - // no data + // no data } @Override public void testChild(String pNodeNameEnum) throws SAXException { if (pNodeNameEnum != VALUE_REFERENCE && pNodeNameEnum != VALUE_NULL) throw new SAXException( - getNodeName() - + " node child node can be VALUE.REFERENCE or VALUE.NULL only while it is " - + pNodeNameEnum + "!"); + getNodeName() + " node child node can be VALUE.REFERENCE or VALUE.NULL only while it is " + pNodeNameEnum + "!" + ); } @Override public void childParsed(Node pChild) { if (this.iCIMObjPathAL == null) this.iCIMObjPathAL = new ArrayList(); - if (pChild instanceof ValueReferenceNode) this.iCIMObjPathAL - .add(((ValueReferenceNode) pChild).getCIMObjectPath()); - else if (pChild instanceof ValueNullNode) this.iCIMObjPathAL.add(null); + if (pChild instanceof ValueReferenceNode) this.iCIMObjPathAL.add( + ((ValueReferenceNode) pChild).getCIMObjectPath() + ); else if (pChild instanceof ValueNullNode) this.iCIMObjPathAL.add(null); } @Override public void testCompletness() { - // child nodes are not mandatory + // child nodes are not mandatory } /** @@ -136,5 +133,4 @@ public CIMDataType getType() { public Object getValue() { return size() == 0 ? null : this.iCIMObjPathAL.toArray(EMPTY_OPA); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueReferenceNode.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueReferenceNode.java index 05c1f65..139ba0f 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueReferenceNode.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/cimxml/sax/node/ValueReferenceNode.java @@ -57,7 +57,6 @@ * INSTANCEPATH | LOCALINSTANCEPATH | INSTANCENAME) */ public class ValueReferenceNode extends AbstractScalarValueNode implements ObjectPathIf { - private CIMObjectPath iCIMObjPath; private String iChildNodeName = null; @@ -72,14 +71,22 @@ public ValueReferenceNode() { @Override public void childParsed(Node pChild) { this.iCIMObjPath = ((AbstractPathNode) pChild).getCIMObjectPath(); - if ((CLASSNAME.equalsIgnoreCase(this.iChildNodeName) || INSTANCENAME - .equalsIgnoreCase(this.iChildNodeName)) - && this.iCIMObjPath.getNamespace() != null) { + if ( + (CLASSNAME.equalsIgnoreCase(this.iChildNodeName) || INSTANCENAME.equalsIgnoreCase(this.iChildNodeName)) && + this.iCIMObjPath.getNamespace() != null + ) { // LocalPathBuilder includes default namespace in CLASSNAME and // INSTANCENAME elements, needs to be stripped - this.iCIMObjPath = new CIMObjectPath(this.iCIMObjPath.getScheme(), this.iCIMObjPath - .getHost(), this.iCIMObjPath.getPort(), null, this.iCIMObjPath.getObjectName(), - this.iCIMObjPath.getKeys(), this.iCIMObjPath.getXmlSchemaName()); + this.iCIMObjPath = + new CIMObjectPath( + this.iCIMObjPath.getScheme(), + this.iCIMObjPath.getHost(), + this.iCIMObjPath.getPort(), + null, + this.iCIMObjPath.getObjectName(), + this.iCIMObjPath.getKeys(), + this.iCIMObjPath.getXmlSchemaName() + ); } } @@ -99,30 +106,40 @@ public void init(Attributes pAttribs, SAXSession pSession) { */ @Override public void parseData(String pData) { - // there is no data + // there is no data } - private static final String[] ALLOWED_CHILDREN = { CLASSPATH, LOCALCLASSPATH, CLASSNAME, - INSTANCEPATH, LOCALINSTANCEPATH, INSTANCENAME }; + private static final String[] ALLOWED_CHILDREN = { + CLASSPATH, + LOCALCLASSPATH, + CLASSNAME, + INSTANCEPATH, + LOCALINSTANCEPATH, + INSTANCENAME + }; @Override public void testChild(String pNodeNameEnum) throws SAXException { - if (this.iCIMObjPath != null) throw new SAXException("Child node " + pNodeNameEnum - + " is illegal, since VALUE.REFERENCE already has a child!"); - for (int i = 0; i < ALLOWED_CHILDREN.length; i++) - if (ALLOWED_CHILDREN[i] == pNodeNameEnum) { - this.iChildNodeName = pNodeNameEnum; - return; - } - throw new SAXException("Invalid child node in " + getNodeName() + " node: " + pNodeNameEnum - + "! Valid nodes are CLASSPATH, LOCALCLASSPATH, CLASSNAME, " - + "INSTANCEPATH, LOCALINSTANCEPATH, INSTANCENAME"); + if (this.iCIMObjPath != null) throw new SAXException( + "Child node " + pNodeNameEnum + " is illegal, since VALUE.REFERENCE already has a child!" + ); + for (int i = 0; i < ALLOWED_CHILDREN.length; i++) if (ALLOWED_CHILDREN[i] == pNodeNameEnum) { + this.iChildNodeName = pNodeNameEnum; + return; + } + throw new SAXException( + "Invalid child node in " + + getNodeName() + + " node: " + + pNodeNameEnum + + "! Valid nodes are CLASSPATH, LOCALCLASSPATH, CLASSNAME, " + + "INSTANCEPATH, LOCALINSTANCEPATH, INSTANCENAME" + ); } @Override public void testCompletness() throws SAXException { - if (this.iCIMObjPath == null) throw new SAXException( - "VALUE.REFERENCE node must have a child node!"); + if (this.iCIMObjPath == null) throw new SAXException("VALUE.REFERENCE node must have a child node!"); } /** @@ -140,5 +157,4 @@ public CIMDataType getType() { public CIMObjectPath getCIMObjectPath() { return this.iCIMObjPath; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/discovery/slp/DiscovererSLP.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/discovery/slp/DiscovererSLP.java index 27c97b3..52a3a74 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/discovery/slp/DiscovererSLP.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/discovery/slp/DiscovererSLP.java @@ -53,7 +53,7 @@ import java.util.Locale; import java.util.Vector; import java.util.logging.Level; - +import org.metricshub.wbem.sblim.cimclient.discovery.Discoverer; import org.metricshub.wbem.sblim.cimclient.discovery.WBEMServiceAdvertisement; import org.metricshub.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; import org.metricshub.wbem.sblim.slp.Locator; @@ -62,16 +62,14 @@ import org.metricshub.wbem.sblim.slp.ServiceType; import org.metricshub.wbem.sblim.slp.ServiceURL; import org.metricshub.wbem.sblim.slp.internal.SLPDefaults; -import org.metricshub.wbem.sblim.cimclient.discovery.Discoverer; /** * Class DiscovererSLP is the SLP specific implementation of the Discoverer * interface. - * + * * @since 2.0.2 */ public class DiscovererSLP extends Object implements Discoverer { - private static final String SERVICE_WBEM = "service:wbem"; private static final ServiceType SERVICE_TYPE = new ServiceType(SERVICE_WBEM); @@ -84,7 +82,7 @@ public class DiscovererSLP extends Object implements Discoverer { /** * Ctor. - * + * * @param pLocale * The locale setting to use for the Locator */ @@ -96,7 +94,7 @@ public DiscovererSLP(Locale pLocale) { /** * Returns locale - * + * * @return The value of locale. */ public Locale getLocale() { @@ -105,7 +103,7 @@ public Locale getLocale() { /** * Sets locale - * + * * @param pLocale * The new value of locale. */ @@ -115,7 +113,7 @@ public void setLocale(Locale pLocale) { /** * Returns scopes - * + * * @return The value of scopes. */ public Vector getScopes() { @@ -124,7 +122,7 @@ public Vector getScopes() { /** * Sets scopes - * + * * @param pScopes * The new value of scopes. */ @@ -134,11 +132,10 @@ public void setScopes(Vector pScopes) { /* * (non-Javadoc) - * + * * @see org.sblim.cimclient.discovery.Discoverer#findWbemServices(String[]) */ public WBEMServiceAdvertisement[] findWbemServices(final String[] pDirectoryUrls) { - List advertisements = new ArrayList(); if (pDirectoryUrls != null && pDirectoryUrls.length > 0) { @@ -157,12 +154,13 @@ private List findWbemServices(final String pDA) { logger.entry(); logger.trace(Level.FINEST, "SLP discovery started on DA " + pDA); try { - Vector agents; if (pDA != null) { agents = new Vector(); InetAddress address = InetAddress.getByName(pDA); - if (address == null) { return new LinkedList(); } + if (address == null) { + return new LinkedList(); + } agents.add(address); } else { agents = null; @@ -171,8 +169,7 @@ private List findWbemServices(final String pDA) { final Locator locator = ServiceLocationManager.getLocator(this.iLocale); List advertisements = new ArrayList(); - Enumeration serviceEnum = locator.findServices(SERVICE_TYPE, this.iScopes, "", - agents); + Enumeration serviceEnum = locator.findServices(SERVICE_TYPE, this.iScopes, "", agents); while (serviceEnum != null && serviceEnum.hasMoreElements()) { ServiceURL url; @@ -182,8 +179,7 @@ private List findWbemServices(final String pDA) { logger.trace(Level.FINE, e.getMessage(), e); continue; } - Enumeration attributeEnum = locator.findAttributes(url, this.iScopes, - ATTRIBUTES, agents); + Enumeration attributeEnum = locator.findAttributes(url, this.iScopes, ATTRIBUTES, agents); List attributes = new ArrayList(); while (attributeEnum != null && attributeEnum.hasMoreElements()) { try { @@ -195,16 +191,16 @@ private List findWbemServices(final String pDA) { } advertisements.add(new WBEMServiceAdvertisementSLP(pDA, url, attributes)); } - logger.trace(Level.FINEST, "SLP discovery completed on DA " + pDA + ". " - + advertisements.size() + " WBEM services found"); + logger.trace( + Level.FINEST, + "SLP discovery completed on DA " + pDA + ". " + advertisements.size() + " WBEM services found" + ); logger.exit(); return advertisements; - } catch (ServiceLocationException e) { LogAndTraceBroker.getBroker().trace(Level.FINE, "SLP discovery failed with error", e); } catch (Exception e) { - LogAndTraceBroker.getBroker() - .trace(Level.FINE, "Exception during service discovery", e); + LogAndTraceBroker.getBroker().trace(Level.FINE, "Exception during service discovery", e); } logger.exit(); return new LinkedList(); @@ -218,16 +214,17 @@ public String[] findDirectoryServices() { final Locator locator = ServiceLocationManager.getLocator(this.iLocale); - Enumeration serviceEnum = locator.findServices(SLPDefaults.DA_SERVICE_TYPE, - this.iScopes, ""); + Enumeration serviceEnum = locator.findServices(SLPDefaults.DA_SERVICE_TYPE, this.iScopes, ""); while (serviceEnum != null && serviceEnum.hasMoreElements()) { ServiceURL url = (ServiceURL) serviceEnum.nextElement(); agents.add(url.getHost()); } - logger.trace(Level.FINER, "SLP DA discovery completed in local subnet. " - + agents.size() + " DAs found:" + agents.toString()); + logger.trace( + Level.FINER, + "SLP DA discovery completed in local subnet. " + agents.size() + " DAs found:" + agents.toString() + ); if (agents.size() == 0) { serviceEnum = locator.findServices(SLPDefaults.SA_SERVICE_TYPE, this.iScopes, ""); @@ -235,18 +232,18 @@ public String[] findDirectoryServices() { ServiceURL url = (ServiceURL) serviceEnum.nextElement(); agents.add(url.getHost()); } - logger.trace(Level.FINER, "SLP SA discovery completed in local subnet. " - + agents.size() + " SAs found:" + agents.toString()); + logger.trace( + Level.FINER, + "SLP SA discovery completed in local subnet. " + agents.size() + " SAs found:" + agents.toString() + ); } logger.exit(); return agents.toArray(new String[agents.size()]); - } catch (ServiceLocationException e) { LogAndTraceBroker.getBroker().trace(Level.FINE, "SLP discovery failed with error", e); } catch (Exception e) { - LogAndTraceBroker.getBroker() - .trace(Level.FINE, "Exception during service discovery", e); + LogAndTraceBroker.getBroker().trace(Level.FINE, "Exception during service discovery", e); } logger.exit(); return new String[0]; diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/discovery/slp/WBEMServiceAdvertisementSLP.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/discovery/slp/WBEMServiceAdvertisementSLP.java index 887a6bc..a7d3916 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/discovery/slp/WBEMServiceAdvertisementSLP.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/discovery/slp/WBEMServiceAdvertisementSLP.java @@ -46,14 +46,12 @@ import java.util.List; import java.util.Locale; import java.util.Map; -import java.util.Set; import java.util.Map.Entry; +import java.util.Set; import java.util.logging.Level; import java.util.regex.Matcher; import java.util.regex.Pattern; - import javax.security.auth.Subject; - import org.metricshub.wbem.javax.cim.CIMObjectPath; import org.metricshub.wbem.javax.wbem.client.WBEMClient; import org.metricshub.wbem.javax.wbem.client.WBEMClientFactory; @@ -64,12 +62,11 @@ /** * Class WBEMServiceAdvertisementSLP is the SLP specific implementation if the * WBEMServiceAdvertisement interface. - * - * + * + * * @since 2.0.2 */ public class WBEMServiceAdvertisementSLP implements WBEMServiceAdvertisement { - private static final Pattern ATTR_PATTERN = Pattern.compile("[(]?(.+)=([^)]+)[)]?"); private String iDA; @@ -82,7 +79,7 @@ public class WBEMServiceAdvertisementSLP implements WBEMServiceAdvertisement { /** * Ctor. - * + * * @param pDA * The Directory Agent from which this advertisement was received * @param pUrl @@ -93,12 +90,10 @@ public class WBEMServiceAdvertisementSLP implements WBEMServiceAdvertisement { * (key=value). */ public WBEMServiceAdvertisementSLP(String pDA, ServiceURL pUrl, List pAttributes) { - if (pDA == null || pUrl == null) throw new IllegalArgumentException( - "Directory and URL must not be null"); + if (pDA == null || pUrl == null) throw new IllegalArgumentException("Directory and URL must not be null"); this.iDA = pDA; this.iServiceUrl = pUrl; parseAttributes(pAttributes); - } private void parseAttributes(List pAttributes) { @@ -112,15 +107,14 @@ private void parseAttributes(List pAttributes) { String value = matcher.group(2).trim(); this.iAttributeMap.put(key, value); } else { - LogAndTraceBroker.getBroker().trace(Level.FINE, - "SLP discovery returned invalid attribute: " + attribute); + LogAndTraceBroker.getBroker().trace(Level.FINE, "SLP discovery returned invalid attribute: " + attribute); } } } /* * (non-Javadoc) - * + * * @see * org.sblim.cimclient.discovery.WbemService#getAttribute(java.lang.String) */ @@ -130,7 +124,7 @@ public String getAttribute(String pAttributeName) { /* * (non-Javadoc) - * + * * @see org.sblim.cimclient.discovery.WbemService#getAttributes() */ public Set> getAttributes() { @@ -139,7 +133,7 @@ public Set> getAttributes() { /* * (non-Javadoc) - * + * * @see org.sblim.cimclient.discovery.WbemService#getConcreteServiceType() */ public String getConcreteServiceType() { @@ -148,17 +142,18 @@ public String getConcreteServiceType() { /* * (non-Javadoc) - * + * * @see org.sblim.cimclient.discovery.WbemService#getServiceUrl() */ public String getServiceUrl() { - return getConcreteServiceType() + "://" + this.iServiceUrl.getHost() + ":" - + String.valueOf(this.iServiceUrl.getPort()); + return ( + getConcreteServiceType() + "://" + this.iServiceUrl.getHost() + ":" + String.valueOf(this.iServiceUrl.getPort()) + ); } /* * (non-Javadoc) - * + * * @see * org.sblim.cimclient.discovery.WBEMServiceAdvertisement#createClient(javax * .security.auth.Subject, java.util.Locale[]) @@ -169,9 +164,14 @@ public WBEMClient createClient(Subject pSubject, Locale[] pLocales) throws Excep communication = getAttribute(OTHER_COMM_MECHN_DESC); } WBEMClient client = WBEMClientFactory.getClient(communication); - CIMObjectPath path = new CIMObjectPath(this.iServiceUrl.getServiceType() - .getConcreteTypeName(), this.iServiceUrl.getHost(), String.valueOf(this.iServiceUrl - .getPort()), null, null, null); + CIMObjectPath path = new CIMObjectPath( + this.iServiceUrl.getServiceType().getConcreteTypeName(), + this.iServiceUrl.getHost(), + String.valueOf(this.iServiceUrl.getPort()), + null, + null, + null + ); client.initialize(path, pSubject, pLocales); return client; } @@ -182,7 +182,7 @@ public String getDirectory() { /* * (non-Javadoc) - * + * * @see java.lang.Object#toString() */ @Override @@ -237,7 +237,7 @@ private String[] parseCommaSeparatedList(String pAttribute) { /* * (non-Javadoc) - * + * * @see * org.sblim.cimclient.discovery.WBEMServiceAdvertisement#getServiceId() */ @@ -247,7 +247,7 @@ public String getServiceId() { /* * (non-Javadoc) - * + * * @see org.sblim.cimclient.discovery.WBEMServiceAdvertisement#isExpired() */ public boolean isExpired() { @@ -256,7 +256,7 @@ public boolean isExpired() { /* * (non-Javadoc) - * + * * @see * org.sblim.cimclient.discovery.WBEMServiceAdvertisement#setExpired(boolean * ) @@ -267,23 +267,24 @@ public void setExpired(boolean pExpired) { /* * (non-Javadoc) - * + * * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object pObj) { - if (pObj == this) { return true; } + if (pObj == this) { + return true; + } if (pObj != null && pObj instanceof WBEMServiceAdvertisement) { WBEMServiceAdvertisement that = (WBEMServiceAdvertisement) pObj; - return getServiceUrl().equals(that.getServiceUrl()) - && getDirectory().equals(that.getDirectory()); + return getServiceUrl().equals(that.getServiceUrl()) && getDirectory().equals(that.getDirectory()); } return false; } /* * (non-Javadoc) - * + * * @see java.lang.Object#hashCode() */ @Override diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/AuthorizationHandler.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/AuthorizationHandler.java index 884ab88..50a417c 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/AuthorizationHandler.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/AuthorizationHandler.java @@ -50,15 +50,14 @@ /** * Class AuthorizationHandler manages AdAuthorizationInfo instances - * + * */ public class AuthorizationHandler { - private ArrayList iAuthList = new ArrayList(); /** * Adds an AuthorizationInfo to the handler - * + * * @param pAuthorizationInfo * The AuthorizationInfo to add */ @@ -68,7 +67,7 @@ public synchronized void addAuthorizationInfo(AuthorizationInfo pAuthorizationIn /** * Returns the corresponding AuthorizationInfo for a given set of parameters - * + * * @param pAuthorizationModule * The authorization module * @param pProxy @@ -85,25 +84,37 @@ public synchronized void addAuthorizationInfo(AuthorizationInfo pAuthorizationIn * Scheme * @return The AuthorizationInfo or null if none fits */ - public synchronized AuthorizationInfo getAuthorizationInfo(String pAuthorizationModule, - Boolean pProxy, String pAddr, int pPort, String pProtocol, String pRealm, String pScheme) { - - AuthorizationInfo request = AuthorizationInfo.createAuthorizationInfo(pAuthorizationModule, - pProxy, pAddr, pPort, pProtocol, pRealm, pScheme); + public synchronized AuthorizationInfo getAuthorizationInfo( + String pAuthorizationModule, + Boolean pProxy, + String pAddr, + int pPort, + String pProtocol, + String pRealm, + String pScheme + ) { + AuthorizationInfo request = AuthorizationInfo.createAuthorizationInfo( + pAuthorizationModule, + pProxy, + pAddr, + pPort, + pProtocol, + pRealm, + pScheme + ); Iterator iter = this.iAuthList.iterator(); while (iter.hasNext()) { AuthorizationInfo authInfo = iter.next(); if (authInfo.match(request)) return authInfo; - } return null; } /** * Returns the AuthorizationInfo at a given index - * + * * @param pIndex * The index * @return The AuthorizationInfo diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/AuthorizationInfo.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/AuthorizationInfo.java index 3a9691c..eb4fdb0 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/AuthorizationInfo.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/AuthorizationInfo.java @@ -50,19 +50,17 @@ import java.net.URI; import java.security.NoSuchAlgorithmException; import java.util.logging.Level; - import org.metricshub.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; import org.metricshub.wbem.sblim.cimclient.internal.logging.Messages; import org.metricshub.wbem.sblim.cimclient.internal.util.WBEMConfiguration; /** * Abstract superclass for HTTP authorization information. - * + * * @see WwwAuthInfo * @see PegasusLocalAuthInfo */ public abstract class AuthorizationInfo { - protected String iAddr; protected int iPort; @@ -97,7 +95,7 @@ public abstract class AuthorizationInfo { /** * Initialize - * + * * @param pProxy * Proxy authentication ? * @param pAddress @@ -111,8 +109,7 @@ public abstract class AuthorizationInfo { * @param pScheme * Scheme */ - public void init(Boolean pProxy, String pAddress, int pPort, String pProtocol, String pRealm, - String pScheme) { + public void init(Boolean pProxy, String pAddress, int pPort, String pProtocol, String pRealm, String pScheme) { this.iAddr = pAddress; this.iPort = pPort; this.iProtocol = pProtocol; @@ -122,7 +119,7 @@ public void init(Boolean pProxy, String pAddress, int pPort, String pProtocol, S /** * Sets opaque - * + * * @param opaque * new Value */ @@ -132,7 +129,7 @@ public void setOpaque(String opaque) { /** * Returns opaque - * + * * @return Opaque */ public String getOpaque() { @@ -141,7 +138,7 @@ public String getOpaque() { /** * Returns Qop - * + * * @return Qop */ public String getQop() { @@ -150,7 +147,7 @@ public String getQop() { /** * Sets Qop - * + * * @param qop * New value */ @@ -160,7 +157,7 @@ public void setQop(String qop) { /** * Returns nc - * + * * @return nc */ public long getNc() { @@ -169,7 +166,7 @@ public long getNc() { /** * Sets nc - * + * * @param nc * New value */ @@ -179,7 +176,7 @@ public void setNc(long nc) { /** * Sets nonce - * + * * @param nonce * New Value */ @@ -189,7 +186,7 @@ public void setNonce(String nonce) { /** * Returns nonce - * + * * @return nonce */ public String getNonce() { @@ -198,7 +195,7 @@ public String getNonce() { /** * Set cnonce - * + * * @param cnonce * New value */ @@ -208,7 +205,7 @@ public void setCnonce(String cnonce) { /** * Returns cnonce - * + * * @return cnonce */ public String getCnonce() { @@ -217,7 +214,7 @@ public String getCnonce() { /** * Set algorithm - * + * * @param algorithm * New value */ @@ -227,7 +224,7 @@ public void setAlgorithm(String algorithm) { /** * Returns algorithm - * + * * @return algorithm */ public String getAlgorithm() { @@ -236,7 +233,7 @@ public String getAlgorithm() { /** * Returns A1 - * + * * @return A1 */ public String getA1() { @@ -245,7 +242,7 @@ public String getA1() { /** * Sets A1 - * + * * @param A1 * New value */ @@ -255,7 +252,7 @@ public void setA1(String A1) { /** * Sets response - * + * * @param response * New value */ @@ -265,7 +262,7 @@ public void setResponse(String response) { /** * Returns response - * + * * @return New value */ public String getResponse() { @@ -274,7 +271,7 @@ public String getResponse() { /** * Returns URI - * + * * @return URI */ public String getURI() { @@ -283,7 +280,7 @@ public String getURI() { /** * Sets URI - * + * * @param uri * New value */ @@ -293,7 +290,7 @@ public void setURI(String uri) { /** * Sets credentials - * + * * @param credentials * New value */ @@ -303,7 +300,7 @@ public void setCredentials(PasswordAuthentication credentials) { /** * Returns the address - * + * * @return The server address */ public String getAddr() { @@ -312,7 +309,7 @@ public String getAddr() { /** * Returns the port - * + * * @return The server port */ public int getPort() { @@ -321,7 +318,7 @@ public int getPort() { /** * Returns the protocol - * + * * @return The protocol */ public String getProtocol() { @@ -330,7 +327,7 @@ public String getProtocol() { /** * Returns the realm - * + * * @return The realm */ public String getRealm() { @@ -339,7 +336,7 @@ public String getRealm() { /** * Sets the realm - * + * * @param realm * New value */ @@ -349,7 +346,7 @@ public void setRealm(String realm) { /** * Returns the scheme - * + * * @return The scheme */ public String getScheme() { @@ -358,7 +355,7 @@ public String getScheme() { /** * Sets the scheme - * + * * @param scheme * New value */ @@ -368,7 +365,7 @@ public void setScheme(String scheme) { /** * Returns the credentials - * + * * @return The credentials */ public PasswordAuthentication getCredentials() { @@ -377,7 +374,7 @@ public PasswordAuthentication getCredentials() { /** * Compares two authorization informations. - * + * * @param obj * The other authorization information * @return true if type, realm, scheme, address, protocol and @@ -391,21 +388,17 @@ public boolean match(Object obj) { boolean type = getClass().equals(that.getClass()); // boolean prxt = (iProxy == null || that.iProxy == null)? // true:iProxy.equals(that.iProxy); - boolean prmpt = (this.iRealm == null || that.iRealm == null) ? true : this.iRealm - .equals(that.iRealm); - boolean schm = (this.iScheme == null || that.iScheme == null) ? true : this.iScheme - .equals(that.iScheme); - boolean adr = (this.iAddr == null || that.iAddr == null) ? true : this.iAddr - .equals(that.iAddr); - boolean prot = (this.iProtocol == null || that.iProtocol == null) ? true : this.iProtocol - .equals(that.iProtocol); + boolean prmpt = (this.iRealm == null || that.iRealm == null) ? true : this.iRealm.equals(that.iRealm); + boolean schm = (this.iScheme == null || that.iScheme == null) ? true : this.iScheme.equals(that.iScheme); + boolean adr = (this.iAddr == null || that.iAddr == null) ? true : this.iAddr.equals(that.iAddr); + boolean prot = (this.iProtocol == null || that.iProtocol == null) ? true : this.iProtocol.equals(that.iProtocol); boolean prt = (this.iPort <= 0 || that.iPort <= 0) ? true : (this.iPort == that.iPort); return (type && prmpt && schm && adr && prot && prt); } /** * Updates the authorization information according to a received challenge. - * + * * @param challenge * The received challenge * @param authenticate @@ -416,12 +409,17 @@ public boolean match(Object obj) { * The HTTP request method (POST or MPOST) * @throws NoSuchAlgorithmException */ - public abstract void updateAuthenticationInfo(Challenge challenge, String authenticate, - URI url, String requestMethod) throws NoSuchAlgorithmException; + public abstract void updateAuthenticationInfo( + Challenge challenge, + String authenticate, + URI url, + String requestMethod + ) + throws NoSuchAlgorithmException; /* * (non-Javadoc) - * + * * @see java.lang.Object#toString() */ @Override @@ -429,7 +427,7 @@ public abstract void updateAuthenticationInfo(Challenge challenge, String authen /** * Gets the HTTP header field name for this authentication information - * + * * @return The field name */ public abstract String getHeaderFieldName(); @@ -437,7 +435,7 @@ public abstract void updateAuthenticationInfo(Challenge challenge, String authen /** * Determines if the authorization information is already sent on the very * first http request or after the "401 Unauthorized" response - * + * * @return true or false */ public abstract boolean isSentOnFirstRequest(); @@ -445,7 +443,7 @@ public abstract void updateAuthenticationInfo(Challenge challenge, String authen /** * Determines if the connection is kept alive after the "401 Unauthorized" * response - * + * * @return true or false */ public abstract boolean isKeptAlive(); @@ -453,7 +451,7 @@ public abstract void updateAuthenticationInfo(Challenge challenge, String authen /** * Factory method for AuthorizationInfo objects. Returns an instance of a * subclass according to the requested type. - * + * * @param pModule * The authorization info type to be constructed * @param pProxy @@ -473,9 +471,15 @@ public abstract void updateAuthenticationInfo(Challenge challenge, String authen * @see WwwAuthInfo * @see PegasusLocalAuthInfo */ - public static AuthorizationInfo createAuthorizationInfo(String pModule, Boolean pProxy, - String pAddress, int pPort, String pProtocol, String pRealm, String pScheme) { - + public static AuthorizationInfo createAuthorizationInfo( + String pModule, + Boolean pProxy, + String pAddress, + int pPort, + String pProtocol, + String pRealm, + String pScheme + ) { AuthorizationInfo info = createAuthorizationInfo(pModule); if (info != null) { @@ -483,29 +487,30 @@ public static AuthorizationInfo createAuthorizationInfo(String pModule, Boolean } return info; - } /** * Factory method for AuthorizationInfo objects. Returns an instance of a * subclass according to the requested type. - * + * * @param pModule * The authorization info type to be constructed * @return An instance of a AuthorizationInfo subclass or null */ public static AuthorizationInfo createAuthorizationInfo(String pModule) { - - if (WwwAuthInfo.class.getName().equals(pModule)) { return new WwwAuthInfo(); } - if (PegasusLocalAuthInfo.class.getName().equals(pModule)) { return new PegasusLocalAuthInfo(); } + if (WwwAuthInfo.class.getName().equals(pModule)) { + return new WwwAuthInfo(); + } + if (PegasusLocalAuthInfo.class.getName().equals(pModule)) { + return new PegasusLocalAuthInfo(); + } try { Class module = Class.forName(pModule); AuthorizationInfo info = (AuthorizationInfo) module.newInstance(); return info; } catch (Exception e) { - LogAndTraceBroker.getBroker().trace(Level.FINER, - "Exception while loading authentication module", e); + LogAndTraceBroker.getBroker().trace(Level.FINER, "Exception while loading authentication module", e); LogAndTraceBroker.getBroker().message(Messages.HTTP_AUTH_MODULE_INVALID, pModule); } return null; diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/BASE64Encoder.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/BASE64Encoder.java index d907f98..2bed79c 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/BASE64Encoder.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/BASE64Encoder.java @@ -47,22 +47,83 @@ /** * Class BASE64Encoder implements the BASE64 encoding algorithm - * + * */ public final class BASE64Encoder { - - private static byte BASE64_ALPHABET[] = { 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, - 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, 100, 101, 102, 103, - 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, - 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47 }; + private static byte BASE64_ALPHABET[] = { + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77, + 78, + 79, + 80, + 81, + 82, + 83, + 84, + 85, + 86, + 87, + 88, + 89, + 90, + 97, + 98, + 99, + 100, + 101, + 102, + 103, + 104, + 105, + 106, + 107, + 108, + 109, + 110, + 111, + 112, + 113, + 114, + 115, + 116, + 117, + 118, + 119, + 120, + 121, + 122, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 43, + 47 + }; private BASE64Encoder() { - // no instances + // no instances } /** * Encodes a given byte array - * + * * @param pPlain * The raw bytes * @return The encoded bytes @@ -137,5 +198,4 @@ public static String encode(byte[] pPlain) { } return res; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/Challenge.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/Challenge.java index e41d1b2..3d1df69 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/Challenge.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/Challenge.java @@ -48,21 +48,20 @@ /** * Class Challenge holds a http authentication challenge - * + * */ public class Challenge { - private String iScheme; private HttpHeader iParams; private Challenge() { - // hidden ctor + // hidden ctor } /** * Returns the parameters - * + * * @return The parameters */ public HttpHeader getParams() { @@ -71,7 +70,7 @@ public HttpHeader getParams() { /** * Returns the scheme - * + * * @return The scheme */ public String getScheme() { @@ -80,7 +79,7 @@ public String getScheme() { /** * Returns the realm - * + * * @return The realm */ public String getRealm() { @@ -90,13 +89,13 @@ public String getRealm() { /** * Parses the challenge as received from the host. RFC 2617 defines the * following syntax for a challenge: - * + * *
      -	 * challenge = auth-scheme 1*SP 1#auth-param 
      -	 * auth-scheme = token 
      +	 * challenge = auth-scheme 1*SP 1#auth-param
      +	 * auth-scheme = token
       	 * auth-param = token "=" ( token | quoted-string )
       	 * 
      - * + * * @param pLine * The challenge string * @return The parsed challenge @@ -104,8 +103,7 @@ public String getRealm() { * If the challenge string is ill-formed */ public static Challenge[] parseChallenge(String pLine) throws HttpParseException { - if (pLine == null || pLine.length() == 0) throw new IllegalArgumentException( - "Invalid challenge, empty"); + if (pLine == null || pLine.length() == 0) throw new IllegalArgumentException("Invalid challenge, empty"); pLine = pLine.trim(); if (pLine.length() == 0) throw new IllegalArgumentException("Invalid challenge, empty"); @@ -120,8 +118,7 @@ public static Challenge[] parseChallenge(String pLine) throws HttpParseException tokensBetweenCommas.add(removeWhitespace(pLine.substring(start, end))); start = end + 1; } - if (start < pLine.length()) tokensBetweenCommas.add(removeWhitespace(pLine - .substring(start))); + if (start < pLine.length()) tokensBetweenCommas.add(removeWhitespace(pLine.substring(start))); // Break up tokens into auth-scheme and auth-param Vector tokens = new Vector(); @@ -154,8 +151,7 @@ public static Challenge[] parseChallenge(String pLine) throws HttpParseException tokens.add(token.substring(start)); } } else { - throw new HttpParseException("Invalid challenge, too many tokens in " - + token); + throw new HttpParseException("Invalid challenge, too many tokens in " + token); } } } @@ -169,17 +165,14 @@ public static Challenge[] parseChallenge(String pLine) throws HttpParseException int equalSign = indexOfOutsideQuotedString(token, '=', 0); if (equalSign == 0) { - throw new HttpParseException( - "Invalid challenge, no token before equal sign in " + token); + throw new HttpParseException("Invalid challenge, no token before equal sign in " + token); } else if (equalSign > 0) { // param - if (challenge.iScheme == null) throw new HttpParseException( - "Invalid challenge, param without scheme"); + if (challenge.iScheme == null) throw new HttpParseException("Invalid challenge, param without scheme"); String name = token.substring(0, equalSign); String value = token.substring(equalSign + 1); if (value.length() == 0) { - throw new HttpParseException( - "Invalid challenge, no token after equal sign in " + token); + throw new HttpParseException("Invalid challenge, no token after equal sign in " + token); } else if (value.startsWith("\"") && value.endsWith("\"") && value.length() > 1) { challenge.iParams.addField(name, value.substring(1, value.length() - 1)); } else { @@ -208,7 +201,6 @@ public static Challenge[] parseChallenge(String pLine) throws HttpParseException } return challenges.toArray(new Challenge[challenges.size()]); - } /* @@ -223,20 +215,19 @@ private static String removeWhitespace(String str) throws HttpParseException { for (int inIdx = 0; inIdx < inBuf.length; inIdx++) { if (inQuotes || !Character.isSpaceChar(inBuf[inIdx])) { if (inBuf[inIdx] == '=' && outStr.length() == 0) throw new HttpParseException( - "Invalid challenge, no token before equal sign in " + str); + "Invalid challenge, no token before equal sign in " + str + ); outStr.append(inBuf[inIdx]); } else { // Whitespace not within quoted string int i = skipSpaces(inBuf, inIdx + 1); - if (i >= inBuf.length) throw new HttpParseException( - "Invalid challenge, no token after space in " + str); + if (i >= inBuf.length) throw new HttpParseException("Invalid challenge, no token after space in " + str); if (inBuf[i] == '=') { // auth-param, remove all whitespace up to next token i = skipSpaces(inBuf, i + 1); - if (i >= inBuf.length) throw new HttpParseException( - "Invalid challenge, no token after equal sign in " + str); + if (i >= inBuf.length) throw new HttpParseException("Invalid challenge, no token after equal sign in " + str); outStr.append('='); } else { // another token, combine all whitespace up to next token @@ -248,19 +239,16 @@ private static String removeWhitespace(String str) throws HttpParseException { } if (inBuf[inIdx] == '\"') inQuotes = !inQuotes; } - if (inQuotes) throw new HttpParseException( - "Invalid challenge, quoted string not terminated in " + str); + if (inQuotes) throw new HttpParseException("Invalid challenge, quoted string not terminated in " + str); return outStr.toString(); } private static int skipSpaces(char[] buf, int pos) { - while (pos < buf.length && Character.isSpaceChar(buf[pos])) - pos++; + while (pos < buf.length && Character.isSpaceChar(buf[pos])) pos++; return pos; } - private static int indexOfOutsideQuotedString(String str, int ch, int pos) - throws HttpParseException { + private static int indexOfOutsideQuotedString(String str, int ch, int pos) throws HttpParseException { int len = str.length(); boolean inQuotes = false; @@ -272,9 +260,7 @@ private static int indexOfOutsideQuotedString(String str, int ch, int pos) } pos++; } - if (inQuotes) throw new HttpParseException( - "Invalid callenge, quoted string not terminated in " + str); + if (inQuotes) throw new HttpParseException("Invalid callenge, quoted string not terminated in " + str); return -1; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpClient.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpClient.java index c324b87..a28b673 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpClient.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpClient.java @@ -115,19 +115,17 @@ import java.security.PrivilegedAction; import java.util.Arrays; import java.util.Iterator; +import java.util.Map.Entry; import java.util.StringTokenizer; import java.util.Vector; -import java.util.Map.Entry; import java.util.logging.Level; import java.util.zip.GZIPInputStream; - import javax.net.SocketFactory; import javax.net.ssl.HandshakeCompletedEvent; import javax.net.ssl.HandshakeCompletedListener; import javax.net.ssl.SSLSession; import javax.net.ssl.SSLSocket; import javax.net.ssl.SSLSocketFactory; - import org.metricshub.wbem.sblim.cimclient.WBEMConfigurationProperties; import org.metricshub.wbem.sblim.cimclient.internal.http.HttpHeader.HeaderEntry; import org.metricshub.wbem.sblim.cimclient.internal.http.io.ASCIIPrintStream; @@ -141,23 +139,21 @@ /** * Class HttpClient implements a HTTP client - * + * */ public class HttpClient implements HandshakeCompletedListener { private static class HostPortPair { - String iHost; /** * Ctor. - * + * * @param url * The url */ public HostPortPair(URI url) { - this.iHost = url.getScheme().toLowerCase() + ':' + url.getHost().toLowerCase() + ':' - + url.getPort(); + this.iHost = url.getScheme().toLowerCase() + ':' + url.getHost().toLowerCase() + ':' + url.getPort(); } @Override @@ -179,7 +175,6 @@ public String toString() { } private static class GetProperty implements PrivilegedAction { - String iPropertyName; GetProperty(String propertyName) { @@ -195,12 +190,15 @@ public Object run() { static { try { - iEncoding = (String) AccessController.doPrivileged(new PrivilegedAction() { + iEncoding = + (String) AccessController.doPrivileged( + new PrivilegedAction() { - public Object run() { - return System.getProperty("file.encoding", "ISO8859_1"); - } - }); + public Object run() { + return System.getProperty("file.encoding", "ISO8859_1"); + } + } + ); if (!isASCIISuperset(iEncoding)) iEncoding = "ISO8859_1"; } catch (Exception exception) { iEncoding = "ISO8859_1"; @@ -209,7 +207,7 @@ public Object run() { /** * Converts a byte array to a String of hex digits - * + * * @param digest * The byte array * @return The hex string @@ -228,7 +226,7 @@ public static String convertToHexString(byte[] digest) { /** * Returns a client from a http client pool - * + * * @param url * The url to connect to * @param clientPool @@ -237,21 +235,17 @@ public static String convertToHexString(byte[] digest) { * The authentication handler to use * @return A http client from the pool */ - public static HttpClient getClient(URI url, HttpClientPool clientPool, - AuthorizationHandler auth_handler) { - + public static HttpClient getClient(URI url, HttpClientPool clientPool, AuthorizationHandler auth_handler) { return clientPool.retrieveAvailableConnectionFromPool(url, auth_handler); } protected static String dequote(String str) { int len = str.length(); - if (len > 1 && str.charAt(0) == '\"' && str.charAt(len - 1) == '\"') return str.substring( - 1, len - 1); + if (len > 1 && str.charAt(0) == '\"' && str.charAt(len - 1) == '\"') return str.substring(1, len - 1); return str; } - protected static void handleRsp(String authInfo, AuthorizationInfo prevAuthInfo) - throws IOException { + protected static void handleRsp(String authInfo, AuthorizationInfo prevAuthInfo) throws IOException { if (authInfo != null) { HttpHeader params = HttpHeader.parse(authInfo); @@ -266,8 +260,7 @@ protected static void handleRsp(String authInfo, AuthorizationInfo prevAuthInfo) if (qop != null) { if (!"auth".equalsIgnoreCase(qop) && !"auth-int".equalsIgnoreCase(qop)) { // TODO - throw new IOException( - "Authentication Digest with integrity check not supported"); + throw new IOException("Authentication Digest with integrity check not supported"); } byte[] rspauth; String rspauthStr = dequote(params.getField("rspauth")); @@ -275,13 +268,16 @@ protected static void handleRsp(String authInfo, AuthorizationInfo prevAuthInfo) rspauth = parseHex(rspauthStr); String cnonce = dequote(params.getField("cnonce")); - if (cnonce != null && !cnonce.equals(prevAuthInfo.getCnonce())) { throw new IOException( - "Digest authentication: Invalid nonce counter"); } + if (cnonce != null && !cnonce.equals(prevAuthInfo.getCnonce())) { + throw new IOException("Digest authentication: Invalid nonce counter"); + } String ncStr = params.getField("nc"); if (ncStr != null) { try { long nc = Long.parseLong(ncStr, 16); - if (nc != prevAuthInfo.getNc()) { throw new IOException(); } + if (nc != prevAuthInfo.getNc()) { + throw new IOException(); + } } catch (Exception e) { throw new IOException("Digest authentication: Invalid nonce counter"); } @@ -312,17 +308,13 @@ protected static void handleRsp(String authInfo, AuthorizationInfo prevAuthInfo) HA2 = convertToHexString(md5.digest()); md5.reset(); - md5.update((HA1 + ":" + nonce + ":" + ncStr + ":" + cnonce + ":" + qop - + ":" + HA2).getBytes("UTF-8")); + md5.update((HA1 + ":" + nonce + ":" + ncStr + ":" + cnonce + ":" + qop + ":" + HA2).getBytes("UTF-8")); String hsh = convertToHexString(md5.digest()); byte[] hash = parseHex(hsh); - if (!Arrays.equals(hash, rspauth)) throw new IOException( - "Digest Authentication failed!"); - + if (!Arrays.equals(hash, rspauth)) throw new IOException("Digest Authentication failed!"); } catch (NoSuchAlgorithmException e1) { - throw new IOException( - "Unable to validate Authentication response: NoSuchAlgorithmException"); + throw new IOException("Unable to validate Authentication response: NoSuchAlgorithmException"); } } } else { @@ -343,11 +335,89 @@ protected static byte[] parseHex(String hex) { private static boolean isASCIISuperset(String charset) throws Exception { String asciiSuperSet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_.!~*'();/?:@&=+$,"; - byte abyte0[] = { 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, - 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, - 116, 117, 118, 119, 120, 121, 122, 45, 95, 46, 33, 126, 42, 39, 40, 41, 59, 47, 63, - 58, 64, 38, 61, 43, 36, 44 }; + byte abyte0[] = { + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77, + 78, + 79, + 80, + 81, + 82, + 83, + 84, + 85, + 86, + 87, + 88, + 89, + 90, + 97, + 98, + 99, + 100, + 101, + 102, + 103, + 104, + 105, + 106, + 107, + 108, + 109, + 110, + 111, + 112, + 113, + 114, + 115, + 116, + 117, + 118, + 119, + 120, + 121, + 122, + 45, + 95, + 46, + 33, + 126, + 42, + 39, + 40, + 41, + 59, + 47, + 63, + 58, + 64, + 38, + 61, + 43, + 36, + 44 + }; byte convertedArray[] = asciiSuperSet.getBytes(charset); return Arrays.equals(convertedArray, abyte0); } @@ -396,7 +466,7 @@ private static boolean isASCIISuperset(String charset) throws Exception { /** * Ctor. - * + * * @param url * The url to connect to * @param clientPool @@ -412,7 +482,7 @@ public HttpClient(URI url, HttpClientPool clientPool, AuthorizationHandler auth_ /** * Connects to the http server - * + * * @throws IOException */ public void connect() throws IOException { @@ -463,13 +533,12 @@ protected void finalize() throws Throwable { /** * Returns the http header field value for a given index - * + * * @param index * The index * @return The header field value */ public synchronized String getHeaderFieldValue(int index) { - if (index < 0) throw new IllegalArgumentException(); if (index == 0) return this.iResponse.toString(); @@ -483,7 +552,7 @@ public synchronized String getHeaderFieldValue(int index) { /** * Returns the http header field for a given name - * + * * @param name * The name * @return The header field @@ -494,7 +563,7 @@ public synchronized String getHeaderField(String name) { /** * Return the http header field name for a given index - * + * * @param index * The index * @return The name @@ -513,20 +582,19 @@ public synchronized String getHeaderFieldName(int index) { /** * Returns the input stream of this http connection - * + * * @return The input stream * @throws IOException */ public synchronized InputStream getInputStream() throws IOException { if (getResponseCode() < 500 && this.iResponse != null && this.iServerInput != null) return this.iServerInput; - throw new IOException("Failed to open an input stream from server: HTTPResponse " - + getResponseCode()); + throw new IOException("Failed to open an input stream from server: HTTPResponse " + getResponseCode()); } /** * Returns the output stream of this http connection - * + * * @return The output stream */ public synchronized OutputStream getOutputStream() { @@ -538,7 +606,7 @@ public synchronized OutputStream getOutputStream() { /** * Returns the request method - * + * * @return The request method */ public String getRequestMethod() { @@ -547,7 +615,7 @@ public String getRequestMethod() { /** * Returns the request property for a given key - * + * * @param key * The key * @return The property @@ -558,7 +626,7 @@ public String getRequestProperty(String key) { /** * Returns the response code - * + * * @return The response code * @throws IOException */ @@ -573,24 +641,23 @@ public synchronized int getResponseCode() throws IOException { int IoRetry = 1; int AuthentificationRetry = 1; do { - logger.trace(Level.FINER, "Attempting http request (retry counters:" + IoRetry - + "/" + AuthentificationRetry + ")"); + logger.trace( + Level.FINER, + "Attempting http request (retry counters:" + IoRetry + "/" + AuthentificationRetry + ")" + ); long RequestTime = System.currentTimeMillis(); if (this.iPreviousResponseTime != -1) { long time = RequestTime - this.iPreviousResponseTime; - long maxTime = this.iHttpClientPool.getConfigurationContext() - .getSocketIdleTimeout(); + long maxTime = this.iHttpClientPool.getConfigurationContext().getSocketIdleTimeout(); if (maxTime > 0 && time > maxTime) { - logger.trace(Level.FINER, "Closing socket after " + time - + "ms of idle time"); + logger.trace(Level.FINER, "Closing socket after " + time + "ms of idle time"); if (this.iSocket != null && !this.iSocket.isClosed()) { try { this.iSocket.close(); } catch (IOException e) { - logger.trace(Level.FINER, - "Exception caught while closing socket", e); + logger.trace(Level.FINER, "Exception caught while closing socket", e); } } this.iSocket = null; @@ -611,26 +678,34 @@ public synchronized int getResponseCode() throws IOException { String query = this.iUrl.getQuery(); if (query != null) file = file + '?' + query; - this.iMethod = new HttpClientMethod(this.iRequestMethod, this.iUrl - .getPath(), 1, this.iUseHttp11 ? 1 : 0); + this.iMethod = new HttpClientMethod(this.iRequestMethod, this.iUrl.getPath(), 1, this.iUseHttp11 ? 1 : 0); logger.trace(Level.FINER, "HTTP Operation= " + this.iMethod); this.iMethod.write(out); StringBuilder hostField = new StringBuilder(this.iUrl.getHost()); - if (this.iUrl.getPort() > 0 - && ((WBEMConstants.HTTPS.equalsIgnoreCase(this.iUrl.getScheme()) && this.iUrl - .getPort() != WBEMConstants.DEFAULT_WBEM_SECURE_PORT) || (WBEMConstants.HTTP - .equalsIgnoreCase(this.iUrl.getScheme()) && this.iUrl - .getPort() != WBEMConstants.DEFAULT_WBEM_PORT))) { + if ( + this.iUrl.getPort() > 0 && + ( + ( + WBEMConstants.HTTPS.equalsIgnoreCase(this.iUrl.getScheme()) && + this.iUrl.getPort() != WBEMConstants.DEFAULT_WBEM_SECURE_PORT + ) || + ( + WBEMConstants.HTTP.equalsIgnoreCase(this.iUrl.getScheme()) && + this.iUrl.getPort() != WBEMConstants.DEFAULT_WBEM_PORT + ) + ) + ) { hostField.append(':'); hostField.append(this.iUrl.getPort()); } this.iRequestHeaders.addField("Host", hostField.toString()); if (this.iServerOutput != null) this.iRequestHeaders.addField( - "Content-length", "" + this.iServerOutput.size()); - else this.iRequestHeaders.addField("Content-length", "0"); + "Content-length", + "" + this.iServerOutput.size() + ); else this.iRequestHeaders.addField("Content-length", "0"); if (this.iHttpClientPool.getConfigurationContext().isHttpChunked()) { this.iRequestHeaders.addField("TE", "trailers"); } @@ -641,53 +716,54 @@ public synchronized int getResponseCode() throws IOException { // And may cause issues with EMC's VAPP appliances // so we made the header available only when // new strict mode is disabled - logger.trace(Level.INFO, - "HTTP 1.1 protocol and 'Connection=Keep-alive' strict mode disabled, we add the header"); + logger.trace( + Level.INFO, + "HTTP 1.1 protocol and 'Connection=Keep-alive' strict mode disabled, we add the header" + ); iRequestHeaders.addField("Connection", "Keep-alive"); } if (this.iPrevAuthInfo == null) { AuthorizationInfo authInfo = this.iAuth_handler.getAuthorizationInfo(0); - String authenticate = this.iHttpClientPool.getConfigurationContext() - .getHttpWwwAuthenticateInfo(); + String authenticate = this.iHttpClientPool.getConfigurationContext().getHttpWwwAuthenticateInfo(); if (authInfo.isSentOnFirstRequest()) { - this.iRequestHeaders.addField(authInfo.getHeaderFieldName(), - authInfo.toString()); + this.iRequestHeaders.addField(authInfo.getHeaderFieldName(), authInfo.toString()); } else if (authenticate != null) { try { - this.iPrevAuthInfo = getAuthentication(false, - this.iPrevAuthInfo, authenticate); + this.iPrevAuthInfo = getAuthentication(false, this.iPrevAuthInfo, authenticate); if (this.iPrevAuthInfo != null) { - this.iRequestHeaders.addField(this.iPrevAuthInfo - .getHeaderFieldName(), this.iPrevAuthInfo - .toString()); + this.iRequestHeaders.addField( + this.iPrevAuthInfo.getHeaderFieldName(), + this.iPrevAuthInfo.toString() + ); } } catch (NoSuchAlgorithmException e) { logger.trace(Level.FINER, "Unable to find digest algorithm", e); } catch (IllegalArgumentException e) { - logger - .trace( - Level.FINER, - WBEMConfigurationProperties.HTTP_WWW_AUTHENTICATE_INFO - + " did not contain WWW-Authenticate information", - e); + logger.trace( + Level.FINER, + WBEMConfigurationProperties.HTTP_WWW_AUTHENTICATE_INFO + + " did not contain WWW-Authenticate information", + e + ); } catch (HttpParseException e) { - logger - .trace( - Level.FINER, - WBEMConfigurationProperties.HTTP_WWW_AUTHENTICATE_INFO - + " did not contain valid WWW-Authenticate information", - e); + logger.trace( + Level.FINER, + WBEMConfigurationProperties.HTTP_WWW_AUTHENTICATE_INFO + + " did not contain valid WWW-Authenticate information", + e + ); } } } else { - this.iRequestHeaders.addField(this.iPrevAuthInfo.getHeaderFieldName(), - this.iPrevAuthInfo.toString()); + this.iRequestHeaders.addField(this.iPrevAuthInfo.getHeaderFieldName(), this.iPrevAuthInfo.toString()); } if (this.iPrevProxy != null) this.iRequestHeaders.addField( - "Proxy-authorization", this.iPrevProxy.toString()); + "Proxy-authorization", + this.iPrevProxy.toString() + ); boolean isGzipped = false; if (this.iHttpClientPool.getConfigurationContext().isGzipEncodingEnabled()) { @@ -701,15 +777,12 @@ public synchronized int getResponseCode() throws IOException { if (out.checkError() != null) { delayedException = out.checkError(); - logger.trace(Level.FINER, - "Exception caught while writing to the http output stream.", - delayedException); + logger.trace(Level.FINER, "Exception caught while writing to the http output stream.", delayedException); if (this.iSocket != null && !this.iSocket.isClosed()) { try { this.iSocket.close(); } catch (IOException e) { - logger.trace(Level.FINER, - "Exception caught while closing socket", e); + logger.trace(Level.FINER, "Exception caught while closing socket", e); } } this.iSocket = null; @@ -732,7 +805,7 @@ public synchronized int getResponseCode() throws IOException { // if (k < 0) // break; // } - // + // // if (header[0] != 72 // HTTP1. // || header[1] != 84 // || header[2] != 84 @@ -746,7 +819,7 @@ public synchronized int getResponseCode() throws IOException { // server. Header does not match HTTP header: "+new // String(header)); // } - // + // // istream.reset(); this.iResponse = new HttpClientMethod(this.iIStream); @@ -754,14 +827,13 @@ public synchronized int getResponseCode() throws IOException { ResponseTime = System.currentTimeMillis(); this.iResponseHeaders = new HttpHeader(this.iIStream); - logger.trace(Level.FINER, "Response HTTP Headers= " - + this.iResponseHeaders.toString()); + logger.trace(Level.FINER, "Response HTTP Headers= " + this.iResponseHeaders.toString()); this.iKeepAlive = false; - if ("Keep-alive".equalsIgnoreCase(this.iResponseHeaders - .getField("Connection")) - || (this.iResponse.getMajorVersion() == 1 && this.iResponse - .getMinorVersion() == 1) - || this.iResponseHeaders.getField("Keep-alive") != null) { + if ( + "Keep-alive".equalsIgnoreCase(this.iResponseHeaders.getField("Connection")) || + (this.iResponse.getMajorVersion() == 1 && this.iResponse.getMinorVersion() == 1) || + this.iResponseHeaders.getField("Keep-alive") != null + ) { this.iKeepAlive = true; } @@ -772,42 +844,33 @@ public synchronized int getResponseCode() throws IOException { String contentLength = this.iResponseHeaders.getField("Content-length"); long length = -1; try { - if (contentLength != null && contentLength.length() > 0) length = Long - .parseLong(contentLength); + if (contentLength != null && contentLength.length() > 0) length = Long.parseLong(contentLength); } catch (Exception e) { - logger.trace(Level.FINER, - "Exception while parsing the content length of http response", - e); + logger.trace(Level.FINER, "Exception while parsing the content length of http response", e); } - this.iKeepAlive = (length >= 0 || this.iResponse.getStatus() == 304 || this.iResponse - .getStatus() == 204); + this.iKeepAlive = (length >= 0 || this.iResponse.getStatus() == 304 || this.iResponse.getStatus() == 204); if (isGzipped) { - String contentEncoding = this.iResponseHeaders - .getField("Content-Encoding"); - if (contentEncoding != null - && contentEncoding.toLowerCase().contains("gzip")) { + String contentEncoding = this.iResponseHeaders.getField("Content-Encoding"); + if (contentEncoding != null && contentEncoding.toLowerCase().contains("gzip")) { length = -1; // ignore Content-length this.iServerInput = new GZIPInputStream(this.iServerInput); } } - String transferEncoding = this.iResponseHeaders - .getField("Transfer-encoding"); + String transferEncoding = this.iResponseHeaders.getField("Transfer-encoding"); if (transferEncoding != null) { length = -1; // ignore Content-length if (transferEncoding.toLowerCase().endsWith("chunked")) { - this.iServerInput = new ChunkedInputStream(this.iServerInput, - this.iResponseHeaders.getField("Trailer"), "Response"); + this.iServerInput = + new ChunkedInputStream(this.iServerInput, this.iResponseHeaders.getField("Trailer"), "Response"); this.iKeepAlive = true; } } - if (length >= 0) this.iServerInput = new BoundedInputStream( - this.iServerInput, length); + if (length >= 0) this.iServerInput = new BoundedInputStream(this.iServerInput, length); - logger.trace(Level.FINER, "KeepAlive=" - + (this.iKeepAlive ? "true" : "false")); + logger.trace(Level.FINER, "KeepAlive=" + (this.iKeepAlive ? "true" : "false")); if (this.iKeepAlive) { this.iServerInput = new KeepAliveInputStream(this.iServerInput, this); @@ -815,11 +878,10 @@ public synchronized int getResponseCode() throws IOException { switch (this.iResponse.getStatus()) { case 100: { - continue; - } + continue; + } case HttpURLConnection.HTTP_OK: - String authInfo = this.iResponseHeaders - .getField("Authentication-Info"); + String authInfo = this.iResponseHeaders.getField("Authentication-Info"); handleRsp(authInfo, this.iPrevAuthInfo); authInfo = this.iResponseHeaders.getField("Authentication-Proxy"); @@ -829,40 +891,28 @@ public synchronized int getResponseCode() throws IOException { this.iPreviousResponseTime = ResponseTime; return HttpURLConnection.HTTP_OK; - case HttpURLConnection.HTTP_UNAUTHORIZED: --AuthentificationRetry; - String authenticate = this.iResponseHeaders - .getField("WWW-Authenticate"); + String authenticate = this.iResponseHeaders.getField("WWW-Authenticate"); try { - this.iPrevAuthInfo = getAuthentication(false, - this.iPrevAuthInfo, authenticate); + this.iPrevAuthInfo = getAuthentication(false, this.iPrevAuthInfo, authenticate); if (this.iPrevAuthInfo != null) { - this.iRequestHeaders.addField(this.iPrevAuthInfo - .getHeaderFieldName(), this.iPrevAuthInfo - .toString()); + this.iRequestHeaders.addField( + this.iPrevAuthInfo.getHeaderFieldName(), + this.iPrevAuthInfo.toString() + ); } } catch (NoSuchAlgorithmException e) { logger.trace(Level.FINER, "Unable to find digest algorithm", e); } catch (IllegalArgumentException e) { - logger - .trace( - Level.FINER, - "HTTP 401 response did not contain WWW-Authenticate information", - e); + logger.trace(Level.FINER, "HTTP 401 response did not contain WWW-Authenticate information", e); } catch (HttpParseException e) { - logger - .trace( - Level.FINER, - "HTTP 401 response did not contain valid WWW-Authenticate information", - e); + logger.trace(Level.FINER, "HTTP 401 response did not contain valid WWW-Authenticate information", e); } if (!authFailed) { authFailed = true; - logger - .trace(Level.FINER, - "Authorization failed, retrying with authorization info."); + logger.trace(Level.FINER, "Authorization failed, retrying with authorization info."); } if (this.iPrevAuthInfo != null && this.iPrevAuthInfo.isKeptAlive()) { this.iKeepAlive = true; @@ -882,23 +932,21 @@ public synchronized int getResponseCode() throws IOException { * requestHeaders.addField * ("Proxy-Authorization", * prevProxy.toString()); - * + * * while ((total = serverInput.available()) > 0) * { serverInput.skip(total); } break; */ break; default: int status = this.iResponse.getStatus(); - if (!this.iKeepAlive) closeConnection(); - else this.iServerInput.close(); + if (!this.iKeepAlive) closeConnection(); else this.iServerInput.close(); this.iPreviousResponseTime = ResponseTime; return status; } } catch (SocketTimeoutException e) { throw e; } catch (IOException e) { - logger.message(Messages.HTTP_CONNECTION_FAILED, new Object[] { this.iUrl, - e.getMessage() }); + logger.message(Messages.HTTP_CONNECTION_FAILED, new Object[] { this.iUrl, e.getMessage() }); StringBuilder msg = new StringBuilder("Http connection failed "); if (ResponseTime != -1) { msg.append("after"); @@ -918,8 +966,7 @@ public synchronized int getResponseCode() throws IOException { try { this.iSocket.close(); } catch (IOException e2) { - logger.trace(Level.FINER, "Exception caught while closing socket", - e2); + logger.trace(Level.FINER, "Exception caught while closing socket", e2); } } this.iSocket = null; @@ -927,7 +974,6 @@ public synchronized int getResponseCode() throws IOException { this.iResponse = null; --IoRetry; } - } while (AuthentificationRetry >= 0 && IoRetry >= 0); } @@ -936,8 +982,9 @@ public synchronized int getResponseCode() throws IOException { if (ResponseTime != -1) this.iPreviousResponseTime = ResponseTime; return this.iResponse.getStatus(); } - throw (IOException) (delayedException != null ? delayedException : new Exception( - "Unable to get response after maximum retries")); + throw (IOException) ( + delayedException != null ? delayedException : new Exception("Unable to get response after maximum retries") + ); } finally { logger.exit(); } @@ -945,7 +992,7 @@ public synchronized int getResponseCode() throws IOException { /** * Returns the response message - * + * * @return The response message */ public String getResponseMessage() { @@ -970,7 +1017,7 @@ public void reset() { /** * Sets the request method - * + * * @param method * The request method */ @@ -980,7 +1027,7 @@ public void setRequestMethod(String method) { /** * Sets the request property - * + * * @param key * The property name * @param value @@ -999,13 +1046,12 @@ public void streamFinished() { /** * Releases the client and returns it to the pool - * + * * @param keep * if true return to the pool, if false * drop. */ public void streamFinished(boolean keep) { - LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); logger.entry(); @@ -1023,7 +1069,7 @@ public void streamFinished(boolean keep) { /** * Enables/Disables use of http 1.1 - * + * * @param bool * if true http 1.1 is enabled. */ @@ -1033,7 +1079,7 @@ public void useHttp11(boolean bool) { /** * Returns if a proxy is used - * + * * @return true if a proxy is used */ public boolean usingProxy() { @@ -1041,8 +1087,8 @@ public boolean usingProxy() { return false; } - protected AuthorizationInfo getAuthentication(boolean proxy, AuthorizationInfo prevAuthInfo, - String authenticate) throws HttpParseException, NoSuchAlgorithmException { + protected AuthorizationInfo getAuthentication(boolean proxy, AuthorizationInfo prevAuthInfo, String authenticate) + throws HttpParseException, NoSuchAlgorithmException { Challenge[] challenges = Challenge.parseChallenge(authenticate); // AuthorizationHandler auth_handler = @@ -1056,14 +1102,19 @@ protected AuthorizationInfo getAuthentication(boolean proxy, AuthorizationInfo p // HttpHeader headers = challenge.getParams(); // String stale = headers.getField("stale"); // } - prevAuthInfo = this.iAuth_handler.getAuthorizationInfo(this.iHttpClientPool - .getConfigurationContext().getHttpAuthenticationModule(), proxy ? Boolean.TRUE - : Boolean.FALSE, this.iUrl.getHost(), this.iUrl.getPort(), this.iUrl - .getScheme(), challenge.getRealm(), challenge.getScheme()); + prevAuthInfo = + this.iAuth_handler.getAuthorizationInfo( + this.iHttpClientPool.getConfigurationContext().getHttpAuthenticationModule(), + proxy ? Boolean.TRUE : Boolean.FALSE, + this.iUrl.getHost(), + this.iUrl.getPort(), + this.iUrl.getScheme(), + challenge.getRealm(), + challenge.getScheme() + ); if (prevAuthInfo != null) { - prevAuthInfo.updateAuthenticationInfo(challenge, authenticate, this.iUrl, - this.iRequestMethod); + prevAuthInfo.updateAuthenticationInfo(challenge, authenticate, this.iUrl, this.iRequestMethod); return prevAuthInfo; } } @@ -1093,13 +1144,15 @@ private String[] parseProperty(String propertyName) { as = null; } else { Vector vector = new Vector(); - for (StringTokenizer stringtokenizer = new StringTokenizer(s, ","); stringtokenizer - .hasMoreElements(); vector.addElement(stringtokenizer.nextElement())) { + for ( + StringTokenizer stringtokenizer = new StringTokenizer(s, ","); + stringtokenizer.hasMoreElements(); + vector.addElement(stringtokenizer.nextElement()) + ) { // add each token to vector } as = new String[vector.size()]; - for (int i1 = 0; i1 < as.length; i1++) - as[i1] = (String) vector.elementAt(i1); + for (int i1 = 0; i1 < as.length; i1++) as[i1] = (String) vector.elementAt(i1); } return as; } @@ -1117,10 +1170,11 @@ private void resetSocket() throws IOException { if (this.iSocket == null) { // Determine whether we need to connect with a timeout or not - boolean socketConnectWithTimeout = this.iHttpClientPool.getConfigurationContext() - .socketConnectWithTimeout(); - logger.trace(Level.FINER, "Socket=null, creating http socket " - + (socketConnectWithTimeout ? "with" : "without") + " timeout."); + boolean socketConnectWithTimeout = this.iHttpClientPool.getConfigurationContext().socketConnectWithTimeout(); + logger.trace( + Level.FINER, + "Socket=null, creating http socket " + (socketConnectWithTimeout ? "with" : "without") + " timeout." + ); // On Java 5+ InetSocketAddress(String,int) constructor will call // any security manager's checkConnect method @@ -1131,45 +1185,41 @@ private void resetSocket() throws IOException { } } - SocketFactory factory = this.iHttpClientPool.getConfigurationContext() - .getCustomSocketFactory(); + SocketFactory factory = this.iHttpClientPool.getConfigurationContext().getCustomSocketFactory(); if (factory == null) { - factory = HttpSocketFactory + factory = + HttpSocketFactory .getInstance() .getClientSocketFactory( - WBEMConstants.HTTPS.equalsIgnoreCase(this.iUrl.getScheme()) ? this.iHttpClientPool - .getSslContext() - : null); + WBEMConstants.HTTPS.equalsIgnoreCase(this.iUrl.getScheme()) ? this.iHttpClientPool.getSslContext() : null + ); if (factory == null) { logger.message(Messages.HTTP_NO_SOCKET_FACTORY, this.iUrl.getScheme()); - throw new IllegalStateException("Unable to load socket factory:" - + this.iUrl.getScheme()); + throw new IllegalStateException("Unable to load socket factory:" + this.iUrl.getScheme()); } } logger.trace(Level.FINER, "Creating new http for url " + this.iUrl.toString()); if (socketConnectWithTimeout) { - int connectTimeout = this.iHttpClientPool.getConfigurationContext() - .getSocketConnectTimeout(); + int connectTimeout = this.iHttpClientPool.getConfigurationContext().getSocketConnectTimeout(); logger.trace(Level.FINER, "Setting socket connect timeout=" + connectTimeout); if (factory instanceof SSLSocketFactory) { Socket sock = new Socket(); - sock.connect(new InetSocketAddress(this.iUrl.getHost(), this.iUrl.getPort()), - connectTimeout); - this.iSocket = ((SSLSocketFactory) factory).createSocket(sock, this.iUrl - .getHost(), this.iUrl.getPort(), true); - + sock.connect(new InetSocketAddress(this.iUrl.getHost(), this.iUrl.getPort()), connectTimeout); + this.iSocket = + ((SSLSocketFactory) factory).createSocket(sock, this.iUrl.getHost(), this.iUrl.getPort(), true); } else { this.iSocket = factory.createSocket(); - if (this.iSocket != null) this.iSocket.connect(new InetSocketAddress(this.iUrl - .getHost(), this.iUrl.getPort()), connectTimeout); + if (this.iSocket != null) this.iSocket.connect( + new InetSocketAddress(this.iUrl.getHost(), this.iUrl.getPort()), + connectTimeout + ); } } else { this.iSocket = factory.createSocket(this.iUrl.getHost(), this.iUrl.getPort()); } if (this.iSocket == null) { - logger.trace(Level.WARNING, "Socket factory " + factory.getClass().getName() - + " returned null socket"); + logger.trace(Level.WARNING, "Socket factory " + factory.getClass().getName() + " returned null socket"); throw new IOException("Socket factory did not create socket"); } @@ -1180,44 +1230,50 @@ private void resetSocket() throws IOException { if (this.iSocket instanceof SSLSocket) { // Determine whether we need to perform SSL handshake or not - boolean performHandshake = this.iHttpClientPool.getConfigurationContext() - .performSslHandshake(); - logger.trace(Level.FINER, "SSL socket created, handshake " - + (performHandshake ? "will" : "will not") + " be performed."); + boolean performHandshake = this.iHttpClientPool.getConfigurationContext().performSslHandshake(); + logger.trace( + Level.FINER, + "SSL socket created, handshake " + (performHandshake ? "will" : "will not") + " be performed." + ); if (performHandshake) { SSLSocket sk = (SSLSocket) this.iSocket; String protocols[] = parseProperty("https.protocols"); if (protocols != null) { - logger.trace(Level.FINER, - "Setting SSLSocket.setEnabledProtocols() from \"https.protocols\"=" - + String.valueOf(Arrays.asList(protocols))); + logger.trace( + Level.FINER, + "Setting SSLSocket.setEnabledProtocols() from \"https.protocols\"=" + + String.valueOf(Arrays.asList(protocols)) + ); sk.setEnabledProtocols(protocols); } String ciphersuites[] = parseProperty("https.cipherSuites"); if (ciphersuites != null) { - logger.trace(Level.FINER, - "Setting SSLSocket.setEnableCipheSuites() from \"https.cipherSuites\"=" - + String.valueOf(Arrays.asList(ciphersuites))); + logger.trace( + Level.FINER, + "Setting SSLSocket.setEnableCipheSuites() from \"https.cipherSuites\"=" + + String.valueOf(Arrays.asList(ciphersuites)) + ); sk.setEnabledCipherSuites(ciphersuites); } - String disableCipherSuites = this.iHttpClientPool.getConfigurationContext() - .getSslClientCipherSuitesToDisable(); + String disableCipherSuites = + this.iHttpClientPool.getConfigurationContext().getSslClientCipherSuitesToDisable(); if (disableCipherSuites != null) { - sk.setEnabledCipherSuites(this.iHttpClientPool.getUpdatedCipherSuites(sk - .getEnabledCipherSuites(), disableCipherSuites)); + sk.setEnabledCipherSuites( + this.iHttpClientPool.getUpdatedCipherSuites(sk.getEnabledCipherSuites(), disableCipherSuites) + ); } // Determine whether we need to perform synchronized SSL // handshake or not - boolean synchronizedHandshake = this.iHttpClientPool.getConfigurationContext() - .synchronizedSslHandshake(); - logger.trace(Level.FINER, "Starting " - + (synchronizedHandshake ? "synchronized" : "unsynchronized") - + " http handshake."); + boolean synchronizedHandshake = this.iHttpClientPool.getConfigurationContext().synchronizedSslHandshake(); + logger.trace( + Level.FINER, + "Starting " + (synchronizedHandshake ? "synchronized" : "unsynchronized") + " http handshake." + ); sk.addHandshakeCompletedListener(this); if (synchronizedHandshake) { @@ -1231,8 +1287,8 @@ private void resetSocket() throws IOException { } this.iIStream = new BufferedInputStream(this.iSocket.getInputStream()); - this.iOStream = new ASCIIPrintStream(new BufferedOutputStream(this.iSocket - .getOutputStream(), 1024), false, iEncoding); + this.iOStream = + new ASCIIPrintStream(new BufferedOutputStream(this.iSocket.getOutputStream(), 1024), false, iEncoding); this.iServerInput = null; } else { if (this.iServerInput != null && !(this.iServerInput instanceof KeepAliveInputStream)) { @@ -1251,7 +1307,7 @@ private void resetSocket() throws IOException { /** * Returns connected - * + * * @return The value of connected. */ public boolean isConnected() { diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpClientMethod.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpClientMethod.java index c6e5e6f..1275ff0 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpClientMethod.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpClientMethod.java @@ -48,15 +48,13 @@ import java.io.IOException; import java.io.InputStream; import java.net.HttpURLConnection; - import org.metricshub.wbem.sblim.cimclient.internal.http.io.ASCIIPrintStream; /** * Class HttpClientMethod encapsulates a http client method - * + * */ public class HttpClientMethod extends HttpMethod { - private boolean iIncomming = true; private String iHttpHeader; @@ -73,7 +71,7 @@ public class HttpClientMethod extends HttpMethod { /** * Ctor. Creates an outgoing http method - * + * * @param pMethod * The method * @param pRequest @@ -93,7 +91,7 @@ public HttpClientMethod(String pMethod, String pRequest, int pMajor, int pMinor) /** * Ctor. Parses an incoming http method from a given input stream - * + * * @param pReader * The input stream * @throws IOException @@ -137,7 +135,7 @@ public HttpClientMethod(InputStream pReader) throws IOException { /** * Returns the major version - * + * * @return The major version */ public int getMajorVersion() { @@ -146,7 +144,7 @@ public int getMajorVersion() { /** * Returns the minor version - * + * * @return The minor version */ public int getMinorVersion() { @@ -155,7 +153,7 @@ public int getMinorVersion() { /** * Returns the method name - * + * * @return The method name */ public String getMethodName() { @@ -164,7 +162,7 @@ public String getMethodName() { /** * Return the status - * + * * @return The status */ public int getStatus() { @@ -173,18 +171,17 @@ public int getStatus() { /** * Writes the method to a given stream - * + * * @param pStream * The stream */ public void write(ASCIIPrintStream pStream) { - pStream.print(this.iMethod + " " + this.iRequest + " HTTP/" + this.iMajor + "." - + this.iMinor + "\r\n"); + pStream.print(this.iMethod + " " + this.iRequest + " HTTP/" + this.iMajor + "." + this.iMinor + "\r\n"); } /** * Returns the response message - * + * * @return The response message */ public String getResponseMessage() { @@ -193,7 +190,9 @@ public String getResponseMessage() { @Override public String toString() { - if (this.iIncomming) { return this.iHttpHeader + " " + this.iStatus + " " + this.iResponse; } + if (this.iIncomming) { + return this.iHttpHeader + " " + this.iStatus + " " + this.iResponse; + } return this.iMethod + " " + this.iRequest + " HTTP/" + this.iMajor + "." + this.iMinor; } } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpClientPool.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpClientPool.java index 06b7f4f..a94aa88 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpClientPool.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpClientPool.java @@ -58,19 +58,16 @@ import java.util.Iterator; import java.util.List; import java.util.logging.Level; - import javax.net.ssl.SSLContext; - import org.metricshub.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; import org.metricshub.wbem.sblim.cimclient.internal.util.Util; import org.metricshub.wbem.sblim.cimclient.internal.util.WBEMConfiguration; /** * Class HttpClientPool implements a pool for http client connections - * + * */ public class HttpClientPool { - /** * Guarded by "this" */ @@ -99,7 +96,7 @@ public class HttpClientPool { /** * Ctor. - * + * * @param pConfiguration * The configuration for this session. Must be non-null. */ @@ -116,7 +113,7 @@ public HttpClientPool(WBEMConfiguration pConfiguration) { /** * Returns the number of connections in this pool that are available/free * for (re-)use. - * + * * @return number of available/free connections in pool */ public synchronized int getNumberOfAllConnections() { @@ -125,7 +122,7 @@ public synchronized int getNumberOfAllConnections() { /** * Returns the number of all connections in this pool. - * + * * @return number of all connections in pool */ public synchronized int getNumberOfAvailableConnections() { @@ -134,7 +131,7 @@ public synchronized int getNumberOfAvailableConnections() { /** * Returns the configuration context of this pool - * + * * @return The configuration */ public WBEMConfiguration getConfigurationContext() { @@ -144,13 +141,12 @@ public WBEMConfiguration getConfigurationContext() { /** * Returns the SSL context for the clients in this pool. The context is * initialized on the first call of this method (lazy initialization). - * + * * @return The SSL context */ public synchronized SSLContext getSslContext() { if (this.iSslContext == null) { - this.iSslContext = HttpSocketFactory.getInstance().getClientSSLContext( - this.iConfiguration); + this.iSslContext = HttpSocketFactory.getInstance().getClientSSLContext(this.iConfiguration); } return this.iSslContext; } @@ -158,33 +154,40 @@ public synchronized SSLContext getSslContext() { /** * Returns the available connections of this pool for a given * URI&AuthorizationHandler - * + * * @param pUri * The uri * @param pHandler * The authorization handler * @return A connection if one is available, null otherwise */ - public synchronized HttpClient retrieveAvailableConnectionFromPool(URI pUri, - AuthorizationHandler pHandler) { + public synchronized HttpClient retrieveAvailableConnectionFromPool(URI pUri, AuthorizationHandler pHandler) { if (this.iClosed) { - LogAndTraceBroker.getBroker().trace(Level.FINE, - "Attempt to get client from closed http client pool,"); + LogAndTraceBroker.getBroker().trace(Level.FINE, "Attempt to get client from closed http client pool,"); throw new IllegalStateException("HttpClientPool is closed. Retrieve connection failed."); } if (getNumberOfAvailableConnections() > 0) { - LogAndTraceBroker.getBroker().trace( + LogAndTraceBroker + .getBroker() + .trace( Level.FINE, - "Reusing client (" + pUri.toString() + ", max: " + getPoolSize() + ", current:" - + getNumberOfAvailableConnections()); + "Reusing client (" + + pUri.toString() + + ", max: " + + getPoolSize() + + ", current:" + + getNumberOfAvailableConnections() + ); return this.iAvailableConnections.remove(0); } - LogAndTraceBroker.getBroker().trace( + LogAndTraceBroker + .getBroker() + .trace( Level.FINE, - "New client (" + pUri.toString() + ", max: " + getPoolSize() + ", current:" - + getNumberOfAvailableConnections()); + "New client (" + pUri.toString() + ", max: " + getPoolSize() + ", current:" + getNumberOfAvailableConnections() + ); HttpClient client = new HttpClient(pUri, this, pHandler); addConnectionToPool(client); return client; @@ -194,13 +197,15 @@ public synchronized HttpClient retrieveAvailableConnectionFromPool(URI pUri, * Add the connection to the pool. Connection is added as available * connection. Use method {@link #addConnectionToPool(HttpClient)} to add * the connection without being available for reuse. - * + * * @param httpClient * connection that is to be added to the pool * @return true if connection was added otherwise false */ public synchronized boolean returnAvailableConnectionToPool(HttpClient httpClient) { - if (httpClient == null) { return false; } + if (httpClient == null) { + return false; + } if (this.iClosed) { this.iAllConnections.remove(httpClient); @@ -217,8 +222,7 @@ public synchronized boolean returnAvailableConnectionToPool(HttpClient httpClien return true; } } else { - LogAndTraceBroker.getBroker().trace(Level.FINE, - "Http pool size reached, discarding client."); + LogAndTraceBroker.getBroker().trace(Level.FINE, "Http pool size reached, discarding client."); this.iAllConnections.remove(httpClient); this.iAvailableConnections.remove(httpClient); httpClient.disconnect(); @@ -231,15 +235,14 @@ public synchronized boolean returnAvailableConnectionToPool(HttpClient httpClien * connection. Use method * {@link #returnAvailableConnectionToPool(HttpClient)} to also add the * connection to the available connections. - * + * * @param httpClient * connection that is to be added to the pool * @return true if connection was added otherwise false */ public synchronized boolean addConnectionToPool(HttpClient httpClient) { if (this.iClosed) { - LogAndTraceBroker.getBroker().trace(Level.FINE, - "Attempt to add client to closed http client pool,"); + LogAndTraceBroker.getBroker().trace(Level.FINE, "Attempt to add client to closed http client pool,"); throw new IllegalStateException("HttpClientPool is closed. Add connection failed."); } if (httpClient != null && !this.iAllConnections.contains(httpClient)) { @@ -252,7 +255,7 @@ public synchronized boolean addConnectionToPool(HttpClient httpClient) { /** * Removes a connection completely from the pool. - * + * * @param httpClient * connection that is to be removed from the pool * @return true if connection was removed otherwise false @@ -260,7 +263,9 @@ public synchronized boolean addConnectionToPool(HttpClient httpClient) { public synchronized boolean removeConnectionFromPool(HttpClient httpClient) { if (httpClient != null) { this.iAvailableConnections.remove(httpClient); - if (this.iAllConnections.remove(httpClient)) { return true; } + if (this.iAllConnections.remove(httpClient)) { + return true; + } return false; // connection was not in pool! } return false; // no connection given @@ -288,7 +293,7 @@ protected void finalize() throws Throwable { /** * Returns poolSize - * + * * @return The value of poolSize. */ public int getPoolSize() { @@ -298,32 +303,31 @@ public int getPoolSize() { /** * Returns updated array of cipher suites which is current cipher suites * less any cipher suites listed to be disabled - * + * * NOTE: The updated array is generated only upon first invocation and then * saved, effectively making this a lazy initialization of the cipher suites * on a HttpClientPool basis - it has to be done here and not in WBEMClient * where it belongs because socket characteristics are not known to * WBEMClient - * + * * @param pCurrentCipherSuites * The currently enabled cipher suites * @param pDisableCipherSuites * The list of cipher suites to be disabled * @return The updated enabled cipher suites */ - public synchronized String[] getUpdatedCipherSuites(String[] pCurrentCipherSuites, - String pDisableCipherSuites) { + public synchronized String[] getUpdatedCipherSuites(String[] pCurrentCipherSuites, String pDisableCipherSuites) { if (this.iEnabledCipherSuites == null) { - this.iEnabledCipherSuites = Util.getFilteredStringArray(pCurrentCipherSuites, - pDisableCipherSuites); + this.iEnabledCipherSuites = Util.getFilteredStringArray(pCurrentCipherSuites, pDisableCipherSuites); int before = pCurrentCipherSuites.length; int after = this.iEnabledCipherSuites.length; - if (before > 0 && after == 0) LogAndTraceBroker.getBroker().trace(Level.WARNING, - "All cipher suites disabled for client!"); - else if (before > after) LogAndTraceBroker.getBroker().trace(Level.FINE, - "Some (" + (before - after) + ") cipher suites disabled for client"); - else if (before == after) LogAndTraceBroker.getBroker().trace(Level.FINER, - "No cipher suites disabled for client"); + if (before > 0 && after == 0) LogAndTraceBroker + .getBroker() + .trace(Level.WARNING, "All cipher suites disabled for client!"); else if (before > after) LogAndTraceBroker + .getBroker() + .trace(Level.FINE, "Some (" + (before - after) + ") cipher suites disabled for client"); else if ( + before == after + ) LogAndTraceBroker.getBroker().trace(Level.FINER, "No cipher suites disabled for client"); } return this.iEnabledCipherSuites; } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpConnectionHandler.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpConnectionHandler.java index d13b10c..7a81a0c 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpConnectionHandler.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpConnectionHandler.java @@ -58,9 +58,7 @@ import java.util.HashMap; import java.util.Map; import java.util.logging.Level; - import javax.net.ssl.SSLSocket; - import org.metricshub.wbem.sblim.cimclient.internal.http.io.ASCIIPrintStream; import org.metricshub.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; import org.metricshub.wbem.sblim.cimclient.internal.util.WBEMConfiguration; @@ -69,10 +67,9 @@ /** * Class HttpConnectionHandler is responsible for handling an incoming * connection - * + * */ public class HttpConnectionHandler { - /** * MAJOR_VERSION */ @@ -95,7 +92,7 @@ public class HttpConnectionHandler { /** * Ctor. - * + * * @param pHandler * The content handler * @param pProperties @@ -126,22 +123,23 @@ private synchronized void addSuspectIP(String pSuspectIP) { this.iBlockedIPs.append(pSuspectIP); newIP = true; } - if (newIP) LogAndTraceBroker.getBroker().trace( + if (newIP) LogAndTraceBroker + .getBroker() + .trace( Level.WARNING, - "Maximum allowable timeouts exceeded, all future connections ignored from " - + pSuspectIP); + "Maximum allowable timeouts exceeded, all future connections ignored from " + pSuspectIP + ); } } } private synchronized boolean isBlockedIP(Socket socket) { - return (this.iBlockedIPs != null && this.iBlockedIPs.indexOf(socket.getInetAddress() - .getHostAddress()) != -1); + return (this.iBlockedIPs != null && this.iBlockedIPs.indexOf(socket.getInetAddress().getHostAddress()) != -1); } /** * Handles the incoming connection and forwards to the content handler - * + * * @param socket * The socket of the connection */ @@ -149,10 +147,9 @@ public void handleConnection(Socket socket) { InputStream is = null; OutputStream os = null; if (isBlockedIP(socket)) { - LogAndTraceBroker.getBroker().trace( - Level.FINEST, - "Incoming connection ignored from blocked IP " - + socket.getInetAddress().getHostAddress()); + LogAndTraceBroker + .getBroker() + .trace(Level.FINEST, "Incoming connection ignored from blocked IP " + socket.getInetAddress().getHostAddress()); } else try { is = socket.getInputStream(); os = socket.getOutputStream(); @@ -163,14 +160,12 @@ public void handleConnection(Socket socket) { boolean chunk = reader.isChunkSupported(); HttpServerMethod readerMethod = reader.getMethod(); - if (readerMethod.getMethodName().equals("POST") - || readerMethod.getMethodName().equals("M-POST")) { + if (readerMethod.getMethodName().equals("POST") || readerMethod.getMethodName().equals("M-POST")) { // TODO: validate authorization MessageWriter writer = new MessageWriter(os, persistent, chunk); try { - StringBuilder localURL = new StringBuilder( - socket instanceof SSLSocket ? "https://" : "http://"); + StringBuilder localURL = new StringBuilder(socket instanceof SSLSocket ? "https://" : "http://"); InetAddress localAddress = socket.getLocalAddress(); if (localAddress != null) { localURL.append(localAddress.getHostAddress()); @@ -182,16 +177,28 @@ public void handleConnection(Socket socket) { } // 17931 - this.iHandler.handleContent(reader, writer, socket.getInetAddress(), - localURL.toString()); - writer.setMethod(new HttpServerMethod(readerMethod.getMajorVersion(), - readerMethod.getMinorVersion(), 200, "OK")); + this.iHandler.handleContent(reader, writer, socket.getInetAddress(), localURL.toString()); + writer.setMethod( + new HttpServerMethod(readerMethod.getMajorVersion(), readerMethod.getMinorVersion(), 200, "OK") + ); } catch (HttpException e) { - writer.setMethod(new HttpServerMethod(readerMethod.getMajorVersion(), - readerMethod.getMinorVersion(), e.getStatus(), e.getMessage())); + writer.setMethod( + new HttpServerMethod( + readerMethod.getMajorVersion(), + readerMethod.getMinorVersion(), + e.getStatus(), + e.getMessage() + ) + ); } catch (Throwable t) { - writer.setMethod(new HttpServerMethod(readerMethod.getMajorVersion(), - readerMethod.getMinorVersion(), 501, "Not Implemented")); + writer.setMethod( + new HttpServerMethod( + readerMethod.getMajorVersion(), + readerMethod.getMinorVersion(), + 501, + "Not Implemented" + ) + ); // TODO: define the correct error description writer.reset(); // TODO: report an specific error @@ -200,8 +207,9 @@ public void handleConnection(Socket socket) { try { writer.close(); } catch (IOException e) { - LogAndTraceBroker.getBroker().trace(Level.FINER, - "Exception while closing output stream from server socket", e); + LogAndTraceBroker + .getBroker() + .trace(Level.FINER, "Exception while closing output stream from server socket", e); } } } else { @@ -211,14 +219,16 @@ public void handleConnection(Socket socket) { writer.setHeader(header); // header.addField("Connection", persistent? // "Keep-Alive","close"); - writer.setMethod(new HttpServerMethod(readerMethod.getMajorVersion(), - readerMethod.getMinorVersion(), 501, "Not Implemented")); + writer.setMethod( + new HttpServerMethod(readerMethod.getMajorVersion(), readerMethod.getMinorVersion(), 501, "Not Implemented") + ); writeError(writer.getOutputStream(), "", ""); try { writer.close(); } catch (IOException e) { - LogAndTraceBroker.getBroker().trace(Level.FINER, - "Exception while closing output stream from server socket", e); + LogAndTraceBroker + .getBroker() + .trace(Level.FINER, "Exception while closing output stream from server socket", e); } } @@ -226,25 +236,25 @@ public void handleConnection(Socket socket) { try { reader.close(); } catch (IOException e) { - LogAndTraceBroker.getBroker().trace(Level.FINER, - "Exception while closing input stream from server socket", e); + LogAndTraceBroker + .getBroker() + .trace(Level.FINER, "Exception while closing input stream from server socket", e); } } while (true); } catch (IOException e) { - LogAndTraceBroker.getBroker().trace(Level.FINER, - "Exception while reading from server socket", e); + LogAndTraceBroker.getBroker().trace(Level.FINER, "Exception while reading from server socket", e); - if (e instanceof SocketTimeoutException - || WBEMConstants.INDICATION_DOS_EXCEPTION_MESSAGE.equalsIgnoreCase(e - .getMessage())) { + if ( + e instanceof SocketTimeoutException || + WBEMConstants.INDICATION_DOS_EXCEPTION_MESSAGE.equalsIgnoreCase(e.getMessage()) + ) { addSuspectIP(socket.getInetAddress().getHostAddress()); } } try { socket.close(); } catch (IOException e) { - LogAndTraceBroker.getBroker().trace(Level.FINER, - "Exception while closing server socket", e); + LogAndTraceBroker.getBroker().trace(Level.FINER, "Exception while closing server socket", e); } } @@ -256,14 +266,12 @@ public void close() { } private void writeError(ASCIIPrintStream dos, String title, String body) { - dos.print(" " + title + "" + body - + ""); - + dos.print(" " + title + "" + body + ""); } /** * Get the IPs blocked by the listener associated with the specified port. - * + * * @return The comma-separated list of blocked IPs. */ public synchronized String getBlockedIPs() { @@ -273,12 +281,11 @@ public synchronized String getBlockedIPs() { /** * Set the IPs to be blocked by the listener associated with the specified * port. - * + * * @param pIPs * The comma-separated list of blocked IPs. */ public synchronized void setBlockedIPs(String pIPs) { - this.iBlockedIPs = (pIPs == null || pIPs.trim().length() == 0) ? null : new StringBuilder( - pIPs); + this.iBlockedIPs = (pIPs == null || pIPs.trim().length() == 0) ? null : new StringBuilder(pIPs); } } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpContentHandler.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpContentHandler.java index 3a9d6e8..76b571d 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpContentHandler.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpContentHandler.java @@ -50,13 +50,13 @@ /** * Class HttpContentHandler is responsible for handling the content of an http * connection. - * + * */ public abstract class HttpContentHandler { /** * Handles the content of a given connection - * + * * @param pMessageReader * The reader of the connection * @param pMessageWriter @@ -68,8 +68,13 @@ public abstract class HttpContentHandler { * @throws HttpException * @throws IOException */ - public abstract void handleContent(MessageReader pMessageReader, MessageWriter pMessageWriter, - InetAddress pInetAddress, String pLocalAddress) throws HttpException, IOException; + public abstract void handleContent( + MessageReader pMessageReader, + MessageWriter pMessageWriter, + InetAddress pInetAddress, + String pLocalAddress + ) + throws HttpException, IOException; /** * Closes the handler diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpException.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpException.java index 1021a10..f371c5d 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpException.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpException.java @@ -47,10 +47,9 @@ /** * Class HttpException represents HTTP related problems - * + * */ public class HttpException extends IOException { - private static final long serialVersionUID = 934925248736106630L; int iStatus; @@ -64,7 +63,7 @@ public HttpException() { /** * Ctor. Equivalent to HttpException(-1, reason, null) - * + * * @param reason * The reason */ @@ -74,7 +73,7 @@ public HttpException(String reason) { /** * Ctor. Equivalent to HttpException(-1, reason, null) - * + * * @param status * The status * @param reason @@ -86,7 +85,7 @@ public HttpException(int status, String reason) { /** * Ctor. Equivalent to HttpException(-1, reason, null) - * + * * @param status * The status * @param reason @@ -101,7 +100,7 @@ public HttpException(int status, String reason, String cimError) { /** * Returns the status - * + * * @return The status */ public int getStatus() { diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpHeader.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpHeader.java index 493d56d..c3db780 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpHeader.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpHeader.java @@ -70,7 +70,6 @@ import java.util.Iterator; import java.util.Map.Entry; import java.util.logging.Level; - import org.metricshub.wbem.javax.wbem.WBEMException; import org.metricshub.wbem.sblim.cimclient.internal.http.io.ASCIIPrintStream; import org.metricshub.wbem.sblim.cimclient.internal.http.io.TrailerException; @@ -80,10 +79,9 @@ /** * Class HttpHeader represents a http header block - * + * */ public class HttpHeader { - private static BitSet cDontNeedEncoding; private static final String HEX_STR = "0123456789ABCDEF"; @@ -108,7 +106,6 @@ public class HttpHeader { cDontNeedEncoding.set('/'); cDontNeedEncoding.set('.'); cDontNeedEncoding.set('*'); - } private Hashtable iFields = new Hashtable(); @@ -117,12 +114,12 @@ public class HttpHeader { * Ctor. */ public HttpHeader() { - // empty + // empty } /** * Ctor. Parses the header from an input stream - * + * * @param pReader * The input stream * @throws IOException @@ -133,7 +130,7 @@ public HttpHeader(InputStream pReader) throws IOException { /** * Ctor. Parses the header from an input stream - * + * * @param pReader * The input stream * @param pTimeout @@ -146,8 +143,9 @@ public HttpHeader(InputStream pReader, long pTimeout) throws IOException { // TODO: this needs to be optimized!!! while (((line = HttpMethod.readLine(pReader)) != null) && (line.length() > 0)) { // get the header - if (pTimeout > 0 && (System.currentTimeMillis() - timeStart > pTimeout)) { throw new IOException( - WBEMConstants.INDICATION_DOS_EXCEPTION_MESSAGE); } + if (pTimeout > 0 && (System.currentTimeMillis() - timeStart > pTimeout)) { + throw new IOException(WBEMConstants.INDICATION_DOS_EXCEPTION_MESSAGE); + } try { int separator; if ((separator = line.indexOf(':')) > -1) { @@ -157,8 +155,7 @@ public HttpHeader(InputStream pReader, long pTimeout) throws IOException { // Ignore prefix-match from HTTP extension (RFC 2774), it'll // look like "nn-" - if (line.indexOf('-') == 2 && Character.isDigit(line.charAt(0)) - && Character.isDigit(line.charAt(1))) { + if (line.indexOf('-') == 2 && Character.isDigit(line.charAt(0)) && Character.isDigit(line.charAt(1))) { headerStartIndex = 3; } @@ -166,15 +163,15 @@ public HttpHeader(InputStream pReader, long pTimeout) throws IOException { value = line.substring(separator + 1); // TODO validate header and value, they must not be empty // entries - if (value.length() > 0 && value.startsWith(" ")) addParsedField(header, value - .substring(1)); - else addParsedField(header, value); + if (value.length() > 0 && value.startsWith(" ")) addParsedField( + header, + value.substring(1) + ); else addParsedField(header, value); } else { LogAndTraceBroker.getBroker().message(Messages.HTTP_INVALID_HEADER, line); } } catch (Exception e) { - LogAndTraceBroker.getBroker().trace(Level.FINER, - "Exception while parsing http header", e); + LogAndTraceBroker.getBroker().trace(Level.FINER, "Exception while parsing http header", e); LogAndTraceBroker.getBroker().message(Messages.HTTP_INVALID_HEADER, line); } } @@ -184,7 +181,7 @@ public HttpHeader(InputStream pReader, long pTimeout) throws IOException { /** * Adds a header field for client output (this means duplicate header * entries are replaced) - * + * * @param pName * The name of the header field * @param pValue @@ -203,7 +200,7 @@ public void addField(String pName, String pValue) { /** * Adds a header field from parsed server input (this means duplicate header * entries are appended in comma-separated list as defined by RFC 2616) - * + * * @param pName * The name of the header field * @param pValue @@ -238,7 +235,7 @@ public void clear() { /** * Return an iterator over the header fields - * + * * @return The iterator */ public Iterator> iterator() { @@ -247,7 +244,7 @@ public Iterator> iterator() { /** * Parses a line from a header block - * + * * @param pLine * The line * @return The http header @@ -272,8 +269,7 @@ public static HttpHeader parse(String pLine) { // something goes wrong. no separator found } prev = next + 1; - while (Character.isSpaceChar(pLine.charAt(prev))) - prev++; + while (Character.isSpaceChar(pLine.charAt(prev))) prev++; next = pLine.indexOf(',', prev); } String hdr = pLine.substring(prev); @@ -303,7 +299,7 @@ public String toString() { /** * Removes a field from the header - * + * * @param pName * The name of the field */ @@ -313,7 +309,7 @@ public void removeField(String pName) { /** * Returns a field from the header - * + * * @param pName * The name of the field * @return The value @@ -324,12 +320,11 @@ public String getField(String pName) { /** * Writes a header block to a stream - * + * * @param pWriter * The stream */ public void write(ASCIIPrintStream pWriter) { - Iterator> iterator = this.iFields.entrySet().iterator(); while (iterator.hasNext()) { Entry entry = iterator.next(); @@ -343,7 +338,7 @@ public void write(ASCIIPrintStream pWriter) { /** * Encodes raw data - * + * * @param pData * The raw data * @return The encoded data @@ -351,19 +346,17 @@ public void write(ASCIIPrintStream pWriter) { public static synchronized String encode(byte[] pData) { String str = null; try { - if (cDfltEncName == null) cDfltEncName = (String) AccessController - .doPrivileged(new GetProperty("file.encoding")); + if (cDfltEncName == null) cDfltEncName = (String) AccessController.doPrivileged(new GetProperty("file.encoding")); str = encode(pData, cDfltEncName); } catch (UnsupportedEncodingException e) { - LogAndTraceBroker.getBroker().trace(Level.FINER, - "Exception while encoding http header data", e); + LogAndTraceBroker.getBroker().trace(Level.FINER, "Exception while encoding http header data", e); } return str; } /** * Encodes raw data for a given character set - * + * * @param pData * The raw data * @param pEnc @@ -372,7 +365,6 @@ public static synchronized String encode(byte[] pData) { * @throws UnsupportedEncodingException */ public static String encode(byte[] pData, String pEnc) throws UnsupportedEncodingException { - int maxBytesPerChar = 10; // BufferedWriter validates encoding ByteArrayOutputStream buf = new ByteArrayOutputStream(maxBytesPerChar); @@ -399,7 +391,7 @@ public static String encode(byte[] pData, String pEnc) throws UnsupportedEncodin /** * Encodes a given string for a given character set - * + * * @param pData * The source string * @param pSourceEnc @@ -409,25 +401,22 @@ public static String encode(byte[] pData, String pEnc) throws UnsupportedEncodin * @return The encoded string * @throws UnsupportedEncodingException */ - public static String encode(String pData, String pSourceEnc, String pTargetEnc) - throws UnsupportedEncodingException { - + public static String encode(String pData, String pSourceEnc, String pTargetEnc) throws UnsupportedEncodingException { return encode(pData.getBytes(pSourceEnc), pTargetEnc); } /** * Class HeaderEntry represents a single header field - * + * */ public static class HeaderEntry { - String iHeader; int iHashcode; /** * Ctor. - * + * * @param pName * The name of the header field */ @@ -455,10 +444,9 @@ public int hashCode() { /** * Class GetProperty implements privileged access to system properties - * + * */ private static class GetProperty implements PrivilegedAction { - String iPropertyName; GetProperty(String propertyName) { @@ -473,7 +461,7 @@ public Object run() { /** * Throws a TrailerException if it contains recognized CIM errors in http * trailer entries. - * + * * @throws TrailerException */ public void examineTrailer() throws TrailerException { @@ -483,7 +471,7 @@ public void examineTrailer() throws TrailerException { /** * Throws a TrailerException if it contains recognized CIM errors in http * trailer entries. - * + * * @param pOrigin * The origin of the trailer (response, request, etc.) * @throws TrailerException @@ -509,8 +497,9 @@ public void examineTrailer(String pOrigin) throws TrailerException { try { code = Integer.parseInt(valStr); } catch (NumberFormatException e) { - String msg = new String(WBEMConstants.HTTP_TRAILER_STATUS_CODE + " \"" - + valStr + "\" invalid, setting to CIM_ERR_FAILED"); + String msg = new String( + WBEMConstants.HTTP_TRAILER_STATUS_CODE + " \"" + valStr + "\" invalid, setting to CIM_ERR_FAILED" + ); LogAndTraceBroker.getBroker().trace(Level.FINER, msg, e); code = WBEMException.CIM_ERR_FAILED; if (desc == null) desc = msg; @@ -523,12 +512,13 @@ public void examineTrailer(String pOrigin) throws TrailerException { throw new Error(e); } } - if (hdrs != null && hdrs.length() > 0) LogAndTraceBroker.getBroker().trace( - Level.FINER, - (pOrigin == null ? "Unknown" : pOrigin) + " HTTP Trailer Headers= " - + hdrs.toString()); + if (hdrs != null && hdrs.length() > 0) LogAndTraceBroker + .getBroker() + .trace(Level.FINER, (pOrigin == null ? "Unknown" : pOrigin) + " HTTP Trailer Headers= " + hdrs.toString()); if (code > 0) { - if (desc != null) { throw new TrailerException(new WBEMException(code, desc)); } + if (desc != null) { + throw new TrailerException(new WBEMException(code, desc)); + } throw new TrailerException(new WBEMException(code)); } } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpHeaderParser.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpHeaderParser.java index 05cbdae..86949b9 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpHeaderParser.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpHeaderParser.java @@ -50,17 +50,16 @@ /** * Class HttpHeaderParser parses http headers - * + * */ public class HttpHeaderParser { - String iRaw; Vector iNameValuePair; /** * Ctor. - * + * * @param pHeader * The header block */ @@ -79,8 +78,7 @@ public HttpHeaderParser(String pHeader) { do { char c = charArray[currentPos]; if (c == '=') { - nvp[0] = (new String(charArray, startPosValue, currentPos - startPosValue)) - .toLowerCase(); + nvp[0] = (new String(charArray, startPosValue, currentPos - startPosValue)).toLowerCase(); isName = false; startPosValue = ++currentPos; } else if (c == '"') { @@ -89,8 +87,10 @@ public HttpHeaderParser(String pHeader) { this.iNameValuePair.add(nvp); nvp = new String[2]; withinQuote = false; - while (++currentPos < len - && (charArray[currentPos] == ' ' || charArray[currentPos] == ',' || charArray[currentPos] == ';')) { + while ( + ++currentPos < len && + (charArray[currentPos] == ' ' || charArray[currentPos] == ',' || charArray[currentPos] == ';') + ) { // ignore spaces and preceding comma } isName = true; @@ -104,19 +104,19 @@ public HttpHeaderParser(String pHeader) { currentPos++; } else { if (isName) { - nvp[0] = (new String(charArray, startPosValue, currentPos - - startPosValue)).toLowerCase(); + nvp[0] = (new String(charArray, startPosValue, currentPos - startPosValue)).toLowerCase(); this.iNameValuePair.add(nvp); nvp = new String[2]; } else { - nvp[1] = new String(charArray, startPosValue, currentPos - - startPosValue); + nvp[1] = new String(charArray, startPosValue, currentPos - startPosValue); this.iNameValuePair.add(nvp); nvp = new String[2]; } - while (++currentPos < len - && (charArray[currentPos] == ' ' || charArray[currentPos] == ',' || charArray[currentPos] == ';')) { + while ( + ++currentPos < len && + (charArray[currentPos] == ' ' || charArray[currentPos] == ',' || charArray[currentPos] == ';') + ) { // ignore spaces and preceding comma } isName = true; @@ -134,14 +134,12 @@ public HttpHeaderParser(String pHeader) { this.iNameValuePair.add(nvp); nvp = new String[2]; } else { - nvp[1] = new String(charArray, startPosValue, - (currentPos - startPosValue) + 1); + nvp[1] = new String(charArray, startPosValue, (currentPos - startPosValue) + 1); this.iNameValuePair.add(nvp); nvp = new String[2]; } } else { - nvp[0] = (new String(charArray, startPosValue, (currentPos - startPosValue) + 1)) - .toLowerCase(); + nvp[0] = (new String(charArray, startPosValue, (currentPos - startPosValue) + 1)).toLowerCase(); } this.iNameValuePair.add(nvp); } else if (currentPos == startPosValue) { @@ -165,7 +163,7 @@ public HttpHeaderParser(String pHeader) { /** * Returns the header field at a given index - * + * * @param pIndex * The index * @return The field name @@ -177,7 +175,7 @@ public String getField(int pIndex) { /** * Returns the value of a header field at a given index - * + * * @param pIndex * @return The value */ @@ -188,7 +186,7 @@ public String getValue(int pIndex) { /** * Returns the value of a header field for a given name - * + * * @param pName * The name * @return The value @@ -200,7 +198,7 @@ public String getValue(String pName) { /** * Returns the value of a header field for a given name specifying a * default. - * + * * @param pName * The name of the header field * @param pDefault @@ -212,8 +210,7 @@ public String getValue(String pName, String pDefault) { pName = pName.toLowerCase(); for (int i = 0; i < this.iNameValuePair.size(); i++) { if (this.iNameValuePair.elementAt(i)[0] == null) return pDefault; - if (pName.equals(this.iNameValuePair.elementAt(i)[0])) return this.iNameValuePair - .elementAt(i)[1]; + if (pName.equals(this.iNameValuePair.elementAt(i)[0])) return this.iNameValuePair.elementAt(i)[1]; } return pDefault; } @@ -221,7 +218,7 @@ public String getValue(String pName, String pDefault) { /** * Returns the value of a numeric header field for a given name specifying a * default. - * + * * @param pName * The name of the header field * @param pDefault diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpMethod.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpMethod.java index f5e63b4..6525315 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpMethod.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpMethod.java @@ -51,25 +51,23 @@ import java.io.IOException; import java.io.InputStream; import java.util.logging.Level; - import org.metricshub.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; /** * Class HttpMethod provides a method to read a line from a given input stream - * + * */ public abstract class HttpMethod { /** * Reads a line from a given input stream - * + * * @param pStream * The input stream * @return The line * @throws IOException */ public static String readLine(InputStream pStream) throws IOException { - if (pStream == null) return null; char buffer[] = new char[16]; @@ -78,7 +76,6 @@ public static String readLine(InputStream pStream) throws IOException { boolean flag = true; for (; (prevChar = pStream.read()) >= 0; buffer[used++] = (char) prevChar) { - flag = false; // @12917 - thschaef @@ -102,10 +99,11 @@ public static String readLine(InputStream pStream) throws IOException { } if (flag) { LogAndTraceBroker - .getBroker() - .trace( - Level.FINE, - "Unexpected EOF trying to read line from input stream - CIMOM closed its end of socket, check it for connection issues"); + .getBroker() + .trace( + Level.FINE, + "Unexpected EOF trying to read line from input stream - CIMOM closed its end of socket, check it for connection issues" + ); throw new IOException("Unexpected EOF"); } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpParseException.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpParseException.java index 9735f00..b10d459 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpParseException.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpParseException.java @@ -45,10 +45,9 @@ /** * Class HttpParseException represents problems parsing http challenges - * + * */ public class HttpParseException extends HttpException { - private static final long serialVersionUID = -6546559439537187479L; /** @@ -60,7 +59,7 @@ public HttpParseException() { /** * Ctor. - * + * * @param pReason * The reason */ diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpServerConnection.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpServerConnection.java index f60ff10..45d3c53 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpServerConnection.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpServerConnection.java @@ -66,10 +66,8 @@ import java.util.concurrent.BlockingQueue; import java.util.concurrent.TimeUnit; import java.util.logging.Level; - import javax.net.ssl.SSLContext; import javax.net.ssl.SSLServerSocket; - import org.metricshub.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; import org.metricshub.wbem.sblim.cimclient.internal.util.ThreadPool; import org.metricshub.wbem.sblim.cimclient.internal.util.Util; @@ -79,10 +77,9 @@ * Class HttpServerConnection implements the outer shell of a HTTP server. It * accepts incoming connections and puts them in a queue to be serviced by an * independent thread - * + * */ public class HttpServerConnection implements Runnable { - private int iPort; private ServerSocket iServerSocket; @@ -105,7 +102,7 @@ public class HttpServerConnection implements Runnable { /** * Ctor. - * + * * @param pHandler * The connection handler * @param pLocalAddress @@ -119,9 +116,14 @@ public class HttpServerConnection implements Runnable { * The configuration context * @throws IOException */ - public HttpServerConnection(HttpConnectionHandler pHandler, String pLocalAddress, int pPort, - boolean pSsl, WBEMConfiguration pProperties) throws IOException { - + public HttpServerConnection( + HttpConnectionHandler pHandler, + String pLocalAddress, + int pPort, + boolean pSsl, + WBEMConfiguration pProperties + ) + throws IOException { final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); logger.entry(); @@ -129,21 +131,20 @@ public HttpServerConnection(HttpConnectionHandler pHandler, String pLocalAddress this.iHandler = pHandler; this.iSsl = pSsl; this.iServerName = pSsl ? "HTTPS Server" : "HTTP Server"; - this.iSessionProperties = (pProperties != null) ? pProperties : WBEMConfiguration - .getGlobalConfiguration(); - SSLContext sslContext = pSsl ? HttpSocketFactory.getInstance().getServerSSLContext( - this.iSessionProperties) : null; - this.iServerSocket = (pLocalAddress != null && pLocalAddress.length() > 0) ? HttpSocketFactory - .getInstance().getServerSocketFactory(sslContext).createServerSocket(pPort, 50, - InetAddress.getByName(pLocalAddress)) - : HttpSocketFactory.getInstance().getServerSocketFactory(sslContext) - .createServerSocket(pPort); + this.iSessionProperties = (pProperties != null) ? pProperties : WBEMConfiguration.getGlobalConfiguration(); + SSLContext sslContext = pSsl ? HttpSocketFactory.getInstance().getServerSSLContext(this.iSessionProperties) : null; + this.iServerSocket = + (pLocalAddress != null && pLocalAddress.length() > 0) + ? HttpSocketFactory + .getInstance() + .getServerSocketFactory(sslContext) + .createServerSocket(pPort, 50, InetAddress.getByName(pLocalAddress)) + : HttpSocketFactory.getInstance().getServerSocketFactory(sslContext).createServerSocket(pPort); if (this.iServerSocket instanceof SSLServerSocket) { if (this.iSessionProperties.getSslListenerPeerVerification().equalsIgnoreCase("ignore")) { logger.trace(Level.FINER, "Listener peer verification: ignore"); ((SSLServerSocket) this.iServerSocket).setNeedClientAuth(false); - } else if (this.iSessionProperties.getSslListenerPeerVerification().equalsIgnoreCase( - "accept")) { + } else if (this.iSessionProperties.getSslListenerPeerVerification().equalsIgnoreCase("accept")) { logger.trace(Level.FINER, "Listener peer verification: accept"); ((SSLServerSocket) this.iServerSocket).setWantClientAuth(true); } else { @@ -151,22 +152,19 @@ public HttpServerConnection(HttpConnectionHandler pHandler, String pLocalAddress ((SSLServerSocket) this.iServerSocket).setNeedClientAuth(true); } - String disableCipherSuites = this.iSessionProperties - .getSslListenerCipherSuitesToDisable(); + String disableCipherSuites = this.iSessionProperties.getSslListenerCipherSuitesToDisable(); if (disableCipherSuites != null) { SSLServerSocket sslSock = (SSLServerSocket) this.iServerSocket; String[] currentCipherSuites = sslSock.getEnabledCipherSuites(); - String[] updatedCipherSuites = Util.getFilteredStringArray(currentCipherSuites, - disableCipherSuites); + String[] updatedCipherSuites = Util.getFilteredStringArray(currentCipherSuites, disableCipherSuites); sslSock.setEnabledCipherSuites(updatedCipherSuites); int before = currentCipherSuites.length; int after = updatedCipherSuites.length; - if (before > 0 && after == 0) logger.trace(Level.WARNING, - "All cipher suites disabled for listener!"); - else if (before > after) logger.trace(Level.FINE, "Some (" + (before - after) - + ") cipher suites disabled for listener"); - else if (before == after) logger.trace(Level.FINER, - "No cipher suites disabled for listener"); + if (before > 0 && after == 0) logger.trace(Level.WARNING, "All cipher suites disabled for listener!"); else if ( + before > after + ) logger.trace(Level.FINE, "Some (" + (before - after) + ") cipher suites disabled for listener"); else if ( + before == after + ) logger.trace(Level.FINER, "No cipher suites disabled for listener"); } } this.iTimeout = this.iSessionProperties.getListenerHttpTimeout(); @@ -175,7 +173,7 @@ else if (before == after) logger.trace(Level.FINER, /** * Set the name of the thread - * + * * @param pName * The new value */ @@ -185,7 +183,7 @@ public void setName(String pName) { /** * Returns the port - * + * * @return The port */ public int getPort() { @@ -194,7 +192,7 @@ public int getPort() { /** * Returns the local ip address the socket is bound to - * + * * @return The ip address * @throws UnknownHostException */ @@ -206,7 +204,7 @@ public String getLocalIp() throws UnknownHostException { /** * Returns the local hostname the socket is bound to - * + * * @return The host name * @throws UnknownHostException */ @@ -218,7 +216,7 @@ public String getLocalHostName() throws UnknownHostException { /** * Return whether this connection is SSL secured - * + * * @return true if SSL is enabled, false otherwise */ public boolean isSSL() { @@ -232,12 +230,20 @@ public void start() { if (this.iClose) { this.iClose = false; ThreadGroup group = new ThreadGroup("CIMListener on port " + String.valueOf(this.iPort)); - this.iDispatcher = new HttpConnectionDispatcher(group, this.iHandler, new ThreadPool( - this.iSessionProperties.getListenerMinPoolSize(), this.iSessionProperties - .getListenerMaxPoolSize(), - this.iSessionProperties.getListenerBacklog(), this.iSessionProperties - .getListenerMaxIdle(), group, "Handler "), this.iSessionProperties - .getListenerMaxQueueSize()); + this.iDispatcher = + new HttpConnectionDispatcher( + group, + this.iHandler, + new ThreadPool( + this.iSessionProperties.getListenerMinPoolSize(), + this.iSessionProperties.getListenerMaxPoolSize(), + this.iSessionProperties.getListenerBacklog(), + this.iSessionProperties.getListenerMaxIdle(), + group, + "Handler " + ), + this.iSessionProperties.getListenerMaxQueueSize() + ); this.iDispatcher.start(); this.iRunner = new Thread(group, this, this.iServerName); this.iRunner.setDaemon(true); @@ -254,38 +260,32 @@ public void run() { socket.setTcpNoDelay(true); socket.setSoTimeout(this.iTimeout); } catch (IOException e) { - LogAndTraceBroker.getBroker().trace(Level.FINE, - "Exception while adjusting socket options", e); + LogAndTraceBroker.getBroker().trace(Level.FINE, "Exception while adjusting socket options", e); } boolean dispatched = this.iDispatcher.dispatch(socket); if (!dispatched) { MessageWriter writer = new MessageWriter(socket.getOutputStream(), false, false); try { - writer.setMethod(new HttpServerMethod(1, 1, 503, - "Service temporarily overloaded")); + writer.setMethod(new HttpServerMethod(1, 1, 503, "Service temporarily overloaded")); writer.getHeader().addField("Retry-After", "10"); writer.close(); } catch (IOException e) { - LogAndTraceBroker.getBroker().trace(Level.FINE, - "Exception while sending HTTP 503", e); + LogAndTraceBroker.getBroker().trace(Level.FINE, "Exception while sending HTTP 503", e); } finally { socket.close(); } LogAndTraceBroker - .getBroker() - .trace(Level.FINE, - "HttpServerConnection failed to dispatch incoming connection, sent 503"); + .getBroker() + .trace(Level.FINE, "HttpServerConnection failed to dispatch incoming connection, sent 503"); } else { - LogAndTraceBroker.getBroker().trace(Level.FINE, - "HttpServerConnection dispatched incoming connection"); + LogAndTraceBroker.getBroker().trace(Level.FINE, "HttpServerConnection dispatched incoming connection"); } } catch (Throwable t) { if (t instanceof SocketException && this.iClose) { break; } try { - LogAndTraceBroker.getBroker().trace(Level.FINE, - "Exception while waiting for incoming http connections"); + LogAndTraceBroker.getBroker().trace(Level.FINE, "Exception while waiting for incoming http connections"); } catch (Throwable t2) { // just give up } @@ -295,8 +295,7 @@ public void run() { // shutdown try { - LogAndTraceBroker.getBroker().trace(Level.FINE, - "Shutting down CIMListener on port " + this.iPort); + LogAndTraceBroker.getBroker().trace(Level.FINE, "Shutting down CIMListener on port " + this.iPort); } catch (Throwable t) { // do nothing } @@ -310,8 +309,7 @@ public void run() { try { this.iDispatcher.close(); } catch (Exception e) { - LogAndTraceBroker.getBroker().trace(Level.FINE, - "Exception while closing http connection dispatcher", e); + LogAndTraceBroker.getBroker().trace(Level.FINE, "Exception while closing http connection dispatcher", e); } this.iDispatcher = null; this.iRunner = null; @@ -327,8 +325,7 @@ public void close() { this.iServerSocket.close(); this.iServerSocket = null; } catch (Exception e) { - LogAndTraceBroker.getBroker().trace(Level.FINE, - "Exception while closing server socket", e); + LogAndTraceBroker.getBroker().trace(Level.FINE, "Exception while closing server socket", e); } } } @@ -338,10 +335,9 @@ public void close() { * incoming connections to the handlers. It doesn't execute the handler * directly but creates a runnable that is submitted to a thread pool which * takes care of execution. - * + * */ private static class HttpConnectionDispatcher extends Thread { - private BlockingQueue iConnectionPool; private volatile boolean iAlive = true; @@ -352,7 +348,7 @@ private static class HttpConnectionDispatcher extends Thread { /** * Ctor. - * + * * @param pGroup * The thread group to use for this thread and it's children * @param pHandler @@ -362,8 +358,12 @@ private static class HttpConnectionDispatcher extends Thread { * @param pQueueSize * The fixed capacity for the queue of pending connections */ - public HttpConnectionDispatcher(ThreadGroup pGroup, HttpConnectionHandler pHandler, - ThreadPool pPool, int pQueueSize) { + public HttpConnectionDispatcher( + ThreadGroup pGroup, + HttpConnectionHandler pHandler, + ThreadPool pPool, + int pQueueSize + ) { super(pGroup, "Connection Dispatcher"); setDaemon(true); this.iConnectionPool = new ArrayBlockingQueue(pQueueSize > 0 ? pQueueSize : 1); @@ -373,7 +373,7 @@ public HttpConnectionDispatcher(ThreadGroup pGroup, HttpConnectionHandler pHandl /** * Dispatches a connection - * + * * @param pSocket * The socket of the connection * @return true if dispatch was successful @@ -389,7 +389,7 @@ public boolean dispatch(Socket pSocket) { /** * Gets the next pending connection - * + * * @return The socket of the connection */ public Socket getConnection() { @@ -411,8 +411,7 @@ public void run() { } } catch (Throwable t) { try { - LogAndTraceBroker.getBroker().trace(Level.FINE, - "Exception while submitting worker to thread pool", t); + LogAndTraceBroker.getBroker().trace(Level.FINE, "Exception while submitting worker to thread pool", t); } catch (Throwable t1) { // forget it } @@ -421,14 +420,12 @@ public void run() { try { this.iHandler.close(); } catch (Exception e) { - LogAndTraceBroker.getBroker().trace(Level.FINE, - "Exception while closing http connection handler", e); + LogAndTraceBroker.getBroker().trace(Level.FINE, "Exception while closing http connection handler", e); } try { this.iThreadPool.shutdown(); } catch (Exception e) { - LogAndTraceBroker.getBroker().trace(Level.FINE, - "Exception during shut down of thread pool", e); + LogAndTraceBroker.getBroker().trace(Level.FINE, "Exception during shut down of thread pool", e); } } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpServerMethod.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpServerMethod.java index 7ebf745..c6fce4b 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpServerMethod.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpServerMethod.java @@ -47,15 +47,13 @@ import java.io.IOException; import java.io.InputStream; import java.net.HttpURLConnection; - import org.metricshub.wbem.sblim.cimclient.internal.http.io.ASCIIPrintStream; /** * Class HttpServerMethod is responsible for - * + * */ public class HttpServerMethod extends HttpMethod { - private String iMethodName; private String iFile; @@ -70,7 +68,7 @@ public class HttpServerMethod extends HttpMethod { /** * Ctor. - * + * * @param pMajor * Major version * @param pMinor @@ -89,7 +87,7 @@ public HttpServerMethod(int pMajor, int pMinor, int pStatus, String pReason) { /** * Ctor. - * + * * @param pReader * Inputstream * @throws IOException @@ -130,7 +128,7 @@ public HttpServerMethod(InputStream pReader) throws IOException, HttpException { /** * Returns the major version - * + * * @return The major version */ public int getMajorVersion() { @@ -139,7 +137,7 @@ public int getMajorVersion() { /** * Returns the minor version - * + * * @return The minor version */ public int getMinorVersion() { @@ -148,7 +146,7 @@ public int getMinorVersion() { /** * Returns the method name - * + * * @return The method name */ public String getMethodName() { @@ -157,7 +155,7 @@ public String getMethodName() { /** * Returns the file - * + * * @return The file */ public String getFile() { @@ -166,12 +164,11 @@ public String getFile() { /** * Write to a given output stream - * + * * @param pStream * the output stream */ public void write(ASCIIPrintStream pStream) { - pStream.print("HTTP/" + this.iMajor + "." + this.iMinor + " " + this.iStatus + " " - + this.iReason + "\r\n"); + pStream.print("HTTP/" + this.iMajor + "." + this.iMinor + " " + this.iStatus + " " + this.iReason + "\r\n"); } } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpServerWorker.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpServerWorker.java index b9a73ce..7eead34 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpServerWorker.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpServerWorker.java @@ -45,23 +45,21 @@ */ import java.net.Socket; - import org.metricshub.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; import org.metricshub.wbem.sblim.cimclient.internal.logging.Messages; /** * Class HttpServerWorker forwards incoming connections to a handler - * + * */ public class HttpServerWorker implements Runnable { - HttpConnectionHandler iHandler; Socket iSocket; /** * Ctor. - * + * * @param pHandler * The handler * @param pSocket diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpSocketFactory.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpSocketFactory.java index 1cda5a7..9b1510f 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpSocketFactory.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpSocketFactory.java @@ -73,7 +73,6 @@ import java.security.cert.CertificateException; import java.security.cert.X509Certificate; import java.util.logging.Level; - import javax.net.ServerSocketFactory; import javax.net.SocketFactory; import javax.net.ssl.KeyManager; @@ -83,26 +82,24 @@ import javax.net.ssl.TrustManagerFactory; import javax.net.ssl.X509KeyManager; import javax.net.ssl.X509TrustManager; - import org.metricshub.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; import org.metricshub.wbem.sblim.cimclient.internal.logging.Messages; import org.metricshub.wbem.sblim.cimclient.internal.util.WBEMConfiguration; /** * Class HttpSocketFactory manages socket factories - * + * */ public class HttpSocketFactory { - private static HttpSocketFactory cInstance = new HttpSocketFactory(); private HttpSocketFactory() { - // empty + // empty } /** * Returns the singleton instance - * + * * @return The instance */ public static HttpSocketFactory getInstance() { @@ -111,21 +108,20 @@ public static HttpSocketFactory getInstance() { /** * Returns a server socket factory - * + * * @param pContext * The corresponding SSL context or null for * insecure connections - * + * * @return The factory */ public ServerSocketFactory getServerSocketFactory(SSLContext pContext) { - return pContext != null ? pContext.getServerSocketFactory() : ServerSocketFactory - .getDefault(); + return pContext != null ? pContext.getServerSocketFactory() : ServerSocketFactory.getDefault(); } /** * Returns a client socket factory - * + * * @param pContext * The SSL context or null for insecure connections * @return The factory @@ -137,7 +133,7 @@ public SocketFactory getClientSocketFactory(SSLContext pContext) { /** * Returns a SSLContext for client sockets corresponding to a given set of * configuration properties - * + * * @param pProperties * The configuration to apply * @return The SSL context @@ -149,7 +145,7 @@ public SSLContext getClientSSLContext(final WBEMConfiguration pProperties) { /** * Returns a SSLContext for server sockets corresponding to a given set of * configuration properties - * + * * @param pProperties * The configuration to apply * @return The SSL context @@ -161,7 +157,7 @@ public SSLContext getServerSSLContext(final WBEMConfiguration pProperties) { /** * Returns a SSLContext corresponding to a given set of configuration * properties - * + * * @param pProperties * The configuration to apply * @param pIsServer @@ -170,12 +166,10 @@ public SSLContext getServerSSLContext(final WBEMConfiguration pProperties) { * @return The SSL context */ private SSLContext getSSLContext(final WBEMConfiguration pProperties, boolean pIsServer) { - final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); logger.entry(); - final String provider = pIsServer ? pProperties.getSslServerSocketProvider() : pProperties - .getSslSocketProvider(); + final String provider = pIsServer ? pProperties.getSslServerSocketProvider() : pProperties.getSslSocketProvider(); logger.trace(Level.FINER, "Loading JSSE provider:" + provider); final Provider securityProvider; @@ -198,30 +192,31 @@ private SSLContext getSSLContext(final WBEMConfiguration pProperties, boolean pI TrustManager[] trustManager = loadTruststore(pProperties, securityProvider, pIsServer); - String sslProtocol = pIsServer ? pProperties.getSslListenerProtocol() : pProperties - .getSslClientProtocol(); + String sslProtocol = pIsServer ? pProperties.getSslListenerProtocol() : pProperties.getSslClientProtocol(); - SSLContext sslContext = SSLContext.getInstance(sslProtocol != null ? sslProtocol - : pProperties.getSslProtocol(), securityProvider); + SSLContext sslContext = SSLContext.getInstance( + sslProtocol != null ? sslProtocol : pProperties.getSslProtocol(), + securityProvider + ); sslContext.init(keyManager, trustManager, null); logger.exit(); return sslContext; - } catch (Exception e) { - logger.trace(Level.FINER, "Exception while initializing SSL context (provider:" - + provider + ")", e); + logger.trace(Level.FINER, "Exception while initializing SSL context (provider:" + provider + ")", e); logger.message(Messages.SSL_CONTEXT_INIT_FAILED); logger.exit(); return null; } } - private TrustManager[] loadTruststore(final WBEMConfiguration pProperties, - final Provider pSecurityProvider, boolean pIsServer) { - + private TrustManager[] loadTruststore( + final WBEMConfiguration pProperties, + final Provider pSecurityProvider, + boolean pIsServer + ) { final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); logger.entry(); @@ -236,37 +231,39 @@ private TrustManager[] loadTruststore(final WBEMConfiguration pProperties, final boolean clientPeerVerification = pProperties.getSslClientPeerVerification(); final String listenerPeerVerification = pProperties.getSslListenerPeerVerification(); - logger.trace(Level.FINER, "Using SSL truststore \"" + truststorePath + "\" (" - + truststoreType + "/" + trustManagerAlgorithm + ")"); + logger.trace( + Level.FINER, + "Using SSL truststore \"" + truststorePath + "\" (" + truststoreType + "/" + trustManagerAlgorithm + ")" + ); - if (pIsServer && listenerPeerVerification.equalsIgnoreCase("ignore") - || (!pIsServer && !clientPeerVerification)) { + if (pIsServer && listenerPeerVerification.equalsIgnoreCase("ignore") || (!pIsServer && !clientPeerVerification)) { trustManager = trustAll; if (truststorePath == null || truststorePath.trim().length() == 0) { - logger.trace(Level.FINER, "Peer verification disabled for " - + (pIsServer ? "Listener" : "Client")); + logger.trace(Level.FINER, "Peer verification disabled for " + (pIsServer ? "Listener" : "Client")); } else { logger.message(Messages.SSL_TRUSTSTORE_INACTIVE); } } else { if (truststorePath == null || truststorePath.trim().length() == 0) { - logger.trace(Level.FINER, "Peer verification enabled for " - + (pIsServer ? "Listener" : "Client") + " but no truststore specified!"); + logger.trace( + Level.FINER, + "Peer verification enabled for " + (pIsServer ? "Listener" : "Client") + " but no truststore specified!" + ); logger.message(Messages.SSL_TRUSTSTORE_NULL); } else { - logger.trace(Level.FINER, "Peer verification enabled for " - + (pIsServer ? "Listener" : "Client")); + logger.trace(Level.FINER, "Peer verification enabled for " + (pIsServer ? "Listener" : "Client")); FileInputStream fis = null; try { final KeyStore trustStore = KeyStore.getInstance(truststoreType); fis = new FileInputStream(truststorePath); trustStore.load(fis, truststorePassword); - final TrustManagerFactory trustManagerFactory = TrustManagerFactory - .getInstance(trustManagerAlgorithm, pSecurityProvider); + final TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance( + trustManagerAlgorithm, + pSecurityProvider + ); trustManagerFactory.init(trustStore); trustManager = trustManagerFactory.getTrustManagers(); - logger.trace(Level.FINER, "Truststore successfully loaded for " - + (pIsServer ? "Listener" : "Client")); + logger.trace(Level.FINER, "Truststore successfully loaded for " + (pIsServer ? "Listener" : "Client")); } catch (FileNotFoundException e) { logger.trace(Level.FINER, "Exception while loading truststore", e); logger.message(Messages.SSL_TRUSTSTORE_NOT_FOUND, truststorePath); @@ -275,9 +272,7 @@ private TrustManager[] loadTruststore(final WBEMConfiguration pProperties, logger.message(Messages.SSL_TRUSTSTORE_NOT_READABLE, truststorePath); } catch (NoSuchAlgorithmException e) { logger.trace(Level.FINER, "Exception while loading truststore", e); - logger - .message(Messages.SSL_TRUSTSTORE_INVALID_ALGORITHM, - trustManagerAlgorithm); + logger.message(Messages.SSL_TRUSTSTORE_INVALID_ALGORITHM, trustManagerAlgorithm); } catch (CertificateException e) { logger.trace(Level.FINER, "Exception while loading truststore", e); logger.message(Messages.SSL_TRUSTSTORE_INVALID_CERT, truststorePath); @@ -311,9 +306,11 @@ private TrustManager[] loadTruststore(final WBEMConfiguration pProperties, return trustManager; } - private KeyManager[] loadKeystore(final WBEMConfiguration pProperties, - final Provider pSecurityProvider, boolean pIsServer) { - + private KeyManager[] loadKeystore( + final WBEMConfiguration pProperties, + final Provider pSecurityProvider, + boolean pIsServer + ) { final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); logger.entry(); @@ -325,16 +322,16 @@ private KeyManager[] loadKeystore(final WBEMConfiguration pProperties, final String keystoreType = pProperties.getSslKeyStoreType(); final String keyManagerAlgorithm = pProperties.getSslKeyManagerAlgorithm(); - logger.trace(Level.FINER, "Using SSL keystore \"" + keystorePath + "\" (" + keystoreType - + "/" + keyManagerAlgorithm + ")"); + logger.trace( + Level.FINER, + "Using SSL keystore \"" + keystorePath + "\" (" + keystoreType + "/" + keyManagerAlgorithm + ")" + ); if (keystorePath == null || keystorePath.trim().length() == 0) { - logger.trace(Level.FINER, "Keystore not specified for " - + (pIsServer ? "Listener" : "Client")); + logger.trace(Level.FINER, "Keystore not specified for " + (pIsServer ? "Listener" : "Client")); logger.message(Messages.SSL_KEYSTORE_NULL); } else { - logger.trace(Level.FINER, "Keystore specified and activated for " - + (pIsServer ? "Listener" : "Client")); + logger.trace(Level.FINER, "Keystore specified and activated for " + (pIsServer ? "Listener" : "Client")); FileInputStream fis = null; try { final KeyStore keystore = KeyStore.getInstance(keystoreType); @@ -342,11 +339,12 @@ private KeyManager[] loadKeystore(final WBEMConfiguration pProperties, keystore.load(fis, keystorePassword); final KeyManagerFactory keymanagerfactory = KeyManagerFactory.getInstance( - keyManagerAlgorithm, pSecurityProvider); + keyManagerAlgorithm, + pSecurityProvider + ); keymanagerfactory.init(keystore, keystorePassword); keyManager = keymanagerfactory.getKeyManagers(); - logger.trace(Level.FINER, "Keystore successfully loaded for " - + (pIsServer ? "Listener" : "Client")); + logger.trace(Level.FINER, "Keystore successfully loaded for " + (pIsServer ? "Listener" : "Client")); } catch (FileNotFoundException e) { logger.trace(Level.FINER, "Exception while loading keystore", e); logger.message(Messages.SSL_KEYSTORE_NOT_FOUND, keystorePath); @@ -386,7 +384,6 @@ private KeyManager[] loadKeystore(final WBEMConfiguration pProperties, logger.exit(); return keyManager; } - } class AllTrustManager implements X509TrustManager { diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpUrlConnection.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpUrlConnection.java index b18b6e2..9068487 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpUrlConnection.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/HttpUrlConnection.java @@ -53,15 +53,13 @@ import java.net.SocketPermission; import java.net.URI; import java.security.Permission; - import org.metricshub.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; /** * Class HttpUrlConnection encapsulates a http connection - * + * */ public class HttpUrlConnection extends HttpURLConnection { - private boolean iConnected; private HttpClient iHttpClient; @@ -74,7 +72,7 @@ public class HttpUrlConnection extends HttpURLConnection { /** * Ctor. - * + * * @param pUri * The host URI * @param pHttpClientPool @@ -82,8 +80,7 @@ public class HttpUrlConnection extends HttpURLConnection { * @param pAuthHandler * The authentication handler */ - public HttpUrlConnection(URI pUri, HttpClientPool pHttpClientPool, - AuthorizationHandler pAuthHandler) { + public HttpUrlConnection(URI pUri, HttpClientPool pHttpClientPool, AuthorizationHandler pAuthHandler) { super(null); this.iUrl = pUri; this.iHttpClientPool = pHttpClientPool; @@ -93,9 +90,15 @@ public HttpUrlConnection(URI pUri, HttpClientPool pHttpClientPool, @Override public String toString() { - return "HttpUrlConnection=[url=" + this.iUrl + ",PoolSize=" - + this.iHttpClientPool.getNumberOfAvailableConnections() + "," + this.iAuthHandler - + "]"; + return ( + "HttpUrlConnection=[url=" + + this.iUrl + + ",PoolSize=" + + this.iHttpClientPool.getNumberOfAvailableConnections() + + "," + + this.iAuthHandler + + "]" + ); } @Override @@ -198,7 +201,7 @@ public boolean usingProxy() { /** * Returns the http client - * + * * @return The http client */ public synchronized HttpClient getHttpClient() { @@ -258,7 +261,7 @@ public synchronized String getResponseMessage() { /** * Enables/Disables the use of http 1.1 - * + * * @param pUse11 * If true http 1.1 is enabled. */ diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/MessageReader.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/MessageReader.java index 170e606..1134f6c 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/MessageReader.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/MessageReader.java @@ -51,7 +51,6 @@ import java.io.IOException; import java.io.InputStream; import java.util.logging.Level; - import org.metricshub.wbem.sblim.cimclient.internal.http.io.BoundedInputStream; import org.metricshub.wbem.sblim.cimclient.internal.http.io.ChunkedInputStream; import org.metricshub.wbem.sblim.cimclient.internal.http.io.PersistentInputStream; @@ -59,10 +58,9 @@ /** * Class MessageReader is responsible for reading http messages - * + * */ public class MessageReader { - HttpHeader iHeader; HttpServerMethod iMethod; @@ -75,7 +73,7 @@ public class MessageReader { /** * Ctor. - * + * * @param pStream * The input stream * @param pTimeout @@ -97,8 +95,7 @@ public MessageReader(InputStream pStream, int pTimeout) throws IOException, Http try { contentLength = Integer.parseInt(length); } catch (Exception e) { - LogAndTraceBroker.getBroker().trace(Level.FINER, - "Exception while parsing http content-length", e); + LogAndTraceBroker.getBroker().trace(Level.FINER, "Exception while parsing http content-length", e); } } String contentType = this.iHeader.getField("Content-Type"); @@ -109,16 +106,14 @@ public MessageReader(InputStream pStream, int pTimeout) throws IOException, Http } catch (Exception e) { encoding = "UTF-8"; // TODO is this the default character // encoding? - LogAndTraceBroker.getBroker().trace(Level.FINER, - "Exception while parsing http content-type", e); + LogAndTraceBroker.getBroker().trace(Level.FINER, "Exception while parsing http content-type", e); } this.iEncoding = encoding; } this.iContent = new PersistentInputStream(pStream, isPersistentConnectionSupported()); if (this.iChunked) { - this.iContent = new ChunkedInputStream(this.iContent, this.iHeader.getField("Trailer"), - "Indication Request"); + this.iContent = new ChunkedInputStream(this.iContent, this.iHeader.getField("Trailer"), "Indication Request"); } else if (contentLength >= 0) { this.iContent = new BoundedInputStream(this.iContent, contentLength); } @@ -126,7 +121,7 @@ public MessageReader(InputStream pStream, int pTimeout) throws IOException, Http /** * Returns the character encoding - * + * * @return The character encoding */ public String getCharacterEncoding() { @@ -135,7 +130,7 @@ public String getCharacterEncoding() { /** * Returns the http header - * + * * @return The http header */ public HttpHeader getHeader() { @@ -144,7 +139,7 @@ public HttpHeader getHeader() { /** * Returns the http server method - * + * * @return The http server method */ public HttpServerMethod getMethod() { @@ -153,7 +148,7 @@ public HttpServerMethod getMethod() { /** * Returns the input stream - * + * * @return The input stream */ public InputStream getInputStream() { @@ -162,7 +157,7 @@ public InputStream getInputStream() { /** * Returns the persistent connection support state - * + * * @return true if persistent connection is supported */ public boolean isPersistentConnectionSupported() { @@ -177,21 +172,23 @@ public boolean isPersistentConnectionSupported() { /** * Returns the chunking support state - * + * * @return true if chunking is supported */ public boolean isChunkSupported() { // TODO: make sure this is the correct way to test for chunk support if ((this.iMethod.getMajorVersion() >= 1) && (this.iMethod.getMinorVersion() >= 1)) { String TE; - if ((TE = this.iHeader.getField("TE")) != null && (TE.equalsIgnoreCase("trailers"))) { return true; } + if ((TE = this.iHeader.getField("TE")) != null && (TE.equalsIgnoreCase("trailers"))) { + return true; + } } return false; } /** * Closes the stream - * + * * @throws IOException */ public void close() throws IOException { diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/MessageWriter.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/MessageWriter.java index f9c344a..08fb514 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/MessageWriter.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/MessageWriter.java @@ -51,7 +51,6 @@ import java.io.IOException; import java.io.OutputStream; import java.util.logging.Level; - import org.metricshub.wbem.sblim.cimclient.internal.http.io.ASCIIPrintStream; import org.metricshub.wbem.sblim.cimclient.internal.http.io.ChunkedOutputStream; import org.metricshub.wbem.sblim.cimclient.internal.http.io.PersistentOutputStream; @@ -59,10 +58,9 @@ /** * Class MessageWriter is responsible for creating http messages - * + * */ public class MessageWriter { - HttpHeader iHeader = null; HttpServerMethod iMethod = null; @@ -81,7 +79,7 @@ public class MessageWriter { /** * Ctor. - * + * * @param pStream * @param pPersistent * @param pChunked @@ -92,15 +90,14 @@ public MessageWriter(OutputStream pStream, boolean pPersistent, boolean pChunked this.iPersistent = pPersistent; this.iBufferedOS = new ByteArrayOutputStream(); if (pChunked) { - this.iClientOS = new ASCIIPrintStream(new ChunkedOutputStream( - new PersistentOutputStream(this.iBufferedOS, pPersistent), 512)); + this.iClientOS = + new ASCIIPrintStream(new ChunkedOutputStream(new PersistentOutputStream(this.iBufferedOS, pPersistent), 512)); } else { - this.iClientOS = new ASCIIPrintStream(new PersistentOutputStream(this.iBufferedOS, - pPersistent)); + this.iClientOS = new ASCIIPrintStream(new PersistentOutputStream(this.iBufferedOS, pPersistent)); } this.iHeader = new HttpHeader(); - this.iMethod = new HttpServerMethod(HttpConnectionHandler.MAJOR_VERSION, - HttpConnectionHandler.MINOR_VERSION, 200, "OK"); + this.iMethod = + new HttpServerMethod(HttpConnectionHandler.MAJOR_VERSION, HttpConnectionHandler.MINOR_VERSION, 200, "OK"); } /** @@ -112,7 +109,7 @@ public void reset() { /** * Sets the http header - * + * * @param header * The new value */ @@ -122,7 +119,7 @@ public void setHeader(HttpHeader header) { /** * Sets the http server method - * + * * @param method * The new value */ @@ -132,7 +129,7 @@ public void setMethod(HttpServerMethod method) { /** * Returns the http header - * + * * @return The http header */ public HttpHeader getHeader() { @@ -141,7 +138,7 @@ public HttpHeader getHeader() { /** * Returns the http server method - * + * * @return The http server method */ public HttpServerMethod getMethod() { @@ -150,7 +147,7 @@ public HttpServerMethod getMethod() { /** * Returns the output stream - * + * * @return The output stream */ public ASCIIPrintStream getOutputStream() { @@ -159,29 +156,32 @@ public ASCIIPrintStream getOutputStream() { /** * Write the message and flushes the streams - * + * * @throws IOException */ public void close() throws IOException { this.iMethod.write(this.iRealOS); this.iRealOS.flush(); - if (!this.iChunked) this.iHeader.removeField("Transfer-Encoding"); - else this.iHeader.addField("Transfer-Encoding", "chunked"); - if (this.iPersistent) this.iHeader.addField("Connection", "Keep-iAlive"); - else this.iHeader.addField("Connection", "close"); + if (!this.iChunked) this.iHeader.removeField("Transfer-Encoding"); else this.iHeader.addField( + "Transfer-Encoding", + "chunked" + ); + if (this.iPersistent) this.iHeader.addField("Connection", "Keep-iAlive"); else this.iHeader.addField( + "Connection", + "close" + ); this.iHeader.addField("Content-Type", "application/xml;charset=\"utf-8\""); - if (!this.iChunked) this.iHeader.addField("Content-length", Integer - .toString(this.iBufferedOS.size())); - LogAndTraceBroker.getBroker().trace(Level.FINER, - "Indication Response HTTP Headers= " + this.iHeader.toString()); + if (!this.iChunked) this.iHeader.addField("Content-length", Integer.toString(this.iBufferedOS.size())); + LogAndTraceBroker.getBroker().trace(Level.FINER, "Indication Response HTTP Headers= " + this.iHeader.toString()); this.iHeader.write(this.iRealOS); this.iRealOS.flush(); if (this.iChunked) this.iClientOS.close(); this.iBufferedOS.writeTo(this.iRealOS); if (this.iChunked && (this.iTrailer != null)) { - LogAndTraceBroker.getBroker().trace(Level.FINER, - "Indication Response HTTP Trailer Headers= " + this.iTrailer.toString()); + LogAndTraceBroker + .getBroker() + .trace(Level.FINER, "Indication Response HTTP Trailer Headers= " + this.iTrailer.toString()); this.iTrailer.write(this.iRealOS); } this.iRealOS.flush(); @@ -189,7 +189,7 @@ public void close() throws IOException { /** * Sets the trailer - * + * * @param pTrailer * The new value */ diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/PegasusLocalAuthInfo.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/PegasusLocalAuthInfo.java index 408539a..4fb7662 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/PegasusLocalAuthInfo.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/PegasusLocalAuthInfo.java @@ -52,7 +52,6 @@ import java.io.InputStreamReader; import java.net.URI; import java.util.logging.Level; - import org.metricshub.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; import org.metricshub.wbem.sblim.cimclient.internal.logging.Messages; import org.metricshub.wbem.sblim.cimclient.internal.util.WBEMConstants; @@ -61,7 +60,6 @@ * Implements OpenPegasus local authentication */ public class PegasusLocalAuthInfo extends AuthorizationInfo { - private boolean iChallenged = false; /** @@ -73,7 +71,7 @@ public PegasusLocalAuthInfo() { /* * (non-Javadoc) - * + * * @see * org.sblim.cimclient.internal.http.AuthorizationInfo#updateAuthenticationInfo * (org.sblim.cimclient.internal.http.Challenge, java.net.URI, @@ -86,40 +84,36 @@ public PegasusLocalAuthInfo() { * @param requestMethod */ @Override - public void updateAuthenticationInfo(Challenge challenge, String authenticate, URI url, - String requestMethod) { + public void updateAuthenticationInfo(Challenge challenge, String authenticate, URI url, String requestMethod) { this.iChallenged = true; this.iResponse = authenticate; } /* * (non-Javadoc) - * + * * @see java.lang.Object#toString() */ @Override public String toString() { - if (this.iChallenged && this.iResponse != null && this.iResponse.startsWith("Local ")) { - String fileName = ""; BufferedReader in = null; try { - fileName = this.iResponse.substring(7, this.iResponse.length() - 1); - if (fileName.length() == 0) throw new IOException( - "No local authorization file specified"); + if (fileName.length() == 0) throw new IOException("No local authorization file specified"); File authorizationFile = new File(fileName); - if (!authorizationFile.canRead()) throw new IOException( - "Local authorization file not accessible"); + if (!authorizationFile.canRead()) throw new IOException("Local authorization file not accessible"); - in = WBEMConstants.Z_OS.equals(System.getProperty(WBEMConstants.OS_NAME)) ? new BufferedReader( - new InputStreamReader(new FileInputStream(authorizationFile), - WBEMConstants.ISO_8859_1)) + in = + WBEMConstants.Z_OS.equals(System.getProperty(WBEMConstants.OS_NAME)) + ? new BufferedReader( + new InputStreamReader(new FileInputStream(authorizationFile), WBEMConstants.ISO_8859_1) + ) : new BufferedReader(new FileReader(authorizationFile)); StringBuffer buffer = new StringBuffer(); @@ -141,19 +135,18 @@ public String toString() { header.append('"'); return header.toString(); - } catch (IOException e) { LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); - logger.trace(Level.FINER, - "Exception while reading OpenPegasus local authorization file", e); + logger.trace(Level.FINER, "Exception while reading OpenPegasus local authorization file", e); logger.message(Messages.HTTP_PEGASUS_LOCAL_AUTH_READ, fileName); } finally { if (in != null) { try { in.close(); } catch (IOException e) { - LogAndTraceBroker.getBroker().trace(Level.FINER, - "Exception while closing OpenPegasus local authorization file", e); + LogAndTraceBroker + .getBroker() + .trace(Level.FINER, "Exception while closing OpenPegasus local authorization file", e); } } } @@ -176,5 +169,4 @@ public boolean isSentOnFirstRequest() { public boolean isKeptAlive() { return true; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/WwwAuthInfo.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/WwwAuthInfo.java index b9dd392..30d50b1 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/WwwAuthInfo.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/WwwAuthInfo.java @@ -66,7 +66,7 @@ public WwwAuthInfo() { /* * (non-Javadoc) - * + * * @see java.lang.Object#toString() */ @Override @@ -76,21 +76,31 @@ public String toString() { String _nc = Long.toHexString(this.iNc); if (this.iScheme.equalsIgnoreCase("Digest")) { - if (this.iRealm == null) { // support for some ICAT CIMOMs buggy // Digest authentication try { MessageDigest messageDigest = null; messageDigest = MessageDigest.getInstance("MD5"); - messageDigest.update(getBytes((this.iCredentials != null && this.iCredentials - .getUserName() != null) ? String.valueOf(this.iCredentials - .getPassword()) : "null", "UTF-8")); + messageDigest.update( + getBytes( + (this.iCredentials != null && this.iCredentials.getUserName() != null) + ? String.valueOf(this.iCredentials.getPassword()) + : "null", + "UTF-8" + ) + ); String pass = HttpClient.convertToHexString(messageDigest.digest()); - return "Digest username=" - + ((this.iCredentials != null && this.iCredentials.getUserName() != null) ? this.iCredentials - .getUserName() - : "null") + ", response=" + pass; + return ( + "Digest username=" + + ( + (this.iCredentials != null && this.iCredentials.getUserName() != null) + ? this.iCredentials.getUserName() + : "null" + ) + + ", response=" + + pass + ); } catch (NoSuchAlgorithmException e) { // TODO log e.printStackTrace(); @@ -99,10 +109,11 @@ public String toString() { result.append(this.iScheme); result.append(" username=\""); - result - .append((this.iCredentials != null && this.iCredentials.getUserName() != null) ? this.iCredentials - .getUserName() - : "null"); + result.append( + (this.iCredentials != null && this.iCredentials.getUserName() != null) + ? this.iCredentials.getUserName() + : "null" + ); result.append("\""); if (this.iRealm != null) { result.append(", realm=\""); @@ -143,19 +154,20 @@ public String toString() { result.append(_nc); } } else if (this.iScheme.equalsIgnoreCase("Basic")) { - result.append("Basic "); StringBuffer tmp = new StringBuffer(); - tmp - .append((this.iCredentials != null && this.iCredentials.getUserName() != null) ? this.iCredentials - .getUserName() - : "null"); + tmp.append( + (this.iCredentials != null && this.iCredentials.getUserName() != null) + ? this.iCredentials.getUserName() + : "null" + ); tmp.append(':'); - tmp - .append((this.iCredentials != null && this.iCredentials.getPassword() != null) ? String - .valueOf(this.iCredentials.getPassword()) - : "null"); + tmp.append( + (this.iCredentials != null && this.iCredentials.getPassword() != null) + ? String.valueOf(this.iCredentials.getPassword()) + : "null" + ); result.append(BASE64Encoder.encode(getBytes(tmp.toString(), "UTF-8"))); } @@ -164,7 +176,7 @@ public String toString() { /** * Splits a comma-separated string into multiple substrings - * + * * @param pLine * The comma-separated string * @return The array of substrings (excluding commas) @@ -195,7 +207,7 @@ private static byte[] getBytes(String str, String encoding) { /* * (non-Javadoc) - * + * * @see * org.sblim.cimclient.internal.http.AuthorizationInfo#updateAuthenticationInfo * (org.sblim.cimclient.internal.http.Challenge, java.net.URI, @@ -205,15 +217,16 @@ private static byte[] getBytes(String str, String encoding) { * @param authenticate */ @Override - public void updateAuthenticationInfo(Challenge challenge, String authenticate, URI url, - String requestMethod) throws NoSuchAlgorithmException { - + public void updateAuthenticationInfo(Challenge challenge, String authenticate, URI url, String requestMethod) + throws NoSuchAlgorithmException { setURI(url.getPath()); HttpHeader params = challenge.getParams(); this.iScheme = challenge.getScheme(); - if (!this.iScheme.equalsIgnoreCase("Digest")) { return; } + if (!this.iScheme.equalsIgnoreCase("Digest")) { + return; + } this.iRealm = params.getField("realm"); @@ -282,14 +295,12 @@ public void updateAuthenticationInfo(Challenge challenge, String authenticate, U messageDigest.reset(); PasswordAuthentication credentials1 = getCredentials(); - this.iA1 = credentials1.getUserName() + ":" + getRealm() + ":" - + String.valueOf(credentials1.getPassword()); + this.iA1 = credentials1.getUserName() + ":" + getRealm() + ":" + String.valueOf(credentials1.getPassword()); // System.out.println("Base:"+A1); messageDigest.update(getBytes(this.iA1, "UTF-8")); if ("md5-sess".equalsIgnoreCase(algorithm)) { messageDigest.update(getBytes((":" + getNonce() + ":" + getCnonce()), "UTF-8")); - } byte[] digest1 = messageDigest.digest(); @@ -320,18 +331,33 @@ public void updateAuthenticationInfo(Challenge challenge, String authenticate, U messageDigest.update(getBytes((sessionKey + ":" + nonce + ":" + A2), "UTF-8")); } else { String _nc = Long.toHexString(challengeNc); - messageDigest.update(getBytes((sessionKey + ":" + nonce + ":" - + "00000000".substring(_nc.length()) + _nc + ":" + getCnonce() + ":" + qop - + ":" + A2), "UTF-8")); + messageDigest.update( + getBytes( + ( + sessionKey + + ":" + + nonce + + ":" + + "00000000".substring(_nc.length()) + + _nc + + ":" + + getCnonce() + + ":" + + qop + + ":" + + A2 + ), + "UTF-8" + ) + ); } this.iResponse = HttpClient.convertToHexString(messageDigest.digest()); - // TODO handle digest-required header } /* * (non-Javadoc) - * + * * @see * org.sblim.cimclient.internal.http.AuthorizationInfo#getHeaderFieldName() */ @@ -342,7 +368,7 @@ public String getHeaderFieldName() { /* * (non-Javadoc) - * + * * @see * org.sblim.cimclient.internal.http.AuthorizationInfo#isSentOnFirstRequest * () diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/ASCIIPrintStream.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/ASCIIPrintStream.java index b384ecd..6b4c495 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/ASCIIPrintStream.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/ASCIIPrintStream.java @@ -53,10 +53,9 @@ /** * Class ASCIIPrintStream implement a stream with ASCII charset - * + * */ public class ASCIIPrintStream extends FilterOutputStream { - private boolean iAutoFlush = false; private Exception iTrouble = null; @@ -71,7 +70,7 @@ private ASCIIPrintStream(boolean autoFlush, OutputStream pOut) { /** * Ctor. - * + * * @param pStream * The underlying stream */ @@ -82,7 +81,7 @@ public ASCIIPrintStream(OutputStream pStream) { /** * Ctor. - * + * * @param pStream * The underlying stream * @param pAutoFlush @@ -96,7 +95,7 @@ public ASCIIPrintStream(OutputStream pStream, boolean pAutoFlush) { /** * Ctor. - * + * * @param pStream * The underlying stream * @param pAutoFlush @@ -118,15 +117,14 @@ private void write(String str) { char charArray[] = new char[stringLength]; byte asciiArray[] = new byte[stringLength]; str.getChars(0, stringLength, charArray, 0); - for (int i = 0; i < stringLength; i++) - asciiArray[i] = charArray[i] >= '\u0100' ? 63 : (byte) charArray[i]; + for (int i = 0; i < stringLength; i++) asciiArray[i] = charArray[i] >= '\u0100' ? 63 : (byte) charArray[i]; write(asciiArray, 0, stringLength); } /** * Prints a boolean value - * + * * @param pValue * The value */ @@ -136,7 +134,7 @@ public void print(boolean pValue) { /** * Prints a single character - * + * * @param c * The character */ @@ -146,7 +144,7 @@ public void print(char c) { /** * Prints an integer value - * + * * @param i * The value */ @@ -156,7 +154,7 @@ public void print(int i) { /** * Prints a long value - * + * * @param l * The value */ @@ -166,7 +164,7 @@ public void print(long l) { /** * Prints a float value - * + * * @param f * The value */ @@ -176,7 +174,7 @@ public void print(float f) { /** * Prints a double value - * + * * @param d * The value */ @@ -186,7 +184,7 @@ public void print(double d) { /** * Prints a character array - * + * * @param pArray * The array */ @@ -196,7 +194,7 @@ public void print(char pArray[]) { /** * Prints a string - * + * * @param s * The string */ @@ -206,7 +204,7 @@ public void print(String s) { /** * Prints an object - * + * * @param pObj * The object */ @@ -223,7 +221,7 @@ public void println() { /** * println - * + * * @param flag */ public void println(boolean flag) { @@ -235,7 +233,7 @@ public void println(boolean flag) { /** * println - * + * * @param c */ public void println(char c) { @@ -247,7 +245,7 @@ public void println(char c) { /** * println - * + * * @param i */ public void println(int i) { @@ -259,7 +257,7 @@ public void println(int i) { /** * println - * + * * @param l */ public void println(long l) { @@ -271,7 +269,7 @@ public void println(long l) { /** * println - * + * * @param f */ public void println(float f) { @@ -283,7 +281,7 @@ public void println(float f) { /** * println - * + * * @param d */ public void println(double d) { @@ -295,7 +293,7 @@ public void println(double d) { /** * println - * + * * @param ac */ public void println(char ac[]) { @@ -307,7 +305,7 @@ public void println(char ac[]) { /** * println - * + * * @param s */ public void println(String s) { @@ -319,7 +317,7 @@ public void println(String s) { /** * println - * + * * @param obj */ public void println(Object obj) { @@ -376,12 +374,12 @@ public void write(int b) { } protected void setError() { - // trouble = x; + // trouble = x; } /** * Returns the last exception caught - * + * * @return The exception */ public Exception checkError() { diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/BoundedInputStream.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/BoundedInputStream.java index e066d22..b6c2615 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/BoundedInputStream.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/BoundedInputStream.java @@ -47,17 +47,16 @@ /** * Class BoundedInputStream implements an input stream with a maximum byte * count. - * + * */ public class BoundedInputStream extends FilterInputStream { - private long maxLen, used; private boolean closed = false; /** * Ctor. Creates the stream with unlimited length. - * + * * @param pStream * The stream this one is build upon */ @@ -67,7 +66,7 @@ public BoundedInputStream(InputStream pStream) { /** * Ctor. - * + * * @param pStream * The stream this one is build upon * @param pMaximumLength @@ -131,7 +130,9 @@ public long skip(long len) throws IOException { @Override public int available() throws IOException { - if (this.maxLen > -1) { return (int) (this.maxLen - this.used); } + if (this.maxLen > -1) { + return (int) (this.maxLen - this.used); + } return this.in.available(); } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/ChunkedInputStream.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/ChunkedInputStream.java index 87b36c4..942b1fb 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/ChunkedInputStream.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/ChunkedInputStream.java @@ -54,17 +54,15 @@ import java.io.IOException; import java.io.InputStream; import java.util.logging.Level; - import org.metricshub.wbem.sblim.cimclient.internal.http.HttpHeader; import org.metricshub.wbem.sblim.cimclient.internal.http.HttpMethod; import org.metricshub.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; /** * Class ChunkedInputStream implements an input stream for chunked messages - * + * */ public class ChunkedInputStream extends InputStream { - private InputStream iIn; private String iTrailerFields; @@ -83,7 +81,7 @@ public class ChunkedInputStream extends InputStream { /** * Ctor. - * + * * @param pStream * The stream to create this one upon * @param pTrailerFields @@ -95,7 +93,7 @@ public ChunkedInputStream(InputStream pStream, String pTrailerFields) { /** * Ctor. - * + * * @param pStream * The stream to create this one upon * @param pTrailerFields @@ -136,25 +134,26 @@ public synchronized int read(byte[] buf, int off, int len) throws IOException { try { this.iChunkSize = Long.parseLong(line, 16); } catch (Exception e) { - LogAndTraceBroker.getBroker().trace(Level.FINER, - "Invalid chunk size on HTTP stream", e); + LogAndTraceBroker.getBroker().trace(Level.FINER, "Invalid chunk size on HTTP stream", e); this.iEof = true; throw new IOException("Invalid chunk size"); } } if (this.iChunkSize > 0) { - total = this.iIn.read(buf, off, (this.iChunkSize < len) ? (int) this.iChunkSize - : (int) len); + total = this.iIn.read(buf, off, (this.iChunkSize < len) ? (int) this.iChunkSize : (int) len); if (total > 0) { this.iChunkSize -= total; } if (total == -1) { - LogAndTraceBroker.getBroker().trace( + LogAndTraceBroker + .getBroker() + .trace( Level.FINE, - "Unexpected EOF trying to read " - + (this.iChunkSize < len ? this.iChunkSize : len) - + " bytes from HTTP chunk with remaining length of " - + this.iChunkSize); + "Unexpected EOF trying to read " + + (this.iChunkSize < len ? this.iChunkSize : len) + + " bytes from HTTP chunk with remaining length of " + + this.iChunkSize + ); throw new EOFException("Unexpected EOF reading chunk"); } } else { @@ -166,10 +165,9 @@ public synchronized int read(byte[] buf, int off, int len) throws IOException { // ebak: http trailers this.iTrailers.examineTrailer(this.iOrigin); } catch (IOException e) { - LogAndTraceBroker.getBroker().trace( - Level.FINE, - "Unexpected EOF reading trailer, expected fields were " - + this.iTrailerFields); + LogAndTraceBroker + .getBroker() + .trace(Level.FINE, "Unexpected EOF reading trailer, expected fields were " + this.iTrailerFields); throw new EOFException("Unexpected EOF reading trailer"); } } @@ -179,7 +177,7 @@ public synchronized int read(byte[] buf, int off, int len) throws IOException { /** * Return the http header trailers - * + * * @return The trailers */ public synchronized HttpHeader getTrailers() { @@ -194,7 +192,7 @@ public synchronized long skip(long total) throws IOException { /** * @return int - * + * */ @Override public synchronized int available() { diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/ChunkedOutputStream.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/ChunkedOutputStream.java index 76fba9c..e30138a 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/ChunkedOutputStream.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/ChunkedOutputStream.java @@ -50,10 +50,9 @@ /** * Class ChunkedOutputStream implements an output stream for chunked messages - * + * */ public class ChunkedOutputStream extends OutputStream { - DataOutputStream iOs; byte[] iBuffer; @@ -62,7 +61,7 @@ public class ChunkedOutputStream extends OutputStream { /** * Ctor. - * + * * @param pStream * The stream to create this one upon * @param pBufferLength @@ -100,8 +99,7 @@ public void flush() throws IOException { public void write(byte source[], int offset, int len) throws IOException { int copied = 0; while (len > 0) { - int total = (this.iBuffer.length - this.iUsed < len) ? (this.iBuffer.length - this.iUsed) - : len; + int total = (this.iBuffer.length - this.iUsed < len) ? (this.iBuffer.length - this.iUsed) : len; if (total > 0) { System.arraycopy(source, copied, this.iBuffer, this.iUsed, total); len -= total; @@ -117,5 +115,4 @@ public void write(int i) throws IOException { if (this.iBuffer.length == this.iUsed) flush(); this.iBuffer[this.iUsed++] = (byte) (0xFF & i); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/DebugInputStream.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/DebugInputStream.java index bbc3dec..2578038 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/DebugInputStream.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/DebugInputStream.java @@ -51,16 +51,14 @@ import java.io.InputStream; import java.io.OutputStream; import java.util.logging.Level; - import org.metricshub.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; import org.metricshub.wbem.sblim.cimclient.internal.logging.TimeStamp; /** * Class DebugInputStream is for debugging purposes - * + * */ public class DebugInputStream extends FilterInputStream { - private byte[] iBuf; private boolean iBuffered; @@ -75,7 +73,7 @@ public class DebugInputStream extends FilterInputStream { /** * Ctor. - * + * * @param is * @param os */ @@ -85,7 +83,7 @@ public DebugInputStream(InputStream is, OutputStream os) { /** * Ctor. - * + * * @param is * @param os * @param pOrigin @@ -131,7 +129,8 @@ private void writeBuffer(String header) throws IOException { outStr.append(" end ----->\n"); if (this.iStream != null) this.iStream.write(outStr.toString().getBytes()); if (LogAndTraceBroker.getBroker().isLoggableCIMXMLTrace(Level.FINEST)) LogAndTraceBroker - .getBroker().traceCIMXML(Level.FINEST, outStr.toString(), false); + .getBroker() + .traceCIMXML(Level.FINEST, outStr.toString(), false); } @Override @@ -146,13 +145,16 @@ public synchronized int read() throws IOException { public synchronized int read(byte b[], int off, int len) throws IOException { if (b == null) { throw new NullPointerException(); - } else if ((off < 0) || (off > b.length) || (len < 0) || ((off + len) > b.length) - || ((off + len) < 0)) { + } else if ((off < 0) || (off > b.length) || (len < 0) || ((off + len) > b.length) || ((off + len) < 0)) { throw new IndexOutOfBoundsException(); - } else if (len == 0) { return 0; } + } else if (len == 0) { + return 0; + } int c = read(); - if (c == -1) { return -1; } + if (c == -1) { + return -1; + } b[off] = (byte) c; int i = 1; diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/KeepAliveInputStream.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/KeepAliveInputStream.java index ff7ff91..1da5a52 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/KeepAliveInputStream.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/KeepAliveInputStream.java @@ -45,21 +45,19 @@ import java.io.FilterInputStream; import java.io.IOException; import java.io.InputStream; - import org.metricshub.wbem.sblim.cimclient.internal.http.HttpClient; /** * Class KeepAliveInputStream implements an input stream for connections that * keep iAlive after a request is completed - * + * */ public class KeepAliveInputStream extends FilterInputStream { - private HttpClient iClient; /** * Ctor. - * + * * @param pStream * The underlying stream * @param pClient diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/PersistentInputStream.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/PersistentInputStream.java index ebff1d6..01dbdca 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/PersistentInputStream.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/PersistentInputStream.java @@ -49,17 +49,16 @@ /** * Class PersistentInputStream implements an input stream for which close() can * be disabled. - * + * */ public class PersistentInputStream extends FilterInputStream { - boolean iClosable = false; boolean iClosed = false; /** * Ctor. - * + * * @param pStream * The underlying stream */ @@ -69,7 +68,7 @@ public PersistentInputStream(InputStream pStream) { /** * Ctor. - * + * * @param pStream * The underlying stream * @param pClosable diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/PersistentOutputStream.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/PersistentOutputStream.java index 16fe80b..1c9450f 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/PersistentOutputStream.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/PersistentOutputStream.java @@ -51,14 +51,13 @@ * can be disabled. */ public class PersistentOutputStream extends FilterOutputStream { - boolean iClosable = false; boolean iClosed = false; /** * Ctor. - * + * * @param pStream * The underlying stream */ @@ -68,7 +67,7 @@ public PersistentOutputStream(OutputStream pStream) { /** * Ctor. - * + * * @param pStream * The underlying stream * @param pClosable diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/TrailerException.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/TrailerException.java index 8c606f3..b01ce75 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/TrailerException.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/http/io/TrailerException.java @@ -49,30 +49,35 @@ * Pegasus CIMOM. */ public class TrailerException extends RuntimeException { - private static final long serialVersionUID = 4355341648542585509L; private WBEMException iWBEMException; /** * Ctor. - * + * * @param pException * The contained WBEMException */ public TrailerException(WBEMException pException) { - super(WBEMConstants.HTTP_TRAILER_STATUS_CODE + ":" + pException.getID() + " " - + WBEMConstants.HTTP_TRAILER_STATUS_DESCRIPTION + ":" + pException.getMessage()); + super( + WBEMConstants.HTTP_TRAILER_STATUS_CODE + + ":" + + pException.getID() + + " " + + WBEMConstants.HTTP_TRAILER_STATUS_DESCRIPTION + + ":" + + pException.getMessage() + ); this.iWBEMException = pException; } /** * getWBEMException - * + * * @return WBEMException */ public WBEMException getWBEMException() { return this.iWBEMException; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/logging/LogAndTraceBroker.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/logging/LogAndTraceBroker.java index 470b218..96d8f03 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/logging/LogAndTraceBroker.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/logging/LogAndTraceBroker.java @@ -71,14 +71,13 @@ import java.util.logging.Level; import java.util.logging.LogRecord; import java.util.logging.Logger; - +import org.metricshub.wbem.sblim.cimclient.CIMXMLTraceListener; import org.metricshub.wbem.sblim.cimclient.LogAndTraceManager; +import org.metricshub.wbem.sblim.cimclient.LogListener; +import org.metricshub.wbem.sblim.cimclient.TraceListener; import org.metricshub.wbem.sblim.cimclient.WBEMConfigurationProperties; import org.metricshub.wbem.sblim.cimclient.internal.util.WBEMConfiguration; import org.metricshub.wbem.sblim.cimclient.internal.util.WBEMConstants; -import org.metricshub.wbem.sblim.cimclient.CIMXMLTraceListener; -import org.metricshub.wbem.sblim.cimclient.LogListener; -import org.metricshub.wbem.sblim.cimclient.TraceListener; /** * Class LogAndTraceBroker is the central class that implements the logging and @@ -86,10 +85,9 @@ * trace listeners. It sets up the application independent logging. It provides * the API to send log and trace messages and forwards them to the appropriate * listeners. - * + * */ public class LogAndTraceBroker { - private static final String TRACE_LOGGER = "org.metricshub.wbem.sblim.cimclient.trace"; private static final String FILE_LOGGER = "org.metricshub.wbem.sblim.cimclient.file"; @@ -100,7 +98,7 @@ public class LogAndTraceBroker { /** * Returns the singleton instance of the broker - * + * * @return The broker instance */ public static LogAndTraceBroker getBroker() { @@ -113,7 +111,7 @@ public static LogAndTraceBroker getBroker() { * logging is already up. The WBEMConfiguration is initialized * before the logging, so methods in this class cannot assume the logging to * be up and running. - * + * * @return true if the logging is up, false * otherwise */ @@ -179,8 +177,11 @@ private LogAndTraceBroker() { @Override protected void finalize() throws Throwable { try { - if (this.iXmlTraceFile != null && (!this.iXmlTraceFile.equals(System.out)) - && (!this.iXmlTraceFile.equals(System.err))) this.iXmlTraceFile.close(); + if ( + this.iXmlTraceFile != null && + (!this.iXmlTraceFile.equals(System.out)) && + (!this.iXmlTraceFile.equals(System.err)) + ) this.iXmlTraceFile.close(); } catch (IOException e) { // bad luck } finally { @@ -206,15 +207,15 @@ public void registerInternalListeners() { logger.setUseParentHandlers(false); this.iInternalLevelConsole = level.intValue(); if (this.iInternalListenerLogConsole != null) removeLogListener(this.iInternalListenerLogConsole); - this.iInternalListenerLogConsole = new LogListener() { + this.iInternalListenerLogConsole = + new LogListener() { - public void log(Level pLevel, String pMessageKey, String pMessage, - Object[] pParameters) { - LogRecord record = new LogRecord(pLevel, pMessageKey + " " + pMessage); - record.setParameters(pParameters); - logger.log(record); - } - }; + public void log(Level pLevel, String pMessageKey, String pMessage, Object[] pParameters) { + LogRecord record = new LogRecord(pLevel, pMessageKey + " " + pMessage); + record.setParameters(pParameters); + logger.log(record); + } + }; addLogListener(this.iInternalListenerLogConsole); } } catch (Exception e) { @@ -235,15 +236,15 @@ public void log(Level pLevel, String pMessageKey, String pMessage, logger.setUseParentHandlers(false); this.iInternalLevelLogFile = level.intValue(); if (this.iInternalListenerLogFile != null) removeLogListener(this.iInternalListenerLogFile); - this.iInternalListenerLogFile = new LogListener() { + this.iInternalListenerLogFile = + new LogListener() { - public void log(Level pLevel, String pMessageKey, String pMessage, - Object[] pParameters) { - LogRecord record = new LogRecord(pLevel, pMessageKey + " " + pMessage); - record.setParameters(pParameters); - logger.log(record); - } - }; + public void log(Level pLevel, String pMessageKey, String pMessage, Object[] pParameters) { + LogRecord record = new LogRecord(pLevel, pMessageKey + " " + pMessage); + record.setParameters(pParameters); + logger.log(record); + } + }; addLogListener(this.iInternalListenerLogFile); } } catch (Exception e) { @@ -262,22 +263,22 @@ public void log(Level pLevel, String pMessageKey, String pMessage, logger.setUseParentHandlers(false); this.iInternalLevelConsole = level.intValue(); if (this.iInternalListenerTraceConsole != null) removeTraceListener(this.iInternalListenerTraceConsole); - this.iInternalListenerTraceConsole = new TraceListener() { + this.iInternalListenerTraceConsole = + new TraceListener() { - public void trace(Level pLevel, StackTraceElement pOrigin, String pMessage) { - LogRecord record = new LogRecord(pLevel, pMessage); - record.setSourceMethodName(String.valueOf(pOrigin)); - logger.log(record); - } + public void trace(Level pLevel, StackTraceElement pOrigin, String pMessage) { + LogRecord record = new LogRecord(pLevel, pMessage); + record.setSourceMethodName(String.valueOf(pOrigin)); + logger.log(record); + } - public void trace(Level pLevel, StackTraceElement pOrigin, String pMessage, - Throwable pThrown) { - LogRecord record = new LogRecord(pLevel, pMessage); - record.setSourceMethodName(String.valueOf(pOrigin)); - record.setThrown(pThrown); - logger.log(record); - } - }; + public void trace(Level pLevel, StackTraceElement pOrigin, String pMessage, Throwable pThrown) { + LogRecord record = new LogRecord(pLevel, pMessage); + record.setSourceMethodName(String.valueOf(pOrigin)); + record.setThrown(pThrown); + logger.log(record); + } + }; addTraceListener(this.iInternalListenerTraceConsole); } } catch (Exception e) { @@ -298,22 +299,22 @@ public void trace(Level pLevel, StackTraceElement pOrigin, String pMessage, logger.setUseParentHandlers(false); this.iInternalLevelTraceFile = level.intValue(); if (this.iInternalListenerTraceFile != null) removeTraceListener(this.iInternalListenerTraceFile); - this.iInternalListenerTraceFile = new TraceListener() { + this.iInternalListenerTraceFile = + new TraceListener() { - public void trace(Level pLevel, StackTraceElement pOrigin, String pMessage) { - LogRecord record = new LogRecord(pLevel, pMessage); - record.setSourceMethodName(String.valueOf(pOrigin)); - logger.log(record); - } + public void trace(Level pLevel, StackTraceElement pOrigin, String pMessage) { + LogRecord record = new LogRecord(pLevel, pMessage); + record.setSourceMethodName(String.valueOf(pOrigin)); + logger.log(record); + } - public void trace(Level pLevel, StackTraceElement pOrigin, String pMessage, - Throwable pThrown) { - LogRecord record = new LogRecord(pLevel, pMessage); - record.setSourceMethodName(String.valueOf(pOrigin)); - record.setThrown(pThrown); - logger.log(record); - } - }; + public void trace(Level pLevel, StackTraceElement pOrigin, String pMessage, Throwable pThrown) { + LogRecord record = new LogRecord(pLevel, pMessage); + record.setSourceMethodName(String.valueOf(pOrigin)); + record.setThrown(pThrown); + logger.log(record); + } + }; addTraceListener(this.iInternalListenerTraceFile); } } catch (Exception e) { @@ -324,7 +325,7 @@ public void trace(Level pLevel, StackTraceElement pOrigin, String pMessage, /** * Adds a listener for log messages. The listener will be notified of any * log event. Uses copy on write to ensure concurrent read access. - * + * * @param pListener * The listener */ @@ -335,10 +336,10 @@ public synchronized void addLogListener(LogListener pListener) { newListeners.add(pListener); this.iLogListeners = newListeners; - if ((this.iInternalListenerLogFile != null && this.iInternalListenerLogFile - .equals(pListener)) - || (this.iInternalListenerLogConsole != null && this.iInternalListenerLogConsole - .equals(pListener))) { + if ( + (this.iInternalListenerLogFile != null && this.iInternalListenerLogFile.equals(pListener)) || + (this.iInternalListenerLogConsole != null && this.iInternalListenerLogConsole.equals(pListener)) + ) { this.iNumInternalLogListeners++; } else { this.iNumExternalLogListeners++; @@ -370,72 +371,131 @@ private void loadVersionTxt() { } private void sendGreetings(LogListener pListener) { - - pListener.log(MessageLoader.getLevel(Messages.GREETING), Messages.GREETING, MessageLoader - .getLocalizedMessage(Messages.GREETING), new Object[] { this.iProductName, - this.iCopyright }); - pListener.log(MessageLoader.getLevel(Messages.RELEASE), Messages.RELEASE, MessageLoader - .getLocalizedMessage(Messages.RELEASE), new Object[] { this.iVersion, - this.iBuildDate, this.iBuildTime }); - pListener.log(MessageLoader.getLevel(Messages.OS), Messages.OS, MessageLoader - .getLocalizedMessage(Messages.OS), new Object[] { System.getProperty("os.name"), - System.getProperty("os.version"), System.getProperty("os.arch") }); - pListener.log(MessageLoader.getLevel(Messages.JRE), Messages.JRE, MessageLoader - .getLocalizedMessage(Messages.JRE), new Object[] { - System.getProperty("java.version"), System.getProperty("java.vendor") }); - pListener.log(MessageLoader.getLevel(Messages.JVM), Messages.JVM, MessageLoader - .getLocalizedMessage(Messages.JVM), new Object[] { - System.getProperty("java.vm.name"), System.getProperty("java.vm.version"), - System.getProperty("java.vm.vendor") }); - pListener.log(MessageLoader.getLevel(Messages.CONFIGURATION_URL), - Messages.CONFIGURATION_URL, MessageLoader - .getLocalizedMessage(Messages.CONFIGURATION_URL), - new Object[] { WBEMConfiguration.getActiveConfigFullURL() }); + pListener.log( + MessageLoader.getLevel(Messages.GREETING), + Messages.GREETING, + MessageLoader.getLocalizedMessage(Messages.GREETING), + new Object[] { this.iProductName, this.iCopyright } + ); + pListener.log( + MessageLoader.getLevel(Messages.RELEASE), + Messages.RELEASE, + MessageLoader.getLocalizedMessage(Messages.RELEASE), + new Object[] { this.iVersion, this.iBuildDate, this.iBuildTime } + ); + pListener.log( + MessageLoader.getLevel(Messages.OS), + Messages.OS, + MessageLoader.getLocalizedMessage(Messages.OS), + new Object[] { System.getProperty("os.name"), System.getProperty("os.version"), System.getProperty("os.arch") } + ); + pListener.log( + MessageLoader.getLevel(Messages.JRE), + Messages.JRE, + MessageLoader.getLocalizedMessage(Messages.JRE), + new Object[] { System.getProperty("java.version"), System.getProperty("java.vendor") } + ); + pListener.log( + MessageLoader.getLevel(Messages.JVM), + Messages.JVM, + MessageLoader.getLocalizedMessage(Messages.JVM), + new Object[] { + System.getProperty("java.vm.name"), + System.getProperty("java.vm.version"), + System.getProperty("java.vm.vendor") + } + ); + pListener.log( + MessageLoader.getLevel(Messages.CONFIGURATION_URL), + Messages.CONFIGURATION_URL, + MessageLoader.getLocalizedMessage(Messages.CONFIGURATION_URL), + new Object[] { WBEMConfiguration.getActiveConfigFullURL() } + ); if (!WBEMConfiguration.isConfigurationLoadSuccessful()) { - pListener.log(MessageLoader.getLevel(Messages.CONFIGURATION_LOAD_FAILED), - Messages.CONFIGURATION_LOAD_FAILED, MessageLoader - .getLocalizedMessage(Messages.CONFIGURATION_LOAD_FAILED), - (Object[]) null); + pListener.log( + MessageLoader.getLevel(Messages.CONFIGURATION_LOAD_FAILED), + Messages.CONFIGURATION_LOAD_FAILED, + MessageLoader.getLocalizedMessage(Messages.CONFIGURATION_LOAD_FAILED), + (Object[]) null + ); if (WBEMConfiguration.getConfigurationLoadException() != null) { - pListener.log(MessageLoader.getLevel(Messages.EXCEPTION_DURING_CONFIGURATION_LOAD), - Messages.EXCEPTION_DURING_CONFIGURATION_LOAD, MessageLoader - .getLocalizedMessage(Messages.EXCEPTION_DURING_CONFIGURATION_LOAD), - new Object[] { WBEMConfiguration.getConfigurationLoadException() - .getMessage() }); + pListener.log( + MessageLoader.getLevel(Messages.EXCEPTION_DURING_CONFIGURATION_LOAD), + Messages.EXCEPTION_DURING_CONFIGURATION_LOAD, + MessageLoader.getLocalizedMessage(Messages.EXCEPTION_DURING_CONFIGURATION_LOAD), + new Object[] { WBEMConfiguration.getConfigurationLoadException().getMessage() } + ); } } } private void sendGreetings(TraceListener pListener) { StackTraceElement origin = new Throwable().getStackTrace()[0]; - pListener.trace(MessageLoader.getLevel(Messages.GREETING), origin, MessageFormat.format( - MessageLoader.getMessage(Messages.GREETING), new Object[] { this.iProductName, - this.iCopyright })); - pListener.trace(MessageLoader.getLevel(Messages.RELEASE), origin, MessageFormat.format( - MessageLoader.getMessage(Messages.RELEASE), new Object[] { this.iVersion, - this.iBuildDate, this.iBuildTime })); - pListener.trace(MessageLoader.getLevel(Messages.OS), origin, MessageFormat.format( - MessageLoader.getMessage(Messages.OS), new Object[] { - System.getProperty("os.name"), System.getProperty("os.version"), - System.getProperty("os.arch") })); - pListener.trace(MessageLoader.getLevel(Messages.JRE), origin, MessageFormat.format( - MessageLoader.getMessage(Messages.JRE), new Object[] { - System.getProperty("java.version"), System.getProperty("java.vendor") })); - pListener.trace(MessageLoader.getLevel(Messages.JVM), origin, MessageFormat.format( - MessageLoader.getMessage(Messages.JVM), new Object[] { - System.getProperty("java.vm.name"), System.getProperty("java.vm.version"), - System.getProperty("java.vm.vendor") })); - pListener.trace(MessageLoader.getLevel(Messages.CONFIGURATION_URL), origin, MessageFormat - .format(MessageLoader.getMessage(Messages.CONFIGURATION_URL), - new Object[] { WBEMConfiguration.getActiveConfigURL() })); + pListener.trace( + MessageLoader.getLevel(Messages.GREETING), + origin, + MessageFormat.format( + MessageLoader.getMessage(Messages.GREETING), + new Object[] { this.iProductName, this.iCopyright } + ) + ); + pListener.trace( + MessageLoader.getLevel(Messages.RELEASE), + origin, + MessageFormat.format( + MessageLoader.getMessage(Messages.RELEASE), + new Object[] { this.iVersion, this.iBuildDate, this.iBuildTime } + ) + ); + pListener.trace( + MessageLoader.getLevel(Messages.OS), + origin, + MessageFormat.format( + MessageLoader.getMessage(Messages.OS), + new Object[] { System.getProperty("os.name"), System.getProperty("os.version"), System.getProperty("os.arch") } + ) + ); + pListener.trace( + MessageLoader.getLevel(Messages.JRE), + origin, + MessageFormat.format( + MessageLoader.getMessage(Messages.JRE), + new Object[] { System.getProperty("java.version"), System.getProperty("java.vendor") } + ) + ); + pListener.trace( + MessageLoader.getLevel(Messages.JVM), + origin, + MessageFormat.format( + MessageLoader.getMessage(Messages.JVM), + new Object[] { + System.getProperty("java.vm.name"), + System.getProperty("java.vm.version"), + System.getProperty("java.vm.vendor") + } + ) + ); + pListener.trace( + MessageLoader.getLevel(Messages.CONFIGURATION_URL), + origin, + MessageFormat.format( + MessageLoader.getMessage(Messages.CONFIGURATION_URL), + new Object[] { WBEMConfiguration.getActiveConfigURL() } + ) + ); if (!WBEMConfiguration.isConfigurationLoadSuccessful()) { - pListener.trace(MessageLoader.getLevel(Messages.CONFIGURATION_LOAD_FAILED), origin, - MessageLoader.getMessage(Messages.CONFIGURATION_LOAD_FAILED)); + pListener.trace( + MessageLoader.getLevel(Messages.CONFIGURATION_LOAD_FAILED), + origin, + MessageLoader.getMessage(Messages.CONFIGURATION_LOAD_FAILED) + ); if (WBEMConfiguration.getConfigurationLoadException() != null) { - pListener.trace(MessageLoader - .getLevel(Messages.EXCEPTION_DURING_CONFIGURATION_LOAD), origin, - MessageLoader.getMessage(Messages.EXCEPTION_DURING_CONFIGURATION_LOAD), - WBEMConfiguration.getConfigurationLoadException()); + pListener.trace( + MessageLoader.getLevel(Messages.EXCEPTION_DURING_CONFIGURATION_LOAD), + origin, + MessageLoader.getMessage(Messages.EXCEPTION_DURING_CONFIGURATION_LOAD), + WBEMConfiguration.getConfigurationLoadException() + ); } } } @@ -443,7 +503,7 @@ private void sendGreetings(TraceListener pListener) { /** * Remove a listener. This listener will not be notified of log events * anymore. - * + * * @param pListener * The listener */ @@ -452,13 +512,11 @@ public synchronized void removeLogListener(LogListener pListener) { if (!newListeners.remove(pListener)) return; this.iLogListeners = newListeners; - if (this.iInternalListenerLogFile != null - && this.iInternalListenerLogFile.equals(pListener)) { + if (this.iInternalListenerLogFile != null && this.iInternalListenerLogFile.equals(pListener)) { // Removing internal log listener for file this.iInternalListenerLogFile = null; this.iNumInternalLogListeners--; - } else if (this.iInternalListenerLogConsole != null - && this.iInternalListenerLogConsole.equals(pListener)) { + } else if (this.iInternalListenerLogConsole != null && this.iInternalListenerLogConsole.equals(pListener)) { // Removing internal log listener for console this.iInternalListenerLogConsole = null; this.iNumInternalLogListeners--; @@ -486,7 +544,7 @@ public synchronized void clearLogListeners() { /** * Gets the registered log listeners including the internal console and file * loggers. - * + * * @return The list of listeners */ public List getLogListeners() { @@ -496,7 +554,7 @@ public List getLogListeners() { /** * Adds a listener for log messages. The listener will be notified of any * trace event. - * + * * @param pListener * The listener */ @@ -507,10 +565,10 @@ public synchronized void addTraceListener(TraceListener pListener) { newListeners.add(pListener); this.iTraceListeners = newListeners; - if ((this.iInternalListenerTraceFile != null && this.iInternalListenerTraceFile - .equals(pListener)) - || (this.iInternalListenerTraceConsole != null && this.iInternalListenerTraceConsole - .equals(pListener))) { + if ( + (this.iInternalListenerTraceFile != null && this.iInternalListenerTraceFile.equals(pListener)) || + (this.iInternalListenerTraceConsole != null && this.iInternalListenerTraceConsole.equals(pListener)) + ) { this.iNumInternalTraceListeners++; } else { this.iNumExternalTraceListeners++; @@ -520,7 +578,7 @@ public synchronized void addTraceListener(TraceListener pListener) { /** * Removes a listener. This listener will not be notified of trace events * anymore. - * + * * @param pListener * The listener */ @@ -529,13 +587,11 @@ public synchronized void removeTraceListener(TraceListener pListener) { if (!newListeners.remove(pListener)) return; this.iTraceListeners = newListeners; - if (this.iInternalListenerTraceFile != null - && this.iInternalListenerTraceFile.equals(pListener)) { + if (this.iInternalListenerTraceFile != null && this.iInternalListenerTraceFile.equals(pListener)) { // Removing internal tracelistener for file this.iInternalListenerTraceFile = null; this.iNumInternalTraceListeners--; - } else if (this.iInternalListenerTraceConsole != null - && this.iInternalListenerTraceConsole.equals(pListener)) { + } else if (this.iInternalListenerTraceConsole != null && this.iInternalListenerTraceConsole.equals(pListener)) { // Removing internal trace listener for console this.iInternalListenerTraceConsole = null; this.iNumInternalTraceListeners--; @@ -562,7 +618,7 @@ public synchronized void clearTraceListeners() { /** * Gets the registered trace listeners including the internal console and * file loggers. - * + * * @return A list of listeners */ public List getTraceListeners() { @@ -572,14 +628,13 @@ public List getTraceListeners() { /** * Adds a listener for CIM-XML trace messages. The listener will be notified * of any CIM-XML trace event. - * + * * @param pListener * The listener */ public synchronized void addCIMXMLTraceListener(CIMXMLTraceListener pListener) { if (pListener == null) return; - ArrayList newListeners = new ArrayList( - this.iCIMXMLTraceListeners); + ArrayList newListeners = new ArrayList(this.iCIMXMLTraceListeners); newListeners.add(pListener); this.iCIMXMLTraceListeners = newListeners; } @@ -587,13 +642,12 @@ public synchronized void addCIMXMLTraceListener(CIMXMLTraceListener pListener) { /** * Removes a CIM-XML trace listener. This listener will not be notified of * CIM-XML trace events anymore. - * + * * @param pListener * The listener */ public synchronized void removeCIMXMLTraceListener(CIMXMLTraceListener pListener) { - ArrayList newListeners = new ArrayList( - this.iCIMXMLTraceListeners); + ArrayList newListeners = new ArrayList(this.iCIMXMLTraceListeners); if (!newListeners.remove(pListener)) return; this.iCIMXMLTraceListeners = newListeners; } @@ -607,7 +661,7 @@ public synchronized void clearCIMXMLTraceListeners() { /** * Gets the registered CIM-XML trace listeners. - * + * * @return A list of listeners */ public List getCIMXMLTraceListeners() { @@ -616,7 +670,7 @@ public List getCIMXMLTraceListeners() { /** * Forwards a log/trace message to the registered log&trace listeners. - * + * * @param pKey * The message identifier. */ @@ -626,7 +680,7 @@ public void message(String pKey) { /** * Forwards a log/trace message to the registered log&trace listeners. - * + * * @param pKey * The message identifier. * @param pParameter @@ -638,7 +692,7 @@ public void message(String pKey, Object pParameter) { /** * Forwards a log/trace message to the registered log&trace listeners. - * + * * @param pKey * The message identifier. * @param pParameters @@ -653,8 +707,7 @@ public void message(String pKey, Object[] pParameters) { final List traceListeners = getTraceListeners(); StackTraceElement caller = getCaller(); for (int i = 0; i < traceListeners.size(); ++i) { - traceListeners.get(i).trace(level, caller, - pKey + " " + MessageFormat.format(message, pParameters)); + traceListeners.get(i).trace(level, caller, pKey + " " + MessageFormat.format(message, pParameters)); } } final List logListeners = getLogListeners(); @@ -668,7 +721,7 @@ public void message(String pKey, Object[] pParameters) { /** * Forwards a trace message to the registered trace listeners. - * + * * @param pLevel * One of the three message level identifiers FINE, FINER and * FINEST @@ -691,7 +744,7 @@ public void trace(Level pLevel, String pMessage) { /** * Forwards a trace message to the registered trace listeners. - * + * * @param pLevel * One of the three message level identifiers FINE, FINER and * FINEST @@ -717,7 +770,7 @@ public void trace(Level pLevel, String pMessage, Throwable pThrown) { /** * Forwards a CIM-XML trace message to the registered CIM-XML trace * listeners. - * + * * @param pLevel * One of the message level identifiers, e.g. FINE * @param pMessage @@ -757,7 +810,7 @@ public void exit() { /** * Returns the output stream to which all CIM-XML traffic (outgoing & * incoming) will be copied for debugging purposes. - * + * * @return The output stream. A null value means that CIM-XML * debugging is disabled */ @@ -768,7 +821,7 @@ public OutputStream getXmlTraceStream() { /** * Sets an output stream to which all CIM-XML traffic (outgoing & * incoming) will be copied for debugging purposes. - * + * * @param pStream * The output stream. A null value means that * CIM-XML debugging is disabled. @@ -787,8 +840,7 @@ private void initXmlTraceFile() { try { if (WBEMConfiguration.getGlobalConfiguration().isCimXmlTracingEnabled()) { String filename = WBEMConfiguration.getGlobalConfiguration().getCimXmlTraceStream(); - if (filename != null && filename.length() > 0 && this.iXmlTraceFile == null - && getXmlTraceStream() == null) { + if (filename != null && filename.length() > 0 && this.iXmlTraceFile == null && getXmlTraceStream() == null) { if (filename.equalsIgnoreCase("System.out")) { this.iXmlTraceFile = System.out; } else if (filename.equalsIgnoreCase("System.err")) { @@ -797,9 +849,11 @@ && getXmlTraceStream() == null) { try { this.iXmlTraceFile = new FileOutputStream(filename); } catch (IOException e) { - trace(Level.FINE, "Unable to open " - + WBEMConfigurationProperties.CIMXML_TRACE_STREAM + "=" - + filename, e); + trace( + Level.FINE, + "Unable to open " + WBEMConfigurationProperties.CIMXML_TRACE_STREAM + "=" + filename, + e + ); } } setXmlTraceStream(this.iXmlTraceFile); @@ -813,7 +867,7 @@ && getXmlTraceStream() == null) { /** * Analyzes the stack trace and determines from where the * LogAndTraceBroker was called. - * + * * @return First StackTraceElement outside the * LogAndTraceBroker */ @@ -822,14 +876,16 @@ private StackTraceElement getCaller() { for (int i = 0; i < stack.length; ++i) { StackTraceElement frame = stack[i]; String cname = frame.getClassName(); - if (!this.iTHIS_CLASS.equals(cname) && !this.iTHROWABLE.equals(cname)) { return frame; } + if (!this.iTHIS_CLASS.equals(cname) && !this.iTHROWABLE.equals(cname)) { + return frame; + } } return null; } /** * Removes all handlers from a logger - * + * * @param pLogger * The logger */ @@ -846,13 +902,13 @@ private void removeHandlers(Logger pLogger) { * message with the specified level. Use this method to determine if a * trace() method call could result in logging before preparing the * information to be logged. For example: - * + * *
       	 *     if (logger.isLoggableTrace(Level.WARNING) {
       	 *         // Prepare info for logging
       	 *         logger.trace(Level.WARNING, ...
       	 * 
      - * + * * @param pLevel * The Level of the trace message. * @return true if trace message could be logged, @@ -888,13 +944,13 @@ public boolean isLoggableTrace(Level pLevel) { * with the specified level. Use this method to determine if a message() * method call could result in logging before preparing the information to * be logged. For example: - * + * *
       	 *     if (logger.isLoggableMessage(Level.WARNING) {
       	 *         // Prepare info for logging
       	 *         logger.message(Level.WARNING, ...
       	 * 
      - * + * * @param pLevel * The Level of the message. * @return true if message could be logged, false @@ -933,13 +989,13 @@ public boolean isLoggableMessage(Level pLevel) { * a CIM-XML trace message. Use this method to determine if a trace() method * call could result in logging before preparing the information to be * logged. For example: - * + * *
       	 *     if (logger.isLoggableCIMXMLTrace(Level.FINEST) {
       	 *         // Prepare info for logging
       	 *         logger.traceCIMXML(Level.FINEST, ...
       	 * 
      - * + * * @param pLevel * The Level of the trace message. * @return true if CIM-XML trace message could be logged, diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/logging/LogFormatter.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/logging/LogFormatter.java index b088ed4..2ff6d23 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/logging/LogFormatter.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/logging/LogFormatter.java @@ -47,10 +47,9 @@ /** * Class LogFormatter implements the formatting algorithm for our console log. - * + * */ public class LogFormatter extends Formatter { - private final String iLineSeparator = System.getProperty("line.separator"); /** @@ -62,7 +61,7 @@ public LogFormatter() { /* * (non-Javadoc) - * + * * @see java.util.logging.Formatter#format(java.util.logging.LogRecord) */ @Override diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/logging/MessageLoader.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/logging/MessageLoader.java index 51eb83a..8f80a92 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/logging/MessageLoader.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/logging/MessageLoader.java @@ -48,17 +48,14 @@ /** * Class MessageLoader encapsulates the access to the resource file containing * log messages. - * + * */ public final class MessageLoader { - private static final String BUNDLE_NAME = "org.sblim.cimclient.internal.logging.messages"; //$NON-NLS-1$ - private static final ResourceBundle RESOURCE_BUNDLE_LOCAL - /* = ResourceBundle.getBundle(BUNDLE_NAME, Locale.getDefault()) */; + private static final ResourceBundle RESOURCE_BUNDLE_LOCAL/* = ResourceBundle.getBundle(BUNDLE_NAME, Locale.getDefault()) */; - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME, - Locale.ENGLISH); + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME, Locale.ENGLISH); /* * Use English if default locale not supported (doing it here handles @@ -75,12 +72,12 @@ public final class MessageLoader { } private MessageLoader() { - // prevent instantiation + // prevent instantiation } /** * Returns the English message for a given key. - * + * * @param pKey * The key * @return The message @@ -95,7 +92,7 @@ public static String getMessage(String pKey) { /** * Returns the localized message for a given key. - * + * * @param pKey * The key * @return The message @@ -115,7 +112,7 @@ public static String getLocalizedMessage(String pKey) { * CIM1234S. Valid level tokens are S, W, I and * C for SEVERE, WARNING, INFO and * CONFIG respectively. - * + * * @param pKey * The message id * @return The level diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/logging/Messages.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/logging/Messages.java index 203e35f..2a2d746 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/logging/Messages.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/logging/Messages.java @@ -44,10 +44,9 @@ /** * Interface Messages holds the constants for the message keys. - * + * */ public interface Messages { - /** * GREETING */ diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/logging/TimeStamp.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/logging/TimeStamp.java index 1ff1b6e..86a4ef8 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/logging/TimeStamp.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/logging/TimeStamp.java @@ -46,7 +46,7 @@ /** * Class TimeStamp is responsible for building uniform date/time strings for * logging and tracing. - * + * */ public class TimeStamp { @@ -56,17 +56,15 @@ private static String pad(int pDigits, int pNum) { char[] cA = new char[len]; int paddingDigits = pDigits - str.length(); int dIdx = 0; - while (dIdx < paddingDigits) - cA[dIdx++] = '0'; + while (dIdx < paddingDigits) cA[dIdx++] = '0'; int sIdx = 0; - while (dIdx < len) - cA[dIdx++] = str.charAt(sIdx++); + while (dIdx < len) cA[dIdx++] = str.charAt(sIdx++); return new String(cA); } /** * formatWorker - * + * * @param pMillis * - total milliseconds * @param pIncludeMillis @@ -96,7 +94,7 @@ private static String formatWorker(long pMillis, boolean pIncludeMillis) { /** * format - * + * * @param pMillis * - total milliseconds * @return formatted date/time String. ( YYYY.MM.DD HH:mm:SS ) @@ -107,7 +105,7 @@ public static String format(long pMillis) { /** * formatWithMillis - * + * * @param pMillis * - total milliseconds * @return formatted date/time String. ( YYYY.MM.DD HH:mm:SS.sss ) diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/logging/TraceFormatter.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/logging/TraceFormatter.java index 04ca2fa..3fb3265 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/logging/TraceFormatter.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/logging/TraceFormatter.java @@ -48,10 +48,9 @@ /** * Class TraceFormatter implements the formatting algorithm for our console log. - * + * */ public class TraceFormatter extends Formatter { - private final String iLineSeparator = System.getProperty("line.separator"); /** @@ -63,7 +62,7 @@ public TraceFormatter() { /* * (non-Javadoc) - * + * * @see java.util.logging.Formatter#format(java.util.logging.LogRecord) */ @Override diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/pullparser/XMLPullParser.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/pullparser/XMLPullParser.java index c1a810c..e9b0a16 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/pullparser/XMLPullParser.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/pullparser/XMLPullParser.java @@ -63,14 +63,13 @@ import java.io.Reader; import java.util.ArrayList; import java.util.logging.Level; - import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.XMLDefaultHandlerImpl; import org.metricshub.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; import org.xml.sax.Attributes; /** * Class XMLPullParser is responsible for XML parsing. - * + * */ public class XMLPullParser { @@ -175,7 +174,6 @@ public String getValue(String uri, String localName) { } class XMLAttributeValue { - int iCurrentPos; int iBegin, iLen; @@ -186,7 +184,7 @@ class XMLAttributeValue { /** * Ctor. - * + * * @param begin * @param len * @param translate @@ -199,7 +197,7 @@ public XMLAttributeValue(int begin, int len, boolean translate) { /** * Ctor. - * + * * @param begin * @param len */ @@ -211,7 +209,7 @@ public XMLAttributeValue(int begin, int len) { /** * getText - * + * * @return String */ public String getText() { @@ -229,10 +227,8 @@ public String getText() { // cnt++; // } } catch (Exception e) { - LogAndTraceBroker.getBroker().trace(Level.WARNING, - "exception while decoding CHARACTERS XML", e); - this.iText = new String(XMLPullParser.this.iBufferChar, this.iBegin, - this.iLen); + LogAndTraceBroker.getBroker().trace(Level.WARNING, "exception while decoding CHARACTERS XML", e); + this.iText = new String(XMLPullParser.this.iBufferChar, this.iBegin, this.iLen); } } else { // Integer hashKey = new Integer(hash); @@ -256,7 +252,7 @@ public String getText() { /** * init - * + * * @param begin * @param len */ @@ -268,7 +264,7 @@ public void init(int begin, int len) { /** * setTranslate - * + * * @param translate */ public void setTranslate(boolean translate) { @@ -321,12 +317,13 @@ protected int parseReference() throws XMLPullParserException { int value = 0; do { ch1 = XMLPullParser.this.iBufferChar[this.iCurrentPos++]; - if (ch1 >= '0' && ch1 <= '9') value = value * 16 + (ch1 - '0'); - else if (ch1 >= 'A' && ch1 <= 'F' || ch1 >= 'a' && ch1 <= 'f') value = value - * 16 + (Character.toUpperCase(ch1) - 'A' + 10); - else if (ch1 == ';') break; - else throw new XMLPullParserException( - "invalid character while parsing hex encoded number " + escape(ch1)); + if (ch1 >= '0' && ch1 <= '9') value = value * 16 + (ch1 - '0'); else if ( + ch1 >= 'A' && ch1 <= 'F' || ch1 >= 'a' && ch1 <= 'f' + ) value = value * 16 + (Character.toUpperCase(ch1) - 'A' + 10); else if ( + ch1 == ';' + ) break; else throw new XMLPullParserException( + "invalid character while parsing hex encoded number " + escape(ch1) + ); } while (true); this.iCurrentPos--; // 18274 return (char) value; @@ -337,10 +334,9 @@ else throw new XMLPullParserException( if (ch1 >= '0' && ch1 <= '9') { value = value * 10 + (ch1 - '0'); ch1 = XMLPullParser.this.iBufferChar[this.iCurrentPos++]; - } else if (ch1 == ';') break; - else throw new XMLPullParserException( - "invalid character while parsing decimal encoded number: " - + escape(ch1)); + } else if (ch1 == ';') break; else throw new XMLPullParserException( + "invalid character while parsing decimal encoded number: " + escape(ch1) + ); } while (true); this.iCurrentPos--; // 18274 return (char) value; @@ -353,11 +349,11 @@ else throw new XMLPullParserException( ch1 = XMLPullParser.this.iBufferChar[this.iCurrentPos++]; if (ch1 == ';') break; if (!isValidElementNameChar(ch1)) throw new XMLPullParserException( - "invalid reference character " + escape(ch1)); + "invalid reference character " + escape(ch1) + ); } while (true); } else { - throw new XMLPullParserException( - "expected valid name start character for value reference"); + throw new XMLPullParserException("expected valid name start character for value reference"); } this.iCurrentPos--; ch1 = XMLPullParser.this.iBufferChar[startPos]; @@ -370,7 +366,9 @@ else throw new XMLPullParserException( return '>'; } else { char ch4 = XMLPullParser.this.iBufferChar[startPos + 3]; - if (ch1 == 'a' && ch2 == 'm' && ch3 == 'p' && ch4 == ';') { return '&'; } + if (ch1 == 'a' && ch2 == 'm' && ch3 == 'p' && ch4 == ';') { + return '&'; + } char ch5 = XMLPullParser.this.iBufferChar[startPos + 4]; if (ch1 == 'a' && ch2 == 'p' && ch3 == 'o' && ch4 == 's' && ch5 == ';') { return '\''; @@ -466,31 +464,29 @@ else throw new XMLPullParserException( /** * main - * + * * @param args */ public static void main(String[] args) { - // this did testing + // this did testing } // TODO: ebak: this function seems to be wrong, because "synchronizes" to // IRETURNVALUE /** * next - * + * * @param reader * @param parserHdlr * @return boolean * @throws Exception */ - public static boolean next(XMLPullParser reader, XMLDefaultHandlerImpl parserHdlr) - throws Exception { + public static boolean next(XMLPullParser reader, XMLDefaultHandlerImpl parserHdlr) throws Exception { while (reader.hasNext()) { int event = reader.next(); switch (event) { case START_ELEMENT: - parserHdlr.startElement(EMPTY, EMPTY, reader.getElementName(), reader - .getAttributes()); + parserHdlr.startElement(EMPTY, EMPTY, reader.getElementName(), reader.getAttributes()); break; case END_ELEMENT: parserHdlr.endElement(EMPTY, EMPTY, reader.getElementName()); @@ -501,7 +497,9 @@ public static boolean next(XMLPullParser reader, XMLDefaultHandlerImpl parserHdl lastElementName = elementNames.get(elementNames.size() - 1); } - if (lastElementName != null && lastElementName.equalsIgnoreCase("IRETURNVALUE")) { return true; } + if (lastElementName != null && lastElementName.equalsIgnoreCase("IRETURNVALUE")) { + return true; + } break; case CHARACTERS: char[] buf = reader.getText().toCharArray(); @@ -559,7 +557,7 @@ public static boolean next(XMLPullParser reader, XMLDefaultHandlerImpl parserHdl /** * Ctor. - * + * * @param in */ public XMLPullParser(Reader in) { @@ -569,7 +567,7 @@ public XMLPullParser(Reader in) { /** * close - * + * * @throws IOException */ public void close() throws IOException { @@ -580,7 +578,7 @@ public void close() throws IOException { /** * getAttributes - * + * * @return Attributes */ public Attributes getAttributes() { @@ -594,7 +592,7 @@ public Attributes getAttributes() { /** * getElementName - * + * * @return String */ public String getElementName() { @@ -603,7 +601,7 @@ public String getElementName() { /** * getElementNames - * + * * @return Vector */ public ArrayList getElementNames() { @@ -612,7 +610,7 @@ public ArrayList getElementNames() { /** * getLevel - * + * * @return int */ public int getLevel() { @@ -621,19 +619,20 @@ public int getLevel() { /** * getText - * + * * @return String */ public String getText() { String result = null; - if (this.iCurrentState == CHARACTERS && this.iCharacters != null) { return this.iCharacters - .getText(); } + if (this.iCurrentState == CHARACTERS && this.iCharacters != null) { + return this.iCharacters.getText(); + } return result; } /** * hasNext - * + * * @return boolean */ public boolean hasNext() { @@ -642,7 +641,7 @@ public boolean hasNext() { /** * next - * + * * @return int * @throws IOException */ @@ -661,14 +660,16 @@ public int next() throws IOException { if (ch == '<') { ch = (char) getNextChar(); if (ch == '?') { - if (this.iSeenProlog) { throw new XMLPullParserException( - "The processing instruction target matching \"[xX][mM][lL]\" is not allowed."); } + if (this.iSeenProlog) { + throw new XMLPullParserException( + "The processing instruction target matching \"[xX][mM][lL]\" is not allowed." + ); + } this.iSeenProlog = true; parsePI(); ch = (char) getNextChar(); ch = skipOptionalSpaces(ch); - if (ch != '<') throw new XMLPullParserException(this, - "Content is not allowed in prolog."); + if (ch != '<') throw new XMLPullParserException(this, "Content is not allowed in prolog."); goBack(); this.iCurrentState = START_DOCUMENT; @@ -716,17 +717,19 @@ public int next() throws IOException { ch = (char) getNextCharCheckingEOF(); if (ch == (char) -1) { - if (this.iElementNames.size() != 0) throw new XMLPullParserException(this, - "unexpected EOF "); + if (this.iElementNames.size() != 0) throw new XMLPullParserException(this, "unexpected EOF "); this.iCurrentState = END_DOCUMENT; return this.iCurrentState; - } else if (ch == '\r' || ch == '\n') { /* :) */} else { + } else if (ch == '\r' || ch == '\n') { + /* :) */ + } else { if (!isSpace(ch) && ch != '<' && this.iElementNames.size() == 0) { - if (!this.iSeenProlog) throw new XMLPullParserException(this, - "Content is not allowed in trailing section."); - throw new XMLPullParserException(this, - "Content is not allowed in trailing section."); + if (!this.iSeenProlog) throw new XMLPullParserException( + this, + "Content is not allowed in trailing section." + ); + throw new XMLPullParserException(this, "Content is not allowed in trailing section."); } } amp = false; @@ -739,11 +742,9 @@ public int next() throws IOException { this.iEndCharacters = this.iCurrentPosition; goBack(); if (this.iElementNames.size() > 0) { - if (this.iCharacters == null) this.iCharacters = new XMLAttributeValue( - this.iStartCharacters, this.iEndCharacters - this.iStartCharacters - 1); - else { - this.iCharacters.init(this.iStartCharacters, this.iEndCharacters - - this.iStartCharacters - 1); + if (this.iCharacters == null) this.iCharacters = + new XMLAttributeValue(this.iStartCharacters, this.iEndCharacters - this.iStartCharacters - 1); else { + this.iCharacters.init(this.iStartCharacters, this.iEndCharacters - this.iStartCharacters - 1); this.iCharacters.setTranslate(true); } @@ -781,30 +782,30 @@ public void reset() { public String toString() { switch (this.iCurrentState) { case START_ELEMENT: { - StringBuilder sb = new StringBuilder("START ELEM: <"); - sb.append(this.iElementName); - if (this.iAttributeNames.size() > 0) { - sb.append(" "); - for (int i = 0; i < this.iAttributeNames.size(); i++) { - sb.append(this.iAttributeNames.get(i)); - sb.append("=\""); - sb.append(this.iAttributeValues.get(i)); - sb.append("\" "); + StringBuilder sb = new StringBuilder("START ELEM: <"); + sb.append(this.iElementName); + if (this.iAttributeNames.size() > 0) { + sb.append(" "); + for (int i = 0; i < this.iAttributeNames.size(); i++) { + sb.append(this.iAttributeNames.get(i)); + sb.append("=\""); + sb.append(this.iAttributeValues.get(i)); + sb.append("\" "); + } } + sb.append(">"); + return sb.toString(); } - sb.append(">"); - return sb.toString(); - } case END_ELEMENT: { - String s = "END ELEM: "; - return s; - } + String s = "END ELEM: "; + return s; + } case CHARACTERS: { - return "CHARACTERS: \"" + getText(); // .replaceAll("\n", - // "\\\\n").replaceAll("\r", - // "\\\\r").replaceAll("\t", - // "\\\\t")+"\""; - } + return "CHARACTERS: \"" + getText(); // .replaceAll("\n", + // "\\\\n").replaceAll("\r", + // "\\\\r").replaceAll("\t", + // "\\\\t")+"\""; + } } return "UNKOWN"; } @@ -835,8 +836,13 @@ protected void ensureCapacity() { if (this.iBufferChar == null) this.iBufferChar = new char[1024]; if (this.iCurrentPosition >= (8 * this.iBufferChar.length) / 10) { - System.arraycopy(this.iBufferChar, this.iCurrentPosition, this.iBufferChar, 0, - this.iFinishChar - this.iCurrentPosition); + System.arraycopy( + this.iBufferChar, + this.iCurrentPosition, + this.iBufferChar, + 0, + this.iFinishChar - this.iCurrentPosition + ); this.iFinishChar -= this.iCurrentPosition; this.iCurrentPosition = 0; } @@ -848,8 +854,7 @@ protected String escape(char ch) { if (ch == '\r') result = "\'\\r\'"; if (ch == '\t') result = "\'\\t\'"; if (ch == '\'') result = "\'\\'\'"; - if (ch > '\177' || ch < ' ') result = "\'\\u" + Integer.toHexString(ch) + "\'"; - else result = "\'" + ch + "\'"; + if (ch > '\177' || ch < ' ') result = "\'\\u" + Integer.toHexString(ch) + "\'"; else result = "\'" + ch + "\'"; return result; } @@ -863,10 +868,11 @@ protected int getChar() throws IOException { System.arraycopy(tmp, 0, this.iBufferChar, 0, tmp.length); } - int total = this.iInstream.read(this.iBufferChar, this.iFinishChar, - this.iBufferChar.length - this.iFinishChar); + int total = this.iInstream.read(this.iBufferChar, this.iFinishChar, this.iBufferChar.length - this.iFinishChar); - if (total <= 0) { return -1; } + if (total <= 0) { + return -1; + } this.iFinishChar += total; } return this.iBufferChar[this.iCurrentPosition++]; @@ -915,17 +921,36 @@ protected boolean isSpace(char ch) { } protected boolean isValidElementNameChar(char ch) { - return (ch < 256 && (ch >= 'A' && ch <= 'Z' || ch >= 'a' && ch <= 'z' || ch == '_' - || ch == ':' || ch == '-' || ch == '.' || ch >= '0' && ch <= '9' || ch == '\267')) - || ch >= '\300' - && ch <= '\u02FF' - || ch >= '\u0370' - && ch <= '\u037D' - || ch >= '\u0300' - && ch <= '\u036F' - || ch >= '\u037F' - && ch <= '\u2027' - || ch >= '\u202A' && ch <= '\u218F' || ch >= '\u2800' && ch <= '\uFFEF'; + return ( + ( + ch < 256 && + ( + ch >= 'A' && + ch <= 'Z' || + ch >= 'a' && + ch <= 'z' || + ch == '_' || + ch == ':' || + ch == '-' || + ch == '.' || + ch >= '0' && + ch <= '9' || + ch == '\267' + ) + ) || + ch >= '\300' && + ch <= '\u02FF' || + ch >= '\u0370' && + ch <= '\u037D' || + ch >= '\u0300' && + ch <= '\u036F' || + ch >= '\u037F' && + ch <= '\u2027' || + ch >= '\u202A' && + ch <= '\u218F' || + ch >= '\u2800' && + ch <= '\uFFEF' + ); // return isValidStartElementNameChar(ch) // || (ch < 256 && (ch == '-' // || ch == '.' @@ -938,10 +963,23 @@ protected boolean isValidElementNameChar(char ch) { } protected boolean isValidStartElementNameChar(char ch) { - return (ch < 256 && (ch >= 'A' && ch <= 'Z' || ch >= 'a' && ch <= 'z' || ch == '_' || ch == ':')) - || (ch >= '\300' && ch <= '\u02FF' || ch >= '\u0370' && ch <= '\u037D' - || ch >= '\u037F' && ch <= '\u0400' || ch >= '\u0400' && ch <= '\u2027' - || ch >= '\u202A' && ch <= '\u218F' || ch >= '\u2800' && ch <= '\uFFEF'); + return ( + (ch < 256 && (ch >= 'A' && ch <= 'Z' || ch >= 'a' && ch <= 'z' || ch == '_' || ch == ':')) || + ( + ch >= '\300' && + ch <= '\u02FF' || + ch >= '\u0370' && + ch <= '\u037D' || + ch >= '\u037F' && + ch <= '\u0400' || + ch >= '\u0400' && + ch <= '\u2027' || + ch >= '\u202A' && + ch <= '\u218F' || + ch >= '\u2800' && + ch <= '\uFFEF' + ) + ); } protected void parseAttribute(char ch) throws IOException { @@ -962,15 +1000,19 @@ protected void parseAttribute(char ch) throws IOException { ch = skipOptionalSpaces(ch); - if (ch != '=') throw new XMLPullParserException(this, "missing character \'=\'instead " - + escape(ch) + " was found "); + if (ch != '=') throw new XMLPullParserException( + this, + "missing character \'=\'instead " + escape(ch) + " was found " + ); ch = (char) getNextChar(); ch = skipOptionalSpaces(ch); char delimiter; - if (ch != '\"' && ch != '\'') throw new XMLPullParserException(this, - "missing character \'\"\' or \'\'\' instead " + escape(ch) + " was found "); + if (ch != '\"' && ch != '\'') throw new XMLPullParserException( + this, + "missing character \'\"\' or \'\'\' instead " + escape(ch) + " was found " + ); delimiter = ch; // StringBuffer attributeValue = new StringBuffer(); @@ -983,15 +1025,14 @@ protected void parseAttribute(char ch) throws IOException { // hashvalue = hashvalue *primes[n] +ch; ch = (char) getNextChar(); - if (ch == delimiter) break; - else if (ch == '<' || ch == '>') throw new XMLPullParserException(this, - "illegal character " + escape(ch)); - else if (ch == '&') { + if (ch == delimiter) break; else if (ch == '<' || ch == '>') throw new XMLPullParserException( + this, + "illegal character " + escape(ch) + ); else if (ch == '&') { int ref = parseReference(); ch = (char) (ref & 0xffff); // attributeValue.append((char)ref); } else if (ch == '\t' || ch == '\r' || ch == '\n') { - if (ch != '\n' || prevCh != '\r') { // attributeValue.append(' '); } @@ -1002,8 +1043,12 @@ else if (ch == '&') { } while (true); int endAttributeValue = this.iCurrentPosition; // attributeValues.add(attributeValue.toString()); - addAttribute(startAttributeName, endAttributeName - startAttributeName - 1, - startAttributeValue, endAttributeValue - startAttributeValue - 1); + addAttribute( + startAttributeName, + endAttributeName - startAttributeName - 1, + startAttributeValue, + endAttributeValue - startAttributeValue - 1 + ); return; } @@ -1011,10 +1056,14 @@ else if (ch == '&') { protected int parseCDATA() throws IOException { char ch; - if ((char) getNextChar() != 'C' || (char) getNextChar() != 'D' - || (char) getNextChar() != 'A' || (char) getNextChar() != 'T' - || (char) getNextChar() != 'A' || (char) getNextChar() != '[') throw new XMLPullParserException( - "CDATA must start with \"') throw new XMLPullParserException(this, "\'=\' was expected, but \'" - + escape(ch) + "\' was found instead"); + if (ch != '>') throw new XMLPullParserException( + this, + "\'=\' was expected, but \'" + escape(ch) + "\' was found instead" + ); if (this.iElementNames.size() == 0) this.iSeenEpilog = true; } @@ -1112,7 +1167,8 @@ protected int parsePI() throws IOException { dashFound = false; } if (ch == (char) -1) throw new XMLPullParserException( - "XML document structures must start and end within the same entity."); + "XML document structures must start and end within the same entity." + ); } while (true); return -1; @@ -1126,12 +1182,14 @@ protected int parseReference() throws IOException { int value = 0; do { ch1 = (char) getNextChar(); - if (ch1 >= '0' && ch1 <= '9') value = value * 16 + (ch1 - '0'); - else if (ch1 >= 'A' && ch1 <= 'F' || ch1 >= 'a' && ch1 <= 'f') value = value - * 16 + (Character.toUpperCase(ch1) - 'A' + 10); - else if (ch1 == ';') break; - else throw new XMLPullParserException(this, - "invalid character while parsing hex encoded number " + escape(ch1)); + if (ch1 >= '0' && ch1 <= '9') value = value * 16 + (ch1 - '0'); else if ( + ch1 >= 'A' && ch1 <= 'F' || ch1 >= 'a' && ch1 <= 'f' + ) value = value * 16 + (Character.toUpperCase(ch1) - 'A' + 10); else if ( + ch1 == ';' + ) break; else throw new XMLPullParserException( + this, + "invalid character while parsing hex encoded number " + escape(ch1) + ); } while (true); return (char) value; } @@ -1141,10 +1199,10 @@ else throw new XMLPullParserException(this, if (ch1 >= '0' && ch1 <= '9') { value = value * 10 + (ch1 - '0'); ch1 = (char) getNextChar(); - } else if (ch1 == ';') break; - else throw new XMLPullParserException(this, - "invalid character while parsing decimal encoded number: " - + escape(ch1)); + } else if (ch1 == ';') break; else throw new XMLPullParserException( + this, + "invalid character while parsing decimal encoded number: " + escape(ch1) + ); } while (true); return (char) value; } @@ -1156,11 +1214,11 @@ else throw new XMLPullParserException(this, ch1 = (char) getNextChar(); if (ch1 == ';') break; if (!isValidElementNameChar(ch1)) throw new XMLPullParserException( - "invalid reference character " + escape(ch1)); + "invalid reference character " + escape(ch1) + ); } while (true); } else { - throw new XMLPullParserException(this, - "expected valid name start character for value reference"); + throw new XMLPullParserException(this, "expected valid name start character for value reference"); } goBack(); ch1 = this.iBufferChar[startPos]; @@ -1173,7 +1231,9 @@ else throw new XMLPullParserException(this, return '>'; } else { char ch4 = this.iBufferChar[startPos + 3]; - if (ch1 == 'a' && ch2 == 'm' && ch3 == 'p' && ch4 == ';') { return '&'; } + if (ch1 == 'a' && ch2 == 'm' && ch3 == 'p' && ch4 == ';') { + return '&'; + } char ch5 = this.iBufferChar[startPos + 4]; if (ch1 == 'a' && ch2 == 'p' && ch3 == 'o' && ch4 == 's' && ch5 == ';') { return '\''; @@ -1206,8 +1266,7 @@ protected int parseStartElement(char ch) throws IOException { // elementName = (String)stringTable.get(hashKey); // elementName = null; // if (elementName == null) { - this.iElementName = new String(this.iBufferChar, startElementName, endElementName - - startElementName - 1); + this.iElementName = new String(this.iBufferChar, startElementName, endElementName - startElementName - 1); // stringTable.put(hashKey, elementName); // } else { // // System.out.println("Found: "+elementName); @@ -1221,15 +1280,17 @@ protected int parseStartElement(char ch) throws IOException { break; } else if (ch == '/') { ch = (char) getNextChar(); - if (ch != '>') { throw new XMLPullParserException(this, - "\'=\' was expected, but \'" + escape(ch) + "\' was found instead"); } + if (ch != '>') { + throw new XMLPullParserException(this, "\'=\' was expected, but \'" + escape(ch) + "\' was found instead"); + } this.iClosingElementNamePending = true; } else if (isValidStartElementNameChar(ch)) { parseAttribute(ch); ch = (char) getNextChar(); - } else throw new XMLPullParserException(this, - "Element type \"CIM\" must be followed by either attribute specifications, \">\" or \"/>\"."); - + } else throw new XMLPullParserException( + this, + "Element type \"CIM\" must be followed by either attribute specifications, \">\" or \"/>\"." + ); } while (true); return -1; } @@ -1238,8 +1299,7 @@ protected void parseUnknown() throws IOException { char ch; do { ch = (char) getNextChar(); - if (ch == '<') throw new XMLPullParserException( - "\'>\' was expected, but \'<\' was found instead."); + if (ch == '<') throw new XMLPullParserException("\'>\' was expected, but \'<\' was found instead."); } while (ch != '>'); } @@ -1266,5 +1326,4 @@ protected char skipRequiredSpaces(char ch) throws IOException { } while (isSpace(ch)); return ch; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/pullparser/XMLPullParserException.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/pullparser/XMLPullParserException.java index e4a1cc8..1652231 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/pullparser/XMLPullParserException.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/pullparser/XMLPullParserException.java @@ -48,15 +48,14 @@ /** * Class XMLPullParserException is thrown by the PULL parser. - * + * */ public class XMLPullParserException extends IOException { - private static final long serialVersionUID = 8136106792375541159L; /** * Ctor. - * + * * @param str */ public XMLPullParserException(String str) { @@ -65,7 +64,7 @@ public XMLPullParserException(String str) { /** * Ctor. - * + * * @param parser * @param str */ diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/Authority.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/Authority.java index 06ad879..f836517 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/Authority.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/Authority.java @@ -59,7 +59,7 @@ * IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" )
      * IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet
      * reg-name = *( unreserved / pct-encoded / sub-delims )

      - * + * * IPv6address = ( 6( h16 ":" ) ls32
      * / "::" 5( h16 ":" ) ls32
      * / [ h16 ] "::" 4( h16 ":" ) ls32
      @@ -69,24 +69,22 @@ * / [ *4( h16 ":" ) h16 ] "::" ls32
      * / [ *5( h16 ":" ) h16 ] "::" h16
      * / [ *6( h16 ":" ) h16 ] "::" ) Zone-index

      - * + * * ls32 = ( h16 ":" h16 ) / IPv4address
      * ; least-significant 32 bits of address

      - * + * * h16 = 1*4HEXDIG
      * ; 16 bits of address represented in hexadecimal
      * */ public class Authority { - private static final String PCTENCODED = "%[0-9A-Fa-f]{2}"; private static final String UNRESERVED = "A-Za-z0-9\\-\\._~"; private static final String SUBDELIMS = "!\\$&'\\(\\)\\*\\+,;="; - private static final String REGNAMEREG = "([" + UNRESERVED + SUBDELIMS + "]|" + PCTENCODED - + ")+"; + private static final String REGNAMEREG = "([" + UNRESERVED + SUBDELIMS + "]|" + PCTENCODED + ")+"; private static final String ZONEINDEX = "(%[" + UNRESERVED + "]+)?"; @@ -97,41 +95,97 @@ public class Authority { private static final String LS32 = "((" + H16 + ":" + H16 + ")" + "|(" + IPV4 + "))"; private static final String IPV6 = - // 6( h16 ":" ) ls32 - "(((" + H16 + ":){6}" + LS32 + ")|" + - // "::" 5( h16 ":" ) - "(::(" + H16 + ":){5}" + LS32 + ")|" + - // [ h16 ] "::" 4( h16 ":" ) ls32 - "((" + H16 + ")?::" + "(" + H16 + ":){4}" + LS32 + ")|" + - // [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32 - "(((" + H16 + ":){0,1}" + H16 + ")?::(" + H16 + ":){3}" + LS32 + ")|" + - // [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32 - "(((" + H16 + ":){0,2}" + H16 + ")?::(" + H16 + ":){2}" + LS32 + ")|" + - // [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32 - "(((" + H16 + ":){0,3}" + H16 + ")?::" + H16 + ":" + LS32 + ")|" + - // [ *4( h16 ":" ) h16 ] "::" ls32 - "(((" + H16 + ":){0,4}" + H16 + ")?::" + LS32 + ")|" + - // [ *5( h16 ":" ) h16 ] "::" h16 - "(((" + H16 + ":){0,5}" + H16 + ")?::" + H16 + ")|" + - // [ *6( h16 ":" ) h16 ] "::" - "(((" + H16 + ":){0,6}" + H16 + ")?::))" + ZONEINDEX; + // 6( h16 ":" ) ls32 + "(((" + + H16 + + ":){6}" + + LS32 + + ")|" + + // "::" 5( h16 ":" ) + "(::(" + + H16 + + ":){5}" + + LS32 + + ")|" + + // [ h16 ] "::" 4( h16 ":" ) ls32 + "((" + + H16 + + ")?::" + + "(" + + H16 + + ":){4}" + + LS32 + + ")|" + + // [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32 + "(((" + + H16 + + ":){0,1}" + + H16 + + ")?::(" + + H16 + + ":){3}" + + LS32 + + ")|" + + // [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32 + "(((" + + H16 + + ":){0,2}" + + H16 + + ")?::(" + + H16 + + ":){2}" + + LS32 + + ")|" + + // [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32 + "(((" + + H16 + + ":){0,3}" + + H16 + + ")?::" + + H16 + + ":" + + LS32 + + ")|" + + // [ *4( h16 ":" ) h16 ] "::" ls32 + "(((" + + H16 + + ":){0,4}" + + H16 + + ")?::" + + LS32 + + ")|" + + // [ *5( h16 ":" ) h16 ] "::" h16 + "(((" + + H16 + + ":){0,5}" + + H16 + + ")?::" + + H16 + + ")|" + + // [ *6( h16 ":" ) h16 ] "::" + "(((" + + H16 + + ":){0,6}" + + H16 + + ")?::))" + + ZONEINDEX; // IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" ) private static final String IPVFUTURE = "v[0-9A-Fa-f]+\\.([" + UNRESERVED + SUBDELIMS + "]|:)+"; private static final String IPLITERAL = "\\[(" + IPV6 + "|" + IPVFUTURE + ")\\]"; - private static Pattern USERINFOPAT = Pattern.compile("^((([" + UNRESERVED + SUBDELIMS + ":]|(" - + PCTENCODED + "))*)@).*"); + private static Pattern USERINFOPAT = Pattern.compile( + "^((([" + UNRESERVED + SUBDELIMS + ":]|(" + PCTENCODED + "))*)@).*" + ); - private static Pattern HOSTPAT = Pattern.compile("^((" + IPV4 + ")|(" + REGNAMEREG + ")|(" - + IPLITERAL + ")).*"); + private static Pattern HOSTPAT = Pattern.compile("^((" + IPV4 + ")|(" + REGNAMEREG + ")|(" + IPLITERAL + ")).*"); private static Pattern PORTPAT = Pattern.compile("^([0-9]+).*"); /** * Parses userInfo, host and port - * + * * @param pUriStr * @return the parsed Authority */ @@ -144,7 +198,9 @@ public static Authority parse(URIString pUriStr) { } else { userInfo = null; } - if (!uriStr.matchAndCut(HOSTPAT, 1)) { return null; } + if (!uriStr.matchAndCut(HOSTPAT, 1)) { + return null; + } String host = uriStr.group(1); String port = null; if (uriStr.cutStarting(':')) { @@ -173,18 +229,19 @@ private Authority(String pUserInfo, String pHost, String pPort) { /** * str - * + * * @return a String */ @Override public String toString() { - return (this.iUserInfo == null ? "" : this.iUserInfo + "@") + this.iHost - + (this.iPort == null ? "" : ":" + this.iPort); + return ( + (this.iUserInfo == null ? "" : this.iUserInfo + "@") + this.iHost + (this.iPort == null ? "" : ":" + this.iPort) + ); } /** * getUserInfo - * + * * @return the userInfo String */ public String getUserInfo() { @@ -193,7 +250,7 @@ public String getUserInfo() { /** * getHost - * + * * @return the host String */ public String getHost() { @@ -202,11 +259,10 @@ public String getHost() { /** * getPort - * + * * @return the port String */ public String getPort() { return this.iPort; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/BooleanValue.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/BooleanValue.java index a175b0a..4fbc446 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/BooleanValue.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/BooleanValue.java @@ -46,12 +46,11 @@ * Class BooleanValue parses and encapsulates a boolean value. */ public class BooleanValue extends Value { - private boolean iValue; /** * parse - * + * * @param pUriStr * @param pThrow * @return Value or null if pThrow is @@ -63,9 +62,8 @@ public class BooleanValue extends Value { public static Value parse(URIString pUriStr, boolean pThrow) throws IllegalArgumentException { URIString uriStr = pUriStr.deepCopy(); boolean value; - if (uriStr.cutStarting("true", true)) value = true; - else if (uriStr.cutStarting("false", true)) value = false; - else { + if (uriStr.cutStarting("true", true)) value = true; else if (uriStr.cutStarting("false", true)) value = + false; else { if (pThrow) { String msg = "Boolean value not found!\n" + uriStr.markPosition(); throw new IllegalArgumentException(msg); @@ -80,7 +78,7 @@ public static Value parse(URIString pUriStr, boolean pThrow) throws IllegalArgum /** * Parses an untyped boolean value. - * + * * @param pUriStr * @return Value */ @@ -94,7 +92,7 @@ private BooleanValue(boolean pValue) { /** * getValue - * + * * @return the boolean value. */ public boolean getValue() { @@ -103,7 +101,7 @@ public boolean getValue() { /** * getBoolean - * + * * @return Boolean */ public Boolean getBoolean() { @@ -125,5 +123,4 @@ public String toString() { public String getTypeInfo() { return MOF.DT_BOOL; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/CharValue.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/CharValue.java index 19fa51f..9cfb0ed 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/CharValue.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/CharValue.java @@ -43,21 +43,19 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; - import org.metricshub.wbem.sblim.cimclient.internal.util.MOF; /** * Class CharValue parses character value. */ public class CharValue extends Value implements QuotedValue { - private char iChar; private static final Pattern pat = Pattern.compile("\\\\x([0-9a-fA-F]+)"); /** * charValue = // example: 'a' '\x32' - * + * * @param pUriStr * @param pThrow * @return Value or null if parsing is failed and @@ -120,7 +118,7 @@ public static Value parse(URIString pUriStr, boolean pThrow) throws IllegalArgum /** * Parses a char16 value. - * + * * @param pUriStr * @return Value or null if parsing failed. */ @@ -134,7 +132,7 @@ private CharValue(char pChar) { /** * getChar - * + * * @return char */ public char get() { @@ -143,7 +141,7 @@ public char get() { /** * getCharacter - * + * * @return Character */ public Character getCharacter() { @@ -155,7 +153,9 @@ public Character getCharacter() { */ @Override public String toString() { - if (this.iChar < 32) { return "\\x" + (int) this.iChar; } + if (this.iChar < 32) { + return "\\x" + (int) this.iChar; + } return Character.toString(this.iChar); } @@ -173,5 +173,4 @@ public String toQuotedString() { public String getTypeInfo() { return MOF.DT_CHAR16; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/DateTimeValue.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/DateTimeValue.java index 0ebb0f2..0788910 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/DateTimeValue.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/DateTimeValue.java @@ -19,10 +19,6 @@ package org.metricshub.wbem.sblim.cimclient.internal.uri; -import org.metricshub.wbem.javax.cim.CIMDateTimeAbsolute; -import org.metricshub.wbem.javax.cim.CIMDateTimeInterval; -import org.metricshub.wbem.sblim.cimclient.internal.util.MOF; - /*- * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ * WBEM Java Client @@ -44,18 +40,20 @@ */ import org.metricshub.wbem.javax.cim.CIMDateTime; +import org.metricshub.wbem.javax.cim.CIMDateTimeAbsolute; +import org.metricshub.wbem.javax.cim.CIMDateTimeInterval; +import org.metricshub.wbem.sblim.cimclient.internal.util.MOF; /** * Class DateTimeValue is parses and encapsulates a datetime. - * + * */ public class DateTimeValue extends Value implements QuotedValue { - private CIMDateTime iDateTime; /** * datetimeValue = // quoted datetime string - * + * * @param pStrVal * - the dateTime string in an unquoted form * @param pThrow @@ -73,9 +71,13 @@ public static Value parse(String pStrVal, boolean pThrow) throws IllegalArgument dateTime = new CIMDateTimeInterval(pStrVal); } catch (IllegalArgumentException e1) { if (pThrow) { - String msg = "Value=" + pStrVal + "\nFailed to parse as DateTimeAbsolute!:\n" - + e0.getMessage() + "\nFailed to parse as DateTimeInterval!:\n" - + e1.getMessage(); + String msg = + "Value=" + + pStrVal + + "\nFailed to parse as DateTimeAbsolute!:\n" + + e0.getMessage() + + "\nFailed to parse as DateTimeInterval!:\n" + + e1.getMessage(); throw new IllegalArgumentException(msg); } return null; @@ -99,7 +101,7 @@ private DateTimeValue(CIMDateTime pDateTime) { /** * getDateTime - * + * * @return CIMDateTime */ public CIMDateTime getDateTime() { @@ -128,5 +130,4 @@ public String toQuotedString() { public String getTypeInfo() { return MOF.DT_DATETIME; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/IntegerValue.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/IntegerValue.java index 9ba86ed..dccc4a0 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/IntegerValue.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/IntegerValue.java @@ -47,10 +47,9 @@ /** * Class IntegerValue parses and encapsulates an integer value. - * + * */ public class IntegerValue extends Value { - private BigInteger iBigValue; private boolean iTyped; @@ -67,7 +66,7 @@ public class IntegerValue extends Value { * decimalValue = [ "+" | "-" ] ( positiveDecimalDigit *decimalDigit | "0" ) * hexValue = [ "+" | "-" ] ( "0x" | "0X" ) 1*hexDigit * - * + * * @param pUriStr * @param pTyped * - if true pSigned and pBitWidth will be @@ -80,8 +79,8 @@ public class IntegerValue extends Value { * @throws IllegalArgumentException * if parsing is failed and pThrow is true */ - private static Value parse(URIString pUriStr, boolean pTyped, boolean pSigned, int pBitWidth, - boolean pThrow) throws IllegalArgumentException { + private static Value parse(URIString pUriStr, boolean pTyped, boolean pSigned, int pBitWidth, boolean pThrow) + throws IllegalArgumentException { URIString savedUriStr = pUriStr.deepCopy(); // get the substring till the next ',' or end of uriStr String valStr = pUriStr.removeTill(','); @@ -157,7 +156,7 @@ private static Value parse(URIString pUriStr, boolean pTyped, boolean pSigned, i /** * Parses an untyped integer value. - * + * * @param pUriStr * @return a Value */ @@ -167,36 +166,33 @@ public static Value parse(URIString pUriStr) { /** * parseUnsigned - * + * * @param pUriStr * @param pBitWidth * @return Value * @throws IllegalArgumentException * if parsing failed. */ - public static Value parseUnsigned(URIString pUriStr, int pBitWidth) - throws IllegalArgumentException { + public static Value parseUnsigned(URIString pUriStr, int pBitWidth) throws IllegalArgumentException { return parse(pUriStr, true, false, pBitWidth, true); } /** * parseSigned - * + * * @param pUriStr * @param pBitWidth * @return Value * @throws IllegalArgumentException * if parsing failed. */ - public static Value parseSigned(URIString pUriStr, int pBitWidth) - throws IllegalArgumentException { + public static Value parseSigned(URIString pUriStr, int pBitWidth) throws IllegalArgumentException { return parse(pUriStr, true, true, pBitWidth, true); } - private static final Pattern BIN_PAT = Pattern.compile("^((?:\\+|-)?[01]+)[bB]$"), - OCT_PAT = Pattern.compile("^(?:\\+|-)?0[0-7]+$"), DEC_PAT = Pattern - .compile("^(?:\\+|-)?[1-9][0-9]*$"), HEX_PAT = Pattern - .compile("^(\\+|-)?0[xX]([0-9a-fA-F]+)$"); + private static final Pattern BIN_PAT = Pattern.compile("^((?:\\+|-)?[01]+)[bB]$"), OCT_PAT = Pattern.compile( + "^(?:\\+|-)?0[0-7]+$" + ), DEC_PAT = Pattern.compile("^(?:\\+|-)?[1-9][0-9]*$"), HEX_PAT = Pattern.compile("^(\\+|-)?0[xX]([0-9a-fA-F]+)$"); private IntegerValue(String pStrVal, int pRadix, boolean pTyped, boolean pSigned, int pBitWidth) { this.iBigValue = new BigInteger(pStrVal, pRadix); @@ -205,8 +201,7 @@ private IntegerValue(String pStrVal, int pRadix, boolean pTyped, boolean pSigned this.iBitWidth = pBitWidth; } - private static IntegerValue make(String pStrVal, int pRadix, boolean pTyped, boolean pSigned, - int pBitWidth) { + private static IntegerValue make(String pStrVal, int pRadix, boolean pTyped, boolean pSigned, int pBitWidth) { IntegerValue val = new IntegerValue(pStrVal, pRadix, pTyped, pSigned, pBitWidth); if (pTyped) { if (!pSigned && val.isNegative()) { @@ -226,7 +221,7 @@ private static IntegerValue make(String pStrVal, int pRadix, boolean pTyped, boo /** * byteValue - * + * * @return byte */ public byte byteValue() { @@ -235,7 +230,7 @@ public byte byteValue() { /** * shortValue - * + * * @return short */ public short shortValue() { @@ -244,7 +239,7 @@ public short shortValue() { /** * intValue - * + * * @return int */ public int intValue() { @@ -253,7 +248,7 @@ public int intValue() { /** * longValue - * + * * @return long */ public long longValue() { @@ -262,7 +257,7 @@ public long longValue() { /** * bigIntValue - * + * * @return BigInteger */ public BigInteger bigIntValue() { @@ -271,7 +266,7 @@ public BigInteger bigIntValue() { /** * isNegative - * + * * @return true if the number is negative */ public boolean isNegative() { @@ -280,7 +275,7 @@ public boolean isNegative() { /** * isSigned - * + * * @return true if the number is signed integer */ public boolean isSigned() { @@ -290,7 +285,7 @@ public boolean isSigned() { /** * bitLength - * + * * @return the number of bits which is required for storing this integer * value. */ @@ -302,7 +297,7 @@ public int bitLength() { /** * getBitWidth - * + * * @return 8, 16, 32 or 64 */ public int getBitWidth() { @@ -329,5 +324,4 @@ public String toString() { public String getTypeInfo() { return isSigned() ? "sint" : "uint" + getBitWidth(); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/KeyValuePair.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/KeyValuePair.java index bfbd819..05c760d 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/KeyValuePair.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/KeyValuePair.java @@ -45,20 +45,18 @@ * key_name "=" key_value */ public class KeyValuePair { - private static final Pattern KEYNAMEPAT = Pattern.compile("^([A-Za-z][0-9A-Za-z_]*).*"); /** * Tries to get an KeyValuePair from the passed * pUriStr. - * + * * @param pTyped * @param pUriStr * @return an KeyValuePair or null if failed. * @throws IllegalArgumentException */ - public static KeyValuePair parse(boolean pTyped, URIString pUriStr) - throws IllegalArgumentException { + public static KeyValuePair parse(boolean pTyped, URIString pUriStr) throws IllegalArgumentException { // TODO: tracing TRC.log(uriStr.toString()); URIString uriStr = pUriStr.deepCopy(); if (!uriStr.matchAndCut(KEYNAMEPAT, 1)) { @@ -98,14 +96,15 @@ private KeyValuePair(String pKey, Value pValue, boolean pTyped) { public String toString() { StringBuffer buf = new StringBuffer(this.iKey + '='); if (this.iTyped) buf.append('(' + this.iValue.getTypeInfo() + ')'); - buf.append((this.iValue instanceof QuotedValue) ? ((QuotedValue) this.iValue) - .toQuotedString() : this.iValue.toString()); + buf.append( + (this.iValue instanceof QuotedValue) ? ((QuotedValue) this.iValue).toQuotedString() : this.iValue.toString() + ); return buf.toString(); } /** * getKey - * + * * @return the key String */ public String getKey() { @@ -114,11 +113,10 @@ public String getKey() { /** * getValue - * + * * @return the value String */ public Value getValue() { return this.iValue; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/KeyValuePairs.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/KeyValuePairs.java index 4dbf70a..40b9867 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/KeyValuePairs.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/KeyValuePairs.java @@ -46,7 +46,6 @@ * key_value_pair *("," key_value_pair) */ public class KeyValuePairs extends Vector { - /** * serialVersionUID */ @@ -54,15 +53,14 @@ public class KeyValuePairs extends Vector { /** * Tries to parse the key-value pairs from the passed pUriStr. - * + * * @param pTyped * @param pUriStr * @return instance of UntypedKeyValuePairs or * null if failed. * @throws IllegalArgumentException */ - public static KeyValuePairs parse(boolean pTyped, URIString pUriStr) - throws IllegalArgumentException { + public static KeyValuePairs parse(boolean pTyped, URIString pUriStr) throws IllegalArgumentException { // TODO: tracing TRC.log(uriStr.toString()); URIString uriStr = pUriStr.deepCopy(); KeyValuePairs pairs = new KeyValuePairs(); @@ -93,10 +91,8 @@ public String toString() { StringBuffer dstBuf = new StringBuffer(); for (int i = 0; i < size(); i++) { KeyValuePair pair = (KeyValuePair) elementAt(i); - if (sep != null) dstBuf.append(sep); - else sep = ","; + if (sep != null) dstBuf.append(sep); else sep = ","; dstBuf.append(pair.toString()); - } return dstBuf.toString(); } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/NamespaceHandle.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/NamespaceHandle.java index 28f54b0..138bb14 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/NamespaceHandle.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/NamespaceHandle.java @@ -52,7 +52,7 @@ public class NamespaceHandle { /** * Factory method which tries to build a NamespaceHandle from * the passed pUriStr - * + * * @param pUriStr * @return a NamespaceHandle or null in case of * failure @@ -67,7 +67,9 @@ public static NamespaceHandle parse(URIString pUriStr) { } else { auth = null; } - if (!uriStr.cutStarting('/')) { return null; } + if (!uriStr.cutStarting('/')) { + return null; + } String nsName = parseNamespaceName(uriStr); // namespaceName is optimal pUriStr.set(uriStr); @@ -85,7 +87,7 @@ private NamespaceHandle(Authority pAuth, String pNsName) { /** * Constructs a NamespaceHandle with namespace name only. - * + * * @param pNamespaceName */ public NamespaceHandle(String pNamespaceName) { @@ -98,13 +100,12 @@ public NamespaceHandle(String pNamespaceName) { */ @Override public String toString() { - return (this.iAuth == null ? "" : "//" + this.iAuth.toString()) + "/" - + (this.iNsName == null ? "" : this.iNsName); + return (this.iAuth == null ? "" : "//" + this.iAuth.toString()) + "/" + (this.iNsName == null ? "" : this.iNsName); } /** * getName - * + * * @return String */ public String getName() { @@ -113,7 +114,7 @@ public String getName() { /** * getUserInfo - * + * * @return String */ public String getUserInfo() { @@ -122,7 +123,7 @@ public String getUserInfo() { /** * getHost - * + * * @return String */ public String getHost() { @@ -131,7 +132,7 @@ public String getHost() { /** * getPort - * + * * @return String */ public String getPort() { @@ -140,12 +141,11 @@ public String getPort() { private static final String IDENTIFIER = "[A-Za-z][0-9A-Za-z\\._-]*"; - private static final Pattern NAMESPACENAME_PAT = Pattern.compile("^(" + IDENTIFIER + "(/" - + IDENTIFIER + ")*).*"); + private static final Pattern NAMESPACENAME_PAT = Pattern.compile("^(" + IDENTIFIER + "(/" + IDENTIFIER + ")*).*"); /** * IDENTIFIER *("/"IDENTIFIER) - * + * * @param pUriStr * @return String containing the namespace name or * null if failed. @@ -154,5 +154,4 @@ public static String parseNamespaceName(URIString pUriStr) { if (!pUriStr.matchAndCut(NAMESPACENAME_PAT, 1)) return null; return pUriStr.group(1); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/NamespacePath.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/NamespacePath.java index 35618c5..d524db2 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/NamespacePath.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/NamespacePath.java @@ -49,7 +49,6 @@ * */ public class NamespacePath { - private String iNamespaceType; private NamespaceHandle iNamespaceHandle; @@ -61,7 +60,7 @@ protected NamespacePath(String pNamespaceType, NamespaceHandle pNamespaceHandle) /** * Constructs a NamespacePath with namespace name only. - * + * * @param pNamespaceName */ public NamespacePath(String pNamespaceName) { @@ -70,7 +69,7 @@ public NamespacePath(String pNamespaceName) { /** * Tries to parse a namespace path from the passed uriStr. - * + * * @param pUriStr * @return NamespacePath instance or null if * failed. @@ -85,7 +84,9 @@ public static NamespacePath parse(URIString pUriStr) { if (!uriStr.cutStarting(':')) return null; } NamespaceHandle namespaceHandle = NamespaceHandle.parse(uriStr); - if (namespaceHandle == null) { return null; } + if (namespaceHandle == null) { + return null; + } pUriStr.set(uriStr); return new NamespacePath(namespaceType, namespaceHandle); } @@ -103,7 +104,7 @@ public String toString() { /** * getNamespaceType - * + * * @return the namespace type String */ public String getNamespaceType() { @@ -112,7 +113,7 @@ public String getNamespaceType() { /** * getNamespaceName - * + * * @return the namespace name String */ public String getNamespaceName() { @@ -121,7 +122,7 @@ public String getNamespaceName() { /** * getUserInfo - * + * * @return String */ public String getUserInfo() { @@ -130,7 +131,7 @@ public String getUserInfo() { /** * getHost - * + * * @return String */ public String getHost() { @@ -139,7 +140,7 @@ public String getHost() { /** * getPort - * + * * @return String */ public String getPort() { @@ -150,7 +151,7 @@ public String getPort() { /** * namespaceType = ("http" ["s"]) / ("cimxml.wbem" ["s"]) - * + * * @param pUriStr * @return the String containing the namespace type or null if * failed. @@ -159,5 +160,4 @@ private static String parseNamespaceType(URIString pUriStr) { if (!pUriStr.matchAndCut(TYPE_PAT, 1)) return null; return pUriStr.group(1); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/QuotedValue.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/QuotedValue.java index 9308d2d..eb1c26a 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/QuotedValue.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/QuotedValue.java @@ -44,12 +44,10 @@ * printed in a quoted form. */ public interface QuotedValue { - /** * Prints the String representation in a quoted form. - * + * * @return String */ public String toQuotedString(); - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/RealValue.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/RealValue.java index 4223a8f..c3b3edd 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/RealValue.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/RealValue.java @@ -42,7 +42,6 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; - import org.metricshub.wbem.sblim.cimclient.internal.util.MOF; import org.metricshub.wbem.sblim.cimclient.internal.util.Util; import org.metricshub.wbem.sblim.cimclient.internal.util.WBEMConfiguration; @@ -51,7 +50,6 @@ * Class RealValue parses and encapsulates real values. */ public class RealValue extends Value { - private double iValue; private boolean iDoublePrec; @@ -61,13 +59,12 @@ public class RealValue extends Value { /** * realValue = [ "+" | "-" ] *decimalDigit "." 1*decimalDigit [ ( "e" | "E" * ) [ "+" | "-" ] 1*decimalDigit ] parse - * + * * @param pUriStr * @param pDoublePrec * @return Value */ - private static Value parse(URIString pUriStr, boolean pDoublePrec, boolean pThrow) - throws IllegalArgumentException { + private static Value parse(URIString pUriStr, boolean pDoublePrec, boolean pThrow) throws IllegalArgumentException { URIString uriStr = pUriStr.deepCopy(); // get the substring till the next ',' or end of pUriStr String strVal = uriStr.removeTill(','); @@ -90,15 +87,15 @@ private static Value parse(URIString pUriStr, boolean pDoublePrec, boolean pThro try { if (WBEMConfiguration.getGlobalConfiguration().verifyJavaLangDoubleStrings()) { if (Util.isBadDoubleString(strVal)) throw new IllegalArgumentException( - "Double value string hangs older JVMs!\n" + pUriStr.markPosition()); + "Double value string hangs older JVMs!\n" + pUriStr.markPosition() + ); } double val = Double.parseDouble(strVal); pUriStr.set(uriStr); return new RealValue(val, pDoublePrec); } catch (NumberFormatException e) { if (pThrow) { - String msg = "Illegal number format!\n" + pUriStr.markPosition() - + "Nested message:\n" + e.getMessage(); + String msg = "Illegal number format!\n" + pUriStr.markPosition() + "Nested message:\n" + e.getMessage(); throw new IllegalArgumentException(msg); } return null; @@ -107,7 +104,7 @@ private static Value parse(URIString pUriStr, boolean pDoublePrec, boolean pThro /** * Parses a RealValue as a double precision value. - * + * * @param pUriStr * @return Value */ @@ -117,7 +114,7 @@ public static Value parse(URIString pUriStr) { /** * parseFloat - * + * * @param pUriStr * @return Value * @throws IllegalArgumentException @@ -129,7 +126,7 @@ public static Value parseFloat(URIString pUriStr) throws IllegalArgumentExceptio /** * parseDouble - * + * * @param pUriStr * @return Value * @throws IllegalArgumentException @@ -146,7 +143,7 @@ private RealValue(double pValue, boolean pDoublePrec) { /** * isDouble - * + * * @return boolean */ public boolean isDouble() { @@ -155,7 +152,7 @@ public boolean isDouble() { /** * floatValue - * + * * @return float */ public float floatValue() { @@ -164,7 +161,7 @@ public float floatValue() { /** * doubleValue - * + * * @return double */ public double doubleValue() { @@ -187,5 +184,4 @@ public String getTypeInfo() { if (this.iDoublePrec) return MOF.DT_REAL64; return MOF.DT_REAL32; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/ReferenceValue.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/ReferenceValue.java index c2039d4..7a110a9 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/ReferenceValue.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/ReferenceValue.java @@ -46,12 +46,11 @@ * Class UntypedReferenceValue encapsulates an untyped reference value. */ public class ReferenceValue extends Value implements QuotedValue { - private URI iRef; /** * Ctor. - * + * * @param pRef */ public ReferenceValue(URI pRef) { @@ -75,7 +74,7 @@ public String toQuotedString() { /** * getRef - * + * * @return URI */ public URI getRef() { @@ -89,5 +88,4 @@ public URI getRef() { public String getTypeInfo() { return MOF.REFERENCE; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/StringValue.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/StringValue.java index 50dcd6d..dd678fe 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/StringValue.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/StringValue.java @@ -46,7 +46,6 @@ * Class UntypedStringValue parses an untyped string value. */ public class StringValue extends Value implements QuotedValue { - private static final int NORMAL = 0; private static final int ESCAPED = 1; @@ -55,7 +54,7 @@ public class StringValue extends Value implements QuotedValue { /** * Factory method for parsing quoted strings. - * + * * @param pUriStr * @return Value instance * @throws IllegalArgumentException @@ -128,5 +127,4 @@ public String toQuotedString() { public String getTypeInfo() { return MOF.DT_STR; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/Test.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/Test.java index 063e240..add067d 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/Test.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/Test.java @@ -46,92 +46,92 @@ * Class Test is responsible for testing the WBEM-URI String parsing. */ public class Test { - private static String cUriArray[] = { - - "//www.acme.com/root/cimv2", - - "//www.acme.com/root/cimv2:CIM_RegisteredProfile", - - "https://jdd:test@acme.com:5959/cimv2:CIM_RegisteredProfile", - - "https://jdd:test@acme.com:5959/cimv2:CIM_RegisteredProfile." - + "Cool=\"Hey! It's a string\"", - - "https://jdd:test@acme.com:5959/cimv2:CIM_RegisteredProfile.ThisShouldBeAnInt=0", - - "https://jdd:test@acme.com:5959/cimv2:CIM_RegisteredProfile." - + "Cool=\"Hey! It's a string\"," - + "Yeah=\"Gee! \\\"It's an embedded string\\\"\"", - - "https://jdd:test@acme.com:5959/cimv2:CIM_RegisteredProfile." - // + - // "SelfRef=\"https://jdd:test@acme.com:5959/cimv2:CIM_RegisteredProfile\"", - + "InstRef=\"CIM_RegisteredProfile.IntKey=10\"", - "https://jdd:test@acme.com:5959/cimv2:CIM_RegisteredProfile." - + "Yeah=" - + Util.quote("Gee! " + Util.quote("It's an embedded string")) - + ",Ref=" - + Util.quote(// "https://jdd:test@acme.com:5959/cimv2:CIM_RegisteredProfile." - "root/cimv2:CIM_RegisteredProfile." + "Yeah=" - + Util.quote("Gee! " + Util.quote("It's an embedded string"))), - - "https://jdd:test@64.202.189.170:5959/cimv2:CIM_RegisteredProfile." - + "Yeah=" - + Util.quote("Gee! " + Util.quote("It's an embedded string")) - + ",Ref=" - + Util.quote(// "https://jdd:test@acme.com:5959/cimv2:CIM_RegisteredProfile." - "CIM_RegisteredProfile." + "Yeah=" - + Util.quote("Gee! " + Util.quote("It's an embedded string"))), - - "https://64.202.189.170:5959/cimv2:CIM_RegisteredProfile." - + "Yeah=" - + Util.quote("Gee! " + Util.quote("It's an embedded string")) - + ",Ref=" - + Util.quote(// "https://jdd:test@acme.com:5959/cimv2:CIM_RegisteredProfile." - "CIM_RegisteredProfile." + "Yeah=" - + Util.quote("Gee! " + Util.quote("It's an embedded string"))), - - "https://64.202.189.170:5959/cimv2:CIM_RegisteredProfile." - + "Yeah=" - + Util.quote("Gee! " + Util.quote("It's an embedded string")) - + ",Ref=" - + Util.quote("CIM_RegisteredProfile." + "Yeah=" - + Util.quote("Gee! " + Util.quote("It's an embedded string"))) - + ",CharKey0='a'" + ",CharKey1='\\x32'" + ",boolKeyT=True" + ",boolKeyF=False" - + ",binValP=01011010b" + ",binValN=-01011010b" + ",octValP=0644" - + ",octValN=-0644" + ",decValP=1848" + ",decValN=-1848" + ",hexValP=0x55aa" - + ",hexValN=-0x55aa" + ",realValP=+23.566e-23" + ",realValN=-23.566e+23" - + ",dtAbs=" + Util.quote("20061027112135.600123+001") + ",dtInv=" - + Util.quote("00000042123625.600123:000"), - - /* - * Typed URI strings - */ - "https://64.202.189.170:5959/cimv2/(instance)CIM_RegisteredProfile." - + "Yeah=(string)" - + Util.quote("Gee! " + Util.quote("It's an embedded string")) - + ",uInt32=(uint32)100000" - + ",Real32=(real32)3.14" - + ",dtAbs=(datetime)" - + Util.quote("20061027112135.600123+001") - + ",dtInv=(datetime)" - + Util.quote("00000042123625.600123:000") - + ",Bool=(boolean)true" - + ",Char=(char16)'x'" - + ",Ref=(reference)" - + Util.quote("/(instance)CIM_RegisteredProfile." + "Yeah=(string)" - + Util.quote("Gee! " + Util.quote("It's an embedded string")) - + ",ClassRef=(reference)" - + Util.quote("/(instance)CIM_Gyurcsany.Key=(uint8)10")) - + ",RefWithNS=(reference)" - + Util.quote("root/cimv2/(instance)CIM_Orban.Key=(uint8)42") - + "//www.acme.com/root/cimv2", + "//www.acme.com/root/cimv2:CIM_RegisteredProfile", + "https://jdd:test@acme.com:5959/cimv2:CIM_RegisteredProfile", + "https://jdd:test@acme.com:5959/cimv2:CIM_RegisteredProfile." + "Cool=\"Hey! It's a string\"", + "https://jdd:test@acme.com:5959/cimv2:CIM_RegisteredProfile.ThisShouldBeAnInt=0", + "https://jdd:test@acme.com:5959/cimv2:CIM_RegisteredProfile." + + "Cool=\"Hey! It's a string\"," + + "Yeah=\"Gee! \\\"It's an embedded string\\\"\"", + "https://jdd:test@acme.com:5959/cimv2:CIM_RegisteredProfile." + + // + + // "SelfRef=\"https://jdd:test@acme.com:5959/cimv2:CIM_RegisteredProfile\"", + "InstRef=\"CIM_RegisteredProfile.IntKey=10\"", + "https://jdd:test@acme.com:5959/cimv2:CIM_RegisteredProfile." + + "Yeah=" + + Util.quote("Gee! " + Util.quote("It's an embedded string")) + + ",Ref=" + + Util.quote( // "https://jdd:test@acme.com:5959/cimv2:CIM_RegisteredProfile." + "root/cimv2:CIM_RegisteredProfile." + "Yeah=" + Util.quote("Gee! " + Util.quote("It's an embedded string")) + ), + "https://jdd:test@64.202.189.170:5959/cimv2:CIM_RegisteredProfile." + + "Yeah=" + + Util.quote("Gee! " + Util.quote("It's an embedded string")) + + ",Ref=" + + Util.quote( // "https://jdd:test@acme.com:5959/cimv2:CIM_RegisteredProfile." + "CIM_RegisteredProfile." + "Yeah=" + Util.quote("Gee! " + Util.quote("It's an embedded string")) + ), + "https://64.202.189.170:5959/cimv2:CIM_RegisteredProfile." + + "Yeah=" + + Util.quote("Gee! " + Util.quote("It's an embedded string")) + + ",Ref=" + + Util.quote( // "https://jdd:test@acme.com:5959/cimv2:CIM_RegisteredProfile." + "CIM_RegisteredProfile." + "Yeah=" + Util.quote("Gee! " + Util.quote("It's an embedded string")) + ), + "https://64.202.189.170:5959/cimv2:CIM_RegisteredProfile." + + "Yeah=" + + Util.quote("Gee! " + Util.quote("It's an embedded string")) + + ",Ref=" + + Util.quote("CIM_RegisteredProfile." + "Yeah=" + Util.quote("Gee! " + Util.quote("It's an embedded string"))) + + ",CharKey0='a'" + + ",CharKey1='\\x32'" + + ",boolKeyT=True" + + ",boolKeyF=False" + + ",binValP=01011010b" + + ",binValN=-01011010b" + + ",octValP=0644" + + ",octValN=-0644" + + ",decValP=1848" + + ",decValN=-1848" + + ",hexValP=0x55aa" + + ",hexValN=-0x55aa" + + ",realValP=+23.566e-23" + + ",realValN=-23.566e+23" + + ",dtAbs=" + + Util.quote("20061027112135.600123+001") + + ",dtInv=" + + Util.quote("00000042123625.600123:000"), + /* + * Typed URI strings + */ + "https://64.202.189.170:5959/cimv2/(instance)CIM_RegisteredProfile." + + "Yeah=(string)" + + Util.quote("Gee! " + Util.quote("It's an embedded string")) + + ",uInt32=(uint32)100000" + + ",Real32=(real32)3.14" + + ",dtAbs=(datetime)" + + Util.quote("20061027112135.600123+001") + + ",dtInv=(datetime)" + + Util.quote("00000042123625.600123:000") + + ",Bool=(boolean)true" + + ",Char=(char16)'x'" + + ",Ref=(reference)" + + Util.quote( + "/(instance)CIM_RegisteredProfile." + + "Yeah=(string)" + + Util.quote("Gee! " + Util.quote("It's an embedded string")) + + ",ClassRef=(reference)" + + Util.quote("/(instance)CIM_Gyurcsany.Key=(uint8)10") + ) + + ",RefWithNS=(reference)" + + Util.quote("root/cimv2/(instance)CIM_Orban.Key=(uint8)42") }; /** * main - * + * * @param args */ public static void main(String args[]) { @@ -156,20 +156,28 @@ public static void main(String args[]) { for (int j = 0; j < pairs.size(); j++) { KeyValuePair pair = (KeyValuePair) pairs.elementAt(j); Value value = pair.getValue(); - System.out.println("key : " + pair.getKey() + "\n " + getTypeStr(value) + " : " - + pair.getValue().toString() + " " + getIntProps(value)); + System.out.println( + "key : " + + pair.getKey() + + "\n " + + getTypeStr(value) + + " : " + + pair.getValue().toString() + + " " + + getIntProps(value) + ); } } } private static String getTypeStr(Value pVal) { - if (pVal instanceof ReferenceValue) return "refValue"; - else if (pVal instanceof StringValue) return "strValue"; - else if (pVal instanceof CharValue) return "chrValue"; - else if (pVal instanceof BooleanValue) return "boolValue"; - else if (pVal instanceof DateTimeValue) return "dateTimeVal"; - else if (pVal instanceof IntegerValue) return "intValue"; - else if (pVal instanceof RealValue) return "realValue"; + if (pVal instanceof ReferenceValue) return "refValue"; else if ( + pVal instanceof StringValue + ) return "strValue"; else if (pVal instanceof CharValue) return "chrValue"; else if ( + pVal instanceof BooleanValue + ) return "boolValue"; else if (pVal instanceof DateTimeValue) return "dateTimeVal"; else if ( + pVal instanceof IntegerValue + ) return "intValue"; else if (pVal instanceof RealValue) return "realValue"; return pVal.getClass().getName(); } @@ -178,5 +186,4 @@ private static String getIntProps(Value pVal) { IntegerValue intVal = (IntegerValue) pVal; return "sigend=" + intVal.isSigned() + ", bitWidth=" + intVal.getBitWidth(); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/URI.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/URI.java index 7836d18..54a8c08 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/URI.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/URI.java @@ -43,21 +43,20 @@ */ import java.util.regex.Pattern; - import org.metricshub.wbem.sblim.cimclient.internal.util.MOF; /** *
        *    untypedNamespacePath	=	namespacePath
      - *   
      + *
        *    untypedClassPath		=	namespacePath ":" className
      - *    
      + *
        *    untypedInstancePath	=	namespacePath ":" className "." key_value_pairs
      - *    
      + *
        *    typedNamespacePath	=	namespacePath "/(namespace)"
      - *   
      + *
        *    typedClassPath		=	namespacePath "/(class)" className
      - *   
      + *
        *    typedInstancePath	= 	namespacePath "/(instance)" className "." typed_key_value_pairs
        * 
      */ @@ -65,7 +64,7 @@ public class URI { /** * parse - * + * * @param pUri * @return URI * @throws IllegalArgumentException @@ -82,8 +81,7 @@ public static URI parse(String pUri) throws IllegalArgumentException { boolean typed = uriType != null; if (uriStr.length() == 0) { if (typed && uriType != NAMESPACE) { - String msg = uriType + " excepted but " + NAMESPACE + " found!\n" - + uriStr.markPosition(); + String msg = uriType + " excepted but " + NAMESPACE + " found!\n" + uriStr.markPosition(); throw new IllegalArgumentException(msg); } return new URI(nsPath, uriType, null, null); @@ -95,8 +93,7 @@ public static URI parse(String pUri) throws IllegalArgumentException { String className = parseClassName(uriStr, typed); if (uriStr.length() == 0) { if (typed && uriType != CLASS) { - String msg = uriType + " expected but " + CLASS + " found!\n" - + uriStr.markPosition(); + String msg = uriType + " expected but " + CLASS + " found!\n" + uriStr.markPosition(); throw new IllegalArgumentException(msg); } return new URI(nsPath, uriType, className, null); @@ -107,16 +104,16 @@ public static URI parse(String pUri) throws IllegalArgumentException { /** *
      -	 *  referenceValue			=	[ namespaceName ":" ] className "." 
      +	 *  referenceValue			=	[ namespaceName ":" ] className "."
       	 * 								untyped_key_value_pairs
      -	 * 
      +	 *
       	 *  typed_reference_value		=	"(reference)" "\"" typedReferenceValue "\""
      -	 *  
      +	 *
       	 *  // according to Alexander we have to support instance references only
       	 *  typedReferenceValue	=	[ namespaceName ] "/(instance)" className "."
       	 *  							typed_key_value_pairs
       	 * 
      - * + * * @param pUriStr * @param pTyped * @return URI @@ -143,14 +140,12 @@ public static URI parseRef(URIString pUriStr, boolean pTyped) throws IllegalArgu if (uriStr.length() == 0) { if (pTyped) return new URI(null, className, null, pTyped); // untyped reference can be instance reference only - String msg = "Untyped reference can be instance reference only!\n" - + uriStr.markPosition(); + String msg = "Untyped reference can be instance reference only!\n" + uriStr.markPosition(); throw new IllegalArgumentException(msg); } KeyValuePairs keyValuePairs = parseKeyValuePairs(uriStr, pTyped); if (keyValuePairs == null) { - String msg = "Property reference must contain key-value pairs!\n" - + uriStr.markPosition(); + String msg = "Property reference must contain key-value pairs!\n" + uriStr.markPosition(); throw new IllegalArgumentException(msg); } pUriStr.set(uriStr); @@ -159,7 +154,7 @@ public static URI parseRef(URIString pUriStr, boolean pTyped) throws IllegalArgu /** * getNamespaceType - * + * * @return String or null if not set */ public String getNamespaceType() { @@ -168,7 +163,7 @@ public String getNamespaceType() { /** * getNamespaceName - * + * * @return String or null if not set */ public String getNamespaceName() { @@ -177,7 +172,7 @@ public String getNamespaceName() { /** * getUserInfo - * + * * @return String or null if not set */ public String getUserInfo() { @@ -186,7 +181,7 @@ public String getUserInfo() { /** * getHost Userinfo is attached if exists. - * + * * @return String or null if not set */ public String getHost() { @@ -198,7 +193,7 @@ public String getHost() { /** * getPort - * + * * @return String or null if not set */ public String getPort() { @@ -207,7 +202,7 @@ public String getPort() { /** * getClassName - * + * * @return String or null if not set */ public String getClassName() { @@ -216,7 +211,7 @@ public String getClassName() { /** * getKeyValuePairs - * + * * @return KeyValuePairs or null if not set */ public KeyValuePairs getKeyValuePairs() { @@ -230,8 +225,7 @@ public KeyValuePairs getKeyValuePairs() { public String toString() { StringBuffer buf = new StringBuffer(); if (this.iNamespacePath != null) { - if (this.iIsRef) buf.append(getNamespaceName()); - else buf.append(this.iNamespacePath.toString()); + if (this.iIsRef) buf.append(getNamespaceName()); else buf.append(this.iNamespacePath.toString()); } if (this.iUriType != null) buf.append("/(" + this.iUriType + ")"); if (this.iClassName != null) { @@ -250,14 +244,13 @@ public String toString() { /** * Constructor for URI paths. - * + * * @param pNamespacePath * @param pUriType * @param pClassName * @param pKeyValuePairs */ - private URI(NamespacePath pNamespacePath, String pUriType, String pClassName, - KeyValuePairs pKeyValuePairs) { + private URI(NamespacePath pNamespacePath, String pUriType, String pClassName, KeyValuePairs pKeyValuePairs) { this.iNamespacePath = pNamespacePath; this.iUriType = pUriType; this.iClassName = pClassName; @@ -267,14 +260,13 @@ private URI(NamespacePath pNamespacePath, String pUriType, String pClassName, /** * Constructor for reference property values. - * + * * @param pNamespaceName * @param pClassName * @param pKeyValuePairs * @param pTyped */ - private URI(String pNamespaceName, String pClassName, KeyValuePairs pKeyValuePairs, - boolean pTyped) { + private URI(String pNamespaceName, String pClassName, KeyValuePairs pKeyValuePairs, boolean pTyped) { if (pNamespaceName == null && pClassName == null) { String msg = "pNamespaceName or pClassName must be set!"; throw new IllegalArgumentException(msg); @@ -285,9 +277,8 @@ private URI(String pNamespaceName, String pClassName, KeyValuePairs pKeyValuePai } this.iNamespacePath = pNamespaceName == null ? null : new NamespacePath(pNamespaceName); if (pTyped) { - if (pKeyValuePairs != null) this.iUriType = INSTANCE; - else if (pClassName != null) this.iUriType = CLASS; - else this.iUriType = NAMESPACE; + if (pKeyValuePairs != null) this.iUriType = INSTANCE; else if (pClassName != null) this.iUriType = + CLASS; else this.iUriType = NAMESPACE; } else this.iUriType = null; this.iClassName = pClassName; this.iKeyValuePairs = pKeyValuePairs; @@ -307,12 +298,11 @@ private URI(String pNamespaceName, String pClassName, KeyValuePairs pKeyValuePai private boolean iIsRef; - private static final String NAMESPACE = MOF.NAMESPACE, CLASS = MOF.CLASS, - INSTANCE = MOF.INSTANCE; + private static final String NAMESPACE = MOF.NAMESPACE, CLASS = MOF.CLASS, INSTANCE = MOF.INSTANCE; /** * uriType = "/(" ( "namespace" / "class" / "instance" ) ")" - * + * * @param pUriStr * @return NAMESPACE | CLASS | INSTANCE */ @@ -321,10 +311,8 @@ private static String parseUriType(URIString pUriStr) { if (!uriStr.cutStarting("/(")) return null; String typeStr = uriStr.removeTill(')', true, true); if (typeStr == null) return null; - if (typeStr.equalsIgnoreCase(NAMESPACE)) typeStr = NAMESPACE; - else if (typeStr.equalsIgnoreCase(CLASS)) typeStr = CLASS; - else if (typeStr.equalsIgnoreCase(INSTANCE)) typeStr = INSTANCE; - else return null; + if (typeStr.equalsIgnoreCase(NAMESPACE)) typeStr = NAMESPACE; else if (typeStr.equalsIgnoreCase(CLASS)) typeStr = + CLASS; else if (typeStr.equalsIgnoreCase(INSTANCE)) typeStr = INSTANCE; else return null; pUriStr.set(uriStr); return typeStr; } @@ -342,8 +330,7 @@ private static String parseUriType(URIString pUriStr) { /** * @param pTyped */ - private static String parseClassName(URIString pUriStr, boolean pTyped) - throws IllegalArgumentException { + private static String parseClassName(URIString pUriStr, boolean pTyped) throws IllegalArgumentException { if (!pUriStr.matchAndCut(PAT, 1)) { String msg = "className expected!\n" + pUriStr.markPosition(); throw new IllegalArgumentException(msg); @@ -352,8 +339,7 @@ private static String parseClassName(URIString pUriStr, boolean pTyped) return className; } - private static KeyValuePairs parseKeyValuePairs(URIString pUriStr, boolean pTyped) - throws IllegalArgumentException { + private static KeyValuePairs parseKeyValuePairs(URIString pUriStr, boolean pTyped) throws IllegalArgumentException { if (!pUriStr.cutStarting('.')) { String msg = "'.' expected!\n" + pUriStr.markPosition(); throw new IllegalArgumentException(msg); @@ -365,5 +351,4 @@ private static KeyValuePairs parseKeyValuePairs(URIString pUriStr, boolean pType } return keyValuePairs; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/URIString.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/URIString.java index c18231b..4e81ed4 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/URIString.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/URIString.java @@ -51,16 +51,26 @@ public class URIString extends Object implements CharSequence { /** * Ctor. - * + * * @param pCharArray * @param pStart * @param pEnd */ public URIString(char[] pCharArray, int pStart, int pEnd) { if (pEnd < pStart) throw new IndexOutOfBoundsException("end:" + pEnd + " < start:" + pStart); - if (pEnd > pCharArray.length) throw new IndexOutOfBoundsException("charArray.length:" - + pCharArray.length + ", start:" + pStart + ", end:" + pEnd + "\n" + "end:" + pEnd - + " > charArray.length:" + pCharArray.length); + if (pEnd > pCharArray.length) throw new IndexOutOfBoundsException( + "charArray.length:" + + pCharArray.length + + ", start:" + + pStart + + ", end:" + + pEnd + + "\n" + + "end:" + + pEnd + + " > charArray.length:" + + pCharArray.length + ); this.iCA = pCharArray; this.iInitStart = this.iStart = pStart; this.iEnd = pEnd; @@ -68,7 +78,7 @@ public URIString(char[] pCharArray, int pStart, int pEnd) { /** * Ctor. - * + * * @param pCharArray */ public URIString(char[] pCharArray) { @@ -77,7 +87,7 @@ public URIString(char[] pCharArray) { /** * Ctor. - * + * * @param pStr */ public URIString(String pStr) { @@ -86,7 +96,7 @@ public URIString(String pStr) { /** * Ctor. - * + * * @param pUriStr */ public URIString(URIString pUriStr) { @@ -95,7 +105,7 @@ public URIString(URIString pUriStr) { /** * set - * + * * @param pUriStr */ public void set(URIString pUriStr) { @@ -106,7 +116,7 @@ public void set(URIString pUriStr) { /** * deepCopy - * + * * @return URIString instance */ public URIString deepCopy() { @@ -115,13 +125,12 @@ public URIString deepCopy() { /** * find - * + * * @param pChar * @return Position of pChar or -1 if not found. */ public int find(char pChar) { - for (int i = 0; i < length(); i++) - if (charAt(i) == pChar) return i; + for (int i = 0; i < length(); i++) if (charAt(i) == pChar) return i; return -1; } @@ -156,7 +165,7 @@ public String toString() { /** * toInitString - * + * * @return The String which was used for initializing this instance. */ public String toInitString() { @@ -165,7 +174,7 @@ public String toInitString() { /** * getPos - * + * * @return The position of parsing. */ public int getPos() { @@ -174,7 +183,7 @@ public int getPos() { /** * markPosition - * + * * @return a String which marks the position of parsing. */ public String markPosition() { @@ -183,15 +192,14 @@ public String markPosition() { /** * markPosition - * + * * @param pPos * @return a String which marks position pPos. */ public String markPosition(int pPos) { StringBuffer buf = new StringBuffer(); buf.append(toInitString() + '\n'); - for (int i = 0; i < pPos; i++) - buf.append(' '); + for (int i = 0; i < pPos; i++) buf.append(' '); buf.append("^\n"); return buf.toString(); } @@ -200,7 +208,7 @@ public String markPosition(int pPos) { * Returns a new string that is a substring of this string. The substring * begins at the specified pBeginIdx and extends to the character at index * pEndIdx - 1. Thus the length of the substring is pEndIdx-pBeginIdx. - * + * * @param pBeginIdx * @param pEndIdx * @return String @@ -211,7 +219,7 @@ public String substring(int pBeginIdx, int pEndIdx) { /** * startsWith - * + * * @param pC * @return true if the first character is pC. */ @@ -229,7 +237,7 @@ public void cutStarting() { /** * Cuts out the first character if it is pC. - * + * * @param pC * @return true if cut is done. */ @@ -243,21 +251,20 @@ public boolean cutStarting(char pC) { /** * Cuts out pSeq from the beginning if it is there. - * + * * @param pSeq * @return true if cut is done. */ public boolean cutStarting(CharSequence pSeq) { if (pSeq.length() > length()) return false; - for (int i = 0; i < pSeq.length(); i++) - if (charAt(i) != pSeq.charAt(i)) return false; + for (int i = 0; i < pSeq.length(); i++) if (charAt(i) != pSeq.charAt(i)) return false; this.iStart += pSeq.length(); return true; } /** * Cuts out pStr from the beginning if it is there. - * + * * @param pStr * @param pIgnoreCase * @return true if cut is done. @@ -274,12 +281,11 @@ public boolean cutStarting(String pStr, boolean pIgnoreCase) { /** * Cuts out pChars pieces of characters from the beginning. - * + * * @param pChars */ public void cutStarting(int pChars) { - if (pChars > length()) throw new IndexOutOfBoundsException("chars:" + pChars - + " > length()" + length()); + if (pChars > length()) throw new IndexOutOfBoundsException("chars:" + pChars + " > length()" + length()); this.iStart += pChars; } @@ -287,7 +293,7 @@ public void cutStarting(int pChars) { * Removes the beginning of the string till the first occurrence of pChar or * removes the whole string if it doesn't contain pChar and pMustFound is * false. - * + * * @param pChar * @param pRemoveChar * if true pChar will be removed too @@ -309,7 +315,7 @@ public String removeTill(char pChar, boolean pRemoveChar, boolean pMustFound) { /** * removeTill(pChar, pRemoveChar, false); - * + * * @param pChar * @param pRemoveChar * @return String @@ -321,7 +327,7 @@ public String removeTill(char pChar, boolean pRemoveChar) { /** * removeTill(pChar, false, false); - * + * * @param pChar * @return String * @see #removeTill(char, boolean, boolean) @@ -333,7 +339,7 @@ public String removeTill(char pChar) { /** * Matches pattern pPat and cuts out the beginning till the end * of matcher group pGroup. - * + * * @param pPat * @param pGroup * @return true if pattern is matched and cut was done. @@ -360,5 +366,4 @@ public String group(int pI) { private int iInitStart, iStart, iEnd; private Matcher iM; - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/Value.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/Value.java index 8632245..edd5bac 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/Value.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/Value.java @@ -48,7 +48,7 @@ public abstract class Value { /** * Factory method which tries to parse an untyped value. - * + * * @param pTyped * @param pUriStr * @return Value instance @@ -78,10 +78,12 @@ public static Value parse(boolean pTyped, URIString pUriStr) throws IllegalArgum return value; } catch (IllegalArgumentException e) { // non string like value - if ((value = IntegerValue.parse(uriStr)) != null - || (value = RealValue.parse(uriStr)) != null - || (value = BooleanValue.parse(uriStr)) != null - || (value = CharValue.parse(uriStr)) != null) { + if ( + (value = IntegerValue.parse(uriStr)) != null || + (value = RealValue.parse(uriStr)) != null || + (value = BooleanValue.parse(uriStr)) != null || + (value = CharValue.parse(uriStr)) != null + ) { pUriStr.set(uriStr); return value; } @@ -92,7 +94,7 @@ public static Value parse(boolean pTyped, URIString pUriStr) throws IllegalArgum /** * getTypeInfo - * + * * @return the type description string of the Value. */ public abstract String getTypeInfo(); @@ -142,8 +144,13 @@ private static Value parseTypedValue(URIString pUriStr) throws IllegalArgumentEx val = null; } } catch (IllegalArgumentException e) { - String msg = "Failed to parse " + typeInfo + " value!\n" - + uriStr.markPosition(valuePos) + "Nested message:\n" + e.getMessage(); + String msg = + "Failed to parse " + + typeInfo + + " value!\n" + + uriStr.markPosition(valuePos) + + "Nested message:\n" + + e.getMessage(); throw new IllegalArgumentException(msg); } if (val == null) { @@ -160,8 +167,11 @@ private static Value parseTypedReference(URIString pUriStr) throws IllegalArgume try { strVal = StringValue.parse(pUriStr); } catch (IllegalArgumentException e) { - String msg = "Failed to retrieve typed reference string!\n" + pUriStr.markPosition() - + "Nested message is:\n" + e.getMessage(); + String msg = + "Failed to retrieve typed reference string!\n" + + pUriStr.markPosition() + + "Nested message is:\n" + + e.getMessage(); throw new IllegalArgumentException(msg); } URIString refUriStr = new URIString(strVal.toString()); @@ -169,8 +179,11 @@ private static Value parseTypedReference(URIString pUriStr) throws IllegalArgume URI ref = URI.parseRef(refUriStr, true); return new ReferenceValue(ref); } catch (IllegalArgumentException e) { - String msg = "Failed to parse typed reference value!\n" + pUriStr.markPosition(pos) - + "Nested message is:\n" + e.getMessage(); + String msg = + "Failed to parse typed reference value!\n" + + pUriStr.markPosition(pos) + + "Nested message is:\n" + + e.getMessage(); throw new IllegalArgumentException(msg); } } @@ -180,8 +193,11 @@ private static Value parseTypedDateTime(URIString pUriStr) throws IllegalArgumen try { strVal = StringValue.parse(pUriStr); } catch (IllegalArgumentException e) { - String msg = "Failed to retrieve typed datetime string!\n" + pUriStr.markPosition() - + "Nested message is:\n" + e.getMessage(); + String msg = + "Failed to retrieve typed datetime string!\n" + + pUriStr.markPosition() + + "Nested message is:\n" + + e.getMessage(); throw new IllegalArgumentException(msg); } return DateTimeValue.parse(strVal.toString(), true); @@ -195,5 +211,4 @@ private static String parseTypeInfo(URIString pUriStr) { pUriStr.set(uriStr); return typeInfo; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/util/MOF.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/util/MOF.java index c4a76d5..f0a0f60 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/util/MOF.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/util/MOF.java @@ -52,29 +52,27 @@ import java.util.Comparator; import java.util.TreeMap; - import org.metricshub.wbem.javax.cim.CIMClass; import org.metricshub.wbem.javax.cim.CIMDataType; +import org.metricshub.wbem.javax.cim.CIMDateTime; +import org.metricshub.wbem.javax.cim.CIMElement; +import org.metricshub.wbem.javax.cim.CIMFlavor; import org.metricshub.wbem.javax.cim.CIMInstance; import org.metricshub.wbem.javax.cim.CIMMethod; import org.metricshub.wbem.javax.cim.CIMObjectPath; import org.metricshub.wbem.javax.cim.CIMParameter; +import org.metricshub.wbem.javax.cim.CIMProperty; +import org.metricshub.wbem.javax.cim.CIMQualifiedElementInterface; import org.metricshub.wbem.javax.cim.CIMQualifier; import org.metricshub.wbem.javax.cim.CIMQualifierType; +import org.metricshub.wbem.javax.cim.CIMScope; import org.metricshub.wbem.javax.cim.CIMTypedElement; import org.metricshub.wbem.javax.cim.CIMValuedElement; -import org.metricshub.wbem.javax.cim.CIMDateTime; -import org.metricshub.wbem.javax.cim.CIMElement; -import org.metricshub.wbem.javax.cim.CIMFlavor; -import org.metricshub.wbem.javax.cim.CIMProperty; -import org.metricshub.wbem.javax.cim.CIMQualifiedElementInterface; -import org.metricshub.wbem.javax.cim.CIMScope; /** * Class MOF is responsible for helping MOF String generation. */ public class MOF { - /** * CLASS */ @@ -277,10 +275,10 @@ public class MOF { * classDeclaration = [ qualifierList ] CLASS className [ superClass ] * "{" *classFeature "}" ";" * classFeature = propertyDeclaration | methodDeclaration - * + * * superClass = ":" className * - * + * * @param pCl * @param pInd * @return the MOF string @@ -294,10 +292,8 @@ public static String classDeclaration(CIMClass pCl, String pInd) { if (supCl != null) buf.append(':' + supCl + ' '); buf.append("{\n"); // *classFeature - for (int i = 0; i < pCl.getPropertyCount(); i++) - buf.append(propertyDeclaration(pCl.getProperty(i), pInd + INDENT)); - for (int i = 0; i < pCl.getMethodCount(); i++) - buf.append(methodDeclaration(pCl.getMethod(i), pInd + INDENT)); + for (int i = 0; i < pCl.getPropertyCount(); i++) buf.append(propertyDeclaration(pCl.getProperty(i), pInd + INDENT)); + for (int i = 0; i < pCl.getMethodCount(); i++) buf.append(methodDeclaration(pCl.getMethod(i), pInd + INDENT)); buf.append("};"); return buf.toString(); } @@ -305,7 +301,7 @@ public static String classDeclaration(CIMClass pCl, String pInd) { /** * instanceDeclaration = [ qualifierList ] INSTANCE OF className [ alias ] * "{" 1*valueInitializer "}" ";" - * + * * @param pInst * @param pInd * @return the MOF string @@ -317,8 +313,9 @@ public static String instanceDeclaration(CIMInstance pInst, String pInd) { StringBuffer buf = new StringBuffer(); buf.append(pInd + INSTOF + pInst.getClassName() + " {\n"); // Add all properties in prop array - for (int i = 0; i < pInst.getPropertyCount(); i++) - buf.append(valueInitializer(pInst.getProperty(i), pInd + INDENT)); + for (int i = 0; i < pInst.getPropertyCount(); i++) buf.append( + valueInitializer(pInst.getProperty(i), pInd + INDENT) + ); // Add keys that are NOT also in prop array CIMProperty[] keys = pInst.getKeys(); for (int i = 0; i < keys.length; i++) { @@ -335,7 +332,7 @@ public static String instanceDeclaration(CIMInstance pInst, String pInd) { * methodDeclaration = [ qualifierList ] dataType methodName * "(" [ parameterList ] ")" ";" * - * + * * @param pMethod * @param pInd * @return the MOF string @@ -354,7 +351,7 @@ public static String methodDeclaration(CIMMethod pMethod, String pInd) { /** * parameter - * + * * @param pParam * - CIMParameter * @param pInd @@ -365,17 +362,23 @@ public static String parameter(CIMParameter pParam, String pInd) { } /** - * + * * typedElement = [ qualifierList ] (dataType|objectRef) parameterName [ * array ] - * + * * @param pTypedElement * @param pInd * @return the MOF string */ public static String typedElement(CIMTypedElement pTypedElement, String pInd) { - return qualifierList(pTypedElement, pInd) + pInd + dataType(pTypedElement) + ' ' - + pTypedElement.getName() + array(pTypedElement); + return ( + qualifierList(pTypedElement, pInd) + + pInd + + dataType(pTypedElement) + + ' ' + + pTypedElement.getName() + + array(pTypedElement) + ); } /** @@ -383,7 +386,7 @@ public static String typedElement(CIMTypedElement pTypedElement, String pInd) { * valuedElement = typedElement [ defaultValue ] ";" * defaultValue = "=" initializer * - * + * * @param pValuedElement * @param pInd * @return the MOF string @@ -399,7 +402,7 @@ public static String valuedElement(CIMValuedElement pValuedElement, String pI *
       	 *        qualifierList			=	"[" qualifier *( "," qualifier ) "]"
       	 * 
      - * + * * @param pElement * @param pInd * @return the MOF string +newLine if qualifiers present or empty string @@ -419,16 +422,26 @@ public static String qualifierList(CIMElement pElement, String pInd) { /** *
      -	 *        qualifierDeclaration	=	QUALIFIER qualifierName qualifierType scope 
      +	 *        qualifierDeclaration	=	QUALIFIER qualifierName qualifierType scope
       	 *        							[ defaultFlavor ] ";"
       	 * 
      - * + * * @param pQType * @return the MOF string */ public static String qualifierDeclaration(CIMQualifierType pQType) { - return QUALIFIER + ' ' + pQType.getName() + ' ' + dataType(pQType) + ' ' - + scope(pQType.getScope()) + ' ' + flavor(pQType.getFlavor()) + ';'; + return ( + QUALIFIER + + ' ' + + pQType.getName() + + ' ' + + dataType(pQType) + + ' ' + + scope(pQType.getScope()) + + ' ' + + flavor(pQType.getFlavor()) + + ';' + ); } /** @@ -437,7 +450,7 @@ public static String qualifierDeclaration(CIMQualifierType pQType) { * metaElement = CLASS | ASSOCIATION | INDICATION | QUALIFIER * PROPERTY | REFERENCE | METHOD | PARAMETER | ANY * - * + * * @param pScopes * @return the MOF string */ @@ -470,7 +483,7 @@ public static String scope(int pScopes) { *
       	 * flavor = ENABLEOVERRIDE | DISABLEOVERRIDE | RESTRICTED | TOSUBCLASS | TRANSLATABLE
       	 * 
      - * + * * @param flavor * @return the MOF string */ @@ -490,7 +503,7 @@ public static String flavor(int flavor) { *
       	 *        qualifier				=	qualifierName [ qualifierParameter ] [ ":" 1*flavor ]
       	 * 
      - * + * * @param pQuali * @return the MOF string */ @@ -498,8 +511,7 @@ public static String qualifier(CIMQualifier pQuali) { StringBuffer buf = new StringBuffer(); buf.append(pQuali.getName()); // TODO: review. Why qualifierParameter is optional? - if (pQuali.getDataType() != null && pQuali.getValue() != null) buf - .append(qualifierParameter(pQuali)); + if (pQuali.getDataType() != null && pQuali.getValue() != null) buf.append(qualifierParameter(pQuali)); // FIXME: why flavors are optional // if (pQuali.getFlavor() != 0) buf.append(':' + flavor(pQuali.getFlavor())); @@ -511,7 +523,7 @@ public static String qualifier(CIMQualifier pQuali) { * propertyDeclaration = typedElement [ defaultValue ] ";" * defaultValue = "=" initializer * - * + * * @param pProp * @param pInd * @return the MOF string @@ -525,15 +537,16 @@ public static String propertyDeclaration(CIMProperty pProp, String pInd) { * valueInitializer = [ qualifierList ] ( propertyName | referenceName ) "=" * initializer ";" * - * + * * @param pProp * @param pInd * @return the MOF string */ public static String valueInitializer(CIMProperty pProp, String pInd) { Object value = pProp.getValue(); - if (value != null) { return qualifierList(pProp, pInd) + pInd + pProp.getName() + " = " - + initializer(value, pInd) + ";\n"; } + if (value != null) { + return qualifierList(pProp, pInd) + pInd + pProp.getName() + " = " + initializer(value, pInd) + ";\n"; + } return ""; } @@ -542,14 +555,14 @@ public static String valueInitializer(CIMProperty pProp, String pInd) { * dataType = DT_UINT8 | DT_SINT8 | DT_UINT16 | DT_SINT16 | DT_UINT32 | DT_SINT32 | DT_UINT64 * | DT_SINT64 | DT_REAL32 | DT_REAL64 | DT_CHAR16 | DT_STR | DT_BOOL | DT_DATETIME * - * + * * Additionally it handles reference types too. - * + * *
       	 *        objectType	=	objectRef
       	 *        objectRef		=	className REF
       	 * 
      - * + * * @param pType * @return the MOF string */ @@ -575,7 +588,7 @@ public static String dataType(CIMTypedElement pTypedElement) { /** * objectHandle - * + * * @param pPath * @return the Untyped MOF String */ @@ -585,7 +598,7 @@ public static String objectHandle(CIMObjectPath pPath) { /** * objectHandle - * + * * @param pPath * The path * @param pTyped @@ -605,8 +618,7 @@ public static String objectHandle(CIMObjectPath pPath, boolean pTyped, boolean p if (!pLocal) buf.append('/'); buf.append(pPath.getNamespace()); } - if (pTyped) buf.append(pathType(pPath)); - else if (pPath.getObjectName() != null && buf.length() > 0) { + if (pTyped) buf.append(pathType(pPath)); else if (pPath.getObjectName() != null && buf.length() > 0) { buf.append(':'); } if (pPath.getObjectName() != null) { @@ -617,7 +629,7 @@ else if (pPath.getObjectName() != null && buf.length() > 0) { /** * objectHandleAsRef - * + * * @param pPath * @return the Untyped MOF String */ @@ -627,7 +639,7 @@ public static String objectHandleAsRef(CIMObjectPath pPath) { /** * objectHandleAsRef - * + * * @param pPath * @param pTyped * @return the MOF String @@ -649,7 +661,7 @@ public static String objectHandleAsRef(CIMObjectPath pPath, boolean pTyped) { * constantValue = integerValue | realValue | charValue | stringValue | booleanValue | nullValue * // | dateTimeValue | objectHandle * - * + * * @param pValuedElement * @param pInd * @return the MOF string @@ -660,7 +672,7 @@ public static String constantValue(CIMValuedElement pValuedElement, String pI /** * constantValue - * + * * @param pObj * @param pTyped * @param pInd @@ -703,7 +715,7 @@ public static String constantValue(Object pObj, boolean pTyped, String pInd) { /** * constantValue - * + * * @param pObj * @param pInd * @return the untyped MOF String @@ -742,7 +754,7 @@ private static String keyValuePairs(CIMProperty[] pKeys, boolean pTyped, Stri * parameterList = parameter *( "," parameter ) * parameter = [ qualifierList ] (dataType|objectRef) parameterName [ array ] * - * + * * @param pMethod * @return the MOF string */ @@ -757,7 +769,6 @@ private static String parameterList(CIMMethod pMethod, String pInd) { } private static class ScopeBuffer { - private StringBuffer buf = new StringBuffer(); private int iScopes; @@ -766,7 +777,7 @@ private static class ScopeBuffer { /** * Ctor. - * + * * @param pScopes */ public ScopeBuffer(int pScopes) { @@ -775,7 +786,7 @@ public ScopeBuffer(int pScopes) { /** * append - * + * * @param pStr */ public void append(String pStr) { @@ -784,7 +795,7 @@ public void append(String pStr) { /** * append - * + * * @param pChar */ public void append(char pChar) { @@ -793,7 +804,7 @@ public void append(char pChar) { /** * append - * + * * @param pMask * @param pName */ @@ -817,18 +828,19 @@ public String toString() { *
       	 *        qualifierParameter		=	"(" constantValue ")" | arrayInitializer
       	 * 
      - * + * * @param pQuali * @return the MOF string */ private static String qualifierParameter(CIMQualifier pQuali) { - return pQuali.getDataType().isArray() ? arrayInitializer(pQuali, EMPTY) - : '(' + constantValue(pQuali, EMPTY) + ')'; + return pQuali.getDataType().isArray() ? arrayInitializer(pQuali, EMPTY) : '(' + constantValue(pQuali, EMPTY) + ')'; } private static String charValue(Character pChar) { char ch = pChar.charValue(); - if (ch < 32) { return "'\\x" + Integer.toString(ch, 16) + '\''; } + if (ch < 32) { + return "'\\x" + Integer.toString(ch, 16) + '\''; + } return "'" + ch + '\''; } @@ -836,7 +848,7 @@ private static String charValue(Character pChar) { *
       	 *        arrayInitializer		=	"{" constantValue*( "," constantValue)"}"
       	 * 
      - * + * * @param pValue * @param pInd * @return the MOF string or empty string if the array has no elements or @@ -867,7 +879,7 @@ private static String arrayInitializer(CIMValuedElement pValuedElement, Strin /** * array = "[" [positiveDecimalValue] "]" - * + * * @param pType * @return the MOF string or empty string if not array type */ @@ -887,14 +899,15 @@ private static String array(CIMTypedElement pTypedElement) { } private static final TreeMap DATATYPE_MAP = new TreeMap( - new Comparator() { + new Comparator() { - public int compare(Object pO1, Object pO2) { - CIMDataType t1 = (CIMDataType) pO1; - CIMDataType t2 = (CIMDataType) pO2; - return t1.getType() - t2.getType(); - } - }); + public int compare(Object pO1, Object pO2) { + CIMDataType t1 = (CIMDataType) pO1; + CIMDataType t2 = (CIMDataType) pO2; + return t1.getType() - t2.getType(); + } + } + ); static { DATATYPE_MAP.put(CIMDataType.UINT8_T, DT_UINT8); @@ -921,7 +934,7 @@ public int compare(Object pO1, Object pO2) { /** * defaultValue = "=" initializer - * + * * @param pValuedElement * @param pInd * @return the MOF string or empty string if the value is null @@ -937,7 +950,7 @@ private static String defaultValue(CIMValuedElement pValuedElement, String pI * initializer = constantValue | arrayInitializer | referenceInitializer * // referenceInitializer is handled by constantValue * - * + * * @param pValue * @param pInd * @return the MOF string diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/util/StringSorter.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/util/StringSorter.java index 113abf5..b1dca4d 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/util/StringSorter.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/util/StringSorter.java @@ -48,13 +48,12 @@ * searching of String arrays. */ public class StringSorter implements Comparator { - private static final Comparator COMPARATOR = new StringSorter(); /** * Sorts non case sensitively the passed String array, the passed array is * not copied. - * + * * @param pArray * the array which will be sorted if it's not null * @return pArray @@ -70,7 +69,7 @@ public static String[] sort(String[] pArray) { /** * Finds pName, in pArray which must be a non case sensitive sorted array of * Strings. - * + * * @param pArray * @param pName * @return true if found, otherwise false @@ -91,5 +90,4 @@ public int compare(Object pO1, Object pO2) { String str2 = (String) pO2; return str1.compareToIgnoreCase(str2); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/util/ThreadPool.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/util/ThreadPool.java index 22cc12b..ca966ee 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/util/ThreadPool.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/util/ThreadPool.java @@ -54,22 +54,20 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import java.util.logging.Level; - import org.metricshub.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; /** * Class ThreadPool implements a pool that manages threads and executes * submitted tasks using this threads. - * + * */ public class ThreadPool { /** * Class Worker implements a worker thread used by the thread pool - * + * */ private static class Worker extends Thread { - private volatile boolean iAlive; private final ThreadPool iPool; @@ -80,7 +78,7 @@ private static class Worker extends Thread { /** * Ctor. - * + * * @param pool * The owning pool * @param name @@ -110,7 +108,7 @@ public void kill() { /** * Waits for a new task execute - * + * * @return The task or null * @throws InterruptedException */ @@ -138,8 +136,7 @@ public void run() { try { tsk.run(); } catch (Throwable t) { - LogAndTraceBroker.getBroker().trace(Level.FINE, - "Exception while executing task from thread pool", t); + LogAndTraceBroker.getBroker().trace(Level.FINE, "Exception while executing task from thread pool", t); } this.iPool.taskCompleted(); } @@ -176,7 +173,7 @@ public void run() { /** * Ctor - * + * * @param pMinPoolSize * The minimal pool size. The pool will always keep at least this * number of worker threads alive even in no load situations. @@ -194,8 +191,14 @@ public void run() { * @param pWorkerName * The name to use for worker threads */ - public ThreadPool(int pMinPoolSize, int pMaxPoolSize, int pToleratedBacklog, - long pToleratedIdle, ThreadGroup pGroup, String pWorkerName) { + public ThreadPool( + int pMinPoolSize, + int pMaxPoolSize, + int pToleratedBacklog, + long pToleratedIdle, + ThreadGroup pGroup, + String pWorkerName + ) { this.iGroup = pGroup != null ? pGroup : new ThreadGroup("TreadPool Group"); this.iMinPoolSize = pMinPoolSize; this.iMaxPoolSize = pMaxPoolSize; @@ -206,7 +209,7 @@ public ThreadPool(int pMinPoolSize, int pMaxPoolSize, int pToleratedBacklog, /** * Submits a task for execution - * + * * @param task * The task * @return true if the task was executed or enqueued, @@ -223,15 +226,15 @@ public synchronized boolean execute(Runnable task) { boolean added = this.iQueue.offer(task); - if (totalIdle > 0) { return added; } + if (totalIdle > 0) { + return added; + } // is maximal pool size reached ? - boolean mayCreateWorker = (this.iMaxPoolSize == -1) - || (this.iThreadPool.size() < this.iMaxPoolSize); + boolean mayCreateWorker = (this.iMaxPoolSize == -1) || (this.iThreadPool.size() < this.iMaxPoolSize); // create a new worker when backlog exceeds toleration level or we // have no workers at all - if (mayCreateWorker - && ((this.iQueue.size() > this.iToleratedBacklog) || this.iThreadPool.size() == 0)) { + if (mayCreateWorker && ((this.iQueue.size() > this.iToleratedBacklog) || this.iThreadPool.size() == 0)) { createWorker(); } return added; @@ -239,7 +242,7 @@ public synchronized boolean execute(Runnable task) { /** * Creates a new worker thread - * + * */ private synchronized void createWorker() { Worker worker = new Worker(this, this.iWorkerName + getID()); @@ -250,7 +253,7 @@ private synchronized void createWorker() { /** * Removes a worker from the pool. - * + * * @param worker * The worker */ @@ -270,7 +273,7 @@ protected synchronized void removeWorker(Worker worker) { /** * Gets the associated thread group - * + * * @return The thread group */ protected ThreadGroup getGroup() { @@ -281,7 +284,7 @@ protected ThreadGroup getGroup() { * Get a new task. If no task was available during the timeout period the * calling worker might be killed if more than the minimum number of workers * exist - * + * * @param worker * The worker asking for a new task * @return The next available task from the queue. If no task is available @@ -334,12 +337,11 @@ public synchronized void shutdown() { /** * Generates an "unique" id for a worker thread - * + * * @return The id */ private String getID() { if (++this.iCntr >= 10000) this.iCntr = 1; return String.valueOf(this.iCntr); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/util/Util.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/util/Util.java index 8e67957..1fae609 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/util/Util.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/util/Util.java @@ -52,7 +52,7 @@ public class Util { /** * Quotes the passed string. - * + * * @param pStr * @return the quoted string */ @@ -75,15 +75,13 @@ public static String quote(String pStr) { * loop. The range is defined as (lowBadDouble, * hiBadDouble). */ - private static final BigDecimal lowBadDouble = new BigDecimal( - "2.225073858507201136057409796709131975934E-308"); + private static final BigDecimal lowBadDouble = new BigDecimal("2.225073858507201136057409796709131975934E-308"); - private static final BigDecimal hiBadDouble = new BigDecimal( - "2.225073858507201259573821257020768020078E-308"); + private static final BigDecimal hiBadDouble = new BigDecimal("2.225073858507201259573821257020768020078E-308"); /** * isBadDoubleString checks if passed string could hang JVM. - * + * * @param s * A string to be converted to a Double. * @return true if double is in range of bad values, @@ -104,7 +102,7 @@ public static boolean isBadDoubleString(String s) { * pArray = {"A", "B", "C", "D", "E", "F", "G"} and * pIgnoreElements = "D,E,B" then this method returns * {"A", "C", "F", "G"}. - * + * * @param pArray * Original string array. * @param pIgnoreElements @@ -114,8 +112,7 @@ public static boolean isBadDoubleString(String s) { public static String[] getFilteredStringArray(String[] pArray, String pIgnoreElements) { int i, j; - if (pArray == null || pArray.length == 0 || pIgnoreElements == null - || pIgnoreElements.length() == 0) return pArray; + if (pArray == null || pArray.length == 0 || pIgnoreElements == null || pIgnoreElements.length() == 0) return pArray; Vector vecIgnore = new Vector(); StringTokenizer strtok = new StringTokenizer(pIgnoreElements, ","); @@ -128,8 +125,7 @@ public static String[] getFilteredStringArray(String[] pArray, String pIgnoreEle Vector vecNew = new Vector(); for (i = 0; i < pArray.length; i++) { - for (j = 0; j < vecIgnore.size(); j++) - if (pArray[i].equalsIgnoreCase(vecIgnore.elementAt(j))) break; + for (j = 0; j < vecIgnore.size(); j++) if (pArray[i].equalsIgnoreCase(vecIgnore.elementAt(j))) break; if (j >= vecIgnore.size()) vecNew.add(pArray[i]); } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/util/WBEMConfiguration.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/util/WBEMConfiguration.java index c6dff49..dac3106 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/util/WBEMConfiguration.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/util/WBEMConfiguration.java @@ -86,22 +86,19 @@ import java.security.Security; import java.util.Arrays; import java.util.Iterator; -import java.util.Properties; import java.util.Map.Entry; +import java.util.Properties; import java.util.logging.Level; - import javax.net.SocketFactory; - import org.metricshub.wbem.sblim.cimclient.WBEMConfigurationProperties; /** * Class WBEMConfigurationFile is responsible for initializing the the * configuration properties from the configuration file. - * + * * This class was designed as thread-safe */ public class WBEMConfiguration { - private static WBEMConfiguration cConfiguration; private static String cConfigURL = null; @@ -122,7 +119,6 @@ public class WBEMConfiguration { * Loads the global configuration from the configuration file */ public static void loadGlobalConfiguration() { - Properties wbemProperties = new Properties(new Properties()); try { cConfigURL = null; @@ -134,12 +130,10 @@ public static void loadGlobalConfiguration() { wbemProperties.load(inputstream); cLoadSuccessful = true; } - for (Iterator> iterator = wbemProperties.entrySet().iterator(); iterator - .hasNext();) { + for (Iterator> iterator = wbemProperties.entrySet().iterator(); iterator.hasNext();) { Entry entry = iterator.next(); String key = String.valueOf(entry.getKey()); - if (key.startsWith("sblim.wbem.") || key.startsWith("javax.net.ssl.") - || key.startsWith("net.slp.")) { + if (key.startsWith("sblim.wbem.") || key.startsWith("javax.net.ssl.") || key.startsWith("net.slp.")) { String value = String.valueOf(entry.getValue()); System.setProperty(key, value); } else if (key.startsWith("ssl.")) { @@ -160,7 +154,7 @@ public static void loadGlobalConfiguration() { /** * Returns the URL of the active configuration file. This is the file used * to initialize the global configuration. - * + * * @return The URL of the active configuration file. */ public static String getActiveConfigURL() { @@ -170,7 +164,7 @@ public static String getActiveConfigURL() { /** * Returns the full URL of the active configuration file. This is the file * used to initialize the global configuration. - * + * * @return The full URL of the active configuration file. */ public static String getActiveConfigFullURL() { @@ -180,7 +174,7 @@ public static String getActiveConfigFullURL() { /** * Returns if the configuration was successfully loaded from the * configuration file - * + * * @return true if the configuration was successfully loaded * from the configuration file, false otherwise */ @@ -192,12 +186,11 @@ public static boolean isConfigurationLoadSuccessful() { * Returns an input stream for the configuration file. The method looks if a * configuration file URL is set in the system properties and tries the * default location if not. - * + * * @return The InputStream of the configuration file or * null if none could be opened. */ private static InputStream getConfigURLStream() { - String configURL = System.getProperty(WBEMConfigurationProperties.CONFIG_URL); if (configURL != null) { @@ -236,7 +229,7 @@ private static InputStream getConfigURLStream() { * Returns the full URL of the parameter. Only "file:" URLs will be * processed, and the full URL will be the FQDN of the file with relative * paths ("." and "..") removed. - * + * * @param url * The URL * @return The full URL @@ -277,7 +270,7 @@ private static String getFullURL(URL url) { /** * Returns the global configuration - * + * * @return The global configuration */ public static WBEMConfiguration getGlobalConfiguration() { @@ -286,7 +279,7 @@ public static WBEMConfiguration getGlobalConfiguration() { /** * Returns the exception caught during configuration load, load failed. - * + * * @return The exception or null if none was caught. */ public static Exception getConfigurationLoadException() { @@ -297,10 +290,11 @@ public static Exception getConfigurationLoadException() { @Override protected Object childValue(Object parentValue) { - if (parentValue instanceof Properties) { return ((Properties) parentValue).clone(); } + if (parentValue instanceof Properties) { + return ((Properties) parentValue).clone(); + } return super.childValue(parentValue); } - }; /** @@ -324,7 +318,7 @@ private WBEMConfiguration() { /** * Ctor. - * + * * @param pDomainProperties * The domain specific properties of this configuration. Domain * specific properties are treated as an overlay on the global @@ -333,14 +327,15 @@ private WBEMConfiguration() { * If pDomainProperties is null */ public WBEMConfiguration(Properties pDomainProperties) { - if (pDomainProperties == null) { throw new NullPointerException( - "Domain properties shall not be null"); } + if (pDomainProperties == null) { + throw new NullPointerException("Domain properties shall not be null"); + } this.iDomainProperties = pDomainProperties; } /** * Returns whether this configuration is the global one - * + * * @return true if this is the global configuration */ public boolean isGlobal() { @@ -349,7 +344,7 @@ public boolean isGlobal() { /** * Returns the domain properties - * + * * @return The domain properties. */ public synchronized Properties getDomainProperties() { @@ -358,19 +353,18 @@ public synchronized Properties getDomainProperties() { /** * Sets the domain properties - * + * * @param pDomainProperties * The new value */ public synchronized void setDomainProperties(Properties pDomainProperties) { - if (isGlobal()) throw new IllegalStateException( - "Global configuration cannot be modified by setDomainProperties()"); + if (isGlobal()) throw new IllegalStateException("Global configuration cannot be modified by setDomainProperties()"); this.iDomainProperties = pDomainProperties; } /** * Returns a value from the domain properties for a given name - * + * * @param pKey * The name of the property * @return The value @@ -381,21 +375,20 @@ public synchronized String getDomainProperty(String pKey) { /** * Sets a property value of the domain properties - * + * * @param pKey * The name of property * @param pValue * The new value */ public synchronized void setDomainProperty(String pKey, String pValue) { - if (isGlobal()) throw new IllegalStateException( - "Global configuration cannot be modified by setDomainProperty()"); + if (isGlobal()) throw new IllegalStateException("Global configuration cannot be modified by setDomainProperty()"); this.iDomainProperties.setProperty(pKey, pValue); } /** * Returns the properties local to the current thread - * + * * @return The local properties. */ public Properties getLocalProperties() { @@ -404,19 +397,18 @@ public Properties getLocalProperties() { /** * Sets the properties local to the current thread - * + * * @param pLocalProperties * The new value */ public void setLocalProperties(Properties pLocalProperties) { - if (isGlobal()) throw new IllegalStateException( - "Global configuration cannot be modified by setLocalProperties()"); + if (isGlobal()) throw new IllegalStateException("Global configuration cannot be modified by setLocalProperties()"); this.iLocalProperties.set(pLocalProperties); } /** * Returns a value from the local properties for a given name - * + * * @param pKey * The name of the property * @return The value @@ -428,15 +420,14 @@ public String getLocalProperty(String pKey) { /** * Sets a property value of the local properties - * + * * @param pKey * The name of property * @param pValue * The new value */ public void setLocalProperty(String pKey, String pValue) { - if (isGlobal()) throw new IllegalStateException( - "Global configuration cannot be modified by setLocalProperty()"); + if (isGlobal()) throw new IllegalStateException("Global configuration cannot be modified by setLocalProperty()"); Properties localProperties = (Properties) this.iLocalProperties.get(); if (localProperties == null) { localProperties = new Properties(); @@ -449,21 +440,23 @@ private String getProperty(String pProperty, String pDefault) { String globalProperty = System.getProperty(pProperty, pDefault); String domainProperty = getDomainProperty(pProperty); String localProperty = getLocalProperty(pProperty); - return (localProperty != null) ? localProperty : (domainProperty != null) ? domainProperty - : (globalProperty != null) ? globalProperty : pDefault; + return (localProperty != null) + ? localProperty + : (domainProperty != null) ? domainProperty : (globalProperty != null) ? globalProperty : pDefault; } private String getSecurityProperty(String pProperty, String pDefault) { String globalProperty = Security.getProperty(pProperty); String domainProperty = getDomainProperty(pProperty); String localProperty = getLocalProperty(pProperty); - return (localProperty != null) ? localProperty : (domainProperty != null) ? domainProperty - : (globalProperty != null) ? globalProperty : pDefault; + return (localProperty != null) + ? localProperty + : (domainProperty != null) ? domainProperty : (globalProperty != null) ? globalProperty : pDefault; } /** * Sets a custom socket factory. - * + * * @param pFactory * The factory */ @@ -473,7 +466,7 @@ public synchronized void setCustomSocketFactory(SocketFactory pFactory) { /** * Returns the custom socket factory - * + * * @return The factory if set, null otherwise */ public synchronized SocketFactory getCustomSocketFactory() { @@ -482,138 +475,145 @@ public synchronized SocketFactory getCustomSocketFactory() { /** * Returns the console log level - * + * * @return The console log level */ public Level getLogConsoleLevel() { - return Level.parse(getProperty(WBEMConfigurationProperties.LOG_CONSOLE_LEVEL, - WBEMConfigurationDefaults.LOG_CONSOLE_LEVEL)); + return Level.parse( + getProperty(WBEMConfigurationProperties.LOG_CONSOLE_LEVEL, WBEMConfigurationDefaults.LOG_CONSOLE_LEVEL) + ); } /** * Returns the console log type - * + * * @return The console log type */ public String getLogConsoleType() { - return getProperty(WBEMConfigurationProperties.LOG_CONSOLE_TYPE, - WBEMConfigurationDefaults.LOG_CONSOLE_TYPE); + return getProperty(WBEMConfigurationProperties.LOG_CONSOLE_TYPE, WBEMConfigurationDefaults.LOG_CONSOLE_TYPE); } /** * Returns the log file level - * + * * @return The log file level */ public Level getLogFileLevel() { - return Level.parse(getProperty(WBEMConfigurationProperties.LOG_FILE_LEVEL, - WBEMConfigurationDefaults.LOG_FILE_LEVEL)); + return Level.parse( + getProperty(WBEMConfigurationProperties.LOG_FILE_LEVEL, WBEMConfigurationDefaults.LOG_FILE_LEVEL) + ); } /** * Returns the log file location - * + * * @return The log file location */ public String getLogFileLocation() { - return getProperty(WBEMConfigurationProperties.LOG_FILE_LOCATION, - WBEMConfigurationDefaults.LOG_FILE_LOCATION); + return getProperty(WBEMConfigurationProperties.LOG_FILE_LOCATION, WBEMConfigurationDefaults.LOG_FILE_LOCATION); } /** * Returns the log file count - * + * * @return The log file count */ public int getLogFileCount() { - return Integer.parseInt(getProperty(WBEMConfigurationProperties.LOG_FILE_COUNT, - WBEMConfigurationDefaults.LOG_FILE_COUNT)); + return Integer.parseInt( + getProperty(WBEMConfigurationProperties.LOG_FILE_COUNT, WBEMConfigurationDefaults.LOG_FILE_COUNT) + ); } /** * Returns the log file size limit - * + * * @return The log file size limit */ public int getLogFileSizeLimit() { - return Integer.parseInt(getProperty(WBEMConfigurationProperties.LOG_FILE_SIZE_LIMIT, - WBEMConfigurationDefaults.LOG_FILE_SIZE_LIMIT)); + return Integer.parseInt( + getProperty(WBEMConfigurationProperties.LOG_FILE_SIZE_LIMIT, WBEMConfigurationDefaults.LOG_FILE_SIZE_LIMIT) + ); } /** * Returns the trace file level - * + * * @return The trace file level */ public Level getTraceFileLevel() { - return Level.parse(getProperty(WBEMConfigurationProperties.TRACE_FILE_LEVEL, - WBEMConfigurationDefaults.TRACE_FILE_LEVEL)); - + return Level.parse( + getProperty(WBEMConfigurationProperties.TRACE_FILE_LEVEL, WBEMConfigurationDefaults.TRACE_FILE_LEVEL) + ); } /** * Returns the trace file location - * + * * @return The trace file location */ public String getTraceFileLocation() { - return getProperty(WBEMConfigurationProperties.TRACE_FILE_LOCATION, - WBEMConfigurationDefaults.TRACE_FILE_LOCATION); + return getProperty(WBEMConfigurationProperties.TRACE_FILE_LOCATION, WBEMConfigurationDefaults.TRACE_FILE_LOCATION); } /** * Returns the trace file count - * + * * @return The trace file count */ public int getTraceFileCount() { - return Integer.parseInt(getProperty(WBEMConfigurationProperties.TRACE_FILE_COUNT, - WBEMConfigurationDefaults.TRACE_FILE_COUNT)); + return Integer.parseInt( + getProperty(WBEMConfigurationProperties.TRACE_FILE_COUNT, WBEMConfigurationDefaults.TRACE_FILE_COUNT) + ); } /** * Returns the trace file count - * + * * @return The trace file count */ public int getTraceFileSizeLimit() { - return Integer.parseInt(getProperty(WBEMConfigurationProperties.TRACE_FILE_SIZE_LIMIT, - WBEMConfigurationDefaults.TRACE_FILE_SIZE_LIMIT)); + return Integer.parseInt( + getProperty(WBEMConfigurationProperties.TRACE_FILE_SIZE_LIMIT, WBEMConfigurationDefaults.TRACE_FILE_SIZE_LIMIT) + ); } /** * Returns the http timeout - * + * * @return The http timeout */ public int getHttpTimeout() { - return Integer.parseInt(getProperty(WBEMConfigurationProperties.HTTP_TIMEOUT, - WBEMConfigurationDefaults.HTTP_TIMEOUT)); + return Integer.parseInt( + getProperty(WBEMConfigurationProperties.HTTP_TIMEOUT, WBEMConfigurationDefaults.HTTP_TIMEOUT) + ); } /** * Returns the http pool size - * + * * @return The http pool size */ public int getHttpPoolSize() { - return Integer.parseInt(getProperty(WBEMConfigurationProperties.HTTP_POOL_SIZE, - WBEMConfigurationDefaults.HTTP_POOL_SIZE)); + return Integer.parseInt( + getProperty(WBEMConfigurationProperties.HTTP_POOL_SIZE, WBEMConfigurationDefaults.HTTP_POOL_SIZE) + ); } /** * Returns the Java class name of http authentication module to use - * + * * @return The http authentication module's class name */ public String getHttpAuthenticationModule() { - return getProperty(WBEMConfigurationProperties.HTTP_AUTHENTICATION_MODULE, - WBEMConfigurationDefaults.HTTP_AUTHENTICATION_MODULE); + return getProperty( + WBEMConfigurationProperties.HTTP_AUTHENTICATION_MODULE, + WBEMConfigurationDefaults.HTTP_AUTHENTICATION_MODULE + ); } /** * Returns the WWW-Authenticate info to use on first request - * + * * @return The WWW-Authenticate info */ public String getHttpWwwAuthenticateInfo() { @@ -622,41 +622,40 @@ public String getHttpWwwAuthenticateInfo() { /** * Returns the state of MPOST enablement - * + * * @return true if MPOST is enabled, false * otherwise */ public boolean isHttpMPost() { - return Boolean.valueOf( - getProperty(WBEMConfigurationProperties.HTTP_USE_MPOST, - WBEMConfigurationDefaults.HTTP_USE_MPOST)).booleanValue(); + return Boolean + .valueOf(getProperty(WBEMConfigurationProperties.HTTP_USE_MPOST, WBEMConfigurationDefaults.HTTP_USE_MPOST)) + .booleanValue(); } /** * Returns the state of chunking enablement - * + * * @return true if chunking is enabled, false * otherwise */ public boolean isHttpChunked() { - return Boolean.valueOf( - getProperty(WBEMConfigurationProperties.HTTP_USE_CHUNKING, - WBEMConfigurationDefaults.HTTP_USE_CHUNKING)).booleanValue(); + return Boolean + .valueOf(getProperty(WBEMConfigurationProperties.HTTP_USE_CHUNKING, WBEMConfigurationDefaults.HTTP_USE_CHUNKING)) + .booleanValue(); } /** * Returns the http version to use - * + * * @return The http version */ public String getHttpVersion() { - return getProperty(WBEMConfigurationProperties.HTTP_VERSION, - WBEMConfigurationDefaults.HTTP_VERSION); + return getProperty(WBEMConfigurationProperties.HTTP_VERSION, WBEMConfigurationDefaults.HTTP_VERSION); } /** * Returns the file path of the keystore. - * + * * @return The keystore file path. */ public String getSslKeyStorePath() { @@ -665,17 +664,16 @@ public String getSslKeyStorePath() { /** * Returns the type of the keystore. - * + * * @return The keystore type. */ public String getSslKeyStoreType() { - return getProperty(WBEMConfigurationProperties.KEYSTORE_TYPE, - WBEMConfigurationDefaults.KEYSTORE_TYPE); + return getProperty(WBEMConfigurationProperties.KEYSTORE_TYPE, WBEMConfigurationDefaults.KEYSTORE_TYPE); } /** * Returns the password of the keystore. - * + * * @return The keystore password. */ public String getSslKeyStorePassword() { @@ -684,7 +682,7 @@ public String getSslKeyStorePassword() { /** * Returns the file path of the truststore. - * + * * @return The truststore file path. */ public String getSslTrustStorePath() { @@ -693,17 +691,16 @@ public String getSslTrustStorePath() { /** * Returns the type of the truststore. - * + * * @return The truststore type. */ public String getSslTrustStoreType() { - return getProperty(WBEMConfigurationProperties.TRUSTSTORE_TYPE, - WBEMConfigurationDefaults.TRUSTSTORE_TYPE); + return getProperty(WBEMConfigurationProperties.TRUSTSTORE_TYPE, WBEMConfigurationDefaults.TRUSTSTORE_TYPE); } /** * Returns the password of the truststore. - * + * * @return The truststore password. */ public String getSslTrustStorePassword() { @@ -712,40 +709,42 @@ public String getSslTrustStorePassword() { /** * Returns the JSSE provider to use for creating ssl client sockets - * + * * @return The JSSE provider for client sockets */ public String getSslSocketProvider() { Provider[] providers = Security.getProviders("SSLContext.SSL"); - return getProperty(WBEMConfigurationProperties.SSL_SOCKET_PROVIDER, providers != null - && providers.length > 0 ? providers[0].getClass().getName() : null); + return getProperty( + WBEMConfigurationProperties.SSL_SOCKET_PROVIDER, + providers != null && providers.length > 0 ? providers[0].getClass().getName() : null + ); } /** * Returns the JSSE provider to use for creating ssl server sockets - * + * * @return The JSSE provider for server sockets */ public String getSslServerSocketProvider() { Provider[] providers = Security.getProviders("SSLContext.SSL"); - return getProperty(WBEMConfigurationProperties.SSL_SERVER_SOCKET_PROVIDER, - providers != null && providers.length > 0 ? providers[0].getClass().getName() - : null); + return getProperty( + WBEMConfigurationProperties.SSL_SERVER_SOCKET_PROVIDER, + providers != null && providers.length > 0 ? providers[0].getClass().getName() : null + ); } /** * getSslProtocol - * + * * @return The SSL protocol for SSLContext.getInstance() */ public String getSslProtocol() { - return getSecurityProperty(WBEMConfigurationProperties.SSL_PROTOCOL, - WBEMConfigurationDefaults.SSL_DEF_PROTOCOL); + return getSecurityProperty(WBEMConfigurationProperties.SSL_PROTOCOL, WBEMConfigurationDefaults.SSL_DEF_PROTOCOL); } /** * getSslClientProtocol - * + * * @return The SSL protocol for SSLContext.getInstance() for client */ public String getSslClientProtocol() { @@ -754,7 +753,7 @@ public String getSslClientProtocol() { /** * getSslListenerProtocol - * + * * @return The SSL protocol for SSLContext.getInstance() for listener */ public String getSslListenerProtocol() { @@ -763,7 +762,7 @@ public String getSslListenerProtocol() { /** * Returns the certificate algorithm the key manager will use - * + * * @return The key mangers algorithm */ public String getSslKeyManagerAlgorithm() { @@ -772,7 +771,7 @@ public String getSslKeyManagerAlgorithm() { /** * Returns the certificate algorithm the trust manager will use - * + * * @return The trust mangers algorithm */ public String getSslTrustManagerAlgorithm() { @@ -781,32 +780,39 @@ public String getSslTrustManagerAlgorithm() { /** * Returns whether the client will attempt to authenticate the CIMOM - * + * * @return true if the client will attempt to authenticate the * CIMOM by verifying the server certificate false * otherwise */ public boolean getSslClientPeerVerification() { - return Boolean.valueOf( - getProperty(WBEMConfigurationProperties.SSL_CLIENT_PEER_VERIFICATION, - WBEMConfigurationDefaults.SSL_CLIENT_PEER_VERIFICATION)).booleanValue(); + return Boolean + .valueOf( + getProperty( + WBEMConfigurationProperties.SSL_CLIENT_PEER_VERIFICATION, + WBEMConfigurationDefaults.SSL_CLIENT_PEER_VERIFICATION + ) + ) + .booleanValue(); } /** * Returns how the listener will handle to authentication of the indication * sender endpoint. - * + * * @return The listener peer verification mode */ public String getSslListenerPeerVerification() { - return getProperty(WBEMConfigurationProperties.SSL_LISTENER_PEER_VERIFICATION, - WBEMConfigurationDefaults.SSL_LISTENER_PEER_VERIFICATION); + return getProperty( + WBEMConfigurationProperties.SSL_LISTENER_PEER_VERIFICATION, + WBEMConfigurationDefaults.SSL_LISTENER_PEER_VERIFICATION + ); } /** * Returns the comma-separated list of cipher suites to be disabled by * client. - * + * * @return The list of cipher suites */ public String getSslClientCipherSuitesToDisable() { @@ -816,7 +822,7 @@ public String getSslClientCipherSuitesToDisable() { /** * Returns the comma-separated list of cipher suites to be disabled by * listener. - * + * * @return The list of cipher suites */ public String getSslListenerCipherSuitesToDisable() { @@ -826,181 +832,225 @@ public String getSslListenerCipherSuitesToDisable() { /** * Returns the number of retries the client will attempt when the connection * was refused. - * + * * @return The number of retries */ public int getHttpConnectRetriesCount() { - return Integer.parseInt(getProperty(WBEMConfigurationProperties.HTTP_CONNECTION_RETRIES, - WBEMConfigurationDefaults.HTTP_CONNECTION_RETRIES)); + return Integer.parseInt( + getProperty( + WBEMConfigurationProperties.HTTP_CONNECTION_RETRIES, + WBEMConfigurationDefaults.HTTP_CONNECTION_RETRIES + ) + ); } /** * Returns if the content length retry feature is enabled - * + * * @return true if content length retry is enabled, * false otherwise */ public boolean isHttpContentLengthRetryEnabled() { - return Boolean.valueOf( - getProperty(WBEMConfigurationProperties.HTTP_ENABLE_CONTENT_LENGTH_RETRY, - WBEMConfigurationDefaults.HTTP_ENABLE_CONTENT_LENGTH_RETRY)).booleanValue(); + return Boolean + .valueOf( + getProperty( + WBEMConfigurationProperties.HTTP_ENABLE_CONTENT_LENGTH_RETRY, + WBEMConfigurationDefaults.HTTP_ENABLE_CONTENT_LENGTH_RETRY + ) + ) + .booleanValue(); } /** * Returns the threshold for the content length retry algorithm - * + * * @return The threshold */ public int getHttpContentLengthThreshold() { - return Integer.parseInt(getProperty( + return Integer.parseInt( + getProperty( WBEMConfigurationProperties.HTTP_CONTENT_LENGTH_THRESHOLD, - WBEMConfigurationDefaults.HTTP_CONTENT_LENGTH_THRESHOLD)); + WBEMConfigurationDefaults.HTTP_CONTENT_LENGTH_THRESHOLD + ) + ); } /** * Return the XML parser to use for processing operation responses - * + * * @return The XML parser */ public String getCimXmlParser() { - return getProperty(WBEMConfigurationProperties.CIMXML_PARSER, - WBEMConfigurationDefaults.CIMXML_PARSER); + return getProperty(WBEMConfigurationProperties.CIMXML_PARSER, WBEMConfigurationDefaults.CIMXML_PARSER); } /** * getCimXmlEmbObjBuilder - * + * * @return configuration property for the embedded object builder */ public String getCimXmlEmbObjBuilder() { - return getProperty(WBEMConfigurationProperties.CIMXML_EMBOBJBUILDER, - WBEMConfigurationDefaults.CIMXML_EMBOBJBUILDER); + return getProperty( + WBEMConfigurationProperties.CIMXML_EMBOBJBUILDER, + WBEMConfigurationDefaults.CIMXML_EMBOBJBUILDER + ); } /** * strictEmbObjTypes - * + * * @return true if EmbeddedObject exactly means Embedded Class */ public boolean strictEmbObjTypes() { - return Boolean.valueOf( - getProperty(WBEMConfigurationProperties.CIMXML_PARSER_STRICT_EMBOBJ_TYPES, - WBEMConfigurationDefaults.CIMXML_PARSER_STRICT_EMBOBJ_TYPES)) - .booleanValue(); + return Boolean + .valueOf( + getProperty( + WBEMConfigurationProperties.CIMXML_PARSER_STRICT_EMBOBJ_TYPES, + WBEMConfigurationDefaults.CIMXML_PARSER_STRICT_EMBOBJ_TYPES + ) + ) + .booleanValue(); } /** * upperCaseEmbObjEntities - * + * * @return true if "EMBEDDEDOBJECT" entity, false if "EmbeddedObject" */ public boolean upperCaseEmbObjEntities() { - return Boolean.valueOf( - getProperty(WBEMConfigurationProperties.CIMXML_BUILDER_UPPERCASE_EMBOBJ_ENTITIES, - WBEMConfigurationDefaults.CIMXML_BUILDER_UPPERCASE_EMBOBJ_ENTITIES)) - .booleanValue(); + return Boolean + .valueOf( + getProperty( + WBEMConfigurationProperties.CIMXML_BUILDER_UPPERCASE_EMBOBJ_ENTITIES, + WBEMConfigurationDefaults.CIMXML_BUILDER_UPPERCASE_EMBOBJ_ENTITIES + ) + ) + .booleanValue(); } /** * performSslHandshake - * + * * @return true if SSL handshakes should take place */ public boolean performSslHandshake() { - return Boolean.valueOf( - getProperty(WBEMConfigurationProperties.PERFORM_SSL_HANDSHAKE, - WBEMConfigurationDefaults.PERFORM_SSL_HANDSHAKE)).booleanValue(); + return Boolean + .valueOf( + getProperty(WBEMConfigurationProperties.PERFORM_SSL_HANDSHAKE, WBEMConfigurationDefaults.PERFORM_SSL_HANDSHAKE) + ) + .booleanValue(); } /** * synchronizedSslHandshake - * + * * @return true if SSL handshakes should be synchronized */ public boolean synchronizedSslHandshake() { - return Boolean.valueOf( - getProperty(WBEMConfigurationProperties.SYNCHRONIZED_SSL_HANDSHAKE, - WBEMConfigurationDefaults.SYNCHRONIZED_SSL_HANDSHAKE)).booleanValue(); + return Boolean + .valueOf( + getProperty( + WBEMConfigurationProperties.SYNCHRONIZED_SSL_HANDSHAKE, + WBEMConfigurationDefaults.SYNCHRONIZED_SSL_HANDSHAKE + ) + ) + .booleanValue(); } /** * socketConnectWithTimeout - * + * * @return true if socket connections should be attempted with a timeout */ public boolean socketConnectWithTimeout() { - return Boolean.valueOf( - getProperty(WBEMConfigurationProperties.SOCKET_CONNECT_WITH_TIMEOUT, - WBEMConfigurationDefaults.SOCKET_CONNECT_WITH_TIMEOUT)).booleanValue(); + return Boolean + .valueOf( + getProperty( + WBEMConfigurationProperties.SOCKET_CONNECT_WITH_TIMEOUT, + WBEMConfigurationDefaults.SOCKET_CONNECT_WITH_TIMEOUT + ) + ) + .booleanValue(); } /** * Returns the socket connect timeout - * + * * @return The socket connect timeout */ public int getSocketConnectTimeout() { - return Integer.parseInt(getProperty(WBEMConfigurationProperties.SOCKET_CONNECT_TIMEOUT, - WBEMConfigurationDefaults.SOCKET_CONNECT_TIMEOUT)); + return Integer.parseInt( + getProperty(WBEMConfigurationProperties.SOCKET_CONNECT_TIMEOUT, WBEMConfigurationDefaults.SOCKET_CONNECT_TIMEOUT) + ); } /** * Returns the socket idle timeout - * + * * @return The socket idle timeout */ public int getSocketIdleTimeout() { - return Integer.parseInt(getProperty(WBEMConfigurationProperties.SOCKET_IDLE_TIMEOUT, - WBEMConfigurationDefaults.SOCKET_IDLE_TIMEOUT)); + return Integer.parseInt( + getProperty(WBEMConfigurationProperties.SOCKET_IDLE_TIMEOUT, WBEMConfigurationDefaults.SOCKET_IDLE_TIMEOUT) + ); } /** * isDefaultAuthorizationEnabled - * + * * @return true if default authorization is enabled */ public boolean isDefaultAuthorizationEnabled() { - return Boolean.valueOf( - getProperty(WBEMConfigurationProperties.KEY_CREDENTIALS_DEFAULT_ENABLED, - WBEMConfigurationDefaults.KEY_CREDENTIALS_DEFAULT_ENABLED)).booleanValue(); + return Boolean + .valueOf( + getProperty( + WBEMConfigurationProperties.KEY_CREDENTIALS_DEFAULT_ENABLED, + WBEMConfigurationDefaults.KEY_CREDENTIALS_DEFAULT_ENABLED + ) + ) + .booleanValue(); } /** * getDefaultPrincipal - * + * * @return default value of Principal */ public String getDefaultPrincipal() { - return getProperty(WBEMConfigurationProperties.KEY_DEFAULT_PRINCIPAL, - WBEMConfigurationDefaults.KEY_DEFAULT_PRINCIPAL); + return getProperty( + WBEMConfigurationProperties.KEY_DEFAULT_PRINCIPAL, + WBEMConfigurationDefaults.KEY_DEFAULT_PRINCIPAL + ); } /** * getDefaultCredentials - * + * * @return default value of Credentials */ public String getDefaultCredentials() { - return getProperty(WBEMConfigurationProperties.KEY_DEFAULT_CREDENTIAL, - WBEMConfigurationDefaults.KEY_DEFAULT_CREDENTIAL); + return getProperty( + WBEMConfigurationProperties.KEY_DEFAULT_CREDENTIAL, + WBEMConfigurationDefaults.KEY_DEFAULT_CREDENTIAL + ); } /** * Returns the state of CIM-XML tracing - * + * * @return true if tracing is enabled, false * otherwise */ public boolean isCimXmlTracingEnabled() { - return Boolean.valueOf( - getProperty(WBEMConfigurationProperties.CIMXML_TRACING, - WBEMConfigurationDefaults.CIMXML_TRACING)).booleanValue(); + return Boolean + .valueOf(getProperty(WBEMConfigurationProperties.CIMXML_TRACING, WBEMConfigurationDefaults.CIMXML_TRACING)) + .booleanValue(); } /** * Returns the CIM-XML trace stream to be used if application does not set * one of its own - * + * * @return The trace stream */ public String getCimXmlTraceStream() { @@ -1010,149 +1060,184 @@ public String getCimXmlTraceStream() { /** * Returns the backlog that is tolerated before the thread pool creates an * additional handler - * + * * @return The backlog */ public int getListenerBacklog() { - return Integer.parseInt(getProperty(WBEMConfigurationProperties.LISTENER_BACKLOG, - WBEMConfigurationDefaults.LISTENER_BACKLOG)); + return Integer.parseInt( + getProperty(WBEMConfigurationProperties.LISTENER_BACKLOG, WBEMConfigurationDefaults.LISTENER_BACKLOG) + ); } /** * Returns the http timeout for indication connection handlers - * + * * @return The timeout */ public int getListenerHttpTimeout() { - return Integer.parseInt(getProperty(WBEMConfigurationProperties.LISTENER_HTTP_TIMEOUT, - WBEMConfigurationDefaults.LISTENER_HTTP_TIMEOUT)); + return Integer.parseInt( + getProperty(WBEMConfigurationProperties.LISTENER_HTTP_TIMEOUT, WBEMConfigurationDefaults.LISTENER_HTTP_TIMEOUT) + ); } /** * Returns the http header timeout for indication connection handlers - * + * * @return The timeout */ public int getListenerHttpHeaderTimeout() { - return Integer.parseInt(getProperty( + return Integer.parseInt( + getProperty( WBEMConfigurationProperties.LISTENER_HTTP_HEADER_TIMEOUT, - WBEMConfigurationDefaults.LISTENER_HTTP_HEADER_TIMEOUT)); + WBEMConfigurationDefaults.LISTENER_HTTP_HEADER_TIMEOUT + ) + ); } /** * Returns the maximum allowed http timeouts before IP is blocked - * + * * @return The maximum allowed timeouts */ public int getListenerMaxAllowedTimeouts() { - return Integer.parseInt(getProperty( + return Integer.parseInt( + getProperty( WBEMConfigurationProperties.LISTENER_HTTP_MAX_ALLOWED_TIMEOUTS, - WBEMConfigurationDefaults.LISTENER_HTTP_MAX_ALLOWED_TIMEOUTS)); + WBEMConfigurationDefaults.LISTENER_HTTP_MAX_ALLOWED_TIMEOUTS + ) + ); } /** * Returns the maximal pool size for indication connection handlers - * + * * @return The maximal pool size */ public int getListenerMaxPoolSize() { - return Integer.parseInt(getProperty(WBEMConfigurationProperties.LISTENER_MAX_POOL_SIZE, - WBEMConfigurationDefaults.LISTENER_MAX_POOL_SIZE)); + return Integer.parseInt( + getProperty(WBEMConfigurationProperties.LISTENER_MAX_POOL_SIZE, WBEMConfigurationDefaults.LISTENER_MAX_POOL_SIZE) + ); } /** * Returns the minimal pool size for indication connection handlers - * + * * @return The minimal pool size */ public int getListenerMinPoolSize() { - return Integer.parseInt(getProperty(WBEMConfigurationProperties.LISTENER_MIN_POOL_SIZE, - WBEMConfigurationDefaults.LISTENER_MIN_POOL_SIZE)); + return Integer.parseInt( + getProperty(WBEMConfigurationProperties.LISTENER_MIN_POOL_SIZE, WBEMConfigurationDefaults.LISTENER_MIN_POOL_SIZE) + ); } /** * Returns the maximal queue size for pending indication connections - * + * * @return The maximal queue size */ public int getListenerMaxQueueSize() { - return Integer.parseInt(getProperty(WBEMConfigurationProperties.LISTENER_MAX_QUEUE_SIZE, - WBEMConfigurationDefaults.LISTENER_MAX_QUEUE_SIZE)); + return Integer.parseInt( + getProperty( + WBEMConfigurationProperties.LISTENER_MAX_QUEUE_SIZE, + WBEMConfigurationDefaults.LISTENER_MAX_QUEUE_SIZE + ) + ); } /** * Returns the maximal idle time that is tolerated for a connection handler - * + * * @return The maximal idle time */ public long getListenerMaxIdle() { - return Long.parseLong(getProperty(WBEMConfigurationProperties.LISTENER_HANDLER_MAX_IDLE, - WBEMConfigurationDefaults.LISTENER_HANDLER_MAX_IDLE)); + return Long.parseLong( + getProperty( + WBEMConfigurationProperties.LISTENER_HANDLER_MAX_IDLE, + WBEMConfigurationDefaults.LISTENER_HANDLER_MAX_IDLE + ) + ); } /** * Returns the maximal queue size for indications awaiting delivery - * + * * @return The maximal queue size */ public int getListenerMaxQueuedEvents() { - return Integer.parseInt(getProperty(WBEMConfigurationProperties.LISTENER_MAX_QUEUED_EVENTS, - WBEMConfigurationDefaults.LISTENER_MAX_QUEUED_EVENTS)); + return Integer.parseInt( + getProperty( + WBEMConfigurationProperties.LISTENER_MAX_QUEUED_EVENTS, + WBEMConfigurationDefaults.LISTENER_MAX_QUEUED_EVENTS + ) + ); } /** * Returns the state of reliable indication support - * + * * @return true if reliable indication support is enabled, * false otherwise */ public boolean isReliableIndicationEnabled() { - return Boolean.valueOf( - getProperty(WBEMConfigurationProperties.LISTENER_ENABLE_RELIABLE_INDICATIONS, - WBEMConfigurationDefaults.LISTENER_ENABLE_RELIABLE_INDICATIONS)) - .booleanValue(); + return Boolean + .valueOf( + getProperty( + WBEMConfigurationProperties.LISTENER_ENABLE_RELIABLE_INDICATIONS, + WBEMConfigurationDefaults.LISTENER_ENABLE_RELIABLE_INDICATIONS + ) + ) + .booleanValue(); } /** * Returns the default value to use for CIM_IndicationService * DeliveryRetryAttempts - * + * * @return The default value */ public long getListenerDeliveryRetryAttempts() { - return Long.parseLong(getProperty( + return Long.parseLong( + getProperty( WBEMConfigurationProperties.LISTENER_DELIVERY_RETRY_ATTEMPTS, - WBEMConfigurationDefaults.LISTENER_DELIVERY_RETRY_ATTEMPTS)); + WBEMConfigurationDefaults.LISTENER_DELIVERY_RETRY_ATTEMPTS + ) + ); } /** * Returns the default value to use for CIM_IndicationService * DeliveryRetryInterval - * + * * @return The default value */ public long getListenerDeliveryRetryInterval() { - return Long.parseLong(getProperty( + return Long.parseLong( + getProperty( WBEMConfigurationProperties.LISTENER_DELIVERY_RETRY_INTERVAL, - WBEMConfigurationDefaults.LISTENER_DELIVERY_RETRY_INTERVAL)); + WBEMConfigurationDefaults.LISTENER_DELIVERY_RETRY_INTERVAL + ) + ); } /** * Returns the initial capacity of the hash table used to handle reliable * indications - * + * * @return The default value */ public int getReliableIndicationHashtableCapacity() { - return Integer.parseInt(getProperty( + return Integer.parseInt( + getProperty( WBEMConfigurationProperties.LISTENER_RELIABLE_INDICATION_HASHTABLE_CAPACITY, - WBEMConfigurationDefaults.LISTENER_RELIABLE_INDICATION_HASHTABLE_CAPACITY)); + WBEMConfigurationDefaults.LISTENER_RELIABLE_INDICATION_HASHTABLE_CAPACITY + ) + ); } /** * Returns the filter to use for tracing of incoming indications at the FINE * level - * + * * @return The indication trace filter */ public String getListenerIndicationTraceFilter() { @@ -1161,28 +1246,38 @@ public String getListenerIndicationTraceFilter() { /** * Returns whether sender IP property should be added to indications - * + * * @return true if sender IP property should be added to * indications, false otherwise */ public boolean getListenerAddSenderIPAddress() { - return Boolean.valueOf( - getProperty(WBEMConfigurationProperties.LISTENER_ADD_SENDER_IP_ADDRESS, - WBEMConfigurationDefaults.LISTENER_ADD_SENDER_IP_ADDRESS)).booleanValue(); + return Boolean + .valueOf( + getProperty( + WBEMConfigurationProperties.LISTENER_ADD_SENDER_IP_ADDRESS, + WBEMConfigurationDefaults.LISTENER_ADD_SENDER_IP_ADDRESS + ) + ) + .booleanValue(); } /** * Returns whether the client will attempt to verify strings passed into the * java.lang.Double constructor or its parseDouble * method won't hang the JVM in an infinite loop. - * + * * @return true if the client will attempt to verify strings * passed to Double, false otherwise */ public boolean verifyJavaLangDoubleStrings() { - return Boolean.valueOf( - getProperty(WBEMConfigurationProperties.VERIFY_JAVA_LANG_DOUBLE_STRINGS, - WBEMConfigurationDefaults.VERIFY_JAVA_LANG_DOUBLE_STRINGS)).booleanValue(); + return Boolean + .valueOf( + getProperty( + WBEMConfigurationProperties.VERIFY_JAVA_LANG_DOUBLE_STRINGS, + WBEMConfigurationDefaults.VERIFY_JAVA_LANG_DOUBLE_STRINGS + ) + ) + .booleanValue(); } /** @@ -1190,49 +1285,61 @@ public boolean verifyJavaLangDoubleStrings() { * keys in a CIMInstance's CIMObjectPath match * those of the corresponding keys within the CIMInstance's * CIMProperty[]. - * + * * @return true if the client will synchronize * CIMInstance numeric key data types, * false otherwise */ public boolean synchronizeNumericKeyDataTypes() { - return Boolean.valueOf( - getProperty(WBEMConfigurationProperties.SYNCHRONIZE_NUMERIC_KEY_DATA_TYPES, - WBEMConfigurationDefaults.SYNCHRONIZE_NUMERIC_KEY_DATA_TYPES)) - .booleanValue(); + return Boolean + .valueOf( + getProperty( + WBEMConfigurationProperties.SYNCHRONIZE_NUMERIC_KEY_DATA_TYPES, + WBEMConfigurationDefaults.SYNCHRONIZE_NUMERIC_KEY_DATA_TYPES + ) + ) + .booleanValue(); } /** * Returns the state of gzip encoding enablement. - * + * * @return true if gzip encoding is enabled, false * otherwise */ public boolean isGzipEncodingEnabled() { - return Boolean.valueOf( - getProperty(WBEMConfigurationProperties.ENABLE_GZIP_ENCODING, - WBEMConfigurationDefaults.ENABLE_GZIP_ENCODING)).booleanValue(); + return Boolean + .valueOf( + getProperty(WBEMConfigurationProperties.ENABLE_GZIP_ENCODING, WBEMConfigurationDefaults.ENABLE_GZIP_ENCODING) + ) + .booleanValue(); } /** * Returns whether the client will allow empty * LOCALNAMESPACEPATH elements in incoming CIM-XML responses. - * + * * @return true if CIM-XML parser should allow empty * LOCALNAMESPACEPATH elements in incoming responses, * false otherwise */ public boolean allowEmptyLocalNameSpacePath() { - return Boolean.valueOf( + return Boolean + .valueOf( getProperty( - WBEMConfigurationProperties.CIMXML_PARSER_ALLOW_EMPTY_LOCALNAMESPACEPATH, - WBEMConfigurationDefaults.CIMXML_PARSER_ALLOW_EMPTY_LOCALNAMESPACEPATH)) - .booleanValue(); + WBEMConfigurationProperties.CIMXML_PARSER_ALLOW_EMPTY_LOCALNAMESPACEPATH, + WBEMConfigurationDefaults.CIMXML_PARSER_ALLOW_EMPTY_LOCALNAMESPACEPATH + ) + ) + .booleanValue(); } public boolean useKeepAliveStrictMode() { return Boolean.valueOf( - getProperty(WBEMConfigurationProperties.HTTP_KEEP_ALIVE_STRICT_MODE, - WBEMConfigurationDefaults.HTTP_KEEP_ALIVE_STRICT_MODE)); + getProperty( + WBEMConfigurationProperties.HTTP_KEEP_ALIVE_STRICT_MODE, + WBEMConfigurationDefaults.HTTP_KEEP_ALIVE_STRICT_MODE + ) + ); } } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/util/WBEMConfigurationDefaults.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/util/WBEMConfigurationDefaults.java index 816b20d..71256db 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/util/WBEMConfigurationDefaults.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/util/WBEMConfigurationDefaults.java @@ -72,16 +72,17 @@ /** * Interface WBEMConfigurationDefaults holds the default values for the * configuration properties. - * + * */ public interface WBEMConfigurationDefaults { - /** * CONFIG_URL */ - public static final String[] CONFIG_URL = new String[] { "file:sblim-cim-client2.properties", - "file:" + System.getProperty("user.home") + "/sblim-cim-client2.properties", - "file:/etc/java/sblim-cim-client2.properties" }; + public static final String[] CONFIG_URL = new String[] { + "file:sblim-cim-client2.properties", + "file:" + System.getProperty("user.home") + "/sblim-cim-client2.properties", + "file:/etc/java/sblim-cim-client2.properties" + }; /** * LOG_FILE_LEVEL diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/util/WBEMConstants.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/util/WBEMConstants.java index 411dd23..59ee47a 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/util/WBEMConstants.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/util/WBEMConstants.java @@ -56,7 +56,6 @@ * Class WBEMConstants contains global constants of the CIM client. */ public interface WBEMConstants { - /** * The HTTP protocol */ @@ -189,5 +188,6 @@ public interface WBEMConstants { /** * Exception message for indication sender potential DoS */ - public static final String INDICATION_DOS_EXCEPTION_MESSAGE = "Indication sender taking too long, possible DoS underway?"; + public static final String INDICATION_DOS_EXCEPTION_MESSAGE = + "Indication sender taking too long, possible DoS underway?"; } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/util/XMLHostStr.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/util/XMLHostStr.java index 336ec11..2decbf5 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/util/XMLHostStr.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/util/XMLHostStr.java @@ -49,23 +49,24 @@ * protocol, host and port strings. */ public class XMLHostStr { - private String iHostStr, iProtocol, iHost, iPort; /* * [ protocol "://"] host [ ":" port ] - * + * * hosts: bela@anything.org 172.20.8.1 [ffe8::e391:13a3] */ /** * Ctor. */ - public XMLHostStr() { /* default constructor */} + public XMLHostStr() { + /* default constructor */ + } /** * Ctor. - * + * * @param pXMLHostStr * - like https://anything.org:5989 */ @@ -75,7 +76,7 @@ public XMLHostStr(String pXMLHostStr) { /** * set - * + * * @param pXMLHostStr * - like https://anything.org:5989 */ @@ -93,7 +94,7 @@ public void set(String pXMLHostStr) { /** * getProtocol - * + * * @return String */ public String getProtocol() { @@ -102,7 +103,7 @@ public String getProtocol() { /** * getHost - * + * * @return String */ public String getHost() { @@ -111,7 +112,7 @@ public String getHost() { /** * getPort - * + * * @return String */ public String getPort() { @@ -158,7 +159,7 @@ private static boolean isIPv6Literal(String pStr) { /* * [ protocol "://"] host [ ":" port ] - * + * * hosts: bela@anything.org 172.20.8.1 [ffe8::e391:13a3] */ @@ -180,5 +181,4 @@ private String parsePort() { this.iHostStr = m.group(1); return m.group(2); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/CIMError.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/CIMError.java index 1cf4a46..19da1d5 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/CIMError.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/CIMError.java @@ -49,10 +49,9 @@ /** * Class CIMError is required for IndicationHandling and CIM-XML parsing. - * + * */ public class CIMError { - private int iStatusCode; private String iDescription; @@ -68,7 +67,7 @@ public CIMError() { /** * Construct a CIMError object from the given WBEMException. - * + * * @param pEx */ public CIMError(WBEMException pEx) { @@ -77,7 +76,7 @@ public CIMError(WBEMException pEx) { /** * Construct a CIMError object with the specified status code. - * + * * @param pStatus * The status code */ @@ -87,7 +86,7 @@ public CIMError(int pStatus) { /** * Ctor. - * + * * @param pStatus * @param pMsg */ @@ -97,7 +96,7 @@ public CIMError(int pStatus, String pMsg) { /** * Ctor. - * + * * @param pStatus * @param pMsg * @param pInstances @@ -110,7 +109,7 @@ public CIMError(int pStatus, String pMsg, CIMInstance[] pInstances) { /** * Gets the status code. - * + * * @return The status code */ public int getCode() { @@ -119,7 +118,7 @@ public int getCode() { /** * Gets the description associated with this status. - * + * * @return The description */ public String getDescription() { @@ -128,7 +127,7 @@ public String getDescription() { /** * getCIMInstances - * + * * @return CIMInstance[] */ public CIMInstance[] getCIMInstances() { @@ -137,19 +136,19 @@ public CIMInstance[] getCIMInstances() { /** * Specifies the status code. - * + * * @param pStatus */ public void setCode(int pStatus) { - if (pStatus > WBEMException.CIM_ERR_SERVER_IS_SHUTTING_DOWN - || pStatus < WBEMException.CIM_ERR_FAILED) throw new IllegalArgumentException( - "invalid error code"); + if ( + pStatus > WBEMException.CIM_ERR_SERVER_IS_SHUTTING_DOWN || pStatus < WBEMException.CIM_ERR_FAILED + ) throw new IllegalArgumentException("invalid error code"); this.iStatusCode = pStatus; } /** * Specifies the description associated to this status. - * + * * @param pDescription */ public void setDescription(String pDescription) { @@ -158,7 +157,7 @@ public void setDescription(String pDescription) { /* * (non-Javadoc) - * + * * @see java.lang.Object#toString() */ @Override @@ -168,7 +167,7 @@ public String toString() { /* * (non-Javadoc) - * + * * @see java.lang.Object#equals(java.lang.Object) */ @Override @@ -177,15 +176,16 @@ public boolean equals(Object o) { CIMError that = (CIMError) o; - if (this.iStatusCode == that.iStatusCode - && (this.iDescription == null ? that.iDescription == null : this.iDescription - .equals(that.iDescription))) return true; + if ( + this.iStatusCode == that.iStatusCode && + (this.iDescription == null ? that.iDescription == null : this.iDescription.equals(that.iDescription)) + ) return true; return false; } /* * (non-Javadoc) - * + * * @see java.lang.Object#hashCode() */ @Override diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/CloseableIteratorDOM.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/CloseableIteratorDOM.java index 447d37c..f838edf 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/CloseableIteratorDOM.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/CloseableIteratorDOM.java @@ -51,29 +51,26 @@ import java.util.Iterator; import java.util.List; import java.util.logging.Level; - import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; - import org.metricshub.wbem.javax.cim.CIMObjectPath; import org.metricshub.wbem.javax.wbem.CloseableIterator; import org.metricshub.wbem.javax.wbem.WBEMException; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.CIMMessage; import org.metricshub.wbem.sblim.cimclient.internal.cimxml.CIMResponse; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.CIMXMLParseException; import org.metricshub.wbem.sblim.cimclient.internal.cimxml.CIMXMLParserImpl; import org.metricshub.wbem.sblim.cimclient.internal.http.io.TrailerException; import org.metricshub.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; -import org.metricshub.wbem.sblim.cimclient.internal.cimxml.CIMMessage; -import org.metricshub.wbem.sblim.cimclient.internal.cimxml.CIMXMLParseException; import org.w3c.dom.Document; import org.xml.sax.InputSource; /** * Class CloseableIteratorDOM is a CloseableIterator implementation for the * CIM-XML DOM parser. - * + * */ public class CloseableIteratorDOM implements CloseableIterator { - private Iterator iItr; private CIMResponse iRsp; @@ -92,14 +89,13 @@ private void trace(Level pLevel, String pMsg) { /** * Ctor. - * + * * @param pStream * @param pPath * @throws WBEMException * @throws IOException */ - public CloseableIteratorDOM(InputStreamReader pStream, CIMObjectPath pPath) - throws WBEMException, IOException { + public CloseableIteratorDOM(InputStreamReader pStream, CIMObjectPath pPath) throws WBEMException, IOException { try { parse(new InputSource(pStream), pPath); } finally { @@ -109,7 +105,7 @@ public CloseableIteratorDOM(InputStreamReader pStream, CIMObjectPath pPath) /** * Ctor. - * + * * @param pIs * @param pLocalPath * @throws WBEMException @@ -152,7 +148,7 @@ public WBEMException getWBEMException() { /** * getParamValues : returns the list of CIMArgument parsed parameters and * their values : String name, CIMDataType type, Object value - * + * * @return List of CIMArgument */ public List getParamValues() { @@ -195,5 +191,4 @@ private void parse(InputSource pIs, CIMObjectPath pLocalPath) throws WBEMExcepti this.iItr = retValVec == null ? null : retValVec.iterator(); this.outParamValues = this.iRsp.getParamValues(); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/CloseableIteratorGeneric.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/CloseableIteratorGeneric.java index cf283f1..1a97ed3 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/CloseableIteratorGeneric.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/CloseableIteratorGeneric.java @@ -38,26 +38,24 @@ */ import java.util.Iterator; - import org.metricshub.wbem.javax.wbem.CloseableIterator; import org.metricshub.wbem.javax.wbem.WBEMException; /** * Class CloseableIteratorGeneric creates new CloseableIterator from an Iterator * and WBEMException. - * + * * @param * : Type */ public class CloseableIteratorGeneric implements CloseableIterator { - private Iterator iterator; private WBEMException iWBEMException; /** * Ctor. : creates new CloseableIterator from an Iterator and WBEMException. - * + * * @param pIterator * : Iterator to be used in closeableIterator * @param pException @@ -70,7 +68,7 @@ public CloseableIteratorGeneric(Iterator pIterator, WBEMException pException) /** * Ctor. : creates new CloseableIterator from an Iterator. - * + * * @param pIterator * : Iterator to be used in closeableIterator */ @@ -85,9 +83,9 @@ public void close() { /** * Returns WBEMException - * + * * @return WBEMException : This can be null - * + * */ public WBEMException getWBEMException() { return this.iWBEMException; diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/CloseableIteratorPULL.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/CloseableIteratorPULL.java index 0169c6f..e28a9ca 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/CloseableIteratorPULL.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/CloseableIteratorPULL.java @@ -48,26 +48,24 @@ import java.io.IOException; import java.io.InputStreamReader; import java.util.logging.Level; - import org.metricshub.wbem.javax.cim.CIMArgument; import org.metricshub.wbem.javax.cim.CIMObjectPath; import org.metricshub.wbem.javax.wbem.CloseableIterator; import org.metricshub.wbem.javax.wbem.WBEMException; import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.XMLDefaultHandlerImpl; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node.AbstractMessageNode; import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node.AbstractSimpleRspNode; import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node.CIMNode; import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node.MessageNode; import org.metricshub.wbem.sblim.cimclient.internal.http.io.TrailerException; import org.metricshub.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; import org.metricshub.wbem.sblim.cimclient.internal.pullparser.XMLPullParser; -import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node.AbstractMessageNode; import org.xml.sax.SAXException; /** * CloseableIterator implementation for PULL parser. */ public class CloseableIteratorPULL implements CloseableIterator { - private XMLPullParser iParser; private XMLDefaultHandlerImpl iHandler; @@ -88,19 +86,18 @@ public class CloseableIteratorPULL implements CloseableIterator { /** * Ctor. - * + * * @param pStream * @param pPath * @throws RuntimeException */ - public CloseableIteratorPULL(InputStreamReader pStream, CIMObjectPath pPath) - throws RuntimeException { + public CloseableIteratorPULL(InputStreamReader pStream, CIMObjectPath pPath) throws RuntimeException { this(new XMLPullParser(pStream), new XMLDefaultHandlerImpl(pPath)); } /** * Ctor. - * + * * @param pParser * @param pHandler */ @@ -127,8 +124,7 @@ public boolean hasNext() { this.iWBEMException = e.getWBEMException(); throw new RuntimeException(this.iWBEMException); } catch (Exception e) { - LogAndTraceBroker.getBroker().trace(Level.SEVERE, - "Exception occurred during XML parsing!", e); + LogAndTraceBroker.getBroker().trace(Level.SEVERE, "Exception occurred during XML parsing!", e); throw new RuntimeException(e); } } @@ -153,8 +149,7 @@ private boolean hasNextImpl() throws Exception { int event = this.iParser.next(); switch (event) { case XMLPullParser.START_ELEMENT: - this.iHandler.startElement(EMPTY, EMPTY, this.iParser.getElementName(), - this.iParser.getAttributes()); + this.iHandler.startElement(EMPTY, EMPTY, this.iParser.getElementName(), this.iParser.getAttributes()); break; case XMLPullParser.CHARACTERS: char[] buf = this.iParser.getText().toCharArray(); @@ -174,8 +169,11 @@ private boolean hasNextImpl() throws Exception { this.iCIMArgAL = absSimpRspNode.getCIMArguments(); CIMError cimErr = absSimpRspNode.getCIMError(); - if (cimErr != null) throw new WBEMException(cimErr.getCode(), cimErr - .getDescription(), cimErr.getCIMInstances()); + if (cimErr != null) throw new WBEMException( + cimErr.getCode(), + cimErr.getDescription(), + cimErr.getCIMInstances() + ); return false; } } @@ -201,7 +199,8 @@ private AbstractSimpleRspNode getAbstractSimpleRspNode() throws Exception { AbstractMessageNode absMsgNode = this.iMsgNode.getAbstractMessageNode(); if (absMsgNode == null) return null; if (!(absMsgNode instanceof AbstractSimpleRspNode)) throw new SAXException( - "Simple response child node expected for MESSAGE node!"); + "Simple response child node expected for MESSAGE node!" + ); this.iAbsSimpRspNode = (AbstractSimpleRspNode) absMsgNode; this.iMsgNode = null; this.iCIMNode = null; // needed no more @@ -209,10 +208,10 @@ private AbstractSimpleRspNode getAbstractSimpleRspNode() throws Exception { } /** - * + * * getCIMArguments : returns the array of parsed parameters and their values * : String name, CIMDataType type, Object value - * + * * @return CIMArgument<?>[] */ diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/CloseableIteratorSAX.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/CloseableIteratorSAX.java index 59ef76a..de72100 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/CloseableIteratorSAX.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/CloseableIteratorSAX.java @@ -47,21 +47,19 @@ import java.io.IOException; import java.io.InputStreamReader; - import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; - import org.metricshub.wbem.javax.cim.CIMArgument; import org.metricshub.wbem.javax.cim.CIMObjectPath; import org.metricshub.wbem.javax.wbem.CloseableIterator; import org.metricshub.wbem.javax.wbem.WBEMException; import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.XMLDefaultHandlerImpl; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node.AbstractMessageNode; import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node.AbstractSimpleRspNode; import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node.CIMNode; import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node.MessageNode; import org.metricshub.wbem.sblim.cimclient.internal.http.io.TrailerException; -import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node.AbstractMessageNode; import org.xml.sax.InputSource; import org.xml.sax.SAXException; @@ -69,7 +67,6 @@ * CloseableIterator implementation for SAX parser. */ public class CloseableIteratorSAX implements CloseableIterator { - private AbstractSimpleRspNode iAbsSimpleRspNode; private CIMError iErr; @@ -82,7 +79,7 @@ public class CloseableIteratorSAX implements CloseableIterator { /** * Ctor. - * + * * @param pStream * @param pPath * @throws IOException @@ -90,8 +87,8 @@ public class CloseableIteratorSAX implements CloseableIterator { * @throws ParserConfigurationException * @throws WBEMException */ - public CloseableIteratorSAX(InputStreamReader pStream, CIMObjectPath pPath) throws IOException, - SAXException, ParserConfigurationException, WBEMException { + public CloseableIteratorSAX(InputStreamReader pStream, CIMObjectPath pPath) + throws IOException, SAXException, ParserConfigurationException, WBEMException { XMLDefaultHandlerImpl handler = new XMLDefaultHandlerImpl(pPath); SAXParser saxParser = iFactory.newSAXParser(); try { @@ -107,7 +104,7 @@ public CloseableIteratorSAX(InputStreamReader pStream, CIMObjectPath pPath) thro /** * Ctor. - * + * * @param pCIMNode * @throws WBEMException */ @@ -117,11 +114,11 @@ public CloseableIteratorSAX(CIMNode pCIMNode) throws WBEMException { private void init(CIMNode pCIMNode) throws WBEMException { MessageNode msgNode = pCIMNode.getMessageNode(); - if (msgNode == null) throw new WBEMException( - "CIMNode parameter must contain a message node!"); + if (msgNode == null) throw new WBEMException("CIMNode parameter must contain a message node!"); AbstractMessageNode absMsgNode = msgNode.getAbstractMessageNode(); if (!(absMsgNode instanceof AbstractSimpleRspNode)) throw new WBEMException( - "Currently only AbstractSimpleRspNodes are handled!"); + "Currently only AbstractSimpleRspNodes are handled!" + ); this.iAbsSimpleRspNode = (AbstractSimpleRspNode) absMsgNode; this.iErr = this.iAbsSimpleRspNode.getCIMError(); this.iCIMArgAL = this.iAbsSimpleRspNode.getCIMArguments(); @@ -136,14 +133,15 @@ public void close() { } public boolean hasNext() { - if (this.iWBEMException != null) { throw new RuntimeException(this.iWBEMException); } + if (this.iWBEMException != null) { + throw new RuntimeException(this.iWBEMException); + } if (this.iErr != null) { - this.iWBEMException = new WBEMException(this.iErr.getCode(), - this.iErr.getDescription(), this.iErr.getCIMInstances()); + this.iWBEMException = + new WBEMException(this.iErr.getCode(), this.iErr.getDescription(), this.iErr.getCIMInstances()); throw new RuntimeException(this.iWBEMException); } - return this.iAbsSimpleRspNode == null ? false : this.iAbsSimpleRspNode - .getReturnValueCount() > 0; + return this.iAbsSimpleRspNode == null ? false : this.iAbsSimpleRspNode.getReturnValueCount() > 0; } public Object next() { @@ -159,10 +157,10 @@ public WBEMException getWBEMException() { } /** - * + * * getCIMArguments : returns the array of parsed parameters and their values * : String name, CIMDataType type, Object value - * + * * @return CIMArgument<?>[] */ diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/EnumerateResponseDOM.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/EnumerateResponseDOM.java index e429344..08e58ef 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/EnumerateResponseDOM.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/EnumerateResponseDOM.java @@ -42,9 +42,7 @@ import java.io.IOException; import java.io.InputStreamReader; import java.util.List; - import javax.xml.parsers.ParserConfigurationException; - import org.metricshub.wbem.javax.cim.CIMArgument; import org.metricshub.wbem.javax.cim.CIMObjectPath; import org.metricshub.wbem.javax.wbem.CloseableIterator; @@ -55,17 +53,16 @@ /** * Class EnumerateResponseDOM is responsible for all helper functions of DOM * parser related with EnumerateResponse. - * + * * @param * : Type Variable */ public class EnumerateResponseDOM { - private EnumerateResponse enumResponse; /** * EnumerateResponsePULL - * + * * @param pStream * @param pPath * @throws IOException @@ -74,9 +71,8 @@ public class EnumerateResponseDOM { * @throws WBEMException */ @SuppressWarnings("unchecked") - public EnumerateResponseDOM(InputStreamReader pStream, CIMObjectPath pPath) throws IOException, - SAXException, ParserConfigurationException, WBEMException { - + public EnumerateResponseDOM(InputStreamReader pStream, CIMObjectPath pPath) + throws IOException, SAXException, ParserConfigurationException, WBEMException { String enumContext = null; Boolean endOfSequence = null; @@ -88,8 +84,9 @@ public EnumerateResponseDOM(InputStreamReader pStream, CIMObjectPath pPath) thro iter.hasNext(); } catch (RuntimeException e) { iter.close(); - if (e.getCause() != null && e.getCause() instanceof WBEMException) { throw (WBEMException) e - .getCause(); } + if (e.getCause() != null && e.getCause() instanceof WBEMException) { + throw (WBEMException) e.getCause(); + } throw e; } @@ -97,39 +94,41 @@ public EnumerateResponseDOM(InputStreamReader pStream, CIMObjectPath pPath) thro List pOutArgA = ((CloseableIteratorDOM) iter).getParamValues(); // pOutArgA can never be null - if (pOutArgA == null) { throw new IllegalArgumentException( - "Output auguments not found during CIM-XML DOM parser"); } + if (pOutArgA == null) { + throw new IllegalArgumentException("Output auguments not found during CIM-XML DOM parser"); + } for (int i = 0; i < pOutArgA.size(); i++) { - CIMArgument cimArg = (CIMArgument) pOutArgA.get(i); - if (cimArg.getName().equals("EnumerationContext")) enumContext = (String) cimArg - .getValue(); - else if (cimArg.getName().equals("EndOfSequence")) endOfSequence = (Boolean) cimArg - .getValue(); - else throw new IllegalArgumentException( - "Invalid argument : only EnumerationContext and EndOfSequence are allowed"); + if (cimArg.getName().equals("EnumerationContext")) enumContext = (String) cimArg.getValue(); else if ( + cimArg.getName().equals("EndOfSequence") + ) endOfSequence = (Boolean) cimArg.getValue(); else throw new IllegalArgumentException( + "Invalid argument : only EnumerationContext and EndOfSequence are allowed" + ); } // EndOfSequence can never be null - if (endOfSequence == null) { throw new IllegalArgumentException( - "Invalid argument : EndOfSequence can never be null"); } + if (endOfSequence == null) { + throw new IllegalArgumentException("Invalid argument : EndOfSequence can never be null"); + } // EnumerationContext can't be null if there is more data available - if ((endOfSequence.booleanValue() == false) && (enumContext == null)) { throw new IllegalArgumentException( - "Invalid argument : EnumerationContext cannot be null if there is more data available"); } + if ((endOfSequence.booleanValue() == false) && (enumContext == null)) { + throw new IllegalArgumentException( + "Invalid argument : EnumerationContext cannot be null if there is more data available" + ); + } - this.enumResponse = new EnumerateResponse(enumContext, (CloseableIterator) iter, - endOfSequence.booleanValue()); + this.enumResponse = + new EnumerateResponse(enumContext, (CloseableIterator) iter, endOfSequence.booleanValue()); } /** * Returns enumResponse - * + * * @return The value of enumResponse. */ public EnumerateResponse getEnumResponse() { return this.enumResponse; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/EnumerateResponsePULL.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/EnumerateResponsePULL.java index 4127f66..336c7e4 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/EnumerateResponsePULL.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/EnumerateResponsePULL.java @@ -41,9 +41,7 @@ import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; - import javax.xml.parsers.ParserConfigurationException; - import org.metricshub.wbem.javax.cim.CIMArgument; import org.metricshub.wbem.javax.cim.CIMObjectPath; import org.metricshub.wbem.javax.wbem.CloseableIterator; @@ -54,16 +52,15 @@ /** * Class EnumerateResponsePULL is responsible for all helper functions of PULL * parser related with EnumerateResponse. - * + * * @param */ public class EnumerateResponsePULL { - private EnumerateResponse enumResponse; /** * Ctor. - * + * * @param pStream * Input stream to be parsed * @param pPath @@ -75,8 +72,7 @@ public class EnumerateResponsePULL { */ @SuppressWarnings("unchecked") public EnumerateResponsePULL(InputStreamReader pStream, CIMObjectPath pPath) - throws IOException, SAXException, ParserConfigurationException, WBEMException { - + throws IOException, SAXException, ParserConfigurationException, WBEMException { String enumContext = null; Boolean endOfSequence = null; ArrayList list = new ArrayList(); @@ -85,51 +81,55 @@ public EnumerateResponsePULL(InputStreamReader pStream, CIMObjectPath pPath) // iterate through 'iter' for getCIMArguments to populate try { - while (iter.hasNext()) - list.add((T) iter.next()); + while (iter.hasNext()) list.add((T) iter.next()); } catch (RuntimeException e) { iter.close(); - if (e.getCause() != null && e.getCause() instanceof WBEMException) { throw (WBEMException) e - .getCause(); } + if (e.getCause() != null && e.getCause() instanceof WBEMException) { + throw (WBEMException) e.getCause(); + } throw e; } // pOutArgA can never be null CIMArgument[] pOutArgA = ((CloseableIteratorPULL) iter).getCIMArguments(); - if (pOutArgA == null) { throw new IllegalArgumentException( - "Output auguments not found during CIM-XML PULL parser"); } + if (pOutArgA == null) { + throw new IllegalArgumentException("Output auguments not found during CIM-XML PULL parser"); + } for (int i = 0; i < pOutArgA.length; i++) { - if (pOutArgA[i].getName().equals("EnumerationContext")) enumContext = (String) pOutArgA[i] - .getValue(); - else if (pOutArgA[i].getName().equals("EndOfSequence")) endOfSequence = (Boolean) pOutArgA[i] - .getValue(); - else throw new IllegalArgumentException( - "Invalid argument : only EnumerationContext and EndOfSequence are allowed"); + if (pOutArgA[i].getName().equals("EnumerationContext")) enumContext = (String) pOutArgA[i].getValue(); else if ( + pOutArgA[i].getName().equals("EndOfSequence") + ) endOfSequence = (Boolean) pOutArgA[i].getValue(); else throw new IllegalArgumentException( + "Invalid argument : only EnumerationContext and EndOfSequence are allowed" + ); } // EndOfSequence can never be null - if (endOfSequence == null) { throw new IllegalArgumentException( - "Invalid argument : EndOfSequence can never be null"); } + if (endOfSequence == null) { + throw new IllegalArgumentException("Invalid argument : EndOfSequence can never be null"); + } // EnumerationContext can't be null if there is more data available - if ((endOfSequence.booleanValue() == false) && (enumContext == null)) { throw new IllegalArgumentException( - "Invalid argument : EnumerationContext cannot be null if there is more data available"); } + if ((endOfSequence.booleanValue() == false) && (enumContext == null)) { + throw new IllegalArgumentException( + "Invalid argument : EnumerationContext cannot be null if there is more data available" + ); + } // create new closeableIterator as we cannot reuse 'iter' - CloseableIterator iterPull = (CloseableIterator) new CloseableIteratorGeneric(list - .iterator(), iter.getWBEMException()); + CloseableIterator iterPull = (CloseableIterator) new CloseableIteratorGeneric( + list.iterator(), + iter.getWBEMException() + ); - this.enumResponse = new EnumerateResponse(enumContext, iterPull, endOfSequence - .booleanValue()); + this.enumResponse = new EnumerateResponse(enumContext, iterPull, endOfSequence.booleanValue()); } /** * Returns enumResponse - * + * * @return The value of enumResponse. */ public EnumerateResponse getEnumResponse() { return this.enumResponse; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/EnumerateResponseSAX.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/EnumerateResponseSAX.java index d56ecb8..edb6879 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/EnumerateResponseSAX.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/EnumerateResponseSAX.java @@ -42,9 +42,7 @@ import java.io.IOException; import java.io.InputStreamReader; - import javax.xml.parsers.ParserConfigurationException; - import org.metricshub.wbem.javax.cim.CIMArgument; import org.metricshub.wbem.javax.cim.CIMObjectPath; import org.metricshub.wbem.javax.wbem.CloseableIterator; @@ -55,16 +53,15 @@ /** * Class EnumerateResponseSAX is responsible for all helper functions of SAX * parser related with EnumerateResponse. - * + * * @param */ public class EnumerateResponseSAX { - private EnumerateResponse enumResponse; /** * Ctor. - * + * * @param pStream * Input stream to be parsed * @param pPath @@ -75,9 +72,8 @@ public class EnumerateResponseSAX { * @throws WBEMException */ @SuppressWarnings("unchecked") - public EnumerateResponseSAX(InputStreamReader pStream, CIMObjectPath pPath) throws IOException, - SAXException, ParserConfigurationException, WBEMException { - + public EnumerateResponseSAX(InputStreamReader pStream, CIMObjectPath pPath) + throws IOException, SAXException, ParserConfigurationException, WBEMException { String enumContext = null; Boolean endOfSequence = null; @@ -89,8 +85,9 @@ public EnumerateResponseSAX(InputStreamReader pStream, CIMObjectPath pPath) thro iter.hasNext(); } catch (RuntimeException e) { iter.close(); - if (e.getCause() != null && e.getCause() instanceof WBEMException) { throw (WBEMException) e - .getCause(); } + if (e.getCause() != null && e.getCause() instanceof WBEMException) { + throw (WBEMException) e.getCause(); + } throw e; } @@ -98,8 +95,9 @@ public EnumerateResponseSAX(InputStreamReader pStream, CIMObjectPath pPath) thro CIMArgument[] pOutArgA = ((CloseableIteratorSAX) iter).getCIMArguments(); // pOutArgA can never be null - if (pOutArgA == null) { throw new IllegalArgumentException( - "Output auguments not found during CIM-XML SAX parser"); } + if (pOutArgA == null) { + throw new IllegalArgumentException("Output auguments not found during CIM-XML SAX parser"); + } // we can use this too but we need not sort array just for 2 elements // enumContext = ((CIMArgument) CIMElementSorter.find(pOutArgA, @@ -108,32 +106,34 @@ public EnumerateResponseSAX(InputStreamReader pStream, CIMObjectPath pPath) thro // CIMElementSorter.find(pOutArgA, "EndOfSequence")).getValue(); for (int i = 0; i < pOutArgA.length; i++) { - if (pOutArgA[i].getName().equals("EnumerationContext")) enumContext = (String) pOutArgA[i] - .getValue(); - else if (pOutArgA[i].getName().equals("EndOfSequence")) endOfSequence = (Boolean) pOutArgA[i] - .getValue(); - else throw new IllegalArgumentException( - "Invalid argument : only EnumerationContext and EndOfSequence are allowed"); + if (pOutArgA[i].getName().equals("EnumerationContext")) enumContext = (String) pOutArgA[i].getValue(); else if ( + pOutArgA[i].getName().equals("EndOfSequence") + ) endOfSequence = (Boolean) pOutArgA[i].getValue(); else throw new IllegalArgumentException( + "Invalid argument : only EnumerationContext and EndOfSequence are allowed" + ); } // EndOfSequence can never be null - if (endOfSequence == null) { throw new IllegalArgumentException( - "Invalid argument : EndOfSequence can never be null"); } + if (endOfSequence == null) { + throw new IllegalArgumentException("Invalid argument : EndOfSequence can never be null"); + } // EnumerationContext can't be null if there is more data available - if ((endOfSequence.booleanValue() == false) && (enumContext == null)) { throw new IllegalArgumentException( - "Invalid argument : EnumerationContext cannot be null if there is more data available"); } + if ((endOfSequence.booleanValue() == false) && (enumContext == null)) { + throw new IllegalArgumentException( + "Invalid argument : EnumerationContext cannot be null if there is more data available" + ); + } - this.enumResponse = new EnumerateResponse(enumContext, (CloseableIterator) iter, - endOfSequence.booleanValue()); + this.enumResponse = + new EnumerateResponse(enumContext, (CloseableIterator) iter, endOfSequence.booleanValue()); } /** * Returns enumResponse - * + * * @return The value of enumResponse. */ public EnumerateResponse getEnumResponse() { return this.enumResponse; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/WBEMClientCIMXML.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/WBEMClientCIMXML.java index f0e2c58..91a75a1 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/WBEMClientCIMXML.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/WBEMClientCIMXML.java @@ -119,34 +119,45 @@ import java.util.Iterator; import java.util.List; import java.util.Locale; -import java.util.Properties; import java.util.Map.Entry; +import java.util.Properties; import java.util.logging.Level; - +import javax.net.SocketFactory; +import javax.net.ssl.SSLHandshakeException; +import javax.security.auth.Subject; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; import org.metricshub.wbem.javax.cim.CIMArgument; import org.metricshub.wbem.javax.cim.CIMClass; import org.metricshub.wbem.javax.cim.CIMInstance; import org.metricshub.wbem.javax.cim.CIMObjectPath; import org.metricshub.wbem.javax.cim.CIMQualifierType; +import org.metricshub.wbem.javax.cim.UnsignedInteger32; +import org.metricshub.wbem.javax.cim.UnsignedInteger64; import org.metricshub.wbem.javax.wbem.CloseableIterator; import org.metricshub.wbem.javax.wbem.WBEMException; import org.metricshub.wbem.javax.wbem.client.EnumerateResponse; import org.metricshub.wbem.javax.wbem.client.PasswordCredential; import org.metricshub.wbem.javax.wbem.client.RoleCredential; import org.metricshub.wbem.javax.wbem.client.WBEMClient; +import org.metricshub.wbem.javax.wbem.client.WBEMClientConstants; import org.metricshub.wbem.sblim.cimclient.WBEMClientSBLIM; import org.metricshub.wbem.sblim.cimclient.WBEMConfigurationProperties; import org.metricshub.wbem.sblim.cimclient.internal.cim.CIMHelper; import org.metricshub.wbem.sblim.cimclient.internal.cimxml.CIMClientXML_HelperImpl; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.CIMMessage; import org.metricshub.wbem.sblim.cimclient.internal.cimxml.CIMResponse; +import org.metricshub.wbem.sblim.cimclient.internal.cimxml.CIMXMLParseException; import org.metricshub.wbem.sblim.cimclient.internal.cimxml.CIMXMLParserImpl; import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXHelper; +import org.metricshub.wbem.sblim.cimclient.internal.http.AuthorizationHandler; import org.metricshub.wbem.sblim.cimclient.internal.http.AuthorizationInfo; import org.metricshub.wbem.sblim.cimclient.internal.http.HttpClientPool; import org.metricshub.wbem.sblim.cimclient.internal.http.HttpHeader; +import org.metricshub.wbem.sblim.cimclient.internal.http.HttpHeader.HeaderEntry; import org.metricshub.wbem.sblim.cimclient.internal.http.HttpHeaderParser; import org.metricshub.wbem.sblim.cimclient.internal.http.HttpUrlConnection; -import org.metricshub.wbem.sblim.cimclient.internal.http.HttpHeader.HeaderEntry; import org.metricshub.wbem.sblim.cimclient.internal.http.io.DebugInputStream; import org.metricshub.wbem.sblim.cimclient.internal.http.io.TrailerException; import org.metricshub.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; @@ -155,20 +166,6 @@ import org.metricshub.wbem.sblim.cimclient.internal.util.MOF; import org.metricshub.wbem.sblim.cimclient.internal.util.WBEMConfiguration; import org.metricshub.wbem.sblim.cimclient.internal.util.WBEMConfigurationDefaults; -import org.metricshub.wbem.javax.cim.UnsignedInteger32; -import org.metricshub.wbem.javax.cim.UnsignedInteger64; -import javax.net.SocketFactory; -import javax.net.ssl.SSLHandshakeException; -import javax.security.auth.Subject; - -import org.metricshub.wbem.javax.wbem.client.WBEMClientConstants; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; - -import org.metricshub.wbem.sblim.cimclient.internal.cimxml.CIMMessage; -import org.metricshub.wbem.sblim.cimclient.internal.cimxml.CIMXMLParseException; -import org.metricshub.wbem.sblim.cimclient.internal.http.AuthorizationHandler; import org.metricshub.wbem.sblim.cimclient.internal.util.WBEMConstants; import org.w3c.dom.Document; import org.xml.sax.InputSource; @@ -179,12 +176,11 @@ * javax.wbem.client.WBEMClient interface for the CIM-XML protocol * including the extensions of the * org.metricshub.wbem.sblim.cimclient.WBEMClientSBLIM interface. - * + * * @see WBEMClient * @see WBEMClientSBLIM */ public class WBEMClientCIMXML implements WBEMClientSBLIM { - private final WBEMConfiguration iConfiguration = new WBEMConfiguration(new Properties()); private Locale[] iLocales; // final @@ -221,8 +217,7 @@ public WBEMClientCIMXML() { } private synchronized void initializeClient(URI pUri, Subject pSubject, Locale[] pLocales) - throws IllegalArgumentException { - + throws IllegalArgumentException { if (this.iInitialized) throw new IllegalStateException("WBEMClient is already initialized"); final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); @@ -230,34 +225,44 @@ private synchronized void initializeClient(URI pUri, Subject pSubject, Locale[] try { this.iHttpClientPool = new HttpClientPool(this.iConfiguration); - this.iLocales = (pLocales != null && pLocales.length > 0) ? pLocales - : WBEMConstants.DEFAULT_LOCALES; + this.iLocales = (pLocales != null && pLocales.length > 0) ? pLocales : WBEMConstants.DEFAULT_LOCALES; this.iUri = pUri; AuthorizationInfo authInfo = AuthorizationInfo.createAuthorizationInfo( - this.iConfiguration.getHttpAuthenticationModule(), Boolean.FALSE, this.iUri - .getHost(), this.iUri.getPort(), null, null, null); - - Principal principal = (pSubject != null && pSubject.getPrincipals() != null && !pSubject - .getPrincipals().isEmpty()) ? (Principal) pSubject.getPrincipals().iterator() - .next() : null; - Object credential = (pSubject != null && pSubject.getPrivateCredentials() != null - && !pSubject.getPrivateCredentials().isEmpty() ? pSubject - .getPrivateCredentials().iterator().next() : null); - - boolean defaultAuthEnabled = WBEMConfiguration.getGlobalConfiguration() - .isDefaultAuthorizationEnabled(); + this.iConfiguration.getHttpAuthenticationModule(), + Boolean.FALSE, + this.iUri.getHost(), + this.iUri.getPort(), + null, + null, + null + ); + + Principal principal = ( + pSubject != null && pSubject.getPrincipals() != null && !pSubject.getPrincipals().isEmpty() + ) + ? (Principal) pSubject.getPrincipals().iterator().next() + : null; + Object credential = + ( + pSubject != null && pSubject.getPrivateCredentials() != null && !pSubject.getPrivateCredentials().isEmpty() + ? pSubject.getPrivateCredentials().iterator().next() + : null + ); + + boolean defaultAuthEnabled = WBEMConfiguration.getGlobalConfiguration().isDefaultAuthorizationEnabled(); String user = (principal != null) ? principal.getName() : ""; - String password = (credential != null && credential instanceof PasswordCredential) ? new String( - ((PasswordCredential) credential).getUserPassword()) - : ((credential != null && credential instanceof RoleCredential) ? new String( - ((RoleCredential) credential).getCredential()) : ""); + String password = (credential != null && credential instanceof PasswordCredential) + ? new String(((PasswordCredential) credential).getUserPassword()) + : ( + (credential != null && credential instanceof RoleCredential) + ? new String(((RoleCredential) credential).getCredential()) + : "" + ); - if (defaultAuthEnabled && (user == null || user.length() == 0) - && password.length() == 0) { - logger.trace(Level.FINER, - "Principal and Credential not set - using default authorization!"); + if (defaultAuthEnabled && (user == null || user.length() == 0) && password.length() == 0) { + logger.trace(Level.FINER, "Principal and Credential not set - using default authorization!"); user = WBEMConfiguration.getGlobalConfiguration().getDefaultPrincipal(); password = WBEMConfiguration.getGlobalConfiguration().getDefaultCredentials(); @@ -270,36 +275,37 @@ private synchronized void initializeClient(URI pUri, Subject pSubject, Locale[] try { this.iXmlHelper = new CIMClientXML_HelperImpl(); } catch (ParserConfigurationException e) { - logger - .trace(Level.FINE, "Exception while instantiating CIMClientXML_HelperImpl", - e); + logger.trace(Level.FINE, "Exception while instantiating CIMClientXML_HelperImpl", e); logger.message(Messages.CIM_XMLHELPER_FAILED); throw new RuntimeException(e); } this.iInitialized = true; - } finally { logger.exit(); } } public void initialize(CIMObjectPath pName, Subject pSubject, Locale[] pLocales) - throws IllegalArgumentException, WBEMException { - + throws IllegalArgumentException, WBEMException { final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); logger.entry(); try { final URI uri; - if (pName == null || pName.getHost() == null || pName.getHost().length() == 0) { throw new IllegalArgumentException( - "Empty host path"); } - if (pName.getScheme() == null || pName.getScheme().length() == 0) { throw new IllegalArgumentException( - "Empty scheme"); } - if (!pName.getScheme().equalsIgnoreCase(WBEMConstants.HTTP) - && !pName.getScheme().equalsIgnoreCase(WBEMConstants.HTTPS)) { throw new IllegalArgumentException( - "Protocol not supported"); } + if (pName == null || pName.getHost() == null || pName.getHost().length() == 0) { + throw new IllegalArgumentException("Empty host path"); + } + if (pName.getScheme() == null || pName.getScheme().length() == 0) { + throw new IllegalArgumentException("Empty scheme"); + } + if ( + !pName.getScheme().equalsIgnoreCase(WBEMConstants.HTTP) && + !pName.getScheme().equalsIgnoreCase(WBEMConstants.HTTPS) + ) { + throw new IllegalArgumentException("Protocol not supported"); + } try { uri = CIMHelper.createCimomUri(pName); @@ -313,22 +319,25 @@ public void initialize(CIMObjectPath pName, Subject pSubject, Locale[] pLocales) } } - public void initialize(URI pUri, Subject pSubject, Locale[] pLocales) - throws IllegalArgumentException, WBEMException { - + public void initialize(URI pUri, Subject pSubject, Locale[] pLocales) throws IllegalArgumentException, WBEMException { final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); logger.entry(); try { final URI uri; - if (pUri == null || pUri.getHost() == null || pUri.getHost().length() == 0) { throw new IllegalArgumentException( - "Empty host path"); } - if (pUri.getScheme() == null || pUri.getScheme().length() == 0) { throw new IllegalArgumentException( - "Empty scheme"); } - if (!pUri.getScheme().equalsIgnoreCase(WBEMConstants.HTTP) - && !pUri.getScheme().equalsIgnoreCase(WBEMConstants.HTTPS)) { throw new IllegalArgumentException( - "Protocol not supported"); } + if (pUri == null || pUri.getHost() == null || pUri.getHost().length() == 0) { + throw new IllegalArgumentException("Empty host path"); + } + if (pUri.getScheme() == null || pUri.getScheme().length() == 0) { + throw new IllegalArgumentException("Empty scheme"); + } + if ( + !pUri.getScheme().equalsIgnoreCase(WBEMConstants.HTTP) && + !pUri.getScheme().equalsIgnoreCase(WBEMConstants.HTTPS) + ) { + throw new IllegalArgumentException("Protocol not supported"); + } try { uri = CIMHelper.createCimomUri(pUri); @@ -399,7 +408,6 @@ public String getProperty(String pKey) { } } return this.iConfiguration.getDomainProperty(pKey); - } public void setProperties(Properties pProperties) { @@ -410,23 +418,18 @@ public void setProperty(String pKey, String pValue) { if (pKey.startsWith("javax.wbem.")) { // Process JSR48 properties if (pKey.equals(WBEMClientConstants.PROP_ENABLE_CONSOLE_LOGGING)) { - this.iConfiguration.setDomainProperty( - WBEMConfigurationProperties.LOG_CONSOLE_LEVEL, pValue); + this.iConfiguration.setDomainProperty(WBEMConfigurationProperties.LOG_CONSOLE_LEVEL, pValue); } else if (pKey.equals(WBEMClientConstants.PROP_ENABLE_FILE_LOGGING)) { - this.iConfiguration.setDomainProperty(WBEMConfigurationProperties.LOG_FILE_LEVEL, - pValue); + this.iConfiguration.setDomainProperty(WBEMConfigurationProperties.LOG_FILE_LEVEL, pValue); } else if (pKey.equals(WBEMClientConstants.PROP_LOG_BYTE_LIMIT)) { - this.iConfiguration.setDomainProperty( - WBEMConfigurationProperties.LOG_FILE_SIZE_LIMIT, pValue); + this.iConfiguration.setDomainProperty(WBEMConfigurationProperties.LOG_FILE_SIZE_LIMIT, pValue); } else if (pKey.equals(WBEMClientConstants.PROP_LOG_DIR)) { StringBuffer NewSblimLog = new StringBuffer(pValue != null ? pValue : ""); - if (NewSblimLog.length() > 0 - && NewSblimLog.charAt(NewSblimLog.length() - 1) != File.separatorChar) { + if (NewSblimLog.length() > 0 && NewSblimLog.charAt(NewSblimLog.length() - 1) != File.separatorChar) { NewSblimLog.append(File.separator); } - String CurSblimLog = this.iConfiguration - .getDomainProperty(WBEMConfigurationProperties.LOG_FILE_LOCATION); + String CurSblimLog = this.iConfiguration.getDomainProperty(WBEMConfigurationProperties.LOG_FILE_LOCATION); if (CurSblimLog == null) { CurSblimLog = WBEMConfigurationDefaults.LOG_FILE_LOCATION; } @@ -438,13 +441,11 @@ public void setProperty(String pKey, String pValue) { NewSblimLog.append(CurSblimLog.substring(i + 1)); } - this.iConfiguration.setDomainProperty( - WBEMConfigurationProperties.LOG_FILE_LOCATION, NewSblimLog.toString()); + this.iConfiguration.setDomainProperty(WBEMConfigurationProperties.LOG_FILE_LOCATION, NewSblimLog.toString()); } else if (pKey.equals(WBEMClientConstants.PROP_LOG_FILENAME)) { StringBuffer NewSblimLog = new StringBuffer(pValue != null ? pValue : ""); - String CurSblimLog = this.iConfiguration - .getDomainProperty(WBEMConfigurationProperties.LOG_FILE_LOCATION); + String CurSblimLog = this.iConfiguration.getDomainProperty(WBEMConfigurationProperties.LOG_FILE_LOCATION); if (CurSblimLog != null) { int i = getLastSeparator(CurSblimLog); if (i != -1) { @@ -452,27 +453,22 @@ public void setProperty(String pKey, String pValue) { } } - this.iConfiguration.setDomainProperty( - WBEMConfigurationProperties.LOG_FILE_LOCATION, NewSblimLog.toString()); + this.iConfiguration.setDomainProperty(WBEMConfigurationProperties.LOG_FILE_LOCATION, NewSblimLog.toString()); } else if (pKey.equals(WBEMClientConstants.PROP_LOG_NUM_FILES)) { - this.iConfiguration.setDomainProperty(WBEMConfigurationProperties.LOG_FILE_COUNT, - pValue); + this.iConfiguration.setDomainProperty(WBEMConfigurationProperties.LOG_FILE_COUNT, pValue); } else if (pKey.equals(WBEMClientConstants.PROP_TIMEOUT)) { - this.iConfiguration.setDomainProperty(WBEMConfigurationProperties.HTTP_TIMEOUT, - pValue); + this.iConfiguration.setDomainProperty(WBEMConfigurationProperties.HTTP_TIMEOUT, pValue); } else if (pKey.equals(WBEMClientConstants.PROPERTY_WBEM_CHUNKING)) { this.iConfiguration.setDomainProperty( - WBEMConfigurationProperties.HTTP_USE_CHUNKING, pValue.equals("0") ? "false" - : "true"); + WBEMConfigurationProperties.HTTP_USE_CHUNKING, + pValue.equals("0") ? "false" : "true" + ); } else if (pKey.equals(WBEMClientConstants.PROP_CLIENT_KEYSTORE)) { - this.iConfiguration.setDomainProperty(WBEMConfigurationProperties.KEYSTORE_PATH, - pValue); + this.iConfiguration.setDomainProperty(WBEMConfigurationProperties.KEYSTORE_PATH, pValue); } else if (pKey.equals(WBEMClientConstants.PROP_CLIENT_KEYSTORE_PASSWORD)) { - this.iConfiguration.setDomainProperty( - WBEMConfigurationProperties.KEYSTORE_PASSWORD, pValue); + this.iConfiguration.setDomainProperty(WBEMConfigurationProperties.KEYSTORE_PASSWORD, pValue); } else if (pKey.equals(WBEMClientConstants.PROP_CLIENT_TRUSTSTORE)) { - this.iConfiguration.setDomainProperty(WBEMConfigurationProperties.TRUSTSTORE_PATH, - pValue); + this.iConfiguration.setDomainProperty(WBEMConfigurationProperties.TRUSTSTORE_PATH, pValue); } else { throw new IllegalArgumentException(pKey); } @@ -481,10 +477,14 @@ public void setProperty(String pKey, String pValue) { } } - public CloseableIterator associatorNames(CIMObjectPath pObjectName, - String pAssociationClass, String pResultClass, String pRole, String pResultRole) - throws WBEMException { - + public CloseableIterator associatorNames( + CIMObjectPath pObjectName, + String pAssociationClass, + String pResultClass, + String pRole, + String pResultRole + ) + throws WBEMException { final String operation = "AssociatorNames"; final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); logger.entry(); @@ -492,33 +492,30 @@ public CloseableIterator associatorNames(CIMObjectPath pObjectNam checkState(); try { - - if (pObjectName == null || pObjectName.getNamespace() == null - || pObjectName.getObjectName() == null) { throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + if (pObjectName == null || pObjectName.getNamespace() == null || pObjectName.getObjectName() == null) { + throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); + } HttpHeader hh = new HttpHeader(); - hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", - "US-ASCII")); + hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", "US-ASCII")); Document doc = this.iXmlHelper.newDocument(); - this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.associatorNames_request(doc, - pObjectName, pAssociationClass, pResultClass, pRole, pResultRole)); + this.iXmlHelper.createCIMMessage( + doc, + this.iXmlHelper.associatorNames_request(doc, pObjectName, pAssociationClass, pResultClass, pRole, pResultRole) + ); InputStreamReader is = transmitRequest("AssociatorNames", hh, doc); CloseableIterator iter = getIterator(is, pObjectName); return iter; - } catch (WBEMException e) { logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); throw e; } catch (Exception e) { if (e.getCause() != null && e.getCause() instanceof WBEMException) { - logger - .trace(Level.FINE, operation + " request resulted in CIM Error", e - .getCause()); + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e.getCause()); throw (WBEMException) e.getCause(); } logger.trace(Level.FINE, operation + " request failed", e); @@ -528,10 +525,17 @@ public CloseableIterator associatorNames(CIMObjectPath pObjectNam } } - public CloseableIterator associatorClasses(CIMObjectPath pObjectName, - String pAssociationClass, String pResultClass, String pRole, String pResultRole, - boolean pIncludeQualifiers, boolean pIncludeClassOrigin, String[] pPropertyList) - throws WBEMException { + public CloseableIterator associatorClasses( + CIMObjectPath pObjectName, + String pAssociationClass, + String pResultClass, + String pRole, + String pResultRole, + boolean pIncludeQualifiers, + boolean pIncludeClassOrigin, + String[] pPropertyList + ) + throws WBEMException { final String operation = "AssociatorClasses"; final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); logger.entry(); @@ -539,34 +543,40 @@ public CloseableIterator associatorClasses(CIMObjectPath pObjectName, checkState(); try { - - if (pObjectName == null || pObjectName.getNamespace() == null - || pObjectName.getObjectName() == null) { throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + if (pObjectName == null || pObjectName.getNamespace() == null || pObjectName.getObjectName() == null) { + throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); + } HttpHeader hh = new HttpHeader(); - hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", - "US-ASCII")); + hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", "US-ASCII")); Document doc = this.iXmlHelper.newDocument(); - this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.associatorClasses_request(doc, - pObjectName, pAssociationClass, pResultClass, pRole, pResultRole, - pIncludeQualifiers, pIncludeClassOrigin, pPropertyList)); + this.iXmlHelper.createCIMMessage( + doc, + this.iXmlHelper.associatorClasses_request( + doc, + pObjectName, + pAssociationClass, + pResultClass, + pRole, + pResultRole, + pIncludeQualifiers, + pIncludeClassOrigin, + pPropertyList + ) + ); InputStreamReader is = transmitRequest("Associators", hh, doc); CloseableIterator iter = getIterator(is, pObjectName); return iter; - } catch (WBEMException e) { logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); throw e; } catch (Exception e) { if (e.getCause() != null && e.getCause() instanceof WBEMException) { - logger - .trace(Level.FINE, operation + " request resulted in CIM Error", e - .getCause()); + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e.getCause()); throw (WBEMException) e.getCause(); } logger.trace(Level.FINE, operation + " request failed", e); @@ -576,9 +586,16 @@ public CloseableIterator associatorClasses(CIMObjectPath pObjectName, } } - public CloseableIterator associatorInstances(CIMObjectPath pObjectName, - String pAssociationClass, String pResultClass, String pRole, String pResultRole, - boolean pIncludeClassOrigin, String[] pPropertyList) throws WBEMException { + public CloseableIterator associatorInstances( + CIMObjectPath pObjectName, + String pAssociationClass, + String pResultClass, + String pRole, + String pResultRole, + boolean pIncludeClassOrigin, + String[] pPropertyList + ) + throws WBEMException { final String operation = "AssociatorInstances"; final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); logger.entry(); @@ -586,33 +603,38 @@ public CloseableIterator associatorInstances(CIMObjectPath pObjectN checkState(); try { - - if (pObjectName == null || pObjectName.getNamespace() == null - || pObjectName.getObjectName() == null) { throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + if (pObjectName == null || pObjectName.getNamespace() == null || pObjectName.getObjectName() == null) { + throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); + } HttpHeader hh = new HttpHeader(); - hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", - "US-ASCII")); + hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", "US-ASCII")); Document doc = this.iXmlHelper.newDocument(); - this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.associatorInstances_request(doc, - pObjectName, pAssociationClass, pResultClass, pRole, pResultRole, - pIncludeClassOrigin, pPropertyList)); + this.iXmlHelper.createCIMMessage( + doc, + this.iXmlHelper.associatorInstances_request( + doc, + pObjectName, + pAssociationClass, + pResultClass, + pRole, + pResultRole, + pIncludeClassOrigin, + pPropertyList + ) + ); InputStreamReader is = transmitRequest("Associators", hh, doc); CloseableIterator iter = getIterator(is, pObjectName); return iter; - } catch (WBEMException e) { logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); throw e; } catch (Exception e) { if (e.getCause() != null && e.getCause() instanceof WBEMException) { - logger - .trace(Level.FINE, operation + " request resulted in CIM Error", e - .getCause()); + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e.getCause()); throw (WBEMException) e.getCause(); } logger.trace(Level.FINE, operation + " request failed", e); @@ -637,7 +659,6 @@ public synchronized void close() { } public void createClass(CIMClass pClass) throws WBEMException { - final String operation = "CreateClass"; final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); logger.entry(); @@ -645,18 +666,15 @@ public void createClass(CIMClass pClass) throws WBEMException { checkState(); try { - - if (pClass == null || pClass.getObjectPath() == null - || pClass.getObjectPath().getNamespace() == null) { throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + if (pClass == null || pClass.getObjectPath() == null || pClass.getObjectPath().getNamespace() == null) { + throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); + } HttpHeader hh = new HttpHeader(); - hh.addField("CIMObject", HttpHeader.encode(pClass.getObjectPath().getNamespace(), - "UTF-8", "US-ASCII")); + hh.addField("CIMObject", HttpHeader.encode(pClass.getObjectPath().getNamespace(), "UTF-8", "US-ASCII")); Document doc = this.iXmlHelper.newDocument(); - this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.createClass_request(doc, pClass - .getObjectPath(), pClass)); + this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.createClass_request(doc, pClass.getObjectPath(), pClass)); InputStreamReader is = transmitRequest("CreateClass", hh, doc); @@ -666,15 +684,12 @@ public void createClass(CIMClass pClass) throws WBEMException { } finally { iter.close(); } - } catch (WBEMException e) { logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); throw e; } catch (Exception e) { if (e.getCause() != null && e.getCause() instanceof WBEMException) { - logger - .trace(Level.FINE, operation + " request resulted in CIM Error", e - .getCause()); + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e.getCause()); throw (WBEMException) e.getCause(); } logger.trace(Level.FINE, operation + " request failed", e); @@ -685,7 +700,6 @@ public void createClass(CIMClass pClass) throws WBEMException { } public CIMObjectPath createInstance(CIMInstance pInstance) throws WBEMException { - final String operation = "CreateInstance"; final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); logger.entry(); @@ -693,37 +707,37 @@ public CIMObjectPath createInstance(CIMInstance pInstance) throws WBEMException checkState(); try { - if (pInstance == null || pInstance.getObjectPath() == null - || pInstance.getObjectPath().getNamespace() == null) { throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + if (pInstance == null || pInstance.getObjectPath() == null || pInstance.getObjectPath().getNamespace() == null) { + throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); + } HttpHeader hh = new HttpHeader(); - hh.addField("CIMObject", HttpHeader.encode(pInstance.getObjectPath().getNamespace(), - "UTF-8", "US-ASCII")); + hh.addField("CIMObject", HttpHeader.encode(pInstance.getObjectPath().getNamespace(), "UTF-8", "US-ASCII")); Document doc = this.iXmlHelper.newDocument(); - this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.createInstance_request(doc, - pInstance.getObjectPath(), pInstance)); + this.iXmlHelper.createCIMMessage( + doc, + this.iXmlHelper.createInstance_request(doc, pInstance.getObjectPath(), pInstance) + ); InputStreamReader is = transmitRequest("CreateInstance", hh, doc); CloseableIterator iter = getIterator(is, pInstance.getObjectPath()); try { - if (iter.hasNext()) { return (CIMObjectPath) iter.next(); } + if (iter.hasNext()) { + return (CIMObjectPath) iter.next(); + } } finally { iter.close(); } return null; - } catch (WBEMException e) { logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); throw e; } catch (Exception e) { if (e.getCause() != null && e.getCause() instanceof WBEMException) { - logger - .trace(Level.FINE, operation + " request resulted in CIM Error", e - .getCause()); + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e.getCause()); throw (WBEMException) e.getCause(); } logger.trace(Level.FINE, operation + " request failed", e); @@ -734,7 +748,6 @@ public CIMObjectPath createInstance(CIMInstance pInstance) throws WBEMException } public void deleteClass(CIMObjectPath pPath) throws WBEMException { - final String operation = "DeleteClass"; final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); logger.entry(); @@ -742,8 +755,9 @@ public void deleteClass(CIMObjectPath pPath) throws WBEMException { checkState(); try { - if (pPath == null || pPath.getNamespace() == null || pPath.getObjectName() == null) { throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + if (pPath == null || pPath.getNamespace() == null || pPath.getObjectName() == null) { + throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); + } HttpHeader hh = new HttpHeader(); hh.addField("CIMObject", HttpHeader.encode(pPath.getNamespace(), "UTF-8", "US-ASCII")); @@ -761,15 +775,12 @@ public void deleteClass(CIMObjectPath pPath) throws WBEMException { } return; - } catch (WBEMException e) { logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); throw e; } catch (Exception e) { if (e.getCause() != null && e.getCause() instanceof WBEMException) { - logger - .trace(Level.FINE, operation + " request resulted in CIM Error", e - .getCause()); + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e.getCause()); throw (WBEMException) e.getCause(); } logger.trace(Level.FINE, operation + " request failed", e); @@ -780,7 +791,6 @@ public void deleteClass(CIMObjectPath pPath) throws WBEMException { } public void deleteInstance(CIMObjectPath pPath) throws WBEMException { - final String operation = "DeleteInstance"; final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); logger.entry(); @@ -788,16 +798,16 @@ public void deleteInstance(CIMObjectPath pPath) throws WBEMException { checkState(); try { - if (pPath == null || pPath.getNamespace() == null || pPath.getObjectName() == null) { throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + if (pPath == null || pPath.getNamespace() == null || pPath.getObjectName() == null) { + throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); + } HttpHeader hh = new HttpHeader(); hh.addField("CIMObject", HttpHeader.encode(pPath.getNamespace(), "UTF-8", "US-ASCII")); Document doc = this.iXmlHelper.newDocument(); - this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper - .deleteInstance_request(doc, pPath)); + this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.deleteInstance_request(doc, pPath)); InputStreamReader is = transmitRequest("DeleteInstance", hh, doc); @@ -809,15 +819,12 @@ public void deleteInstance(CIMObjectPath pPath) throws WBEMException { } return; - } catch (WBEMException e) { logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); throw e; } catch (Exception e) { if (e.getCause() != null && e.getCause() instanceof WBEMException) { - logger - .trace(Level.FINE, operation + " request resulted in CIM Error", e - .getCause()); + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e.getCause()); throw (WBEMException) e.getCause(); } logger.trace(Level.FINE, operation + " request failed", e); @@ -828,7 +835,6 @@ public void deleteInstance(CIMObjectPath pPath) throws WBEMException { } public void deleteQualifierType(CIMObjectPath pPath) throws WBEMException { - final String operation = "DeleteQualifierType"; final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); logger.entry(); @@ -836,15 +842,15 @@ public void deleteQualifierType(CIMObjectPath pPath) throws WBEMException { checkState(); try { - if (pPath == null || pPath.getNamespace() == null || pPath.getObjectName() == null) { throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + if (pPath == null || pPath.getNamespace() == null || pPath.getObjectName() == null) { + throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); + } HttpHeader hh = new HttpHeader(); hh.addField("CIMObject", HttpHeader.encode(pPath.getNamespace(), "UTF-8", "US-ASCII")); Document doc = this.iXmlHelper.newDocument(); - this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.deleteQualifierType_request(doc, - pPath)); + this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.deleteQualifierType_request(doc, pPath)); InputStreamReader is = transmitRequest("DeleteQualifierType", hh, doc); @@ -856,15 +862,12 @@ public void deleteQualifierType(CIMObjectPath pPath) throws WBEMException { } return; - } catch (WBEMException e) { logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); throw e; } catch (Exception e) { if (e.getCause() != null && e.getCause() instanceof WBEMException) { - logger - .trace(Level.FINE, operation + " request resulted in CIM Error", e - .getCause()); + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e.getCause()); throw (WBEMException) e.getCause(); } logger.trace(Level.FINE, operation + " request failed", e); @@ -874,9 +877,7 @@ public void deleteQualifierType(CIMObjectPath pPath) throws WBEMException { } } - public CloseableIterator enumerateClassNames(CIMObjectPath pPath, boolean pDeep) - throws WBEMException { - + public CloseableIterator enumerateClassNames(CIMObjectPath pPath, boolean pDeep) throws WBEMException { final String operation = "EnumerateClassNames"; final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); logger.entry(); @@ -884,29 +885,26 @@ public CloseableIterator enumerateClassNames(CIMObjectPath pPath, checkState(); try { - if (pPath == null || pPath.getNamespace() == null) { throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + if (pPath == null || pPath.getNamespace() == null) { + throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); + } HttpHeader hh = new HttpHeader(); hh.addField("CIMObject", HttpHeader.encode(pPath.getNamespace(), "UTF-8", "US-ASCII")); Document doc = this.iXmlHelper.newDocument(); - this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.enumerateClassNames_request(doc, - pPath, pDeep)); + this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.enumerateClassNames_request(doc, pPath, pDeep)); InputStreamReader is = transmitRequest("EnumerateClassNames", hh, doc); CloseableIterator iter = getIterator(is, pPath); return iter; - } catch (WBEMException e) { logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); throw e; } catch (Exception e) { if (e.getCause() != null && e.getCause() instanceof WBEMException) { - logger - .trace(Level.FINE, operation + " request resulted in CIM Error", e - .getCause()); + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e.getCause()); throw (WBEMException) e.getCause(); } logger.trace(Level.FINE, operation + " request failed", e); @@ -916,10 +914,14 @@ public CloseableIterator enumerateClassNames(CIMObjectPath pPath, } } - public CloseableIterator enumerateClasses(CIMObjectPath pPath, boolean pDeep, - boolean pPropagated, boolean pIncludeQualifiers, boolean pIncludeClassOrigin) - throws WBEMException { - + public CloseableIterator enumerateClasses( + CIMObjectPath pPath, + boolean pDeep, + boolean pPropagated, + boolean pIncludeQualifiers, + boolean pIncludeClassOrigin + ) + throws WBEMException { final String operation = "EnumerateClasses"; final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); logger.entry(); @@ -927,29 +929,36 @@ public CloseableIterator enumerateClasses(CIMObjectPath pPath, boolean checkState(); try { - if (pPath == null || pPath.getNamespace() == null) { throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + if (pPath == null || pPath.getNamespace() == null) { + throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); + } HttpHeader hh = new HttpHeader(); hh.addField("CIMObject", HttpHeader.encode(pPath.getNamespace(), "UTF-8", "US-ASCII")); Document doc = this.iXmlHelper.newDocument(); - this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.enumerateClasses_request(doc, - pPath, pDeep, pPropagated, pIncludeQualifiers, pIncludeClassOrigin)); + this.iXmlHelper.createCIMMessage( + doc, + this.iXmlHelper.enumerateClasses_request( + doc, + pPath, + pDeep, + pPropagated, + pIncludeQualifiers, + pIncludeClassOrigin + ) + ); InputStreamReader is = transmitRequest("EnumerateClasses", hh, doc); CloseableIterator iter = getIterator(is, pPath); return iter; - } catch (WBEMException e) { logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); throw e; } catch (Exception e) { if (e.getCause() != null && e.getCause() instanceof WBEMException) { - logger - .trace(Level.FINE, operation + " request resulted in CIM Error", e - .getCause()); + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e.getCause()); throw (WBEMException) e.getCause(); } logger.trace(Level.FINE, operation + " request failed", e); @@ -959,9 +968,7 @@ public CloseableIterator enumerateClasses(CIMObjectPath pPath, boolean } } - public CloseableIterator enumerateInstanceNames(CIMObjectPath pPath) - throws WBEMException { - + public CloseableIterator enumerateInstanceNames(CIMObjectPath pPath) throws WBEMException { final String operation = "EnumerateInstanceNames"; final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); logger.entry(); @@ -969,29 +976,26 @@ public CloseableIterator enumerateInstanceNames(CIMObjectPath pPa checkState(); try { - if (pPath == null || pPath.getNamespace() == null || pPath.getObjectName() == null) { throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + if (pPath == null || pPath.getNamespace() == null || pPath.getObjectName() == null) { + throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); + } HttpHeader hh = new HttpHeader(); hh.addField("CIMObject", HttpHeader.encode(pPath.getNamespace(), "UTF-8", "US-ASCII")); Document doc = this.iXmlHelper.newDocument(); - this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.enumerateInstanceNames_request( - doc, pPath)); + this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.enumerateInstanceNames_request(doc, pPath)); InputStreamReader is = transmitRequest("EnumerateInstanceNames", hh, doc); CloseableIterator iter = getIterator(is, pPath); return iter; - } catch (WBEMException e) { logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); throw e; } catch (Exception e) { if (e.getCause() != null && e.getCause() instanceof WBEMException) { - logger - .trace(Level.FINE, operation + " request resulted in CIM Error", e - .getCause()); + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e.getCause()); throw (WBEMException) e.getCause(); } logger.trace(Level.FINE, operation + " request failed", e); @@ -1001,10 +1005,14 @@ public CloseableIterator enumerateInstanceNames(CIMObjectPath pPa } } - public CloseableIterator enumerateInstances(CIMObjectPath pPath, boolean pDeep, - boolean pPropagated, boolean pIncludeClassOrigin, String[] pPropertyList) - throws WBEMException { - + public CloseableIterator enumerateInstances( + CIMObjectPath pPath, + boolean pDeep, + boolean pPropagated, + boolean pIncludeClassOrigin, + String[] pPropertyList + ) + throws WBEMException { final String operation = "EnumerateInstances"; final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); logger.entry(); @@ -1012,29 +1020,37 @@ public CloseableIterator enumerateInstances(CIMObjectPath pPath, bo checkState(); try { - if (pPath == null || pPath.getNamespace() == null || pPath.getObjectName() == null) { throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + if (pPath == null || pPath.getNamespace() == null || pPath.getObjectName() == null) { + throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); + } HttpHeader hh = new HttpHeader(); hh.addField("CIMObject", HttpHeader.encode(pPath.getNamespace(), "UTF-8", "US-ASCII")); Document doc = this.iXmlHelper.newDocument(); - this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.enumerateInstances_request(doc, - pPath, pDeep, pPropagated, false, pIncludeClassOrigin, pPropertyList)); + this.iXmlHelper.createCIMMessage( + doc, + this.iXmlHelper.enumerateInstances_request( + doc, + pPath, + pDeep, + pPropagated, + false, + pIncludeClassOrigin, + pPropertyList + ) + ); InputStreamReader is = transmitRequest("EnumerateInstances", hh, doc); CloseableIterator iter = getIterator(is, pPath); return iter; - } catch (WBEMException e) { logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); throw e; } catch (Exception e) { if (e.getCause() != null && e.getCause() instanceof WBEMException) { - logger - .trace(Level.FINE, operation + " request resulted in CIM Error", e - .getCause()); + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e.getCause()); throw (WBEMException) e.getCause(); } logger.trace(Level.FINE, operation + " request failed", e); @@ -1048,14 +1064,14 @@ public CloseableIterator enumerateInstances(CIMObjectPath pPath, bo // the name of this Interop Namespace shall be either "interop" (preferred) // or "root/interop" while OpenPegasus 2.11 and earlier implemented // "root/PG_InterOp" prior to adopting DSP1033. - private static final String[] InteropNamespaces = { "interop", "root/interop", - "root/PG_InterOp" }; + private static final String[] InteropNamespaces = { "interop", "root/interop", "root/PG_InterOp" }; private CloseableIterator enumerateNamespace(String pNamespace) { if (pNamespace != null && pNamespace.trim().length() > 0) { try { - CloseableIterator result = enumerateInstanceNames(new CIMObjectPath( - null, null, null, pNamespace, "CIM_Namespace", null)); + CloseableIterator result = enumerateInstanceNames( + new CIMObjectPath(null, null, null, pNamespace, "CIM_Namespace", null) + ); if (result != null) return result; } catch (Exception e) { // namespace may not exist @@ -1064,8 +1080,7 @@ private CloseableIterator enumerateNamespace(String pNamespace) { return null; } - public CloseableIterator enumerateNamespaces(String pNamespace) - throws WBEMException { + public CloseableIterator enumerateNamespaces(String pNamespace) throws WBEMException { CloseableIterator result; // First, try the user's specified namespace (if any) @@ -1090,13 +1105,13 @@ public CloseableIterator enumerateNamespaces(String pNamespace) } } - throw new WBEMException(WBEMException.CIM_ERR_FAILED, - "Interop namespaces do not exist, CIMOM may not support DSP1033"); + throw new WBEMException( + WBEMException.CIM_ERR_FAILED, + "Interop namespaces do not exist, CIMOM may not support DSP1033" + ); } - public CloseableIterator> enumerateQualifierTypes(CIMObjectPath pPath) - throws WBEMException { - + public CloseableIterator> enumerateQualifierTypes(CIMObjectPath pPath) throws WBEMException { final String operation = "EnumerateQualifiers"; final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); logger.entry(); @@ -1106,29 +1121,26 @@ public CloseableIterator> enumerateQualifierTypes(CIMObjectP try { // enumerateQualifierTypes does not need class name, as it lists all // qualifiers in namespace - if (pPath == null || pPath.getNamespace() == null) { throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + if (pPath == null || pPath.getNamespace() == null) { + throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); + } HttpHeader hh = new HttpHeader(); hh.addField("CIMObject", HttpHeader.encode(pPath.getNamespace(), "UTF-8", "US-ASCII")); Document doc = this.iXmlHelper.newDocument(); - this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.enumQualifierTypes_request(doc, - pPath)); + this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.enumQualifierTypes_request(doc, pPath)); InputStreamReader is = transmitRequest("EnumerateQualifiers", hh, doc); CloseableIterator> iter = getIterator(is, pPath); return iter; - } catch (WBEMException e) { logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); throw e; } catch (Exception e) { if (e.getCause() != null && e.getCause() instanceof WBEMException) { - logger - .trace(Level.FINE, operation + " request resulted in CIM Error", e - .getCause()); + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e.getCause()); throw (WBEMException) e.getCause(); } logger.trace(Level.FINE, operation + " request failed", e); @@ -1138,9 +1150,8 @@ public CloseableIterator> enumerateQualifierTypes(CIMObjectP } } - public CloseableIterator execQuery(CIMObjectPath pPath, String pQuery, - String pQueryLanguage) throws WBEMException { - + public CloseableIterator execQuery(CIMObjectPath pPath, String pQuery, String pQueryLanguage) + throws WBEMException { final String operation = "ExecQuery"; final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); logger.entry(); @@ -1148,29 +1159,26 @@ public CloseableIterator execQuery(CIMObjectPath pPath, String pQue checkState(); try { - if (pPath == null || pPath.getNamespace() == null) { throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + if (pPath == null || pPath.getNamespace() == null) { + throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); + } HttpHeader hh = new HttpHeader(); hh.addField("CIMObject", HttpHeader.encode(pPath.getNamespace(), "UTF-8", "US-ASCII")); Document doc = this.iXmlHelper.newDocument(); - this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.execQuery_request(doc, pPath, - pQuery, pQueryLanguage)); + this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.execQuery_request(doc, pPath, pQuery, pQueryLanguage)); InputStreamReader is = transmitRequest("ExecQuery", hh, doc); CloseableIterator iter = getIterator(is, pPath); return iter; - } catch (WBEMException e) { logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); throw e; } catch (Exception e) { if (e.getCause() != null && e.getCause() instanceof WBEMException) { - logger - .trace(Level.FINE, operation + " request resulted in CIM Error", e - .getCause()); + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e.getCause()); throw (WBEMException) e.getCause(); } logger.trace(Level.FINE, operation + " request failed", e); @@ -1180,9 +1188,14 @@ public CloseableIterator execQuery(CIMObjectPath pPath, String pQue } } - public CIMClass getClass(CIMObjectPath pName, boolean pPropagated, boolean pIncludeQualifiers, - boolean pIncludeClassOrigin, String[] pPropertyList) throws WBEMException { - + public CIMClass getClass( + CIMObjectPath pName, + boolean pPropagated, + boolean pIncludeQualifiers, + boolean pIncludeClassOrigin, + String[] pPropertyList + ) + throws WBEMException { final String operation = "GetClass"; final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); logger.entry(); @@ -1190,35 +1203,44 @@ public CIMClass getClass(CIMObjectPath pName, boolean pPropagated, boolean pIncl checkState(); try { - if (pName == null || pName.getNamespace() == null || pName.getObjectName() == null) { throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + if (pName == null || pName.getNamespace() == null || pName.getObjectName() == null) { + throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); + } HttpHeader hh = new HttpHeader(); hh.addField("CIMObject", HttpHeader.encode(pName.getNamespace(), "UTF-8", "US-ASCII")); Document doc = this.iXmlHelper.newDocument(); - this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.getClass_request(doc, pName, - pPropagated, pIncludeQualifiers, pIncludeClassOrigin, pPropertyList)); + this.iXmlHelper.createCIMMessage( + doc, + this.iXmlHelper.getClass_request( + doc, + pName, + pPropagated, + pIncludeQualifiers, + pIncludeClassOrigin, + pPropertyList + ) + ); InputStreamReader is = transmitRequest("GetClass", hh, doc); CloseableIterator iter = getIterator(is, pName); try { - if (iter.hasNext()) { return (CIMClass) iter.next(); } + if (iter.hasNext()) { + return (CIMClass) iter.next(); + } } finally { iter.close(); } return null; - } catch (WBEMException e) { logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); throw e; } catch (Exception e) { if (e.getCause() != null && e.getCause() instanceof WBEMException) { - logger - .trace(Level.FINE, operation + " request resulted in CIM Error", e - .getCause()); + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e.getCause()); throw (WBEMException) e.getCause(); } logger.trace(Level.FINE, operation + " request failed", e); @@ -1228,9 +1250,13 @@ public CIMClass getClass(CIMObjectPath pName, boolean pPropagated, boolean pIncl } } - public CIMInstance getInstance(CIMObjectPath pName, boolean pPropagated, - boolean pIncludeClassOrigin, String[] pPropertyList) throws WBEMException { - + public CIMInstance getInstance( + CIMObjectPath pName, + boolean pPropagated, + boolean pIncludeClassOrigin, + String[] pPropertyList + ) + throws WBEMException { final String operation = "GetInstance"; final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); logger.entry(); @@ -1238,15 +1264,18 @@ public CIMInstance getInstance(CIMObjectPath pName, boolean pPropagated, checkState(); try { - if (pName == null || pName.getNamespace() == null || pName.getObjectName() == null) { throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + if (pName == null || pName.getNamespace() == null || pName.getObjectName() == null) { + throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); + } HttpHeader hh = new HttpHeader(); hh.addField("CIMObject", HttpHeader.encode(pName.getNamespace(), "UTF-8", "US-ASCII")); Document doc = this.iXmlHelper.newDocument(); - this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.getInstance_request(doc, pName, - pPropagated, false, pIncludeClassOrigin, pPropertyList)); + this.iXmlHelper.createCIMMessage( + doc, + this.iXmlHelper.getInstance_request(doc, pName, pPropagated, false, pIncludeClassOrigin, pPropertyList) + ); InputStreamReader is = transmitRequest("GetInstance", hh, doc); @@ -1261,15 +1290,12 @@ public CIMInstance getInstance(CIMObjectPath pName, boolean pPropagated, } return null; - } catch (WBEMException e) { logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); throw e; } catch (Exception e) { if (e.getCause() != null && e.getCause() instanceof WBEMException) { - logger - .trace(Level.FINE, operation + " request resulted in CIM Error", e - .getCause()); + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e.getCause()); throw (WBEMException) e.getCause(); } logger.trace(Level.FINE, operation + " request failed", e); @@ -1280,7 +1306,6 @@ public CIMInstance getInstance(CIMObjectPath pName, boolean pPropagated, } public CIMQualifierType getQualifierType(CIMObjectPath pName) throws WBEMException { - final String operation = "GetQualifier"; final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); logger.entry(); @@ -1288,35 +1313,34 @@ public CIMQualifierType getQualifierType(CIMObjectPath pName) throws WBEMExce checkState(); try { - if (pName == null || pName.getNamespace() == null || pName.getObjectName() == null) { throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + if (pName == null || pName.getNamespace() == null || pName.getObjectName() == null) { + throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); + } HttpHeader hh = new HttpHeader(); hh.addField("CIMObject", HttpHeader.encode(pName.getNamespace(), "UTF-8", "US-ASCII")); Document doc = this.iXmlHelper.newDocument(); - this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.getQualifier_request(doc, pName, - pName.getObjectName())); + this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.getQualifier_request(doc, pName, pName.getObjectName())); InputStreamReader is = transmitRequest("GetQualifier", hh, doc); CloseableIterator iter = getIterator(is, pName); try { - if (iter.hasNext()) { return (CIMQualifierType) iter.next(); } + if (iter.hasNext()) { + return (CIMQualifierType) iter.next(); + } } finally { iter.close(); } return null; - } catch (WBEMException e) { logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); throw e; } catch (Exception e) { if (e.getCause() != null && e.getCause() instanceof WBEMException) { - logger - .trace(Level.FINE, operation + " request resulted in CIM Error", e - .getCause()); + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e.getCause()); throw (WBEMException) e.getCause(); } logger.trace(Level.FINE, operation + " request failed", e); @@ -1326,10 +1350,13 @@ public CIMQualifierType getQualifierType(CIMObjectPath pName) throws WBEMExce } } - public Object invokeMethod(CIMObjectPath pName, String pMethodName, - CIMArgument[] pInputArguments, CIMArgument[] pOutputArguments) - throws WBEMException { - + public Object invokeMethod( + CIMObjectPath pName, + String pMethodName, + CIMArgument[] pInputArguments, + CIMArgument[] pOutputArguments + ) + throws WBEMException { final String operation = "InvokeMethod"; final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); logger.entry(); @@ -1337,28 +1364,33 @@ public Object invokeMethod(CIMObjectPath pName, String pMethodName, checkState(); try { - if (pName == null || pName.getNamespace() == null || pName.getObjectName() == null) { throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + if (pName == null || pName.getNamespace() == null || pName.getObjectName() == null) { + throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); + } HttpHeader hh = new HttpHeader(); - hh.addField("CIMObject", HttpHeader.encode(MOF.objectHandle(pName, false, true), - "UTF-8", "US-ASCII")); + hh.addField("CIMObject", HttpHeader.encode(MOF.objectHandle(pName, false, true), "UTF-8", "US-ASCII")); // sfcb needs pragma set for UpdateExpiredPassword call - if (pMethodName != null && pMethodName.equalsIgnoreCase("UpdateExpiredPassword")) hh - .addField("Pragma", "UpdateExpiredPassword"); + if (pMethodName != null && pMethodName.equalsIgnoreCase("UpdateExpiredPassword")) hh.addField( + "Pragma", + "UpdateExpiredPassword" + ); Document doc = this.iXmlHelper.newDocument(); - this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.invokeMethod_request(doc, pName, - pMethodName, pInputArguments)); + this.iXmlHelper.createCIMMessage( + doc, + this.iXmlHelper.invokeMethod_request(doc, pName, pMethodName, pInputArguments) + ); InputStreamReader is = transmitRequest(pMethodName, hh, doc); CIMResponse response = null; String parser = this.iConfiguration.getCimXmlParser(); // TODO: set the local namespace for parsers - if (WBEMConstants.SAX.equals(parser) || WBEMConstants.PULL.equals(parser)) { return SAXHelper - .parseInvokeMethodResponse(is, pOutputArguments, null); } + if (WBEMConstants.SAX.equals(parser) || WBEMConstants.PULL.equals(parser)) { + return SAXHelper.parseInvokeMethodResponse(is, pOutputArguments, null); + } // DOM parser response = getSingleResponse(is, null); response.checkError(); @@ -1369,12 +1401,11 @@ public Object invokeMethod(CIMObjectPath pName, String pMethodName, List outParamValues = response.getParamValues(); if (pOutputArguments != null && outParamValues != null) { Iterator itr = outParamValues.iterator(); - for (int i = 0; i < pOutputArguments.length; i++) - if (itr.hasNext()) { - pOutputArguments[i] = (CIMArgument) itr.next(); - } else { - break; - } + for (int i = 0; i < pOutputArguments.length; i++) if (itr.hasNext()) { + pOutputArguments[i] = (CIMArgument) itr.next(); + } else { + break; + } } return rc; } catch (WBEMException e) { @@ -1382,9 +1413,7 @@ public Object invokeMethod(CIMObjectPath pName, String pMethodName, throw e; } catch (Exception e) { if (e.getCause() != null && e.getCause() instanceof WBEMException) { - logger - .trace(Level.FINE, operation + " request resulted in CIM Error", e - .getCause()); + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e.getCause()); throw (WBEMException) e.getCause(); } logger.trace(Level.FINE, operation + " request failed", e); @@ -1399,7 +1428,6 @@ public boolean isActive() { } public void modifyClass(CIMClass pClass) throws WBEMException { - final String operation = "ModifyClass"; final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); logger.entry(); @@ -1407,18 +1435,20 @@ public void modifyClass(CIMClass pClass) throws WBEMException { checkState(); try { - if (pClass == null || pClass.getObjectPath() == null - || pClass.getObjectPath().getNamespace() == null - || pClass.getObjectPath().getObjectName() == null) { throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + if ( + pClass == null || + pClass.getObjectPath() == null || + pClass.getObjectPath().getNamespace() == null || + pClass.getObjectPath().getObjectName() == null + ) { + throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); + } HttpHeader hh = new HttpHeader(); - hh.addField("CIMObject", HttpHeader.encode(pClass.getObjectPath().getNamespace(), - "UTF-8", "US-ASCII")); + hh.addField("CIMObject", HttpHeader.encode(pClass.getObjectPath().getNamespace(), "UTF-8", "US-ASCII")); Document doc = this.iXmlHelper.newDocument(); - this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.setClass_request(doc, pClass - .getObjectPath(), pClass)); + this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.setClass_request(doc, pClass.getObjectPath(), pClass)); InputStreamReader is = transmitRequest("ModifyClass", hh, doc); @@ -1430,15 +1460,12 @@ public void modifyClass(CIMClass pClass) throws WBEMException { } return; - } catch (WBEMException e) { logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); throw e; } catch (Exception e) { if (e.getCause() != null && e.getCause() instanceof WBEMException) { - logger - .trace(Level.FINE, operation + " request resulted in CIM Error", e - .getCause()); + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e.getCause()); throw (WBEMException) e.getCause(); } logger.trace(Level.FINE, operation + " request failed", e); @@ -1453,18 +1480,21 @@ public void modifyInstance(CIMInstance pInst, String[] pPropertyList) throws WBE final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); logger.entry(); checkState(); - if (pInst == null || pInst.getObjectPath() == null - || pInst.getObjectPath().getNamespace() == null - || pInst.getObjectPath().getObjectName() == null) { throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + if ( + pInst == null || + pInst.getObjectPath() == null || + pInst.getObjectPath().getNamespace() == null || + pInst.getObjectPath().getObjectName() == null + ) { + throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); + } final CIMObjectPath path = pInst.getObjectPath(); try { HttpHeader hh = new HttpHeader(); hh.addField("CIMObject", HttpHeader.encode(path.getNamespace(), "UTF-8", "US-ASCII")); Document doc = this.iXmlHelper.newDocument(); - this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.setInstance_request(doc, path, - pInst, true, pPropertyList)); + this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.setInstance_request(doc, path, pInst, true, pPropertyList)); InputStreamReader is = transmitRequest(operation, hh, doc); CloseableIterator iter = getIterator(is, path); @@ -1479,9 +1509,7 @@ public void modifyInstance(CIMInstance pInst, String[] pPropertyList) throws WBE throw e; } catch (Exception e) { if (e.getCause() != null && e.getCause() instanceof WBEMException) { - logger - .trace(Level.FINE, operation + " request resulted in CIM Error", e - .getCause()); + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e.getCause()); throw (WBEMException) e.getCause(); } logger.trace(Level.FINE, operation + " request failed", e); @@ -1491,10 +1519,15 @@ public void modifyInstance(CIMInstance pInst, String[] pPropertyList) throws WBE } } - public CloseableIterator referenceClasses(CIMObjectPath pObjectName, - String pResultClass, String pRole, boolean pIncludeQualifiers, - boolean pIncludeClassOrigin, String[] pPropertyList) throws WBEMException { - + public CloseableIterator referenceClasses( + CIMObjectPath pObjectName, + String pResultClass, + String pRole, + boolean pIncludeQualifiers, + boolean pIncludeClassOrigin, + String[] pPropertyList + ) + throws WBEMException { final String operation = "ReferenceClasses"; final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); logger.entry(); @@ -1502,31 +1535,36 @@ public CloseableIterator referenceClasses(CIMObjectPath pObjectName, checkState(); try { - if (pObjectName == null || pObjectName.getNamespace() == null - || pObjectName.getObjectName() == null) { throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + if (pObjectName == null || pObjectName.getNamespace() == null || pObjectName.getObjectName() == null) { + throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); + } HttpHeader hh = new HttpHeader(); - hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", - "US-ASCII")); + hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", "US-ASCII")); Document doc = this.iXmlHelper.newDocument(); - this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.referenceClasses_request(doc, - pObjectName, pResultClass, pRole, pIncludeQualifiers, pIncludeClassOrigin, - pPropertyList)); + this.iXmlHelper.createCIMMessage( + doc, + this.iXmlHelper.referenceClasses_request( + doc, + pObjectName, + pResultClass, + pRole, + pIncludeQualifiers, + pIncludeClassOrigin, + pPropertyList + ) + ); InputStreamReader is = transmitRequest("References", hh, doc); return getIterator(is, pObjectName); - } catch (WBEMException e) { logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); throw e; } catch (Exception e) { if (e.getCause() != null && e.getCause() instanceof WBEMException) { - logger - .trace(Level.FINE, operation + " request resulted in CIM Error", e - .getCause()); + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e.getCause()); throw (WBEMException) e.getCause(); } logger.trace(Level.FINE, operation + " request failed", e); @@ -1536,10 +1574,14 @@ public CloseableIterator referenceClasses(CIMObjectPath pObjectName, } } - public CloseableIterator referenceInstances(CIMObjectPath pObjectName, - String pResultClass, String pRole, boolean pIncludeClassOrigin, String[] pPropertyList) - throws WBEMException { - + public CloseableIterator referenceInstances( + CIMObjectPath pObjectName, + String pResultClass, + String pRole, + boolean pIncludeClassOrigin, + String[] pPropertyList + ) + throws WBEMException { final String operation = "ReferenceInstances"; final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); logger.entry(); @@ -1547,30 +1589,35 @@ public CloseableIterator referenceInstances(CIMObjectPath pObjectNa checkState(); try { - if (pObjectName == null || pObjectName.getNamespace() == null - || pObjectName.getObjectName() == null) { throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + if (pObjectName == null || pObjectName.getNamespace() == null || pObjectName.getObjectName() == null) { + throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); + } HttpHeader hh = new HttpHeader(); - hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", - "US-ASCII")); + hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", "US-ASCII")); Document doc = this.iXmlHelper.newDocument(); - this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.referenceInstances_request(doc, - pObjectName, pResultClass, pRole, pIncludeClassOrigin, pPropertyList)); + this.iXmlHelper.createCIMMessage( + doc, + this.iXmlHelper.referenceInstances_request( + doc, + pObjectName, + pResultClass, + pRole, + pIncludeClassOrigin, + pPropertyList + ) + ); InputStreamReader is = transmitRequest("References", hh, doc); return getIterator(is, pObjectName); - } catch (WBEMException e) { logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); throw e; } catch (Exception e) { if (e.getCause() != null && e.getCause() instanceof WBEMException) { - logger - .trace(Level.FINE, operation + " request resulted in CIM Error", e - .getCause()); + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e.getCause()); throw (WBEMException) e.getCause(); } logger.trace(Level.FINE, operation + " request failed", e); @@ -1580,9 +1627,8 @@ public CloseableIterator referenceInstances(CIMObjectPath pObjectNa } } - public CloseableIterator referenceNames(CIMObjectPath pObjectName, - String pResultClass, String pRole) throws WBEMException { - + public CloseableIterator referenceNames(CIMObjectPath pObjectName, String pResultClass, String pRole) + throws WBEMException { final String operation = "ReferenceNames"; final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); logger.entry(); @@ -1590,31 +1636,29 @@ public CloseableIterator referenceNames(CIMObjectPath pObjectName checkState(); try { - if (pObjectName == null || pObjectName.getNamespace() == null - || pObjectName.getObjectName() == null) { throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + if (pObjectName == null || pObjectName.getNamespace() == null || pObjectName.getObjectName() == null) { + throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); + } HttpHeader hh = new HttpHeader(); - hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", - "US-ASCII")); + hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", "US-ASCII")); Document doc = this.iXmlHelper.newDocument(); - this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.referenceNames_request(doc, - pObjectName, pResultClass, pRole)); + this.iXmlHelper.createCIMMessage( + doc, + this.iXmlHelper.referenceNames_request(doc, pObjectName, pResultClass, pRole) + ); InputStreamReader is = transmitRequest("ReferenceNames", hh, doc); CloseableIterator iter = getIterator(is, pObjectName); return iter; - } catch (WBEMException e) { logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); throw e; } catch (Exception e) { if (e.getCause() != null && e.getCause() instanceof WBEMException) { - logger - .trace(Level.FINE, operation + " request resulted in CIM Error", e - .getCause()); + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e.getCause()); throw (WBEMException) e.getCause(); } logger.trace(Level.FINE, operation + " request failed", e); @@ -1625,12 +1669,10 @@ public CloseableIterator referenceNames(CIMObjectPath pObjectName } public void setLocales(Locale[] pLocales) { - this.iLocales = (pLocales != null && pLocales.length > 0) ? pLocales - : WBEMConstants.DEFAULT_LOCALES; + this.iLocales = (pLocales != null && pLocales.length > 0) ? pLocales : WBEMConstants.DEFAULT_LOCALES; } public void setQualifierType(CIMQualifierType pQualifierType) throws WBEMException { - final String operation = "SetQualifierType"; final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); logger.entry(); @@ -1638,18 +1680,23 @@ public void setQualifierType(CIMQualifierType pQualifierType) throws WBEMExce checkState(); try { - if (pQualifierType == null || pQualifierType.getObjectPath() == null - || pQualifierType.getObjectPath().getNamespace() == null - || pQualifierType.getObjectPath().getObjectName() == null) { throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + if ( + pQualifierType == null || + pQualifierType.getObjectPath() == null || + pQualifierType.getObjectPath().getNamespace() == null || + pQualifierType.getObjectPath().getObjectName() == null + ) { + throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); + } HttpHeader hh = new HttpHeader(); - hh.addField("CIMObject", HttpHeader.encode(pQualifierType.getObjectPath() - .getNamespace(), "UTF-8", "US-ASCII")); + hh.addField("CIMObject", HttpHeader.encode(pQualifierType.getObjectPath().getNamespace(), "UTF-8", "US-ASCII")); Document doc = this.iXmlHelper.newDocument(); - this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.setQualifierType_request(doc, - pQualifierType.getObjectPath(), pQualifierType)); + this.iXmlHelper.createCIMMessage( + doc, + this.iXmlHelper.setQualifierType_request(doc, pQualifierType.getObjectPath(), pQualifierType) + ); InputStreamReader is = transmitRequest("SetQualifierType", hh, doc); @@ -1661,15 +1708,12 @@ public void setQualifierType(CIMQualifierType pQualifierType) throws WBEMExce } return; - } catch (WBEMException e) { logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); throw e; } catch (Exception e) { if (e.getCause() != null && e.getCause() instanceof WBEMException) { - logger - .trace(Level.FINE, operation + " request resulted in CIM Error", e - .getCause()); + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e.getCause()); throw (WBEMException) e.getCause(); } logger.trace(Level.FINE, operation + " request failed", e); @@ -1703,20 +1747,24 @@ private String getHttpErrorString(int pStatusCode) { return null; } - private InputStreamReader transmitRequest(String pCimMethod, HttpHeader pHeader, - Document pDocument) throws IOException, ProtocolException, WBEMException { - return transmitRequestWorker(false, this.iUri, this.iHttpClientPool, pCimMethod, pHeader, - pDocument); + private InputStreamReader transmitRequest(String pCimMethod, HttpHeader pHeader, Document pDocument) + throws IOException, ProtocolException, WBEMException { + return transmitRequestWorker(false, this.iUri, this.iHttpClientPool, pCimMethod, pHeader, pDocument); } /* * Worker for both transmitRequest() (pIsIndication == false) and * transmitIndicationRequest() (pIsIndication == true). */ - private InputStreamReader transmitRequestWorker(boolean pIsIndication, URI pRecipient, - HttpClientPool pClientPool, String pCimMethod, HttpHeader pHeader, Document pDocument) - throws IOException, ProtocolException, WBEMException { - + private InputStreamReader transmitRequestWorker( + boolean pIsIndication, + URI pRecipient, + HttpClientPool pClientPool, + String pCimMethod, + HttpHeader pHeader, + Document pDocument + ) + throws IOException, ProtocolException, WBEMException { final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); logger.entry(); @@ -1728,8 +1776,7 @@ private InputStreamReader transmitRequestWorker(boolean pIsIndication, URI pReci this.iCurrentTime = System.currentTimeMillis(); if ((this.iCurrentTime - this.iMPostFailTime) > 24 * 60 * 60 * 1000) this.iMPostFailed = false; } - boolean useMPost = this.iMPostFailed || pIsIndication ? false : this.iConfiguration - .isHttpMPost(); + boolean useMPost = this.iMPostFailed || pIsIndication ? false : this.iConfiguration.isHttpMPost(); int retries = this.iConfiguration.getHttpConnectRetriesCount(); do { logger.trace(Level.FINE, "Attempting to connect.. number of attempts left:" + retries); @@ -1738,8 +1785,7 @@ private InputStreamReader transmitRequestWorker(boolean pIsIndication, URI pReci if (connection != null) { connection.disconnect(); } - connection = newConnection(pIsIndication, pRecipient, pClientPool, pCimMethod, pHeader, - useMPost); + connection = newConnection(pIsIndication, pRecipient, pClientPool, pCimMethod, pHeader, useMPost); try { logger.trace(Level.FINE, "Connecting..."); connection.connect(); @@ -1748,22 +1794,26 @@ private InputStreamReader transmitRequestWorker(boolean pIsIndication, URI pReci } catch (SocketException e) { throw new WBEMException(WBEMException.CIM_ERR_FAILED, "Unable to connect", null, e); } catch (SSLHandshakeException e) { - throw new WBEMException(WBEMException.CIM_ERR_FAILED, "SSL handshake exception", - null, e); + throw new WBEMException(WBEMException.CIM_ERR_FAILED, "SSL handshake exception", null, e); } OutputStream os = connection.getOutputStream(); - if (this.iConfiguration.isCimXmlTracingEnabled() - || LogAndTraceBroker.getBroker().isLoggableCIMXMLTrace(Level.FINEST)) { + if ( + this.iConfiguration.isCimXmlTracingEnabled() || + LogAndTraceBroker.getBroker().isLoggableCIMXMLTrace(Level.FINEST) + ) { OutputStream pos = new ByteArrayOutputStream(); - CIMClientXML_HelperImpl.dumpDocument(pos, pDocument, - pIsIndication ? "indication request" : "request"); + CIMClientXML_HelperImpl.dumpDocument(pos, pDocument, pIsIndication ? "indication request" : "request"); OutputStream debugStream = LogAndTraceBroker.getBroker().getXmlTraceStream(); - if (this.iConfiguration.isCimXmlTracingEnabled() && debugStream != null) debugStream - .write(pos.toString().getBytes()); - if (LogAndTraceBroker.getBroker().isLoggableCIMXMLTrace(Level.FINEST)) logger - .traceCIMXML(Level.FINEST, pos.toString(), true); + if (this.iConfiguration.isCimXmlTracingEnabled() && debugStream != null) debugStream.write( + pos.toString().getBytes() + ); + if (LogAndTraceBroker.getBroker().isLoggableCIMXMLTrace(Level.FINEST)) logger.traceCIMXML( + Level.FINEST, + pos.toString(), + true + ); } CIMClientXML_HelperImpl.serialize(os, pDocument); os.flush(); @@ -1777,12 +1827,10 @@ private InputStreamReader transmitRequestWorker(boolean pIsIndication, URI pReci throw new WBEMException(WBEMException.CIM_ERR_FAILED, "Unable to connect", null, e); } catch (SocketTimeoutException e) { connection.disconnect(); - throw new WBEMException(WBEMException.CIM_ERR_FAILED, "Connection timed out", null, - e); + throw new WBEMException(WBEMException.CIM_ERR_FAILED, "Connection timed out", null, e); } catch (SSLHandshakeException e) { connection.disconnect(); - throw new WBEMException(WBEMException.CIM_ERR_FAILED, "SSL handshake exception", - null, e); + throw new WBEMException(WBEMException.CIM_ERR_FAILED, "SSL handshake exception", null, e); } HttpHeader headers = parseHeaders(connection); @@ -1795,7 +1843,6 @@ private InputStreamReader transmitRequestWorker(boolean pIsIndication, URI pReci switch (resultCode) { case HttpURLConnection.HTTP_OK: // 200 - if (this.iConfiguration.isHttpContentLengthRetryEnabled()) { String contentLengthField = headers.getField("Content-length"); if (contentLengthField != null && contentLengthField.trim().length() > 0) { @@ -1803,8 +1850,7 @@ private InputStreamReader transmitRequestWorker(boolean pIsIndication, URI pReci int lengthToCheck = this.iConfiguration.getHttpContentLengthThreshold(); if (contentLength < lengthToCheck) { - logger.trace(Level.FINE, "Content Length below " + lengthToCheck - + ", retrying"); + logger.trace(Level.FINE, "Content Length below " + lengthToCheck + ", retrying"); break; } } @@ -1814,14 +1860,14 @@ private InputStreamReader transmitRequestWorker(boolean pIsIndication, URI pReci InputStream is = connection.getInputStream(); OutputStream debugStream = LogAndTraceBroker.getBroker().getXmlTraceStream(); - if ((this.iConfiguration.isCimXmlTracingEnabled() && debugStream != null) - || LogAndTraceBroker.getBroker().isLoggableCIMXMLTrace(Level.FINEST)) { - is = new DebugInputStream(is, debugStream, - pIsIndication ? "indication response" : "response"); + if ( + (this.iConfiguration.isCimXmlTracingEnabled() && debugStream != null) || + LogAndTraceBroker.getBroker().isLoggableCIMXMLTrace(Level.FINEST) + ) { + is = new DebugInputStream(is, debugStream, pIsIndication ? "indication response" : "response"); } return new InputStreamReader(is, charset); - case HttpURLConnection.HTTP_NOT_IMPLEMENTED: // 501 // TODO if there is an error with the default xml // encoder/decoder, load the correct version @@ -1829,11 +1875,8 @@ private InputStreamReader transmitRequestWorker(boolean pIsIndication, URI pReci // version, CIM version or Protocol Version // that is expecting String cimProtocolVersion = headers.getField("CIMProtocolVersion"); - if (cimProtocolVersion == null && headers.getField("CIMError") == null - && useMPost) { - logger - .trace(Level.FINER, - "Received HTTP Error 501 - NOT IMPLEMENTED with M-POST, falling back to POST"); + if (cimProtocolVersion == null && headers.getField("CIMError") == null && useMPost) { + logger.trace(Level.FINER, "Received HTTP Error 501 - NOT IMPLEMENTED with M-POST, falling back to POST"); this.iMPostFailTime = System.currentTimeMillis(); useMPost = false; this.iMPostFailed = true; @@ -1841,38 +1884,30 @@ private InputStreamReader transmitRequestWorker(boolean pIsIndication, URI pReci break; } - logger.trace(Level.FINER, - "Received HTTP Error 501 - NOT IMPLEMENTED, skipping retries"); + logger.trace(Level.FINER, "Received HTTP Error 501 - NOT IMPLEMENTED, skipping retries"); retries = 0; break; - case HttpURLConnection.HTTP_BAD_REQUEST: // 400 case HttpURLConnection.HTTP_FORBIDDEN: // 403 case HttpURLConnection.HTTP_BAD_METHOD: // 405 - logger.trace(Level.FINER, "Received HTTP Error " - + getHttpErrorString(resultCode) + ", skipping retries"); + logger.trace(Level.FINER, "Received HTTP Error " + getHttpErrorString(resultCode) + ", skipping retries"); retries = 0; break; - case HttpURLConnection.HTTP_UNAUTHORIZED: // 401 case HttpURLConnection.HTTP_PROXY_AUTH: // 407 - logger.trace(Level.FINER, "Received HTTP Error " - + getHttpErrorString(resultCode) + ", skipping retries"); + logger.trace(Level.FINER, "Received HTTP Error " + getHttpErrorString(resultCode) + ", skipping retries"); exceptionNum = WBEMException.CIM_ERR_ACCESS_DENIED; retries = 0; break; - default: if (useMPost) { - logger.trace(Level.FINER, "Received HTTP Error " + resultCode - + " with M-POST, falling back to POST"); + logger.trace(Level.FINER, "Received HTTP Error " + resultCode + " with M-POST, falling back to POST"); this.iMPostFailTime = System.currentTimeMillis(); useMPost = false; this.iMPostFailed = true; ++retries; } else { - logger.trace(Level.FINER, "Received HTTP Error " + resultCode - + ", retrying"); + logger.trace(Level.FINER, "Received HTTP Error " + resultCode + ", retrying"); } } @@ -1882,8 +1917,10 @@ private InputStreamReader transmitRequestWorker(boolean pIsIndication, URI pReci // sending multiple requests without any response) if (retries > 0) { OutputStream debugStream = LogAndTraceBroker.getBroker().getXmlTraceStream(); - if ((this.iConfiguration.isCimXmlTracingEnabled() && debugStream != null) - || LogAndTraceBroker.getBroker().isLoggableCIMXMLTrace(Level.FINEST)) { + if ( + (this.iConfiguration.isCimXmlTracingEnabled() && debugStream != null) || + LogAndTraceBroker.getBroker().isLoggableCIMXMLTrace(Level.FINEST) + ) { StringBuilder resultStr = new StringBuilder("<--- error response begin "); resultStr.append(TimeStamp.formatWithMillis(System.currentTimeMillis())); resultStr.append(" ----\nHTTP "); @@ -1891,10 +1928,14 @@ private InputStreamReader transmitRequestWorker(boolean pIsIndication, URI pReci resultStr.append(' '); resultStr.append(connection.getResponseMessage()); resultStr.append(" (retrying request)\n---- error response end ----->\n"); - if (this.iConfiguration.isCimXmlTracingEnabled() && debugStream != null) debugStream - .write(resultStr.toString().getBytes()); - if (LogAndTraceBroker.getBroker().isLoggableCIMXMLTrace(Level.FINEST)) logger - .traceCIMXML(Level.FINEST, resultStr.toString(), false); + if (this.iConfiguration.isCimXmlTracingEnabled() && debugStream != null) debugStream.write( + resultStr.toString().getBytes() + ); + if (LogAndTraceBroker.getBroker().isLoggableCIMXMLTrace(Level.FINEST)) logger.traceCIMXML( + Level.FINEST, + resultStr.toString(), + false + ); } } } while (retries-- > 0); @@ -1914,8 +1955,7 @@ private InputStreamReader transmitRequestWorker(boolean pIsIndication, URI pReci } catch (Exception e) { errorDescriptionCIM = null; } - logger.trace(Level.FINER, "Found CIMErrorDescription field with value \"" - + errorDescriptionCIM + "\""); + logger.trace(Level.FINER, "Found CIMErrorDescription field with value \"" + errorDescriptionCIM + "\""); } } @@ -1940,8 +1980,7 @@ private InputStreamReader transmitRequestWorker(boolean pIsIndication, URI pReci } catch (Exception e) { errorSFCB = null; } - logger.trace(Level.FINER, "Found SFCBErrorDetail field with value \"" + errorSFCB - + "\""); + logger.trace(Level.FINER, "Found SFCBErrorDetail field with value \"" + errorSFCB + "\""); } // If CIMErrorDescription present, format of WBEMException is: @@ -1953,7 +1992,7 @@ private InputStreamReader transmitRequestWorker(boolean pIsIndication, URI pReci // // HTTP StatusCode - ReasonPhrase (CIMError: "ErrorString", OpenPegasus // Error: "ErrorString", SFCB Error: "ErrorString") - // + // // For example: // HTTP 503 - Service Unavailable (SFCB Error: // "Max Session Limit Exceeded") @@ -1994,22 +2033,26 @@ private InputStreamReader transmitRequestWorker(boolean pIsIndication, URI pReci throw new WBEMException(exceptionNum, errorMsg.toString()); } - private HttpUrlConnection newConnection(boolean pIsIndication, URI pRecipient, - HttpClientPool pClientPool, String pCimMethod, HttpHeader pHeader, boolean pUseMPost) { - + private HttpUrlConnection newConnection( + boolean pIsIndication, + URI pRecipient, + HttpClientPool pClientPool, + String pCimMethod, + HttpHeader pHeader, + boolean pUseMPost + ) { final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); logger.entry(); - HttpUrlConnection connection = new HttpUrlConnection(pRecipient, pClientPool, - this.iAuthorizationHandler); + HttpUrlConnection connection = new HttpUrlConnection(pRecipient, pClientPool, this.iAuthorizationHandler); if (pUseMPost) { connection.setRequestMethod(WBEMConstants.HTTP_MPOST); } else connection.setRequestMethod(WBEMConstants.HTTP_POST); connection.useHttp11("1.1".equals(this.iConfiguration.getHttpVersion())); String firstLocaleStr = this.iLocales[0].getLanguage(); - if (this.iLocales[0].getCountry().length() > 0) firstLocaleStr = firstLocaleStr + '-' - + this.iLocales[0].getCountry(); + if (this.iLocales[0].getCountry().length() > 0) firstLocaleStr = + firstLocaleStr + '-' + this.iLocales[0].getCountry(); StringBuilder restLocaleStrBld = new StringBuilder(""); for (int i = 1; i < this.iLocales.length; i++) { if (this.iLocales[i] != null && this.iLocales[i].getLanguage().length() > 0) { @@ -2028,26 +2071,21 @@ private HttpUrlConnection newConnection(boolean pIsIndication, URI pRecipient, connection.setRequestProperty("Accept", "text/html, text/xml, application/xml"); connection.setRequestProperty("Cache-Control", "no-cache"); connection.setRequestProperty("Content-Language", firstLocaleStr); - connection.setRequestProperty("Accept-Language", firstLocaleStr - + restLocaleStrBld.toString() + ", *"); - if (this.iAuthorization != null) connection.setRequestProperty("Authorization", - this.iAuthorization); + connection.setRequestProperty("Accept-Language", firstLocaleStr + restLocaleStrBld.toString() + ", *"); + if (this.iAuthorization != null) connection.setRequestProperty("Authorization", this.iAuthorization); String prefix = ""; if (connection.getRequestMethod().equalsIgnoreCase(WBEMConstants.HTTP_MPOST)) { String ns = getNextNs(); - connection.setRequestProperty("Man", "http://www.dmtf.org/cim/mapping/http/v1.0;ns=" - + ns); + connection.setRequestProperty("Man", "http://www.dmtf.org/cim/mapping/http/v1.0;ns=" + ns); prefix = ns + "-"; } connection.setRequestProperty(prefix + "CIMProtocolVersion", "1.0"); if (pIsIndication) { try { - connection.setRequestProperty("CIMExport", HttpHeader.encode("MethodRequest", - "UTF-8", "US-ASCII")); - connection.setRequestProperty("CIMExportMethod", HttpHeader.encode( - "ExportIndication", "UTF-8", "US-ASCII")); + connection.setRequestProperty("CIMExport", HttpHeader.encode("MethodRequest", "UTF-8", "US-ASCII")); + connection.setRequestProperty("CIMExportMethod", HttpHeader.encode("ExportIndication", "UTF-8", "US-ASCII")); } catch (UnsupportedEncodingException e) { logger.trace(Level.FINE, "Exception while encoding http header", e); connection.setRequestProperty("CIMExport", "MethodRequest"); @@ -2056,8 +2094,7 @@ private HttpUrlConnection newConnection(boolean pIsIndication, URI pRecipient, } else { connection.setRequestProperty(prefix + "CIMOperation", "MethodCall"); try { - connection.setRequestProperty(prefix + "CIMMethod", HttpHeader.encode(pCimMethod, - "UTF-8", "US-ASCII")); + connection.setRequestProperty(prefix + "CIMMethod", HttpHeader.encode(pCimMethod, "UTF-8", "US-ASCII")); } catch (UnsupportedEncodingException e) { logger.trace(Level.FINE, "Exception while encoding http header", e); connection.setRequestProperty(prefix + "CIMMethod", pCimMethod); @@ -2066,8 +2103,7 @@ private HttpUrlConnection newConnection(boolean pIsIndication, URI pRecipient, Iterator> iter = pHeader.iterator(); while (iter.hasNext()) { Entry entry = iter.next(); - connection.setRequestProperty(prefix + entry.getKey().toString(), entry.getValue() - .toString()); + connection.setRequestProperty(prefix + entry.getKey().toString(), entry.getValue().toString()); } logger.exit(); @@ -2087,17 +2123,19 @@ private HttpHeader parseHeaders(URLConnection pConnection) { String ns = null; HttpHeaderParser manOptHeader = null; - if (man != null && man.length() > 0) manOptHeader = new HttpHeaderParser(man); - else if (opt != null && opt.length() > 0) manOptHeader = new HttpHeaderParser(opt); + if (man != null && man.length() > 0) manOptHeader = new HttpHeaderParser(man); else if ( + opt != null && opt.length() > 0 + ) manOptHeader = new HttpHeaderParser(opt); if (manOptHeader != null) ns = manOptHeader.getValue("ns"); if (ns != null) { i = 0; String key; while ((key = pConnection.getHeaderFieldKey(++i)) != null) { - if (key.startsWith(ns + "-")) headers.addParsedField(key.substring(3), pConnection - .getHeaderField(i)); - else headers.addParsedField(key, pConnection.getHeaderField(i)); + if (key.startsWith(ns + "-")) headers.addParsedField( + key.substring(3), + pConnection.getHeaderField(i) + ); else headers.addParsedField(key, pConnection.getHeaderField(i)); } } else { i = 0; @@ -2122,7 +2160,7 @@ private String getCharacterSet(HttpHeader pHeader) { /** * getIterator : get generic CloseableIterator - * + * * @param * : Type Parameter * @param pStream @@ -2139,8 +2177,7 @@ private String getCharacterSet(HttpHeader pHeader) { // :TODO : try to find solution of "unchecked" warning @SuppressWarnings("unchecked") private CloseableIterator getIterator(InputStreamReader pStream, CIMObjectPath pPath) - throws IOException, SAXException, ParserConfigurationException, WBEMException { - + throws IOException, SAXException, ParserConfigurationException, WBEMException { String parser = this.iConfiguration.getCimXmlParser(); CloseableIterator iter = null; @@ -2152,8 +2189,7 @@ private CloseableIterator getIterator(InputStreamReader pStream, CIMObjec } else if (WBEMConstants.DOM.equals(parser)) { iter = new CloseableIteratorDOM(pStream, pPath); } else { - throw new IllegalArgumentException("Invalid CIM-XML parser configured (\"" + parser - + "\") "); + throw new IllegalArgumentException("Invalid CIM-XML parser configured (\"" + parser + "\") "); } try { // check for CIMExceptions @@ -2161,31 +2197,26 @@ private CloseableIterator getIterator(InputStreamReader pStream, CIMObjec return (CloseableIterator) iter; } catch (RuntimeException e) { iter.close(); - if (e.getCause() != null && e.getCause() instanceof WBEMException) { throw (WBEMException) e - .getCause(); } + if (e.getCause() != null && e.getCause() instanceof WBEMException) { + throw (WBEMException) e.getCause(); + } throw e; } } - private EnumerateResponse getEnumerateResponse(InputStreamReader pStream, - CIMObjectPath pPath) throws IOException, SAXException, ParserConfigurationException, - WBEMException { - + private EnumerateResponse getEnumerateResponse(InputStreamReader pStream, CIMObjectPath pPath) + throws IOException, SAXException, ParserConfigurationException, WBEMException { String parser = this.iConfiguration.getCimXmlParser(); if (WBEMConstants.SAX.equals(parser)) return new EnumerateResponseSAX(pStream, pPath) - .getEnumResponse(); - else if (WBEMConstants.PULL.equals(parser)) return new EnumerateResponsePULL(pStream, - pPath).getEnumResponse(); - else if (WBEMConstants.DOM.equals(parser)) return new EnumerateResponseDOM(pStream, - pPath).getEnumResponse(); + .getEnumResponse(); else if (WBEMConstants.PULL.equals(parser)) return new EnumerateResponsePULL(pStream, pPath) + .getEnumResponse(); else if (WBEMConstants.DOM.equals(parser)) return new EnumerateResponseDOM(pStream, pPath) + .getEnumResponse(); - throw new IllegalArgumentException("Invalid CIM-XML parser configured (\"" + parser - + "\") "); + throw new IllegalArgumentException("Invalid CIM-XML parser configured (\"" + parser + "\") "); } - private CIMResponse getSingleResponse(InputStreamReader pStream, CIMObjectPath pLocalPath) - throws WBEMException { + private CIMResponse getSingleResponse(InputStreamReader pStream, CIMObjectPath pLocalPath) throws WBEMException { final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); Document dom; @@ -2237,11 +2268,19 @@ private synchronized void checkState() throws IllegalStateException { throw new IllegalStateException("WBEMClient is " + state); } - public EnumerateResponse associatorPaths(CIMObjectPath pObjectName, - String pAssociationClass, String pResultClass, String pRole, String pResultRole, - String pFilterQueryLanguage, String pFilterQuery, UnsignedInteger32 pTimeout, - boolean pContinueOnError, UnsignedInteger32 pMaxObjects) throws WBEMException { - + public EnumerateResponse associatorPaths( + CIMObjectPath pObjectName, + String pAssociationClass, + String pResultClass, + String pRole, + String pResultRole, + String pFilterQueryLanguage, + String pFilterQuery, + UnsignedInteger32 pTimeout, + boolean pContinueOnError, + UnsignedInteger32 pMaxObjects + ) + throws WBEMException { final String operation = "OpenAssociatorInstancePaths"; final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); logger.entry(); @@ -2249,34 +2288,42 @@ public EnumerateResponse associatorPaths(CIMObjectPath pObjectNam checkState(); try { - if (pObjectName == null || pObjectName.getNamespace() == null - || pObjectName.getObjectName() == null) { throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + if (pObjectName == null || pObjectName.getNamespace() == null || pObjectName.getObjectName() == null) { + throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); + } HttpHeader hh = new HttpHeader(); - hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", - "US-ASCII")); + hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", "US-ASCII")); Document doc = this.iXmlHelper.newDocument(); - this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper - .OpenAssociatorInstancePaths_request(doc, pObjectName, pAssociationClass, - pResultClass, pRole, pResultRole, pFilterQueryLanguage, pFilterQuery, - pTimeout, pContinueOnError, pMaxObjects)); + this.iXmlHelper.createCIMMessage( + doc, + this.iXmlHelper.OpenAssociatorInstancePaths_request( + doc, + pObjectName, + pAssociationClass, + pResultClass, + pRole, + pResultRole, + pFilterQueryLanguage, + pFilterQuery, + pTimeout, + pContinueOnError, + pMaxObjects + ) + ); InputStreamReader is = transmitRequest(operation, hh, doc); EnumerateResponse enumResp = getEnumerateResponse(is, pObjectName); return enumResp; - } catch (WBEMException e) { logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); throw e; } catch (Exception e) { if (e.getCause() != null && e.getCause() instanceof WBEMException) { - logger - .trace(Level.FINE, operation + " request resulted in CIM Error", e - .getCause()); + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e.getCause()); throw (WBEMException) e.getCause(); } logger.trace(Level.FINE, operation + " request failed", e); @@ -2286,12 +2333,21 @@ public EnumerateResponse associatorPaths(CIMObjectPath pObjectNam } } - public EnumerateResponse associators(CIMObjectPath pObjectName, - String pAssocClass, String pResultClass, String pRole, String pResultRole, - boolean pIncludeClassOrigin, String[] pPropertyList, String pFilterQueryLanguage, - String pFilterQuery, UnsignedInteger32 pTimeout, boolean pContinueOnError, - UnsignedInteger32 pMaxObjects) throws WBEMException { - + public EnumerateResponse associators( + CIMObjectPath pObjectName, + String pAssocClass, + String pResultClass, + String pRole, + String pResultRole, + boolean pIncludeClassOrigin, + String[] pPropertyList, + String pFilterQueryLanguage, + String pFilterQuery, + UnsignedInteger32 pTimeout, + boolean pContinueOnError, + UnsignedInteger32 pMaxObjects + ) + throws WBEMException { final String operation = "OpenAssociatorInstances"; final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); logger.entry(); @@ -2299,34 +2355,44 @@ public EnumerateResponse associators(CIMObjectPath pObjectName, checkState(); try { - if (pObjectName == null || pObjectName.getNamespace() == null - || pObjectName.getObjectName() == null) { throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + if (pObjectName == null || pObjectName.getNamespace() == null || pObjectName.getObjectName() == null) { + throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); + } HttpHeader hh = new HttpHeader(); - hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", - "US-ASCII")); + hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", "US-ASCII")); Document doc = this.iXmlHelper.newDocument(); - this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.OpenAssociatorInstances_request( - doc, pObjectName, pAssocClass, pResultClass, pRole, pResultRole, - pIncludeClassOrigin, pPropertyList, pFilterQueryLanguage, pFilterQuery, - pTimeout, pContinueOnError, pMaxObjects)); + this.iXmlHelper.createCIMMessage( + doc, + this.iXmlHelper.OpenAssociatorInstances_request( + doc, + pObjectName, + pAssocClass, + pResultClass, + pRole, + pResultRole, + pIncludeClassOrigin, + pPropertyList, + pFilterQueryLanguage, + pFilterQuery, + pTimeout, + pContinueOnError, + pMaxObjects + ) + ); InputStreamReader is = transmitRequest(operation, hh, doc); EnumerateResponse enumResp = getEnumerateResponse(is, pObjectName); return enumResp; - } catch (WBEMException e) { logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); throw e; } catch (Exception e) { if (e.getCause() != null && e.getCause() instanceof WBEMException) { - logger - .trace(Level.FINE, operation + " request resulted in CIM Error", e - .getCause()); + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e.getCause()); throw (WBEMException) e.getCause(); } logger.trace(Level.FINE, operation + " request failed", e); @@ -2336,9 +2402,7 @@ public EnumerateResponse associators(CIMObjectPath pObjectName, } } - public void closeEnumeration(CIMObjectPath pObjectName, String pEnumerationContext) - throws WBEMException { - + public void closeEnumeration(CIMObjectPath pObjectName, String pEnumerationContext) throws WBEMException { final String operation = "CloseEnumeration"; final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); logger.entry(); @@ -2346,18 +2410,19 @@ public void closeEnumeration(CIMObjectPath pObjectName, String pEnumerationConte checkState(); try { - if (pObjectName == null || pObjectName.getNamespace() == null - || pObjectName.getObjectName() == null) { throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + if (pObjectName == null || pObjectName.getNamespace() == null || pObjectName.getObjectName() == null) { + throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); + } HttpHeader hh = new HttpHeader(); - hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", - "US-ASCII")); + hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", "US-ASCII")); Document doc = this.iXmlHelper.newDocument(); - this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.CloseEnumeration_request(doc, - pObjectName, pEnumerationContext)); + this.iXmlHelper.createCIMMessage( + doc, + this.iXmlHelper.CloseEnumeration_request(doc, pObjectName, pEnumerationContext) + ); InputStreamReader is = transmitRequest(operation, hh, doc); @@ -2374,9 +2439,7 @@ public void closeEnumeration(CIMObjectPath pObjectName, String pEnumerationConte throw e; } catch (Exception e) { if (e.getCause() != null && e.getCause() instanceof WBEMException) { - logger - .trace(Level.FINE, operation + " request resulted in CIM Error", e - .getCause()); + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e.getCause()); throw (WBEMException) e.getCause(); } logger.trace(Level.FINE, operation + " request failed", e); @@ -2384,13 +2447,17 @@ public void closeEnumeration(CIMObjectPath pObjectName, String pEnumerationConte } finally { logger.exit(); } - } - public EnumerateResponse enumerateInstancePaths(CIMObjectPath pObjectName, - String pFilterQueryLanguage, String pFilterQuery, UnsignedInteger32 pTimeout, - boolean pContinueOnError, UnsignedInteger32 pMaxObjects) throws WBEMException { - + public EnumerateResponse enumerateInstancePaths( + CIMObjectPath pObjectName, + String pFilterQueryLanguage, + String pFilterQuery, + UnsignedInteger32 pTimeout, + boolean pContinueOnError, + UnsignedInteger32 pMaxObjects + ) + throws WBEMException { final String operation = "OpenEnumerateInstancePaths"; final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); logger.entry(); @@ -2398,33 +2465,38 @@ public EnumerateResponse enumerateInstancePaths(CIMObjectPath pOb checkState(); try { - if (pObjectName == null || pObjectName.getNamespace() == null - || pObjectName.getObjectName() == null) { throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + if (pObjectName == null || pObjectName.getNamespace() == null || pObjectName.getObjectName() == null) { + throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); + } HttpHeader hh = new HttpHeader(); - hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", - "US-ASCII")); + hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", "US-ASCII")); Document doc = this.iXmlHelper.newDocument(); - this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper - .OpenEnumerateInstancePaths_request(doc, pObjectName, pFilterQueryLanguage, - pFilterQuery, pTimeout, pContinueOnError, pMaxObjects)); + this.iXmlHelper.createCIMMessage( + doc, + this.iXmlHelper.OpenEnumerateInstancePaths_request( + doc, + pObjectName, + pFilterQueryLanguage, + pFilterQuery, + pTimeout, + pContinueOnError, + pMaxObjects + ) + ); InputStreamReader is = transmitRequest(operation, hh, doc); EnumerateResponse enumResp = getEnumerateResponse(is, pObjectName); return enumResp; - } catch (WBEMException e) { logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); throw e; } catch (Exception e) { if (e.getCause() != null && e.getCause() instanceof WBEMException) { - logger - .trace(Level.FINE, operation + " request resulted in CIM Error", e - .getCause()); + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e.getCause()); throw (WBEMException) e.getCause(); } logger.trace(Level.FINE, operation + " request failed", e); @@ -2434,11 +2506,18 @@ public EnumerateResponse enumerateInstancePaths(CIMObjectPath pOb } } - public EnumerateResponse enumerateInstances(CIMObjectPath pObjectName, - boolean pDeepInheritance, boolean pIncludeClassOrigin, String[] pPropertyList, - String pFilterQueryLanguage, String pFilterQuery, UnsignedInteger32 pTimeout, - boolean pContinueOnError, UnsignedInteger32 pMaxObjects) throws WBEMException { - + public EnumerateResponse enumerateInstances( + CIMObjectPath pObjectName, + boolean pDeepInheritance, + boolean pIncludeClassOrigin, + String[] pPropertyList, + String pFilterQueryLanguage, + String pFilterQuery, + UnsignedInteger32 pTimeout, + boolean pContinueOnError, + UnsignedInteger32 pMaxObjects + ) + throws WBEMException { final String operation = "OpenEnumerateInstances"; final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); logger.entry(); @@ -2446,32 +2525,40 @@ public EnumerateResponse enumerateInstances(CIMObjectPath pObjectNa checkState(); try { - if (pObjectName == null || pObjectName.getNamespace() == null - || pObjectName.getObjectName() == null) { throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + if (pObjectName == null || pObjectName.getNamespace() == null || pObjectName.getObjectName() == null) { + throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); + } HttpHeader hh = new HttpHeader(); - hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", - "US-ASCII")); + hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", "US-ASCII")); Document doc = this.iXmlHelper.newDocument(); - this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.OpenEnumerateInstances_request( - doc, pObjectName, pDeepInheritance, pIncludeClassOrigin, pPropertyList, - pFilterQueryLanguage, pFilterQuery, pTimeout, pContinueOnError, pMaxObjects)); + this.iXmlHelper.createCIMMessage( + doc, + this.iXmlHelper.OpenEnumerateInstances_request( + doc, + pObjectName, + pDeepInheritance, + pIncludeClassOrigin, + pPropertyList, + pFilterQueryLanguage, + pFilterQuery, + pTimeout, + pContinueOnError, + pMaxObjects + ) + ); InputStreamReader is = transmitRequest(operation, hh, doc); EnumerateResponse enumResp = getEnumerateResponse(is, pObjectName); return enumResp; - } catch (WBEMException e) { logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); throw e; } catch (Exception e) { if (e.getCause() != null && e.getCause() instanceof WBEMException) { - logger - .trace(Level.FINE, operation + " request resulted in CIM Error", e - .getCause()); + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e.getCause()); throw (WBEMException) e.getCause(); } logger.trace(Level.FINE, operation + " request failed", e); @@ -2483,7 +2570,7 @@ public EnumerateResponse enumerateInstances(CIMObjectPath pObjectNa // not supported yet public UnsignedInteger64 enumerationCount(CIMObjectPath pObjectName, String pEnumerationContext) - throws WBEMException { + throws WBEMException { final String operation = "EnumerationCount"; final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); logger.entry(); @@ -2491,18 +2578,19 @@ public UnsignedInteger64 enumerationCount(CIMObjectPath pObjectName, String pEnu checkState(); try { - if (pObjectName == null || pObjectName.getNamespace() == null - || pObjectName.getObjectName() == null) { throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + if (pObjectName == null || pObjectName.getNamespace() == null || pObjectName.getObjectName() == null) { + throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); + } HttpHeader hh = new HttpHeader(); - hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", - "US-ASCII")); + hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", "US-ASCII")); Document doc = this.iXmlHelper.newDocument(); - this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.EnumerationCount_request(doc, - pObjectName, pEnumerationContext)); + this.iXmlHelper.createCIMMessage( + doc, + this.iXmlHelper.EnumerationCount_request(doc, pObjectName, pEnumerationContext) + ); InputStreamReader is = transmitRequest(operation, hh, doc); // Currently this is not supported by server. Server returns @@ -2517,15 +2605,12 @@ public UnsignedInteger64 enumerationCount(CIMObjectPath pObjectName, String pEnu // this exception will be thrown only if server starts to support // enumerationCount throw new WBEMException(operation + " is currently not supported by client"); - } catch (WBEMException e) { logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); throw e; } catch (Exception e) { if (e.getCause() != null && e.getCause() instanceof WBEMException) { - logger - .trace(Level.FINE, operation + " request resulted in CIM Error", e - .getCause()); + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e.getCause()); throw (WBEMException) e.getCause(); } logger.trace(Level.FINE, operation + " request failed", e); @@ -2535,11 +2620,17 @@ public UnsignedInteger64 enumerationCount(CIMObjectPath pObjectName, String pEnu } } - public EnumerateResponse execQueryInstances(CIMObjectPath pObjectName, - String pFilterQuery, String pFilterQueryLanguage, boolean pReturnQueryResultClass, - UnsignedInteger32 pTimeout, boolean pContinueOnError, UnsignedInteger32 pMaxObjects, - CIMClass pQueryResultClass) throws WBEMException { - + public EnumerateResponse execQueryInstances( + CIMObjectPath pObjectName, + String pFilterQuery, + String pFilterQueryLanguage, + boolean pReturnQueryResultClass, + UnsignedInteger32 pTimeout, + boolean pContinueOnError, + UnsignedInteger32 pMaxObjects, + CIMClass pQueryResultClass + ) + throws WBEMException { final String operation = "OpenQueryInstances"; final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); logger.entry(); @@ -2547,32 +2638,39 @@ public EnumerateResponse execQueryInstances(CIMObjectPath pObjectNa checkState(); try { - if (pObjectName == null || pObjectName.getNamespace() == null - || pObjectName.getObjectName() == null) { throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + if (pObjectName == null || pObjectName.getNamespace() == null || pObjectName.getObjectName() == null) { + throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); + } HttpHeader hh = new HttpHeader(); - hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", - "US-ASCII")); + hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", "US-ASCII")); Document doc = this.iXmlHelper.newDocument(); - this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.OpenQueryInstances_request(doc, - pObjectName, pFilterQuery, pFilterQueryLanguage, pReturnQueryResultClass, - pTimeout, pContinueOnError, pMaxObjects, pQueryResultClass)); + this.iXmlHelper.createCIMMessage( + doc, + this.iXmlHelper.OpenQueryInstances_request( + doc, + pObjectName, + pFilterQuery, + pFilterQueryLanguage, + pReturnQueryResultClass, + pTimeout, + pContinueOnError, + pMaxObjects, + pQueryResultClass + ) + ); InputStreamReader is = transmitRequest(operation, hh, doc); EnumerateResponse enumResp = getEnumerateResponse(is, pObjectName); return enumResp; - } catch (WBEMException e) { logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); throw e; } catch (Exception e) { if (e.getCause() != null && e.getCause() instanceof WBEMException) { - logger - .trace(Level.FINE, operation + " request resulted in CIM Error", e - .getCause()); + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e.getCause()); throw (WBEMException) e.getCause(); } logger.trace(Level.FINE, operation + " request failed", e); @@ -2582,9 +2680,12 @@ public EnumerateResponse execQueryInstances(CIMObjectPath pObjectNa } } - public EnumerateResponse getInstancePaths(CIMObjectPath pObjectName, - String pContext, UnsignedInteger32 pMaxObjects) throws WBEMException { - + public EnumerateResponse getInstancePaths( + CIMObjectPath pObjectName, + String pContext, + UnsignedInteger32 pMaxObjects + ) + throws WBEMException { final String operation = "PullInstancePaths"; final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); logger.entry(); @@ -2592,31 +2693,29 @@ public EnumerateResponse getInstancePaths(CIMObjectPath pObjectNa checkState(); try { - if (pObjectName == null || pObjectName.getNamespace() == null - || pObjectName.getObjectName() == null) { throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + if (pObjectName == null || pObjectName.getNamespace() == null || pObjectName.getObjectName() == null) { + throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); + } HttpHeader hh = new HttpHeader(); - hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", - "US-ASCII")); + hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", "US-ASCII")); Document doc = this.iXmlHelper.newDocument(); - this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.PullInstancePaths_request(doc, - pObjectName, pContext, pMaxObjects)); + this.iXmlHelper.createCIMMessage( + doc, + this.iXmlHelper.PullInstancePaths_request(doc, pObjectName, pContext, pMaxObjects) + ); InputStreamReader is = transmitRequest(operation, hh, doc); EnumerateResponse enumResp = getEnumerateResponse(is, pObjectName); return enumResp; - } catch (WBEMException e) { logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); throw e; } catch (Exception e) { if (e.getCause() != null && e.getCause() instanceof WBEMException) { - logger - .trace(Level.FINE, operation + " request resulted in CIM Error", e - .getCause()); + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e.getCause()); throw (WBEMException) e.getCause(); } logger.trace(Level.FINE, operation + " request failed", e); @@ -2626,9 +2725,12 @@ public EnumerateResponse getInstancePaths(CIMObjectPath pObjectNa } } - public EnumerateResponse getInstances(CIMObjectPath pObjectName, String pContext, - UnsignedInteger32 pMaxObjects) throws WBEMException { - + public EnumerateResponse getInstances( + CIMObjectPath pObjectName, + String pContext, + UnsignedInteger32 pMaxObjects + ) + throws WBEMException { final String operation = "PullInstances"; final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); logger.entry(); @@ -2636,31 +2738,29 @@ public EnumerateResponse getInstances(CIMObjectPath pObjectName, St checkState(); try { - if (pObjectName == null || pObjectName.getNamespace() == null - || pObjectName.getObjectName() == null) { throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + if (pObjectName == null || pObjectName.getNamespace() == null || pObjectName.getObjectName() == null) { + throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); + } HttpHeader hh = new HttpHeader(); - hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", - "US-ASCII")); + hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", "US-ASCII")); Document doc = this.iXmlHelper.newDocument(); - this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.PullInstances_request(doc, - pObjectName, pContext, pMaxObjects)); + this.iXmlHelper.createCIMMessage( + doc, + this.iXmlHelper.PullInstances_request(doc, pObjectName, pContext, pMaxObjects) + ); InputStreamReader is = transmitRequest(operation, hh, doc); EnumerateResponse enumResp = getEnumerateResponse(is, pObjectName); return enumResp; - } catch (WBEMException e) { logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); throw e; } catch (Exception e) { if (e.getCause() != null && e.getCause() instanceof WBEMException) { - logger - .trace(Level.FINE, operation + " request resulted in CIM Error", e - .getCause()); + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e.getCause()); throw (WBEMException) e.getCause(); } logger.trace(Level.FINE, operation + " request failed", e); @@ -2670,9 +2770,12 @@ public EnumerateResponse getInstances(CIMObjectPath pObjectName, St } } - public EnumerateResponse getInstancesWithPath(CIMObjectPath pObjectName, - String pContext, UnsignedInteger32 pMaxObjects) throws WBEMException { - + public EnumerateResponse getInstancesWithPath( + CIMObjectPath pObjectName, + String pContext, + UnsignedInteger32 pMaxObjects + ) + throws WBEMException { final String operation = "PullInstancesWithPath"; final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); logger.entry(); @@ -2680,31 +2783,29 @@ public EnumerateResponse getInstancesWithPath(CIMObjectPath pObject checkState(); try { - if (pObjectName == null || pObjectName.getNamespace() == null - || pObjectName.getObjectName() == null) { throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + if (pObjectName == null || pObjectName.getNamespace() == null || pObjectName.getObjectName() == null) { + throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); + } HttpHeader hh = new HttpHeader(); - hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", - "US-ASCII")); + hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", "US-ASCII")); Document doc = this.iXmlHelper.newDocument(); - this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.PullInstancesWithPath_request( - doc, pObjectName, pContext, pMaxObjects)); + this.iXmlHelper.createCIMMessage( + doc, + this.iXmlHelper.PullInstancesWithPath_request(doc, pObjectName, pContext, pMaxObjects) + ); InputStreamReader is = transmitRequest(operation, hh, doc); EnumerateResponse enumResp = getEnumerateResponse(is, pObjectName); return enumResp; - } catch (WBEMException e) { logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); throw e; } catch (Exception e) { if (e.getCause() != null && e.getCause() instanceof WBEMException) { - logger - .trace(Level.FINE, operation + " request resulted in CIM Error", e - .getCause()); + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e.getCause()); throw (WBEMException) e.getCause(); } logger.trace(Level.FINE, operation + " request failed", e); @@ -2714,11 +2815,17 @@ public EnumerateResponse getInstancesWithPath(CIMObjectPath pObject } } - public EnumerateResponse referencePaths(CIMObjectPath pObjectName, - String pResultClass, String pRole, String pFilterQueryLanguage, String pFilterQuery, - UnsignedInteger32 pTimeout, boolean pContinueOnError, UnsignedInteger32 pMaxObjects) - throws WBEMException { - + public EnumerateResponse referencePaths( + CIMObjectPath pObjectName, + String pResultClass, + String pRole, + String pFilterQueryLanguage, + String pFilterQuery, + UnsignedInteger32 pTimeout, + boolean pContinueOnError, + UnsignedInteger32 pMaxObjects + ) + throws WBEMException { final String operation = "OpenReferenceInstancePaths"; final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); logger.entry(); @@ -2726,33 +2833,39 @@ public EnumerateResponse referencePaths(CIMObjectPath pObjectName checkState(); try { - if (pObjectName == null || pObjectName.getNamespace() == null - || pObjectName.getObjectName() == null) { throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + if (pObjectName == null || pObjectName.getNamespace() == null || pObjectName.getObjectName() == null) { + throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); + } HttpHeader hh = new HttpHeader(); - hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", - "US-ASCII")); + hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", "US-ASCII")); Document doc = this.iXmlHelper.newDocument(); - this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper - .OpenReferenceInstancePaths_request(doc, pObjectName, pResultClass, pRole, - pFilterQueryLanguage, pFilterQuery, pTimeout, pContinueOnError, - pMaxObjects)); + this.iXmlHelper.createCIMMessage( + doc, + this.iXmlHelper.OpenReferenceInstancePaths_request( + doc, + pObjectName, + pResultClass, + pRole, + pFilterQueryLanguage, + pFilterQuery, + pTimeout, + pContinueOnError, + pMaxObjects + ) + ); InputStreamReader is = transmitRequest(operation, hh, doc); EnumerateResponse enumResp = getEnumerateResponse(is, pObjectName); return enumResp; - } catch (WBEMException e) { logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); throw e; } catch (Exception e) { if (e.getCause() != null && e.getCause() instanceof WBEMException) { - logger - .trace(Level.FINE, operation + " request resulted in CIM Error", e - .getCause()); + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e.getCause()); throw (WBEMException) e.getCause(); } logger.trace(Level.FINE, operation + " request failed", e); @@ -2762,11 +2875,19 @@ public EnumerateResponse referencePaths(CIMObjectPath pObjectName } } - public EnumerateResponse references(CIMObjectPath pObjectName, - String pResultClass, String pRole, boolean pIncludeClassOrigin, String[] pPropertyList, - String pFilterQueryLanguage, String pFilterQuery, UnsignedInteger32 pTimeout, - boolean pContinueOnError, UnsignedInteger32 pMaxObjects) throws WBEMException { - + public EnumerateResponse references( + CIMObjectPath pObjectName, + String pResultClass, + String pRole, + boolean pIncludeClassOrigin, + String[] pPropertyList, + String pFilterQueryLanguage, + String pFilterQuery, + UnsignedInteger32 pTimeout, + boolean pContinueOnError, + UnsignedInteger32 pMaxObjects + ) + throws WBEMException { final String operation = "OpenReferenceInstances"; final LogAndTraceBroker logger = LogAndTraceBroker.getBroker(); logger.entry(); @@ -2774,33 +2895,41 @@ public EnumerateResponse references(CIMObjectPath pObjectName, checkState(); try { - - if (pObjectName == null || pObjectName.getNamespace() == null - || pObjectName.getObjectName() == null) { throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); } + if (pObjectName == null || pObjectName.getNamespace() == null || pObjectName.getObjectName() == null) { + throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid object path"); + } HttpHeader hh = new HttpHeader(); - hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", - "US-ASCII")); + hh.addField("CIMObject", HttpHeader.encode(pObjectName.getNamespace(), "UTF-8", "US-ASCII")); Document doc = this.iXmlHelper.newDocument(); - this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.OpenReferenceInstances_request( - doc, pObjectName, pResultClass, pRole, pIncludeClassOrigin, pPropertyList, - pFilterQueryLanguage, pFilterQuery, pTimeout, pContinueOnError, pMaxObjects)); + this.iXmlHelper.createCIMMessage( + doc, + this.iXmlHelper.OpenReferenceInstances_request( + doc, + pObjectName, + pResultClass, + pRole, + pIncludeClassOrigin, + pPropertyList, + pFilterQueryLanguage, + pFilterQuery, + pTimeout, + pContinueOnError, + pMaxObjects + ) + ); InputStreamReader is = transmitRequest(operation, hh, doc); EnumerateResponse enumResp = getEnumerateResponse(is, pObjectName); return enumResp; - } catch (WBEMException e) { logger.trace(Level.FINE, operation + " request resulted in CIM Error", e); throw e; } catch (Exception e) { if (e.getCause() != null && e.getCause() instanceof WBEMException) { - logger - .trace(Level.FINE, operation + " request resulted in CIM Error", e - .getCause()); + logger.trace(Level.FINE, operation + " request resulted in CIM Error", e.getCause()); throw (WBEMException) e.getCause(); } logger.trace(Level.FINE, operation + " request failed", e); @@ -2810,9 +2939,13 @@ public EnumerateResponse references(CIMObjectPath pObjectName, } } - private InputStreamReader transmitIndicationRequest(URI pRecipient, HttpClientPool pClientPool, - HttpHeader pHeader, Document pDocument) throws IOException, ProtocolException, - WBEMException { + private InputStreamReader transmitIndicationRequest( + URI pRecipient, + HttpClientPool pClientPool, + HttpHeader pHeader, + Document pDocument + ) + throws IOException, ProtocolException, WBEMException { return transmitRequestWorker(true, pRecipient, pClientPool, null, pHeader, pDocument); } @@ -2823,28 +2956,40 @@ public boolean sendIndication(URI pRecipient, CIMInstance pIndication) throws WB checkState(); try { - if (pRecipient == null || pRecipient.getScheme() == null - || pRecipient.getHost() == null || pRecipient.getPort() <= 0) { throw new WBEMException( + if ( + pRecipient == null || + pRecipient.getScheme() == null || + pRecipient.getHost() == null || + pRecipient.getPort() <= 0 + ) { + throw new WBEMException( WBEMException.CIM_ERR_INVALID_PARAMETER, - "Invalid recipient URI, must contain valid scheme://host:port"); } + "Invalid recipient URI, must contain valid scheme://host:port" + ); + } - if (!pRecipient.getScheme().equalsIgnoreCase(WBEMConstants.HTTP) - && !pRecipient.getScheme().equalsIgnoreCase(WBEMConstants.HTTPS)) throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid scheme " - + pRecipient.getScheme() + ", must be http or https"); + if ( + !pRecipient.getScheme().equalsIgnoreCase(WBEMConstants.HTTP) && + !pRecipient.getScheme().equalsIgnoreCase(WBEMConstants.HTTPS) + ) throw new WBEMException( + WBEMException.CIM_ERR_INVALID_PARAMETER, + "Invalid scheme " + pRecipient.getScheme() + ", must be http or https" + ); - if (pIndication == null) { throw new WBEMException( - WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid indication, must not be null"); } + if (pIndication == null) { + throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "Invalid indication, must not be null"); + } - logger.trace(Level.FINER, "Attempting to send following indication to " - + pRecipient.toString() + ":\n" + pIndication.toString()); + logger.trace( + Level.FINER, + "Attempting to send following indication to " + pRecipient.toString() + ":\n" + pIndication.toString() + ); HttpHeader hh = new HttpHeader(); Document doc = this.iXmlHelper.newDocument(); - this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.sendIndication_request(doc, - pIndication)); + this.iXmlHelper.createCIMMessage(doc, this.iXmlHelper.sendIndication_request(doc, pIndication)); HttpClientPool indPool = new HttpClientPool(this.iConfiguration); diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/indications/CIMEvent.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/indications/CIMEvent.java index 4b3845a..dd4f17a 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/indications/CIMEvent.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/indications/CIMEvent.java @@ -48,15 +48,13 @@ */ import java.net.InetAddress; - import org.metricshub.wbem.javax.cim.CIMInstance; /** * Class CIMEvent is required for indication handling. - * + * */ public class CIMEvent { - protected CIMInstance iIndication; protected String iID; @@ -65,7 +63,7 @@ public class CIMEvent { /** * Ctor. - * + * * @param pIndication */ public CIMEvent(CIMInstance pIndication) { @@ -74,7 +72,7 @@ public CIMEvent(CIMInstance pIndication) { /** * Ctor. - * + * * @param pIndication * @param id */ @@ -86,7 +84,7 @@ public CIMEvent(CIMInstance pIndication, String id) { /** * Constructor that takes the CIMInstance of the indication, the id as well * as the InetAddress of the remote machine. - * + * * @param pIndication * The indication instance * @param pId @@ -104,7 +102,7 @@ public CIMEvent(CIMInstance pIndication, String pId, InetAddress pInetAddress) { * This method returns the InetAddress of the machine that hosts the CIM * Agent that sent the indication. Be aware the remote machine could have * multiple network adapters - thus the result can be ambiguous. - * + * * @return The InetAddress of the remote machine */ public InetAddress getInetAddress() { @@ -113,7 +111,7 @@ public InetAddress getInetAddress() { /** * getIndication - * + * * @return CIMInstance */ public CIMInstance getIndication() { @@ -122,7 +120,7 @@ public CIMInstance getIndication() { /** * getID - * + * * @return String */ public String getID() { diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/indications/CIMEventDispatcher.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/indications/CIMEventDispatcher.java index c6ff246..0f14f63 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/indications/CIMEventDispatcher.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/indications/CIMEventDispatcher.java @@ -51,17 +51,15 @@ import java.util.EventListener; import java.util.LinkedList; import java.util.logging.Level; - import org.metricshub.wbem.javax.wbem.listener.IndicationListener; import org.metricshub.wbem.sblim.cimclient.IndicationListenerSBLIM; import org.metricshub.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; /** * Class CIMEventDispatcher is required for indication handling. - * + * */ public class CIMEventDispatcher extends Thread { - protected LinkedList iEventQueue = new LinkedList(); protected EventListener iListener = null; @@ -76,7 +74,7 @@ public class CIMEventDispatcher extends Thread { * Construct a CIMEventDispatcher object which distributes CIMEvents to the * appropriate CIMListener. The EventListener must be an instance of * IndicationListener or IndicationListenerSBLIM. - * + * * @param pListener * The CIMListener (IndicationListener or * IndicationListenerSBLIM) which receives the CIMEvents to be @@ -90,7 +88,7 @@ public CIMEventDispatcher(EventListener pListener) { * Construct a CIMEventDispatcher object which distributes CIMEvents to the * appropriate CIMListener. The EventListener must be an instance of * IndicationListener or IndicationListenerSBLIM. - * + * * @param pListener * The CIMListener (IndicationListener or * IndicationListenerSBLIM) which receives the CIMEvents to be @@ -99,9 +97,9 @@ public CIMEventDispatcher(EventListener pListener) { * The maximum number of CIMEvents waiting to be dispatched. */ public CIMEventDispatcher(EventListener pListener, int pMaxEvents) { - if (!(pListener instanceof IndicationListener) - && !(pListener instanceof IndicationListenerSBLIM)) throw new IllegalArgumentException( - "Listener must be instance of IndicationListener or IndicationListenerSBLIM"); + if ( + !(pListener instanceof IndicationListener) && !(pListener instanceof IndicationListenerSBLIM) + ) throw new IllegalArgumentException("Listener must be instance of IndicationListener or IndicationListenerSBLIM"); this.iListener = pListener; this.iMaxEvents = pMaxEvents; setDaemon(true); @@ -111,27 +109,33 @@ public CIMEventDispatcher(EventListener pListener, int pMaxEvents) { /** * Propagates the CIMEvent to the event consumers. - * + * * @param pEvent * The CIMEvent to be dispatched. */ public synchronized void dispatchEvent(CIMEvent pEvent) { - if (pEvent != null) { if (this.iMaxEvents > 0) { int size = this.iEventQueue.size(); if (size >= this.iMaxEvents) { for (int i = size - this.iMaxEvents + 1; i > 0; i--) { CIMEvent event = this.iEventQueue.remove(0); - this.iLogger.trace(Level.FINE, "Deleted CIMEvent (id=" + event.getID() - + ") from the queue (maximum size of " + this.iMaxEvents - + " reached)"); + this.iLogger.trace( + Level.FINE, + "Deleted CIMEvent (id=" + + event.getID() + + ") from the queue (maximum size of " + + this.iMaxEvents + + " reached)" + ); } } } this.iEventQueue.add(pEvent); - this.iLogger.trace(Level.FINE, "Added CIMEvent (id=" + pEvent.getID() - + ") to the queue (" + this.iEventQueue.size() + " elements total)"); + this.iLogger.trace( + Level.FINE, + "Added CIMEvent (id=" + pEvent.getID() + ") to the queue (" + this.iEventQueue.size() + " elements total)" + ); notify(); } else { this.iLogger.trace(Level.WARNING, "CIMEvent to dispatch was null"); @@ -140,7 +144,7 @@ public synchronized void dispatchEvent(CIMEvent pEvent) { /** * Starts the dispatching engine of the CIMEventDispatcher. - * + * */ public synchronized void startup() { this.iAlive = true; @@ -167,12 +171,16 @@ private synchronized CIMEvent getEvent() { while (event == null) { try { if (this.iEventQueue.size() == 0) wait(); - } catch (InterruptedException e) { /**/} + } catch (InterruptedException e) { + /**/ + } if (!this.iAlive) break; if (this.iEventQueue.size() > 0) { event = this.iEventQueue.remove(0); - this.iLogger.trace(Level.FINER, "Removed CIMEvent (id=" + event.getID() - + ") from the queue (" + this.iEventQueue.size() + " elements left)"); + this.iLogger.trace( + Level.FINER, + "Removed CIMEvent (id=" + event.getID() + ") from the queue (" + this.iEventQueue.size() + " elements left)" + ); } } return event; @@ -184,18 +192,22 @@ public void run() { try { CIMEvent event = getEvent(); if (event != null) { - this.iLogger.trace(Level.FINER, "Processing CIMEvent (id=" + event.getID() - + ")"); + this.iLogger.trace(Level.FINER, "Processing CIMEvent (id=" + event.getID() + ")"); try { - if (this.iListener instanceof IndicationListener) ((IndicationListener) this.iListener) - .indicationOccured(event.getID(), event.getIndication()); - else // if instanceof IndicationListenerSBLIM) - ((IndicationListenerSBLIM) this.iListener).indicationOccured(event.getID(), - event.getIndication(), event.getInetAddress()); + if (this.iListener instanceof IndicationListener) ((IndicationListener) this.iListener).indicationOccured( + event.getID(), + event.getIndication() + ); else ((IndicationListenerSBLIM) this.iListener).indicationOccured( // if instanceof IndicationListenerSBLIM) + event.getID(), + event.getIndication(), + event.getInetAddress() + ); } catch (Throwable t) { - this.iLogger.trace(Level.FINE, "Exception caught in listener (" - + this.iListener.getClass().getName() - + ") while processing CIMEvent", t); + this.iLogger.trace( + Level.FINE, + "Exception caught in listener (" + this.iListener.getClass().getName() + ") while processing CIMEvent", + t + ); } } } catch (Throwable t) { diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/indications/CIMIndicationHandler.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/indications/CIMIndicationHandler.java index f8a507f..d22c534 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/indications/CIMIndicationHandler.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/indications/CIMIndicationHandler.java @@ -79,35 +79,32 @@ import java.util.Iterator; import java.util.LinkedList; import java.util.Map; +import java.util.Map.Entry; import java.util.Set; import java.util.Vector; -import java.util.Map.Entry; import java.util.logging.Level; - +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.ParserConfigurationException; import org.metricshub.wbem.javax.cim.CIMDataType; import org.metricshub.wbem.javax.cim.CIMInstance; +import org.metricshub.wbem.javax.cim.CIMProperty; import org.metricshub.wbem.javax.wbem.WBEMException; import org.metricshub.wbem.sblim.cimclient.internal.cimxml.CIMClientXML_HelperImpl; import org.metricshub.wbem.sblim.cimclient.internal.cimxml.CIMRequest; import org.metricshub.wbem.sblim.cimclient.internal.cimxml.CIMXMLBuilderImpl; import org.metricshub.wbem.sblim.cimclient.internal.cimxml.CIMXMLParserImpl; +import org.metricshub.wbem.sblim.cimclient.internal.http.HttpContentHandler; +import org.metricshub.wbem.sblim.cimclient.internal.http.HttpException; import org.metricshub.wbem.sblim.cimclient.internal.http.HttpHeader; +import org.metricshub.wbem.sblim.cimclient.internal.http.HttpHeader.HeaderEntry; import org.metricshub.wbem.sblim.cimclient.internal.http.HttpHeaderParser; import org.metricshub.wbem.sblim.cimclient.internal.http.MessageReader; import org.metricshub.wbem.sblim.cimclient.internal.http.MessageWriter; -import org.metricshub.wbem.sblim.cimclient.internal.http.HttpHeader.HeaderEntry; import org.metricshub.wbem.sblim.cimclient.internal.http.io.DebugInputStream; import org.metricshub.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; import org.metricshub.wbem.sblim.cimclient.internal.util.WBEMConfiguration; import org.metricshub.wbem.sblim.cimclient.internal.util.WBEMConfigurationDefaults; import org.metricshub.wbem.sblim.cimclient.internal.wbem.CIMError; -import org.metricshub.wbem.javax.cim.CIMProperty; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.ParserConfigurationException; - -import org.metricshub.wbem.sblim.cimclient.internal.http.HttpContentHandler; -import org.metricshub.wbem.sblim.cimclient.internal.http.HttpException; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.xml.sax.InputSource; @@ -123,7 +120,6 @@ public class CIMIndicationHandler extends HttpContentHandler { * reliable indication queue and cache. */ private class DataManager extends Thread { - private boolean iAlive = true; private LinkedList iLinkedList; @@ -165,8 +161,7 @@ public void run() { Map.Entry entry; Iterator> iterator; - Set> set = this.iHashTable - .entrySet(); + Set> set = this.iHashTable.entrySet(); if (set != null) { iterator = set.iterator(); while (iterator.hasNext()) { @@ -200,7 +195,7 @@ public void stopRun() { * serverIP/destinationURL pair along with its own * ReliableIndicationHandler. This is done to handle multiple * contexts from the same server. - * + * * NOTE: Multiple contexts from the same server will not be handled * correctly if the user creates multiple * CIM_ListenerDestination instances with the same @@ -212,13 +207,12 @@ public void stopRun() { * DSP1054 1.2. */ private class IndicationServer { - private boolean iRIInitialized = false; private ReliableIndicationHandler iRIHandler; public IndicationServer() { - // initialize() does the work + // initialize() does the work } public void initialize(ReliableIndicationHandler pRIHandler) { @@ -242,7 +236,6 @@ public ReliableIndicationHandler getRIHandler() { * looking for the corresponding server IP and destination URL. */ private class ServerListEntry { - private InetAddress iInetAddress; private String iDestinationUrl; @@ -275,7 +268,6 @@ public IndicationServer getIndicationServer() { * and destination URL. */ private class ServerTableEntry { - private InetAddress iInetAddress; private String iDestinationUrl; @@ -297,8 +289,10 @@ public String getDestinationUrl() { public boolean equals(Object pObj) { if (!(pObj instanceof ServerTableEntry)) return false; ServerTableEntry that = (ServerTableEntry) pObj; - if (this.iInetAddress.equals(that.getInetAddress()) - && this.iDestinationUrl.equalsIgnoreCase(that.getDestinationUrl())) return true; + if ( + this.iInetAddress.equals(that.getInetAddress()) && + this.iDestinationUrl.equalsIgnoreCase(that.getDestinationUrl()) + ) return true; return false; } @@ -334,7 +328,7 @@ public int hashCode() { /** * Ctor. - * + * * @param pDispatcher */ public CIMIndicationHandler(CIMEventDispatcher pDispatcher) { @@ -343,37 +337,35 @@ public CIMIndicationHandler(CIMEventDispatcher pDispatcher) { /** * Ctor. - * + * * @param pDispatcher * @param pProperties */ public CIMIndicationHandler(CIMEventDispatcher pDispatcher, WBEMConfiguration pProperties) { this.iDispatcher = pDispatcher; - this.iSessionProperties = (pProperties != null) ? pProperties : WBEMConfiguration - .getGlobalConfiguration(); + this.iSessionProperties = (pProperties != null) ? pProperties : WBEMConfiguration.getGlobalConfiguration(); this.iReliableIndicationsDisabled = !this.iSessionProperties.isReliableIndicationEnabled(); // Initialize reliable indication support if (!this.iReliableIndicationsDisabled) { - this.iHashtableCapacity = this.iSessionProperties - .getReliableIndicationHashtableCapacity(); + this.iHashtableCapacity = this.iSessionProperties.getReliableIndicationHashtableCapacity(); // Validate ReliableIndicationHashtableCapacity property if (this.iHashtableCapacity < 0 || this.iHashtableCapacity > 25000) { - this.iLogger.trace(Level.FINE, "ReliableIndicationHashtableCapacity of " - + this.iHashtableCapacity + " outside range, using default value"); + this.iLogger.trace( + Level.FINE, + "ReliableIndicationHashtableCapacity of " + this.iHashtableCapacity + " outside range, using default value" + ); - this.iHashtableCapacity = Integer.valueOf( - WBEMConfigurationDefaults.LISTENER_RELIABLE_INDICATION_HASHTABLE_CAPACITY) - .intValue(); + this.iHashtableCapacity = + Integer.valueOf(WBEMConfigurationDefaults.LISTENER_RELIABLE_INDICATION_HASHTABLE_CAPACITY).intValue(); } if (this.iHashtableCapacity == 0) { this.iServerList = new LinkedList(); this.iDataManagerThread = new DataManager(this.iServerList); } else { - this.iServerTable = new Hashtable( - this.iHashtableCapacity); + this.iServerTable = new Hashtable(this.iHashtableCapacity); this.iDataManagerThread = new DataManager(this.iServerTable); } @@ -410,8 +402,7 @@ public CIMIndicationHandler(CIMEventDispatcher pDispatcher, WBEMConfiguration pP this.iIndicationTraceProperties = a.toArray(new String[0]); if (this.iLogger.isLoggableTrace(Level.INFO)) { - StringBuilder msg = new StringBuilder( - "Indication trace enabled: class filter="); + StringBuilder msg = new StringBuilder("Indication trace enabled: class filter="); if (this.iIndicationTraceClass != null) { msg.append("\""); @@ -461,7 +452,7 @@ public void close() { /** * getMsgID - * + * * @return int */ public synchronized int getMsgID() { @@ -470,9 +461,7 @@ public synchronized int getMsgID() { return this.iMessageId; } - private static HttpHeader processHeader(HttpHeader pHeader, MessageWriter pWriter) - throws HttpException { - + private static HttpHeader processHeader(HttpHeader pHeader, MessageWriter pWriter) throws HttpException { HttpHeader header = processHttpExtensions(pHeader); String cimExport = header.getField("CIMExport"); String cimOperation = header.getField("CIMOperation"); @@ -481,8 +470,11 @@ private static HttpHeader processHeader(HttpHeader pHeader, MessageWriter pWrite pWriter.getHeader().addField("CIMError", "unsupported-operation"); throw new HttpException(400, "Bad Request"); } - if (cimExport != null && !"METHODREQUEST".equalsIgnoreCase(cimExport) - && !"EXPORTMETHODCALL".equalsIgnoreCase(cimExport)) { + if ( + cimExport != null && + !"METHODREQUEST".equalsIgnoreCase(cimExport) && + !"EXPORTMETHODCALL".equalsIgnoreCase(cimExport) + ) { pWriter.getHeader().addField("CIMError", "unsupported-operation"); throw new HttpException(400, "Bad Request"); } @@ -497,16 +489,19 @@ private static HttpHeader processHeader(HttpHeader pHeader, MessageWriter pWrite } @Override - public void handleContent(MessageReader pReader, MessageWriter pWriter, - InetAddress pInetAddress, String pLocalAddress) throws HttpException, IOException { - + public void handleContent( + MessageReader pReader, + MessageWriter pWriter, + InetAddress pInetAddress, + String pLocalAddress + ) + throws HttpException, IOException { CIMError error = null; // TODO validate CIMHeaders! HttpHeader inputHeader = pReader.getHeader(); inputHeader = processHeader(inputHeader, pWriter); - LogAndTraceBroker.getBroker().trace(Level.FINER, - "Indication Request HTTP Headers= " + inputHeader.toString()); + LogAndTraceBroker.getBroker().trace(Level.FINER, "Indication Request HTTP Headers= " + inputHeader.toString()); String cimMethod = inputHeader.getField("CIMMethod"); String cimExport = inputHeader.getField("CIMExport"); @@ -522,11 +517,16 @@ public void handleContent(MessageReader pReader, MessageWriter pWriter, } InputStream inputstream = null; - if ((this.iSessionProperties.isCimXmlTracingEnabled() && LogAndTraceBroker.getBroker() - .getXmlTraceStream() != null) - || LogAndTraceBroker.getBroker().isLoggableCIMXMLTrace(Level.FINEST)) { - inputstream = new DebugInputStream(pReader.getInputStream(), LogAndTraceBroker - .getBroker().getXmlTraceStream(), "indication request"); + if ( + (this.iSessionProperties.isCimXmlTracingEnabled() && LogAndTraceBroker.getBroker().getXmlTraceStream() != null) || + LogAndTraceBroker.getBroker().isLoggableCIMXMLTrace(Level.FINEST) + ) { + inputstream = + new DebugInputStream( + pReader.getInputStream(), + LogAndTraceBroker.getBroker().getXmlTraceStream(), + "indication request" + ); } else { inputstream = pReader.getInputStream(); } @@ -535,24 +535,22 @@ public void handleContent(MessageReader pReader, MessageWriter pWriter, if (request == null) throw new HttpException(400, "Bad Request"); - if ((cimExport == null && !cimMethod.equalsIgnoreCase("Indication")) - || !request.isCIMExport()) { throw new HttpException(400, "Bad Request"); } + if ((cimExport == null && !cimMethod.equalsIgnoreCase("Indication")) || !request.isCIMExport()) { + throw new HttpException(400, "Bad Request"); + } error = dispatchIndications(pReader, pInetAddress, pLocalAddress, request); buildResponse(xmlHelper, pWriter, request, error); } - private CIMRequest parseDocument(CIMClientXML_HelperImpl xmlHelper, MessageReader pReader, - InputStream inputstream) throws HttpException { - + private CIMRequest parseDocument(CIMClientXML_HelperImpl xmlHelper, MessageReader pReader, InputStream inputstream) + throws HttpException { // TODO: integrate SAX parser and DOM parser Document doc = null; try { - - doc = xmlHelper.parse(new InputSource(new InputStreamReader(inputstream, pReader - .getCharacterEncoding()))); + doc = xmlHelper.parse(new InputSource(new InputStreamReader(inputstream, pReader.getCharacterEncoding()))); Element rootE = doc.getDocumentElement(); return (CIMRequest) CIMXMLParserImpl.parseCIM(rootE); } catch (Exception e) { @@ -565,28 +563,32 @@ private CIMRequest parseDocument(CIMClientXML_HelperImpl xmlHelper, MessageReade * Returns the corresponding indication server if the server is already * present in the linked list, otherwise appends the server to the linked * list and returns the new entry. - * + * * @param pInetAddress * Address of indication server. * @param pDestinationUrl * Destination URL of indication. * @return IndicationServer with given address. */ - private IndicationServer getIndicationServerFromList(InetAddress pInetAddress, - String pDestinationUrl) { + private IndicationServer getIndicationServerFromList(InetAddress pInetAddress, String pDestinationUrl) { ServerListEntry entry; Iterator iterator = this.iServerList.iterator(); while (iterator.hasNext()) { entry = iterator.next(); - if (entry.getInetAddress().equals(pInetAddress) - && entry.getDestinationUrl().equalsIgnoreCase(pDestinationUrl)) return entry - .getIndicationServer(); + if ( + entry.getInetAddress().equals(pInetAddress) && entry.getDestinationUrl().equalsIgnoreCase(pDestinationUrl) + ) return entry.getIndicationServer(); } entry = new ServerListEntry(pInetAddress, pDestinationUrl); this.iServerList.add(entry); - this.iLogger.trace(Level.FINE, "Creating reliable indication handler for server IP " - + entry.getInetAddress().toString() + ", destination URL " - + entry.getDestinationUrl() + " in linked list"); + this.iLogger.trace( + Level.FINE, + "Creating reliable indication handler for server IP " + + entry.getInetAddress().toString() + + ", destination URL " + + entry.getDestinationUrl() + + " in linked list" + ); return entry.getIndicationServer(); } @@ -595,15 +597,14 @@ private IndicationServer getIndicationServerFromList(InetAddress pInetAddress, * Returns the corresponding indication server if the server is already * present in the hash table, otherwise adds the server to the hash table * and returns the new entry. - * + * * @param pInetAddress * Address of indication server. * @param pDestinationUrl * Destination URL of indication. * @return IndicationServer with given address. */ - private IndicationServer getIndicationServerFromTable(InetAddress pInetAddress, - String pDestinationUrl) { + private IndicationServer getIndicationServerFromTable(InetAddress pInetAddress, String pDestinationUrl) { ServerTableEntry key; IndicationServer server; @@ -612,9 +613,14 @@ private IndicationServer getIndicationServerFromTable(InetAddress pInetAddress, if (server == null) { server = new IndicationServer(); this.iServerTable.put(key, server); - this.iLogger.trace(Level.FINE, "Creating reliable indication handler for server IP " - + key.getInetAddress().toString() + ", destination URL " - + key.getDestinationUrl() + " in hash table"); + this.iLogger.trace( + Level.FINE, + "Creating reliable indication handler for server IP " + + key.getInetAddress().toString() + + ", destination URL " + + key.getDestinationUrl() + + " in hash table" + ); } return server; } @@ -622,7 +628,7 @@ private IndicationServer getIndicationServerFromTable(InetAddress pInetAddress, /** * deliverIndication handles reliable indications and returns a boolean * indicating whether the indication should be delivered or not - * + * * @param pIndication * Indication. * @param pId @@ -633,8 +639,7 @@ private IndicationServer getIndicationServerFromTable(InetAddress pInetAddress, * false if ReliableIndicationHandler will * deliver indication */ - private synchronized boolean deliverIndication(CIMInstance pIndication, String pId, - InetAddress pInetAddress) { + private synchronized boolean deliverIndication(CIMInstance pIndication, String pId, InetAddress pInetAddress) { IndicationServer server; // Each serverIP/destinationURL pair needs its own @@ -650,33 +655,34 @@ private synchronized boolean deliverIndication(CIMInstance pIndication, String p // Validate DeliveryRetryAttempts property long attempts = this.iSessionProperties.getListenerDeliveryRetryAttempts(); if (attempts <= 0 || attempts > 1000) { - this.iLogger.trace(Level.FINE, "DeliveryRetryAttempts of " + attempts - + " outside range, using default value"); + this.iLogger.trace(Level.FINE, "DeliveryRetryAttempts of " + attempts + " outside range, using default value"); - attempts = Long.valueOf(WBEMConfigurationDefaults.LISTENER_DELIVERY_RETRY_ATTEMPTS) - .longValue(); + attempts = Long.valueOf(WBEMConfigurationDefaults.LISTENER_DELIVERY_RETRY_ATTEMPTS).longValue(); } // Validate DeliveryRetryInterval property long interval = this.iSessionProperties.getListenerDeliveryRetryInterval(); if (interval <= 0 || interval > 86400) { - this.iLogger.trace(Level.FINE, "DeliveryRetryInterval of " + interval - + " outside range, using default value"); + this.iLogger.trace(Level.FINE, "DeliveryRetryInterval of " + interval + " outside range, using default value"); - interval = Long.valueOf(WBEMConfigurationDefaults.LISTENER_DELIVERY_RETRY_INTERVAL) - .longValue(); + interval = Long.valueOf(WBEMConfigurationDefaults.LISTENER_DELIVERY_RETRY_INTERVAL).longValue(); } // Create new ReliableIndicationHandler for this // CIMIndicationHandler - server.initialize(new ReliableIndicationHandler(this.iDispatcher, attempts * interval - * 10 * 1000)); + server.initialize(new ReliableIndicationHandler(this.iDispatcher, attempts * interval * 10 * 1000)); - this.iLogger - .trace(Level.FINE, "Reliable indication support enabled for IP " - + pInetAddress.getHostAddress() + " and URL " + pId - + ", DeliveryRetryAttempts=" + attempts + ", DeliveryRetryInterval=" - + interval); + this.iLogger.trace( + Level.FINE, + "Reliable indication support enabled for IP " + + pInetAddress.getHostAddress() + + " and URL " + + pId + + ", DeliveryRetryAttempts=" + + attempts + + ", DeliveryRetryInterval=" + + interval + ); } // Let ReliableIndicationHandler deliver it @@ -684,8 +690,12 @@ private synchronized boolean deliverIndication(CIMInstance pIndication, String p return false; } - private CIMError dispatchIndications(MessageReader pReader, InetAddress pInetAddress, - String pLocalAddress, CIMRequest request) { + private CIMError dispatchIndications( + MessageReader pReader, + InetAddress pInetAddress, + String pLocalAddress, + CIMRequest request + ) { try { Vector paramValue = request.getParamValue(); Iterator iter = paramValue.iterator(); @@ -715,18 +725,21 @@ private CIMError dispatchIndications(MessageReader pReader, InetAddress pInetAdd if (this.iAddSenderIPAddress) { int size = indicationInst.getPropertyCount(); CIMProperty props[] = new CIMProperty[size + 1]; - for (int i = 0; i < size; i++) - props[i] = indicationInst.getProperty(i); - props[size] = new CIMProperty("SBLIMJCC_SenderIPAddress", - CIMDataType.STRING_T, pInetAddress.getHostAddress()); + for (int i = 0; i < size; i++) props[i] = indicationInst.getProperty(i); + props[size] = + new CIMProperty("SBLIMJCC_SenderIPAddress", CIMDataType.STRING_T, pInetAddress.getHostAddress()); indicationInst = new CIMInstance(indicationInst.getObjectPath(), props); } // Do any user-requested indication tracing here - if (this.iIndicationTraceProperties != null - && this.iLogger.isLoggableTrace(Level.FINE) - && (this.iIndicationTraceClass == null || indicationInst.getClassName() - .toLowerCase().indexOf(this.iIndicationTraceClass) != -1)) { + if ( + this.iIndicationTraceProperties != null && + this.iLogger.isLoggableTrace(Level.FINE) && + ( + this.iIndicationTraceClass == null || + indicationInst.getClassName().toLowerCase().indexOf(this.iIndicationTraceClass) != -1 + ) + ) { StringBuilder msg = new StringBuilder("Received indication "); msg.append(indicationInst.getClassName()); msg.append(" from IP="); @@ -737,8 +750,7 @@ private CIMError dispatchIndications(MessageReader pReader, InetAddress pInetAdd msg.append(" with properties:"); for (int i = 0; i < this.iIndicationTraceProperties.length; i++) { msg.append(" "); - CIMProperty prop = indicationInst - .getProperty(this.iIndicationTraceProperties[i]); + CIMProperty prop = indicationInst.getProperty(this.iIndicationTraceProperties[i]); if (prop == null) { msg.append(this.iIndicationTraceProperties[i]); msg.append(" not a property;"); @@ -755,41 +767,45 @@ private CIMError dispatchIndications(MessageReader pReader, InetAddress pInetAdd this.iLogger.trace(Level.FINE, msg.toString()); } - if (this.iReliableIndicationsDisabled - || deliverIndication(indicationInst, id, pInetAddress)) { - this.iDispatcher.dispatchEvent(new CIMEvent(indicationInst, id, - pInetAddress)); + if (this.iReliableIndicationsDisabled || deliverIndication(indicationInst, id, pInetAddress)) { + this.iDispatcher.dispatchEvent(new CIMEvent(indicationInst, id, pInetAddress)); } } } return null; } catch (Exception e) { - return new CIMError(new WBEMException(WBEMException.CIM_ERR_FAILED, "CIM_ERR_FAILED", - null, e)); + return new CIMError(new WBEMException(WBEMException.CIM_ERR_FAILED, "CIM_ERR_FAILED", null, e)); } } - private void buildResponse(CIMClientXML_HelperImpl xmlHelper, MessageWriter pWriter, - CIMRequest request, CIMError error) throws HttpException, IOException { + private void buildResponse( + CIMClientXML_HelperImpl xmlHelper, + MessageWriter pWriter, + CIMRequest request, + CIMError error + ) + throws HttpException, IOException { Document responseDoc = null; try { DocumentBuilder docBuilder = xmlHelper.getDocumentBuilder(); responseDoc = docBuilder.newDocument(); CIMXMLBuilderImpl.createIndication_response(responseDoc, request.getId(), error); - } catch (Exception e) { // TODO: check this error code, may not be appropriate throw new HttpException(400, "Bad Request"); } - if (this.iSessionProperties.isCimXmlTracingEnabled() - || this.iLogger.isLoggableCIMXMLTrace(Level.FINEST)) { + if (this.iSessionProperties.isCimXmlTracingEnabled() || this.iLogger.isLoggableCIMXMLTrace(Level.FINEST)) { OutputStream pos = new ByteArrayOutputStream(); CIMClientXML_HelperImpl.dumpDocument(pos, responseDoc, "indication response"); OutputStream debugStream = this.iLogger.getXmlTraceStream(); - if (this.iSessionProperties.isCimXmlTracingEnabled() && debugStream != null) debugStream - .write(pos.toString().getBytes()); + if (this.iSessionProperties.isCimXmlTracingEnabled() && debugStream != null) debugStream.write( + pos.toString().getBytes() + ); if (this.iLogger.isLoggableCIMXMLTrace(Level.FINEST)) this.iLogger.traceCIMXML( - Level.FINEST, pos.toString(), true); + Level.FINEST, + pos.toString(), + true + ); } CIMClientXML_HelperImpl.serialize(pWriter.getOutputStream(), responseDoc); pWriter.getHeader().addField("CIMExport", "MethodResponse"); @@ -802,21 +818,22 @@ private static HttpHeader processHttpExtensions(HttpHeader pOriginalHeader) { String ns = null; HttpHeaderParser manOptHeader = null; - if (man != null && man.length() > 0) manOptHeader = new HttpHeaderParser(man); - else if (opt != null && opt.length() > 0) manOptHeader = new HttpHeaderParser(opt); + if (man != null && man.length() > 0) manOptHeader = new HttpHeaderParser(man); else if ( + opt != null && opt.length() > 0 + ) manOptHeader = new HttpHeaderParser(opt); if (manOptHeader != null) ns = manOptHeader.getValue("ns"); if (ns != null) { - Iterator> iter = pOriginalHeader.iterator(); String key; while (iter.hasNext()) { Entry entry = iter.next(); if (entry != null) { key = entry.getKey().toString(); - if (key.startsWith(ns + "-")) headers.addParsedField(key.substring(3), entry - .getValue().toString()); - else headers.addParsedField(key, entry.getValue().toString()); + if (key.startsWith(ns + "-")) headers.addParsedField( + key.substring(3), + entry.getValue().toString() + ); else headers.addParsedField(key, entry.getValue().toString()); } } } else { @@ -825,5 +842,4 @@ private static HttpHeader processHttpExtensions(HttpHeader pOriginalHeader) { return headers; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/indications/ReliableIndicationHandler.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/indications/ReliableIndicationHandler.java index 25522eb..5b0f86f 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/indications/ReliableIndicationHandler.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/indications/ReliableIndicationHandler.java @@ -46,10 +46,9 @@ import java.util.Iterator; import java.util.LinkedList; import java.util.logging.Level; - import org.metricshub.wbem.javax.cim.CIMInstance; -import org.metricshub.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; import org.metricshub.wbem.javax.cim.CIMProperty; +import org.metricshub.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker; /** * ReliableIndicationHandler is responsible for determining when to @@ -57,7 +56,7 @@ * caching all indications for the duration of their sequence identifier * lifetime, and logging missing, duplicate and out-of-order indications. This * functionality is based on the changes first introduced by DSP1054 v1.1. - * + * * The handleIndication, areAllEmpty and * processAll methods need to be synchronized because they are the * entry points into ReliableIndicationHandler - the first is the @@ -65,7 +64,7 @@ * indication, the other two are only called by the DataManager thread and hence * protected. All of the private methods are only called from one of the three * synchronized methods. - * + * * NOTE: ReliableIndicationHandler does NOT contain any logic for * handling sequence number wrapping. It was deemed unnecessary because of the * performance impact to each and every indication for a VERY rare occurrence: @@ -84,7 +83,6 @@ public class ReliableIndicationHandler { * one sequence context can be in the queue at any one time. */ private class ReliableIndication { - private long iDiscardTime; private String iId; @@ -95,8 +93,13 @@ private class ReliableIndication { private long iSequenceNumber; - public ReliableIndication(CIMInstance pIndication, long pSequenceNumber, long pDiscardTime, - String pId, InetAddress pInetAddress) { + public ReliableIndication( + CIMInstance pIndication, + long pSequenceNumber, + long pDiscardTime, + String pId, + InetAddress pInetAddress + ) { this.iIndication = pIndication; this.iSequenceNumber = pSequenceNumber; this.iDiscardTime = pDiscardTime; @@ -133,7 +136,6 @@ public long getSequenceNumber() { * increasing discard time. */ private class CacheEntry { - private String iSeqContext; private long iSeqNumber; @@ -183,7 +185,7 @@ public long getSequenceNumber() { * Constructs a ReliableIndicationHandler instance that uses * the specified event dispatcher and sequence identifier lifetime to handle * reliable indications. - * + * * @param pDispatcher * CIMEventDispatcher that does the actual * indication dispatching. @@ -197,15 +199,14 @@ public ReliableIndicationHandler(CIMEventDispatcher pDispatcher, long pIdentifer /** * Adds a reliable indication to the indication delivery queue. - * + * * @param pIndication * Reliable indication to be queued for delivery. */ private void addToQueue(ReliableIndication pIndication) { int size = this.iQueue.size(); - if ((size == 0) - || (this.iQueue.getLast().getSequenceNumber()) < pIndication.getSequenceNumber()) { + if ((size == 0) || (this.iQueue.getLast().getSequenceNumber()) < pIndication.getSequenceNumber()) { this.iQueue.addLast(pIndication); } else { int i; @@ -235,8 +236,9 @@ private void flushQueue() { ReliableIndication indication = this.iQueue.removeFirst(); logMissingQueueEntries(indication.getSequenceNumber()); - this.iDispatcher.dispatchEvent(new CIMEvent(indication.getIndication(), indication - .getId(), indication.getInetAddress())); + this.iDispatcher.dispatchEvent( + new CIMEvent(indication.getIndication(), indication.getId(), indication.getInetAddress()) + ); this.iExpectedSequenceNumber = indication.getSequenceNumber() + 1; } @@ -244,7 +246,7 @@ private void flushQueue() { /** * Determines if the indication delivery queue is empty. - * + * * @return true if indication delivery queue is empty, * false otherwise. */ @@ -255,7 +257,7 @@ private boolean isQueueEmpty() { /** * Logs any missing reliable indications at the front of the indication * delivery queue. - * + * * @param pSequenceNumber * Sequence number of first indication present in delivery queue. */ @@ -297,8 +299,9 @@ private void processQueue() { indication = this.iQueue.removeFirst(); logMissingQueueEntries(indication.getSequenceNumber()); - this.iDispatcher.dispatchEvent(new CIMEvent(indication.getIndication(), indication - .getId(), indication.getInetAddress())); + this.iDispatcher.dispatchEvent( + new CIMEvent(indication.getIndication(), indication.getId(), indication.getInetAddress()) + ); this.iExpectedSequenceNumber = indication.getSequenceNumber() + 1; @@ -310,8 +313,9 @@ private void processQueue() { while (indication.getSequenceNumber() == this.iExpectedSequenceNumber) { indication = this.iQueue.removeFirst(); - this.iDispatcher.dispatchEvent(new CIMEvent(indication.getIndication(), indication - .getId(), indication.getInetAddress())); + this.iDispatcher.dispatchEvent( + new CIMEvent(indication.getIndication(), indication.getId(), indication.getInetAddress()) + ); this.iExpectedSequenceNumber++; @@ -322,7 +326,7 @@ private void processQueue() { /** * Adds a reliable indication to the sequence identifier cache. - * + * * @param pSequenceContext * Sequence context of reliable indication to be cached. * @param pSequenceNumber @@ -348,7 +352,6 @@ private void addToCache(String pSequenceContext, long pSequenceNumber, long pDis } this.iCache.addFirst(newEntry); } - // printCache(); } @@ -362,7 +365,7 @@ private void addToCache(String pSequenceContext, long pSequenceNumber, long pDis /** * Determines if the sequence identifier cache is empty. - * + * * @return true if sequence identifier cache is empty, * false otherwise. */ @@ -372,7 +375,7 @@ private boolean isCacheEmpty() { /** * Determines if the sequence context is in the sequence identifier cache. - * + * * @param pSequenceContext * Sequence context to look for. * @return true if sequence context is in sequence identifier @@ -390,7 +393,7 @@ private boolean isInCache(String pSequenceContext) { /** * Determines if the sequence identifier (context and number) is in the * sequence identifier cache. - * + * * @param pSequenceContext * Sequence context to look for. * @param pSequenceNumber @@ -403,8 +406,9 @@ private boolean isInCache(String pSequenceContext, long pSequenceNumber) { Iterator iterator = this.iCache.iterator(); while (iterator.hasNext()) { CacheEntry entry = iterator.next(); - if ((entry.getSequenceContext().compareTo(pSequenceContext) == 0) - && (entry.getSequenceNumber() == pSequenceNumber)) return true; + if ( + (entry.getSequenceContext().compareTo(pSequenceContext) == 0) && (entry.getSequenceNumber() == pSequenceNumber) + ) return true; } return false; } @@ -439,7 +443,7 @@ private void processCache() { /** * Determines if both the indication delivery queue and sequence identifier * cache are empty. - * + * * @return true if both the indication delivery queue and * sequence identifier cache are empty, false * otherwise. @@ -471,7 +475,7 @@ protected synchronized void processAll() { * indication is either sent directly to the CIMEventDispatcher * or placed in the indication delivery queue to be dispatched later. All * reliable indications are placed in the sequence identifier cache. - * + * * @param pIndication * Indication. * @param pId @@ -479,8 +483,7 @@ protected synchronized void processAll() { * @param pInetAddress * Indication server IP. */ - public synchronized void handleIndication(CIMInstance pIndication, String pId, - InetAddress pInetAddress) { + public synchronized void handleIndication(CIMInstance pIndication, String pId, InetAddress pInetAddress) { // Get current time long arrivalTime = System.currentTimeMillis(); @@ -491,8 +494,7 @@ public synchronized void handleIndication(CIMInstance pIndication, String pId, // At this point indication is reliable or not reliable // Indication is not reliable, handle appropriately and deliver - if (seqCtxProp == null || seqNumProp == null || seqCtxProp.getValue() == null - || seqNumProp.getValue() == null) { + if (seqCtxProp == null || seqNumProp == null || seqCtxProp.getValue() == null || seqNumProp.getValue() == null) { // Handle switch from reliable to not reliable if (this.iLastSequenceContext != null) { // Deliver all enqueued indications from previous context @@ -520,8 +522,11 @@ public synchronized void handleIndication(CIMInstance pIndication, String pId, // this.iLastArrivalTime = arrivalTime; // Cache sequence identifier - addToCache(this.iLastSequenceContext, this.iLastSequenceNumber.longValue(), arrivalTime - + this.iIndentifierLifetime); + addToCache( + this.iLastSequenceContext, + this.iLastSequenceNumber.longValue(), + arrivalTime + this.iIndentifierLifetime + ); // Deliver indication this.iDispatcher.dispatchEvent(new CIMEvent(pIndication, pId, pInetAddress)); @@ -568,15 +573,18 @@ public synchronized void handleIndication(CIMInstance pIndication, String pId, // Cached sequence context indicates this indication arrived // out-of-order from previous context, log and ignore if (isInCache(seqCtx)) { - this.iLogger.trace(Level.FINE, "Out-of-order indication #" + seqNumVal - + " received from previous context; indication ignored, logged: " - + pIndication.toString()); + this.iLogger.trace( + Level.FINE, + "Out-of-order indication #" + + seqNumVal + + " received from previous context; indication ignored, logged: " + + pIndication.toString() + ); return; } - this.iLogger.trace(Level.FINE, - "Discarding knowledge of previous sequence identifier because context changed"); + this.iLogger.trace(Level.FINE, "Discarding knowledge of previous sequence identifier because context changed"); // Deliver all enqueued indications from previous context flushQueue(); @@ -600,8 +608,9 @@ public synchronized void handleIndication(CIMInstance pIndication, String pId, // Unexpected (non-zero) sequence number, enqueue this.iLastSequenceNumber = Long.valueOf(-1); this.iExpectedSequenceNumber = 0; - addToQueue(new ReliableIndication(pIndication, seqNumVal, arrivalTime - + this.iIndentifierLifetime, pId, pInetAddress)); + addToQueue( + new ReliableIndication(pIndication, seqNumVal, arrivalTime + this.iIndentifierLifetime, pId, pInetAddress) + ); return; } @@ -625,8 +634,7 @@ public synchronized void handleIndication(CIMInstance pIndication, String pId, // Duplicate indication arrived, log and ignore if (isInCache(seqCtx, seqNumVal)) { - this.iLogger.trace(Level.FINE, "Duplicate indication #" + seqNumVal - + " received; indication ignored"); + this.iLogger.trace(Level.FINE, "Duplicate indication #" + seqNumVal + " received; indication ignored"); // Cache sequence identifier (duplicate entries okay and much easier // than deleting/adding or moving) @@ -637,9 +645,15 @@ public synchronized void handleIndication(CIMInstance pIndication, String pId, // Out-of-order indication arrived, log and ignore if (seqNumVal < this.iExpectedSequenceNumber) { - this.iLogger.trace(Level.FINE, "Out-of-order indication #" + seqNumVal + " received (#" - + this.iExpectedSequenceNumber + " expected); indication ignored, logged: " - + pIndication.toString()); + this.iLogger.trace( + Level.FINE, + "Out-of-order indication #" + + seqNumVal + + " received (#" + + this.iExpectedSequenceNumber + + " expected); indication ignored, logged: " + + pIndication.toString() + ); // Cache sequence identifier addToCache(seqCtx, seqNumVal, arrivalTime + this.iIndentifierLifetime); @@ -650,8 +664,9 @@ public synchronized void handleIndication(CIMInstance pIndication, String pId, // Indication with higher sequence number than expected received, cache // and enqueue it addToCache(seqCtx, seqNumVal, arrivalTime + this.iIndentifierLifetime); - addToQueue(new ReliableIndication(pIndication, seqNumVal, arrivalTime - + this.iIndentifierLifetime, pId, pInetAddress)); + addToQueue( + new ReliableIndication(pIndication, seqNumVal, arrivalTime + this.iIndentifierLifetime, pId, pInetAddress) + ); return; } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMAssociatorNamesOp.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMAssociatorNamesOp.java index 9ce5a38..059ce11 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMAssociatorNamesOp.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMAssociatorNamesOp.java @@ -48,12 +48,11 @@ /** * @author Roberto - * + * * To change the template for this generated type comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ public class CIMAssociatorNamesOp extends CIMOperation { - protected String iAssociationClass; protected String iResultClass; @@ -64,16 +63,20 @@ public class CIMAssociatorNamesOp extends CIMOperation { /** * Ctor. - * + * * @param pObjectName * @param pAssociationClass * @param pResultClass * @param pRole * @param pResultRole */ - public CIMAssociatorNamesOp(CIMObjectPath pObjectName, String pAssociationClass, - String pResultClass, String pRole, String pResultRole) { - + public CIMAssociatorNamesOp( + CIMObjectPath pObjectName, + String pAssociationClass, + String pResultClass, + String pRole, + String pResultRole + ) { this.iMethodCall = "AssociatorNames"; this.iObjectName = pObjectName; this.iAssociationClass = pAssociationClass; @@ -83,7 +86,7 @@ public CIMAssociatorNamesOp(CIMObjectPath pObjectName, String pAssociationClass, /** * Returns the association class name - * + * * @return The association class name */ public String getAssocClass() { @@ -92,7 +95,7 @@ public String getAssocClass() { /** * Returns the result class name - * + * * @return The result class name */ public String getResultClass() { @@ -101,7 +104,7 @@ public String getResultClass() { /** * Returns the result role - * + * * @return The result role */ public String getResultRole() { @@ -110,11 +113,10 @@ public String getResultRole() { /** * Returns the role - * + * * @return The role */ public String getRole() { return this.iRole; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMAssociatorsOp.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMAssociatorsOp.java index 7620e9d..8448f68 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMAssociatorsOp.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMAssociatorsOp.java @@ -48,10 +48,9 @@ /** * Class CIMAssociatorsOp - * + * */ public class CIMAssociatorsOp extends CIMOperation { - protected String iAssociationClass; protected String iResultClass; @@ -68,7 +67,7 @@ public class CIMAssociatorsOp extends CIMOperation { /** * Ctor. - * + * * @param pObjectName * @param pAssociationClass * @param pResultClass @@ -78,10 +77,16 @@ public class CIMAssociatorsOp extends CIMOperation { * @param pIncludeClassOrigin * @param pPropertyList */ - public CIMAssociatorsOp(CIMObjectPath pObjectName, String pAssociationClass, - String pResultClass, String pRole, String pResultRole, boolean pIncludeQualifiers, - boolean pIncludeClassOrigin, String[] pPropertyList) { - + public CIMAssociatorsOp( + CIMObjectPath pObjectName, + String pAssociationClass, + String pResultClass, + String pRole, + String pResultRole, + boolean pIncludeQualifiers, + boolean pIncludeClassOrigin, + String[] pPropertyList + ) { this.iMethodCall = "Associators"; this.iObjectName = pObjectName; this.iAssociationClass = pAssociationClass; @@ -94,7 +99,7 @@ public CIMAssociatorsOp(CIMObjectPath pObjectName, String pAssociationClass, /** * Returns the association class - * + * * @return The association class */ public String getAssocClass() { @@ -103,7 +108,7 @@ public String getAssocClass() { /** * Returns if includeQualifiers is set - * + * * @return The value of includeClassOrigin */ public boolean isIncludeClassOrigin() { @@ -112,7 +117,7 @@ public boolean isIncludeClassOrigin() { /** * Returns if includeQualifiers is set - * + * * @return The value of includeClassOrigin */ public boolean isIncludeQualifiers() { @@ -121,7 +126,7 @@ public boolean isIncludeQualifiers() { /** * Returns the property list - * + * * @return The property list */ public String[] getPropertyList() { @@ -130,7 +135,7 @@ public String[] getPropertyList() { /** * Returns the result class - * + * * @return The result class */ public String getResultClass() { @@ -139,7 +144,7 @@ public String getResultClass() { /** * Returns the result role - * + * * @return The result role */ public String getResultRole() { @@ -148,11 +153,10 @@ public String getResultRole() { /** * Returns the role - * + * * @return The role */ public String getRole() { return this.iRole; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMCreateClassOp.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMCreateClassOp.java index 626b73e..dfa1766 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMCreateClassOp.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMCreateClassOp.java @@ -49,15 +49,14 @@ /** * CIMCreateClassOp - * + * */ public class CIMCreateClassOp extends CIMOperation { - protected CIMClass iCimClass; /** * Ctor. - * + * * @param pObjectName * @param pCimClass */ @@ -69,7 +68,7 @@ public CIMCreateClassOp(CIMObjectPath pObjectName, CIMClass pCimClass) { /** * Returns the CIM class - * + * * @return The CIM class */ public CIMClass getCimClass() { diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMCreateInstanceOp.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMCreateInstanceOp.java index d58ac30..a8ad3a6 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMCreateInstanceOp.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMCreateInstanceOp.java @@ -49,15 +49,14 @@ /** * CIMCreateInstanceOp - * + * */ public class CIMCreateInstanceOp extends CIMOperation { - protected CIMInstance iInstance; /** * Ctor. - * + * * @param pObjectName * @param pInstance */ @@ -69,11 +68,10 @@ public CIMCreateInstanceOp(CIMObjectPath pObjectName, CIMInstance pInstance) { /** * Returns the instance - * + * * @return The instance */ public CIMInstance getInstance() { return this.iInstance; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMCreateNameSpaceOp.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMCreateNameSpaceOp.java index 11c5c41..f9a2184 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMCreateNameSpaceOp.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMCreateNameSpaceOp.java @@ -47,13 +47,13 @@ /** * CIMCreateNameSpaceOp - * + * */ public class CIMCreateNameSpaceOp extends CIMOperation { /** * Ctor. - * + * * @param pNamespace */ public CIMCreateNameSpaceOp(String pNamespace) { diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMCreateQualifierTypeOp.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMCreateQualifierTypeOp.java index dd501a1..f07d55f 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMCreateQualifierTypeOp.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMCreateQualifierTypeOp.java @@ -50,15 +50,14 @@ /** * CIMCreateQualifierTypeOp - * + * */ public class CIMCreateQualifierTypeOp extends CIMOperation { - protected CIMQualifierType iQualifierType; /** * Ctor. - * + * * @param pObjectName * @param pQualifierType */ @@ -70,11 +69,10 @@ public CIMCreateQualifierTypeOp(CIMObjectPath pObjectName, CIMQualifierType p /** * Returns the qualifier type - * + * * @return The qualifier type */ public CIMQualifierType getQualifierType() { return this.iQualifierType; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMDeleteClassOp.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMDeleteClassOp.java index 3a8ce82..f6f039a 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMDeleteClassOp.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMDeleteClassOp.java @@ -48,13 +48,13 @@ /** * CIMDeleteClassOp - * + * */ public class CIMDeleteClassOp extends CIMOperation { /** * Ctor. - * + * * @param pObjectName */ public CIMDeleteClassOp(CIMObjectPath pObjectName) { diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMDeleteInstanceOp.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMDeleteInstanceOp.java index f6fb378..6ed4219 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMDeleteInstanceOp.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMDeleteInstanceOp.java @@ -48,13 +48,13 @@ /** * CIMDeleteInstanceOp - * + * */ public class CIMDeleteInstanceOp extends CIMOperation { /** * Ctor. - * + * * @param pObjectName */ public CIMDeleteInstanceOp(CIMObjectPath pObjectName) { diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMDeleteNameSpaceOp.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMDeleteNameSpaceOp.java index 083f619..4cab903 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMDeleteNameSpaceOp.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMDeleteNameSpaceOp.java @@ -48,17 +48,16 @@ /** * CIMDeleteNameSpaceOp - * + * */ public class CIMDeleteNameSpaceOp extends CIMOperation { /** * Ctor. - * + * * @param pNamespace */ public CIMDeleteNameSpaceOp(String pNamespace) { this.iNameSpace = pNamespace; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMDeleteQualifierTypeOp.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMDeleteQualifierTypeOp.java index 936bd83..87851d0 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMDeleteQualifierTypeOp.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMDeleteQualifierTypeOp.java @@ -48,13 +48,13 @@ /** * CIMDeleteQualifierTypeOp - * + * */ public class CIMDeleteQualifierTypeOp extends CIMOperation { /** * Ctor. - * + * * @param pObjectName */ public CIMDeleteQualifierTypeOp(CIMObjectPath pObjectName) { diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumClassNamesOp.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumClassNamesOp.java index bd666a9..59ee6d9 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumClassNamesOp.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumClassNamesOp.java @@ -48,15 +48,14 @@ /** * CIMEnumClassNamesOp - * + * */ public class CIMEnumClassNamesOp extends CIMOperation { - protected boolean iDeep; /** * Ctor. - * + * * @param objectName * @param deep */ @@ -68,11 +67,10 @@ public CIMEnumClassNamesOp(CIMObjectPath objectName, boolean deep) { /** * Returns deep - * + * * @return The value of deep */ public boolean isDeep() { return this.iDeep; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumClassesOp.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumClassesOp.java index 1f4a83f..e5ff842 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumClassesOp.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumClassesOp.java @@ -48,10 +48,9 @@ /** * CIMEnumClassesOp - * + * */ public class CIMEnumClassesOp extends CIMOperation { - protected boolean iDeep; protected boolean iLocalOnly; @@ -62,15 +61,20 @@ public class CIMEnumClassesOp extends CIMOperation { /** * Ctor. - * + * * @param pObjectName * @param pDeep * @param pLocalOnly * @param pIncludeQualifiers * @param pIncludeClassOrigin */ - public CIMEnumClassesOp(CIMObjectPath pObjectName, boolean pDeep, boolean pLocalOnly, - boolean pIncludeQualifiers, boolean pIncludeClassOrigin) { + public CIMEnumClassesOp( + CIMObjectPath pObjectName, + boolean pDeep, + boolean pLocalOnly, + boolean pIncludeQualifiers, + boolean pIncludeClassOrigin + ) { this.iMethodCall = "EnumerateClasses"; this.iObjectName = pObjectName; this.iDeep = pDeep; @@ -81,7 +85,7 @@ public CIMEnumClassesOp(CIMObjectPath pObjectName, boolean pDeep, boolean pLocal /** * Returns if deep is set - * + * * @return The value of deep */ public boolean isDeep() { @@ -90,7 +94,7 @@ public boolean isDeep() { /** * Returns if includeClassOrigin is set - * + * * @return The value of includeClassOrigin */ public boolean isIncludeClassOrigin() { @@ -99,7 +103,7 @@ public boolean isIncludeClassOrigin() { /** * Returns if includeQualifiers is set - * + * * @return The value of includeQualifiers */ public boolean isIncludeQualifiers() { @@ -108,11 +112,10 @@ public boolean isIncludeQualifiers() { /** * Returns if localOnly is set - * + * * @return The value of localOnly */ public boolean isLocalOnly() { return this.iLocalOnly; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumInstanceNamesOp.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumInstanceNamesOp.java index 272ca83..6cb4c32 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumInstanceNamesOp.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumInstanceNamesOp.java @@ -48,13 +48,13 @@ /** * CIMEnumInstanceNamesOp - * + * */ public class CIMEnumInstanceNamesOp extends CIMOperation { /** * Ctor. - * + * * @param objectName */ public CIMEnumInstanceNamesOp(CIMObjectPath objectName) { diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumInstancesOp.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumInstancesOp.java index 883015a..69a8e51 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumInstancesOp.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumInstancesOp.java @@ -48,10 +48,9 @@ /** * CIMEnumInstancesOp - * + * */ public class CIMEnumInstancesOp extends CIMOperation { - protected boolean iDeep; protected boolean iLocalOnly; @@ -64,7 +63,7 @@ public class CIMEnumInstancesOp extends CIMOperation { /** * Ctor. - * + * * @param objectName * @param deep * @param localOnly @@ -72,8 +71,14 @@ public class CIMEnumInstancesOp extends CIMOperation { * @param includeClassOrigin * @param propertyList */ - public CIMEnumInstancesOp(CIMObjectPath objectName, boolean deep, boolean localOnly, - boolean includeQualifiers, boolean includeClassOrigin, String[] propertyList) { + public CIMEnumInstancesOp( + CIMObjectPath objectName, + boolean deep, + boolean localOnly, + boolean includeQualifiers, + boolean includeClassOrigin, + String[] propertyList + ) { this.iMethodCall = "EnumerateInstances"; this.iObjectName = objectName; this.iDeep = deep; @@ -85,7 +90,7 @@ public CIMEnumInstancesOp(CIMObjectPath objectName, boolean deep, boolean localO /** * Returns deep - * + * * @return The value of deep. */ public boolean isDeep() { @@ -94,7 +99,7 @@ public boolean isDeep() { /** * Returns includeClassOrigin - * + * * @return The value of includeClassOrigin. */ public boolean isIncludeClassOrigin() { @@ -103,7 +108,7 @@ public boolean isIncludeClassOrigin() { /** * Returns includeQualifiers - * + * * @return The value of includeQualifiers. */ public boolean isIncludeQualifiers() { @@ -112,7 +117,7 @@ public boolean isIncludeQualifiers() { /** * Returns localOnly - * + * * @return The value of localOnly. */ public boolean isLocalOnly() { @@ -121,11 +126,10 @@ public boolean isLocalOnly() { /** * Returns propertyList - * + * * @return The value of propertyList. */ public String[] getPropertyList() { return this.iPropertyList; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumNameSpaceOp.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumNameSpaceOp.java index aec5631..8796148 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumNameSpaceOp.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumNameSpaceOp.java @@ -47,13 +47,13 @@ /** * CIMEnumNameSpaceOp - * + * */ public class CIMEnumNameSpaceOp extends CIMOperation { /** * Ctor. - * + * * @param pNamespace */ public CIMEnumNameSpaceOp(String pNamespace) { diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumQualifierTypesOp.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumQualifierTypesOp.java index adadda4..5f16d6b 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumQualifierTypesOp.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMEnumQualifierTypesOp.java @@ -48,13 +48,13 @@ /** * CIMEnumQualifierTypesOp - * + * */ public class CIMEnumQualifierTypesOp extends CIMOperation { /** * Ctor. - * + * * @param pObjectName */ public CIMEnumQualifierTypesOp(CIMObjectPath pObjectName) { diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMExecQueryOp.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMExecQueryOp.java index 126446d..470de49 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMExecQueryOp.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMExecQueryOp.java @@ -48,17 +48,16 @@ /** * CIMExecQueryOp - * + * */ public class CIMExecQueryOp extends CIMOperation { - protected String iQuery; protected String iQueryLanguage; /** * Ctor. - * + * * @param objectName * @param query * @param queryLanguage @@ -72,7 +71,7 @@ public CIMExecQueryOp(CIMObjectPath objectName, String query, String queryLangua /** * Returns query - * + * * @return The value of query. */ public String getQuery() { @@ -81,11 +80,10 @@ public String getQuery() { /** * Returns queryLanguage - * + * * @return The value of queryLanguage. */ public String getQueryLanguage() { return this.iQueryLanguage; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMGetClassOp.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMGetClassOp.java index bcd3dcf..b742f80 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMGetClassOp.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMGetClassOp.java @@ -49,10 +49,9 @@ /** * CIMGetClassOp - * + * */ public class CIMGetClassOp extends CIMSingleResultOperation { - protected boolean iLocalOnly; protected boolean iIncludeQualifiers; @@ -63,16 +62,20 @@ public class CIMGetClassOp extends CIMSingleResultOperation { /** * Ctor. - * + * * @param pObjectName * @param pLocalOnly * @param pIncludeQualifiers * @param pIncludeClassOrigin * @param pPropertyList */ - public CIMGetClassOp(CIMObjectPath pObjectName, boolean pLocalOnly, boolean pIncludeQualifiers, - boolean pIncludeClassOrigin, String[] pPropertyList) { - + public CIMGetClassOp( + CIMObjectPath pObjectName, + boolean pLocalOnly, + boolean pIncludeQualifiers, + boolean pIncludeClassOrigin, + String[] pPropertyList + ) { this.iMethodCall = "GetClass"; this.iObjectName = pObjectName; this.iLocalOnly = pLocalOnly; @@ -82,7 +85,7 @@ public CIMGetClassOp(CIMObjectPath pObjectName, boolean pLocalOnly, boolean pInc /** * Returns includeClassOrigin - * + * * @return The value of includeClassOrigin. */ public boolean isIncludeClassOrigin() { @@ -91,7 +94,7 @@ public boolean isIncludeClassOrigin() { /** * Returns includeQualifiers - * + * * @return The value of includeQualifiers. */ public boolean isIncludeQualifiers() { @@ -100,7 +103,7 @@ public boolean isIncludeQualifiers() { /** * Returns localOnly - * + * * @return The value of localOnly. */ public boolean isLocalOnly() { @@ -109,11 +112,10 @@ public boolean isLocalOnly() { /** * Returns propertyList - * + * * @return The value of propertyList. */ public String[] getPropertyList() { return this.iPropertyList; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMGetInstanceOp.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMGetInstanceOp.java index f65275f..6477215 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMGetInstanceOp.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMGetInstanceOp.java @@ -48,10 +48,9 @@ /** * CIMGetInstanceOp - * + * */ public class CIMGetInstanceOp extends CIMSingleResultOperation { - protected boolean iLocalOnly; protected boolean iIncludeQualifiers; @@ -62,16 +61,20 @@ public class CIMGetInstanceOp extends CIMSingleResultOperation { /** * Ctor. - * + * * @param pObjectName * @param pLocalOnly * @param pIncludeQualifiers * @param pIncludeClassOrigin * @param pPropertyList */ - public CIMGetInstanceOp(CIMObjectPath pObjectName, boolean pLocalOnly, - boolean pIncludeQualifiers, boolean pIncludeClassOrigin, String[] pPropertyList) { - + public CIMGetInstanceOp( + CIMObjectPath pObjectName, + boolean pLocalOnly, + boolean pIncludeQualifiers, + boolean pIncludeClassOrigin, + String[] pPropertyList + ) { this.iMethodCall = "GetInstance"; this.iObjectName = pObjectName; this.iLocalOnly = pLocalOnly; @@ -82,7 +85,7 @@ public CIMGetInstanceOp(CIMObjectPath pObjectName, boolean pLocalOnly, /** * Returns includeClassOrigin - * + * * @return The value of includeClassOrigin. */ public boolean isIncludeClassOrigin() { @@ -91,7 +94,7 @@ public boolean isIncludeClassOrigin() { /** * Returns includeQualifiers - * + * * @return The value of includeQualifiers. */ public boolean isIncludeQualifiers() { @@ -100,7 +103,7 @@ public boolean isIncludeQualifiers() { /** * Returns localOnly - * + * * @return The value of localOnly. */ public boolean isLocalOnly() { @@ -109,7 +112,7 @@ public boolean isLocalOnly() { /** * Returns propertyList - * + * * @return The value of propertyList. */ public String[] getPropertyList() { diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMGetPropertyOp.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMGetPropertyOp.java index 929594f..5c61f4a 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMGetPropertyOp.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMGetPropertyOp.java @@ -48,15 +48,14 @@ /** * CIMGetPropertyOp - * + * */ public class CIMGetPropertyOp extends CIMSingleResultOperation { - protected String iPropertyName; /** * Ctor. - * + * * @param pObjectName * @param pPropertyName */ @@ -68,11 +67,10 @@ public CIMGetPropertyOp(CIMObjectPath pObjectName, String pPropertyName) { /** * Returns propertyName - * + * * @return The value of propertyName. */ public String getPropertyName() { return this.iPropertyName; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMGetQualifierTypeOp.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMGetQualifierTypeOp.java index b4176d9..e4709e1 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMGetQualifierTypeOp.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMGetQualifierTypeOp.java @@ -48,15 +48,14 @@ /** * CIMGetQualifierTypeOp - * + * */ public class CIMGetQualifierTypeOp extends CIMSingleResultOperation { - protected String iQualifierType; /** * Ctor. - * + * * @param pObjectName * @param pQualifierType */ @@ -68,11 +67,10 @@ public CIMGetQualifierTypeOp(CIMObjectPath pObjectName, String pQualifierType) { /** * Returns qualifierType - * + * * @return The value of qualifierType. */ public String getQualifierType() { return this.iQualifierType; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMInvokeMethodOp.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMInvokeMethodOp.java index ac5f8d0..305d754 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMInvokeMethodOp.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMInvokeMethodOp.java @@ -50,10 +50,9 @@ /** * CIMInvokeMethodOp - * + * */ public class CIMInvokeMethodOp extends CIMOperation { - protected String iMethodName; protected CIMArgument[] iInParams; @@ -62,14 +61,18 @@ public class CIMInvokeMethodOp extends CIMOperation { /** * Ctor. - * + * * @param pObjectName * @param pMethodName * @param pInParams * @param pOutParams */ - public CIMInvokeMethodOp(CIMObjectPath pObjectName, String pMethodName, - CIMArgument[] pInParams, CIMArgument[] pOutParams) { + public CIMInvokeMethodOp( + CIMObjectPath pObjectName, + String pMethodName, + CIMArgument[] pInParams, + CIMArgument[] pOutParams + ) { this.iMethodCall = "InvokeMethod"; this.iObjectName = pObjectName; this.iMethodName = pMethodName; @@ -79,7 +82,7 @@ public CIMInvokeMethodOp(CIMObjectPath pObjectName, String pMethodName, /** * Returns inParameters - * + * * @return The value of inParameters. */ public CIMArgument[] getInParams() { @@ -88,7 +91,7 @@ public CIMArgument[] getInParams() { /** * Returns methodName - * + * * @return The value of methodName. */ public String getMethodName() { @@ -97,11 +100,10 @@ public String getMethodName() { /** * Returns outParameters - * + * * @return The value of outParameters. */ public CIMArgument[] getOutParams() { return this.iOutParams; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMOperation.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMOperation.java index b119a50..f868515 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMOperation.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMOperation.java @@ -49,10 +49,9 @@ /** * CIMOperation - * + * */ public abstract class CIMOperation { - protected CIMObjectPath iObjectName; protected String iNameSpace; @@ -63,7 +62,7 @@ public abstract class CIMOperation { /** * Returns the object name - * + * * @return The object name */ public CIMObjectPath getObjectName() { @@ -72,7 +71,7 @@ public CIMObjectPath getObjectName() { /** * Returns the namespace - * + * * @return The namespace */ public String getNameSpace() { @@ -81,7 +80,7 @@ public String getNameSpace() { /** * Sets the namespace - * + * * @param pNamespace * The namespace */ @@ -91,7 +90,7 @@ public void setNameSpace(String pNamespace) { /** * Returns the method call - * + * * @return The method call */ public String getMethodCall() { @@ -100,7 +99,7 @@ public String getMethodCall() { /** * Returns if an (uncaught) exception occurred - * + * * @return true if an (uncaught) exception occurred, * false otherwise */ @@ -110,7 +109,7 @@ public boolean isException() { /** * Returns the result of the operation - * + * * @return The result * @throws WBEMException */ @@ -121,7 +120,7 @@ public Object getResult() throws WBEMException { /** * Sets the operation result - * + * * @param pResult * The result */ diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMReferenceNamesOp.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMReferenceNamesOp.java index a00bda6..7db3498 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMReferenceNamesOp.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMReferenceNamesOp.java @@ -48,17 +48,16 @@ /** * CIMReferenceNamesOp - * + * */ public class CIMReferenceNamesOp extends CIMOperation { - protected String iResultClass; protected String iResultRole; /** * Ctor. - * + * * @param pObjectName * @param pResultClass * @param pRole @@ -72,7 +71,7 @@ public CIMReferenceNamesOp(CIMObjectPath pObjectName, String pResultClass, Strin /** * Returns resultClass - * + * * @return The value of resultClass. */ public String getResultClass() { @@ -81,11 +80,10 @@ public String getResultClass() { /** * Returns resultRole - * + * * @return The value of resultRole. */ public String getResultRole() { return this.iResultRole; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMReferencesOp.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMReferencesOp.java index 89f4fd5..90af1f9 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMReferencesOp.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMReferencesOp.java @@ -48,10 +48,9 @@ /** * CIMReferencesOp - * + * */ public class CIMReferencesOp extends CIMOperation { - protected String iResultClass; protected String iRole; @@ -64,7 +63,7 @@ public class CIMReferencesOp extends CIMOperation { /** * Ctor. - * + * * @param pObjectName * @param pResultClass * @param pRole @@ -72,8 +71,14 @@ public class CIMReferencesOp extends CIMOperation { * @param pIncludeClassOrigin * @param pPropertyList */ - public CIMReferencesOp(CIMObjectPath pObjectName, String pResultClass, String pRole, - boolean pIncludeQualifiers, boolean pIncludeClassOrigin, String[] pPropertyList) { + public CIMReferencesOp( + CIMObjectPath pObjectName, + String pResultClass, + String pRole, + boolean pIncludeQualifiers, + boolean pIncludeClassOrigin, + String[] pPropertyList + ) { this.iMethodCall = "References"; this.iObjectName = pObjectName; this.iResultClass = pResultClass; @@ -84,7 +89,7 @@ public CIMReferencesOp(CIMObjectPath pObjectName, String pResultClass, String pR /** * Returns includeClassOrigin - * + * * @return The value of includeClassOrigin. */ public boolean isIncludeClassOrigin() { @@ -93,7 +98,7 @@ public boolean isIncludeClassOrigin() { /** * Returns includeQualifiers - * + * * @return The value of includeQualifiers. */ public boolean isIncludeQualifiers() { @@ -102,7 +107,7 @@ public boolean isIncludeQualifiers() { /** * Returns propertyList - * + * * @return The value of propertyList. */ public String[] getPropertyList() { @@ -111,7 +116,7 @@ public String[] getPropertyList() { /** * Returns resultClass - * + * * @return The value of resultClass. */ public String getResultClass() { @@ -120,11 +125,10 @@ public String getResultClass() { /** * Returns role - * + * * @return The value of role. */ public String getRole() { return this.iRole; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMSetClassOp.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMSetClassOp.java index 2f00ca6..ecc16a1 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMSetClassOp.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMSetClassOp.java @@ -49,15 +49,14 @@ /** * CIMSetClassOp - * + * */ public class CIMSetClassOp extends CIMOperation { - protected CIMClass iCimClass; /** * Ctor. - * + * * @param objectName * @param cimClass */ @@ -69,11 +68,10 @@ public CIMSetClassOp(CIMObjectPath objectName, CIMClass cimClass) { /** * Returns cimClass - * + * * @return The value of cimClass. */ public CIMClass getCimClass() { return this.iCimClass; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMSetInstanceOp.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMSetInstanceOp.java index 8e6adf5..160f299 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMSetInstanceOp.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMSetInstanceOp.java @@ -49,10 +49,9 @@ /** * CIMSetInstanceOp - * + * */ public class CIMSetInstanceOp extends CIMOperation { - protected CIMInstance iInstance; protected boolean iIncludeQualifiers; @@ -61,14 +60,18 @@ public class CIMSetInstanceOp extends CIMOperation { /** * Ctor. - * + * * @param objectName * @param instance * @param includeQualifiers * @param propertyList */ - public CIMSetInstanceOp(CIMObjectPath objectName, CIMInstance instance, - boolean includeQualifiers, String[] propertyList) { + public CIMSetInstanceOp( + CIMObjectPath objectName, + CIMInstance instance, + boolean includeQualifiers, + String[] propertyList + ) { this.iMethodCall = "SetInstance"; this.iObjectName = objectName; this.iInstance = instance; @@ -78,7 +81,7 @@ public CIMSetInstanceOp(CIMObjectPath objectName, CIMInstance instance, /** * Returns includeQualifiers - * + * * @return The value of includeQualifiers. */ public boolean isIncludeQualifiers() { @@ -87,7 +90,7 @@ public boolean isIncludeQualifiers() { /** * Returns instance - * + * * @return The value of instance. */ public CIMInstance getInstance() { @@ -96,11 +99,10 @@ public CIMInstance getInstance() { /** * Returns propertyList - * + * * @return The value of propertyList. */ public String[] getPropertyList() { return this.iPropertyList; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMSetPropertyOp.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMSetPropertyOp.java index 0d329dd..eebfeb4 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMSetPropertyOp.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMSetPropertyOp.java @@ -48,17 +48,16 @@ /** * CIMSetPropertyOp - * + * */ public class CIMSetPropertyOp extends CIMOperation { - protected String iPropertyName; protected Object iCimValue; /** * Ctor. - * + * * @param objectName * @param propertyName * @param cimValue @@ -72,7 +71,7 @@ public CIMSetPropertyOp(CIMObjectPath objectName, String propertyName, Object ci /** * Returns cimValue - * + * * @return The value of cimValue. */ public Object getCimValue() { @@ -81,11 +80,10 @@ public Object getCimValue() { /** * Returns propertyName - * + * * @return The value of propertyName. */ public String getPropertyName() { return this.iPropertyName; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMSetQualifierTypeOp.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMSetQualifierTypeOp.java index 9bbb945..2e8a77f 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMSetQualifierTypeOp.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMSetQualifierTypeOp.java @@ -50,15 +50,14 @@ /** * CIMSetQualifierTypeOp - * + * */ public class CIMSetQualifierTypeOp extends CIMOperation { - protected CIMQualifierType iQualifierType; /** * Ctor. - * + * * @param objectName * @param qualifierType */ @@ -70,11 +69,10 @@ public CIMSetQualifierTypeOp(CIMObjectPath objectName, CIMQualifierType quali /** * Returns qualifierType - * + * * @return The value of qualifierType. */ public CIMQualifierType getQualifierType() { return this.iQualifierType; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMSingleResultOperation.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMSingleResultOperation.java index eae45e8..7721d52 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMSingleResultOperation.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/wbem/operations/CIMSingleResultOperation.java @@ -46,25 +46,25 @@ */ import java.util.Vector; - import org.metricshub.wbem.javax.wbem.WBEMException; /** * CIMSingleResultOperation - * + * */ -abstract public class CIMSingleResultOperation extends CIMOperation { +public abstract class CIMSingleResultOperation extends CIMOperation { /* * (non-Javadoc) - * + * * @see org.sblim.wbem.client.operations.CIMOperation#getResult() */ @Override public Object getResult() throws WBEMException { if (this.iResult instanceof Exception) throw (WBEMException) this.iResult; - if (this.iResult instanceof Vector && ((Vector) this.iResult).size() > 0) return ((Vector) this.iResult) - .elementAt(0); + if (this.iResult instanceof Vector && ((Vector) this.iResult).size() > 0) return ( + (Vector) this.iResult + ).elementAt(0); return null; } } diff --git a/src/main/java/org/metricshub/wbem/sblim/slp/Advertiser.java b/src/main/java/org/metricshub/wbem/sblim/slp/Advertiser.java index 2ed1dd1..1c2cd11 100644 --- a/src/main/java/org/metricshub/wbem/sblim/slp/Advertiser.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/Advertiser.java @@ -56,10 +56,9 @@ * created, deregistrations of service instances are made for all locales. */ public interface Advertiser { - /** * Return the language locale with which this object was created. - * + * * @return The locale */ public abstract Locale getLocale(); @@ -68,7 +67,7 @@ public interface Advertiser { * Register a new service with SLP having the given attributes. The API * library is required to perform the operation in all scopes obtained * through configuration. - * + * * @param pURL * The URL for the service. * @param pAttributes @@ -77,14 +76,14 @@ public interface Advertiser { * @throws ServiceLocationException */ public abstract void register(ServiceURL pURL, Vector pAttributes) - throws ServiceLocationException; + throws ServiceLocationException; /** * Deregister a service from the SLP framework. This has the effect of * deregistering the service from every language locale. The API library is * required to perform the operation in all scopes obtained through * configuration. - * + * * @param pURL * The URL for the service. * @throws ServiceLocationException @@ -95,7 +94,7 @@ public abstract void register(ServiceURL pURL, Vector * Update the registration by adding the given attributes. The API library * is required to perform the operation in all scopes obtained through * configuration. - * + * * @param pURL * The URL for the service. * @param pAttributes @@ -105,13 +104,13 @@ public abstract void register(ServiceURL pURL, Vector * @throws ServiceLocationException */ public abstract void addAttributes(ServiceURL pURL, Vector pAttributes) - throws ServiceLocationException; + throws ServiceLocationException; /** * Delete the attributes from a URL for the locale with which the Advertiser * was created. The API library is required to perform the operation in all * scopes obtained through configuration. - * + * * @param pURL * The URL for the service. * @param pAttributeIds @@ -123,6 +122,5 @@ public abstract void addAttributes(ServiceURL pURL, Vector pAttributeIds) - throws ServiceLocationException; + public abstract void deleteAttributes(ServiceURL pURL, Vector pAttributeIds) throws ServiceLocationException; } diff --git a/src/main/java/org/metricshub/wbem/sblim/slp/Locator.java b/src/main/java/org/metricshub/wbem/sblim/slp/Locator.java index 3babc9a..8d8652d 100644 --- a/src/main/java/org/metricshub/wbem/sblim/slp/Locator.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/Locator.java @@ -57,10 +57,9 @@ * for service types are independent of locale. */ public interface Locator { - /** * Return the language locale with which this object was created. - * + * * @return The locale */ public abstract Locale getLocale(); @@ -69,7 +68,7 @@ public interface Locator { * Returns an enumeration of ServiceType objects giving known service types * for the given scopes and given naming authority. If no service types are * found, an empty enumeration is returned. - * + * * @param pNamingAuthority * The naming authority. Use "" for the default naming authority * and "*" for all naming authorities. @@ -80,8 +79,8 @@ public interface Locator { * @return The enumeration * @throws ServiceLocationException */ - public abstract ServiceLocationEnumeration findServiceTypes(String pNamingAuthority, - Vector pScopes) throws ServiceLocationException; + public abstract ServiceLocationEnumeration findServiceTypes(String pNamingAuthority, Vector pScopes) + throws ServiceLocationException; /** * Returns an enumeration of ServiceType objects giving known service types @@ -89,7 +88,7 @@ public abstract ServiceLocationEnumeration findServiceTypes(String pNamingAuthor * found, an empty enumeration is returned.
      *
      * This method is not part of the RFC 2614 interface definition. - * + * * @param pNamingAuthority * The naming authority. Use "" for the default naming authority * and "*" for all naming authorities. @@ -100,19 +99,22 @@ public abstract ServiceLocationEnumeration findServiceTypes(String pNamingAuthor * @param pDirectoryAgent * A vector of InetAddress that specify the directory agents to * look for. - * + * * @return The enumeration * @throws ServiceLocationException */ - public abstract ServiceLocationEnumeration findServiceTypes(String pNamingAuthority, - Vector pScopes, Vector pDirectoryAgent) - throws ServiceLocationException; + public abstract ServiceLocationEnumeration findServiceTypes( + String pNamingAuthority, + Vector pScopes, + Vector pDirectoryAgent + ) + throws ServiceLocationException; /** * Returns a vector of ServiceURL objects for services matching the query, * and having a matching type in the given scopes. If no services are found, * an empty enumeration is returned. - * + * * @param pType * The SLP service type of the service. * @param pScopes @@ -125,12 +127,16 @@ public abstract ServiceLocationEnumeration findServiceTypes(String pNamingAuthor * scopes are returned. SLP reserved characters must be escaped * in the query. Use ServiceLocationAttribute.escapeId() and * ServiceLocationAttribute.escapeValue() to construct the query. - * + * * @return The enumeration * @throws ServiceLocationException */ - public abstract ServiceLocationEnumeration findServices(ServiceType pType, - Vector pScopes, String pSearchFilter) throws ServiceLocationException; + public abstract ServiceLocationEnumeration findServices( + ServiceType pType, + Vector pScopes, + String pSearchFilter + ) + throws ServiceLocationException; /** * Returns a vector of ServiceURL objects for services matching the query, @@ -138,7 +144,7 @@ public abstract ServiceLocationEnumeration findServices(ServiceType pType, * an empty enumeration is returned.
      *
      * This method is not part of the RFC 2614 interface definition. - * + * * @param pType * The SLP service type of the service. * @param pScopes @@ -154,20 +160,24 @@ public abstract ServiceLocationEnumeration findServices(ServiceType pType, * @param pDirectoryAgents * A vector of InetAddress that specify the directory agents to * look for. - * + * * @return The enumeration * @throws ServiceLocationException */ - public abstract ServiceLocationEnumeration findServices(ServiceType pType, - Vector pScopes, String pSearchFilter, Vector pDirectoryAgents) - throws ServiceLocationException; + public abstract ServiceLocationEnumeration findServices( + ServiceType pType, + Vector pScopes, + String pSearchFilter, + Vector pDirectoryAgents + ) + throws ServiceLocationException; /** * For the URL and scope, return a Vector of ServiceLocationAttribute * objects whose ids match the String patterns in the attributeIds Vector. * The request is made in the language locale of the Locator. If no * attributes match, an empty enumeration is returned. - * + * * @param URL * The URL for which the attributes are desired. * @param scopes @@ -183,8 +193,12 @@ public abstract ServiceLocationEnumeration findServices(ServiceType pType, * @return The enumeration * @throws ServiceLocationException */ - public abstract ServiceLocationEnumeration findAttributes(ServiceURL URL, - Vector scopes, Vector attributeIds) throws ServiceLocationException; + public abstract ServiceLocationEnumeration findAttributes( + ServiceURL URL, + Vector scopes, + Vector attributeIds + ) + throws ServiceLocationException; /** * For the URL and scope, return a Vector of ServiceLocationAttribute @@ -193,7 +207,7 @@ public abstract ServiceLocationEnumeration findAttributes(ServiceURL URL, * attributes match, an empty enumeration is returned.
      *
      * This method is not part of the RFC 2614 interface definition. - * + * * @param pURL * The URL for which the attributes are desired. * @param pScopes @@ -211,18 +225,22 @@ public abstract ServiceLocationEnumeration findAttributes(ServiceURL URL, * look for. * @return The enumeration * @throws ServiceLocationException - * + * */ - public abstract ServiceLocationEnumeration findAttributes(ServiceURL pURL, - Vector pScopes, Vector pAttributeIds, - Vector pDirectoryAgents) throws ServiceLocationException; + public abstract ServiceLocationEnumeration findAttributes( + ServiceURL pURL, + Vector pScopes, + Vector pAttributeIds, + Vector pDirectoryAgents + ) + throws ServiceLocationException; /** * For the type and scope, return a Vector of all ServiceLocationAttribute * objects whose ids match the String patterns in the attributeIds Vector * regardless of the Locator's locale. The request is made independent of * language locale. If no attributes are found, an empty vector is returned. - * + * * @param pType * The service type. * @param pScopes @@ -239,8 +257,12 @@ public abstract ServiceLocationEnumeration findAttributes(ServiceURL pURL, * @return The enumeration * @throws ServiceLocationException */ - public abstract ServiceLocationEnumeration findAttributes(ServiceType pType, - Vector pScopes, Vector pAttributeIds) throws ServiceLocationException; + public abstract ServiceLocationEnumeration findAttributes( + ServiceType pType, + Vector pScopes, + Vector pAttributeIds + ) + throws ServiceLocationException; /** * For the type and scope, return a Vector of all ServiceLocationAttribute @@ -249,7 +271,7 @@ public abstract ServiceLocationEnumeration findAttributes(ServiceType pType, * language locale. If no attributes are found, an empty vector is returned.
      *
      * This method is not part of the RFC 2614 interface definition. - * + * * @param pType * The service type. * @param pScopes @@ -269,8 +291,11 @@ public abstract ServiceLocationEnumeration findAttributes(ServiceType pType, * @return The enumeration * @throws ServiceLocationException */ - public abstract ServiceLocationEnumeration findAttributes(ServiceType pType, - Vector pScopes, Vector pAttributeIds, - Vector pDirectoryAgents) throws ServiceLocationException; - + public abstract ServiceLocationEnumeration findAttributes( + ServiceType pType, + Vector pScopes, + Vector pAttributeIds, + Vector pDirectoryAgents + ) + throws ServiceLocationException; } diff --git a/src/main/java/org/metricshub/wbem/sblim/slp/SLPConfigProperties.java b/src/main/java/org/metricshub/wbem/sblim/slp/SLPConfigProperties.java index ef7c238..7f2f57f 100644 --- a/src/main/java/org/metricshub/wbem/sblim/slp/SLPConfigProperties.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/SLPConfigProperties.java @@ -50,10 +50,9 @@ * configuration properties of the SLP package. To set a property call * System.setProperty(name, value). Note that these properties have * global VM scope. - * + * */ public interface SLPConfigProperties { - /** * A URL string giving the location of the SLP config file.
      *
      @@ -358,7 +357,7 @@ public interface SLPConfigProperties { * Default is 10.
      *
      * SBLIM specific extension to RFC 2614 - * + * */ public static final String NET_SLP_SERVER_SOCKET_QUEUE_LENGTH = "net.slp.serverSocketQueueLength"; @@ -368,7 +367,7 @@ public interface SLPConfigProperties { * The default is 20000 ms.
      *
      * SBLIM specific extension to RFC 2614 - * + * */ public static final String NET_SLP_TCPTIMEOUT = "net.slp.TCPTimeout"; @@ -423,7 +422,7 @@ public interface SLPConfigProperties { *
      * (|(service-type=service:imap)(service-type=service:pop3))
      *
      - * + * * The API library can also use unicast to contact the discovered SAs for * subsequent requests for these service types, to optimize network access.
      *
      @@ -455,5 +454,4 @@ public interface SLPConfigProperties { * Not evaluated by SBLIM SLP client */ public static final String NET_SLP_TRC_LEVEL = "net.slp.trc.level"; - } diff --git a/src/main/java/org/metricshub/wbem/sblim/slp/ServiceLocationAttribute.java b/src/main/java/org/metricshub/wbem/sblim/slp/ServiceLocationAttribute.java index 4fcb435..1b531d2 100644 --- a/src/main/java/org/metricshub/wbem/sblim/slp/ServiceLocationAttribute.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/ServiceLocationAttribute.java @@ -58,18 +58,15 @@ import java.util.Arrays; import java.util.StringTokenizer; import java.util.Vector; - import org.metricshub.wbem.sblim.cimclient.GenericExts; import org.metricshub.wbem.sblim.slp.internal.AttributeHandler; import org.metricshub.wbem.sblim.slp.internal.Convert; import org.metricshub.wbem.sblim.slp.internal.SLPString; - /** * Service location attribute */ public class ServiceLocationAttribute implements Serializable { - private static final long serialVersionUID = -6753246108754657715L; private Vector iValues; @@ -79,7 +76,7 @@ public class ServiceLocationAttribute implements Serializable { /** * Construct a service location attribute. Errors in the id or values vector * result in an IllegalArgumentException. - * + * * @param pId * The attribute name. The String can consist of any Unicode * character. @@ -99,7 +96,7 @@ public ServiceLocationAttribute(String pId, Vector pValues) { /** * Construct a service location attribute from a String. - * + * * @param pString * The string to parse * @throws ServiceLocationException @@ -107,25 +104,28 @@ public ServiceLocationAttribute(String pId, Vector pValues) { */ public ServiceLocationAttribute(String pString) throws ServiceLocationException { if (pString == null || pString.length() == 0) throw new ServiceLocationException( - ServiceLocationException.PARSE_ERROR, - "Empty or null String is not good for this constructor!"); + ServiceLocationException.PARSE_ERROR, + "Empty or null String is not good for this constructor!" + ); if (pString.startsWith("(") && pString.endsWith(")")) { int equalPos = pString.indexOf('='); if (equalPos < 0) throw new ServiceLocationException( - ServiceLocationException.PARSE_ERROR, "Missing '=' from attribute string: " - + pString); + ServiceLocationException.PARSE_ERROR, + "Missing '=' from attribute string: " + pString + ); this.iId = Convert.unescape(pString.substring(1, equalPos)); if (this.iId.length() == 0) throw new ServiceLocationException( - ServiceLocationException.PARSE_ERROR, - "Empty attribute ID in attribute string: " + pString); + ServiceLocationException.PARSE_ERROR, + "Empty attribute ID in attribute string: " + pString + ); String valueString = pString.substring(equalPos + 1, pString.length() - 1); parseValueString(valueString); - } else { if (pString.indexOf('(') >= 0 || pString.indexOf(')') >= 0) throw new ServiceLocationException( - ServiceLocationException.PARSE_ERROR); + ServiceLocationException.PARSE_ERROR + ); this.iId = Convert.unescape(pString); this.iValues = null; } @@ -136,7 +136,7 @@ public ServiceLocationAttribute(String pString) throws ServiceLocationException * a query. Any reserved characters as specified in [7] are escaped using * UTF-8 encoding. If any characters in the tag are illegal, throws * IllegalArgumentException. - * + * * @param pId * The attribute id to escape. ServiceLocationException is thrown * if any characters are illegal for an attribute tag. @@ -156,7 +156,7 @@ public static String escapeId(String pId) { * is a Boolean or Integer, then the returned string contains the object * converted into a string. If the value is any type other than String, * Integer, Boolean or byte[], an IllegalArgumentException is thrown. - * + * * @param pValue * The attribute value to be converted into a string and escaped. * @return The escaped value @@ -169,9 +169,9 @@ public static String escapeValue(Object pValue) { * Returns a cloned vector of attribute values, or null if the attribute is * a keyword attribute. If the attribute is single-valued, then the vector * contains only one object. - * + * * @return The value vector - * + * */ public Vector getValues() { if (this.iValues != null) return GenericExts.cloneVector(this.iValues); @@ -180,7 +180,7 @@ public Vector getValues() { /** * Returns the attribute's name. - * + * * @return The name (id) */ public String getId() { @@ -189,9 +189,9 @@ public String getId() { /* * (non-Javadoc) - * + * * @see java.lang.Object#equals(java.lang.Object) - * + * * Overrides Object.equals(). Two attributes are equal if their identifiers * are equal and their value vectors contain the same number of equal values * as determined by the Object equals() method. Values having byte[] type @@ -220,9 +220,9 @@ public boolean equals(Object obj) { /* * (non-Javadoc) - * + * * @see java.lang.Object#toString() - * + * * Overrides Object.toString(). The string returned contains a formatted * representation of the attribute, giving the attribute's id, values, and * the Java type of the values. The returned string is suitable for @@ -243,7 +243,6 @@ public String toString() { if (obj instanceof byte[]) obj = AttributeHandler.mkOpaqueStr((byte[]) obj); stringbuffer.append(obj.toString()); } - } stringbuffer.append(")"); return stringbuffer.toString(); @@ -258,9 +257,9 @@ private void incHashCode(int pHashCode) { /* * (non-Javadoc) - * + * * @see java.lang.Object#hashCode() - * + * * Overrides Object.hashCode(). Hashes on the attribute's identifier. */ @Override @@ -269,8 +268,7 @@ public int hashCode() { this.iHashCode = this.iId.hashCode(); if (this.iValues != null) { ValueEntry[] valueEntries = getSortedValueEntries(); - for (int i = 0; i < valueEntries.length; i++) - incHashCode(valueEntries[i].hashCode()); + for (int i = 0; i < valueEntries.length; i++) incHashCode(valueEntries[i].hashCode()); } } return this.iHashCode; @@ -302,35 +300,37 @@ private void parseValueString(String pStr) throws ServiceLocationException { private static byte[] parseOpaqueStr(String pStr) throws ServiceLocationException { if (pStr.length() == 3) throw new ServiceLocationException( - ServiceLocationException.PARSE_ERROR, - "There must be at least three characters after \\FF in opaque string!" + " pStr=" - + pStr); + ServiceLocationException.PARSE_ERROR, + "There must be at least three characters after \\FF in opaque string!" + " pStr=" + pStr + ); ByteArrayOutputStream oStr = new ByteArrayOutputStream(); int pos = 3; // skip "\\FF" int left; while ((left = pStr.length() - pos) > 0) { - if (left < 3) throw new ServiceLocationException(ServiceLocationException.PARSE_ERROR, - "Number of characters must be multiple of three after \\FF in opaque string!" - + " pStr=" + pStr); + if (left < 3) throw new ServiceLocationException( + ServiceLocationException.PARSE_ERROR, + "Number of characters must be multiple of three after \\FF in opaque string!" + " pStr=" + pStr + ); if (pStr.charAt(pos) != '\\') throw new ServiceLocationException( - ServiceLocationException.PARSE_ERROR, - "Hex value must be preceded by \\ in opaque string!" + " pStr=" + pStr); + ServiceLocationException.PARSE_ERROR, + "Hex value must be preceded by \\ in opaque string!" + " pStr=" + pStr + ); String hexStr = pStr.substring(pos + 1, pos + 3); pos += 3; try { oStr.write(Integer.parseInt(hexStr, 16)); } catch (NumberFormatException e) { - throw new ServiceLocationException(ServiceLocationException.PARSE_ERROR, - "Failed to parse hex value: " + hexStr + " in opaque string: " + pStr - + " !"); + throw new ServiceLocationException( + ServiceLocationException.PARSE_ERROR, + "Failed to parse hex value: " + hexStr + " in opaque string: " + pStr + " !" + ); } } return oStr.toByteArray(); } static class ValueEntry implements Comparable { - /** * iStr */ @@ -354,8 +354,7 @@ public boolean equals(Object pObj) { if (this.iValue == null) return that.iValue == null; if (that.iValue == null) return false; if (!this.iValue.getClass().equals(that.iValue.getClass())) return false; - if (this.iValue instanceof byte[]) return Arrays.equals((byte[]) this.iValue, - (byte[]) that.iValue); + if (this.iValue instanceof byte[]) return Arrays.equals((byte[]) this.iValue, (byte[]) that.iValue); if (this.iValue instanceof String) return this.iStr.equals(that.iStr); return this.iValue.equals(that.iValue); } @@ -364,14 +363,13 @@ public boolean equals(Object pObj) { public int hashCode() { return this.iStr == null ? 1 : this.iStr.hashCode(); } - } private transient ValueEntry[] iSortedValueEntries; /** * Used for equals check and hashCode calculation. - * + * * @param pAttrib * @return attribute values in unified order, which is : values are sorted * by theirs toString(). @@ -400,5 +398,4 @@ private ValueEntry[] getSortedValueEntries() { Arrays.sort(this.iSortedValueEntries); return this.iSortedValueEntries; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/slp/ServiceLocationAttributeDescriptor.java b/src/main/java/org/metricshub/wbem/sblim/slp/ServiceLocationAttributeDescriptor.java index b5b0029..9749da0 100644 --- a/src/main/java/org/metricshub/wbem/sblim/slp/ServiceLocationAttributeDescriptor.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/ServiceLocationAttributeDescriptor.java @@ -53,13 +53,12 @@ * particular service location attribute definition from the service template. * This information is primarily for GUI tools. Programmatic attribute * verification should be done through the ServiceLocationAttributeVerifier. - * + * */ public interface ServiceLocationAttributeDescriptor { - /** * Return a String containing the attribute's id. - * + * * @return The id */ public abstract String getId(); @@ -94,14 +93,14 @@ public interface ServiceLocationAttributeDescriptor { * "" (empty string) * * - * + * * @return The Java type */ public abstract String getValueType(); /** * Return a String containing the attribute's help text. - * + * * @return The description */ public abstract String getDescription(); @@ -110,7 +109,7 @@ public interface ServiceLocationAttributeDescriptor { * Return an Enumeration of allowed values for the attribute type. For * keyword attributes returns null. For no allowed values (i.e. * unrestricted) returns an empty Enumeration. - * + * * @return The allowed values */ public abstract Enumeration getAllowedValues(); @@ -119,7 +118,7 @@ public interface ServiceLocationAttributeDescriptor { * Return an Enumeration of default values for the attribute type. For * keyword attributes returns null. For no allowed values (i.e. * unrestricted) returns an empty Enumeration. - * + * * @return The default values */ public abstract Enumeration getDefaultValues(); @@ -127,38 +126,37 @@ public interface ServiceLocationAttributeDescriptor { /** * Returns true if the "X" flag is set, indicating that the attribute should * be included in an any Locator.findServices() request search filter. - * + * * @return true if "X" is set, false otherwise */ public abstract boolean getRequiresExplicitMatch(); /** * Returns true if the "M" flag is set. - * + * * @return true if "M" is set, false otherwise */ public abstract boolean getIsMultivalued(); /** * Returns true if the "O"" flag is set. - * + * * @return true if "O" is set, false otherwise */ public abstract boolean getIsOptional(); /** * Returns true if the "L" flag is set. - * + * * @return true if "L" is set, false otherwise */ public abstract boolean getIsLiteral(); /** * Returns true if the attribute is a keyword attribute. - * + * * @return true if the attribute is a keyword, * false otherwise */ public abstract boolean getIsKeyword(); - } diff --git a/src/main/java/org/metricshub/wbem/sblim/slp/ServiceLocationAttributeVerifier.java b/src/main/java/org/metricshub/wbem/sblim/slp/ServiceLocationAttributeVerifier.java index c9431b0..0223420 100644 --- a/src/main/java/org/metricshub/wbem/sblim/slp/ServiceLocationAttributeVerifier.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/ServiceLocationAttributeVerifier.java @@ -55,42 +55,41 @@ * ServiceLocationAttribute object matches a template for a particular service * type. Clients obtain ServiceLocationAttributeVerifier objects for specific * SLP service types through the TemplateRegistry. - * - * + * + * */ public interface ServiceLocationAttributeVerifier { - /** * Returns the SLP service type for which this is the verifier. - * + * * @return The service type */ public abstract ServiceType getServiceType(); /** * Return the language locale of the template. - * + * * @return The locale */ public abstract Locale getLocale(); /** * Return the template version number identifier. - * + * * @return The version */ public abstract String getVersion(); /** * Return the URL syntax expression for the service: URL. - * + * * @return The url syntax */ public abstract String getURLSyntax(); /** * Return the descriptive help text for the template. - * + * * @return The description */ public abstract String getDescription(); @@ -101,7 +100,7 @@ public interface ServiceLocationAttributeVerifier { * This method is primarily for GUI tools to display attribute information. * Programmatic verification of attributes should use the verifyAttribute() * method. - * + * * @param pAttributeId * The attribute id * @return The descriptor @@ -115,7 +114,7 @@ public interface ServiceLocationAttributeVerifier { * method is primarily for GUI tools to display attribute information. * Programmatic verification of attributes should use the verifyAttribute() * method. - * + * * @return Enumeration of attribute descriptors */ public abstract Enumeration getAttributeDescriptors(); @@ -124,15 +123,14 @@ public interface ServiceLocationAttributeVerifier { * Verify that the attribute matches the template definition. If the * attribute doesn't match, ServiceLocationException is thrown with the * error code as ServiceLocationException.PARSE_ERROR. - * + * * @param pAttribute * The ServiceLocationAttribute object to be verified. * @throws ServiceLocationException * if validation failed - * + * */ - public abstract void verifyAttribute(ServiceLocationAttribute pAttribute) - throws ServiceLocationException; + public abstract void verifyAttribute(ServiceLocationAttribute pAttribute) throws ServiceLocationException; /** * Verify that the Vector of ServiceLocationAttribute objects matches the @@ -140,14 +138,12 @@ public abstract void verifyAttribute(ServiceLocationAttribute pAttribute) * attributes, and all attributes must match their template definitions. If * the attributes don't match, ServiceLocationException is thrown with the * error code as ServiceLocationException.PARSE_ERROR - * + * * @param pAttributeVector * A Vector of ServiceLocationAttribute objects for the * registration. * @throws ServiceLocationException * if attributes don't match */ - public abstract void verifyRegistration(Vector pAttributeVector) - throws ServiceLocationException; - + public abstract void verifyRegistration(Vector pAttributeVector) throws ServiceLocationException; } diff --git a/src/main/java/org/metricshub/wbem/sblim/slp/ServiceLocationEnumeration.java b/src/main/java/org/metricshub/wbem/sblim/slp/ServiceLocationEnumeration.java index 8045954..590b761 100644 --- a/src/main/java/org/metricshub/wbem/sblim/slp/ServiceLocationEnumeration.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/ServiceLocationEnumeration.java @@ -57,10 +57,9 @@ * unconcerned with SLP exceptions (this method will never ever throw one). */ public interface ServiceLocationEnumeration extends Enumeration { - /** * Return the next value or block until it becomes available. - * + * * @return The next value * @throws ServiceLocationException * Thrown if the SLP operation encounters an error. @@ -72,11 +71,11 @@ public interface ServiceLocationEnumeration extends Enumeration { /** * @return next Object in Exception table * @throws NoSuchElementException - * + * * This in internal implementation to get list of all exceptions * thrown/caught by parser This can throw RuntimeExceptions. * They can be ignored or used for analysis. - * + * * use hasNextException to check whether there exists another * element in Exception table */ @@ -84,7 +83,7 @@ public interface ServiceLocationEnumeration extends Enumeration { /** * @return true if there exists another element in Exception table - * + * */ public abstract boolean hasMoreExceptions(); } diff --git a/src/main/java/org/metricshub/wbem/sblim/slp/ServiceLocationException.java b/src/main/java/org/metricshub/wbem/sblim/slp/ServiceLocationException.java index 30c126d..5f97d96 100644 --- a/src/main/java/org/metricshub/wbem/sblim/slp/ServiceLocationException.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/ServiceLocationException.java @@ -50,7 +50,6 @@ * information. */ public class ServiceLocationException extends Exception { - private static final long serialVersionUID = 6414188770647750627L; /** @@ -175,19 +174,37 @@ public class ServiceLocationException extends Exception { */ public static final short PREVIOUS_RESPONDER_OVERFLOW = 100; - private static final String[] ERROR_MESSAGES = { "OK", "LANGUAGE_NOT_SUPPORTED", "PARSE_ERROR", - "INVALID_REGISTRATION", "SCOPE_NOT_SUPPORTED", "AUTHENTICATION_UNKNOWN", - "AUTHENTICATION_ABSENT", "AUTHENTICATION_FAILED", "", "VERSION_NOT_SUPPORTED", - "INTERNAL_ERROR", "DA_BUSY", "OPTION_NOT_SUPPORTED", "INVALID_UPDATE", - "REQUEST_NOT_SUPPORTED", "REFRESH_REJECTED", "NOT_IMPLEMENTED", "NETWORK_INIT_FAILED", - "NETWORK_TIMED_OUT", "NETWORK_ERROR", "INTERNAL_SYSTEM_ERROR", "TYPE_ERROR", - "BUFFER_OVERFLOW" }; + private static final String[] ERROR_MESSAGES = { + "OK", + "LANGUAGE_NOT_SUPPORTED", + "PARSE_ERROR", + "INVALID_REGISTRATION", + "SCOPE_NOT_SUPPORTED", + "AUTHENTICATION_UNKNOWN", + "AUTHENTICATION_ABSENT", + "AUTHENTICATION_FAILED", + "", + "VERSION_NOT_SUPPORTED", + "INTERNAL_ERROR", + "DA_BUSY", + "OPTION_NOT_SUPPORTED", + "INVALID_UPDATE", + "REQUEST_NOT_SUPPORTED", + "REFRESH_REJECTED", + "NOT_IMPLEMENTED", + "NETWORK_INIT_FAILED", + "NETWORK_TIMED_OUT", + "NETWORK_ERROR", + "INTERNAL_SYSTEM_ERROR", + "TYPE_ERROR", + "BUFFER_OVERFLOW" + }; private short iErrorCode; /** * Ctor. - * + * * @param pErrorCode * One of the ec constants in this class */ @@ -198,7 +215,7 @@ public ServiceLocationException(short pErrorCode) { /** * Ctor. - * + * * @param pErrorCode * One of the ec constants in this class * @param pCause @@ -211,13 +228,13 @@ public ServiceLocationException(short pErrorCode, Throwable pCause) { /** * Ctor. - * + * * @param pErrorCode * One of the ec constants in this class * @param pMessage * A more specific message * @param pCause - * + * */ public ServiceLocationException(short pErrorCode, String pMessage, Throwable pCause) { super(ERROR_MESSAGES[pErrorCode] + "(" + pMessage + ")", pCause); @@ -226,7 +243,7 @@ public ServiceLocationException(short pErrorCode, String pMessage, Throwable pCa /** * Ctor. - * + * * @param pErrorCode * One of the error code constants in this class * @param pMessage @@ -239,7 +256,7 @@ public ServiceLocationException(short pErrorCode, String pMessage) { /** * Return the error code. The error code takes on one of the static field * values. - * + * * @return The error code */ public short getErrorCode() { @@ -248,13 +265,14 @@ public short getErrorCode() { /** * Gets the message associated to this exception. - * + * * @return The message */ @Override public String getMessage() { - if (getCause() == null) { return super.getMessage(); } + if (getCause() == null) { + return super.getMessage(); + } return super.getMessage() + "; nested exception is: \n\t" + getCause().toString(); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/slp/ServiceLocationManager.java b/src/main/java/org/metricshub/wbem/sblim/slp/ServiceLocationManager.java index 5964a43..bfbfa85 100644 --- a/src/main/java/org/metricshub/wbem/sblim/slp/ServiceLocationManager.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/ServiceLocationManager.java @@ -48,7 +48,6 @@ import java.util.Locale; import java.util.Vector; - import org.metricshub.wbem.sblim.slp.internal.AdvertiserImpl; import org.metricshub.wbem.sblim.slp.internal.ua.LocatorImpl; @@ -56,7 +55,7 @@ * The ServiceLocationManager manages access to the service location framework. * Clients obtain the Locator and Advertiser objects for UA and SA, and a Vector * of known scope names from the ServiceLocationManager. - * + * */ public class ServiceLocationManager { @@ -66,9 +65,9 @@ public class ServiceLocationManager { * and, if used by the SA, assures that no refresh registration will be * rejected. If no DA advertises a min-refresh-interval attribute, a value * of 0 is returned. - * + * * Not yet implemented - * + * * @return The minimum refresh interval * @throws ServiceLocationException */ @@ -81,9 +80,9 @@ public static int getRefreshInterval() throws ServiceLocationException { * scopes comes from a variety of sources, see Section 2.1 for the scope * discovery algorithm. There is always at least one string in the Vector, * the default scope, "DEFAULT". - * + * * Not yet implemented - * + * * @return A Vector containing the scopes * @throws ServiceLocationException */ @@ -94,7 +93,7 @@ public static Vector findScopes() throws ServiceLocationException { /** * Return a Locator object for the given language locale. If the * implementation does not support UA functionality, returns null. - * + * * @param pLocale * The language locale of the Locator. The default SLP locale is * used if null. @@ -107,7 +106,7 @@ public static Locator getLocator(Locale pLocale) { /** * Return an Advertiser object for the given language locale. If the * implementation does not support SA functionality, returns null. - * + * * @param pLocale * The language locale of the Advertiser. The default SLP locale * is used if null. @@ -116,5 +115,4 @@ public static Locator getLocator(Locale pLocale) { public static Advertiser getAdvertiser(Locale pLocale) { return new AdvertiserImpl(pLocale); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/slp/ServiceType.java b/src/main/java/org/metricshub/wbem/sblim/slp/ServiceType.java index 1844899..30b7436 100644 --- a/src/main/java/org/metricshub/wbem/sblim/slp/ServiceType.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/ServiceType.java @@ -55,7 +55,6 @@ * abstract service types are all handled. */ public class ServiceType implements Serializable { - private static final long serialVersionUID = -4850546870881037017L; private boolean iIsServiceURL = true; @@ -67,10 +66,10 @@ public class ServiceType implements Serializable { private String iNamingAuthority = ""; /** - * + * * Constructs a service type object from the service type specifier. Throws * IllegalArgumentException if the type name is syntactically incorrect. - * + * * @param pType * The service type name as a String. If the service type is from * a service: URL, the "service:" prefix must be intact. @@ -81,7 +80,7 @@ public ServiceType(String pType) { /** * Returns true if the type name contains the "service:" prefix. - * + * * @return true if the type name contains the "service:" prefix */ public boolean isServiceURL() { @@ -90,7 +89,7 @@ public boolean isServiceURL() { /** * Returns true if the type name is for an abstract type. - * + * * @return true if the type name is for an abstract type */ public boolean isAbstractType() { @@ -100,7 +99,7 @@ public boolean isAbstractType() { /** * Returns true if the naming authority is the default, i.e. is the empty * string. - * + * * @return true if the naming authority is the default, i.e. is * the empty string */ @@ -113,7 +112,7 @@ public boolean isNADefault() { * if the service type is not abstract. For example, if the type name is * "service:printing:ipp", the method returns "ipp". If the type name is * "service:ftp", the method returns "". - * + * * @return true if the service type is not abstract */ public String getConcreteTypeName() { @@ -125,7 +124,7 @@ public String getConcreteTypeName() { * a protocol type, or the URL scheme for a generic URL. For example, in the * abstract type name "service:printing:ipp", the method returns "printing". * In the protocol type name "service:ftp", the method returns "ftp". - * + * * @return The principle type name */ public String getPrincipleTypeName() { @@ -138,19 +137,20 @@ public String getPrincipleTypeName() { * concrete type name or intervening colon. If not an abstract type, returns * the empty string. For example, in the abstract type name * "service:printing:ipp", the method returns "service:printing". - * + * * @return The abstract type name */ public String getAbstractTypeName() { - if (isAbstractType()) return "service:" + this.iPrincipleType - + (this.iNamingAuthority.length() <= 0 ? "" : "." + this.iNamingAuthority); + if (isAbstractType()) return ( + "service:" + this.iPrincipleType + (this.iNamingAuthority.length() <= 0 ? "" : "." + this.iNamingAuthority) + ); return ""; } /** * Return the naming authority name, or the empty string if the naming * authority is the default. - * + * * @return The naming authority */ public String getNamingAuthority() { @@ -159,9 +159,9 @@ public String getNamingAuthority() { /* * (non-Javadoc) - * + * * @see java.lang.Object#equals(java.lang.Object) - * + * * Overrides Object.equals(). The two objects are equal if they are both * ServiceType objects and the components of both are equal. */ @@ -171,35 +171,40 @@ public boolean equals(Object obj) { if (!(obj instanceof ServiceType)) return false; ServiceType servicetype = (ServiceType) obj; - return this.iIsServiceURL == servicetype.iIsServiceURL - && this.iPrincipleType.equals(servicetype.iPrincipleType) - && this.iAbstractType.equals(servicetype.iAbstractType) - && this.iNamingAuthority.equals(servicetype.iNamingAuthority); + return ( + this.iIsServiceURL == servicetype.iIsServiceURL && + this.iPrincipleType.equals(servicetype.iPrincipleType) && + this.iAbstractType.equals(servicetype.iAbstractType) && + this.iNamingAuthority.equals(servicetype.iNamingAuthority) + ); } /* * (non-Javadoc) - * + * * @see java.lang.Object#toString() - * + * * Returns the fully formatted type name, including the "service:" if the * type was originally from a service: URL. */ @Override public String toString() { // TODO: clean up this - return (this.iIsServiceURL ? "service:" : "") + this.iPrincipleType - + (this.iNamingAuthority.length() <= 0 ? "" : "." + this.iNamingAuthority) - + (this.iAbstractType.length() <= 0 ? "" : ":" + this.iAbstractType); + return ( + (this.iIsServiceURL ? "service:" : "") + + this.iPrincipleType + + (this.iNamingAuthority.length() <= 0 ? "" : "." + this.iNamingAuthority) + + (this.iAbstractType.length() <= 0 ? "" : ":" + this.iAbstractType) + ); } private int iHashCode = 0; /* * (non-Javadoc) - * + * * @see java.lang.Object#hashCode() - * + * * Overrides Object.hashCode(). Hashes on the string value of the "service" * prefix, naming authority, if any, abstract and concrete type names for * abstract types, protocol type name for protocol types, and URL scheme for @@ -215,7 +220,6 @@ private void parse(String pString) { StringTokenizer st = new StringTokenizer(pString, ":.", true); while (true) { try { - String token = st.nextToken(); if (token.equals(":") || token.equals(".")) continue; @@ -263,7 +267,9 @@ private static void validateTypeComponent(String str) { for (int pos = 0; pos < length; pos++) { char ch = str.charAt(pos); - if (!Character.isLetterOrDigit(ch) && ch != '+' && ch != '-') { throw new IllegalArgumentException(); } + if (!Character.isLetterOrDigit(ch) && ch != '+' && ch != '-') { + throw new IllegalArgumentException(); + } } } } diff --git a/src/main/java/org/metricshub/wbem/sblim/slp/ServiceURL.java b/src/main/java/org/metricshub/wbem/sblim/slp/ServiceURL.java index 1a12cde..e6cfeec 100644 --- a/src/main/java/org/metricshub/wbem/sblim/slp/ServiceURL.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/ServiceURL.java @@ -54,7 +54,6 @@ * subclass of java.net.URL but can't since that class is final. */ public class ServiceURL implements Serializable { - private static final long serialVersionUID = 8998115518853094365L; /** @@ -102,7 +101,7 @@ public class ServiceURL implements Serializable { /** * Construct a service URL object having the specified lifetime. - * + * * @param pServiceURL * The URL as a string. Must be either a service: URL or a valid * generic URL according to RFC 2396 [2]. @@ -112,14 +111,15 @@ public class ServiceURL implements Serializable { * LIFETIME_PERMANENT. */ public ServiceURL(String pServiceURL, int pLifetime) { - if (pLifetime > LIFETIME_MAXIMUM || pLifetime < LIFETIME_PERMANENT) throw new IllegalArgumentException( - "lifetime:" + pLifetime); + "lifetime:" + pLifetime + ); for (int i = 0; i < pServiceURL.length(); i++) { char c = pServiceURL.charAt(i); - if ("/:-.%_\'*()$!,+\\;@?&=[]".indexOf(c) == -1 && !Character.isLetterOrDigit(c)) { throw new IllegalArgumentException( - "invalid character: '" + c + "' on string \"" + pServiceURL + "\""); } + if ("/:-.%_\'*()$!,+\\;@?&=[]".indexOf(c) == -1 && !Character.isLetterOrDigit(c)) { + throw new IllegalArgumentException("invalid character: '" + c + "' on string \"" + pServiceURL + "\""); + } } parseURL(pServiceURL); @@ -130,7 +130,7 @@ public ServiceURL(String pServiceURL, int pLifetime) { /** * Returns the service type object representing the service type name of the * URL. - * + * * @return The service type */ public ServiceType getServiceType() { @@ -140,7 +140,7 @@ public ServiceType getServiceType() { /** * Set the service type name to the object. Ignored if the URL is a service: * URL. - * + * * @param pServicetype * The service type object. */ @@ -151,7 +151,7 @@ public void setServiceType(ServiceType pServicetype) { /** * Get the network layer transport identifier. If the transport is IP, an * empty string, "", is returned. - * + * * @return The NLT identifier */ public String getTransport() { @@ -162,7 +162,7 @@ public String getTransport() { /** * Returns the host identifier. For IP, this will be the machine name or IP * address. - * + * * @return The host */ public String getHost() { @@ -172,7 +172,7 @@ public String getHost() { /** * Returns the port number, if any. For non-IP transports, always returns * NO_PORT. - * + * * @return The port */ public int getPort() { @@ -181,7 +181,7 @@ public int getPort() { /** * Returns the URL path description, if any. - * + * * @return The URL path */ public String getURLPath() { @@ -191,7 +191,7 @@ public String getURLPath() { /** * Returns the service advertisement lifetime. This will be a positive int * between LIFETIME_NONE and LIFETIME_MAXIMUM. - * + * * @return The lifetime */ public int getLifetime() { @@ -200,9 +200,9 @@ public int getLifetime() { /* * (non-Javadoc) - * + * * @see java.lang.Object#equals(java.lang.Object) - * + * * Compares the object to the ServiceURL and returns true if the two are the * same. Two ServiceURL objects are equal if their current service types * match and they have the same host, port, transport, and URL path. @@ -214,16 +214,19 @@ public boolean equals(Object obj) { ServiceURL that = (ServiceURL) obj; - return equalObjs(this.iServiceType, that.iServiceType) - && equalStrs(this.iTransport, that.iTransport) && equalStrs(this.iHost, that.iHost) - && this.iPort == that.iPort; + return ( + equalObjs(this.iServiceType, that.iServiceType) && + equalStrs(this.iTransport, that.iTransport) && + equalStrs(this.iHost, that.iHost) && + this.iPort == that.iPort + ); } /* * (non-Javadoc) - * + * * @see java.lang.Object#toString() - * + * * Returns a formatted string with the URL. Overrides Object.toString(). The * returned URL has the original service type or URL scheme, not the current * service type. @@ -243,9 +246,9 @@ public String toString() { /* * (non-Javadoc) - * + * * @see java.lang.Object#hashCode() - * + * * Overrides Object.hashCode(). Hashes on the current service type, * transport, host, port, and URL part. !! in this case toString() must not * contain the lifeTime @@ -263,13 +266,13 @@ public int hashCode() { /** *
       	 * service: URL or URL
      -	 * 
      +	 *
       	 * "service:" srvtype "://" addrspec
       	 * "service:" abstract-type ":" concrete-type> "://" addrspecc
      -	 * 
      +	 *
       	 * addrspesc  = ( hostName / IPv4Address / IPv6Address ) [ ":" port ]
       	 * 
      - * + * * @param pUrlString * @throws IllegalArgumentException */ @@ -303,7 +306,8 @@ private void parseIPv6Address(String pAddrStr) throws IllegalArgumentException { this.iHost = pAddrStr.substring(0, colonIdx); if (colonIdx < pAddrStr.length()) { if (pAddrStr.charAt(colonIdx) != ':') throw new IllegalArgumentException( - "':' expected in \"" + pAddrStr + "\" at position " + colonIdx + " !"); + "':' expected in \"" + pAddrStr + "\" at position " + colonIdx + " !" + ); parsePort(pAddrStr.substring(colonIdx + 1), pAddrStr); } } @@ -322,8 +326,7 @@ private void parsePort(String pPortStr, String pAddrStr) throws IllegalArgumentE try { this.iPort = Integer.parseInt(pPortStr); } catch (NumberFormatException e) { - throw new IllegalArgumentException("Port field : " + pPortStr + " in " + pAddrStr - + " is invalid!"); + throw new IllegalArgumentException("Port field : " + pPortStr + " in " + pAddrStr + " is invalid!"); } } @@ -332,8 +335,6 @@ private static boolean equalObjs(Object pThis, Object pThat) { } private static boolean equalStrs(String pThis, String pThat) { - return (pThis == null || pThis.length() == 0) ? (pThat == null || pThat.length() == 0) - : pThis.equals(pThat); + return (pThis == null || pThis.length() == 0) ? (pThat == null || pThat.length() == 0) : pThis.equals(pThat); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/slp/TemplateRegistry.java b/src/main/java/org/metricshub/wbem/sblim/slp/TemplateRegistry.java index f31836a..c2c9f70 100644 --- a/src/main/java/org/metricshub/wbem/sblim/slp/TemplateRegistry.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/TemplateRegistry.java @@ -55,7 +55,7 @@ * that clients of the Advertiser are not required to verify attributes before * registering (though they may get a TYPE_ERROR if the implementation supports * type checking and there is a mismatch with the template). - * + * */ public abstract class TemplateRegistry { @@ -63,9 +63,9 @@ public abstract class TemplateRegistry { * Returns the distinguished TemplateRegistry object for performing * operations on and with service templates. Returns null if the * implementation doesn't support TemplateRegistry functionality. - * + * * Not yet implemented - * + * * @return The template registry */ public static TemplateRegistry getTemplateRegistry() { @@ -74,7 +74,7 @@ public static TemplateRegistry getTemplateRegistry() { /** * Register the service template with the template registry. - * + * * @param pType * The service type. * @param pDocumentURL @@ -87,12 +87,12 @@ public static TemplateRegistry getTemplateRegistry() { * The version number identifier of template document. * @throws ServiceLocationException */ - public abstract void registerServiceTemplate(ServiceType pType, String pDocumentURL, - Locale pLocale, String pVersion) throws ServiceLocationException; + public abstract void registerServiceTemplate(ServiceType pType, String pDocumentURL, Locale pLocale, String pVersion) + throws ServiceLocationException; /** * Deregister the template for the service type. - * + * * @param pType * The service type. * @param pLocale @@ -103,12 +103,12 @@ public abstract void registerServiceTemplate(ServiceType pType, String pDocument * the latest version. * @throws ServiceLocationException */ - public abstract void deregisterServiceTemplate(ServiceType pType, Locale pLocale, - String pVersion) throws ServiceLocationException; + public abstract void deregisterServiceTemplate(ServiceType pType, Locale pLocale, String pVersion) + throws ServiceLocationException; /** * Returns the URL for the template document. - * + * * @param pType * The service type. * @param pLocale @@ -121,14 +121,14 @@ public abstract void deregisterServiceTemplate(ServiceType pType, Locale pLocale * @throws ServiceLocationException */ public abstract String findTemplateURL(ServiceType pType, Locale pLocale, String pVersion) - throws ServiceLocationException; + throws ServiceLocationException; /** * Reads the template document URL and returns an attribute verifier for the * service type. The attribute verifier can be used for verifying that * registration attributes match the template, and for introspection on the * template definition. - * + * * @param pDocumentURL * A String containing the template document's URL. May not be * the empty string. @@ -136,6 +136,5 @@ public abstract String findTemplateURL(ServiceType pType, Locale pLocale, String * @throws ServiceLocationException */ public abstract ServiceLocationAttributeVerifier attributeVerifier(String pDocumentURL) - throws ServiceLocationException; - + throws ServiceLocationException; } diff --git a/src/main/java/org/metricshub/wbem/sblim/slp/internal/AdvertiserImpl.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/AdvertiserImpl.java index b015014..e9ed890 100644 --- a/src/main/java/org/metricshub/wbem/sblim/slp/internal/AdvertiserImpl.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/AdvertiserImpl.java @@ -23,15 +23,15 @@ package org.metricshub.wbem.sblim.slp.internal; -import org.metricshub.wbem.sblim.slp.ServiceLocationAttribute; -import org.metricshub.wbem.sblim.slp.ServiceURL; -import org.metricshub.wbem.sblim.slp.internal.msg.MsgFactory; -import org.metricshub.wbem.sblim.slp.internal.msg.SLPMessage; -import org.metricshub.wbem.sblim.slp.internal.msg.ServiceAcknowledgment; -import org.metricshub.wbem.sblim.slp.internal.msg.ServiceDeregistration; -import org.metricshub.wbem.sblim.slp.internal.msg.ServiceRegistration; -import org.metricshub.wbem.sblim.slp.internal.msg.Util; - +import java.io.IOException; +import java.net.DatagramPacket; +import java.net.DatagramSocket; +import java.net.InetAddress; +import java.net.SocketTimeoutException; +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; +import java.util.Vector; /*- * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ * WBEM Java Client @@ -53,26 +53,21 @@ */ import org.metricshub.wbem.sblim.slp.Advertiser; +import org.metricshub.wbem.sblim.slp.ServiceLocationAttribute; import org.metricshub.wbem.sblim.slp.ServiceLocationException; - -import java.io.IOException; -import java.net.DatagramPacket; -import java.net.DatagramSocket; -import java.net.InetAddress; -import java.net.SocketTimeoutException; -import java.util.ArrayList; -import java.util.List; -import java.util.Locale; -import java.util.Vector; - - +import org.metricshub.wbem.sblim.slp.ServiceURL; +import org.metricshub.wbem.sblim.slp.internal.msg.MsgFactory; +import org.metricshub.wbem.sblim.slp.internal.msg.SLPMessage; +import org.metricshub.wbem.sblim.slp.internal.msg.ServiceAcknowledgment; +import org.metricshub.wbem.sblim.slp.internal.msg.ServiceDeregistration; +import org.metricshub.wbem.sblim.slp.internal.msg.ServiceRegistration; +import org.metricshub.wbem.sblim.slp.internal.msg.Util; /** * AdvertiserImpl - * + * */ public class AdvertiserImpl implements Advertiser { - private Locale iLocale; private String iLangTag; @@ -89,7 +84,7 @@ public class AdvertiserImpl implements Advertiser { /** * Ctor. - * + * * @param pLocale */ public AdvertiserImpl(Locale pLocale) { @@ -105,7 +100,7 @@ public AdvertiserImpl(Locale pLocale) { * @throws ServiceLocationException */ public void addAttributes(ServiceURL pURL, Vector pAttributes) - throws ServiceLocationException { + throws ServiceLocationException { throw new ServiceLocationException(ServiceLocationException.NOT_IMPLEMENTED); } @@ -114,8 +109,7 @@ public void addAttributes(ServiceURL pURL, Vector pAtt * @param pAttributeIds * @throws ServiceLocationException */ - public void deleteAttributes(ServiceURL pURL, Vector pAttributeIds) - throws ServiceLocationException { + public void deleteAttributes(ServiceURL pURL, Vector pAttributeIds) throws ServiceLocationException { throw new ServiceLocationException(ServiceLocationException.NOT_IMPLEMENTED); } @@ -127,11 +121,8 @@ public Locale getLocale() { return this.iLocale; } - public void register(ServiceURL pURL, Vector pAttributes) - throws ServiceLocationException { - sendMessage(new ServiceRegistration(this.iLangTag, pURL, this.iDefScopeList, pAttributes, - null)); - + public void register(ServiceURL pURL, Vector pAttributes) throws ServiceLocationException { + sendMessage(new ServiceRegistration(this.iLangTag, pURL, this.iDefScopeList, pAttributes, null)); } private void sendMessage(SLPMessage pMsg) throws ServiceLocationException { @@ -148,12 +139,15 @@ private int unicast(SLPMessage pMsg) throws ServiceLocationException, IOExceptio DatagramSocket dgSocket = new DatagramSocket(); try { byte[] reqBytes = pMsg.serialize(false, true, false); - InetAddress loopback = this.iUseV6 ? SLPConfig.getLoopbackV6() : SLPConfig - .getLoopbackV4(); + InetAddress loopback = this.iUseV6 ? SLPConfig.getLoopbackV6() : SLPConfig.getLoopbackV4(); TRC.debug("loopback:" + loopback); - DatagramPacket outPacket = new DatagramPacket(reqBytes, reqBytes.length, loopback, - SLPConfig.getGlobalCfg().getPort()); + DatagramPacket outPacket = new DatagramPacket( + reqBytes, + reqBytes.length, + loopback, + SLPConfig.getGlobalCfg().getPort() + ); DatagramPacket inPacket = new DatagramPacket(this.iInBuf, this.iInBuf.length); int timeOutIdx = 0; @@ -181,5 +175,4 @@ private int unicast(SLPMessage pMsg) throws ServiceLocationException, IOExceptio TRC.warning("registration failed"); return ServiceLocationException.INVALID_REGISTRATION; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/slp/internal/AttributeHandler.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/AttributeHandler.java index 36ff919..71f7f28 100644 --- a/src/main/java/org/metricshub/wbem/sblim/slp/internal/AttributeHandler.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/AttributeHandler.java @@ -44,12 +44,11 @@ import java.util.Iterator; import java.util.Vector; - import org.metricshub.wbem.sblim.slp.ServiceLocationAttribute; /** * AttributeHandler - * + * */ public class AttributeHandler { @@ -77,8 +76,7 @@ public static String buildString(ServiceLocationAttribute pAttr) { Iterator itr = valVec.iterator(); boolean first = true; while (itr.hasNext()) { - if (first) first = false; - else buf.append(','); + if (first) first = false; else buf.append(','); buf.append(AttributeHandler.escapeValue(itr.next())); } buf.append(')'); @@ -88,7 +86,7 @@ public static String buildString(ServiceLocationAttribute pAttr) { /** * escapeValue - * + * * @param pValue * @return String */ @@ -101,14 +99,15 @@ public static String escapeValue(Object pValue) { return ((Boolean) pValue).toString(); } else if (pValue instanceof byte[]) { return AttributeHandler.mkOpaqueStr((byte[]) pValue); - } else if (pValue == null) { return ""; } - throw new IllegalArgumentException("Type: " + pValue.getClass().getName() - + " cannot be an attribute value!"); + } else if (pValue == null) { + return ""; + } + throw new IllegalArgumentException("Type: " + pValue.getClass().getName() + " cannot be an attribute value!"); } /** * mkOpaqueStr - * + * * @param pBytes * @return String */ @@ -123,5 +122,4 @@ public static String mkOpaqueStr(byte[] pBytes) { } return buf.toString(); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/slp/internal/Convert.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/Convert.java index 231b0f9..82638ee 100644 --- a/src/main/java/org/metricshub/wbem/sblim/slp/internal/Convert.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/Convert.java @@ -42,15 +42,13 @@ */ import java.io.UnsupportedEncodingException; - import org.metricshub.wbem.sblim.slp.ServiceLocationException; /** * Convert - * + * */ public class Convert { - /** * ATTR_RESERVED */ @@ -70,7 +68,7 @@ public class Convert { /** * getBytes - * + * * @param pStr * @return byte[] */ @@ -85,7 +83,7 @@ public static byte[] getBytes(String pStr) { /** * escape - * + * * @param pStr * @return String */ @@ -95,7 +93,7 @@ public static String escape(String pStr) { /** * escape - * + * * @param pStr * @param pReservedChars * @return String @@ -121,7 +119,7 @@ public static String escape(String pStr, String pReservedChars) { /** * unescape - * + * * @param pStr * @return String * @throws ServiceLocationException @@ -136,15 +134,14 @@ public static String unescape(String pStr) throws ServiceLocationException { resBuf.append(pStr.subSequence(lastPos, pos)).append(ch); lastPos = pos + 3; } - if (resBuf != null && lastPos < pStr.length()) resBuf.append(pStr.substring(lastPos, pStr - .length())); + if (resBuf != null && lastPos < pStr.length()) resBuf.append(pStr.substring(lastPos, pStr.length())); return resBuf == null ? pStr : resBuf.toString(); } /** * The escape character is a backslash (UTF-8 0x5c) followed by the two * hexadecimal digits of the escaped character. -> Character code is ASCII. - * + * * @param ch * @return String */ @@ -156,16 +153,19 @@ private static String escapeChar(char ch) { private static char unescapeChar(String pEscSeq) throws ServiceLocationException { if (pEscSeq.length() < 3) throw new ServiceLocationException( - ServiceLocationException.PARSE_ERROR, - "Escaped character must contain 2 hex digits!\n" + "pEscSeq:" + pEscSeq); + ServiceLocationException.PARSE_ERROR, + "Escaped character must contain 2 hex digits!\n" + "pEscSeq:" + pEscSeq + ); String hexStr = pEscSeq.substring(1, 3); try { int code = Integer.parseInt(hexStr, 16); return (char) code; } catch (NumberFormatException e) { - throw new ServiceLocationException(ServiceLocationException.PARSE_ERROR, - "Failed to parse hex string: " + hexStr + ", pEscSeq=" + pEscSeq + " !", e); + throw new ServiceLocationException( + ServiceLocationException.PARSE_ERROR, + "Failed to parse hex string: " + hexStr + ", pEscSeq=" + pEscSeq + " !", + e + ); } } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/slp/internal/IPv6MulticastAddressFactory.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/IPv6MulticastAddressFactory.java index 5548585..f39b9fa 100644 --- a/src/main/java/org/metricshub/wbem/sblim/slp/internal/IPv6MulticastAddressFactory.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/IPv6MulticastAddressFactory.java @@ -42,7 +42,6 @@ import java.net.InetAddress; import java.net.UnknownHostException; - import org.metricshub.wbem.sblim.slp.ServiceType; import org.metricshub.wbem.sblim.slp.internal.msg.AttributeRequest; import org.metricshub.wbem.sblim.slp.internal.msg.SLPMessage; @@ -55,30 +54,26 @@ * - SRVTYPERQST Service Type Request * - ATTRRQST Attribute Request * - UA sends too - * + * * SVRLOC-DA group-id : FF0X:0:0:0:0:0:0:123 * - SRVRQST for the "service:directory-agent" service type * - UA sends too - * + * * 1000 - 13FF: SRVRQST : FF0X:0:0:0:0:0:1:.... * - the ID is the hashcode of the Service Type string used in the SrvRqst. * - UA sends too * */ public class IPv6MulticastAddressFactory { + private static final byte[] SRVLOC = { (byte) 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, (byte) 0x16 }; - private static final byte[] SRVLOC = { (byte) 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, - (byte) 0x16 }; + private static final byte[] SRVLOC_DA = { (byte) 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, (byte) 0x23 }; - private static final byte[] SRVLOC_DA = { (byte) 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, (byte) 0x23 }; - - private static final byte[] SRV_RQST = { (byte) 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, - 0 }; + private static final byte[] SRV_RQST = { (byte) 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 }; /** * getSrvLocAddress - * + * * @param pScope * @return InetAddress * @throws UnknownHostException @@ -90,25 +85,28 @@ public static InetAddress getSrvLocAddress(int pScope) throws UnknownHostExcepti /** * get - * + * * @param pScope * @param pMsg * @return InetAddress * @throws UnknownHostException */ public static InetAddress get(int pScope, SLPMessage pMsg) throws UnknownHostException { - if (pMsg instanceof ServiceTypeRequest || pMsg instanceof AttributeRequest) { return getSrvLocAddress(pScope); } + if (pMsg instanceof ServiceTypeRequest || pMsg instanceof AttributeRequest) { + return getSrvLocAddress(pScope); + } if (pMsg instanceof ServiceRequest) { ServiceRequest srvRqst = (ServiceRequest) pMsg; return get(pScope, srvRqst.getServiceType()); } - throw new IllegalArgumentException("Cannot determine IPv6 multicast address for " - + pMsg.getClass().getName() + " !"); + throw new IllegalArgumentException( + "Cannot determine IPv6 multicast address for " + pMsg.getClass().getName() + " !" + ); } /** * get - * + * * @param pScope * @param pSrvType * @return InetAddress @@ -124,7 +122,7 @@ public static InetAddress get(int pScope, ServiceType pSrvType) throws UnknownHo /** * get - * + * * @param pScope * @param pSrvHash * @return InetAddress @@ -149,7 +147,7 @@ public static InetAddress get(int pScope, int pSrvHash) throws UnknownHostExcept * return (0x3FF & h); // round to a range of 0-1023 * } * - * + * * @param pServiceType * @return int */ @@ -163,5 +161,4 @@ public static int getSrvTypeHash(ServiceType pServiceType) { } return (0x3ff & hash) + 0x1000; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/slp/internal/Net.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/Net.java index 01f864f..76c3edf 100644 --- a/src/main/java/org/metricshub/wbem/sblim/slp/internal/Net.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/Net.java @@ -50,15 +50,14 @@ /** * Net - * + * */ public class Net { - private static boolean cHasV6, cHasV4; /** * hasIPv6 - * + * * @return boolean */ public static boolean hasIPv6() { @@ -68,7 +67,7 @@ public static boolean hasIPv6() { /** * hasIPv4 - * + * * @return boolean */ public static boolean hasIPv4() { @@ -83,7 +82,7 @@ private static void scan() { try { cScanned = true; Enumeration ifaceEnum = NetworkInterface.getNetworkInterfaces(); - ifLoop: while (ifaceEnum.hasMoreElements()) { + ifLoop:while (ifaceEnum.hasMoreElements()) { NetworkInterface iface = ifaceEnum.nextElement(); Enumeration addrEnum = iface.getInetAddresses(); while (addrEnum.hasMoreElements()) { @@ -102,5 +101,4 @@ private static void scan() { TRC.error(e); } } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/slp/internal/SLPConfig.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/SLPConfig.java index 68580f0..bb1cc16 100644 --- a/src/main/java/org/metricshub/wbem/sblim/slp/internal/SLPConfig.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/SLPConfig.java @@ -59,19 +59,17 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; +import java.util.Map.Entry; import java.util.Properties; import java.util.StringTokenizer; -import java.util.Map.Entry; import java.util.logging.Level; - import org.metricshub.wbem.sblim.slp.SLPConfigProperties; /** * SLPConfig - * + * */ public final class SLPConfig { - private static InetAddress cBroadcastAddress; private static SLPConfig cInstance = null; @@ -113,7 +111,7 @@ private static InetAddress getByName(String pName) { /** * getBroadcastAddress - * + * * @return InetAddress */ public static InetAddress getBroadcastAddress() { @@ -122,7 +120,7 @@ public static InetAddress getBroadcastAddress() { /** * getGlobalCfg - * + * * @return SLPConfig */ public static synchronized SLPConfig getGlobalCfg() { @@ -134,7 +132,7 @@ public static synchronized SLPConfig getGlobalCfg() { /** * getLoopbackV4 - * + * * @return InetAddress */ public static InetAddress getLoopbackV4() { @@ -143,7 +141,7 @@ public static InetAddress getLoopbackV4() { /** * getLoopbackV6 - * + * * @return InetAddress */ public static InetAddress getLoopbackV6() { @@ -152,7 +150,7 @@ public static InetAddress getLoopbackV6() { /** * getMulticastAddress - * + * * @return InetAddress */ public static InetAddress getMulticastAddress() { @@ -161,7 +159,7 @@ public static InetAddress getMulticastAddress() { /** * getSRVLOC_MulticastAddress - * + * * @return InetAddress */ public static InetAddress getSRVLOC_MulticastAddress() { @@ -170,7 +168,7 @@ public static InetAddress getSRVLOC_MulticastAddress() { /** * getSRVLOC_DA_MulticastAddress - * + * * @return InetAddress */ public static InetAddress getSRVLOC_DA_MulticastAddress() { @@ -183,7 +181,6 @@ private static int getIntProperty(String pName, int pDefaultValue, int pMinValue } private SLPConfig() { - try { // try to load config class from CIM client. This will cause load of // the CIM client's config file. @@ -198,12 +195,9 @@ private SLPConfig() { if (inputstream != null) { slpProperties.load(inputstream); } - for (Iterator> iterator = slpProperties.entrySet().iterator(); iterator - .hasNext();) { + for (Iterator> iterator = slpProperties.entrySet().iterator(); iterator.hasNext();) { Entry entry = iterator.next(); - System - .setProperty(String.valueOf(entry.getKey()), String.valueOf(entry - .getValue())); + System.setProperty(String.valueOf(entry.getKey()), String.valueOf(entry.getValue())); } } catch (IOException e) { System.out.println("Error while parsing property file"); @@ -213,58 +207,62 @@ private SLPConfig() { /** * getActiveDiscoveryGranularity - * + * * @return int */ public int getActiveDiscoveryGranularity() { - return getIntProperty(SLPConfigProperties.NET_SLP_DA_ACTIVE_DISCOVERY_GRANULARITY, - SLPDefaults.ACTIVE_DISCOVERY_GRANULARITY, SLPLimits.MIN_DISCOVERY_GRANULARITY, - SLPLimits.MAX_DISCOVERY_GRANULARITY); + return getIntProperty( + SLPConfigProperties.NET_SLP_DA_ACTIVE_DISCOVERY_GRANULARITY, + SLPDefaults.ACTIVE_DISCOVERY_GRANULARITY, + SLPLimits.MIN_DISCOVERY_GRANULARITY, + SLPLimits.MAX_DISCOVERY_GRANULARITY + ); } /** * getActiveDiscoveryInterval - * + * * @return int */ public int getActiveDiscoveryInterval() { - int interval = getIntProperty(SLPConfigProperties.NET_SLP_DA_ACTIVE_DISCOVERY_INTERVAL, - SLPDefaults.ACTIVE_DISCOVERY_INTERVAL, SLPLimits.MIN_DISCOVERY_INTERVAL, - SLPLimits.MAX_DISCOVERY_INTERVAL); // 3mins - if (interval > 0 && interval < 300) { return 300; - // prevent network flooding + int interval = getIntProperty( + SLPConfigProperties.NET_SLP_DA_ACTIVE_DISCOVERY_INTERVAL, + SLPDefaults.ACTIVE_DISCOVERY_INTERVAL, + SLPLimits.MIN_DISCOVERY_INTERVAL, + SLPLimits.MAX_DISCOVERY_INTERVAL + ); // 3mins + if (interval > 0 && interval < 300) { + return 300; + // prevent network flooding } return interval; } /** * getDADiscoveryTimeouts - * + * * @return int[] */ public int[] getDADiscoveryTimeouts() { - return parseTimeouts(SLPConfigProperties.NET_SLP_DA_DISCOVERY_TIMEOUTS, - SLPDefaults.DA_DISCOVERY_TIMEOUTS); + return parseTimeouts(SLPConfigProperties.NET_SLP_DA_DISCOVERY_TIMEOUTS, SLPDefaults.DA_DISCOVERY_TIMEOUTS); } /** * getDatagramTimeouts - * + * * @return int[] */ public int[] getDatagramTimeouts() { - return parseTimeouts(SLPConfigProperties.NET_SLP_DATAGRAM_TIMEOUTS, - SLPDefaults.DATAGRAM_TIMEOUTS); + return parseTimeouts(SLPConfigProperties.NET_SLP_DATAGRAM_TIMEOUTS, SLPDefaults.DATAGRAM_TIMEOUTS); } /** * getInterfaces - * + * * @return List */ @SuppressWarnings("null") public List getInterfaces() { - String property = System.getProperty(SLPConfigProperties.NET_SLP_INTERFACES); List addresses = parseList(property); @@ -299,17 +297,16 @@ public List getInterfaces() { /** * getPort - * + * * @return int */ public int getPort() { - return Integer.getInteger(SLPConfigProperties.NET_SLP_PORT, SLPDefaults.SLP_PORT) - .intValue(); + return Integer.getInteger(SLPConfigProperties.NET_SLP_PORT, SLPDefaults.SLP_PORT).intValue(); } /** * setPort - * + * * @param pPort */ public void setPort(int pPort) { @@ -318,7 +315,7 @@ public void setPort(int pPort) { /** * getTraceLevel - * + * * @return String */ public Level getTraceLevel() { @@ -333,7 +330,7 @@ public Level getTraceLevel() { /** * setTraceLevel - * + * * @param pLevel */ public void setTraceLevel(String pLevel) { @@ -342,7 +339,7 @@ public void setTraceLevel(String pLevel) { /** * setUseIPv6 - * + * * @param pValue */ public void setUseIPv6(boolean pValue) { @@ -351,7 +348,7 @@ public void setUseIPv6(boolean pValue) { /** * useIPv6 - * + * * @return boolean */ public boolean useIPv6() { @@ -360,7 +357,7 @@ public boolean useIPv6() { /** * setUseIPv4 - * + * * @param pValue */ public void setUseIPv4(boolean pValue) { @@ -369,7 +366,7 @@ public void setUseIPv4(boolean pValue) { /** * useIPv4 - * + * * @return boolean */ public boolean useIPv4() { @@ -378,7 +375,7 @@ public boolean useIPv4() { /** * getLocalHost - * + * * @return InetAddress */ public InetAddress getLocalHost() { @@ -388,61 +385,63 @@ public InetAddress getLocalHost() { /** * getMaximumResults - * + * * @return int */ public int getMaximumResults() { - int value = Integer.getInteger(SLPConfigProperties.NET_SLP_MAX_RESULTS, - SLPDefaults.MAXIMUM_RESULTS).intValue(); - return (value >= 1 && value < SLPDefaults.MAXIMUM_RESULTS) ? value - : SLPDefaults.MAXIMUM_RESULTS; + int value = Integer.getInteger(SLPConfigProperties.NET_SLP_MAX_RESULTS, SLPDefaults.MAXIMUM_RESULTS).intValue(); + return (value >= 1 && value < SLPDefaults.MAXIMUM_RESULTS) ? value : SLPDefaults.MAXIMUM_RESULTS; } /** * getMTU - * + * * @return int */ public int getMTU() { - return getIntProperty(SLPConfigProperties.NET_SLP_MTU, SLPDefaults.MTU, SLPLimits.MIN_MTU, - SLPLimits.MAX_MTU); + return getIntProperty(SLPConfigProperties.NET_SLP_MTU, SLPDefaults.MTU, SLPLimits.MIN_MTU, SLPLimits.MAX_MTU); } /** * getMulticastMaximumWait - * + * * @return int */ public int getMulticastMaximumWait() { - return getIntProperty(SLPConfigProperties.NET_SLP_MULTICAST_MAXIMUM_WAIT, - SLPDefaults.MULTICAST_MAXIMUM_WAIT, SLPLimits.MIN_MULTICAST_MAXIMUM_WAIT, - SLPLimits.MAX_MULTICAST_MAXIMUM_WAIT); + return getIntProperty( + SLPConfigProperties.NET_SLP_MULTICAST_MAXIMUM_WAIT, + SLPDefaults.MULTICAST_MAXIMUM_WAIT, + SLPLimits.MIN_MULTICAST_MAXIMUM_WAIT, + SLPLimits.MAX_MULTICAST_MAXIMUM_WAIT + ); } /** * getMulticastRadius - * + * * @return int */ public int getMulticastRadius() { - return getIntProperty(SLPConfigProperties.NET_SLP_MULTICAST_TTL, - SLPDefaults.MULTICAST_RADIUS, SLPLimits.MIN_MULTICAST_RADIUS, - SLPLimits.MAX_MULTICAST_RADIUS); + return getIntProperty( + SLPConfigProperties.NET_SLP_MULTICAST_TTL, + SLPDefaults.MULTICAST_RADIUS, + SLPLimits.MIN_MULTICAST_RADIUS, + SLPLimits.MAX_MULTICAST_RADIUS + ); } /** * getMulticastTimeouts - * + * * @return int[] */ public int[] getMulticastTimeouts() { - return parseTimeouts(SLPConfigProperties.NET_SLP_MULTICAST_TIMEOUTS, - SLPDefaults.MULTICAST_TIMEOUTS); + return parseTimeouts(SLPConfigProperties.NET_SLP_MULTICAST_TIMEOUTS, SLPDefaults.MULTICAST_TIMEOUTS); } /** * getPreconfiguredDAs - * + * * @return List <InetAddress> */ public List getPreconfiguredDAs() { @@ -462,7 +461,7 @@ public List getPreconfiguredDAs() { /** * getConfiguredScopes - * + * * @return List<String> */ public List getConfiguredScopes() { @@ -474,7 +473,7 @@ public List getConfiguredScopes() { /** * getSAOnlyScopes - * + * * @return List<String> */ public List getSAOnlyScopes() { @@ -483,28 +482,35 @@ public List getSAOnlyScopes() { /** * getServerSocketQueueLength - * + * * @return int */ public int getServerSocketQueueLength() { - return getIntProperty(SLPConfigProperties.NET_SLP_SERVER_SOCKET_QUEUE_LENGTH, - SLPDefaults.SERVER_SOCKET_QUEUE_LENGTH, SLPLimits.MIN_SERVER_SOCKET_QUEUE_LENGTH, - SLPLimits.MAX_SERVER_SOCKET_QUEUE_LENGTH); + return getIntProperty( + SLPConfigProperties.NET_SLP_SERVER_SOCKET_QUEUE_LENGTH, + SLPDefaults.SERVER_SOCKET_QUEUE_LENGTH, + SLPLimits.MIN_SERVER_SOCKET_QUEUE_LENGTH, + SLPLimits.MAX_SERVER_SOCKET_QUEUE_LENGTH + ); } /** * getTCPTimeout - * + * * @return int */ public int getTCPTimeout() { - return getIntProperty(SLPConfigProperties.NET_SLP_TCPTIMEOUT, SLPDefaults.TCP_TIMEOUT, - SLPLimits.MIN_TCP_TIMEOUT, SLPLimits.MAX_TCP_TIMEOUT); + return getIntProperty( + SLPConfigProperties.NET_SLP_TCPTIMEOUT, + SLPDefaults.TCP_TIMEOUT, + SLPLimits.MIN_TCP_TIMEOUT, + SLPLimits.MAX_TCP_TIMEOUT + ); } /** * getTraceMsg - * + * * @return boolean */ public boolean getTraceMsg() { @@ -513,7 +519,7 @@ public boolean getTraceMsg() { /** * isBroadcastOnly - * + * * @return boolean */ public boolean isBroadcastOnly() { @@ -522,7 +528,7 @@ public boolean isBroadcastOnly() { /** * isDA - * + * * @return boolean */ public boolean isDA() { @@ -531,7 +537,7 @@ public boolean isDA() { /** * isSA - * + * * @return boolean */ public boolean isSA() { @@ -544,7 +550,6 @@ private static boolean getBoolean(String pPropName, boolean pDefaultValue) { } private InputStream getConfigURLStream() { - String configURL = System.getProperty(SLPConfigProperties.NET_SLP_CONFIG_URL); if (configURL != null) { @@ -576,7 +581,7 @@ private InputStream getConfigURLStream() { /** * Parses comma separated list. - * + * * @param pList * @return List of Strings */ diff --git a/src/main/java/org/metricshub/wbem/sblim/slp/internal/SLPDefaults.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/SLPDefaults.java index fced292..eb270f1 100644 --- a/src/main/java/org/metricshub/wbem/sblim/slp/internal/SLPDefaults.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/SLPDefaults.java @@ -47,19 +47,17 @@ */ import java.util.Locale; - import org.metricshub.wbem.sblim.slp.ServiceType; /** * SLPDefaults - * + * */ /** * Class SLPDefaults is responsible for - * + * */ public interface SLPDefaults { - /** * ALL_AUTHORITIES */ @@ -74,10 +72,11 @@ public interface SLPDefaults { * CONF_URLS */ public static final String[] CONF_URLS = { - "file:sblim-slp-client2.properties", - "file:" + System.getProperty("user.home") + System.getProperty("file.separator") - + "sblim-slp-client2.properties", - "file:/etc/java/sblim-slp-client2.properties", "file:/etc/sblim-slp-client2.properties" }; + "file:sblim-slp-client2.properties", + "file:" + System.getProperty("user.home") + System.getProperty("file.separator") + "sblim-slp-client2.properties", + "file:/etc/java/sblim-slp-client2.properties", + "file:/etc/sblim-slp-client2.properties" + }; /** * DA_DISCOVERY_TIMEOUTS @@ -213,5 +212,4 @@ public interface SLPDefaults { * IPV6_MULTICAST_SCOPE */ public static final int IPV6_MULTICAST_SCOPE = 5; - } diff --git a/src/main/java/org/metricshub/wbem/sblim/slp/internal/SLPLimits.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/SLPLimits.java index d0c2c58..25f803a 100644 --- a/src/main/java/org/metricshub/wbem/sblim/slp/internal/SLPLimits.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/SLPLimits.java @@ -44,10 +44,9 @@ /** * SLPLimits - * + * */ public interface SLPLimits { - /** * MAX_DISCOVERY_GRANULARITY */ @@ -117,5 +116,4 @@ public interface SLPLimits { * MIN_TCP_TIMEOUT */ public static final int MIN_TCP_TIMEOUT = 100; - } diff --git a/src/main/java/org/metricshub/wbem/sblim/slp/internal/SLPString.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/SLPString.java index 3ce766e..e592e5e 100644 --- a/src/main/java/org/metricshub/wbem/sblim/slp/internal/SLPString.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/SLPString.java @@ -43,19 +43,19 @@ /** *
        * This class provides functions for comparison of SLP message strings.
      - * 
      + *
        * From RFC 2608:
      - * 
      + *
        * String comparison for order and equality in SLP MUST be case
        * insensitive inside the 0x00-0x7F subrange of UTF-8 (which corresponds
        * to ASCII character encoding).  Case insensitivity SHOULD be supported
        * throughout the entire UTF-8 encoded Unicode [6] character set.
      - * 
      + *
        * The case insensitivity rule applies to all string matching in SLPv2,
        * including Scope strings, SLP SPI strings, service types, attribute
        * tags and values in query handling, language tags, previous responder
        * lists.  Comparisons of URL strings, however, is case sensitive.
      - * 
      + *
        * White space (SPACE, CR, LF, TAB) internal to a string value is folded
        * to a single SPACE character for the sake of string comparisons.
        * White space preceding or following a string value is ignored for the
      @@ -68,7 +68,7 @@ public class SLPString {
       
       	/**
       	 * equals
      -	 * 
      +	 *
       	 * @param pStr0
       	 * @param pStr1
       	 * @return boolean
      @@ -81,7 +81,7 @@ public static boolean equals(String pStr0, String pStr1) {
       
       	/**
       	 * compare
      -	 * 
      +	 *
       	 * @param pStr0
       	 * @param pStr1
       	 * @return int
      @@ -92,7 +92,7 @@ public static int compare(String pStr0, String pStr1) {
       
       	/**
       	 * public for testing only.
      -	 * 
      +	 *
       	 * @param pStr
       	 * @return String
       	 */
      @@ -115,5 +115,4 @@ public static String unify(String pStr) {
       		}
       		return resBuf.toString();
       	}
      -
       }
      diff --git a/src/main/java/org/metricshub/wbem/sblim/slp/internal/TRC.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/TRC.java
      index e8f959c..f8364a6 100644
      --- a/src/main/java/org/metricshub/wbem/sblim/slp/internal/TRC.java
      +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/TRC.java
      @@ -51,15 +51,13 @@
       import java.util.logging.Level;
       import java.util.regex.Matcher;
       import java.util.regex.Pattern;
      -
       import org.metricshub.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker;
       
       /**
        * debug -> FINEST info -> INFO warning -> WARNING error -> SEVERE
      - * 
      + *
        */
       public class TRC {
      -
       	private static PrintStream cOut;
       
       	private static Level cLevel = SLPConfig.getGlobalCfg().getTraceLevel();
      @@ -74,7 +72,7 @@ public class TRC {
       
       	/**
       	 * setLevel
      -	 * 
      +	 *
       	 * @param pLevel
       	 */
       	public static void setLevel(Level pLevel) {
      @@ -83,7 +81,7 @@ public static void setLevel(Level pLevel) {
       
       	/**
       	 * setConsolLog
      -	 * 
      +	 *
       	 * @param pOutStr
       	 */
       	public static void setOutput(OutputStream pOutStr) {
      @@ -92,7 +90,7 @@ public static void setOutput(OutputStream pOutStr) {
       
       	/**
       	 * setOutputStream
      -	 * 
      +	 *
       	 * @param pOutStr
       	 */
       	public static void setOutput(PrintStream pOutStr) {
      @@ -101,7 +99,7 @@ public static void setOutput(PrintStream pOutStr) {
       
       	/**
       	 * setPatterns
      -	 * 
      +	 *
       	 * @param pDenyPatterns
       	 * @param pAllowPatterns
       	 */
      @@ -121,7 +119,7 @@ private static Pattern[] compile(String[] pStrs) {
       
       	/**
       	 * debug
      -	 * 
      +	 *
       	 * @param pMsg
       	 */
       	public static void debug(String pMsg) {
      @@ -130,7 +128,7 @@ public static void debug(String pMsg) {
       
       	/**
       	 * debug
      -	 * 
      +	 *
       	 * @param pMsg
       	 * @param pEx
       	 */
      @@ -141,7 +139,7 @@ public static void debug(String pMsg, Exception pEx) {
       
       	/**
       	 * info
      -	 * 
      +	 *
       	 * @param pMsg
       	 */
       	public static void info(String pMsg) {
      @@ -150,7 +148,7 @@ public static void info(String pMsg) {
       
       	/**
       	 * info
      -	 * 
      +	 *
       	 * @param pMsg
       	 * @param pEx
       	 */
      @@ -161,7 +159,7 @@ public static void info(String pMsg, Exception pEx) {
       
       	/**
       	 * warning
      -	 * 
      +	 *
       	 * @param pMsg
       	 */
       	public static void warning(String pMsg) {
      @@ -170,7 +168,7 @@ public static void warning(String pMsg) {
       
       	/**
       	 * warning
      -	 * 
      +	 *
       	 * @param pMsg
       	 * @param pEx
       	 */
      @@ -181,7 +179,7 @@ public static void warning(String pMsg, Exception pEx) {
       
       	/**
       	 * error
      -	 * 
      +	 *
       	 * @param pMsg
       	 */
       	public static void error(String pMsg) {
      @@ -190,7 +188,7 @@ public static void error(String pMsg) {
       
       	/**
       	 * error
      -	 * 
      +	 *
       	 * @param pEx
       	 */
       	public static void error(Exception pEx) {
      @@ -199,7 +197,7 @@ public static void error(Exception pEx) {
       
       	/**
       	 * error
      -	 * 
      +	 *
       	 * @param pMsg
       	 * @param pEx
       	 */
      @@ -230,9 +228,17 @@ private static void trace(Level pLevel, String pMsg, Exception pEx) {
       		StackTraceElement location = getLocation();
       		String fnStr = getFunctionStr(location);
       		if (deny(fnStr) && !allow(fnStr)) return;
      -		StringBuffer buf = new StringBuffer('[' + pLevel.toString() + ' '
      -				+ Thread.currentThread().getName() + ' ' + getDate() + ' '
      -				+ getLocationStr(location) + "]\n");
      +		StringBuffer buf = new StringBuffer(
      +			'[' +
      +			pLevel.toString() +
      +			' ' +
      +			Thread.currentThread().getName() +
      +			' ' +
      +			getDate() +
      +			' ' +
      +			getLocationStr(location) +
      +			"]\n"
      +		);
       		if (pMsg != null) buf.append(pMsg + '\n');
       		if (pEx != null) {
       			StringWriter writer = new StringWriter();
      @@ -274,28 +280,35 @@ private static String pad(int pDigits, int pNum) {
       		char[] cA = new char[len];
       		int paddingDigits = pDigits - str.length();
       		int dIdx = 0;
      -		while (dIdx < paddingDigits)
      -			cA[dIdx++] = '0';
      +		while (dIdx < paddingDigits) cA[dIdx++] = '0';
       		int sIdx = 0;
      -		while (dIdx < len)
      -			cA[dIdx++] = str.charAt(sIdx++);
      +		while (dIdx < len) cA[dIdx++] = str.charAt(sIdx++);
       		return new String(cA);
       	}
       
       	/**
       	 * getDate
      -	 * 
      +	 *
       	 * @return String
       	 */
       	private static String getDate() {
       		long millis = new Date().getTime();
       		Calendar cal = Calendar.getInstance();
       		cal.setTimeInMillis(millis);
      -		return Integer.toString(cal.get(Calendar.YEAR)) + '.' + pad(2, cal.get(Calendar.MONTH) + 1)
      -				+ '.' + pad(2, cal.get(Calendar.DAY_OF_MONTH)) + ' '
      -				+ pad(2, cal.get(Calendar.HOUR_OF_DAY)) + ':' + pad(2, cal.get(Calendar.MINUTE))
      -				+ ':' + pad(2, cal.get(Calendar.SECOND)) + ' '
      -				+ pad(3, cal.get(Calendar.MILLISECOND));
      +		return (
      +			Integer.toString(cal.get(Calendar.YEAR)) +
      +			'.' +
      +			pad(2, cal.get(Calendar.MONTH) + 1) +
      +			'.' +
      +			pad(2, cal.get(Calendar.DAY_OF_MONTH)) +
      +			' ' +
      +			pad(2, cal.get(Calendar.HOUR_OF_DAY)) +
      +			':' +
      +			pad(2, cal.get(Calendar.MINUTE)) +
      +			':' +
      +			pad(2, cal.get(Calendar.SECOND)) +
      +			' ' +
      +			pad(3, cal.get(Calendar.MILLISECOND))
      +		);
       	}
      -
       }
      diff --git a/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/AttributeReply.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/AttributeReply.java
      index 4f9fc21..45832f4 100644
      --- a/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/AttributeReply.java
      +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/AttributeReply.java
      @@ -46,10 +46,9 @@
       import java.io.IOException;
       import java.util.Iterator;
       import java.util.List;
      -
       import org.metricshub.wbem.sblim.slp.ServiceLocationAttribute;
      -import org.metricshub.wbem.sblim.slp.internal.TRC;
       import org.metricshub.wbem.sblim.slp.ServiceLocationException;
      +import org.metricshub.wbem.sblim.slp.internal.TRC;
       
       /*
        * 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
      @@ -62,28 +61,26 @@
        * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |# of
        * AttrAuths | Attribute Authentication Block (if present) \
        * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      - * 
      + *
        */
       
       /**
        * AttributeReply message
      - * 
      + *
        */
       public class AttributeReply extends ReplyMessage {
      -
       	private List iAttrList;
       
       	/**
       	 * parse
      -	 * 
      +	 *
       	 * @param pHdr
       	 * @param pInStr
       	 * @return SLPMessage
       	 * @throws ServiceLocationException
       	 * @throws IOException
       	 */
      -	public static SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr)
      -			throws ServiceLocationException, IOException {
      +	public static SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) throws ServiceLocationException, IOException {
       		AttributeReply reply = new AttributeReply(pHdr, pInStr.read16(), pInStr.readAttributeList());
       		if (pInStr.readAuthBlockList() != null) TRC.warning("Non empty auth block!");
       		return reply;
      @@ -91,7 +88,7 @@ public static SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr)
       
       	/**
       	 * Ctor.
      -	 * 
      +	 *
       	 * @param pErrorCode
       	 * @param pAttrList
       	 *            - list of ServiceLocationAttributes
      @@ -103,7 +100,7 @@ public AttributeReply(int pErrorCode, List pAttrList)
       
       	/**
       	 * Ctor.
      -	 * 
      +	 *
       	 * @param pLangTag
       	 * @param pErrorCode
       	 * @param pAttrList
      @@ -116,14 +113,13 @@ public AttributeReply(String pLangTag, int pErrorCode, List pAttrList) {
      +	public AttributeReply(MsgHeader pHeader, int pErrorCode, List pAttrList) {
       		super(pHeader, pErrorCode);
       		this.iAttrList = pAttrList;
       	}
      @@ -138,8 +134,9 @@ public Iterator getResultIterator() {
       	 */
       	@Override
       	protected boolean serializeBody(SLPOutputStream pOutStr, SerializeOption pOption) {
      -		return pOutStr.write16(getErrorCode()) && pOutStr.writeAttributeList(this.iAttrList)
      -				&& pOutStr.writeAuthBlockList(null);
      +		return (
      +			pOutStr.write16(getErrorCode()) && pOutStr.writeAttributeList(this.iAttrList) && pOutStr.writeAuthBlockList(null)
      +		);
       	}
       
       	@Override
      @@ -147,5 +144,4 @@ public Iterator getExceptionIterator() {
       		// this message doesn't have exception table
       		return null;
       	}
      -
       }
      diff --git a/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/AttributeRequest.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/AttributeRequest.java
      index 2e890ac..35ee7bf 100644
      --- a/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/AttributeRequest.java
      +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/AttributeRequest.java
      @@ -45,9 +45,8 @@
       import java.io.IOException;
       import java.util.List;
       import java.util.SortedSet;
      -
      -import org.metricshub.wbem.sblim.slp.ServiceURL;
       import org.metricshub.wbem.sblim.slp.ServiceLocationException;
      +import org.metricshub.wbem.sblim.slp.ServiceURL;
       
       /*
        * 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
      @@ -67,10 +66,9 @@
       
       /**
        * AttributeRequest message
      - * 
      + *
        */
       public class AttributeRequest extends RequestMessage {
      -
       	private String iURLStr;
       
       	private List iTagList;
      @@ -81,22 +79,27 @@ public class AttributeRequest extends RequestMessage {
       
       	/**
       	 * parse
      -	 * 
      +	 *
       	 * @param pHdr
       	 * @param pInStr
       	 * @return SLPMessage
       	 * @throws ServiceLocationException
       	 * @throws IOException
       	 */
      -	public static SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr)
      -			throws ServiceLocationException, IOException {
      -		return new AttributeRequest(pHdr, pInStr.readStringSet(), pInStr.readString(), pInStr
      -				.readStringList(), pInStr.readStringList(), pInStr.readStringList());
      +	public static SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) throws ServiceLocationException, IOException {
      +		return new AttributeRequest(
      +			pHdr,
      +			pInStr.readStringSet(),
      +			pInStr.readString(),
      +			pInStr.readStringList(),
      +			pInStr.readStringList(),
      +			pInStr.readStringList()
      +		);
       	}
       
       	/**
       	 * Ctor.
      -	 * 
      +	 *
       	 * @param pPrevResponderSet
       	 *            - set of address strings
       	 * @param pURLStr
      @@ -105,15 +108,20 @@ public static SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr)
       	 * @param pTagList
       	 * @param pSPIList
       	 */
      -	public AttributeRequest(SortedSet pPrevResponderSet, String pURLStr,
      -			List pScopeList, List pTagList, List pSPIList) {
      +	public AttributeRequest(
      +		SortedSet pPrevResponderSet,
      +		String pURLStr,
      +		List pScopeList,
      +		List pTagList,
      +		List pSPIList
      +	) {
       		super(ATTR_RQST, pPrevResponderSet, pScopeList);
       		init(pURLStr, pTagList, pSPIList);
       	}
       
       	/**
       	 * Ctor.
      -	 * 
      +	 *
       	 * @param pLangTag
       	 * @param pPrevResponderSet
       	 *            - set of address strings
      @@ -123,15 +131,21 @@ public AttributeRequest(SortedSet pPrevResponderSet, String pURLStr,
       	 * @param pTagList
       	 * @param pSPIList
       	 */
      -	public AttributeRequest(String pLangTag, SortedSet pPrevResponderSet, String pURLStr,
      -			List pScopeList, List pTagList, List pSPIList) {
      +	public AttributeRequest(
      +		String pLangTag,
      +		SortedSet pPrevResponderSet,
      +		String pURLStr,
      +		List pScopeList,
      +		List pTagList,
      +		List pSPIList
      +	) {
       		super(ATTR_RQST, pLangTag, pPrevResponderSet, pScopeList);
       		init(pURLStr, pTagList, pSPIList);
       	}
       
       	/**
       	 * Ctor.
      -	 * 
      +	 *
       	 * @param pHeader
       	 * @param pPrevResponderSet
       	 *            - set of address strings
      @@ -141,15 +155,21 @@ public AttributeRequest(String pLangTag, SortedSet pPrevResponderSet, St
       	 * @param pTagList
       	 * @param pSPIList
       	 */
      -	public AttributeRequest(MsgHeader pHeader, SortedSet pPrevResponderSet, String pURLStr,
      -			List pScopeList, List pTagList, List pSPIList) {
      +	public AttributeRequest(
      +		MsgHeader pHeader,
      +		SortedSet pPrevResponderSet,
      +		String pURLStr,
      +		List pScopeList,
      +		List pTagList,
      +		List pSPIList
      +	) {
       		super(pHeader, pPrevResponderSet, pScopeList);
       		init(pURLStr, pTagList, pSPIList);
       	}
       
       	/**
       	 * getServiceURL
      -	 * 
      +	 *
       	 * @return ServiceURL
       	 */
       	public ServiceURL getServiceURL() {
      @@ -158,8 +178,12 @@ public ServiceURL getServiceURL() {
       
       	@Override
       	protected boolean serializeRequestBody(SLPOutputStream pOutStr) {
      -		return pOutStr.write(this.iURLStr) && pOutStr.writeStringList(getScopeList())
      -				&& pOutStr.writeStringList(this.iTagList) && pOutStr.writeStringList(this.iSPIList);
      +		return (
      +			pOutStr.write(this.iURLStr) &&
      +			pOutStr.writeStringList(getScopeList()) &&
      +			pOutStr.writeStringList(this.iTagList) &&
      +			pOutStr.writeStringList(this.iSPIList)
      +		);
       	}
       
       	@Override
      @@ -172,5 +196,4 @@ private void init(String pURLStr, List pTagList, List pSPIList)
       		this.iTagList = pTagList;
       		this.iSPIList = pSPIList;
       	}
      -
       }
      diff --git a/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/DAAdvert.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/DAAdvert.java
      index 122977d..a55c4f7 100644
      --- a/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/DAAdvert.java
      +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/DAAdvert.java
      @@ -48,7 +48,6 @@
       import java.util.Iterator;
       import java.util.List;
       import java.util.TreeSet;
      -
       import org.metricshub.wbem.sblim.slp.ServiceLocationAttribute;
       import org.metricshub.wbem.sblim.slp.ServiceLocationException;
       
      @@ -75,10 +74,9 @@
       
       /**
        * DAAdvert message
      - * 
      + *
        */
       public class DAAdvert extends ReplyMessage {
      -
       	private long iStatelessBootTime;
       
       	private String iURLStr;
      @@ -91,22 +89,28 @@ public class DAAdvert extends ReplyMessage {
       
       	/**
       	 * parse
      -	 * 
      +	 *
       	 * @param pHdr
       	 * @param pInStr
       	 * @return SLPMessage
       	 * @throws ServiceLocationException
       	 * @throws IOException
       	 */
      -	public static SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr)
      -			throws ServiceLocationException, IOException {
      -		return new DAAdvert(pHdr, pInStr.read16(), pInStr.read32(), pInStr.readString(), pInStr
      -				.readStringList(), pInStr.readAttributeList(), pInStr.readStringList());
      +	public static SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) throws ServiceLocationException, IOException {
      +		return new DAAdvert(
      +			pHdr,
      +			pInStr.read16(),
      +			pInStr.read32(),
      +			pInStr.readString(),
      +			pInStr.readStringList(),
      +			pInStr.readAttributeList(),
      +			pInStr.readStringList()
      +		);
       	}
       
       	/**
       	 * Ctor.
      -	 * 
      +	 *
       	 * @param pErrorCode
       	 * @param pStatelessBootTime
       	 * @param pURLStr
      @@ -116,15 +120,21 @@ public static SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr)
       	 *            - list of ServiceLocationAttributes
       	 * @param pSPIList
       	 */
      -	public DAAdvert(int pErrorCode, long pStatelessBootTime, String pURLStr,
      -			List pScopeList, List pAttrList, List pSPIList) {
      +	public DAAdvert(
      +		int pErrorCode,
      +		long pStatelessBootTime,
      +		String pURLStr,
      +		List pScopeList,
      +		List pAttrList,
      +		List pSPIList
      +	) {
       		super(DA_ADVERT, pErrorCode);
       		init(pStatelessBootTime, pURLStr, pScopeList, pAttrList, pSPIList);
       	}
       
       	/**
       	 * Ctor.
      -	 * 
      +	 *
       	 * @param pLangTag
       	 * @param pErrorCode
       	 * @param pStatelessBootTime
      @@ -135,15 +145,22 @@ public DAAdvert(int pErrorCode, long pStatelessBootTime, String pURLStr,
       	 *            - list of ServiceLocationAttributes
       	 * @param pSPIList
       	 */
      -	public DAAdvert(String pLangTag, int pErrorCode, long pStatelessBootTime, String pURLStr,
      -			List pScopeList, List pAttrList, List pSPIList) {
      +	public DAAdvert(
      +		String pLangTag,
      +		int pErrorCode,
      +		long pStatelessBootTime,
      +		String pURLStr,
      +		List pScopeList,
      +		List pAttrList,
      +		List pSPIList
      +	) {
       		super(DA_ADVERT, pLangTag, pErrorCode);
       		init(pStatelessBootTime, pURLStr, pScopeList, pAttrList, pSPIList);
       	}
       
       	/**
       	 * Ctor.
      -	 * 
      +	 *
       	 * @param pHeader
       	 * @param pErrorCode
       	 * @param pStatelessBootTime
      @@ -154,8 +171,15 @@ public DAAdvert(String pLangTag, int pErrorCode, long pStatelessBootTime, String
       	 *            - list of ServiceLocationAttributes
       	 * @param pSPIList
       	 */
      -	public DAAdvert(MsgHeader pHeader, int pErrorCode, long pStatelessBootTime, String pURLStr,
      -			List pScopeList, List pAttrList, List pSPIList) {
      +	public DAAdvert(
      +		MsgHeader pHeader,
      +		int pErrorCode,
      +		long pStatelessBootTime,
      +		String pURLStr,
      +		List pScopeList,
      +		List pAttrList,
      +		List pSPIList
      +	) {
       		super(pHeader, pErrorCode);
       		init(pStatelessBootTime, pURLStr, pScopeList, pAttrList, pSPIList);
       	}
      @@ -167,8 +191,7 @@ public DAAdvert(MsgHeader pHeader, int pErrorCode, long pStatelessBootTime, Stri
       	@Override
       	public Iterator getResultIterator() {
       		ArrayList list = new ArrayList(1);
      -		list.add(new DADescriptor(this.iURLStr, new TreeSet(this.iScopeList),
      -				this.iAttrList));
      +		list.add(new DADescriptor(this.iURLStr, new TreeSet(this.iScopeList), this.iAttrList));
       		return list.iterator();
       	}
       
      @@ -177,14 +200,23 @@ public Iterator getResultIterator() {
       	 */
       	@Override
       	protected boolean serializeBody(SLPOutputStream pOutStr, SerializeOption pOption) {
      -		return pOutStr.write16(getErrorCode()) && pOutStr.write32(this.iStatelessBootTime)
      -				&& pOutStr.write(this.iURLStr) && pOutStr.writeStringList(this.iScopeList)
      -				&& pOutStr.writeAttributeList(this.iAttrList)
      -				&& pOutStr.writeStringList(this.iSPIList);
      +		return (
      +			pOutStr.write16(getErrorCode()) &&
      +			pOutStr.write32(this.iStatelessBootTime) &&
      +			pOutStr.write(this.iURLStr) &&
      +			pOutStr.writeStringList(this.iScopeList) &&
      +			pOutStr.writeAttributeList(this.iAttrList) &&
      +			pOutStr.writeStringList(this.iSPIList)
      +		);
       	}
       
      -	private void init(long pStatelessBootTime, String pURLStr, List pScopeList,
      -			List pAttrList, List pSPIList) {
      +	private void init(
      +		long pStatelessBootTime,
      +		String pURLStr,
      +		List pScopeList,
      +		List pAttrList,
      +		List pSPIList
      +	) {
       		this.iStatelessBootTime = pStatelessBootTime;
       		this.iURLStr = pURLStr;
       		this.iScopeList = pScopeList;
      @@ -197,5 +229,4 @@ public Iterator getExceptionIterator() {
       		// this message doesn't have exception table
       		return null;
       	}
      -
       }
      diff --git a/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/DADescriptor.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/DADescriptor.java
      index 5587d71..3e1e834 100644
      --- a/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/DADescriptor.java
      +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/DADescriptor.java
      @@ -46,7 +46,6 @@
       import java.util.Iterator;
       import java.util.List;
       import java.util.TreeSet;
      -
       import org.metricshub.wbem.sblim.slp.ServiceLocationAttribute;
       
       /**
      @@ -58,7 +57,6 @@
        * 
      */ public class DADescriptor implements Comparable { - private String iURL; private TreeSet iScopeSet; @@ -67,15 +65,14 @@ public class DADescriptor implements Comparable { /** * Ctor. - * + * * @param pURL * @param pScopeSet * - set of scope Strings * @param pAttributes * - set of ServiceLocationAttributes */ - public DADescriptor(String pURL, TreeSet pScopeSet, - List pAttributes) { + public DADescriptor(String pURL, TreeSet pScopeSet, List pAttributes) { this.iURL = pURL; this.iScopeSet = pScopeSet; this.iAttributes = pAttributes; @@ -83,7 +80,7 @@ public DADescriptor(String pURL, TreeSet pScopeSet, /** * getURL - * + * * @return String */ public String getURL() { @@ -92,7 +89,7 @@ public String getURL() { /** * hasScope - * + * * @param pScope * @return boolean */ @@ -123,7 +120,7 @@ private void incHashCode(int pHashCode) { /* * hashCode has to be independent of the order of scopes and attributes * (non-Javadoc) - * + * * @see java.lang.Object#hashCode() */ @Override @@ -133,8 +130,7 @@ public int hashCode() { Iterator itr; if (this.iScopeSet != null) { itr = this.iScopeSet.iterator(); - while (itr.hasNext()) - incHashCode(itr.next().hashCode()); + while (itr.hasNext()) incHashCode(itr.next().hashCode()); } if (this.iAttributes != null) { itr = this.iAttributes.iterator(); @@ -142,8 +138,7 @@ public int hashCode() { * iHasCode is simply incremented, because attribute order * mustn't be considered. */ - while (itr.hasNext()) - this.iHashCode += itr.next().hashCode(); + while (itr.hasNext()) this.iHashCode += itr.next().hashCode(); } } return this.iHashCode; @@ -156,13 +151,11 @@ public String toString() { Iterator itr = this.iScopeSet.iterator(); boolean more = false; while (itr.hasNext()) { - if (more) strBuf.append(", "); - else more = true; + if (more) strBuf.append(", "); else more = true; strBuf.append(itr.next()); } } return strBuf.toString(); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/FunctionIDs.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/FunctionIDs.java index b60609a..c118a2c 100644 --- a/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/FunctionIDs.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/FunctionIDs.java @@ -44,7 +44,6 @@ * FunctionIDs */ public interface FunctionIDs { - /** * SRV_RQST */ @@ -109,5 +108,4 @@ public interface FunctionIDs { * LAST_ID */ public static final int LAST_ID = SA_ADVERT; - } diff --git a/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/MsgFactory.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/MsgFactory.java index b8c05df..ff1c65a 100644 --- a/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/MsgFactory.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/MsgFactory.java @@ -44,33 +44,30 @@ import java.io.InputStream; import java.net.DatagramPacket; import java.net.Socket; - -import org.metricshub.wbem.sblim.slp.internal.msg.FunctionIDs; import org.metricshub.wbem.sblim.slp.ServiceLocationException; +import org.metricshub.wbem.sblim.slp.internal.msg.FunctionIDs; /** * MsgFactory - * + * */ public class MsgFactory implements FunctionIDs { /** * FactoryEntry - * + * */ private interface FactoryEntry { - /** * parse - * + * * @param pHdr * @param pInStr * @return SLPMessage * @throws ServiceLocationException * @throws IOException */ - public SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) - throws ServiceLocationException, IOException; + public SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) throws ServiceLocationException, IOException; } private static FactoryEntry[] cFactoryArray; @@ -82,86 +79,107 @@ private static void placeFactory(int pFnID, FactoryEntry pEntry) { private static synchronized void createFactoryArray() { if (cFactoryArray != null) return; cFactoryArray = new FactoryEntry[LAST_ID - FIRST_ID + 1]; - for (int i = 0; i < cFactoryArray.length; i++) - cFactoryArray[i] = null; - placeFactory(ATTR_RPLY, new FactoryEntry() { - - public SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) - throws ServiceLocationException, IOException { - return AttributeReply.parse(pHdr, pInStr); + for (int i = 0; i < cFactoryArray.length; i++) cFactoryArray[i] = null; + placeFactory( + ATTR_RPLY, + new FactoryEntry() { + + public SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) throws ServiceLocationException, IOException { + return AttributeReply.parse(pHdr, pInStr); + } } - }); - placeFactory(ATTR_RQST, new FactoryEntry() { - - public SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) - throws ServiceLocationException, IOException { - return AttributeRequest.parse(pHdr, pInStr); + ); + placeFactory( + ATTR_RQST, + new FactoryEntry() { + + public SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) throws ServiceLocationException, IOException { + return AttributeRequest.parse(pHdr, pInStr); + } } - }); - placeFactory(DA_ADVERT, new FactoryEntry() { - - public SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) - throws ServiceLocationException, IOException { - return DAAdvert.parse(pHdr, pInStr); + ); + placeFactory( + DA_ADVERT, + new FactoryEntry() { + + public SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) throws ServiceLocationException, IOException { + return DAAdvert.parse(pHdr, pInStr); + } } - }); - placeFactory(SA_ADVERT, new FactoryEntry() { - - public SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) - throws ServiceLocationException, IOException { - return SAAdvert.parse(pHdr, pInStr); + ); + placeFactory( + SA_ADVERT, + new FactoryEntry() { + + public SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) throws ServiceLocationException, IOException { + return SAAdvert.parse(pHdr, pInStr); + } } - }); - placeFactory(SRV_ACK, new FactoryEntry() { - - public SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) - throws ServiceLocationException, IOException { - return ServiceAcknowledgment.parse(pHdr, pInStr); + ); + placeFactory( + SRV_ACK, + new FactoryEntry() { + + public SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) throws ServiceLocationException, IOException { + return ServiceAcknowledgment.parse(pHdr, pInStr); + } } - }); - placeFactory(SRV_DEREG, new FactoryEntry() { - - public SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) - throws ServiceLocationException, IOException { - return ServiceDeregistration.parse(pHdr, pInStr); + ); + placeFactory( + SRV_DEREG, + new FactoryEntry() { + + public SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) throws ServiceLocationException, IOException { + return ServiceDeregistration.parse(pHdr, pInStr); + } } - }); - placeFactory(SRV_REG, new FactoryEntry() { - - public SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) - throws ServiceLocationException, IOException { - return ServiceRegistration.parse(pHdr, pInStr); + ); + placeFactory( + SRV_REG, + new FactoryEntry() { + + public SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) throws ServiceLocationException, IOException { + return ServiceRegistration.parse(pHdr, pInStr); + } } - }); - placeFactory(SRV_RPLY, new FactoryEntry() { - - public SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) - throws ServiceLocationException, IOException { - return ServiceReply.parse(pHdr, pInStr); + ); + placeFactory( + SRV_RPLY, + new FactoryEntry() { + + public SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) throws ServiceLocationException, IOException { + return ServiceReply.parse(pHdr, pInStr); + } } - }); - placeFactory(SRV_RQST, new FactoryEntry() { - - public SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) - throws ServiceLocationException, IOException { - return ServiceRequest.parse(pHdr, pInStr); + ); + placeFactory( + SRV_RQST, + new FactoryEntry() { + + public SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) throws ServiceLocationException, IOException { + return ServiceRequest.parse(pHdr, pInStr); + } } - }); + ); // - placeFactory(SRV_TYPE_RPLY, new FactoryEntry() { + placeFactory( + SRV_TYPE_RPLY, + new FactoryEntry() { - public SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) - throws ServiceLocationException, IOException { - return ServiceTypeReply.parse(pHdr, pInStr); + public SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) throws ServiceLocationException, IOException { + return ServiceTypeReply.parse(pHdr, pInStr); + } } - }); - placeFactory(SRV_TYPE_RQST, new FactoryEntry() { - - public SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) - throws ServiceLocationException, IOException { - return ServiceTypeRequest.parse(pHdr, pInStr); + ); + placeFactory( + SRV_TYPE_RQST, + new FactoryEntry() { + + public SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) throws ServiceLocationException, IOException { + return ServiceTypeRequest.parse(pHdr, pInStr); + } } - }); + ); } private static FactoryEntry getFactory(int pFnID) { @@ -171,7 +189,7 @@ private static FactoryEntry getFactory(int pFnID) { /** * parse - * + * * @param pSock * @return SLPMessage * @throws ServiceLocationException @@ -183,7 +201,7 @@ public static SLPMessage parse(Socket pSock) throws ServiceLocationException, IO /** * parse - * + * * @param pInStr * @return SLPMessage * @throws ServiceLocationException @@ -195,33 +213,31 @@ public static SLPMessage parse(InputStream pInStr) throws ServiceLocationExcepti /** * parse - * + * * @param pPacket * @return SLPMessage * @throws ServiceLocationException * @throws IOException */ - public static SLPMessage parse(DatagramPacket pPacket) throws ServiceLocationException, - IOException { + public static SLPMessage parse(DatagramPacket pPacket) throws ServiceLocationException, IOException { return parse(new SLPInputStream(pPacket)); } /** * parse - * + * * @param pInStr * @return SLPMessage * @throws ServiceLocationException * @throws IOException */ - public static SLPMessage parse(SLPInputStream pInStr) throws ServiceLocationException, - IOException { + public static SLPMessage parse(SLPInputStream pInStr) throws ServiceLocationException, IOException { MsgHeader hdr = MsgHeader.parse(pInStr); FactoryEntry factory = getFactory(hdr.getFunctionID()); if (factory == null) throw new ServiceLocationException( - ServiceLocationException.NOT_IMPLEMENTED, "FunctionID=" + hdr.getFunctionID() - + " is not implemented!"); + ServiceLocationException.NOT_IMPLEMENTED, + "FunctionID=" + hdr.getFunctionID() + " is not implemented!" + ); return factory.parse(hdr, pInStr); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/MsgHeader.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/MsgHeader.java index f853487..1260edc 100644 --- a/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/MsgHeader.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/MsgHeader.java @@ -43,9 +43,8 @@ import java.io.IOException; import java.util.Random; - -import org.metricshub.wbem.sblim.slp.internal.Convert; import org.metricshub.wbem.sblim.slp.ServiceLocationException; +import org.metricshub.wbem.sblim.slp.internal.Convert; /* * SLP Header: 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 @@ -58,35 +57,35 @@ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Language * Tag Length | Language Tag \ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * + * * Message Type Abbreviation Function-ID - * + * * Service Request SrvRqst 1 Service Reply SrvRply 2 Service Registration SrvReg * 3 Service Deregister SrvDeReg 4 Service Acknowledge SrvAck 5 Attribute * Request AttrRqst 6 Attribute Reply AttrRply 7 DA Advertisement DAAdvert 8 * Service Type Request SrvTypeRqst 9 Service Type Reply SrvTypeRply 10 SA * Advertisement SAAdvert 11 - * + * * Length: @2 3 bytes length of the entire SLP message, header included. - * + * * Flags: @5 1 byte OVERFLOW (0x80): is set when a message's length exceeds what * can fit into a datagram. FRESH (0x40): is set on every new SrvReg. REQUEST * MCAST (0x20): is set when multicasting or broadcasting requests. - * + * * Reserved: @6 1 byte bits MUST be 0. - * + * * Next Extension Offset: @7 3 bytes is set to 0 unless extensions are used. The * first extension begins at 'offset' bytes, from the message's beginning. It is * placed after the SLP message data. - * + * * XID: @10 2 bytes is set to a unique value for each unique request. If the * request is retransmitted, the same XID is used. Replies set the XID to the * same value as the xid in the request. Only unsolicited DAAdverts are sent * with an XID of 0. - * + * * Language Tag Length: @12 2 bytes is the length in bytes of the Language Tag * field. - * + * * Language Tag: @14 The Language Tag in a reply MUST be the same as the * Language Tag in the request. This field must be encoded 1*8ALPHA *("-" * 1*8ALPHA). @@ -94,10 +93,9 @@ /** * MsgHeader - * + * */ public class MsgHeader implements FunctionIDs { - /** * VERSION */ @@ -144,41 +142,40 @@ public class MsgHeader implements FunctionIDs { /** * parse - * + * * @param pInStr * @return MsgHeader * @throws ServiceLocationException * @throws IOException */ - public static MsgHeader parse(SLPInputStream pInStr) throws ServiceLocationException, - IOException { + public static MsgHeader parse(SLPInputStream pInStr) throws ServiceLocationException, IOException { int version = pInStr.read8(); int fnID = pInStr.read8(); if (fnID < FIRST_ID || fnID > LAST_ID) throw new ServiceLocationException( - ServiceLocationException.PARSE_ERROR, "functionID:" + fnID + " is not supported!"); + ServiceLocationException.PARSE_ERROR, + "functionID:" + fnID + " is not supported!" + ); // int len = pInStr.read24(); // TODO: could be used for sanity checking int flags = pInStr.read16(); pInStr.read24(); // skip extension int XID = pInStr.read16(); String langTag = pInStr.readString(); - return new MsgHeader(version, fnID, langTag, (flags & OVERFLOW) > 0, (flags & FRESH) > 0, - (flags & MCAST) > 0, XID); + return new MsgHeader(version, fnID, langTag, (flags & OVERFLOW) > 0, (flags & FRESH) > 0, (flags & MCAST) > 0, XID); } /** * Ctor. - * + * * @param pHdr */ public MsgHeader(MsgHeader pHdr) { - this(pHdr.iVersion, pHdr.iFunctionID, pHdr.iLangTag, pHdr.iOverflow, pHdr.iFresh, - pHdr.iMCast, pHdr.iXID); + this(pHdr.iVersion, pHdr.iFunctionID, pHdr.iLangTag, pHdr.iOverflow, pHdr.iFresh, pHdr.iMCast, pHdr.iXID); } /** * Ctor. - * + * * @param pVersion * @param pFunctionID * @param pLangTag @@ -187,8 +184,15 @@ public MsgHeader(MsgHeader pHdr) { * @param pMCast * @param pXID */ - public MsgHeader(int pVersion, int pFunctionID, String pLangTag, boolean pOverflow, - boolean pFresh, boolean pMCast, int pXID) { + public MsgHeader( + int pVersion, + int pFunctionID, + String pLangTag, + boolean pOverflow, + boolean pFresh, + boolean pMCast, + int pXID + ) { this.iVersion = pVersion; this.iFunctionID = pFunctionID; this.iLangTag = pLangTag; @@ -200,7 +204,7 @@ public MsgHeader(int pVersion, int pFunctionID, String pLangTag, boolean pOverfl /** * getVersion - * + * * @return int */ public int getVersion() { @@ -209,7 +213,7 @@ public int getVersion() { /** * getFunctionID - * + * * @return int */ public int getFunctionID() { @@ -218,7 +222,7 @@ public int getFunctionID() { /** * getLangTag - * + * * @return int */ public String getLangTag() { @@ -227,7 +231,7 @@ public String getLangTag() { /** * overflows - * + * * @return boolean */ public boolean overflows() { @@ -236,7 +240,7 @@ public boolean overflows() { /** * fresh - * + * * @return boolean */ public boolean fresh() { @@ -245,7 +249,7 @@ public boolean fresh() { /** * multicast - * + * * @return boolean */ public boolean multicast() { @@ -264,7 +268,7 @@ public int getXID() { /** * The response have to contain the same XID of the request. So this setter * can be useful. - * + * * @param pXID */ public void setXID(int pXID) { @@ -273,7 +277,7 @@ public void setXID(int pXID) { /** * getSize - * + * * @return int */ public int getSize() { @@ -287,15 +291,14 @@ public int getSize() { */ /** * serialize - * + * * @param pBodyLength * @param pOverflow * @param pSetMultiCastFlag * @param pKeepXID * @return byte[] */ - public byte[] serialize(int pBodyLength, boolean pOverflow, boolean pSetMultiCastFlag, - boolean pKeepXID) { + public byte[] serialize(int pBodyLength, boolean pOverflow, boolean pSetMultiCastFlag, boolean pKeepXID) { SLPOutputStream outStr = new SLPOutputStream(); outStr.writeNoChk8(VERSION); outStr.writeNoChk8(this.iFunctionID); @@ -335,5 +338,4 @@ private static int getNewXID() { if (cXID == 0) ++cXID; return ++cXID; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/ReplyMessage.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/ReplyMessage.java index 79a662c..b544282 100644 --- a/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/ReplyMessage.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/ReplyMessage.java @@ -46,15 +46,14 @@ /** * ReplyMessage - * + * */ public abstract class ReplyMessage extends SLPMessage { - private int iErrorCode; /** * Ctor. - * + * * @param pFunctionID * @param pErrorCode */ @@ -65,7 +64,7 @@ public ReplyMessage(int pFunctionID, int pErrorCode) { /** * Ctor. - * + * * @param pFunctionID * @param pLangTag * @param pErrorCode @@ -77,7 +76,7 @@ public ReplyMessage(int pFunctionID, String pLangTag, int pErrorCode) { /** * Ctor. - * + * * @param pHeader * @param pErrorCode */ @@ -88,7 +87,7 @@ public ReplyMessage(MsgHeader pHeader, int pErrorCode) { /** * getErrorCode - * + * * @return int */ public int getErrorCode() { @@ -97,16 +96,15 @@ public int getErrorCode() { /** * getResultIterator - * + * * @return Iterator */ public abstract Iterator getResultIterator(); /** * getExceptionIterator - * + * * @return Iterator */ public abstract Iterator getExceptionIterator(); - } diff --git a/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/RequestMessage.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/RequestMessage.java index 669ddf0..4fd3209 100644 --- a/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/RequestMessage.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/RequestMessage.java @@ -47,38 +47,35 @@ import java.util.List; import java.util.SortedSet; import java.util.TreeSet; - -import org.metricshub.wbem.sblim.slp.internal.msg.SLPMessage; import org.metricshub.wbem.sblim.slp.ServiceLocationException; +import org.metricshub.wbem.sblim.slp.internal.msg.SLPMessage; /** * RequestMessage - * + * */ public abstract class RequestMessage extends SLPMessage { - private SortedSet iPrevResponderSet; private List iScopeList; /** * Ctor. - * + * * @param pFunctionID * @param pPrevResponderSet * - set of address strings * @param pScopeList * - list of scope strings */ - public RequestMessage(int pFunctionID, SortedSet pPrevResponderSet, - List pScopeList) { + public RequestMessage(int pFunctionID, SortedSet pPrevResponderSet, List pScopeList) { super(pFunctionID); init(pPrevResponderSet, pScopeList); } /** * Ctor. - * + * * @param pFunctionID * @param pLangTag * @param pPrevResponderSet @@ -86,30 +83,33 @@ public RequestMessage(int pFunctionID, SortedSet pPrevResponderSet, * @param pScopeList * - list of scope strings */ - public RequestMessage(int pFunctionID, String pLangTag, SortedSet pPrevResponderSet, - List pScopeList) { + public RequestMessage( + int pFunctionID, + String pLangTag, + SortedSet pPrevResponderSet, + List pScopeList + ) { super(pFunctionID, pLangTag); init(pPrevResponderSet, pScopeList); } /** * Ctor. - * + * * @param pHeader * @param pPrevResponderSet * - set of address strings * @param pScopeList * - list of scope strings */ - public RequestMessage(MsgHeader pHeader, SortedSet pPrevResponderSet, - List pScopeList) { + public RequestMessage(MsgHeader pHeader, SortedSet pPrevResponderSet, List pScopeList) { super(pHeader); init(pPrevResponderSet, pScopeList); } /** * getPrevResponderSet - * + * * @return SortedSet */ public SortedSet getPrevResponderSet() { @@ -118,7 +118,7 @@ public SortedSet getPrevResponderSet() { /** * getPrevRespondersItr - * + * * @return Iterator */ public Iterator getPrevRespondersItr() { @@ -127,7 +127,7 @@ public Iterator getPrevRespondersItr() { /** * updatePrevResponders - * + * * @param pResponder * @return boolean */ @@ -138,7 +138,7 @@ public boolean updatePrevResponders(String pResponder) { /** * getScopeList - * + * * @return List of scope strings */ public List getScopeList() { @@ -147,7 +147,7 @@ public List getScopeList() { /** * isAllowedResponseType - * + * * @param pRspMsg * @return boolean */ @@ -156,37 +156,37 @@ public boolean isAllowedResponseType(SLPMessage pRspMsg) { int id = pRspMsg.getFunctionID(); int[] rspIDs = getAllowedResponseIDs(); if (rspIDs == null) return true; - for (int i = 0; i < rspIDs.length; i++) - if (id == rspIDs[i]) return true; + for (int i = 0; i < rspIDs.length; i++) if (id == rspIDs[i]) return true; return false; } /** * serializeWithoutResponders - * + * * @param pSetMulticastFlag * @param pDatagramLimited * @param pKeepXID * @return byte[] * @throws ServiceLocationException */ - public byte[] serializeWithoutResponders(boolean pSetMulticastFlag, boolean pDatagramLimited, - boolean pKeepXID) throws ServiceLocationException { - + public byte[] serializeWithoutResponders(boolean pSetMulticastFlag, boolean pDatagramLimited, boolean pKeepXID) + throws ServiceLocationException { return serialize(pSetMulticastFlag, pDatagramLimited, pKeepXID, new SkipResponders()); } @Override protected boolean serializeBody(SLPOutputStream pOutStr, SerializeOption pSkipResponders) - throws ServiceLocationException { - if (!pOutStr.writeStringList(pSkipResponders == null ? getPrevRespondersItr() : null)) throw new ServiceLocationException( - ServiceLocationException.PREVIOUS_RESPONDER_OVERFLOW, - "Previous responder list has overflowed!"); + throws ServiceLocationException { + if ( + !pOutStr.writeStringList(pSkipResponders == null ? getPrevRespondersItr() : null) + ) throw new ServiceLocationException( + ServiceLocationException.PREVIOUS_RESPONDER_OVERFLOW, + "Previous responder list has overflowed!" + ); return serializeRequestBody(pOutStr); } - protected abstract boolean serializeRequestBody(SLPOutputStream pOutStr) - throws ServiceLocationException; + protected abstract boolean serializeRequestBody(SLPOutputStream pOutStr) throws ServiceLocationException; protected abstract int[] getAllowedResponseIDs(); @@ -201,5 +201,4 @@ class SkipResponders extends SerializeOption { * serialization have to be skipped */ } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/SAAdvert.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/SAAdvert.java index b65911b..82b48be 100644 --- a/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/SAAdvert.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/SAAdvert.java @@ -47,7 +47,6 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; - import org.metricshub.wbem.sblim.slp.ServiceLocationAttribute; import org.metricshub.wbem.sblim.slp.ServiceLocationException; @@ -63,15 +62,14 @@ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | # auth * blocks | authentication block (if any) \ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * + * */ /** * SAAdvert message - * + * */ public class SAAdvert extends ReplyMessage { - private String iURLStr; private List iScopeList; @@ -80,37 +78,34 @@ public class SAAdvert extends ReplyMessage { /** * parse - * + * * @param pHdr * @param pInStr * @return SLPMessage * @throws ServiceLocationException * @throws IOException */ - public static SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) - throws ServiceLocationException, IOException { - return new SAAdvert(pHdr, pInStr.readString(), pInStr.readStringList(), pInStr - .readAttributeList()); + public static SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) throws ServiceLocationException, IOException { + return new SAAdvert(pHdr, pInStr.readString(), pInStr.readStringList(), pInStr.readAttributeList()); } /** * Ctor. - * + * * @param pURLStr * @param pScopeList * - list of scope strings * @param pAttrList * - list of ServiceLocationAttributes */ - public SAAdvert(String pURLStr, List pScopeList, - List pAttrList) { + public SAAdvert(String pURLStr, List pScopeList, List pAttrList) { super(SA_ADVERT, 0); init(pURLStr, pScopeList, pAttrList); } /** * Ctor. - * + * * @param pLangTag * @param pURLStr * @param pScopeList @@ -118,15 +113,14 @@ public SAAdvert(String pURLStr, List pScopeList, * @param pAttrList * - list of ServiceLocationAttributes */ - public SAAdvert(String pLangTag, String pURLStr, List pScopeList, - List pAttrList) { + public SAAdvert(String pLangTag, String pURLStr, List pScopeList, List pAttrList) { super(SA_ADVERT, pLangTag, 0); init(pURLStr, pScopeList, pAttrList); } /** * Ctor. - * + * * @param pHeader * @param pURLStr * @param pScopeList @@ -134,8 +128,12 @@ public SAAdvert(String pLangTag, String pURLStr, List pScopeList, * @param pAttrList * - list of ServiceLocationAttributes */ - public SAAdvert(MsgHeader pHeader, String pURLStr, List pScopeList, - List pAttrList) { + public SAAdvert( + MsgHeader pHeader, + String pURLStr, + List pScopeList, + List pAttrList + ) { super(pHeader, 0); init(pURLStr, pScopeList, pAttrList); } @@ -152,12 +150,14 @@ public Iterator getResultIterator() { */ @Override protected boolean serializeBody(SLPOutputStream pOutStr, SerializeOption pOption) { - return pOutStr.write(this.iURLStr) && pOutStr.writeStringList(this.iScopeList) - && pOutStr.writeAttributeList(this.iAttrList); + return ( + pOutStr.write(this.iURLStr) && + pOutStr.writeStringList(this.iScopeList) && + pOutStr.writeAttributeList(this.iAttrList) + ); } - private void init(String pURLStr, List pScopeList, - List pAttrList) { + private void init(String pURLStr, List pScopeList, List pAttrList) { this.iURLStr = pURLStr; this.iScopeList = pScopeList; this.iAttrList = pAttrList; @@ -168,5 +168,4 @@ public Iterator getExceptionIterator() { // this message doesn't have exception table return null; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/SLPInputStream.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/SLPInputStream.java index 93a0d2e..b81fa4f 100644 --- a/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/SLPInputStream.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/SLPInputStream.java @@ -58,28 +58,26 @@ import java.util.SortedSet; import java.util.StringTokenizer; import java.util.TreeSet; - import org.metricshub.wbem.sblim.slp.ServiceLocationAttribute; +import org.metricshub.wbem.sblim.slp.ServiceLocationException; import org.metricshub.wbem.sblim.slp.ServiceType; import org.metricshub.wbem.sblim.slp.ServiceURL; import org.metricshub.wbem.sblim.slp.internal.Convert; import org.metricshub.wbem.sblim.slp.internal.SLPDefaults; import org.metricshub.wbem.sblim.slp.internal.TRC; -import org.metricshub.wbem.sblim.slp.ServiceLocationException; /** * Helps the parsing of the bytes of SLP messages. - * + * */ public class SLPInputStream { - private InputStream iInStr; private final byte[] iBBuf = new byte[4]; /** * Ctor. - * + * * @param pBytes */ public SLPInputStream(byte[] pBytes) { @@ -88,7 +86,7 @@ public SLPInputStream(byte[] pBytes) { /** * Ctor. - * + * * @param pSock * @throws IOException */ @@ -98,7 +96,7 @@ public SLPInputStream(Socket pSock) throws IOException { /** * Ctor. - * + * * @param pInStr */ public SLPInputStream(InputStream pInStr) { @@ -107,7 +105,7 @@ public SLPInputStream(InputStream pInStr) { /** * Ctor. - * + * * @param pPacket */ public SLPInputStream(DatagramPacket pPacket) { @@ -116,7 +114,7 @@ public SLPInputStream(DatagramPacket pPacket) { /** * Ctor. - * + * * @param pBytes * @param pOffset * @param pLength @@ -127,7 +125,7 @@ public SLPInputStream(byte[] pBytes, int pOffset, int pLength) { /** * readString - * + * * @return String * @throws ServiceLocationException * @throws IOException @@ -138,7 +136,7 @@ public String readString() throws ServiceLocationException, IOException { /** * readStringSet - * + * * @return SortedSet of Strings * @throws ServiceLocationException * @throws IOException @@ -151,7 +149,7 @@ public SortedSet readStringSet() throws ServiceLocationException, IOExce /** * readStringList - * + * * @return List of Strings * @throws ServiceLocationException * @throws IOException @@ -164,7 +162,7 @@ public List readStringList() throws ServiceLocationException, IOExceptio /** * readAttribute - * + * * @return ServiceLocationAttribute * @throws ServiceLocationException * @throws IOException @@ -176,20 +174,19 @@ public ServiceLocationAttribute readAttribute() throws ServiceLocationException, /** * readAttributeList - * + * * @return List of ServiceLocationAttributes * @throws ServiceLocationException * @throws IOException */ - public List readAttributeList() throws ServiceLocationException, - IOException { + public List readAttributeList() throws ServiceLocationException, IOException { String str = readRawString(); return str == null ? null : new AttrListParser(str).getList(); } /** * # of AttrAuths |(if present) Attribute Authentication Blocks... - * + * * @return null * @throws ServiceLocationException * @throws IOException @@ -199,8 +196,9 @@ public List readAuthBlockList() throws ServiceLocationException, IOException if (blockCntInt == null) return null; int blockCnt = blockCntInt.intValue(); if (blockCnt != 0) throw new ServiceLocationException( - ServiceLocationException.NOT_IMPLEMENTED, - "Handling of authentication blocks is not implemented! blockCount = " + blockCnt); + ServiceLocationException.NOT_IMPLEMENTED, + "Handling of authentication blocks is not implemented! blockCount = " + blockCnt + ); return null; } @@ -238,18 +236,17 @@ public ServiceURL readURL() throws ServiceLocationException, IOException { /** * readUrlList - * + * * @param pURLExceptions * @return List of valid ServiceURLs * @throws ServiceLocationException * @throws IOException - * + * * Add URL to list only if it is valid URL i.e. no exception is * thrown by parser - * + * */ - public List readUrlList(List pURLExceptions) - throws ServiceLocationException, IOException { + public List readUrlList(List pURLExceptions) throws ServiceLocationException, IOException { Integer cntInt = doRead16(); if (cntInt == null) return null; int cnt = cntInt.intValue(); @@ -270,7 +267,7 @@ public List readUrlList(List pURLExceptions) /** * readServiceType - * + * * @return ServiceType * @throws ServiceLocationException * @throws IOException @@ -282,7 +279,7 @@ public ServiceType readServiceType() throws ServiceLocationException, IOExceptio /** * readServTypeList - * + * * @return List of ServiceTypes * @throws ServiceLocationException * @throws IOException @@ -298,57 +295,65 @@ public List readServTypeList() throws ServiceLocationException, IOE /** * read8 - * + * * @return int * @throws ServiceLocationException * @throws IOException */ public int read8() throws ServiceLocationException, IOException { Integer res = doRead8(); - if (res == null) throw new ServiceLocationException(ServiceLocationException.PARSE_ERROR, - "Failed to read byte field!"); + if (res == null) throw new ServiceLocationException( + ServiceLocationException.PARSE_ERROR, + "Failed to read byte field!" + ); return res.intValue(); } /** * read16 - * + * * @return int * @throws ServiceLocationException * @throws IOException */ public int read16() throws ServiceLocationException, IOException { Integer res = doRead16(); - if (res == null) throw new ServiceLocationException(ServiceLocationException.PARSE_ERROR, - "Failed to read 2-byte-long field!"); + if (res == null) throw new ServiceLocationException( + ServiceLocationException.PARSE_ERROR, + "Failed to read 2-byte-long field!" + ); return res.intValue(); } /** * read24 - * + * * @return int * @throws ServiceLocationException * @throws IOException */ public int read24() throws ServiceLocationException, IOException { Integer res = doRead24(); - if (res == null) throw new ServiceLocationException(ServiceLocationException.PARSE_ERROR, - "Failed to read 3-byte-long field!"); + if (res == null) throw new ServiceLocationException( + ServiceLocationException.PARSE_ERROR, + "Failed to read 3-byte-long field!" + ); return res.intValue(); } /** * read32 - * + * * @return long * @throws ServiceLocationException * @throws IOException */ public long read32() throws ServiceLocationException, IOException { Long res = doRead32(); - if (res == null) throw new ServiceLocationException(ServiceLocationException.PARSE_ERROR, - "Failed to read 4-byte-long field!"); + if (res == null) throw new ServiceLocationException( + ServiceLocationException.PARSE_ERROR, + "Failed to read 4-byte-long field!" + ); return res.longValue(); } @@ -366,8 +371,7 @@ private Integer doRead16() throws IOException { private Integer doRead24() throws IOException { int cnt = this.iInStr.read(this.iBBuf, 0, 3); if (cnt != 3) return null; - return Integer.valueOf((this.iBBuf[0] & 0xff) << 16 | (this.iBBuf[1] & 0xff) << 8 - | this.iBBuf[2] & 0xff); + return Integer.valueOf((this.iBBuf[0] & 0xff) << 16 | (this.iBBuf[1] & 0xff) << 8 | this.iBBuf[2] & 0xff); } private Long doRead32() throws IOException { @@ -395,17 +399,14 @@ private String readRawString() throws ServiceLocationException, IOException { } } - private void readStringCollection(Collection pCol) throws ServiceLocationException, - IOException { + private void readStringCollection(Collection pCol) throws ServiceLocationException, IOException { String rawListStr = readRawString(); if (rawListStr == null) return; StringTokenizer tokenizer = new StringTokenizer(rawListStr, ","); - while (tokenizer.hasMoreElements()) - pCol.add(Convert.unescape(tokenizer.nextToken())); + while (tokenizer.hasMoreElements()) pCol.add(Convert.unescape(tokenizer.nextToken())); } private static class AttrListParser { - private int iPos = 0; private String iAttrListStr; @@ -414,7 +415,7 @@ private static class AttrListParser { /** * Ctor. - * + * * @param pAttrListStr * @throws ServiceLocationException */ @@ -430,7 +431,7 @@ public AttrListParser(String pAttrListStr) throws ServiceLocationException { /** * getList - * + * * @return List of ServiceLocationAttributes */ public List getList() { @@ -451,17 +452,17 @@ private String readEntry() throws ServiceLocationException { char ch = this.iAttrListStr.charAt(this.iPos); if (ch == '(') { if (inBlock || this.iPos != startPos) throw new ServiceLocationException( - ServiceLocationException.PARSE_ERROR, invalidChar('(')); + ServiceLocationException.PARSE_ERROR, + invalidChar('(') + ); inBlock = true; } else if (ch == ')') { - if (!inBlock) throw new ServiceLocationException( - ServiceLocationException.PARSE_ERROR, invalidChar(')')); + if (!inBlock) throw new ServiceLocationException(ServiceLocationException.PARSE_ERROR, invalidChar(')')); if (this.iPos == lastIdx) return this.iAttrListStr.substring(startPos); inBlock = false; } else { if (inBlock) { - if (this.iPos == lastIdx) - /* + if (this.iPos == lastIdx) /* * throw new ServiceLocationException( * ServiceLocationException.PARSE_ERROR, "There is no * ')' for '(' !" ); @@ -472,12 +473,15 @@ private String readEntry() throws ServiceLocationException { ++this.iPos; return this.iAttrListStr.substring(startPos, this.iPos - 1); } - if (this.iPos == lastIdx) { return this.iAttrListStr.substring(startPos); } + if (this.iPos == lastIdx) { + return this.iAttrListStr.substring(startPos); + } } } if (this.iPos == lastIdx) throw new ServiceLocationException( - ServiceLocationException.PARSE_ERROR, "Unexpected end of Attribute list:\n" - + this.iAttrListStr); + ServiceLocationException.PARSE_ERROR, + "Unexpected end of Attribute list:\n" + this.iAttrListStr + ); ++this.iPos; } } @@ -486,17 +490,14 @@ private String readEntry() throws ServiceLocationException { * @param ch */ private String invalidChar(char ch) { - return "Invalid '(' character in Attribute list:\n" + this.iAttrListStr - + "\nat position: " + this.iPos; + return "Invalid '(' character in Attribute list:\n" + this.iAttrListStr + "\nat position: " + this.iPos; } - } /** * @param pMsg */ static void debug(String pMsg) { - // System.out.println(pMsg); + // System.out.println(pMsg); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/SLPMessage.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/SLPMessage.java index b09caa8..6a4f51c 100644 --- a/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/SLPMessage.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/SLPMessage.java @@ -22,9 +22,6 @@ package org.metricshub.wbem.sblim.slp.internal.msg; -import org.metricshub.wbem.sblim.slp.internal.SLPConfig; -import org.metricshub.wbem.sblim.slp.internal.SLPDefaults; - /*- * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ * WBEM Java Client @@ -46,13 +43,14 @@ */ import org.metricshub.wbem.sblim.slp.ServiceLocationException; +import org.metricshub.wbem.sblim.slp.internal.SLPConfig; +import org.metricshub.wbem.sblim.slp.internal.SLPDefaults; /** * SLPMessage - * + * */ public abstract class SLPMessage implements FunctionIDs { - // cache it for instance lifetime, do not parse always private final int iMaxDatagramSize = SLPConfig.getGlobalCfg().getMTU(); @@ -60,7 +58,7 @@ public abstract class SLPMessage implements FunctionIDs { /** * Ctor. - * + * * @param pFunctionID */ public SLPMessage(int pFunctionID) { @@ -69,18 +67,17 @@ public SLPMessage(int pFunctionID) { /** * Ctor. - * + * * @param pFunctionID * @param pLangTag */ public SLPMessage(int pFunctionID, String pLangTag) { - this(new MsgHeader(MsgHeader.VERSION, pFunctionID, pLangTag, false, pFunctionID == SRV_REG, - false, 0)); + this(new MsgHeader(MsgHeader.VERSION, pFunctionID, pLangTag, false, pFunctionID == SRV_REG, false, 0)); } /** * Ctor. - * + * * @param pHeader */ public SLPMessage(MsgHeader pHeader) { @@ -89,7 +86,7 @@ public SLPMessage(MsgHeader pHeader) { /** * getHeader - * + * * @return MsgHeader */ public MsgHeader getHeader() { @@ -98,7 +95,7 @@ public MsgHeader getHeader() { /** * getVersion - * + * * @return int */ public int getVersion() { @@ -107,7 +104,7 @@ public int getVersion() { /** * getFunctionID - * + * * @return int */ public int getFunctionID() { @@ -116,7 +113,7 @@ public int getFunctionID() { /** * getLangTag - * + * * @return String */ public String getLangTag() { @@ -125,7 +122,7 @@ public String getLangTag() { /** * overflows - * + * * @return boolean */ public boolean overflows() { @@ -134,7 +131,7 @@ public boolean overflows() { /** * fresh - * + * * @return boolean */ public boolean fresh() { @@ -143,7 +140,7 @@ public boolean fresh() { /** * multicast - * + * * @return boolean */ public boolean multicast() { @@ -152,7 +149,7 @@ public boolean multicast() { /** * getXID - * + * * @return int */ public int getXID() { @@ -169,7 +166,7 @@ public void setXID(int pXID) { /** * serialize - * + * * @param pSetMulticastFlag * @param pDatagramLimited * @param pKeepXID @@ -177,13 +174,13 @@ public void setXID(int pXID) { * @throws ServiceLocationException */ public byte[] serialize(boolean pSetMulticastFlag, boolean pDatagramLimited, boolean pKeepXID) - throws ServiceLocationException { + throws ServiceLocationException { return serialize(pSetMulticastFlag, pDatagramLimited, pKeepXID, null); } /** * serialize - * + * * @param pSetMulticastFlag * @param pDatagramLimited * @param pKeepXID @@ -193,14 +190,19 @@ public byte[] serialize(boolean pSetMulticastFlag, boolean pDatagramLimited, boo * @return byte[] * @throws ServiceLocationException */ - public byte[] serialize(boolean pSetMulticastFlag, boolean pDatagramLimited, boolean pKeepXID, - SerializeOption pOption) throws ServiceLocationException { - SLPOutputStream bodyOutStr = new SLPOutputStream(pDatagramLimited ? this.iMaxDatagramSize - - this.iHeader.getSize() : -1); + public byte[] serialize( + boolean pSetMulticastFlag, + boolean pDatagramLimited, + boolean pKeepXID, + SerializeOption pOption + ) + throws ServiceLocationException { + SLPOutputStream bodyOutStr = new SLPOutputStream( + pDatagramLimited ? this.iMaxDatagramSize - this.iHeader.getSize() : -1 + ); boolean fit = serializeBody(bodyOutStr, pOption); byte[] bodyBytes = bodyOutStr.toByteArray(); - byte[] headerBytes = this.iHeader.serialize(bodyBytes.length, !fit, pSetMulticastFlag, - pKeepXID); + byte[] headerBytes = this.iHeader.serialize(bodyBytes.length, !fit, pSetMulticastFlag, pKeepXID); byte[] bytes = new byte[headerBytes.length + bodyBytes.length]; System.arraycopy(headerBytes, 0, bytes, 0, headerBytes.length); System.arraycopy(bodyBytes, 0, bytes, headerBytes.length, bodyBytes.length); @@ -212,11 +214,10 @@ public byte[] serialize(boolean pSetMulticastFlag, boolean pDatagramLimited, boo * limit) */ protected abstract boolean serializeBody(SLPOutputStream pOutStr, SerializeOption pOption) - throws ServiceLocationException; + throws ServiceLocationException; @Override public String toString() { return super.toString() + " " + getXID(); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/SLPOutputStream.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/SLPOutputStream.java index e4ba0f6..ef3ec73 100644 --- a/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/SLPOutputStream.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/SLPOutputStream.java @@ -47,7 +47,6 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; - import org.metricshub.wbem.sblim.slp.ServiceLocationAttribute; import org.metricshub.wbem.sblim.slp.ServiceType; import org.metricshub.wbem.sblim.slp.ServiceURL; @@ -57,10 +56,9 @@ /** * SLPOutputStream helps the building of SLP message bytes - * + * */ public class SLPOutputStream { - private static final int MAX_FIELD_SIZE = 65535; private static final byte[] EMPTY_BYTES = new byte[0]; @@ -78,7 +76,7 @@ public SLPOutputStream() { /** * Ctor. - * + * * @param pStreamLimit */ public SLPOutputStream(int pStreamLimit) { @@ -87,7 +85,7 @@ public SLPOutputStream(int pStreamLimit) { /** * size - * + * * @return int */ public int size() { @@ -96,7 +94,7 @@ public int size() { /** * freeSpace - * + * * @return int */ public int freeSpace() { @@ -105,7 +103,7 @@ public int freeSpace() { /** * toByteArray - * + * * @return byte[] */ public byte[] toByteArray() { @@ -114,7 +112,7 @@ public byte[] toByteArray() { /** * write - * + * * @param pBytes * @return boolean */ @@ -126,7 +124,7 @@ public boolean write(byte[] pBytes) { /** * write - * + * * @param pServType * @return boolean */ @@ -169,7 +167,7 @@ public boolean write(ServiceURL pURL) { /** * writeURLList - * + * * @param pURLList * @return boolean */ @@ -190,7 +188,7 @@ public boolean writeURLList(List pURLList) { /** * writeServTypeList - * + * * @param pServTypeList * @return boolean */ @@ -200,21 +198,20 @@ public boolean writeServTypeList(List pServTypeList) { /** * writeServTypeList - * + * * @param pServTypeItr * @return boolean */ public boolean writeServTypeList(Iterator pServTypeItr) { if (pServTypeItr == null) return writeStringList((Iterator) null); ArrayList servTypeList = new ArrayList(); - while (pServTypeItr.hasNext()) - servTypeList.add(((ServiceType) pServTypeItr.next()).toString()); + while (pServTypeItr.hasNext()) servTypeList.add(((ServiceType) pServTypeItr.next()).toString()); return writeStringList(servTypeList); } /** * writeAttributeList - * + * * @param pAttrList * @return boolean */ @@ -224,35 +221,34 @@ public boolean writeAttributeList(List pAttrList) { /** * writeAttributeList - * + * * @param pAttrItr * @return boolean */ public boolean writeAttributeList(Iterator pAttrItr) { if (pAttrItr == null) return writeStringList((Iterator) null); ArrayList attrStrList = new ArrayList(); - while (pAttrItr.hasNext()) - attrStrList.add(AttributeHandler - .buildString((ServiceLocationAttribute) pAttrItr.next())); + while (pAttrItr.hasNext()) attrStrList.add( + AttributeHandler.buildString((ServiceLocationAttribute) pAttrItr.next()) + ); return writeStringList(attrStrList, null); } /** * # of AttrAuths |(if present) Attribute Authentication Blocks... - * + * * @param pAuthBlockList * @return boolean */ public boolean writeAuthBlockList(List pAuthBlockList) { int cnt = pAuthBlockList == null ? 0 : pAuthBlockList.size(); - if (cnt != 0) TRC - .error("Handling of non empty authentication block list is not implemented!"); + if (cnt != 0) TRC.error("Handling of non empty authentication block list is not implemented!"); return write8(0); } /** * write - * + * * @param pStr * @return boolean */ @@ -262,14 +258,13 @@ public boolean write(String pStr) { /** * write - * + * * @param pStr * @param pReservedChars * @return boolean */ public boolean write(String pStr, String pReservedChars) { - byte[] bytes = pStr == null ? EMPTY_BYTES : Convert.getBytes(Convert.escape(pStr, - pReservedChars)); + byte[] bytes = pStr == null ? EMPTY_BYTES : Convert.getBytes(Convert.escape(pStr, pReservedChars)); if (bytes.length > MAX_FIELD_SIZE) return false; if (freeSpace() < bytes.length + 2) return false; writeNoChk16(bytes.length); @@ -279,7 +274,7 @@ public boolean write(String pStr, String pReservedChars) { /** * writeStringList - * + * * @param pStrList * @return boolean */ @@ -289,7 +284,7 @@ public boolean writeStringList(List pStrList) { /** * writeStringList - * + * * @param pStrListItr * @return boolean */ @@ -299,7 +294,7 @@ public boolean writeStringList(Iterator pStrListItr) { /** * writeStringList - * + * * @param pStrList * @param pReservedChars * @return boolean @@ -310,7 +305,7 @@ public boolean writeStringList(List pStrList, String pReservedChars) { /** * writeStringList - * + * * @param pStrListItr * @param pReservedChars * @return true if all list items are written to the stream, otherwise false @@ -344,7 +339,7 @@ public boolean writeStringList(Iterator pStrListItr, String pReservedCha /** * write8 - * + * * @param pValue * @return boolean */ @@ -356,7 +351,7 @@ public boolean write8(int pValue) { /** * write16 - * + * * @param pValue * @return boolean */ @@ -368,7 +363,7 @@ public boolean write16(int pValue) { /** * write24 - * + * * @param pValue * @return boolean */ @@ -380,7 +375,7 @@ public boolean write24(int pValue) { /** * write32 - * + * * @param pValue * @return boolean */ @@ -392,7 +387,7 @@ public boolean write32(long pValue) { /** * writeNoChk - * + * * @param pBytes */ public void writeNoChk(byte[] pBytes) { @@ -401,7 +396,7 @@ public void writeNoChk(byte[] pBytes) { /** * writeNoChk8 - * + * * @param pValue */ public void writeNoChk8(int pValue) { @@ -410,7 +405,7 @@ public void writeNoChk8(int pValue) { /** * writeNoChk16 - * + * * @param pValue */ public void writeNoChk16(int pValue) { @@ -420,7 +415,7 @@ public void writeNoChk16(int pValue) { /** * writeNoChk24 - * + * * @param pValue */ public void writeNoChk24(int pValue) { @@ -430,7 +425,7 @@ public void writeNoChk24(int pValue) { /** * writeNoChk32 - * + * * @param pValue */ public void writeNoChk32(long pValue) { diff --git a/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/SerializeOption.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/SerializeOption.java index 40a1627..ed7e464 100644 --- a/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/SerializeOption.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/SerializeOption.java @@ -43,10 +43,9 @@ /** * Inherited classes of SerializeOption provide additional serialization * parameters for the inherited SLPMessage classes. - * + * */ public abstract class SerializeOption { - /* * Inherited classes add the methods. */ diff --git a/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/ServiceAcknowledgment.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/ServiceAcknowledgment.java index 64b1769..279842f 100644 --- a/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/ServiceAcknowledgment.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/ServiceAcknowledgment.java @@ -45,32 +45,30 @@ import java.io.IOException; import java.util.Iterator; - import org.metricshub.wbem.sblim.slp.ServiceLocationException; /** * ServiceAcknowledgment message - * + * */ public class ServiceAcknowledgment extends ReplyMessage { /** * parse - * + * * @param pHdr * @param pInStr * @return SLPMessage * @throws ServiceLocationException * @throws IOException */ - public static SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) - throws ServiceLocationException, IOException { + public static SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) throws ServiceLocationException, IOException { return new ServiceAcknowledgment(pHdr, pInStr.read16()); } /** * Ctor. - * + * * @param pErrorCode */ public ServiceAcknowledgment(int pErrorCode) { @@ -79,7 +77,7 @@ public ServiceAcknowledgment(int pErrorCode) { /** * Ctor. - * + * * @param pLangTag * @param pErrorCode */ @@ -89,7 +87,7 @@ public ServiceAcknowledgment(String pLangTag, int pErrorCode) { /** * Ctor. - * + * * @param pHeader * @param pErrorCode */ @@ -116,5 +114,4 @@ public Iterator getExceptionIterator() { // this message doesn't have exception table return null; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/ServiceDeregistration.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/ServiceDeregistration.java index 0b2b58e..e88a4c3 100644 --- a/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/ServiceDeregistration.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/ServiceDeregistration.java @@ -45,9 +45,8 @@ import java.io.IOException; import java.util.List; - -import org.metricshub.wbem.sblim.slp.ServiceURL; import org.metricshub.wbem.sblim.slp.ServiceLocationException; +import org.metricshub.wbem.sblim.slp.ServiceURL; /* * 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 @@ -70,10 +69,9 @@ /** * ServiceDeregistration message - * + * */ public class ServiceDeregistration extends SLPMessage { - private List iScopeList; private ServiceURL iURL; @@ -82,22 +80,20 @@ public class ServiceDeregistration extends SLPMessage { /** * parse - * + * * @param pHdr * @param pInStr * @return SLPMessage * @throws ServiceLocationException * @throws IOException */ - public static SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) - throws ServiceLocationException, IOException { - return new ServiceDeregistration(pHdr, pInStr.readStringList(), pInStr.readURL(), pInStr - .readStringList()); + public static SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) throws ServiceLocationException, IOException { + return new ServiceDeregistration(pHdr, pInStr.readStringList(), pInStr.readURL(), pInStr.readStringList()); } /** * Ctor. - * + * * @param pScopeList * - list of scope strings * @param pURL @@ -110,37 +106,35 @@ public ServiceDeregistration(List pScopeList, ServiceURL pURL, List pScopeList, ServiceURL pURL, - List pTagList) { + public ServiceDeregistration(String pLangTag, List pScopeList, ServiceURL pURL, List pTagList) { super(SRV_DEREG, pLangTag); init(pScopeList, pURL, pTagList); } /** * Ctor. - * + * * @param pHeader * @param pScopeList * - list of scope strings * @param pURL * @param pTagList */ - public ServiceDeregistration(MsgHeader pHeader, List pScopeList, ServiceURL pURL, - List pTagList) { + public ServiceDeregistration(MsgHeader pHeader, List pScopeList, ServiceURL pURL, List pTagList) { super(pHeader); init(pScopeList, pURL, pTagList); } /** * getServiceURL - * + * * @return ServiceURL */ public ServiceURL getServiceURL() { @@ -152,8 +146,9 @@ public ServiceURL getServiceURL() { */ @Override protected boolean serializeBody(SLPOutputStream pOutStr, SerializeOption pOption) { - return pOutStr.writeStringList(this.iScopeList) && pOutStr.write(this.iURL) - && pOutStr.writeStringList(this.iTagList); + return ( + pOutStr.writeStringList(this.iScopeList) && pOutStr.write(this.iURL) && pOutStr.writeStringList(this.iTagList) + ); } private void init(List pScopeList, ServiceURL pURL, List pTagList) { @@ -161,5 +156,4 @@ private void init(List pScopeList, ServiceURL pURL, List pTagLis this.iURL = pURL; this.iTagList = pTagList; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/ServiceRegistration.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/ServiceRegistration.java index db0e105..a396138 100644 --- a/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/ServiceRegistration.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/ServiceRegistration.java @@ -44,10 +44,9 @@ import java.io.IOException; import java.util.List; - import org.metricshub.wbem.sblim.slp.ServiceLocationAttribute; -import org.metricshub.wbem.sblim.slp.ServiceURL; import org.metricshub.wbem.sblim.slp.ServiceLocationException; +import org.metricshub.wbem.sblim.slp.ServiceURL; /* * 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 @@ -67,10 +66,9 @@ */ /** * ServiceRegistration message - * + * */ public class ServiceRegistration extends SLPMessage { - private ServiceURL iServURL; private List iScopeList; @@ -81,24 +79,28 @@ public class ServiceRegistration extends SLPMessage { /** * parse - * + * * @param pHdr * @param pInStr * @return SLPMessage * @throws ServiceLocationException * @throws IOException */ - public static SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) - throws ServiceLocationException, IOException { + public static SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) throws ServiceLocationException, IOException { ServiceURL url = pInStr.readURL(); pInStr.readServiceType(); // FIXME reading dummy SrvType. Correct? - return new ServiceRegistration(pHdr, url, pInStr.readStringList(), pInStr - .readAttributeList(), pInStr.readAuthBlockList()); + return new ServiceRegistration( + pHdr, + url, + pInStr.readStringList(), + pInStr.readAttributeList(), + pInStr.readAuthBlockList() + ); } /** * Ctor. - * + * * @param pServURL * @param pScopeList * - list of scope strings @@ -106,15 +108,19 @@ public static SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) * - list of ServiceLocationAttributes * @param pAuthBlockList */ - public ServiceRegistration(ServiceURL pServURL, List pScopeList, - List pAttrList, List pAuthBlockList) { + public ServiceRegistration( + ServiceURL pServURL, + List pScopeList, + List pAttrList, + List pAuthBlockList + ) { super(SRV_REG); init(pServURL, pScopeList, pAttrList, pAuthBlockList); } /** * Ctor. - * + * * @param pLangTag * @param pServURL * @param pScopeList @@ -123,15 +129,20 @@ public ServiceRegistration(ServiceURL pServURL, List pScopeList, * - list of ServiceLocationAttributes * @param pAuthBlockList */ - public ServiceRegistration(String pLangTag, ServiceURL pServURL, List pScopeList, - List pAttrList, List pAuthBlockList) { + public ServiceRegistration( + String pLangTag, + ServiceURL pServURL, + List pScopeList, + List pAttrList, + List pAuthBlockList + ) { super(SRV_REG, pLangTag); init(pServURL, pScopeList, pAttrList, pAuthBlockList); } /** * Ctor. - * + * * @param pHeader * @param pServURL * @param pScopeList @@ -140,15 +151,20 @@ public ServiceRegistration(String pLangTag, ServiceURL pServURL, List pS * - list of ServiceLocationAttributes * @param pAuthBlockList */ - public ServiceRegistration(MsgHeader pHeader, ServiceURL pServURL, List pScopeList, - List pAttrList, List pAuthBlockList) { + public ServiceRegistration( + MsgHeader pHeader, + ServiceURL pServURL, + List pScopeList, + List pAttrList, + List pAuthBlockList + ) { super(pHeader); init(pServURL, pScopeList, pAttrList, pAuthBlockList); } /** * getServiceURL - * + * * @return ServiceURL */ public ServiceURL getServiceURL() { @@ -157,7 +173,7 @@ public ServiceURL getServiceURL() { /** * getScopeList - * + * * @return List */ public List getScopeList() { @@ -166,7 +182,7 @@ public List getScopeList() { /** * getAttributeList - * + * * @return List */ public List getAttributeList() { @@ -178,18 +194,24 @@ public List getAttributeList() { */ @Override protected boolean serializeBody(SLPOutputStream pOutStr, SerializeOption pOption) { - return pOutStr.write(this.iServURL) && pOutStr.write(this.iServURL.getServiceType()) - && pOutStr.writeStringList(this.iScopeList) - && pOutStr.writeAttributeList(this.iAttrList) - && pOutStr.writeAuthBlockList(this.iAuthBlockList); + return ( + pOutStr.write(this.iServURL) && + pOutStr.write(this.iServURL.getServiceType()) && + pOutStr.writeStringList(this.iScopeList) && + pOutStr.writeAttributeList(this.iAttrList) && + pOutStr.writeAuthBlockList(this.iAuthBlockList) + ); } - private void init(ServiceURL pServURL, List pScopeList, - List pAttrList, List pAuthBlockList) { + private void init( + ServiceURL pServURL, + List pScopeList, + List pAttrList, + List pAuthBlockList + ) { this.iServURL = pServURL; this.iScopeList = pScopeList; this.iAttrList = pAttrList; this.iAuthBlockList = pAuthBlockList; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/ServiceReply.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/ServiceReply.java index 0f1fedb..4e886ff 100644 --- a/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/ServiceReply.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/ServiceReply.java @@ -47,9 +47,8 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; - -import org.metricshub.wbem.sblim.slp.ServiceURL; import org.metricshub.wbem.sblim.slp.ServiceLocationException; +import org.metricshub.wbem.sblim.slp.ServiceURL; /* * 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 @@ -63,25 +62,23 @@ */ /** * ServiceReply message - * + * */ public class ServiceReply extends ReplyMessage { - private List iURLEntries; private List iURLExceptions; /** * parse - * + * * @param pHdr * @param pInStr * @return SLPMessage * @throws ServiceLocationException * @throws IOException */ - public static SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) - throws ServiceLocationException, IOException { + public static SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) throws ServiceLocationException, IOException { int errorCode = pInStr.read16(); ArrayList urlExceptions = new ArrayList(); List urlEntries = pInStr.readUrlList(urlExceptions); @@ -90,7 +87,7 @@ public static SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) /** * Ctor. - * + * * @param pErrorCode * @param pURLEntries * - list of ServiceURLs @@ -102,7 +99,7 @@ public ServiceReply(int pErrorCode, List pURLEntries) { /** * Ctor. - * + * * @param pLangTag * @param pErrorCode * @param pURLEntries @@ -110,8 +107,7 @@ public ServiceReply(int pErrorCode, List pURLEntries) { * @param pURLExceptions * - list of URL Exceptions */ - public ServiceReply(String pLangTag, int pErrorCode, List pURLEntries, - List pURLExceptions) { + public ServiceReply(String pLangTag, int pErrorCode, List pURLEntries, List pURLExceptions) { super(SRV_RPLY, pLangTag, pErrorCode); this.iURLEntries = pURLEntries; this.iURLExceptions = pURLExceptions; @@ -119,7 +115,7 @@ public ServiceReply(String pLangTag, int pErrorCode, List pURLEntrie /** * Ctor. - * + * * @param pHeader * @param pErrorCode * @param pURLEntries @@ -127,8 +123,7 @@ public ServiceReply(String pLangTag, int pErrorCode, List pURLEntrie * @param pURLExceptions * - list of URL Exceptions */ - public ServiceReply(MsgHeader pHeader, int pErrorCode, List pURLEntries, - List pURLExceptions) { + public ServiceReply(MsgHeader pHeader, int pErrorCode, List pURLEntries, List pURLExceptions) { super(pHeader, pErrorCode); this.iURLEntries = pURLEntries; this.iURLExceptions = pURLExceptions; @@ -136,7 +131,7 @@ public ServiceReply(MsgHeader pHeader, int pErrorCode, List pURLEntr /** * getResultIterator - * + * * @return iterator of URL Exception list */ @Override @@ -146,7 +141,7 @@ public Iterator getResultIterator() { /** * getExceptionIterator - * + * * @return iterator of URL Exception list */ @Override @@ -156,7 +151,7 @@ public Iterator getExceptionIterator() { /** * getURLEntries - * + * * @return list of ServiceURLs */ public List getURLEntries() { @@ -165,7 +160,7 @@ public List getURLEntries() { /** * getURLExceptions - * + * * @return list of URL Exceptions */ public List getURLExceptions() { @@ -179,5 +174,4 @@ public List getURLExceptions() { protected boolean serializeBody(SLPOutputStream pOutStr, SerializeOption pOption) { return pOutStr.write16(getErrorCode()) && pOutStr.writeURLList(this.iURLEntries); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/ServiceRequest.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/ServiceRequest.java index ecae18e..e3ac6ad 100644 --- a/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/ServiceRequest.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/ServiceRequest.java @@ -45,9 +45,8 @@ import java.io.IOException; import java.util.List; import java.util.SortedSet; - -import org.metricshub.wbem.sblim.slp.ServiceType; import org.metricshub.wbem.sblim.slp.ServiceLocationException; +import org.metricshub.wbem.sblim.slp.ServiceType; /* * 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 @@ -77,10 +76,9 @@ /** * ServiceRequest message - * + * */ public class ServiceRequest extends RequestMessage { - private ServiceType iServiceType; private String iPredicate, iSlpSpi; @@ -89,26 +87,27 @@ public class ServiceRequest extends RequestMessage { /** * parse - * + * * @param pHdr * @param pInStr * @return SLPMessage * @throws ServiceLocationException * @throws IOException */ - public static SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) - throws ServiceLocationException, IOException { - return new ServiceRequest(pHdr, pInStr.readStringSet(), // prevResponders - pInStr.readServiceType(), // serviceType - pInStr.readStringList(), // scopeList - pInStr.readString(), // predicate - pInStr.readString() // SlpSpi + public static SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) throws ServiceLocationException, IOException { + return new ServiceRequest( + pHdr, + pInStr.readStringSet(), // prevResponders + pInStr.readServiceType(), // serviceType + pInStr.readStringList(), // scopeList + pInStr.readString(), // predicate + pInStr.readString() // SlpSpi ); } /** * Ctor. - * + * * @param pLangTag * @param pPrevResponderSet * - set of address strings @@ -118,15 +117,21 @@ public static SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) * @param pPredicate * @param pSlpSpi */ - public ServiceRequest(String pLangTag, SortedSet pPrevResponderSet, - ServiceType pServiceType, List pScopeList, String pPredicate, String pSlpSpi) { + public ServiceRequest( + String pLangTag, + SortedSet pPrevResponderSet, + ServiceType pServiceType, + List pScopeList, + String pPredicate, + String pSlpSpi + ) { super(SRV_RQST, pLangTag, pPrevResponderSet, pScopeList); init(pServiceType, pPredicate, pSlpSpi); } /** * Ctor. - * + * * @param pPrevResponderSet * - set of address strings * @param pServiceType @@ -135,8 +140,13 @@ public ServiceRequest(String pLangTag, SortedSet pPrevResponderSet, * @param pPredicate * @param pSlpSpi */ - public ServiceRequest(SortedSet pPrevResponderSet, ServiceType pServiceType, - List pScopeList, String pPredicate, String pSlpSpi) { + public ServiceRequest( + SortedSet pPrevResponderSet, + ServiceType pServiceType, + List pScopeList, + String pPredicate, + String pSlpSpi + ) { super(SRV_RQST, pPrevResponderSet, pScopeList); init(pServiceType, pPredicate, pSlpSpi); } @@ -152,15 +162,21 @@ public ServiceRequest(SortedSet pPrevResponderSet, ServiceType pServiceT * - LDAPv3 search filter * @param pSlpSpi */ - public ServiceRequest(MsgHeader pHeader, SortedSet pPrevResponderSet, - ServiceType pServiceType, List pScopeList, String pPredicate, String pSlpSpi) { + public ServiceRequest( + MsgHeader pHeader, + SortedSet pPrevResponderSet, + ServiceType pServiceType, + List pScopeList, + String pPredicate, + String pSlpSpi + ) { super(pHeader, pPrevResponderSet, pScopeList); init(pServiceType, pPredicate, pSlpSpi); } /** * getServiceType - * + * * @return ServiceType */ public ServiceType getServiceType() { @@ -169,8 +185,12 @@ public ServiceType getServiceType() { @Override protected boolean serializeRequestBody(SLPOutputStream pOutStr) { - return pOutStr.write(this.iServiceType) && pOutStr.writeStringList(getScopeList()) - && pOutStr.write(this.iPredicate) && pOutStr.write(this.iSlpSpi); + return ( + pOutStr.write(this.iServiceType) && + pOutStr.writeStringList(getScopeList()) && + pOutStr.write(this.iPredicate) && + pOutStr.write(this.iSlpSpi) + ); } @Override @@ -183,5 +203,4 @@ private void init(ServiceType pServiceType, String pPredicate, String pSlpSpi) { this.iPredicate = pPredicate; this.iSlpSpi = pSlpSpi; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/ServiceTypeReply.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/ServiceTypeReply.java index 7e03758..1a5b2a5 100644 --- a/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/ServiceTypeReply.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/ServiceTypeReply.java @@ -46,9 +46,8 @@ import java.io.IOException; import java.util.Iterator; import java.util.List; - -import org.metricshub.wbem.sblim.slp.ServiceType; import org.metricshub.wbem.sblim.slp.ServiceLocationException; +import org.metricshub.wbem.sblim.slp.ServiceType; /* * 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 @@ -62,29 +61,27 @@ */ /** * ServiceTypeReply message - * + * */ public class ServiceTypeReply extends ReplyMessage { - private List iServTypeList; /** * parse - * + * * @param pHdr * @param pInStr * @return SLPMessage * @throws ServiceLocationException * @throws IOException */ - public static SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) - throws ServiceLocationException, IOException { + public static SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) throws ServiceLocationException, IOException { return new ServiceTypeReply(pHdr, pInStr.read16(), pInStr.readServTypeList()); } /** * Ctor. - * + * * @param pErrorCode * @param pServTypeList * - list of ServiceTypes @@ -96,7 +93,7 @@ public ServiceTypeReply(int pErrorCode, List pServTypeList) { /** * Ctor. - * + * * @param pLangTag * @param pErrorCode * @param pServTypeList @@ -109,7 +106,7 @@ public ServiceTypeReply(String pLangTag, int pErrorCode, List pServ /** * Ctor. - * + * * @param pHeader * @param pErrorCode * @param pServTypeList @@ -138,5 +135,4 @@ public Iterator getExceptionIterator() { // this message doesn't have exception table return null; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/ServiceTypeRequest.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/ServiceTypeRequest.java index 24bafc0..bfe8e49 100644 --- a/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/ServiceTypeRequest.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/ServiceTypeRequest.java @@ -45,7 +45,6 @@ import java.io.IOException; import java.util.List; import java.util.SortedSet; - import org.metricshub.wbem.sblim.slp.ServiceLocationException; /* @@ -62,49 +61,48 @@ */ /** * ServiceTypeRequest message - * + * */ public class ServiceTypeRequest extends RequestMessage { - private String iNamingAuth; private static final int[] ALLOWED_RSPS = { SRV_TYPE_RPLY }; /** * parse - * + * * @param pHdr * @param pInStr * @return SLPMessage * @throws ServiceLocationException * @throws IOException */ - public static SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) - throws ServiceLocationException, IOException { - return new ServiceTypeRequest(pHdr, pInStr.readStringSet(), // prevResponderSet - pInStr.readString(), // naming authority - pInStr.readStringList() // scope list + public static SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) throws ServiceLocationException, IOException { + return new ServiceTypeRequest( + pHdr, + pInStr.readStringSet(), // prevResponderSet + pInStr.readString(), // naming authority + pInStr.readStringList() // scope list ); } /** * Ctor. - * + * * @param pPrevResponderSet * - set of address strings * @param pNamingAuth * @param pScopeList * - set of scope strings */ - public ServiceTypeRequest(SortedSet pPrevResponderSet, String pNamingAuth, - List pScopeList) { + public ServiceTypeRequest(SortedSet pPrevResponderSet, String pNamingAuth, List pScopeList) { super(SRV_TYPE_RQST, pPrevResponderSet, pScopeList); init(pNamingAuth); } /** * Ctor. - * + * * @param pLangTag * @param pPrevResponderSet * - set of address strings @@ -112,15 +110,19 @@ public ServiceTypeRequest(SortedSet pPrevResponderSet, String pNamingAut * @param pScopeList * - set of scope strings */ - public ServiceTypeRequest(String pLangTag, SortedSet pPrevResponderSet, - String pNamingAuth, List pScopeList) { + public ServiceTypeRequest( + String pLangTag, + SortedSet pPrevResponderSet, + String pNamingAuth, + List pScopeList + ) { super(SRV_TYPE_RQST, pLangTag, pPrevResponderSet, pScopeList); init(pNamingAuth); } /** * Ctor. - * + * * @param pHeader * @param pPrevResponderSet * - set of address strings @@ -128,8 +130,12 @@ public ServiceTypeRequest(String pLangTag, SortedSet pPrevResponderSet, * @param pScopeList * - set of scope strings */ - public ServiceTypeRequest(MsgHeader pHeader, SortedSet pPrevResponderSet, - String pNamingAuth, List pScopeList) { + public ServiceTypeRequest( + MsgHeader pHeader, + SortedSet pPrevResponderSet, + String pNamingAuth, + List pScopeList + ) { super(pHeader, pPrevResponderSet, pScopeList); init(pNamingAuth); } @@ -147,5 +153,4 @@ protected int[] getAllowedResponseIDs() { private void init(String pNamingAuth) { this.iNamingAuth = pNamingAuth; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/Util.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/Util.java index b2e4dd8..dcc2280 100644 --- a/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/Util.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/msg/Util.java @@ -44,13 +44,13 @@ /** * Common handful functions can be here. - * + * */ public class Util { /** * getLangTag - * + * * @param pLocale * @return String */ @@ -60,5 +60,4 @@ public static String getLangTag(Locale pLocale) { String lang = pLocale.getLanguage(); return (country != null && country.length() > 0) ? lang + "-" + country : lang; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/slp/internal/sa/DatagramThread.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/sa/DatagramThread.java index 991a426..64ebf2b 100644 --- a/src/main/java/org/metricshub/wbem/sblim/slp/internal/sa/DatagramThread.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/sa/DatagramThread.java @@ -46,24 +46,22 @@ import java.net.InetAddress; import java.net.MulticastSocket; import java.net.SocketTimeoutException; - import org.metricshub.wbem.sblim.slp.internal.SLPConfig; import org.metricshub.wbem.sblim.slp.internal.SLPDefaults; import org.metricshub.wbem.sblim.slp.internal.TRC; /** * DatagramThread - * + * */ public class DatagramThread extends RecieverThread { - private static MulticastSocket cMCastSocket; private DatagramPacket iPacket = new DatagramPacket(new byte[SLPDefaults.MTU], SLPDefaults.MTU); /** * Ctor. - * + * * @param pSrvAgent */ public DatagramThread(ServiceAgent pSrvAgent) { @@ -72,7 +70,7 @@ public DatagramThread(ServiceAgent pSrvAgent) { /** * joinGroup - * + * * @param pGroup * @throws IOException */ @@ -83,7 +81,7 @@ public synchronized void joinGroup(InetAddress pGroup) throws IOException { /** * leaveGroup - * + * * @param pGroup * @throws IOException */ @@ -118,5 +116,4 @@ protected void close() { cMCastSocket.close(); cMCastSocket = null; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/slp/internal/sa/MessageTable.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/sa/MessageTable.java index 336e21a..12c06f1 100644 --- a/src/main/java/org/metricshub/wbem/sblim/slp/internal/sa/MessageTable.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/sa/MessageTable.java @@ -51,37 +51,35 @@ import java.util.Date; import java.util.SortedMap; import java.util.TreeMap; - +import org.metricshub.wbem.sblim.slp.ServiceLocationException; import org.metricshub.wbem.sblim.slp.internal.msg.RequestMessage; import org.metricshub.wbem.sblim.slp.internal.msg.SLPMessage; -import org.metricshub.wbem.sblim.slp.ServiceLocationException; /** * Keeps track of datagram messages. For requests with the same XID the same * responses should be returned. - * + * */ public class MessageTable { private static class RequestDescriptor implements Comparable { - private byte[] iSrcAddress; private byte[] iRequest; /** * Ctor. - * + * * @param pSource * @param pRequest * @throws ServiceLocationException */ - public RequestDescriptor(InetAddress pSource, SLPMessage pRequest) - throws ServiceLocationException { + public RequestDescriptor(InetAddress pSource, SLPMessage pRequest) throws ServiceLocationException { this.iSrcAddress = pSource.getAddress(); - this.iRequest = (pRequest instanceof RequestMessage) ? ((RequestMessage) pRequest) - .serializeWithoutResponders(false, true, true) : pRequest.serialize(false, - true, true); + this.iRequest = + (pRequest instanceof RequestMessage) + ? ((RequestMessage) pRequest).serializeWithoutResponders(false, true, true) + : pRequest.serialize(false, true, true); } public int compareTo(RequestDescriptor pObj) { @@ -104,8 +102,7 @@ private static int compare(byte[] pBytes0, byte[] pBytes1) { public boolean equals(Object pObj) { if (!(pObj instanceof RequestDescriptor)) return false; RequestDescriptor that = (RequestDescriptor) pObj; - return compare(this.iSrcAddress, that.iSrcAddress) == 0 - && compare(this.iRequest, that.iRequest) == 0; + return compare(this.iSrcAddress, that.iSrcAddress) == 0 && compare(this.iRequest, that.iRequest) == 0; } @Override @@ -115,7 +112,6 @@ public int hashCode() { } private static class TableEntry { - private long iTime; private RequestDescriptor iReqDesc; @@ -124,7 +120,7 @@ private static class TableEntry { /** * Ctor. - * + * * @param pTime * @param pReqKey * @param pResponse @@ -137,7 +133,7 @@ public TableEntry(long pTime, RequestDescriptor pReqKey, byte[] pResponse) { /** * getTime - * + * * @return long */ public long getTime() { @@ -146,7 +142,7 @@ public long getTime() { /** * setTime - * + * * @param pTime */ public void setTime(long pTime) { @@ -155,7 +151,7 @@ public void setTime(long pTime) { /** * getRequestDescriptor - * + * * @return RequestDescriptor */ public RequestDescriptor getRequestDescriptor() { @@ -164,13 +160,12 @@ public RequestDescriptor getRequestDescriptor() { /** * getResponse - * + * * @return byte[] */ public byte[] getResponse() { return this.iResponse; } - } /** @@ -190,14 +185,13 @@ public byte[] getResponse() { /** * getResponse - * + * * @param pSource * @param pRequest * @return byte[] * @throws ServiceLocationException */ - public synchronized byte[] getResponse(InetAddress pSource, SLPMessage pRequest) - throws ServiceLocationException { + public synchronized byte[] getResponse(InetAddress pSource, SLPMessage pRequest) throws ServiceLocationException { long now = getSecs(); RequestDescriptor reqDesc = new RequestDescriptor(pSource, pRequest); TableEntry entry = this.iReqMap.get(reqDesc); @@ -209,14 +203,14 @@ public synchronized byte[] getResponse(InetAddress pSource, SLPMessage pRequest) /** * addResponse - * + * * @param pSource * @param pRequest * @param pRespond * @throws ServiceLocationException */ public synchronized void addResponse(InetAddress pSource, SLPMessage pRequest, byte[] pRespond) - throws ServiceLocationException { + throws ServiceLocationException { insert(new TableEntry(getSecs(), new RequestDescriptor(pSource, pRequest), pRespond)); clean(); } @@ -250,5 +244,4 @@ private void updateTime(TableEntry pEntry, long pTime) { private static long getSecs() { return new Date().getTime() / 1000; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/slp/internal/sa/RecieverThread.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/sa/RecieverThread.java index 371c4f4..1e786bf 100644 --- a/src/main/java/org/metricshub/wbem/sblim/slp/internal/sa/RecieverThread.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/sa/RecieverThread.java @@ -41,16 +41,14 @@ */ import java.io.IOException; - -import org.metricshub.wbem.sblim.slp.internal.TRC; import org.metricshub.wbem.sblim.slp.ServiceLocationException; +import org.metricshub.wbem.sblim.slp.internal.TRC; /** * RecieverThread - * + * */ public abstract class RecieverThread implements Runnable { - private Thread iThread; private volatile boolean iStop; @@ -63,7 +61,7 @@ public abstract class RecieverThread implements Runnable { /** * Ctor. - * + * * @param pName * @param pSrvAgent */ @@ -103,7 +101,7 @@ public void stop() { /** * stop - * + * * @param pWait */ public void stop(boolean pWait) { @@ -171,5 +169,4 @@ private static void sleep(int pMillis) { TRC.error(e); } } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/slp/internal/sa/ServiceAgent.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/sa/ServiceAgent.java index 068c4b3..4b61e1b 100644 --- a/src/main/java/org/metricshub/wbem/sblim/slp/internal/sa/ServiceAgent.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/sa/ServiceAgent.java @@ -51,15 +51,18 @@ import java.net.Socket; import java.net.UnknownHostException; import java.util.List; - +import org.metricshub.wbem.sblim.slp.ServiceLocationException; import org.metricshub.wbem.sblim.slp.ServiceURL; import org.metricshub.wbem.sblim.slp.internal.IPv6MulticastAddressFactory; +import org.metricshub.wbem.sblim.slp.internal.Net; import org.metricshub.wbem.sblim.slp.internal.SLPConfig; import org.metricshub.wbem.sblim.slp.internal.SLPDefaults; import org.metricshub.wbem.sblim.slp.internal.TRC; import org.metricshub.wbem.sblim.slp.internal.msg.AttributeReply; import org.metricshub.wbem.sblim.slp.internal.msg.AttributeRequest; +import org.metricshub.wbem.sblim.slp.internal.msg.FunctionIDs; import org.metricshub.wbem.sblim.slp.internal.msg.MsgFactory; +import org.metricshub.wbem.sblim.slp.internal.msg.ReplyMessage; import org.metricshub.wbem.sblim.slp.internal.msg.RequestMessage; import org.metricshub.wbem.sblim.slp.internal.msg.SLPMessage; import org.metricshub.wbem.sblim.slp.internal.msg.ServiceAcknowledgment; @@ -68,20 +71,14 @@ import org.metricshub.wbem.sblim.slp.internal.msg.ServiceReply; import org.metricshub.wbem.sblim.slp.internal.msg.ServiceRequest; import org.metricshub.wbem.sblim.slp.internal.msg.ServiceTypeReply; -import org.metricshub.wbem.sblim.slp.ServiceLocationException; -import org.metricshub.wbem.sblim.slp.internal.Net; -import org.metricshub.wbem.sblim.slp.internal.msg.FunctionIDs; -import org.metricshub.wbem.sblim.slp.internal.msg.ReplyMessage; /** * ServiceAgent - * + * */ public class ServiceAgent implements FunctionIDs { - - private boolean iUseV4 = Net.hasIPv4() && SLPConfig.getGlobalCfg().useIPv4(), iUseV6 = Net - .hasIPv6() - && SLPConfig.getGlobalCfg().useIPv6(); + private boolean iUseV4 = Net.hasIPv4() && SLPConfig.getGlobalCfg().useIPv4(), iUseV6 = + Net.hasIPv6() && SLPConfig.getGlobalCfg().useIPv6(); boolean iStarted; @@ -97,7 +94,7 @@ public class ServiceAgent implements FunctionIDs { /** * main - * + * * @param pArgs * @throws IOException */ @@ -120,7 +117,7 @@ public static void main(String[] pArgs) throws IOException { /** * setSkipFirstRequest - * + * * @param pValue */ public void setSkipFirstRequest(boolean pValue) { @@ -129,7 +126,7 @@ public void setSkipFirstRequest(boolean pValue) { /** * start - * + * * @throws IOException */ public void start() throws IOException { @@ -149,8 +146,7 @@ public void start() throws IOException { // join multicast groups if (this.iUseV4) this.iDGThread.joinGroup(SLPConfig.getMulticastAddress()); if (this.iUseV6) { - this.iDGThread.joinGroup(IPv6MulticastAddressFactory - .getSrvLocAddress(SLPDefaults.IPV6_MULTICAST_SCOPE)); + this.iDGThread.joinGroup(IPv6MulticastAddressFactory.getSrvLocAddress(SLPDefaults.IPV6_MULTICAST_SCOPE)); } } @@ -164,12 +160,11 @@ public void stop() { this.iDGThread.stop(); } this.iStarted = false; - } /** * processMessage - * + * * @param pDGSock * @param pPacket */ @@ -209,8 +204,7 @@ public void processMessage(DatagramSocket pDGSock, DatagramPacket pPacket) { if (reply != null) { try { TRC.debug("sending response"); - pDGSock.send(new DatagramPacket(reply, reply.length, pPacket.getAddress(), pPacket - .getPort())); + pDGSock.send(new DatagramPacket(reply, reply.length, pPacket.getAddress(), pPacket.getPort())); } catch (IOException e) { TRC.error(e); } @@ -219,7 +213,7 @@ public void processMessage(DatagramSocket pDGSock, DatagramPacket pPacket) { /** * processMessage - * + * * @param pStreamSock */ public void processMessage(Socket pStreamSock) { @@ -262,8 +256,9 @@ public void processMessage(Socket pStreamSock) { */ private SLPMessage makeReply(SLPMessage pRequest) throws ServiceLocationException { try { - SLPMessage msg = pRequest instanceof RequestMessage ? makeReply4Request((RequestMessage) pRequest) - : makeReply4Others(pRequest); + SLPMessage msg = pRequest instanceof RequestMessage + ? makeReply4Request((RequestMessage) pRequest) + : makeReply4Others(pRequest); if (msg != null) msg.setXID(pRequest.getXID()); return msg; } catch (UnknownHostException e) { @@ -273,7 +268,6 @@ private SLPMessage makeReply(SLPMessage pRequest) throws ServiceLocationExceptio TRC.error(e); throw new ServiceLocationException(ServiceLocationException.NETWORK_ERROR); } - } private ReplyMessage makeReply4Request(RequestMessage pRequest) { @@ -283,15 +277,13 @@ private ReplyMessage makeReply4Request(RequestMessage pRequest) { case SRV_RQST: ServiceRequest srvRqst = (ServiceRequest) pRequest; if (SLPDefaults.DA_SERVICE_TYPE.equals(srvRqst.getServiceType())) return null; - List urlList = this.iSrvTable.getServiceURLs(srvRqst.getServiceType(), - scopes); + List urlList = this.iSrvTable.getServiceURLs(srvRqst.getServiceType(), scopes); TRC.debug("srvReply : " + urlList); replyMsg = new ServiceReply(0, urlList); break; case ATTR_RQST: AttributeRequest attrRqst = (AttributeRequest) pRequest; - replyMsg = new AttributeReply(0, this.iSrvTable.getAttributes(attrRqst - .getServiceURL(), scopes)); + replyMsg = new AttributeReply(0, this.iSrvTable.getAttributes(attrRqst.getServiceURL(), scopes)); break; case SRV_TYPE_RQST: // ServiceTypeRequest srvTypeRqst = @@ -308,8 +300,7 @@ private SLPMessage makeReply4Others(SLPMessage pRequest) throws IOException { switch (pRequest.getFunctionID()) { case SRV_REG: ServiceRegistration srvReg = (ServiceRegistration) pRequest; - this.iSrvTable.add(srvReg.getServiceURL(), srvReg.getAttributeList(), srvReg - .getScopeList()); + this.iSrvTable.add(srvReg.getServiceURL(), srvReg.getAttributeList(), srvReg.getScopeList()); return new ServiceAcknowledgment(0); case SRV_DEREG: ServiceDeregistration srvDereg = (ServiceDeregistration) pRequest; @@ -357,5 +348,4 @@ private static byte[] makeErrorReply(SLPMessage pRequest, int pErrorCode) { return null; } } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/slp/internal/sa/ServiceTable.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/sa/ServiceTable.java index dd29f23..60f04ff 100644 --- a/src/main/java/org/metricshub/wbem/sblim/slp/internal/sa/ServiceTable.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/sa/ServiceTable.java @@ -49,22 +49,20 @@ import java.util.HashSet; import java.util.Iterator; import java.util.List; - import org.metricshub.wbem.sblim.slp.ServiceLocationAttribute; import org.metricshub.wbem.sblim.slp.ServiceType; import org.metricshub.wbem.sblim.slp.ServiceURL; import org.metricshub.wbem.sblim.slp.internal.IPv6MulticastAddressFactory; +import org.metricshub.wbem.sblim.slp.internal.Net; import org.metricshub.wbem.sblim.slp.internal.SLPConfig; import org.metricshub.wbem.sblim.slp.internal.SLPDefaults; import org.metricshub.wbem.sblim.slp.internal.TRC; -import org.metricshub.wbem.sblim.slp.internal.Net; /** * ServiceTable - * + * */ public class ServiceTable { - DatagramThread iDgramThread; private boolean iUseV6 = Net.hasIPv6() && SLPConfig.getGlobalCfg().useIPv6(); @@ -72,7 +70,6 @@ public class ServiceTable { class AddressHashTable { class Counter { - /** * iValue */ @@ -86,7 +83,7 @@ class Counter { /** * register - * + * * @param pType * @throws UnknownHostException * @throws IOException @@ -98,17 +95,17 @@ public void register(ServiceType pType) throws UnknownHostException, IOException if (cntr == null) { cntr = new Counter(); this.iMap.put(hash, cntr); - ServiceTable.this.iDgramThread.joinGroup(IPv6MulticastAddressFactory.get( - SLPDefaults.IPV6_MULTICAST_SCOPE, hash.intValue())); + ServiceTable.this.iDgramThread.joinGroup( + IPv6MulticastAddressFactory.get(SLPDefaults.IPV6_MULTICAST_SCOPE, hash.intValue()) + ); } else { ++cntr.iValue; } - } /** * unregister - * + * * @param pType * @throws UnknownHostException * @throws IOException @@ -119,17 +116,16 @@ public void unregister(ServiceType pType) throws UnknownHostException, IOExcepti if (cntr == null) return; if (cntr.iValue <= 1) { this.iMap.remove(hash); - ServiceTable.this.iDgramThread.leaveGroup(IPv6MulticastAddressFactory.get( - SLPDefaults.IPV6_MULTICAST_SCOPE, hash.intValue())); + ServiceTable.this.iDgramThread.leaveGroup( + IPv6MulticastAddressFactory.get(SLPDefaults.IPV6_MULTICAST_SCOPE, hash.intValue()) + ); } else { --cntr.iValue; } } - } private static class ServiceEntry { - private ServiceURL iSrvURL; private List iAttribs; @@ -138,25 +134,23 @@ private static class ServiceEntry { /** * Ctor. - * + * * @param pSrvURL * @param pAttribs * @param pScopes */ - public ServiceEntry(ServiceURL pSrvURL, List pAttribs, - List pScopes) { + public ServiceEntry(ServiceURL pSrvURL, List pAttribs, List pScopes) { set(pSrvURL, pAttribs, pScopes); } /** * set - * + * * @param pSrvURL * @param pAttribs * @param pScopes */ - public void set(ServiceURL pSrvURL, List pAttribs, - List pScopes) { + public void set(ServiceURL pSrvURL, List pAttribs, List pScopes) { this.iSrvURL = pSrvURL; this.iAttribs = pAttribs; this.iScopes = pScopes; @@ -164,7 +158,7 @@ public void set(ServiceURL pSrvURL, List pAttribs, /** * getServiceURL - * + * * @return ServiceURL */ public ServiceURL getServiceURL() { @@ -173,7 +167,7 @@ public ServiceURL getServiceURL() { /** * getServiceType - * + * * @return ServiceType */ public ServiceType getServiceType() { @@ -182,7 +176,7 @@ public ServiceType getServiceType() { /** * getAttributes - * + * * @return List */ public List getAttributes() { @@ -191,7 +185,7 @@ public List getAttributes() { /** * getScopes - * + * * @return List */ public List getScopes() { @@ -200,37 +194,33 @@ public List getScopes() { /** * hasMatchingScope - * + * * @param pScopes * @return boolean */ public boolean hasMatchingScope(List pScopes) { if (pScopes == null) return false; Iterator itr = pScopes.iterator(); - while (itr.hasNext()) - if (hasScope(itr.next())) return true; + while (itr.hasNext()) if (hasScope(itr.next())) return true; return false; } @Override public String toString() { - return "url:" + this.iSrvURL + ", attribs:" + dumpList(this.iAttribs) + ", scopes:" - + dumpList(this.iScopes); + return "url:" + this.iSrvURL + ", attribs:" + dumpList(this.iAttribs) + ", scopes:" + dumpList(this.iScopes); } private boolean hasScope(String pScope) { return this.iScopes == null ? false : this.iScopes.contains(pScope); } - } static class ServiceEntryList extends ArrayList { - private static final long serialVersionUID = 1L; /** * get - * + * * @param pSrvURL * @return ServiceEntry */ @@ -244,7 +234,7 @@ public ServiceEntry get(ServiceURL pSrvURL) { /** * remove - * + * * @param pSrvURL */ public void remove(ServiceURL pSrvURL) { @@ -259,7 +249,7 @@ public void remove(ServiceURL pSrvURL) { /** * getServiceURLs - * + * * @param pSrvType * @param pScopes * @return List @@ -270,15 +260,13 @@ public List getServiceURLs(ServiceType pSrvType, List pScope for (int i = 0; i < size(); i++) { ServiceEntry entry = (ServiceEntry) get(i); if (!entry.hasMatchingScope(pScopes)) continue; - if (pSrvType.getPrincipleTypeName().equals( - entry.getServiceType().getPrincipleTypeName())) { + if (pSrvType.getPrincipleTypeName().equals(entry.getServiceType().getPrincipleTypeName())) { if (srvURLs == null) srvURLs = new ArrayList(); srvURLs.add(entry.getServiceURL()); } } return srvURLs; } - } private ServiceEntryList iSrvEntryTable = new ServiceEntryList(); @@ -287,7 +275,7 @@ public List getServiceURLs(ServiceType pSrvType, List pScope /** * Ctor. - * + * * @param pDgramThread */ public ServiceTable(DatagramThread pDgramThread) { @@ -296,15 +284,15 @@ public ServiceTable(DatagramThread pDgramThread) { /** * add - * + * * @param pSrvURL * @param pAttrList * @param pScopes * @throws UnknownHostException * @throws IOException */ - public synchronized void add(ServiceURL pSrvURL, List pAttrList, - List pScopes) throws UnknownHostException, IOException { + public synchronized void add(ServiceURL pSrvURL, List pAttrList, List pScopes) + throws UnknownHostException, IOException { if (pSrvURL == null) return; TRC.debug("add URL:" + pSrvURL + ", scopes:" + dumpList(pScopes)); ServiceEntry srvEntry = this.iSrvEntryTable.get(pSrvURL); @@ -320,7 +308,7 @@ public synchronized void add(ServiceURL pSrvURL, List /** * remove - * + * * @param pSrvURL * @throws UnknownHostException * @throws IOException @@ -334,7 +322,7 @@ public synchronized void remove(ServiceURL pSrvURL) throws UnknownHostException, /** * getServiceURLs - * + * * @param pSrvType * @param pScopes * @return List ServiceURL @@ -347,13 +335,12 @@ public synchronized List getServiceURLs(ServiceType pSrvType, List getAttributes(ServiceURL pSrvURL, - List pScopes) { + public synchronized List getAttributes(ServiceURL pSrvURL, List pScopes) { if (pSrvURL == null) return null; if (pSrvURL.getURLPath() == null) return getAttributes(pSrvURL.getServiceType(), pScopes); ServiceEntry entry = this.iSrvEntryTable.get(pSrvURL); @@ -362,13 +349,12 @@ public synchronized List getAttributes(ServiceURL pSrv /** * getAttributes - * + * * @param pSrvType * @param pScopes * @return List ServiceLocationAttribute */ - public synchronized List getAttributes(ServiceType pSrvType, - List pScopes) { + public synchronized List getAttributes(ServiceType pSrvType, List pScopes) { if (pSrvType == null) return null; HashSet attribs = new HashSet(); for (int i = 0; i < this.iSrvEntryTable.size(); i++) { @@ -381,7 +367,7 @@ public synchronized List getAttributes(ServiceType pSr /** * getServiceTypes - * + * * @param pScopes * @return List ServiceType */ @@ -415,5 +401,4 @@ private static String dumpList(List pList, String pSep) { } return buf.toString(); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/slp/internal/sa/TCPThread.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/sa/TCPThread.java index 64d7cc6..7ef60f6 100644 --- a/src/main/java/org/metricshub/wbem/sblim/slp/internal/sa/TCPThread.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/sa/TCPThread.java @@ -45,21 +45,19 @@ import java.net.ServerSocket; import java.net.Socket; import java.net.SocketTimeoutException; - import org.metricshub.wbem.sblim.slp.internal.SLPConfig; import org.metricshub.wbem.sblim.slp.internal.TRC; /** * TCPThread - * + * */ public class TCPThread extends RecieverThread { - private ServerSocket iListenerSocket; /** * Ctor. - * + * * @param pSrvAgent */ public TCPThread(ServiceAgent pSrvAgent) { @@ -83,12 +81,11 @@ protected void mainLoop() throws IOException { } private class ConnectionThread implements Runnable { - private Socket iSock; /** * Ctor. - * + * * @param pSock */ public ConnectionThread(Socket pSock) { @@ -99,7 +96,6 @@ public ConnectionThread(Socket pSock) { public void run() { TCPThread.this.iSrvAgent.processMessage(this.iSock); } - } @Override @@ -111,5 +107,4 @@ protected void close() { TRC.error(e); } } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/slp/internal/ua/DACache.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/ua/DACache.java index b0fc299..543a827 100644 --- a/src/main/java/org/metricshub/wbem/sblim/slp/internal/ua/DACache.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/ua/DACache.java @@ -47,26 +47,24 @@ import java.util.List; import java.util.TreeMap; import java.util.TreeSet; - import org.metricshub.wbem.sblim.slp.internal.SLPDefaults; import org.metricshub.wbem.sblim.slp.internal.msg.DADescriptor; /** * DACache caches the discovered DA list in order to eliminate frequent DA * discovery network traffic. - * + * */ public class DACache { private static class ScopeEntry { - private long iTimeOfDiscovery; private TreeSet iDADescriptors; /** * Ctor. - * + * * @param pDADescriptors */ public ScopeEntry(TreeSet pDADescriptors) { @@ -76,7 +74,7 @@ public ScopeEntry(TreeSet pDADescriptors) { /** * valid - * + * * @return boolean */ public boolean valid() { @@ -85,13 +83,12 @@ public boolean valid() { /** * getDADescriptorItr - * + * * @return Iterator */ public Iterator getDADescriptorItr() { return this.iDADescriptors == null ? null : this.iDADescriptors.iterator(); } - } /** @@ -147,8 +144,7 @@ public static synchronized List getDAList(List pScopes) { * @param pDADescriptors * - DADescriptors of the discovered DAs */ - public static synchronized void setDAList(List pScopes, - List pDADescriptors) { + public static synchronized void setDAList(List pScopes, List pDADescriptors) { if (pScopes == null || pDADescriptors == null) return; Iterator scopeItr = pScopes.iterator(); while (scopeItr.hasNext()) { @@ -169,5 +165,4 @@ public static synchronized void setDAList(List pScopes, static long getSecs() { return new Date().getTime() / 1000; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/slp/internal/ua/DatagramRequester.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/ua/DatagramRequester.java index 9546500..9eefc37 100644 --- a/src/main/java/org/metricshub/wbem/sblim/slp/internal/ua/DatagramRequester.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/ua/DatagramRequester.java @@ -57,23 +57,21 @@ import java.util.Date; import java.util.Iterator; import java.util.List; - +import org.metricshub.wbem.sblim.slp.ServiceLocationException; import org.metricshub.wbem.sblim.slp.internal.IPv6MulticastAddressFactory; +import org.metricshub.wbem.sblim.slp.internal.Net; import org.metricshub.wbem.sblim.slp.internal.SLPConfig; import org.metricshub.wbem.sblim.slp.internal.SLPDefaults; import org.metricshub.wbem.sblim.slp.internal.TRC; import org.metricshub.wbem.sblim.slp.internal.msg.MsgFactory; -import org.metricshub.wbem.sblim.slp.internal.msg.RequestMessage; -import org.metricshub.wbem.sblim.slp.ServiceLocationException; -import org.metricshub.wbem.sblim.slp.internal.Net; import org.metricshub.wbem.sblim.slp.internal.msg.ReplyMessage; +import org.metricshub.wbem.sblim.slp.internal.msg.RequestMessage; /** * DatagramRequester - * + * */ public class DatagramRequester implements Runnable { - RequestMessage iReqMsg; private Thread iThread; @@ -86,9 +84,8 @@ public class DatagramRequester implements Runnable { private int iPort = SLPConfig.getGlobalCfg().getPort(); - private boolean iUseV4 = Net.hasIPv4() && SLPConfig.getGlobalCfg().useIPv4(), iUseV6 = Net - .hasIPv6() - && SLPConfig.getGlobalCfg().useIPv6(); + private boolean iUseV4 = Net.hasIPv4() && SLPConfig.getGlobalCfg().useIPv4(), iUseV6 = + Net.hasIPv6() && SLPConfig.getGlobalCfg().useIPv6(); private List iTCPRequesters; @@ -107,14 +104,13 @@ public class DatagramRequester implements Runnable { /** * Constructor used for unicast requests - * + * * @param pRqstMsg * @param pResTable * @param pDst * @throws IOException */ - public DatagramRequester(RequestMessage pRqstMsg, ResultTable pResTable, InetAddress pDst) - throws IOException { + public DatagramRequester(RequestMessage pRqstMsg, ResultTable pResTable, InetAddress pDst) throws IOException { this.iReqMsg = pRqstMsg; this.iResTable = pResTable; this.iDst0 = pDst; @@ -124,7 +120,7 @@ public DatagramRequester(RequestMessage pRqstMsg, ResultTable pResTable, InetAdd /** * Constructor used for multicast requests - * + * * @param pRqstMsg * @param pResTable * @throws IOException @@ -137,14 +133,12 @@ public DatagramRequester(RequestMessage pRqstMsg, ResultTable pResTable) throws MulticastSocket mcastSocket = new MulticastSocket(); this.iDGramSocket = mcastSocket; if (this.iUseV6) { - this.iDst0 = IPv6MulticastAddressFactory - .get(SLPDefaults.IPV6_MULTICAST_SCOPE, pRqstMsg); + this.iDst0 = IPv6MulticastAddressFactory.get(SLPDefaults.IPV6_MULTICAST_SCOPE, pRqstMsg); try { mcastSocket.joinGroup(this.iDst0); } catch (IOException ioe) { // some kernels can't handle IPv6 mcast - TRC.warning("IOException caught during join, disabling IPv6: " + ioe.getMessage(), - ioe); + TRC.warning("IOException caught during join, disabling IPv6: " + ioe.getMessage(), ioe); this.iDst0 = null; } } @@ -156,7 +150,7 @@ public DatagramRequester(RequestMessage pRqstMsg, ResultTable pResTable) throws /** * start - * + * * @param pAsThread */ public void start(boolean pAsThread) { @@ -172,7 +166,7 @@ public void start(boolean pAsThread) { /** * For diagnostic only. - * + * * @return int */ public int getPort() { @@ -208,14 +202,13 @@ public void run() { } class MCastLoopController { - private long iStartTime = getMillis(); private int iTimeOutIdx = 0; /** * getTimeOut - * + * * @return int */ public int getTimeOut() { @@ -235,28 +228,31 @@ public void nextTimeOut() { /** * hasNext - * + * * @return boolean */ public boolean hasNext() { - return DatagramRequester.this.iResTable.getTotalResponses() < DatagramRequester.this.iMaxResults - && getMillis() - this.iStartTime < DatagramRequester.this.iTotalTimeOut - && hasNextTimeOut(); + return ( + DatagramRequester.this.iResTable.getTotalResponses() < DatagramRequester.this.iMaxResults && + getMillis() - this.iStartTime < DatagramRequester.this.iTotalTimeOut && + hasNextTimeOut() + ); } - } private void mcastNegotiate() throws Exception { byte[] reqBytes = this.iReqMsg.serialize(true, true, false); - DatagramPacket outPacket0 = this.iDst0 == null ? null : new DatagramPacket(reqBytes, - reqBytes.length, this.iDst0, this.iPort); - DatagramPacket outPacket1 = this.iDst1 == null ? null : new DatagramPacket(reqBytes, - reqBytes.length, this.iDst1, this.iPort); + DatagramPacket outPacket0 = this.iDst0 == null + ? null + : new DatagramPacket(reqBytes, reqBytes.length, this.iDst0, this.iPort); + DatagramPacket outPacket1 = this.iDst1 == null + ? null + : new DatagramPacket(reqBytes, reqBytes.length, this.iDst1, this.iPort); DatagramPacket inPacket = new DatagramPacket(this.iInBuf, this.iInBuf.length); MCastLoopController ctrl = new MCastLoopController(); boolean respondersUpdated = false; ResponseCache rspCache = new ResponseCache(); - sendLoop: while (ctrl.hasNext()) { + sendLoop:while (ctrl.hasNext()) { if (respondersUpdated) { byte[] msg = this.iReqMsg.serialize(true, true, true); if (outPacket0 != null) outPacket0.setData(msg); @@ -270,8 +266,7 @@ private void mcastNegotiate() throws Exception { if (outPacket0 != null) this.iDGramSocket.send(outPacket0); } catch (IOException ioe) { // some back level kernels can't handle sending IPv6 mcast - TRC.warning("IOException caught during send, disabling IPv6: " + ioe.getMessage(), - ioe); + TRC.warning("IOException caught during send, disabling IPv6: " + ioe.getMessage(), ioe); outPacket0 = null; this.iDst0 = null; } @@ -317,8 +312,7 @@ private void mcastNegotiate() throws Exception { private void ucastNegotiate() throws Exception { byte[] reqBytes = this.iReqMsg.serialize(false, true, false); - DatagramPacket outPacket = new DatagramPacket(reqBytes, reqBytes.length, this.iDst0, - this.iPort); + DatagramPacket outPacket = new DatagramPacket(reqBytes, reqBytes.length, this.iDst0, this.iPort); DatagramPacket inPacket = new DatagramPacket(this.iInBuf, this.iInBuf.length); int timeOutIdx = 0; int timeOut = this.iTimeOuts[timeOutIdx]; @@ -346,8 +340,7 @@ private void ucastNegotiate() throws Exception { continue; } if (replyMsg.overflows()) { - TCPRequester tcpRequester = new TCPRequester(this.iResTable, responderAddress, - this.iReqMsg, true); + TCPRequester tcpRequester = new TCPRequester(this.iResTable, responderAddress, this.iReqMsg, true); tcpRequester.waitFor(); } /* @@ -361,10 +354,10 @@ private void ucastNegotiate() throws Exception { * Tries to parse the content of the packet as a ReplyMessage. If parsing is * successful ReplyMessage is placed into the ResultTable, otherwise the * Exception is placed there. - * + * * @param pPacket * @return the ReplyMessage or null in case of - * + * * Add all invalid URL exceptions thrown by parser into exception * table */ @@ -373,8 +366,7 @@ private ReplyMessage handleResponse(DatagramPacket pPacket) { try { replyMsg = (ReplyMessage) MsgFactory.parse(pPacket); TRC.debug("expected: " + this.iReqMsg.getXID() + ", received: " + replyMsg); - if (this.iReqMsg.getXID() != replyMsg.getXID() - || !this.iReqMsg.isAllowedResponseType(replyMsg)) { + if (this.iReqMsg.getXID() != replyMsg.getXID() || !this.iReqMsg.isAllowedResponseType(replyMsg)) { TRC.debug("expected: " + this.iReqMsg.getXID() + ", ignoring: " + replyMsg); return null; } @@ -409,9 +401,7 @@ private void addTCPRequester(InetAddress pDest) throws ServiceLocationException private void waitForTCPRequesters() { if (this.iTCPRequesters == null) return; Iterator itr = this.iTCPRequesters.iterator(); - while (itr.hasNext()) - itr.next().waitFor(); + while (itr.hasNext()) itr.next().waitFor(); this.iTCPRequesters.clear(); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/slp/internal/ua/LocatorImpl.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/ua/LocatorImpl.java index 90851a6..2209d68 100644 --- a/src/main/java/org/metricshub/wbem/sblim/slp/internal/ua/LocatorImpl.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/ua/LocatorImpl.java @@ -45,7 +45,7 @@ import java.util.Locale; import java.util.SortedSet; import java.util.Vector; - +import org.metricshub.wbem.sblim.slp.Locator; import org.metricshub.wbem.sblim.slp.ServiceLocationEnumeration; import org.metricshub.wbem.sblim.slp.ServiceType; import org.metricshub.wbem.sblim.slp.ServiceURL; @@ -54,22 +54,20 @@ import org.metricshub.wbem.sblim.slp.internal.msg.AttributeRequest; import org.metricshub.wbem.sblim.slp.internal.msg.ServiceRequest; import org.metricshub.wbem.sblim.slp.internal.msg.ServiceTypeRequest; -import org.metricshub.wbem.sblim.slp.Locator; import org.metricshub.wbem.sblim.slp.internal.msg.Util; /** * LocatorImpl - * + * */ public class LocatorImpl implements Locator { - private Locale iLocale; private String iLangTag; /** * Ctor. - * + * * @param pLocale */ public LocatorImpl(Locale pLocale) { @@ -78,48 +76,89 @@ public LocatorImpl(Locale pLocale) { TRC.debug("created, langTag=" + this.iLangTag); } - public ServiceLocationEnumeration findAttributes(ServiceURL pURL, Vector pScopes, - Vector pAttributeIds) { + public ServiceLocationEnumeration findAttributes( + ServiceURL pURL, + Vector pScopes, + Vector pAttributeIds + ) { return findAttributes(pURL, pScopes, pAttributeIds, null); } - public ServiceLocationEnumeration findAttributes(ServiceURL pURL, Vector pScopes, - Vector pAttributeIds, Vector pDirectoryAgents) { - return new SLEnumerationImpl(new AttributeRequest(this.iLangTag, (SortedSet) null, - pURL.toString(), getScopes(pScopes), pAttributeIds, null), pDirectoryAgents); + public ServiceLocationEnumeration findAttributes( + ServiceURL pURL, + Vector pScopes, + Vector pAttributeIds, + Vector pDirectoryAgents + ) { + return new SLEnumerationImpl( + new AttributeRequest( + this.iLangTag, + (SortedSet) null, + pURL.toString(), + getScopes(pScopes), + pAttributeIds, + null + ), + pDirectoryAgents + ); } - public ServiceLocationEnumeration findAttributes(ServiceType pType, Vector pScopes, - Vector pAttributeIds) { + public ServiceLocationEnumeration findAttributes( + ServiceType pType, + Vector pScopes, + Vector pAttributeIds + ) { return findAttributes(pType, pScopes, pAttributeIds, null); } - public ServiceLocationEnumeration findAttributes(ServiceType pType, Vector pScopes, - Vector pAttributeIds, Vector pDirectoryAgents) { - return new SLEnumerationImpl(new AttributeRequest(this.iLangTag, (SortedSet) null, - pType.toString(), getScopes(pScopes), pAttributeIds, null), pDirectoryAgents); + public ServiceLocationEnumeration findAttributes( + ServiceType pType, + Vector pScopes, + Vector pAttributeIds, + Vector pDirectoryAgents + ) { + return new SLEnumerationImpl( + new AttributeRequest( + this.iLangTag, + (SortedSet) null, + pType.toString(), + getScopes(pScopes), + pAttributeIds, + null + ), + pDirectoryAgents + ); } - public ServiceLocationEnumeration findServiceTypes(String pNamingAuthority, - Vector pScopes) { + public ServiceLocationEnumeration findServiceTypes(String pNamingAuthority, Vector pScopes) { return findServiceTypes(pNamingAuthority, pScopes, null); } - public ServiceLocationEnumeration findServiceTypes(String pNamingAuthority, - Vector pScopes, Vector pDirectoryAgent) { - return new SLEnumerationImpl(new ServiceTypeRequest(this.iLangTag, null, pNamingAuthority, - getScopes(pScopes)), pDirectoryAgent); + public ServiceLocationEnumeration findServiceTypes( + String pNamingAuthority, + Vector pScopes, + Vector pDirectoryAgent + ) { + return new SLEnumerationImpl( + new ServiceTypeRequest(this.iLangTag, null, pNamingAuthority, getScopes(pScopes)), + pDirectoryAgent + ); } - public ServiceLocationEnumeration findServices(ServiceType pType, Vector pScopes, - String pSearchFilter) { + public ServiceLocationEnumeration findServices(ServiceType pType, Vector pScopes, String pSearchFilter) { return findServices(pType, pScopes, pSearchFilter, null); } - public ServiceLocationEnumeration findServices(ServiceType pType, Vector pScopes, - String pSearchFilter, Vector pDirectoryAgents) { - return new SLEnumerationImpl(new ServiceRequest(this.iLangTag, null, pType, - getScopes(pScopes), pSearchFilter, null), pDirectoryAgents); + public ServiceLocationEnumeration findServices( + ServiceType pType, + Vector pScopes, + String pSearchFilter, + Vector pDirectoryAgents + ) { + return new SLEnumerationImpl( + new ServiceRequest(this.iLangTag, null, pType, getScopes(pScopes), pSearchFilter, null), + pDirectoryAgents + ); } public Locale getLocale() { @@ -136,5 +175,4 @@ private static Vector getScopes(Vector pScopes) { if (pScopes.isEmpty()) pScopes.add(SLPDefaults.DEFAULT_SCOPE); return pScopes; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/slp/internal/ua/ResponseCache.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/ua/ResponseCache.java index 2b4dcdb..4d753ac 100644 --- a/src/main/java/org/metricshub/wbem/sblim/slp/internal/ua/ResponseCache.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/ua/ResponseCache.java @@ -50,19 +50,18 @@ /** * ResponseCache intends to eliminate the processing of SLP responses with the * same content. - * + * */ public class ResponseCache { private static class Entry { - private byte[] iData; private int iHashCode; /** * Ctor. - * + * * @param pData * @param pOffset * @param pLength @@ -78,7 +77,7 @@ public Entry(byte[] pData, int pOffset, int pLength) { /** * Ctor. - * + * * @param pPacket */ public Entry(DatagramPacket pPacket) { @@ -97,14 +96,13 @@ public boolean equals(Object pObj) { Entry that = (Entry) pObj; return this.iHashCode == that.iHashCode && Arrays.equals(this.iData, that.iData); } - } private HashSet iResponseSet = new HashSet(); /** * add - * + * * @param pPacket */ public void add(DatagramPacket pPacket) { @@ -113,12 +111,11 @@ public void add(DatagramPacket pPacket) { /** * contains - * + * * @param pPacket * @return boolean */ public boolean contains(DatagramPacket pPacket) { return this.iResponseSet.contains(new Entry(pPacket)); } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/slp/internal/ua/ResultTable.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/ua/ResultTable.java index bee02dd..6d4e7da 100644 --- a/src/main/java/org/metricshub/wbem/sblim/slp/internal/ua/ResultTable.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/ua/ResultTable.java @@ -48,16 +48,14 @@ import java.util.Iterator; import java.util.LinkedHashSet; import java.util.NoSuchElementException; - import org.metricshub.wbem.sblim.slp.internal.TRC; import org.metricshub.wbem.sblim.slp.internal.msg.ReplyMessage; /** * ResultTable - * + * */ public class ResultTable implements Iterator { - private ArrayList iRequesters = new ArrayList(); private ArrayList iExceptions = new ArrayList(); @@ -73,20 +71,19 @@ public class ResultTable implements Iterator { /** * ResultTable has to know which Requesters provide results. Requester have * to be registered before hasNext() is called. - * + * * @see #unregisterRequester(DatagramRequester) * @param pReq */ public synchronized void registerRequester(DatagramRequester pReq) { - for (int i = 0; i < this.iRequesters.size(); i++) - if (pReq == this.iRequesters.get(i)) return; + for (int i = 0; i < this.iRequesters.size(); i++) if (pReq == this.iRequesters.get(i)) return; this.iRequesters.add(pReq); } /** * If the Requester's sequence is completed, Requester has to be * unregistered otherwise hasNext() will block. - * + * * @param pReq */ public synchronized void unregisterRequester(DatagramRequester pReq) { @@ -101,7 +98,7 @@ public synchronized void unregisterRequester(DatagramRequester pReq) { /** * addResults - * + * * @param pReplyMsg */ public void addResults(ReplyMessage pReplyMsg) { @@ -110,20 +107,19 @@ public void addResults(ReplyMessage pReplyMsg) { /** * addResults - * + * * @param pResItr */ public synchronized void addResults(Iterator pResItr) { if (pResItr == null) return; - while (pResItr.hasNext()) - addResult(pResItr.next()); + while (pResItr.hasNext()) addResult(pResItr.next()); // waking up hasNext() if (this.iInSet.size() > 0) wakeUp(); } /** * addExceptions - * + * * @param pReplyMsg */ public synchronized void addExceptions(ReplyMessage pReplyMsg) { @@ -132,18 +128,17 @@ public synchronized void addExceptions(ReplyMessage pReplyMsg) { /** * addExceptions - * + * * @param pExceptionItr */ public synchronized void addExceptions(Iterator pExceptionItr) { if (pExceptionItr == null) return; - while (pExceptionItr.hasNext()) - addException((Exception) pExceptionItr.next()); + while (pExceptionItr.hasNext()) addException((Exception) pExceptionItr.next()); } /** * addException - * + * * @param pE */ public synchronized void addException(Exception pE) { @@ -153,7 +148,7 @@ public synchronized void addException(Exception pE) { /** * getTotalResponses - * + * * @return int */ public synchronized int getTotalResponses() { @@ -229,5 +224,4 @@ private void wakeUp() { private boolean hasData() { return this.iInSet.size() > 0; } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/slp/internal/ua/SLEnumerationImpl.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/ua/SLEnumerationImpl.java index 83c214d..99d0e22 100644 --- a/src/main/java/org/metricshub/wbem/sblim/slp/internal/ua/SLEnumerationImpl.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/ua/SLEnumerationImpl.java @@ -52,22 +52,20 @@ import java.util.Iterator; import java.util.List; import java.util.NoSuchElementException; - import org.metricshub.wbem.sblim.slp.ServiceLocationEnumeration; +import org.metricshub.wbem.sblim.slp.ServiceLocationException; import org.metricshub.wbem.sblim.slp.ServiceURL; import org.metricshub.wbem.sblim.slp.internal.SLPDefaults; import org.metricshub.wbem.sblim.slp.internal.TRC; import org.metricshub.wbem.sblim.slp.internal.msg.DADescriptor; import org.metricshub.wbem.sblim.slp.internal.msg.RequestMessage; import org.metricshub.wbem.sblim.slp.internal.msg.ServiceRequest; -import org.metricshub.wbem.sblim.slp.ServiceLocationException; /** * SLEnumerationImpl - * + * */ public class SLEnumerationImpl implements ServiceLocationEnumeration { - private RequestMessage iReqMsg; private ResultTable iResultTable; @@ -82,7 +80,7 @@ public class SLEnumerationImpl implements ServiceLocationEnumeration { /** * Ctor. - * + * * @param pReqMsg * @param pDAList */ @@ -96,7 +94,7 @@ public SLEnumerationImpl(RequestMessage pReqMsg, List pDAList) { /** * This implementation can throw RuntimeExceptions. They can be ignored or * used for analysis. - * + * * @see ServiceLocationEnumeration#next() */ public Object next() throws NoSuchElementException { @@ -113,11 +111,11 @@ public Object next() throws NoSuchElementException { /** * @return next Object in Exception table * @throws NoSuchElementException - * + * * This in internal implementation to get list of all exceptions * thrown/caught by parser This can throw RuntimeExceptions. * They can be ignored or used for analysis. - * + * * use hasNextException to check whether there exists another * element in Exception table */ @@ -127,7 +125,7 @@ public Object nextException() throws NoSuchElementException { /** * @return true if there exists another element in Exception table - * + * */ public boolean hasMoreExceptions() { return this.iResultTable.hasMoreExceptions(); @@ -148,8 +146,7 @@ public boolean hasMoreElements() { try { daList = getDAList(this.iReqMsg.getScopeList()); } catch (Exception e) { - throw new RuntimeException(new ServiceLocationException( - ServiceLocationException.INTERNAL_ERROR, e)); + throw new RuntimeException(new ServiceLocationException(ServiceLocationException.INTERNAL_ERROR, e)); } } try { @@ -172,7 +169,7 @@ public Object nextElement() throws NoSuchElementException { /** * For diagnostic only! - * + * * @return int */ public int getPort() { @@ -190,16 +187,14 @@ private boolean isDASrvRequest() { * @return List of DA address InetAddresses * @throws UnknownHostException */ - private List getDAList(List pScopes) throws UnknownHostException, - IOException { + private List getDAList(List pScopes) throws UnknownHostException, IOException { if (this.iDAList != null && this.iDAList.size() > 0) return this.iDAList; // return cached DA list from previous discovery List scopes = DACache.getDiscoverableScopeList(pScopes); if (scopes != null) { ResultTable resultTable = new ResultTable(); - ServiceRequest srvReq = new ServiceRequest(null, SLPDefaults.DA_SERVICE_TYPE, scopes, - null, null); + ServiceRequest srvReq = new ServiceRequest(null, SLPDefaults.DA_SERVICE_TYPE, scopes, null, null); // multicast DA discovery DatagramRequester requester = new DatagramRequester(srvReq, resultTable); requester.start(false); @@ -251,5 +246,4 @@ private void setupMulticasting() throws ServiceLocationException, IOException { throw new ServiceLocationException(ServiceLocationException.NETWORK_ERROR, e); } } - } diff --git a/src/main/java/org/metricshub/wbem/sblim/slp/internal/ua/TCPRequester.java b/src/main/java/org/metricshub/wbem/sblim/slp/internal/ua/TCPRequester.java index 8432361..b785097 100644 --- a/src/main/java/org/metricshub/wbem/sblim/slp/internal/ua/TCPRequester.java +++ b/src/main/java/org/metricshub/wbem/sblim/slp/internal/ua/TCPRequester.java @@ -45,20 +45,18 @@ import java.io.OutputStream; import java.net.InetAddress; import java.net.Socket; - +import org.metricshub.wbem.sblim.slp.ServiceLocationException; import org.metricshub.wbem.sblim.slp.internal.SLPConfig; import org.metricshub.wbem.sblim.slp.internal.TRC; import org.metricshub.wbem.sblim.slp.internal.msg.MsgFactory; -import org.metricshub.wbem.sblim.slp.internal.msg.RequestMessage; -import org.metricshub.wbem.sblim.slp.ServiceLocationException; import org.metricshub.wbem.sblim.slp.internal.msg.ReplyMessage; +import org.metricshub.wbem.sblim.slp.internal.msg.RequestMessage; /** * TCPRequester - * + * */ public class TCPRequester implements Runnable { - private InetAddress iDestination; private Thread iThread; @@ -75,15 +73,15 @@ public class TCPRequester implements Runnable { /** * Ctor. - * + * * @param pResTable * @param pDestination * @param pReqMsg * @param pAsThread * @throws ServiceLocationException */ - public TCPRequester(ResultTable pResTable, InetAddress pDestination, RequestMessage pReqMsg, - boolean pAsThread) throws ServiceLocationException { + public TCPRequester(ResultTable pResTable, InetAddress pDestination, RequestMessage pReqMsg, boolean pAsThread) + throws ServiceLocationException { this.iResTable = pResTable; this.iDestination = pDestination; this.iReqMsg = pReqMsg; @@ -132,7 +130,6 @@ public void run() { } } } - } private void handleResponse(Socket pSocket) { @@ -143,9 +140,8 @@ private void handleResponse(Socket pSocket) { this.iResTable.addException(e); return; } - if (this.iReqMsg.getXID() == replyMsg.getXID() - && this.iReqMsg.isAllowedResponseType(replyMsg)) this.iResTable - .addResults(replyMsg); + if ( + this.iReqMsg.getXID() == replyMsg.getXID() && this.iReqMsg.isAllowedResponseType(replyMsg) + ) this.iResTable.addResults(replyMsg); } - } diff --git a/src/site/markdown/index.md b/src/site/markdown/index.md index 7cd52bd..94cac33 100644 --- a/src/site/markdown/index.md +++ b/src/site/markdown/index.md @@ -1,9 +1,10 @@ # WBEM Java Client The Web-Based Entreprise Management (WBEM) Java Client is a library that enables to: -* Connect to a WBEM Server -* Execute WQL (WBEM Query Language) queries such as EnumerateInstances -It uses HTTP/HTTPS protocol for that purpose. + +- Connect to a WBEM Server +- Execute WQL (WBEM Query Language) queries such as EnumerateInstances + It uses HTTP/HTTPS protocol for that purpose. # How to run the WBEM Client inside Java @@ -24,11 +25,10 @@ When you embed the WBEM Java Client into your Java application, it's important t ### Exporting Packages with `--add-exports` -Use the `--add-exports` flag to allow modules to access the internal parsers provided by the `com.sun.org.apache.xerces` package in the `java.xml` module: +Use the `--add-exports` flag to allow modules to access the internal parsers provided by the `com.sun.org.apache.xerces` package in the `java.xml` module: - `java.xml/com.sun.org.apache.xerces.internal.parsers` - ### Opening Packages with `--add-opens` Use the `--add-opens` flag to open the required packages in the `java.base` module: @@ -38,7 +38,6 @@ Use the `--add-opens` flag to open the required packages in the `java.base` modu - `java.base/sun.net.www.protocol.http` - `java.base/sun.security.ssl` - ### Example Usage When invoking the `jar` command, include the specified `--add-exports` and `--add-opens` options in the JVM arguments. For example: @@ -48,6 +47,7 @@ java -jar --add-exports java.xml/com.sun.org.apache.xerces.internal.parsers --ad ``` Use it as follows: + ```Java package org.metricshub.wbem; @@ -88,4 +88,4 @@ public class Main { } } -``` \ No newline at end of file +``` diff --git a/src/site/resources/css/site.css b/src/site/resources/css/site.css new file mode 100644 index 0000000..e85911b --- /dev/null +++ b/src/site/resources/css/site.css @@ -0,0 +1,86 @@ +/*- + * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ + * Open MetricsHub Web Site + * ჻჻჻჻჻჻ + * Copyright (C) 2025 MetricsHub + * ჻჻჻჻჻჻ + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ + */ + +/* Poppins font */ +@font-face { + font-family: 'Poppins'; + src: url('../fonts/Poppins-ExtraBold.woff2') format('woff2'), + url('../fonts/Poppins-ExtraBold.woff') format('woff'), + url('../fonts/Poppins-ExtraBold.ttf') format('truetype'), + local('Helvetica'); + font-weight: 800; + font-style: normal; + font-display: swap; +} + +@font-face { + font-family: 'Poppins'; + src: url('../fonts/Poppins-Bold.woff2') format('woff2'), + url('../fonts/Poppins-Bold.woff') format('woff'), + url('../fonts/Poppins-Bold.ttf') format('truetype'), + local('Helvetica'); + font-weight: 700; + font-style: normal; + font-display: swap; +} + +@font-face { + font-family: 'Poppins'; + src: url('../fonts/Poppins-Regular.woff2') format('woff2'), + url('../fonts/Poppins-Regular.woff') format('woff'), + url('../fonts/Poppins-Regular.ttf') format('truetype'), + local('Helvetica'); + font-weight: 400; + font-style: normal; + font-display: swap; +} + +/* MetricsHub fonts */ +:root { + --title-font: "Poppins", sans-serif; + --heading-font: "Poppins", sans-serif; + --content-font: "Poppins", sans-serif; + + --content-font-size: medium; + --banner-font-size: 40px; + --banner-font-weight: 800; + +} + + /* MetricsHub colors */ +body { + --main-fgcolor: #212529; + --banner-bgcolor: #266fd0; + --link-color: #266fd0; + --alternate-bgcolor: #266fd0; + --alternate-fgcolor: #fff; +} + +body.dark { + --link-color: #7cb6ff; + --main-bgcolor: #262626; + --main-fgcolor: #e9ecef; +} \ No newline at end of file diff --git a/src/site/resources/favicon.ico b/src/site/resources/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..61a2a88b8a927081a256a2b15861a747590450f6 GIT binary patch literal 15406 zcmeHO4RBP|6}|!@N|7IHX)8i7*_V)p{1CxurLtt-+lZ2oUD!?;O0`tbk=m-AVp}`u zlHDb-Dpbb$2cs58Z5i5;fpJQI#2IMFB>R&{pcS-WvbzC6upkX2B)8vro45P+W#8_5 zsnhA$_h!z#``+Gr&v(wf=iGbFeaqMtY&4rRiQ%5d?i<6{JjPgFUgEiEGGi~|U3vM? z?*e1Z*E3dxI%t9xiTAjDCa*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I~S?@pfb+pX9DA9VBD4>+e?sXHQ$I_=XN$4nD4}I zs&TOWQQOb|`ZMNz4P@v8VGM+B#P7e3*|BjXgD1SG*cB1a8MWbLy@<5G zHY|Oa`jGv8z}Bq7Mtv9TPy5G@xKZrG9E%Bxc zc3BTxMtrE^OX=Q^b^1q%9>|7;JAf(S`vU^}XW^?V|C!P|og4bdH_e<%ZOd5CJjf8& z!Kt&Rk&MwJv)M5Uwb|mJI30Lele*Q<8LRQ5ES{|mRToenvXAi>;+q-y3{8Lig5B~B z!q>U#yAs&J9<2j*?0brJ&(ATRYk>cvNf|I^J;^-wvWRGhU&(a_rkO+1 zAnafl<*Et0`l2~PK2`lruUyWKO@b~d7j1GL#bC?P&;y%l6uhQ6gC@f&*B48F%1 zPxl?bf7;|2kS({CvD5PY7`mJV{6`GT8|^q8`A^OSNJffduupr%Jbs#Y(T8b0w{!a# zS5Wq+edc8lpHbU^LA|F{D`ipIm!2{&L$m|y$xQ0Z)8U*6?1xR`k4PunVQ2EY%rsyo z9^g;c0)Lj6CZm5PyJ=F`U>v`3|Lex;w0+$pAnKl+RLF^FBDb4ub# z@vti*?KVFK;<;sQqJ1Q|Rc-JMPjn^lpEoZq^nJ6|UuJz?((1fX1!crV?CmyS404>ir{ut%==~BFOXKYhIlaJdd`*i;m&~5c z>j{WhB@g%`M&}WH*PcoiOgon!`o^iv=olc^vQH0>`S;sLV@-Py_O^QjN^>(122NZ*ySvy&jhZs5-r=k#LkY}DgHwv2hS2{K&DG7kOt=HbN^ zEsL(z>u03z=dxp8gm2#j8G2yTnz$xTxySlSb|&lhB=p|~SG%+x`{k}-GDM`4@KsMP zIr!<=Z6-M>=AF&DXTzqykG&qg@r*tLnbyEx=I0H?!$$cRkk!>X~5Eer2$I=mIf>h{J&`6-_puc7ytkO literal 0 HcmV?d00001 diff --git a/src/site/resources/fonts/Poppins-Bold.ttf b/src/site/resources/fonts/Poppins-Bold.ttf new file mode 100644 index 0000000000000000000000000000000000000000..00559eeb290fb8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)+?D z|2q9~%t^o_u&^qoQRKBV@ct-lehf8YO~ng^xg8kFU#t;&TYgw7 z<*B*tPoXluzCE?+gqB&aoIh^Wf_N@o6qos*DbpGKGrEAyu?6gh)xW#?_<9kYgn#SD zzZILpXW4@u0_d*XT&Vhkt3CLWsloY!!aFx$rOH*RR;#Xh340MLR;pa3YPIUBm#~+h zVx`J&OYgPZg9wnz>!f|Gwm0_f5H6tjA8l?51YWnZGH;fDGIsab%r!UejIK4Sb#i)u zZW5^0c(@#O{1{w#%Txs4lGvEJWik`p`KXIU2j|vAxG{6@%u=`ud)}7v2<{m&Hat*2qfMKl*7o$~5smV#HaXwUAD2*|D;fQm4kQlCUFV%o0u6r^&THUih#;tM7~QlZm$44-Xbut2X!;dD;D?$ zsGYB`dYo3Kmz^-LRnW*flpFo8%?c&sDS$tLgV{uf}@or8_z9v+su zvO!M-nVQ`}F3VlS+y)I?m|*AzV;k_nXNM|ITG0Fj53V+ci!!YdDZM-#tbE=-8nx7E F003DowblRt literal 0 HcmV?d00001 diff --git a/src/site/resources/fonts/Poppins-ExtraBold.ttf b/src/site/resources/fonts/Poppins-ExtraBold.ttf new file mode 100644 index 0000000000000000000000000000000000000000..df7093608a7eb6173529ce9eeeb4d46e3a8290e5 GIT binary patch literal 152764 zcmdSCcU)D+(?7nu=iCbyREmI#i1el+MFdo&DyWDE*b5>cq6iB1L}N)}G$t`7mL$d& zW7HUvSfkNIV~Zt4W5M1_OgFvA{k~_I<18IL;Qxg&ak8vp%7}ob6LvE;qZ8w&rjINwD)IIRnv8fq z@V6g{0O!4?E};K_3mQ3Q{N&o;FI*UNKgF2qyo##gqVLrb!I;y0#vHT86ipthzRLZ; zdlAmBvS>`{zUzLKjH$;NGrc#qs%CtL_eZ|OSbS^70v0ipO$}rVSOZqY%YzmtSI1PUaTZlhJ3>JleWugMGM${l& zRmLiQ%!GQJC#W@gXqXRWF+7*#T6E#4T?c~%(XF6sFSeJl--T8-wMx|ZG4>qsh-h&T z$d9Syfm7f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resources/fonts/Poppins-ExtraBold.woff b/src/site/resources/fonts/Poppins-ExtraBold.woff new file mode 100644 index 0000000000000000000000000000000000000000..0d7982a42763a91211fde7f17312f6702171bc8e GIT binary patch literal 72388 zcmZr$b984vu>aP!ZF6hewr$%swzjdw*6r4|ZQHi}`g`x+cklU}Ihi|?$=pm%GD+O! z#l!$W00008djNp&LxF8)0H8nb|MQ56smT7wmHvFf{SUG5USZ-QqGABR3*t{%^am0s zizp%D3i8STAebEh0DcevATEDoM>7ytRu%e@(*OWaLID7Z7l`)lO?hPorXRx#KYH>% zFj$ZECNZ`(bN~RLO#lE8VE_O$B7(ae!`#sMhxY>cBlExb{sw@U+jyD*0B8>Y!1y!( zXt@Da`jFVd)bK|S=*I?t?LT1aka}ADFn@UQKV_mHkiztUiCfsZc>Fj@`coZ00Dzdd z>U54^V{iN;2lwL}r1TGDfE_&LYz;kr>;g6X=n?)0&=Md*J40Jj0AP3Er)@z102Bl3 zI=!cZy|W7da3lc$Aa(utn=v9f$o9Yg6ch;jEo$FUAA#o)00VOJQwLzBsBGdtx{l5^ z`dR&%4wV3E2oU)33-~`S0N{~rY+zzwknq+VK@?j5dfi6g&q=`q5RC_lf(DdXL!kU8 z1oUH_3=j{11=s_?e@egr{2vMc{CE!l0RaD3hhe#)nt_3-fx(&4Zvz8^o3NQ^M_93F zAOSuQ3J_S9f6RnH(}?W;VIZ)u-5DB1Uvx$ihNI@xKRW5KiN;JOT+l_Rm>Pf&0hq6! zHZ`XC#;d8~4f`KodKzGWg1TrTdamjsx+R#d0=dcRi3AD|5h5WfAPE!ACz}OXkup*K z5-5S~)NStY?qbw#K5yXSr0aK7d} zetys0?u_H2K9%3ZRA~ZVpl;ReB;u8cX_%oYTA@u8nwS245b>bEZJNH8v2ad|Rb`)S zS1$GY0g+0{^dB2%LE3Dy0R1A!fs}8!%QAy>s2(xOBM(;o{h`w*<*@Q0_2B11r&3jx zB-AwJqUPxznBpot5|T$G%K~*Ne_tK0(@hJc&R zulD)2Gi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deQXMS9?U+Di;wzz!MCfH5tTOyy#$GzQsZ7o`M+}L z?i>aYR$~iyh~j_G+#!NjPTciOyjPKn-72bdEvgTIQjfW6C-D6Avt&Wk`eqMO1XSKY z!i~g#x7?? zK}_%y_c^r(R;Af=%`AAeY-+czg^RIGWuLh<3}Du Z9BeOSniG6Gel>8Cm?z_$@|ytw002lPOjG~> literal 0 HcmV?d00001 diff --git a/src/site/resources/fonts/Poppins-Regular.ttf b/src/site/resources/fonts/Poppins-Regular.ttf new file mode 100644 index 0000000000000000000000000000000000000000..9f0c71b70a49664ced448c63edc9c4ff2bf8cf4a GIT binary patch literal 158240 zcmdSCcYIYv*FQQld!Lh>1PCn&oiq{%5YiJMJt4i3MwJjqAb}JJp^A!viiiyr5djft zA}S)FAR;17L<9t-_ud6mEad#YYxX`nfyc+!_jm98tpd?enr9WBryh=3SGO+b!_$ z)$!Mneh$(P9$HZ}D#X&WIsEq+6Z?mkPaM|!>sdcAHl+>YS43$^QE{tpyowO-hV-GO z2xu_YO!QxHUZoW^6Nc@)6~I{2d5krlQC>B)$kFr3rx|m|W6VCeqG-Y>bqVi+w8!Aw zDvK&gK5y83C1dJt#!S;kRgJ0X@nz{-jDi<(cWQfYmZ~e9{x6mo#7p5qeD8-@0?`hZ;=1dh-r@7DuGiwE^AyPih?RabM$pd&8Pv!%734ffw#AosQqP6HJHi{kM z8*yCOY*8$ZmWGxlmgbg@7Jo~SrMsn3q$+ir#lvt`Pqb$|!o^JO=yF2ZEcWda@ z+^v;cJ2wwEZ#RFp9&QP4%iUJGZE*X-y_vg*ySKZahww0aIC(VnaQ0~B(axi@N3zFY zkCG0%I_&;aSgnvulg*ti#obT{y$`E0@+#` zvK33&IAr72U#w@*hdCl!WQtUgD0+!F5hJ36pXkEB=I`-x$js5;w;8nbS6Q21@BilX zTO-DPbCh*szjgoh7JMy#YxV0p=X;-TeeUA9v!|w>-F0@y+3jbyo!xSF{n?MtEEJ~K6m=`=@X~-pI&$R?bGv4gdf>vk-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Q{xwjH2d`={7P}krmR08r)78q_rfTPSaUfxkWXx;k*`BDh#jX zey`lb-QLJe2Y9k6tXzMuKXepl%`4mED zc`KMvY2HLkcTc{3uYs8j>Q|P0ZyMFZSKkvxwexX$weoAD3lixsnfA z4HYcvE{csriQL3Ah^kz9@vBsIcHz}Ms5yn4bUlNLCc2>kDv?2jk*HIASxgy8d>fha zQulO2UU{LpHq(Zg7i{|y&;%3CLfCW^4ea;&Ac^S}7J|{iv{R(!%N>i*El7|z!rEnm j$% images/metricshub-logo.png - https://metricshub.com + https://metricshub.org -

      diff --git a/src/test/java/org/metricshub/wbem/WbemCimDataHandlerTest.java b/src/test/java/org/metricshub/wbem/WbemCimDataHandlerTest.java index 1ce5195..0067dac 100644 --- a/src/test/java/org/metricshub/wbem/WbemCimDataHandlerTest.java +++ b/src/test/java/org/metricshub/wbem/WbemCimDataHandlerTest.java @@ -1,157 +1,345 @@ package org.metricshub.wbem; import java.math.BigInteger; - import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.metricshub.wbem.client.WbemCimDataHandler; import org.metricshub.wbem.javax.cim.CIMClass; import org.metricshub.wbem.javax.cim.CIMClassProperty; import org.metricshub.wbem.javax.cim.CIMDataType; +import org.metricshub.wbem.javax.cim.CIMDateTime; import org.metricshub.wbem.javax.cim.CIMDateTimeAbsolute; import org.metricshub.wbem.javax.cim.CIMDateTimeInterval; import org.metricshub.wbem.javax.cim.CIMInstance; import org.metricshub.wbem.javax.cim.CIMObjectPath; -import org.metricshub.wbem.javax.cim.CIMDateTime; import org.metricshub.wbem.javax.cim.CIMProperty; class WbemCimDataHandlerTest { @Test void testGetCimPropertyAsString() { + final CIMObjectPath objectPath = new CIMObjectPath( + "root/emc:Symm_StorageSystem.CreationClassName=\"Symm_StorageSystem\",Name=\"SYMMETRIX-+-000297800620\"" + ); - final CIMObjectPath objectPath = new CIMObjectPath("root/emc:Symm_StorageSystem.CreationClassName=\"Symm_StorageSystem\",Name=\"SYMMETRIX-+-000297800620\""); - - Assertions.assertThrows(IllegalArgumentException.class, () -> WbemCimDataHandler.getCimPropertyAsString(null, new CIMInstance(objectPath, new CIMProperty[] {new CIMProperty("Name", CIMDataType.STRING_T, "SYMMETRIX-+-000297800620")}), null)); - Assertions.assertThrows(IllegalArgumentException.class, () -> WbemCimDataHandler.getCimPropertyAsString("Name", null, null)); + Assertions.assertThrows( + IllegalArgumentException.class, + () -> + WbemCimDataHandler.getCimPropertyAsString( + null, + new CIMInstance( + objectPath, + new CIMProperty[] { new CIMProperty("Name", CIMDataType.STRING_T, "SYMMETRIX-+-000297800620") } + ), + null + ) + ); + Assertions.assertThrows( + IllegalArgumentException.class, + () -> WbemCimDataHandler.getCimPropertyAsString("Name", null, null) + ); - Assertions.assertThrows(IllegalArgumentException.class, () -> WbemCimDataHandler.getCimPropertyAsString("__Path", new CIMInstance(null, new CIMProperty[] {new CIMProperty("Name", CIMDataType.STRING_T, "SYMMETRIX-+-000297800620")}), null)); - Assertions.assertThrows(IllegalArgumentException.class, () -> WbemCimDataHandler.getCimPropertyAsString("Ref", new CIMInstance(objectPath, new CIMProperty[] {new CIMProperty("Ref", new CIMDataType("Ref", 1), "x")}), null)); + Assertions.assertThrows( + IllegalArgumentException.class, + () -> + WbemCimDataHandler.getCimPropertyAsString( + "__Path", + new CIMInstance( + null, + new CIMProperty[] { new CIMProperty("Name", CIMDataType.STRING_T, "SYMMETRIX-+-000297800620") } + ), + null + ) + ); + Assertions.assertThrows( + IllegalArgumentException.class, + () -> + WbemCimDataHandler.getCimPropertyAsString( + "Ref", + new CIMInstance( + objectPath, + new CIMProperty[] { new CIMProperty("Ref", new CIMDataType("Ref", 1), "x") } + ), + null + ) + ); Assertions.assertEquals( - "Symm_StorageSystem.CreationClassName=\"Symm_StorageSystem\",Name=\"SYMMETRIX-+-000297800620\"", - WbemCimDataHandler.getCimPropertyAsString("__PATH", new CIMInstance(objectPath, null), null)); + "Symm_StorageSystem.CreationClassName=\"Symm_StorageSystem\",Name=\"SYMMETRIX-+-000297800620\"", + WbemCimDataHandler.getCimPropertyAsString("__PATH", new CIMInstance(objectPath, null), null) + ); Assertions.assertEquals( - "", - WbemCimDataHandler.getCimPropertyAsString( - "UnknownProperty", - new CIMInstance(objectPath, new CIMProperty[] {new CIMProperty("Name", CIMDataType.STRING_T, "\"SYMMETRIX-+-000297800620;\"")}), null)); + "", + WbemCimDataHandler.getCimPropertyAsString( + "UnknownProperty", + new CIMInstance( + objectPath, + new CIMProperty[] { + new CIMProperty("Name", CIMDataType.STRING_T, "\"SYMMETRIX-+-000297800620;\"") + } + ), + null + ) + ); Assertions.assertEquals( - "blablaVal", - WbemCimDataHandler.getCimPropertyAsString( - "blabla", - new CIMInstance(objectPath, new CIMProperty[] {new CIMProperty("Name", CIMDataType.STRING_T, "\"SYMMETRIX-+-000297800620;\""), new CIMProperty("blabla", CIMDataType.STRING_T, "blablaVal", true, false, null)}), null)); + "blablaVal", + WbemCimDataHandler.getCimPropertyAsString( + "blabla", + new CIMInstance( + objectPath, + new CIMProperty[] { + new CIMProperty("Name", CIMDataType.STRING_T, "\"SYMMETRIX-+-000297800620;\""), + new CIMProperty("blabla", CIMDataType.STRING_T, "blablaVal", true, false, null) + } + ), + null + ) + ); Assertions.assertEquals( - "", - WbemCimDataHandler.getCimPropertyAsString( - "Name", - new CIMInstance(objectPath, new CIMProperty[] {new CIMProperty("Name", CIMDataType.STRING_T, null)}), null)); + "", + WbemCimDataHandler.getCimPropertyAsString( + "Name", + new CIMInstance( + objectPath, + new CIMProperty[] { new CIMProperty("Name", CIMDataType.STRING_T, null) } + ), + null + ) + ); Assertions.assertEquals( - "\"SYMMETRIX-+-000297800620;\"", - WbemCimDataHandler.getCimPropertyAsString( - "Name", - new CIMInstance(objectPath, new CIMProperty[] {new CIMProperty("Name", CIMDataType.STRING_T, "\"SYMMETRIX-+-000297800620;\"")}), null)); + "\"SYMMETRIX-+-000297800620;\"", + WbemCimDataHandler.getCimPropertyAsString( + "Name", + new CIMInstance( + objectPath, + new CIMProperty[] { + new CIMProperty("Name", CIMDataType.STRING_T, "\"SYMMETRIX-+-000297800620;\"") + } + ), + null + ) + ); Assertions.assertEquals( - "true", - WbemCimDataHandler.getCimPropertyAsString( - "EMCAutoMetaEnabled", - new CIMInstance(objectPath, new CIMProperty[] {new CIMProperty("EMCAutoMetaEnabled", CIMDataType.BOOLEAN_T, Boolean.TRUE)}), null)); + "true", + WbemCimDataHandler.getCimPropertyAsString( + "EMCAutoMetaEnabled", + new CIMInstance( + objectPath, + new CIMProperty[] { new CIMProperty("EMCAutoMetaEnabled", CIMDataType.BOOLEAN_T, Boolean.TRUE) } + ), + null + ) + ); Assertions.assertEquals( - "true|false|", - WbemCimDataHandler.getCimPropertyAsString( - "EMCAutoMetaEnabledArray", - new CIMInstance(objectPath, new CIMProperty[] {new CIMProperty("EMCAutoMetaEnabledArray", CIMDataType.BOOLEAN_ARRAY_T, new Boolean[] {Boolean.TRUE, Boolean.FALSE})}), null)); + "true|false|", + WbemCimDataHandler.getCimPropertyAsString( + "EMCAutoMetaEnabledArray", + new CIMInstance( + objectPath, + new CIMProperty[] { + new CIMProperty( + "EMCAutoMetaEnabledArray", + CIMDataType.BOOLEAN_ARRAY_T, + new Boolean[] { Boolean.TRUE, Boolean.FALSE } + ) + } + ), + null + ) + ); Assertions.assertEquals( - "10", - WbemCimDataHandler.getCimPropertyAsString( - "PortType", - new CIMInstance(objectPath, new CIMProperty[] {new CIMProperty("PortType", CIMDataType.SINT32_T, Integer.valueOf(10))}), null)); + "10", + WbemCimDataHandler.getCimPropertyAsString( + "PortType", + new CIMInstance( + objectPath, + new CIMProperty[] { new CIMProperty("PortType", CIMDataType.SINT32_T, Integer.valueOf(10)) } + ), + null + ) + ); Assertions.assertEquals( - "2125000000", - WbemCimDataHandler.getCimPropertyAsString( - "MaxSpeed", - new CIMInstance(objectPath, new CIMProperty[] {new CIMProperty("MaxSpeed", CIMDataType.UINT64_T, new BigInteger("2125000000"))}), null)); + "2125000000", + WbemCimDataHandler.getCimPropertyAsString( + "MaxSpeed", + new CIMInstance( + objectPath, + new CIMProperty[] { + new CIMProperty("MaxSpeed", CIMDataType.UINT64_T, new BigInteger("2125000000")) + } + ), + null + ) + ); Assertions.assertEquals( - "1|2|", - WbemCimDataHandler.getCimPropertyAsString( - "OperationalStatus", - new CIMInstance(objectPath, new CIMProperty[] {new CIMProperty("OperationalStatus", CIMDataType.SINT16_ARRAY_T, new Short[] {1,2})}), null)); + "1|2|", + WbemCimDataHandler.getCimPropertyAsString( + "OperationalStatus", + new CIMInstance( + objectPath, + new CIMProperty[] { + new CIMProperty("OperationalStatus", CIMDataType.SINT16_ARRAY_T, new Short[] { 1, 2 }) + } + ), + null + ) + ); Assertions.assertEquals( - "Symm_StorageSystem.CreationClassName=\"Symm_StorageSystem\",Name=\"SYMMETRIX-+-000297800620\"", - WbemCimDataHandler.getCimPropertyAsString( - "Ref", - new CIMInstance(objectPath, new CIMProperty[] {new CIMProperty("Ref", new CIMDataType("Ref"), objectPath)}), null)); + "Symm_StorageSystem.CreationClassName=\"Symm_StorageSystem\",Name=\"SYMMETRIX-+-000297800620\"", + WbemCimDataHandler.getCimPropertyAsString( + "Ref", + new CIMInstance( + objectPath, + new CIMProperty[] { new CIMProperty("Ref", new CIMDataType("Ref"), objectPath) } + ), + null + ) + ); Assertions.assertEquals( - "Symm_StorageSystem.CreationClassName=\"Symm_StorageSystem\",Name=\"SYMMETRIX-+-000297800620\"" + - "|", - WbemCimDataHandler.getCimPropertyAsString( - "Ref", - new CIMInstance(objectPath, new CIMProperty[] {new CIMProperty("Ref", new CIMDataType("Ref", 1), new CIMObjectPath[] {objectPath})}), null)); + "Symm_StorageSystem.CreationClassName=\"Symm_StorageSystem\",Name=\"SYMMETRIX-+-000297800620\"" + "|", + WbemCimDataHandler.getCimPropertyAsString( + "Ref", + new CIMInstance( + objectPath, + new CIMProperty[] { + new CIMProperty("Ref", new CIMDataType("Ref", 1), new CIMObjectPath[] { objectPath }) + } + ), + null + ) + ); Assertions.assertEquals( - "Symm_StorageSystem.CreationClassName=\"Symm_StorageSystem\",Name=\"SYMMETRIX-+-000297800620\"" + - "||"+ - "Symm_StorageSystem.CreationClassName=\"Symm_StorageSystem\",Name=\"SYMMETRIX-+-000297800620\"" + - "|", - WbemCimDataHandler.getCimPropertyAsString( - "Ref", - new CIMInstance(objectPath, new CIMProperty[] {new CIMProperty("Ref", new CIMDataType("Ref", 3), new CIMObjectPath[] {objectPath, null, objectPath})}), null)); + "Symm_StorageSystem.CreationClassName=\"Symm_StorageSystem\",Name=\"SYMMETRIX-+-000297800620\"" + + "||" + + "Symm_StorageSystem.CreationClassName=\"Symm_StorageSystem\",Name=\"SYMMETRIX-+-000297800620\"" + + "|", + WbemCimDataHandler.getCimPropertyAsString( + "Ref", + new CIMInstance( + objectPath, + new CIMProperty[] { + new CIMProperty( + "Ref", + new CIMDataType("Ref", 3), + new CIMObjectPath[] { objectPath, null, objectPath } + ) + } + ), + null + ) + ); Assertions.assertEquals( - "1173882243000", - WbemCimDataHandler.getCimPropertyAsString( - "timeAbsolute", - new CIMInstance(objectPath, new CIMProperty[] {new CIMProperty("timeAbsolute", CIMDataType.DATETIME_T, new CIMDateTimeAbsolute("20070314160503.566012+101"))}), null)); + "1173882243000", + WbemCimDataHandler.getCimPropertyAsString( + "timeAbsolute", + new CIMInstance( + objectPath, + new CIMProperty[] { + new CIMProperty( + "timeAbsolute", + CIMDataType.DATETIME_T, + new CIMDateTimeAbsolute("20070314160503.566012+101") + ) + } + ), + null + ) + ); Assertions.assertEquals( - "1173882243566", - WbemCimDataHandler.getCimPropertyAsString( - "timeInterval", - new CIMInstance(objectPath, new CIMProperty[] {new CIMProperty("timeInterval", CIMDataType.DATETIME_T, new CIMDateTimeInterval(1173882243566L))}), null)); + "1173882243566", + WbemCimDataHandler.getCimPropertyAsString( + "timeInterval", + new CIMInstance( + objectPath, + new CIMProperty[] { + new CIMProperty( + "timeInterval", + CIMDataType.DATETIME_T, + new CIMDateTimeInterval(1173882243566L) + ) + } + ), + null + ) + ); Assertions.assertEquals( - "1173882243000|1173882243566|", - WbemCimDataHandler.getCimPropertyAsString( - "timeArray", - new CIMInstance(objectPath, new CIMProperty[] {new CIMProperty("timeArray", CIMDataType.DATETIME_ARRAY_T, new CIMDateTime[] {new CIMDateTimeAbsolute("20070314160503.566012+101"), new CIMDateTimeInterval(1173882243566L)})}), null)); + "1173882243000|1173882243566|", + WbemCimDataHandler.getCimPropertyAsString( + "timeArray", + new CIMInstance( + objectPath, + new CIMProperty[] { + new CIMProperty( + "timeArray", + CIMDataType.DATETIME_ARRAY_T, + new CIMDateTime[] { + new CIMDateTimeAbsolute("20070314160503.566012+101"), + new CIMDateTimeInterval(1173882243566L) + } + ) + } + ), + null + ) + ); - final CIMClass cimClass = new CIMClass( - "testClass", - null, - null, - new CIMClassProperty[] {new CIMClassProperty("KeyProp", CIMDataType.STRING_T, null, null, false, false, null)}, - null); + final CIMClass cimClass = new CIMClass( + "testClass", + null, + null, + new CIMClassProperty[] { + new CIMClassProperty("KeyProp", CIMDataType.STRING_T, null, null, false, false, null) + }, + null + ); Assertions.assertEquals( - "class testClass {" + - " string KeyProp;" + - "};", - WbemCimDataHandler.getCimPropertyAsString( - "propClass", - new CIMInstance(objectPath, new CIMProperty[] {new CIMProperty("propClass", CIMDataType.CLASS_T, cimClass)}), null).replaceAll("[\r\n]", "")); - - Assertions.assertEquals( - "class testClass {" + - " string KeyProp;" + - "};" + - "$$" + - "class testClass {" + - " string KeyProp;" + - "};" + - "$", - WbemCimDataHandler.getCimPropertyAsString( - "propClass", - new CIMInstance(objectPath, new CIMProperty[] {new CIMProperty("propClass", CIMDataType.CLASS_ARRAY_T, new CIMClass[] {cimClass, null, cimClass})}), "$").replaceAll("[\r\n]", "")); + "class testClass {" + " string KeyProp;" + "};", + WbemCimDataHandler + .getCimPropertyAsString( + "propClass", + new CIMInstance( + objectPath, + new CIMProperty[] { new CIMProperty("propClass", CIMDataType.CLASS_T, cimClass) } + ), + null + ) + .replaceAll("[\r\n]", "") + ); + + Assertions.assertEquals( + "class testClass {" + " string KeyProp;" + "};" + "$$" + "class testClass {" + " string KeyProp;" + "};" + "$", + WbemCimDataHandler + .getCimPropertyAsString( + "propClass", + new CIMInstance( + objectPath, + new CIMProperty[] { + new CIMProperty( + "propClass", + CIMDataType.CLASS_ARRAY_T, + new CIMClass[] { cimClass, null, cimClass } + ) + } + ), + "$" + ) + .replaceAll("[\r\n]", "") + ); } } diff --git a/src/test/java/org/metricshub/wbem/WbemClientTest.java b/src/test/java/org/metricshub/wbem/WbemClientTest.java index a1a16bf..e59d1c2 100644 --- a/src/test/java/org/metricshub/wbem/WbemClientTest.java +++ b/src/test/java/org/metricshub/wbem/WbemClientTest.java @@ -2,24 +2,22 @@ import java.net.URL; import java.util.Locale; - import javax.security.auth.Subject; - import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.metricshub.wbem.client.WbemClient; +import org.metricshub.wbem.client.WbemQueryResult; import org.metricshub.wbem.client.WqlQuery; import org.metricshub.wbem.javax.cim.CIMInstance; import org.metricshub.wbem.javax.cim.CIMObjectPath; import org.metricshub.wbem.javax.wbem.CloseableIterator; import org.metricshub.wbem.javax.wbem.client.EnumerateResponse; import org.metricshub.wbem.javax.wbem.client.WBEMClient; +import org.metricshub.wbem.javax.wbem.client.WBEMClientConstants; import org.metricshub.wbem.javax.wbem.client.WBEMClientFactory; import org.mockito.ArgumentMatchers; import org.mockito.MockedStatic; import org.mockito.Mockito; -import org.metricshub.wbem.client.WbemQueryResult; -import org.metricshub.wbem.javax.wbem.client.WBEMClientConstants; class WbemClientTest { @@ -27,23 +25,38 @@ class WbemClientTest { void testConnect() throws Exception { final URL url = new URL("https://host:8080"); final String username = "user"; - final char[] password = {'p', 'a', 's', 's'}; - int timeout = 60*1000; - - Assertions.assertThrows(IllegalArgumentException.class, () -> new WbemClient().connect(null, username, password, timeout)); - Assertions.assertThrows(IllegalArgumentException.class, () -> new WbemClient().connect(url, null, password, timeout)); - Assertions.assertThrows(IllegalArgumentException.class, () -> new WbemClient().connect(url, username, null, timeout)); - - try (final MockedStatic mockedWBEMClientFactory = Mockito.mockStatic(WBEMClientFactory.class); - final WbemClient wbemClient = new WbemClient()) { + final char[] password = { 'p', 'a', 's', 's' }; + int timeout = 60 * 1000; + + Assertions.assertThrows( + IllegalArgumentException.class, + () -> new WbemClient().connect(null, username, password, timeout) + ); + Assertions.assertThrows( + IllegalArgumentException.class, + () -> new WbemClient().connect(url, null, password, timeout) + ); + Assertions.assertThrows( + IllegalArgumentException.class, + () -> new WbemClient().connect(url, username, null, timeout) + ); + + try ( + final MockedStatic mockedWBEMClientFactory = Mockito.mockStatic(WBEMClientFactory.class); + final WbemClient wbemClient = new WbemClient() + ) { final WBEMClient client = Mockito.mock(WBEMClient.class); mockedWBEMClientFactory.when(() -> WBEMClientFactory.getClient("CIM-XML")).thenReturn(client); Mockito.doNothing().when(client).setProperty(WBEMClientConstants.PROP_TIMEOUT, String.valueOf(timeout)); - Mockito.doNothing().when(client).initialize( + Mockito + .doNothing() + .when(client) + .initialize( ArgumentMatchers.any(CIMObjectPath.class), ArgumentMatchers.any(Subject.class), - ArgumentMatchers.eq(new Locale[] {Locale.ENGLISH})); + ArgumentMatchers.eq(new Locale[] { Locale.ENGLISH }) + ); wbemClient.connect(url, username, password, timeout); } @@ -56,43 +69,63 @@ void testExecuteWql() throws Exception { final WqlQuery queryHandler = WqlQuery.parseQuery("Select * from EMC_StorageSystem"); Assertions.assertThrows(IllegalArgumentException.class, () -> new WbemClient().executeWql(null, namespace, null)); - Assertions.assertThrows(IllegalArgumentException.class, () -> new WbemClient().executeWql(queryHandler, null, null)); + Assertions.assertThrows( + IllegalArgumentException.class, + () -> new WbemClient().executeWql(queryHandler, null, null) + ); - Assertions.assertThrows(IllegalStateException.class, () -> new WbemClient().executeWql(queryHandler, namespace, null)); + Assertions.assertThrows( + IllegalStateException.class, + () -> new WbemClient().executeWql(queryHandler, namespace, null) + ); final URL url = new URL("https://host:8080"); final String username = "user"; - final char[] password = {'p', 'a', 's', 's'}; - int timeout = 60*1000; + final char[] password = { 'p', 'a', 's', 's' }; + int timeout = 60 * 1000; final WBEMClient client = Mockito.mock(WBEMClient.class); final CloseableIterator iterator = Mockito.mock(CloseableIterator.class); final WbemQueryResult result = Mockito.mock(WbemQueryResult.class); - try (final MockedStatic mockedWBEMClientFactory = Mockito.mockStatic(WBEMClientFactory.class); - final MockedStatic mockedMatsyaWbemClient = Mockito.mockStatic(WbemClient.class); - final WbemClient matsyaWbemClient =new WbemClient()) { - + try ( + final MockedStatic mockedWBEMClientFactory = Mockito.mockStatic(WBEMClientFactory.class); + final MockedStatic mockedMatsyaWbemClient = Mockito.mockStatic(WbemClient.class); + final WbemClient matsyaWbemClient = new WbemClient() + ) { mockedWBEMClientFactory.when(() -> WBEMClientFactory.getClient("CIM-XML")).thenReturn(client); Mockito.doNothing().when(client).setProperty(WBEMClientConstants.PROP_TIMEOUT, String.valueOf(timeout)); - Mockito.doNothing().when(client).initialize( + Mockito + .doNothing() + .when(client) + .initialize( ArgumentMatchers.any(CIMObjectPath.class), ArgumentMatchers.any(Subject.class), - ArgumentMatchers.eq(new Locale[] {Locale.ENGLISH})); + ArgumentMatchers.eq(new Locale[] { Locale.ENGLISH }) + ); - Mockito.doReturn(iterator).when(client).enumerateInstances( + Mockito + .doReturn(iterator) + .when(client) + .enumerateInstances( ArgumentMatchers.any(CIMObjectPath.class), ArgumentMatchers.eq(true), ArgumentMatchers.eq(false), ArgumentMatchers.eq(true), - ArgumentMatchers.eq(queryHandler.getPropertiesArray())); - - mockedMatsyaWbemClient.when(() -> WbemClient.enumerateInstances( - ArgumentMatchers.any(WqlQuery.class), - ArgumentMatchers.any(CloseableIterator.class), - ArgumentMatchers.isNull())) - .thenReturn(result); + ArgumentMatchers.eq(queryHandler.getPropertiesArray()) + ); + + mockedMatsyaWbemClient + .when( + () -> + WbemClient.enumerateInstances( + ArgumentMatchers.any(WqlQuery.class), + ArgumentMatchers.any(CloseableIterator.class), + ArgumentMatchers.isNull() + ) + ) + .thenReturn(result); matsyaWbemClient.connect(url, username, password, timeout); @@ -105,8 +138,8 @@ void testExecuteWql() throws Exception { void testGetAssociators() throws Exception { final URL url = new URL("https://host:8080"); final String username = "user"; - final char[] password = {'p', 'a', 's', 's'}; - int timeout = 60*1000; + final char[] password = { 'p', 'a', 's', 's' }; + int timeout = 60 * 1000; final WBEMClient client = Mockito.mock(WBEMClient.class); final WqlQuery queryHandler = WqlQuery.parseQuery("Select * from EMC_StorageSystem"); final EnumerateResponse response = Mockito.mock(EnumerateResponse.class); @@ -114,25 +147,42 @@ void testGetAssociators() throws Exception { final WbemQueryResult result = Mockito.mock(WbemQueryResult.class); final String objectPathAssociators = "objectPathAssociators"; - Assertions.assertThrows(IllegalArgumentException.class, () -> new WbemClient().getAssociators(null, objectPathAssociators, null)); - Assertions.assertThrows(IllegalArgumentException.class, () -> new WbemClient().getAssociators(queryHandler, null, null)); - - Assertions.assertThrows(IllegalStateException.class, () -> new WbemClient().getAssociators(queryHandler, objectPathAssociators, null)); - - try (final MockedStatic mockedWBEMClientFactory = Mockito.mockStatic(WBEMClientFactory.class); - final MockedStatic mockedMatsyaWbemClient = Mockito.mockStatic(WbemClient.class); - final WbemClient matsyaWbemClient = new WbemClient()) { - + Assertions.assertThrows( + IllegalArgumentException.class, + () -> new WbemClient().getAssociators(null, objectPathAssociators, null) + ); + Assertions.assertThrows( + IllegalArgumentException.class, + () -> new WbemClient().getAssociators(queryHandler, null, null) + ); + + Assertions.assertThrows( + IllegalStateException.class, + () -> new WbemClient().getAssociators(queryHandler, objectPathAssociators, null) + ); + + try ( + final MockedStatic mockedWBEMClientFactory = Mockito.mockStatic(WBEMClientFactory.class); + final MockedStatic mockedMatsyaWbemClient = Mockito.mockStatic(WbemClient.class); + final WbemClient matsyaWbemClient = new WbemClient() + ) { mockedWBEMClientFactory.when(() -> WBEMClientFactory.getClient("CIM-XML")).thenReturn(client); Mockito.doNothing().when(client).setProperty(WBEMClientConstants.PROP_TIMEOUT, String.valueOf(timeout)); - Mockito.doNothing().when(client).initialize( + Mockito + .doNothing() + .when(client) + .initialize( ArgumentMatchers.any(CIMObjectPath.class), ArgumentMatchers.any(Subject.class), - ArgumentMatchers.eq(new Locale[] {Locale.ENGLISH})); + ArgumentMatchers.eq(new Locale[] { Locale.ENGLISH }) + ); - Mockito.doReturn(response).when(client).associators( + Mockito + .doReturn(response) + .when(client) + .associators( ArgumentMatchers.any(CIMObjectPath.class), ArgumentMatchers.eq(queryHandler.getClassName()), ArgumentMatchers.isNull(), @@ -144,20 +194,25 @@ void testGetAssociators() throws Exception { ArgumentMatchers.isNull(), ArgumentMatchers.isNull(), ArgumentMatchers.eq(false), - ArgumentMatchers.isNull()); + ArgumentMatchers.isNull() + ); Mockito.doReturn(iterator).when(response).getResponses(); - mockedMatsyaWbemClient.when(() -> WbemClient.enumerateInstances( - ArgumentMatchers.any(WqlQuery.class), - ArgumentMatchers.any(CloseableIterator.class), - ArgumentMatchers.isNull())) - .thenReturn(result); + mockedMatsyaWbemClient + .when( + () -> + WbemClient.enumerateInstances( + ArgumentMatchers.any(WqlQuery.class), + ArgumentMatchers.any(CloseableIterator.class), + ArgumentMatchers.isNull() + ) + ) + .thenReturn(result); matsyaWbemClient.connect(url, username, password, timeout); Assertions.assertEquals(result, matsyaWbemClient.getAssociators(queryHandler, objectPathAssociators, null)); } } - } diff --git a/src/test/java/org/metricshub/wbem/WbemExecutorTest.java b/src/test/java/org/metricshub/wbem/WbemExecutorTest.java index b94802b..0536132 100644 --- a/src/test/java/org/metricshub/wbem/WbemExecutorTest.java +++ b/src/test/java/org/metricshub/wbem/WbemExecutorTest.java @@ -8,15 +8,14 @@ import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; - import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.metricshub.wbem.client.WbemExecutor; +import org.metricshub.wbem.client.WbemQueryResult; import org.metricshub.wbem.javax.wbem.WBEMException; import org.mockito.ArgumentMatchers; import org.mockito.MockedStatic; import org.mockito.Mockito; -import org.metricshub.wbem.client.WbemQueryResult; class WbemExecutorTest { @@ -25,16 +24,31 @@ class WbemExecutorTest { void testExecuteWql() throws Exception { final URL url = new URL("https://host:8080"); final String username = "user"; - final char[] password = {'p', 'a', 's', 's'}; - int timeout = 60*1000; + final char[] password = { 'p', 'a', 's', 's' }; + int timeout = 60 * 1000; final String namespace = "root/emc"; final String query = "Select * from EMC_StorageSystem"; - Assertions.assertThrows(IllegalArgumentException.class, () -> WbemExecutor.executeWql(null, namespace, username, password, query, timeout, null)); - Assertions.assertThrows(IllegalArgumentException.class, () -> WbemExecutor.executeWql(url, namespace, null, password, query, timeout, null)); - Assertions.assertThrows(IllegalArgumentException.class, () -> WbemExecutor.executeWql(url, namespace, username, null, query, timeout, null)); - Assertions.assertThrows(IllegalArgumentException.class, () -> WbemExecutor.executeWql(url, namespace, username, password, null, timeout, null)); - Assertions.assertThrows(TimeoutException.class, () -> WbemExecutor.executeWql(url, namespace, username, password, query, 0, null)); + Assertions.assertThrows( + IllegalArgumentException.class, + () -> WbemExecutor.executeWql(null, namespace, username, password, query, timeout, null) + ); + Assertions.assertThrows( + IllegalArgumentException.class, + () -> WbemExecutor.executeWql(url, namespace, null, password, query, timeout, null) + ); + Assertions.assertThrows( + IllegalArgumentException.class, + () -> WbemExecutor.executeWql(url, namespace, username, null, query, timeout, null) + ); + Assertions.assertThrows( + IllegalArgumentException.class, + () -> WbemExecutor.executeWql(url, namespace, username, password, null, timeout, null) + ); + Assertions.assertThrows( + TimeoutException.class, + () -> WbemExecutor.executeWql(url, namespace, username, password, query, 0, null) + ); final WbemQueryResult result = Mockito.mock(WbemQueryResult.class); final Future handler = Mockito.mock(Future.class); @@ -50,8 +64,9 @@ void testExecuteWql() throws Exception { Mockito.doThrow(executionException).when(handler).get(timeout, TimeUnit.MILLISECONDS); Assertions.assertThrows( - WBEMException.class, - () -> WbemExecutor.executeWql(url, namespace, username, password, query, timeout, null)); + WBEMException.class, + () -> WbemExecutor.executeWql(url, namespace, username, password, query, timeout, null) + ); } try (final MockedStatic mockedExecutorService = Mockito.mockStatic(Executors.class)) { @@ -64,8 +79,9 @@ void testExecuteWql() throws Exception { Mockito.doThrow(executionException).when(handler).get(timeout, TimeUnit.MILLISECONDS); Assertions.assertThrows( - RuntimeException.class, - () -> WbemExecutor.executeWql(url, namespace, username, password, query, timeout, null)); + RuntimeException.class, + () -> WbemExecutor.executeWql(url, namespace, username, password, query, timeout, null) + ); } try (final MockedStatic mockedExecutorService = Mockito.mockStatic(Executors.class)) { @@ -75,8 +91,9 @@ void testExecuteWql() throws Exception { Mockito.doReturn(result).when(handler).get(timeout, TimeUnit.MILLISECONDS); Assertions.assertEquals( - result, - WbemExecutor.executeWql(url, namespace, username, password, query, timeout, null)); + result, + WbemExecutor.executeWql(url, namespace, username, password, query, timeout, null) + ); } } } diff --git a/src/test/java/org/metricshub/wbem/WqlQueryTest.java b/src/test/java/org/metricshub/wbem/WqlQueryTest.java index beb278f..566e2c6 100644 --- a/src/test/java/org/metricshub/wbem/WqlQueryTest.java +++ b/src/test/java/org/metricshub/wbem/WqlQueryTest.java @@ -3,7 +3,6 @@ import java.util.Arrays; import java.util.LinkedHashSet; import java.util.stream.Collectors; - import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.metricshub.wbem.client.WqlQuery; @@ -58,8 +57,11 @@ void testSelect() throws Exception { final WqlQuery wqlQuery = WqlQuery.parseQuery(" select Antecedent, Dependent from IBMTSDS_SHWIDToSPC"); Assertions.assertEquals("IBMTSDS_SHWIDToSPC", wqlQuery.getClassName()); - Assertions.assertArrayEquals(new String[] {"Antecedent", "Dependent"}, wqlQuery.getPropertiesArray()); - Assertions.assertEquals(Arrays.asList("Antecedent", "Dependent").stream().collect(Collectors.toCollection(LinkedHashSet::new)), wqlQuery.getProperties()); + Assertions.assertArrayEquals(new String[] { "Antecedent", "Dependent" }, wqlQuery.getPropertiesArray()); + Assertions.assertEquals( + Arrays.asList("Antecedent", "Dependent").stream().collect(Collectors.toCollection(LinkedHashSet::new)), + wqlQuery.getProperties() + ); Assertions.assertEquals(Arrays.asList("Antecedent", "Dependent"), wqlQuery.getOriginalProperties()); Assertions.assertFalse(wqlQuery.hasDuplicateProperties()); } @@ -67,8 +69,11 @@ void testSelect() throws Exception { final WqlQuery wqlQuery = WqlQuery.parseQuery(" SELECT __Path, Name, __PATH from EMC_StorageSystem "); Assertions.assertEquals("EMC_StorageSystem", wqlQuery.getClassName()); - Assertions.assertArrayEquals(new String[] {"Name"}, wqlQuery.getPropertiesArray()); - Assertions.assertEquals(Arrays.asList("__Path", "Name").stream().collect(Collectors.toCollection(LinkedHashSet::new)), wqlQuery.getProperties()); + Assertions.assertArrayEquals(new String[] { "Name" }, wqlQuery.getPropertiesArray()); + Assertions.assertEquals( + Arrays.asList("__Path", "Name").stream().collect(Collectors.toCollection(LinkedHashSet::new)), + wqlQuery.getProperties() + ); Assertions.assertEquals(Arrays.asList("__Path", "Name", "__PATH"), wqlQuery.getOriginalProperties()); Assertions.assertTrue(wqlQuery.hasDuplicateProperties()); } From 2de4f017a0f58755b233fd0eaed14c3aa9b010ef Mon Sep 17 00:00:00 2001 From: Elyes Cherfa Date: Mon, 31 Mar 2025 23:49:40 +0200 Subject: [PATCH 3/6] Issue #35: Rebrand Codebase from Sentry Software to MetricsHub * Removed some useless code to reduce the number of spotbugs reports. * Tested the build and the client. --- src/main/java/org/metricshub/wbem/javax/cim/CIMDataType.java | 2 +- src/main/java/org/metricshub/wbem/javax/cim/CIMDateTime.java | 2 +- src/main/java/org/metricshub/wbem/javax/cim/CIMElement.java | 2 +- src/main/java/org/metricshub/wbem/javax/cim/CIMFlavor.java | 2 +- src/main/java/org/metricshub/wbem/javax/cim/CIMInstance.java | 2 +- .../java/org/metricshub/wbem/javax/cim/CIMObjectPath.java | 2 +- src/main/java/org/metricshub/wbem/javax/cim/CIMScope.java | 2 +- .../org/metricshub/wbem/javax/wbem/CloseableIterator.java | 4 ++-- .../metricshub/wbem/javax/wbem/client/PasswordCredential.java | 2 +- .../org/metricshub/wbem/javax/wbem/client/RoleCredential.java | 2 +- .../org/metricshub/wbem/javax/wbem/client/RolePrincipal.java | 2 +- .../org/metricshub/wbem/javax/wbem/client/UserPrincipal.java | 2 +- .../metricshub/wbem/javax/wbem/client/WBEMClientFactory.java | 2 +- .../wbem/javax/wbem/listener/WBEMListenerFactory.java | 2 +- .../sblim/cimclient/internal/discovery/slp/DiscovererSLP.java | 2 +- .../wbem/sblim/cimclient/internal/uri/URIString.java | 2 +- 16 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/main/java/org/metricshub/wbem/javax/cim/CIMDataType.java b/src/main/java/org/metricshub/wbem/javax/cim/CIMDataType.java index 1917b0b..cd68ad6 100644 --- a/src/main/java/org/metricshub/wbem/javax/cim/CIMDataType.java +++ b/src/main/java/org/metricshub/wbem/javax/cim/CIMDataType.java @@ -135,7 +135,7 @@ * mapping of CIM data type to Java * */ -public class CIMDataType extends Object implements Serializable { +public class CIMDataType implements Serializable { private static final long serialVersionUID = 1L; /** diff --git a/src/main/java/org/metricshub/wbem/javax/cim/CIMDateTime.java b/src/main/java/org/metricshub/wbem/javax/cim/CIMDateTime.java index 15bbaca..df20a22 100644 --- a/src/main/java/org/metricshub/wbem/javax/cim/CIMDateTime.java +++ b/src/main/java/org/metricshub/wbem/javax/cim/CIMDateTime.java @@ -80,7 +80,7 @@ * minutes, 12 seconds would be: 00000001132312.000000:000. A UTC offset of zero * is always used for interval properties. */ -public abstract class CIMDateTime extends Object implements Serializable, Comparable { +public abstract class CIMDateTime implements Serializable, Comparable { private static final long serialVersionUID = 3424668043014662166L; /** diff --git a/src/main/java/org/metricshub/wbem/javax/cim/CIMElement.java b/src/main/java/org/metricshub/wbem/javax/cim/CIMElement.java index ba02dc0..c0e2b07 100644 --- a/src/main/java/org/metricshub/wbem/javax/cim/CIMElement.java +++ b/src/main/java/org/metricshub/wbem/javax/cim/CIMElement.java @@ -57,7 +57,7 @@ * href=http://www.dmtf.org/standards/published_documents/DSP0004V2.3_final.pdf * >DSP004). */ -public abstract class CIMElement extends Object implements Serializable, Comparable { +public abstract class CIMElement implements Serializable, Comparable { private static final long serialVersionUID = -3310480832682118922L; private String iName; diff --git a/src/main/java/org/metricshub/wbem/javax/cim/CIMFlavor.java b/src/main/java/org/metricshub/wbem/javax/cim/CIMFlavor.java index 6f152ce..469732e 100644 --- a/src/main/java/org/metricshub/wbem/javax/cim/CIMFlavor.java +++ b/src/main/java/org/metricshub/wbem/javax/cim/CIMFlavor.java @@ -53,7 +53,7 @@ * >DSP004). CIM flavors specify overriding and inheritance rules. These * rules specify how qualifiers are transmitted from classes to derived classes. */ -public class CIMFlavor extends Object implements Serializable { +public class CIMFlavor implements Serializable { private static final long serialVersionUID = -4177389103635687939l; /** diff --git a/src/main/java/org/metricshub/wbem/javax/cim/CIMInstance.java b/src/main/java/org/metricshub/wbem/javax/cim/CIMInstance.java index cd7c846..9bb0280 100644 --- a/src/main/java/org/metricshub/wbem/javax/cim/CIMInstance.java +++ b/src/main/java/org/metricshub/wbem/javax/cim/CIMInstance.java @@ -64,7 +64,7 @@ * href=http://www.dmtf.org/standards/published_documents/DSP0004V2.3_final.pdf * >DSP004). */ -public class CIMInstance extends Object implements CIMNamedElementInterface, Serializable { +public class CIMInstance implements CIMNamedElementInterface, Serializable { private static final long serialVersionUID = -249160087013230559L; private static final CIMProperty[] EMPTY_PROP_A = new CIMProperty[0]; diff --git a/src/main/java/org/metricshub/wbem/javax/cim/CIMObjectPath.java b/src/main/java/org/metricshub/wbem/javax/cim/CIMObjectPath.java index f395b8f..be0192f 100644 --- a/src/main/java/org/metricshub/wbem/javax/cim/CIMObjectPath.java +++ b/src/main/java/org/metricshub/wbem/javax/cim/CIMObjectPath.java @@ -116,7 +116,7 @@ *
    • * CreationClassName=My_ComputerSystem
    • */ -public class CIMObjectPath extends Object implements Serializable { +public class CIMObjectPath implements Serializable { private static final long serialVersionUID = 4593259690658425064L; private String iScheme, iHost, iPort, iNamespace, iObjectName, iXmlSchemaName; diff --git a/src/main/java/org/metricshub/wbem/javax/cim/CIMScope.java b/src/main/java/org/metricshub/wbem/javax/cim/CIMScope.java index f898d54..319681c 100644 --- a/src/main/java/org/metricshub/wbem/javax/cim/CIMScope.java +++ b/src/main/java/org/metricshub/wbem/javax/cim/CIMScope.java @@ -52,7 +52,7 @@ * >DSP004). This class is used in a CIMQualifierType to define * what elements the qualifier can be applied to. */ -public class CIMScope extends Object implements Serializable { +public class CIMScope implements Serializable { private static final long serialVersionUID = -4563643521754840535l; /** diff --git a/src/main/java/org/metricshub/wbem/javax/wbem/CloseableIterator.java b/src/main/java/org/metricshub/wbem/javax/wbem/CloseableIterator.java index 59a3bbc..292a25d 100644 --- a/src/main/java/org/metricshub/wbem/javax/wbem/CloseableIterator.java +++ b/src/main/java/org/metricshub/wbem/javax/wbem/CloseableIterator.java @@ -65,7 +65,7 @@ public interface CloseableIterator extends Iterator { * implementation to do any cleanup and disconnect from any source that it * may be using. */ - public void close(); + void close(); /** * If next() or hasNext() throws a @@ -74,5 +74,5 @@ public interface CloseableIterator extends Iterator { * * @return The WBEMException or null if one was not thrown. */ - public WBEMException getWBEMException(); + WBEMException getWBEMException(); } diff --git a/src/main/java/org/metricshub/wbem/javax/wbem/client/PasswordCredential.java b/src/main/java/org/metricshub/wbem/javax/wbem/client/PasswordCredential.java index c37e1d0..be60024 100644 --- a/src/main/java/org/metricshub/wbem/javax/wbem/client/PasswordCredential.java +++ b/src/main/java/org/metricshub/wbem/javax/wbem/client/PasswordCredential.java @@ -54,7 +54,7 @@ * password is used to authenticate the UserPrincipal. * */ -public class PasswordCredential extends Object { +public class PasswordCredential { private String iPw; private String iHostname; diff --git a/src/main/java/org/metricshub/wbem/javax/wbem/client/RoleCredential.java b/src/main/java/org/metricshub/wbem/javax/wbem/client/RoleCredential.java index 2f38a39..8a4a64d 100644 --- a/src/main/java/org/metricshub/wbem/javax/wbem/client/RoleCredential.java +++ b/src/main/java/org/metricshub/wbem/javax/wbem/client/RoleCredential.java @@ -54,7 +54,7 @@ * This should only be used when a client is assuming a role on a WBEM Server * that requires a password. */ -public class RoleCredential extends Object { +public class RoleCredential { private String iCredential; private String iHostname; diff --git a/src/main/java/org/metricshub/wbem/javax/wbem/client/RolePrincipal.java b/src/main/java/org/metricshub/wbem/javax/wbem/client/RolePrincipal.java index b547524..5523c43 100644 --- a/src/main/java/org/metricshub/wbem/javax/wbem/client/RolePrincipal.java +++ b/src/main/java/org/metricshub/wbem/javax/wbem/client/RolePrincipal.java @@ -51,7 +51,7 @@ * RolePrincipal includes the role and optionally the host * information for which the role is used to authenticate. */ -public class RolePrincipal extends Object implements Principal { +public class RolePrincipal implements Principal { private String iRole; private String iHost; diff --git a/src/main/java/org/metricshub/wbem/javax/wbem/client/UserPrincipal.java b/src/main/java/org/metricshub/wbem/javax/wbem/client/UserPrincipal.java index df2efad..ebc9e4c 100644 --- a/src/main/java/org/metricshub/wbem/javax/wbem/client/UserPrincipal.java +++ b/src/main/java/org/metricshub/wbem/javax/wbem/client/UserPrincipal.java @@ -52,7 +52,7 @@ * UserPrincipal includes the username and optionally the host * information for which the username is used to authenticate. */ -public class UserPrincipal extends Object implements Principal { +public class UserPrincipal implements Principal { private String iUserName; private String iHostName; diff --git a/src/main/java/org/metricshub/wbem/javax/wbem/client/WBEMClientFactory.java b/src/main/java/org/metricshub/wbem/javax/wbem/client/WBEMClientFactory.java index 2eb4817..08d00db 100644 --- a/src/main/java/org/metricshub/wbem/javax/wbem/client/WBEMClientFactory.java +++ b/src/main/java/org/metricshub/wbem/javax/wbem/client/WBEMClientFactory.java @@ -71,7 +71,7 @@ * */ -public class WBEMClientFactory extends Object { +public class WBEMClientFactory { private static final String[] cProtocols = { WBEMClientConstants.PROTOCOL_CIMXML }; /** diff --git a/src/main/java/org/metricshub/wbem/javax/wbem/listener/WBEMListenerFactory.java b/src/main/java/org/metricshub/wbem/javax/wbem/listener/WBEMListenerFactory.java index 26ae3d0..a479c34 100644 --- a/src/main/java/org/metricshub/wbem/javax/wbem/listener/WBEMListenerFactory.java +++ b/src/main/java/org/metricshub/wbem/javax/wbem/listener/WBEMListenerFactory.java @@ -68,7 +68,7 @@ * int port = api.addListener(MyListener, 1234, protocol); * */ -public class WBEMListenerFactory extends Object { +public class WBEMListenerFactory { private static final String[] PROTOCOLS = { WBEMClientConstants.PROTOCOL_CIMXML }; /** diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/discovery/slp/DiscovererSLP.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/discovery/slp/DiscovererSLP.java index 52a3a74..d4b9775 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/discovery/slp/DiscovererSLP.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/discovery/slp/DiscovererSLP.java @@ -69,7 +69,7 @@ * * @since 2.0.2 */ -public class DiscovererSLP extends Object implements Discoverer { +public class DiscovererSLP implements Discoverer { private static final String SERVICE_WBEM = "service:wbem"; private static final ServiceType SERVICE_TYPE = new ServiceType(SERVICE_WBEM); diff --git a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/URIString.java b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/URIString.java index 4e81ed4..b2aaaeb 100644 --- a/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/URIString.java +++ b/src/main/java/org/metricshub/wbem/sblim/cimclient/internal/uri/URIString.java @@ -47,7 +47,7 @@ * Class URIString is responsible for wrapping the WBEM-URI string. It has * methods which help in parsing. */ -public class URIString extends Object implements CharSequence { +public class URIString implements CharSequence { /** * Ctor. From 93de000e3e5b3c66588dc890c02a3904dfd56c18 Mon Sep 17 00:00:00 2001 From: Elyes Cherfa Date: Tue, 1 Apr 2025 10:55:29 +0200 Subject: [PATCH 4/6] Issue #35: Rebrand Codebase from Sentry Software to MetricsHub * Fixed a wrong package name in pom.xml * Tested the update. --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index b80fce4..0314bc8 100644 --- a/pom.xml +++ b/pom.xml @@ -119,7 +119,7 @@ ${maven.compiler.target} public true - org.metricshub.wbem-java.javax.*:org.metricshub.wbem-java.sblim.* + org.metricshub.wbem.javax.*:org.metricshub.wbem.sblim.* From ea1aaea30a8031d18307b5888e71617c0c69b895 Mon Sep 17 00:00:00 2001 From: Nassim Boutekedjiret Date: Tue, 1 Apr 2025 14:34:48 +0200 Subject: [PATCH 5/6] Issue #35: Update developer email addresses in `pom.xml` - Changed Bertrand Martin's email - Updated Nassim BOUTEKEDJIRET's email - Modified `pom.xml` file - Ensured consistency in developer contact info - Maintainer roles remain unchanged - No other changes made --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 0314bc8..4806891 100644 --- a/pom.xml +++ b/pom.xml @@ -44,14 +44,14 @@ Bertrand Martin (@bertysentry) - bertrand@sentrysoftware.com + bertrand@metricshub.com maintainer Nassim BOUTEKEDJIRET (@NassimBtk) - nassim@sentrysoftware.com + nassim@metricshub.com maintainer From d6b9916af0e8255f05b1643752c9179669f2612a Mon Sep 17 00:00:00 2001 From: Nassim Boutekedjiret Date: Tue, 1 Apr 2025 14:42:27 +0200 Subject: [PATCH 6/6] Issue #35: Update URLs in `pom.xml` for organization and project links - Change organization URL to metricshub.com - Update project URL to wbem-java - Ensure consistency in URL format - Reflect new URL structure in project metadata - Maintain project inception year as 2023 - No changes to other project metadata --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 4806891..1867c0d 100644 --- a/pom.xml +++ b/pom.xml @@ -16,10 +16,10 @@ MetricsHub - https://metricshub.org + https://metricshub.com - https://metricshub.org/wbem + https://metricshub.org/wbem-java 2023